mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
ble : remove extra retention cnt upon deinit temporarily
This commit is contained in:
parent
cf744f9466
commit
9578fdc250
@ -186,6 +186,10 @@ static int esp_ecc_gen_dh_key(const uint8_t *peer_pub_key_x, const uint8_t *peer
|
||||
static DRAM_ATTR esp_bt_controller_status_t ble_controller_status = ESP_BT_CONTROLLER_STATUS_IDLE;
|
||||
|
||||
/* This variable tells if BLE is running */
|
||||
#if CONFIG_FREERTOS_USE_TICKLESS_IDLE
|
||||
static bool s_ble_backed_up = false;
|
||||
#endif // CONFIG_FREERTOS_USE_TICKLESS_IDLE
|
||||
|
||||
static bool s_ble_active = false;
|
||||
#ifdef CONFIG_PM_ENABLE
|
||||
static DRAM_ATTR esp_pm_lock_handle_t s_pm_lock = NULL;
|
||||
@ -470,6 +474,7 @@ IRAM_ATTR void controller_sleep_cb(uint32_t enable_tick, void *arg)
|
||||
#endif // CONFIG_BT_LE_WAKEUP_SOURCE_BLE_RTC_TIMER
|
||||
#if SOC_PM_RETENTION_HAS_CLOCK_BUG
|
||||
sleep_retention_do_extra_retention(true);
|
||||
s_ble_backed_up = true;
|
||||
#endif // SOC_PM_RETENTION_HAS_CLOCK_BUG
|
||||
#endif /* CONFIG_FREERTOS_USE_TICKLESS_IDLE */
|
||||
esp_phy_disable();
|
||||
@ -491,6 +496,7 @@ IRAM_ATTR void controller_wakeup_cb(void *arg)
|
||||
#endif // CONFIG_BT_LE_WAKEUP_SOURCE_BLE_RTC_TIMER
|
||||
#if CONFIG_FREERTOS_USE_TICKLESS_IDLE && SOC_PM_RETENTION_HAS_CLOCK_BUG
|
||||
sleep_retention_do_extra_retention(false);
|
||||
s_ble_backed_up = false;
|
||||
#endif /* CONFIG_FREERTOS_USE_TICKLESS_IDLE && SOC_PM_RETENTION_HAS_CLOCK_BUG */
|
||||
#endif //CONFIG_PM_ENABLE
|
||||
esp_phy_enable();
|
||||
@ -596,6 +602,10 @@ error:
|
||||
void controller_sleep_deinit(void)
|
||||
{
|
||||
#if CONFIG_FREERTOS_USE_TICKLESS_IDLE
|
||||
if (s_ble_backed_up) {
|
||||
sleep_retention_module_deinit();
|
||||
s_ble_backed_up = false;
|
||||
}
|
||||
#ifdef CONFIG_BT_LE_WAKEUP_SOURCE_BLE_RTC_TIMER
|
||||
r_ble_rtc_wake_up_state_clr();
|
||||
esp_sleep_disable_bt_wakeup();
|
||||
|
@ -108,6 +108,8 @@ void sleep_retention_entries_get(sleep_retention_entries_t *entries);
|
||||
* or false for restore to register from memory
|
||||
*/
|
||||
void sleep_retention_do_extra_retention(bool backup_or_restore);
|
||||
|
||||
void sleep_retention_module_deinit(void);
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@ -528,6 +528,15 @@ void sleep_retention_do_extra_retention(bool backup_or_restore)
|
||||
_lock_release_recursive(&s_retention.lock);
|
||||
assert(refs >= 0 && refs <= cnt_modules);
|
||||
}
|
||||
|
||||
void sleep_retention_module_deinit(void)
|
||||
{
|
||||
_lock_acquire_recursive(&s_retention.lock);
|
||||
if (s_retention.extra_refs) {
|
||||
s_retention.extra_refs--;
|
||||
}
|
||||
_lock_release_recursive(&s_retention.lock);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if SOC_PM_RETENTION_HAS_REGDMA_POWER_BUG
|
||||
|
Loading…
x
Reference in New Issue
Block a user