fix(phy): Fix ble phy_enable/disable api invoking issue for esp32c2,esp32h2 and esp32c6

This commit is contained in:
zwl 2023-09-01 18:08:33 +08:00 committed by zhangwenxu
parent 9337525cdc
commit 0bbc2805fc
3 changed files with 16 additions and 16 deletions

View File

@ -240,7 +240,7 @@ struct ext_funcs_t ext_funcs_ro = {
._ecc_gen_key_pair = esp_ecc_gen_key_pair, ._ecc_gen_key_pair = esp_ecc_gen_key_pair,
._ecc_gen_dh_key = esp_ecc_gen_dh_key, ._ecc_gen_dh_key = esp_ecc_gen_dh_key,
._esp_reset_rpa_moudle = esp_reset_rpa_moudle, ._esp_reset_rpa_moudle = esp_reset_rpa_moudle,
._esp_bt_track_pll_cap = bt_track_pll_cap, ._esp_bt_track_pll_cap = NULL,
.magic = EXT_FUNC_MAGIC_VALUE, .magic = EXT_FUNC_MAGIC_VALUE,
}; };
@ -465,7 +465,7 @@ IRAM_ATTR void controller_sleep_cb(uint32_t enable_tick, void *arg)
r_ble_rtc_wake_up_state_clr(); r_ble_rtc_wake_up_state_clr();
esp_pm_lock_release(s_pm_lock); esp_pm_lock_release(s_pm_lock);
#endif // CONFIG_PM_ENABLE #endif // CONFIG_PM_ENABLE
esp_phy_disable(); esp_phy_disable(PHY_MODEM_BT);
s_ble_active = false; s_ble_active = false;
} }
@ -474,7 +474,7 @@ IRAM_ATTR void controller_wakeup_cb(void *arg)
if (s_ble_active) { if (s_ble_active) {
return; return;
} }
esp_phy_enable(); esp_phy_enable(PHY_MODEM_BT);
// need to check if need to call pm lock here // need to check if need to call pm lock here
#ifdef CONFIG_PM_ENABLE #ifdef CONFIG_PM_ENABLE
esp_pm_lock_acquire(s_pm_lock); esp_pm_lock_acquire(s_pm_lock);
@ -750,7 +750,7 @@ esp_err_t esp_bt_controller_enable(esp_bt_mode_t mode)
esp_pm_lock_acquire(s_pm_lock); esp_pm_lock_acquire(s_pm_lock);
#endif // CONFIG_PM_ENABLE #endif // CONFIG_PM_ENABLE
// init phy // init phy
esp_phy_enable(); esp_phy_enable(PHY_MODEM_BT);
s_ble_active = true; s_ble_active = true;
} }
// init bb // init bb
@ -772,7 +772,7 @@ error:
coex_disable(); coex_disable();
#endif #endif
if (s_ble_active) { if (s_ble_active) {
esp_phy_disable(); esp_phy_disable(PHY_MODEM_BT);
#if CONFIG_PM_ENABLE #if CONFIG_PM_ENABLE
esp_pm_lock_release(s_pm_lock); esp_pm_lock_release(s_pm_lock);
#endif // CONFIG_PM_ENABLE #endif // CONFIG_PM_ENABLE
@ -792,7 +792,7 @@ esp_err_t esp_bt_controller_disable(void)
} }
if (s_ble_active) { if (s_ble_active) {
esp_phy_disable(); esp_phy_disable(PHY_MODEM_BT);
#if CONFIG_PM_ENABLE #if CONFIG_PM_ENABLE
esp_pm_lock_release(s_pm_lock); esp_pm_lock_release(s_pm_lock);
#endif // CONFIG_PM_ENABLE #endif // CONFIG_PM_ENABLE

View File

@ -487,7 +487,7 @@ IRAM_ATTR void controller_sleep_cb(uint32_t enable_tick, void *arg)
sleep_retention_do_extra_retention(true); sleep_retention_do_extra_retention(true);
#endif // SOC_PM_RETENTION_HAS_CLOCK_BUG #endif // SOC_PM_RETENTION_HAS_CLOCK_BUG
#endif /* CONFIG_FREERTOS_USE_TICKLESS_IDLE */ #endif /* CONFIG_FREERTOS_USE_TICKLESS_IDLE */
esp_phy_disable(); esp_phy_disable(PHY_MODEM_BT);
#ifdef CONFIG_PM_ENABLE #ifdef CONFIG_PM_ENABLE
esp_pm_lock_release(s_pm_lock); esp_pm_lock_release(s_pm_lock);
#endif // CONFIG_PM_ENABLE #endif // CONFIG_PM_ENABLE
@ -506,7 +506,7 @@ IRAM_ATTR void controller_wakeup_cb(void *arg)
sleep_retention_do_extra_retention(false); sleep_retention_do_extra_retention(false);
#endif /* CONFIG_FREERTOS_USE_TICKLESS_IDLE && SOC_PM_RETENTION_HAS_CLOCK_BUG */ #endif /* CONFIG_FREERTOS_USE_TICKLESS_IDLE && SOC_PM_RETENTION_HAS_CLOCK_BUG */
#endif //CONFIG_PM_ENABLE #endif //CONFIG_PM_ENABLE
esp_phy_enable(); esp_phy_enable(PHY_MODEM_BT);
s_ble_active = true; s_ble_active = true;
} }
@ -889,7 +889,7 @@ esp_err_t esp_bt_controller_enable(esp_bt_mode_t mode)
#if CONFIG_PM_ENABLE #if CONFIG_PM_ENABLE
esp_pm_lock_acquire(s_pm_lock); esp_pm_lock_acquire(s_pm_lock);
#endif // CONFIG_PM_ENABLE #endif // CONFIG_PM_ENABLE
esp_phy_enable(); esp_phy_enable(PHY_MODEM_BT);
esp_btbb_enable(); esp_btbb_enable();
s_ble_active = true; s_ble_active = true;
} }
@ -910,7 +910,7 @@ error:
#endif #endif
if (s_ble_active) { if (s_ble_active) {
esp_btbb_disable(); esp_btbb_disable();
esp_phy_disable(); esp_phy_disable(PHY_MODEM_BT);
#if CONFIG_PM_ENABLE #if CONFIG_PM_ENABLE
esp_pm_lock_release(s_pm_lock); esp_pm_lock_release(s_pm_lock);
#endif // CONFIG_PM_ENABLE #endif // CONFIG_PM_ENABLE
@ -933,7 +933,7 @@ esp_err_t esp_bt_controller_disable(void)
#endif #endif
if (s_ble_active) { if (s_ble_active) {
esp_btbb_disable(); esp_btbb_disable();
esp_phy_disable(); esp_phy_disable(PHY_MODEM_BT);
#if CONFIG_PM_ENABLE #if CONFIG_PM_ENABLE
esp_pm_lock_release(s_pm_lock); esp_pm_lock_release(s_pm_lock);
#endif // CONFIG_PM_ENABLE #endif // CONFIG_PM_ENABLE

View File

@ -473,7 +473,7 @@ IRAM_ATTR void controller_sleep_cb(uint32_t enable_tick, void *arg)
#if CONFIG_FREERTOS_USE_TICKLESS_IDLE #if CONFIG_FREERTOS_USE_TICKLESS_IDLE
r_ble_rtc_wake_up_state_clr(); r_ble_rtc_wake_up_state_clr();
#endif /* CONFIG_FREERTOS_USE_TICKLESS_IDLE */ #endif /* CONFIG_FREERTOS_USE_TICKLESS_IDLE */
esp_phy_disable(); esp_phy_disable(PHY_MODEM_BT);
#ifdef CONFIG_PM_ENABLE #ifdef CONFIG_PM_ENABLE
esp_pm_lock_release(s_pm_lock); esp_pm_lock_release(s_pm_lock);
#endif // CONFIG_PM_ENABLE #endif // CONFIG_PM_ENABLE
@ -489,7 +489,7 @@ IRAM_ATTR void controller_wakeup_cb(void *arg)
esp_pm_lock_acquire(s_pm_lock); esp_pm_lock_acquire(s_pm_lock);
r_ble_rtc_wake_up_state_clr(); r_ble_rtc_wake_up_state_clr();
#endif //CONFIG_PM_ENABLE #endif //CONFIG_PM_ENABLE
esp_phy_enable(); esp_phy_enable(PHY_MODEM_BT);
s_ble_active = true; s_ble_active = true;
} }
@ -867,7 +867,7 @@ esp_err_t esp_bt_controller_enable(esp_bt_mode_t mode)
#if CONFIG_PM_ENABLE #if CONFIG_PM_ENABLE
esp_pm_lock_acquire(s_pm_lock); esp_pm_lock_acquire(s_pm_lock);
#endif // CONFIG_PM_ENABLE #endif // CONFIG_PM_ENABLE
esp_phy_enable(); esp_phy_enable(PHY_MODEM_BT);
s_ble_active = true; s_ble_active = true;
} }
esp_btbb_enable(); esp_btbb_enable();
@ -888,7 +888,7 @@ error:
#endif #endif
esp_btbb_disable(); esp_btbb_disable();
if (s_ble_active) { if (s_ble_active) {
esp_phy_disable(); esp_phy_disable(PHY_MODEM_BT);
#if CONFIG_PM_ENABLE #if CONFIG_PM_ENABLE
esp_pm_lock_release(s_pm_lock); esp_pm_lock_release(s_pm_lock);
#endif // CONFIG_PM_ENABLE #endif // CONFIG_PM_ENABLE
@ -911,7 +911,7 @@ esp_err_t esp_bt_controller_disable(void)
#endif #endif
esp_btbb_disable(); esp_btbb_disable();
if (s_ble_active) { if (s_ble_active) {
esp_phy_disable(); esp_phy_disable(PHY_MODEM_BT);
#if CONFIG_PM_ENABLE #if CONFIG_PM_ENABLE
esp_pm_lock_release(s_pm_lock); esp_pm_lock_release(s_pm_lock);
#endif // CONFIG_PM_ENABLE #endif // CONFIG_PM_ENABLE