summaryrefslogtreecommitdiffstats
path: root/main/bte_main.c
diff options
context:
space:
mode:
authorChris Manton <cmanton@google.com>2014-08-27 10:30:47 -0700
committerAndre Eisenbach <eisenbach@google.com>2015-03-16 16:51:32 -0700
commit860a9af89f8dbf8ef65785d5db960c1fa488d2ba (patch)
tree768af293711c3331d4cfa74a92760a5a21fe5f58 /main/bte_main.c
parent44e721e6bfd8948e48ddbe06ef28895199eb61cb (diff)
downloadandroid_system_bt-860a9af89f8dbf8ef65785d5db960c1fa488d2ba.tar.gz
android_system_bt-860a9af89f8dbf8ef65785d5db960c1fa488d2ba.tar.bz2
android_system_bt-860a9af89f8dbf8ef65785d5db960c1fa488d2ba.zip
Replace mailboxes with fixed queues.
Also refactored btu_task a bit.
Diffstat (limited to 'main/bte_main.c')
-rwxr-xr-xmain/bte_main.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/main/bte_main.c b/main/bte_main.c
index a6fffd26c..2ae5020ea 100755
--- a/main/bte_main.c
+++ b/main/bte_main.c
@@ -86,6 +86,12 @@ BOOLEAN hci_logging_config = FALSE; /* configured from bluetooth framework */
BOOLEAN hci_save_log = FALSE; /* save a copy of the log before starting again */
char hci_logfile[256] = HCI_LOGGING_FILENAME;
+// Communication queue between btu_task and bta.
+fixed_queue_t *btu_bta_msg_queue;
+
+// Communication queue between btu_task and hci.
+fixed_queue_t *btu_hci_msg_queue;
+
/*******************************************************************************
** Static variables
*******************************************************************************/
@@ -215,6 +221,9 @@ void bte_main_enable()
{
APPL_TRACE_DEBUG("%s", __FUNCTION__);
+ btu_bta_msg_queue = fixed_queue_new(SIZE_MAX);
+ btu_hci_msg_queue = fixed_queue_new(SIZE_MAX);
+
/* Initialize BTE control block */
BTE_StartUp();
@@ -632,7 +641,10 @@ static void dealloc(void *buffer)
}
static void dump_upbound_data_to_btu(fixed_queue_t *queue, UNUSED_ATTR void *context) {
- GKI_send_msg (BTU_TASK, BTU_HCI_RCV_MBOX, fixed_queue_dequeue(queue));
+ fixed_queue_enqueue(btu_hci_msg_queue, fixed_queue_dequeue(queue));
+ // Signal the target thread work is ready.
+ GKI_send_event(BTU_TASK, (UINT16)EVENT_MASK(BTU_HCI_RCV_MBOX));
+
}
/******************************************************************************
@@ -659,7 +671,9 @@ static void tx_result(void *p_buf, bool all_fragments_sent)
{
if (!all_fragments_sent)
{
- GKI_send_msg (BTU_TASK, BTU_HCI_RCV_MBOX, p_buf);
+ fixed_queue_enqueue(btu_hci_msg_queue, p_buf);
+ // Signal the target thread work is ready.
+ GKI_send_event(BTU_TASK, (UINT16)EVENT_MASK(BTU_HCI_RCV_MBOX));
}
else
{