Move BTU task creation into stack/btu/btu_init.c.
Also fixed function naming where the BTE prefix was used
instead of BTU.
diff --git a/main/bte_main.c b/main/bte_main.c
index d1f65b2..ec70c87 100755
--- a/main/bte_main.c
+++ b/main/bte_main.c
@@ -140,9 +140,6 @@
/*******************************************************************************
** Externs
*******************************************************************************/
-UINT32 btu_task (UINT32 param);
-void BTE_StartUp(void);
-void BTE_ShutDown(void);
void BTE_LoadStack(void);
void BTE_UnloadStack(void);
void scru_flip_bda (BD_ADDR dst, const BD_ADDR src);
@@ -150,18 +147,6 @@
extern void bte_load_ble_conf(const char *p_path);
bt_bdaddr_t btif_local_bd_addr;
-
-/*******************************************************************************
-** System Task Configuration
-*******************************************************************************/
-
-/* bluetooth protocol stack (BTU) task */
-#ifndef BTE_BTU_STACK_SIZE
-#define BTE_BTU_STACK_SIZE 0//0x2000 /* In bytes */
-#endif
-#define BTE_BTU_TASK_STR ((INT8 *) "BTU")
-UINT32 bte_btu_stack[(BTE_BTU_STACK_SIZE + 3) / 4];
-
/******************************************************************************
**
** Function bte_main_boot_entry
@@ -260,12 +245,7 @@
pthread_mutex_init(&btu_l2cap_alarm_lock, NULL);
btu_l2cap_alarm_queue = fixed_queue_new(SIZE_MAX);
- /* Initialize BTE control block */
- BTE_StartUp();
-
- GKI_create_task((TASKPTR)btu_task, BTU_TASK, BTE_BTU_TASK_STR,
- (UINT16 *) ((UINT8 *)bte_btu_stack + BTE_BTU_STACK_SIZE),
- sizeof(bte_btu_stack));
+ BTU_StartUp();
bte_hci_enable();
@@ -288,7 +268,7 @@
preload_stop_wait_timer();
bte_hci_disable();
- GKI_destroy_task(BTU_TASK);
+ BTU_ShutDown();
fixed_queue_free(btu_bta_msg_queue, NULL);
fixed_queue_free(btu_hci_msg_queue, NULL);
@@ -304,8 +284,6 @@
hash_map_free(btu_l2cap_alarm_hash_map);
pthread_mutex_destroy(&btu_l2cap_alarm_lock);
fixed_queue_free(btu_l2cap_alarm_queue, NULL);
-
- BTE_ShutDown();
}
/******************************************************************************
diff --git a/stack/btu/btu_init.c b/stack/btu/btu_init.c
index c20dd7f..f79b2af 100644
--- a/stack/btu/btu_init.c
+++ b/stack/btu/btu_init.c
@@ -101,7 +101,7 @@
/*****************************************************************************
**
-** Function BTE_StartUp
+** Function BTU_StartUp
**
** Description Initializes the BTU control block.
**
@@ -111,7 +111,7 @@
** Returns void
**
******************************************************************************/
-void BTE_StartUp(void)
+void BTU_StartUp(void)
{
memset (&btu_cb, 0, sizeof (tBTU_CB));
btu_cb.hcit_acl_pkt_size = BTU_DEFAULT_DATA_SIZE + HCI_DATA_PREAMBLE_SIZE;
@@ -125,10 +125,12 @@
GKI_init_q(&btu_cb.hci_cmd_cb[i].cmd_cmpl_q);
btu_cb.hci_cmd_cb[i].cmd_window = 1;
}
+
+ GKI_create_task(btu_task, BTU_TASK, (INT8 *)"BTU", NULL, 0);
}
-
-void BTE_ShutDown(void) {
+void BTU_ShutDown(void) {
+ GKI_destroy_task(BTU_TASK);
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));
diff --git a/stack/btu/btu_task.c b/stack/btu/btu_task.c
index 764b891..bb0b6d1 100644
--- a/stack/btu/btu_task.c
+++ b/stack/btu/btu_task.c
@@ -363,7 +363,7 @@
** Returns should never return
**
*******************************************************************************/
-BTU_API UINT32 btu_task (UINT32 param)
+BTU_API void btu_task (UINT32 param)
{
UINT16 event;
BT_HDR *p_msg;
@@ -385,7 +385,7 @@
/* indicates BT ENABLE abort */
BT_TRACE(TRACE_LAYER_BTU, TRACE_TYPE_WARNING,
"btu_task start abort!");
- return (0);
+ return;
}
else if (event & BT_EVT_PRELOAD_CMPL)
{
@@ -498,7 +498,7 @@
btu_free_core();
- return(0);
+ return;
}
/*******************************************************************************
diff --git a/stack/include/btu.h b/stack/include/btu.h
index 8800f15..ec8b3a5 100644
--- a/stack/include/btu.h
+++ b/stack/include/btu.h
@@ -265,6 +265,7 @@
/* Functions provided by btu_task.c
************************************
*/
+BTU_API extern void btu_task (UINT32 param);
BTU_API extern void btu_start_timer (TIMER_LIST_ENT *p_tle, UINT16 type, UINT32 timeout);
BTU_API extern void btu_stop_timer (TIMER_LIST_ENT *p_tle);
BTU_API extern void btu_start_timer_oneshot(TIMER_LIST_ENT *p_tle, UINT16 type, UINT32 timeout);
@@ -302,7 +303,10 @@
*/
BTU_API extern void btu_init_core(void);
BTU_API extern void btu_free_core(void);
-BTU_API extern void BTE_Init(void);
+
+void BTU_StartUp(void);
+void BTU_ShutDown(void);
+
BTU_API extern UINT16 BTU_AclPktSize(void);
BTU_API extern UINT16 BTU_BleAclPktSize(void);