diff --git a/components/bt/bluedroid/hci/hci_hal_h4.c b/components/bt/bluedroid/hci/hci_hal_h4.c index 48a0f802c..52781f58d 100644 --- a/components/bt/bluedroid/hci/hci_hal_h4.c +++ b/components/bt/bluedroid/hci/hci_hal_h4.c @@ -191,10 +191,10 @@ task_post_status_t hci_hal_h4_task_post(task_post_t timeout) evt.par = 0; if (xQueueSend(xHciH4Queue, &evt, timeout) != pdTRUE) { - return TASK_POST_SUCCESS; + return TASK_POST_FAIL; } - return TASK_POST_FAIL; + return TASK_POST_SUCCESS; } #if (C2H_FLOW_CONTROL_INCLUDED == TRUE) diff --git a/components/bt/bt.c b/components/bt/bt.c index a595c4093..3da6f8f70 100644 --- a/components/bt/bt.c +++ b/components/bt/bt.c @@ -75,7 +75,8 @@ extern void btdm_controller_enable_sleep(bool enable); extern void btdm_controller_set_sleep_mode(uint8_t mode); extern uint8_t btdm_controller_get_sleep_mode(void); extern bool btdm_power_state_active(void); -extern void btdm_wakeup_request(void); +extern void btdm_wakeup_request(bool request_lock); +extern void btdm_wakeup_request_end(void); #define BTDM_LPCLK_SEL_XTAL (0) #define BTDM_LPCLK_SEL_XTAL32K (1) @@ -197,7 +198,6 @@ struct osi_funcs_t { void (* _btdm_sleep_exit_phase3)(void); /* called from task */ }; - /* Static variable declare */ // timestamp when PHY/RF was switched on static DRAM_ATTR int64_t s_time_phy_rf_just_enabled = 0; @@ -754,6 +754,8 @@ bool esp_vhci_host_check_send_available(void) void esp_vhci_host_send_packet(uint8_t *data, uint16_t len) { + bool do_wakeup_request = false; + if (!btdm_power_state_active()) { #if CONFIG_PM_ENABLE if (semphr_take_wrapper(s_pm_lock_sem, 0)) { @@ -761,9 +763,15 @@ void esp_vhci_host_send_packet(uint8_t *data, uint16_t len) } esp_timer_stop(s_btdm_slp_tmr); #endif - btdm_wakeup_request(); + do_wakeup_request = true; + btdm_wakeup_request(true); } + API_vhci_host_send_packet(data, len); + + if (do_wakeup_request) { + btdm_wakeup_request_end(); + } } void esp_vhci_host_register_callback(const esp_vhci_host_callback_t *callback) @@ -1089,7 +1097,7 @@ esp_err_t esp_bt_controller_disable(void) if (btdm_controller_get_sleep_mode() == BTDM_MODEM_SLEEP_MODE_ORIG) { btdm_controller_enable_sleep(false); if (!btdm_power_state_active()) { - btdm_wakeup_request(); + btdm_wakeup_request(false); } while (!btdm_power_state_active()) { ets_delay_us(1000); @@ -1225,7 +1233,7 @@ void esp_bt_controller_wakeup_request(void) return; } - btdm_wakeup_request(); + btdm_wakeup_request(false); } esp_err_t esp_bredr_sco_datapath_set(esp_sco_data_path_t data_path) diff --git a/components/bt/lib b/components/bt/lib index 435173c64..6bacf37c1 160000 --- a/components/bt/lib +++ b/components/bt/lib @@ -1 +1 @@ -Subproject commit 435173c642a6793761b068fd8a52b2edb307a6a1 +Subproject commit 6bacf37c12d33616c375bc0dc97828ceb32ecd25