mirror of
https://github.com/espressif/esp-idf.git
synced 2026-04-27 19:13:21 +00:00
fix(esp_hw_support): fix sleep exception if CONFIG_SPI_FLASH_ROM_IMPL enabled
This commit is contained in:
@@ -552,6 +552,7 @@ static void s_do_deep_sleep_phy_callback(void)
|
||||
#endif
|
||||
|
||||
static int s_cache_suspend_cnt = 0;
|
||||
static uint32_t s_cache_state = 0;
|
||||
|
||||
// Must be called from critical sections.
|
||||
static void FORCE_IRAM_ATTR suspend_cache(void) {
|
||||
@@ -563,7 +564,7 @@ static void FORCE_IRAM_ATTR suspend_cache(void) {
|
||||
// fully check the access to external memory, writeback & invalidate is needed here.
|
||||
Cache_WriteBack_Invalidate_All(CACHE_MAP_MASK);
|
||||
#endif
|
||||
spi_flash_disable_cache(esp_cpu_get_core_id(), NULL);
|
||||
spi_flash_disable_cache(esp_cpu_get_core_id(), &s_cache_state);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -572,7 +573,7 @@ static void FORCE_IRAM_ATTR resume_cache(void) {
|
||||
s_cache_suspend_cnt--;
|
||||
assert(s_cache_suspend_cnt >= 0 && DRAM_STR("cache resume doesn't match suspend ops"));
|
||||
if (s_cache_suspend_cnt == 0) {
|
||||
spi_flash_restore_cache(esp_cpu_get_core_id(), 0);
|
||||
spi_flash_restore_cache(esp_cpu_get_core_id(), s_cache_state);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,3 +2,4 @@ CONFIG_PM_SLP_IRAM_OPT=y
|
||||
CONFIG_PM_RTOS_IDLE_OPT=y
|
||||
CONFIG_ESP_SLEEP_POWER_DOWN_FLASH=y
|
||||
CONFIG_ESP_SLEEP_CACHE_SAFE_ASSERTION=y
|
||||
CONFIG_SPI_FLASH_ROM_IMPL=y
|
||||
|
||||
Reference in New Issue
Block a user