From b9ff771e2c0b4cc185acf809127a6ad38001d706 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Fri, 1 Sep 2017 18:35:42 +0800 Subject: [PATCH] deep sleep: don't use protected DPORT access in wake stub --- components/esp32/sleep_modes.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/components/esp32/sleep_modes.c b/components/esp32/sleep_modes.c index 9cf8867226..e305b96eb4 100644 --- a/components/esp32/sleep_modes.c +++ b/components/esp32/sleep_modes.c @@ -100,8 +100,10 @@ void esp_set_deep_sleep_wake_stub(esp_deep_sleep_wake_stub_fn_t new_stub) void RTC_IRAM_ATTR esp_default_wake_deep_sleep(void) { /* Clear MMU for CPU 0 */ - DPORT_REG_SET_BIT(DPORT_PRO_CACHE_CTRL1_REG, DPORT_PRO_CACHE_MMU_IA_CLR); - DPORT_REG_CLR_BIT(DPORT_PRO_CACHE_CTRL1_REG, DPORT_PRO_CACHE_MMU_IA_CLR); + _DPORT_REG_WRITE(DPORT_PRO_CACHE_CTRL1_REG, + _DPORT_REG_READ(DPORT_PRO_CACHE_CTRL1_REG) | DPORT_PRO_CACHE_MMU_IA_CLR); + _DPORT_REG_WRITE(DPORT_PRO_CACHE_CTRL1_REG, + _DPORT_REG_READ(DPORT_PRO_CACHE_CTRL1_REG) & (~DPORT_PRO_CACHE_MMU_IA_CLR)); #if CONFIG_ESP32_DEEP_SLEEP_WAKEUP_DELAY > 0 // ROM code has not started yet, so we need to set delay factor // used by ets_delay_us first.