Merge branch 'bugfix/btdm_sleep_twice_v3.3' into 'release/v3.3'

bugfix btdm sleep twice after wakeup request

See merge request espressif/esp-idf!5638
This commit is contained in:
Jiang Jiang Jian 2019-08-04 15:51:36 +08:00
commit 97e7c14f4e
3 changed files with 16 additions and 7 deletions

View file

@ -189,10 +189,10 @@ task_post_status_t hci_hal_h4_task_post(task_post_t timeout)
evt.par = 0; evt.par = 0;
if (xQueueSend(xHciH4Queue, &evt, timeout) != pdTRUE) { 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) #if (C2H_FLOW_CONTROL_INCLUDED == TRUE)

View file

@ -196,7 +196,8 @@ extern void btdm_controller_enable_sleep(bool enable);
extern void btdm_controller_set_sleep_mode(uint8_t mode); extern void btdm_controller_set_sleep_mode(uint8_t mode);
extern uint8_t btdm_controller_get_sleep_mode(void); extern uint8_t btdm_controller_get_sleep_mode(void);
extern bool btdm_power_state_active(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);
/* Low Power Clock */ /* Low Power Clock */
extern bool btdm_lpclk_select_src(uint32_t sel); extern bool btdm_lpclk_select_src(uint32_t sel);
extern bool btdm_lpclk_set_div(uint32_t div); extern bool btdm_lpclk_set_div(uint32_t div);
@ -879,6 +880,8 @@ bool esp_vhci_host_check_send_available(void)
void esp_vhci_host_send_packet(uint8_t *data, uint16_t len) void esp_vhci_host_send_packet(uint8_t *data, uint16_t len)
{ {
bool do_wakeup_request = false;
if (!btdm_power_state_active()) { if (!btdm_power_state_active()) {
#if CONFIG_PM_ENABLE #if CONFIG_PM_ENABLE
if (semphr_take_wrapper(s_pm_lock_sem, 0)) { if (semphr_take_wrapper(s_pm_lock_sem, 0)) {
@ -886,9 +889,15 @@ void esp_vhci_host_send_packet(uint8_t *data, uint16_t len)
} }
esp_timer_stop(s_btdm_slp_tmr); esp_timer_stop(s_btdm_slp_tmr);
#endif #endif
btdm_wakeup_request(); do_wakeup_request = true;
btdm_wakeup_request(true);
} }
API_vhci_host_send_packet(data, len); API_vhci_host_send_packet(data, len);
if (do_wakeup_request) {
btdm_wakeup_request_end();
}
} }
esp_err_t esp_vhci_host_register_callback(const esp_vhci_host_callback_t *callback) esp_err_t esp_vhci_host_register_callback(const esp_vhci_host_callback_t *callback)
@ -1290,7 +1299,7 @@ esp_err_t esp_bt_controller_disable(void)
if (btdm_controller_get_sleep_mode() == BTDM_MODEM_SLEEP_MODE_ORIG) { if (btdm_controller_get_sleep_mode() == BTDM_MODEM_SLEEP_MODE_ORIG) {
btdm_controller_enable_sleep(false); btdm_controller_enable_sleep(false);
if (!btdm_power_state_active()) { if (!btdm_power_state_active()) {
btdm_wakeup_request(); btdm_wakeup_request(false);
} }
while (!btdm_power_state_active()) { while (!btdm_power_state_active()) {
ets_delay_us(1000); ets_delay_us(1000);
@ -1426,7 +1435,7 @@ void esp_bt_controller_wakeup_request(void)
return; return;
} }
btdm_wakeup_request(); btdm_wakeup_request(false);
} }
esp_err_t esp_bredr_sco_datapath_set(esp_sco_data_path_t data_path) esp_err_t esp_bredr_sco_datapath_set(esp_sco_data_path_t data_path)

@ -1 +1 @@
Subproject commit f099e78fc9c19cc5b527b785215abcce52080e39 Subproject commit 031eaa576d3537fc7448376f3d8cc58febaffbd4