mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-02 03:00:34 +03:00
fix(esp_hw_support): fix sleep exception if CONFIG_SPI_FLASH_ROM_IMPL enabled
This commit is contained in:
@@ -495,12 +495,13 @@ static void s_do_deep_sleep_phy_callback(void)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
static int s_cache_suspend_cnt = 0;
|
static int s_cache_suspend_cnt = 0;
|
||||||
|
static uint32_t s_cache_state = 0;
|
||||||
|
|
||||||
// Must be called from critical sections.
|
// Must be called from critical sections.
|
||||||
static void IRAM_ATTR suspend_cache(void) {
|
static void IRAM_ATTR suspend_cache(void) {
|
||||||
s_cache_suspend_cnt++;
|
s_cache_suspend_cnt++;
|
||||||
if (s_cache_suspend_cnt == 1) {
|
if (s_cache_suspend_cnt == 1) {
|
||||||
spi_flash_disable_cache(esp_cpu_get_core_id(), NULL);
|
spi_flash_disable_cache(esp_cpu_get_core_id(), &s_cache_state);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -509,7 +510,7 @@ static void IRAM_ATTR resume_cache(void) {
|
|||||||
s_cache_suspend_cnt--;
|
s_cache_suspend_cnt--;
|
||||||
assert(s_cache_suspend_cnt >= 0 && DRAM_STR("cache resume doesn't match suspend ops"));
|
assert(s_cache_suspend_cnt >= 0 && DRAM_STR("cache resume doesn't match suspend ops"));
|
||||||
if (s_cache_suspend_cnt == 0) {
|
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_PM_RTOS_IDLE_OPT=y
|
||||||
CONFIG_ESP_SLEEP_POWER_DOWN_FLASH=y
|
CONFIG_ESP_SLEEP_POWER_DOWN_FLASH=y
|
||||||
CONFIG_ESP_SLEEP_CACHE_SAFE_ASSERTION=y
|
CONFIG_ESP_SLEEP_CACHE_SAFE_ASSERTION=y
|
||||||
|
CONFIG_SPI_FLASH_ROM_IMPL=y
|
||||||
|
|||||||
Reference in New Issue
Block a user