Ejemplo n.º 1
0
Archivo: h5.c Proyecto: bboozzoo/zephyr
static void ack_timeout(struct k_work *work)
{
	ARG_UNUSED(work);

	BT_DBG("");

	h5_send(NULL, HCI_3WIRE_ACK_PKT, 0);

	/* Analyze stacks */
	stack_analyze("tx_stack", tx_stack, sizeof(tx_stack));
	stack_analyze("rx_stack", rx_stack, sizeof(rx_stack));
}
Ejemplo n.º 2
0
void on_nble_gap_disconnect_evt(const struct nble_gap_disconnect_evt *evt)
{
	struct bt_conn *conn;

#if 0
	/* Nordic has no disconnection error */
	if (evt->status) {
		return;
	}
#endif

	conn = bt_conn_lookup_handle(evt->conn_handle);
	if (!conn) {
		BT_DBG("Unable to look up conn with handle %u",
		       evt->conn_handle);
		return;
	}
#if 0
	/* Check stacks usage (no-ops if not enabled) */
	stack_analyze("rx stack", rx_fiber_stack, sizeof(rx_fiber_stack));
	stack_analyze("cmd rx stack", rx_prio_fiber_stack,
		      sizeof(rx_prio_fiber_stack));
	stack_analyze("cmd tx stack", cmd_tx_fiber_stack,
		      sizeof(cmd_tx_fiber_stack));
	stack_analyze("conn tx stack", conn->stack, sizeof(conn->stack));

#endif

	conn->err = evt->hci_reason;
	bt_conn_set_state(conn, BT_CONN_DISCONNECTED);
	conn->handle = 0;

#if 0
	/* Only LE supported */
	if (conn->type != BT_CONN_TYPE_LE) {
		bt_conn_unref(conn);
		return;
	}
	/* TODO enabled when autoconn is supported */
	if (atomic_test_bit(conn->flags, BT_CONN_AUTO_CONNECT)) {
		bt_conn_set_state(conn, BT_CONN_CONNECT_SCAN);
		bt_le_scan_update(false);
	}
#endif

	bt_conn_unref(conn);
	if (atomic_test_bit(bt_dev.flags, BT_DEV_KEEP_ADVERTISING)) {
		set_advertise_enable();
	}
}
Ejemplo n.º 3
0
static void ack_fiber(int arg1, int arg2)
{
	ARG_UNUSED(arg1);
	ARG_UNUSED(arg2);

	BT_DBG("");

	h5.ack_to = NULL;

	h5_send(NULL, HCI_3WIRE_ACK_PKT, 0);

	/* Analyze stacks */
	stack_analyze("ack_stack", ack_stack, sizeof(ack_stack));
	stack_analyze("tx_stack", tx_stack, sizeof(tx_stack));
	stack_analyze("rx_stack", rx_stack, sizeof(rx_stack));
	stack_analyze("retx_stack", retx_stack, sizeof(retx_stack));
}
Ejemplo n.º 4
0
static void thread_stack_dump(const struct k_thread *thread, void *user_data)
{
    const char *th_name = k_thread_name_get((k_tid_t)thread);

    if (th_name == NULL) {
        static char tid[9];
        snprintf(tid, sizeof(tid), "%08x", (int)thread);
        th_name = tid;
    }

    stack_analyze(th_name, (char*)thread->stack_info.start, thread->stack_info.size);
}
Ejemplo n.º 5
0
void k_call_stacks_analyze(void)
{
#if defined(CONFIG_INIT_STACKS) && defined(CONFIG_PRINTK)
	extern char sys_work_q_stack[CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE];
#if defined(CONFIG_ARC) && CONFIG_RGF_NUM_BANKS != 1
	extern char _firq_stack[CONFIG_FIRQ_STACK_SIZE];
#endif /* CONFIG_ARC */

	printk("Kernel stacks:\n");
	stack_analyze("main     ", _main_stack, sizeof(_main_stack));
	stack_analyze("idle     ", _idle_stack, sizeof(_idle_stack));
#if defined(CONFIG_ARC) && CONFIG_RGF_NUM_BANKS != 1
	stack_analyze("firq     ", _firq_stack, sizeof(_firq_stack));
#endif /* CONFIG_ARC */
	stack_analyze("interrupt", _interrupt_stack,
		      sizeof(_interrupt_stack));
	stack_analyze("workqueue", sys_work_q_stack,
		      sizeof(sys_work_q_stack));

#endif /* CONFIG_INIT_STACKS && CONFIG_PRINTK */
}
Ejemplo n.º 6
0
/* Delayed fiber taking care about retransmitting packets */
static void retx_fiber(int arg1, int arg2)
{
	ARG_UNUSED(arg1);
	ARG_UNUSED(arg2);

	BT_DBG("unack_queue_len %u", unack_queue_len);

	h5.retx_to = NULL;

	if (unack_queue_len) {
		struct nano_fifo tmp_queue;
		struct net_buf *buf;

		nano_fifo_init(&tmp_queue);

		/* Queue to temperary queue */
		while ((buf = nano_fifo_get(&h5.tx_queue, TICKS_NONE))) {
			nano_fifo_put(&tmp_queue, buf);
		}

		/* Queue unack packets to the beginning of the queue */
		while ((buf = nano_fifo_get(&h5.unack_queue, TICKS_NONE))) {
			/* include also packet type */
			net_buf_push(buf, sizeof(uint8_t));
			nano_fifo_put(&h5.tx_queue, buf);
			h5.tx_seq = (h5.tx_seq - 1) & 0x07;
			unack_queue_len--;
		}

		/* Queue saved packets from temp queue */
		while ((buf = nano_fifo_get(&tmp_queue, TICKS_NONE))) {
			nano_fifo_put(&h5.tx_queue, buf);
		}

		/* Analyze stack */
		stack_analyze("retx_stack", retx_stack, sizeof(retx_stack));
	}
}