fix(pm): cancel cache_safe_assertion when using ext0 & ext1

This commit is contained in:
Lou Tianhao 2024-09-04 11:26:53 +08:00
parent e98e6dc079
commit b1c6f48c10

View File

@ -1220,8 +1220,21 @@ esp_err_t esp_light_sleep_start(void)
#if CONFIG_ESP_SLEEP_CACHE_SAFE_ASSERTION && CONFIG_PM_SLP_IRAM_OPT
/* Cache Suspend 0: if CONFIG_PM_SLP_IRAM_OPT is enabled, suspend cache here so that the access to flash
during the sleep process can be explicitly exposed. */
suspend_cache();
* during the sleep process can be explicitly exposed.
*
* If we use EXTx wakeup, we must put related codes in IRAM, but The `rtc_io_desc` table
* consumes a significant amount of memory. For example, on the ESP32, its size is 1008
* bytes. Therefore, when EXTx wakeup is enabled, we do not perform cache access checks here */
uint32_t ignore_check_wakeup_triggers = 0;
#if SOC_PM_SUPPORT_EXT0_WAKEUP
ignore_check_wakeup_triggers |= RTC_EXT0_TRIG_EN;
#endif
#if SOC_PM_SUPPORT_EXT1_WAKEUP
ignore_check_wakeup_triggers |= RTC_EXT1_TRIG_EN;
#endif
if (!(s_config.wakeup_triggers & ignore_check_wakeup_triggers)) {
suspend_cache();
}
#endif
// Decide which power domains can be powered down
@ -1356,7 +1369,9 @@ esp_err_t esp_light_sleep_start(void)
#if CONFIG_ESP_SLEEP_CACHE_SAFE_ASSERTION && CONFIG_PM_SLP_IRAM_OPT
/* Cache Resume 0: sleep process done, resume cache for continue running */
resume_cache();
if (!(s_config.wakeup_triggers & ignore_check_wakeup_triggers)) {
resume_cache();
}
#endif
esp_ipc_isr_release_other_cpu();