{
btm_cb.devcb.state = BTM_DEV_STATE_WAIT_RESET_CMPLT;
- /* flush out the command complete queue and command transmit queue */
- btu_hcif_flush_cmd_queue();
-
/* Start reset timer. When timer expires we will send first command */
/* from the setup sequence */
{
btm_simple_pair_complete(p);
}
-/*******************************************************************************
-**
-** Function btu_hcif_flush_cmd_queue
-**
-** Description Flush the HCI command complete queue and transmit queue when
-** needed.
-**
-** Returns void
-**
-*******************************************************************************/
-void btu_hcif_flush_cmd_queue(void)
-{
- BT_HDR *p_cmd;
-
- btu_cb.hci_cmd_cb[0].cmd_window = 0;
- while ((p_cmd = (BT_HDR *) GKI_dequeue (&btu_cb.hci_cmd_cb[0].cmd_cmpl_q)) != NULL)
- {
- GKI_freebuf (p_cmd);
- }
- while ((p_cmd = (BT_HDR *) GKI_dequeue (&btu_cb.hci_cmd_cb[0].cmd_xmit_q)) != NULL)
- {
- GKI_freebuf (p_cmd);
- }
-}
/*******************************************************************************
**
#endif
btu_cb.trace_level = HCI_INITIAL_TRACE_LEVEL;
- for (int i = 0; i < BTU_MAX_LOCAL_CTRLS; ++i) {
- GKI_init_q(&btu_cb.hci_cmd_cb[i].cmd_xmit_q);
- GKI_init_q(&btu_cb.hci_cmd_cb[i].cmd_cmpl_q);
- btu_cb.hci_cmd_cb[i].cmd_window = 1;
- }
-
btu_bta_msg_queue = fixed_queue_new(SIZE_MAX);
if (btu_bta_msg_queue == NULL)
goto error_exit;
}
void BTU_ShutDown(void) {
- for (int i = 0; i < BTU_MAX_LOCAL_CTRLS; ++i) {
- while (!GKI_queue_is_empty(&btu_cb.hci_cmd_cb[i].cmd_xmit_q))
- GKI_freebuf(GKI_dequeue(&btu_cb.hci_cmd_cb[i].cmd_xmit_q));
- while (!GKI_queue_is_empty(&btu_cb.hci_cmd_cb[i].cmd_cmpl_q))
- GKI_freebuf(GKI_dequeue(&btu_cb.hci_cmd_cb[i].cmd_cmpl_q));
- }
-
btu_task_shut_down(NULL);
fixed_queue_free(btu_bta_msg_queue, NULL);
*******************************************************************************/
void btu_check_bt_sleep (void)
{
- if ((GKI_queue_is_empty(&btu_cb.hci_cmd_cb[LOCAL_BR_EDR_CONTROLLER_ID].cmd_cmpl_q)
- && GKI_queue_is_empty(&btu_cb.hci_cmd_cb[LOCAL_BR_EDR_CONTROLLER_ID].cmd_xmit_q)))
+ // TODO(zachoverflow) take pending commands into account?
+ if (l2cb.controller_xmit_window == l2cb.num_lm_acl_bufs)
{
- if (l2cb.controller_xmit_window == l2cb.num_lm_acl_bufs)
- {
- /* enable dev to sleep in the cmd cplt and cmd status only and num cplt packet */
- bte_main_lpm_allow_bt_device_sleep();
- }
+ bte_main_lpm_allow_bt_device_sleep();
}
}
#endif
#define NFC_CONTROLLER_ID (1)
#define BTU_MAX_LOCAL_CTRLS (1 + NFC_MAX_LOCAL_CTRLS) /* only BR/EDR */
-/* AMP HCI control block */
-typedef struct
-{
- BUFFER_Q cmd_xmit_q;
- BUFFER_Q cmd_cmpl_q;
- UINT16 cmd_window;
- TIMER_LIST_ENT cmd_cmpl_timer; /* Command complete timer */
-} tHCI_CMD_CB;
-
/* Define structure holding BTU variables
*/
typedef struct
BOOLEAN reset_complete; /* TRUE after first ack from device received */
UINT8 trace_level; /* Trace level for HCI layer */
-
- tHCI_CMD_CB hci_cmd_cb[BTU_MAX_LOCAL_CTRLS]; /* including BR/EDR */
} tBTU_CB;
#ifdef __cplusplus
BTU_API extern UINT32 btu_remaining_time (TIMER_LIST_ENT *p_tle);
BTU_API extern void btu_uipc_rx_cback(BT_HDR *p_msg);
-BTU_API extern void btu_hcif_flush_cmd_queue(void);
/*
** Quick Timer
*/