From: wangmengyang Date: Sat, 26 Nov 2016 08:46:52 +0000 (+0800) Subject: component/bt: reduce bt tasks' stack size X-Git-Tag: v2.1-rc1~196^2~68 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2c577b1360a088d5721aec283469b38414bfc3f4;p=esp-idf component/bt: reduce bt tasks' stack size --- diff --git a/components/bt/bluedroid/hci/hci_hal_h4.c b/components/bt/bluedroid/hci/hci_hal_h4.c index 0fe9aba696..b3b2856fba 100644 --- a/components/bt/bluedroid/hci/hci_hal_h4.c +++ b/components/bt/bluedroid/hci/hci_hal_h4.c @@ -102,7 +102,7 @@ static bool hal_open(const hci_hal_callbacks_t *upper_callbacks) hci_hal_env_init(HCI_HAL_SERIAL_BUFFER_SIZE, SIZE_MAX); xHciH4Queue = xQueueCreate(60, sizeof(BtTaskEvt_t)); - xTaskCreate(hci_hal_h4_rx_handler, "HciH4T", 2048 + 1024, NULL, configMAX_PRIORITIES - 3, &xHciH4TaskHandle); + xTaskCreate(hci_hal_h4_rx_handler, "HciH4T", 1024 + 256, NULL, configMAX_PRIORITIES - 3, &xHciH4TaskHandle); //register vhci host cb API_vhci_host_register_callback(&vhci_host_cb); @@ -159,7 +159,6 @@ static uint16_t transmit_data(serial_data_type_t type, static void hci_hal_h4_rx_handler(void *arg) { BtTaskEvt_t e; - for (;;) { if (pdTRUE == xQueueReceive(xHciH4Queue, &e, (portTickType)portMAX_DELAY)) { if (e.sig == 0xff) { diff --git a/components/bt/bluedroid/hci/hci_layer.c b/components/bt/bluedroid/hci/hci_layer.c index c468039a9d..29704d5be3 100644 --- a/components/bt/bluedroid/hci/hci_layer.c +++ b/components/bt/bluedroid/hci/hci_layer.c @@ -114,7 +114,7 @@ int hci_start_up(void) } xHciHostQueue = xQueueCreate(60, sizeof(BtTaskEvt_t)); - xTaskCreate(hci_host_thread_handler, "HciHostT", (2048 + 1024), NULL, configMAX_PRIORITIES - 3, &xHciHostTaskHandle); + xTaskCreate(hci_host_thread_handler, "HciHostT", (1024+256), NULL, configMAX_PRIORITIES - 3, &xHciHostTaskHandle); packet_fragmenter->init(&packet_fragmenter_callbacks); hal->open(&hal_callbacks); @@ -228,7 +228,6 @@ static void hci_host_thread_handler(void *arg) */ BtTaskEvt_t e; - for (;;) { if (pdTRUE == xQueueReceive(xHciHostQueue, &e, (portTickType)portMAX_DELAY)) { if (e.sig == 0xff) { diff --git a/components/bt/bluedroid/stack/btu/btu_init.c b/components/bt/bluedroid/stack/btu/btu_init.c index 122c2374c5..68c4e03b5c 100644 --- a/components/bt/bluedroid/stack/btu/btu_init.c +++ b/components/bt/bluedroid/stack/btu/btu_init.c @@ -201,7 +201,8 @@ void BTU_StartUp(void) } xBtuQueue = xQueueCreate(60, sizeof(BtTaskEvt_t)); - xTaskCreate(btu_task_thread_handler, "BtuT", 4096, NULL, configMAX_PRIORITIES - 1, &xBtuTaskHandle); + xTaskCreate(btu_task_thread_handler, "BtuT", 2048 + 1024, NULL, configMAX_PRIORITIES - 1, &xBtuTaskHandle); + btu_task_post(SIG_BTU_START_UP); /* // Continue startup on bt workqueue thread. diff --git a/examples/09_a2dp/components/bluedroid_demos/btif/btif_core.c b/examples/09_a2dp/components/bluedroid_demos/btif/btif_core.c index 326dead11a..b2ff5ccd6c 100644 --- a/examples/09_a2dp/components/bluedroid_demos/btif/btif_core.c +++ b/examples/09_a2dp/components/bluedroid_demos/btif/btif_core.c @@ -286,10 +286,8 @@ static void btif_thread_post(uint32_t sig) void btif_task_thread_handler(void *arg) { BtTaskEvt_t *e; - for (;;) { if (pdTRUE == xQueueReceive(xBtifQueue, &e, (portTickType)portMAX_DELAY)) { - if (e->sig == SIG_BTIF_WORK) { fixed_queue_process(btif_msg_queue); } @@ -316,7 +314,7 @@ bt_status_t btif_init_bluetooth(void) goto error_exit; } xBtifQueue = xQueueCreate(60, sizeof(void *)); - xTaskCreate(btif_task_thread_handler, "BtifT", 4096, NULL, configMAX_PRIORITIES - 1, &xBtifTaskHandle); + xTaskCreate(btif_task_thread_handler, "BtifT", 2048, NULL, configMAX_PRIORITIES - 1, &xBtifTaskHandle); fixed_queue_register_dequeue(btif_msg_queue, bt_jni_msg_ready); return BT_STATUS_SUCCESS; diff --git a/examples/09_a2dp/components/bluedroid_demos/btif/btif_media_task.c b/examples/09_a2dp/components/bluedroid_demos/btif/btif_media_task.c index 0858d108cc..5a18d3af60 100644 --- a/examples/09_a2dp/components/bluedroid_demos/btif/btif_media_task.c +++ b/examples/09_a2dp/components/bluedroid_demos/btif/btif_media_task.c @@ -752,7 +752,6 @@ static void btif_media_task_post(uint32_t sig) static void btif_media_task_handler(void *arg) { BtTaskEvt_t *e; - for (;;) { if (pdTRUE == xQueueReceive(xBtifMediaQueue, &e, (portTickType)portMAX_DELAY)) { // LOG_ERROR("med evt %d\n", e->sig); @@ -800,7 +799,7 @@ bool btif_a2dp_start_media_task(void) if (xBtifMediaQueue == 0) { goto error_exit; } - xTaskCreate(btif_media_task_handler, "BtifMediaT\n", 2048 + 1024, NULL, configMAX_PRIORITIES - 1, &xBtifMediaTaskHandle); + xTaskCreate(btif_media_task_handler, "BtifMediaT\n", 2048, NULL, configMAX_PRIORITIES - 1, &xBtifMediaTaskHandle); if (xBtifMediaTaskHandle == NULL) { goto error_exit; } @@ -1193,7 +1192,6 @@ static void btif_media_task_avk_handle_timer(UNUSED_ATTR void *context) num_frames_to_process = btif_media_cb.frames_to_process; APPL_TRACE_DEBUG(" Process Frames + "); - do { p_msg = (tBT_SBC_HDR *)GKI_getfirst(&(btif_media_cb.RxSbcQ)); if (p_msg == NULL) {