From 33cb16fd2a3547ba7495e207b91b8250739f1332 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Fri, 8 Sep 2017 01:29:37 +0800 Subject: [PATCH] esp32: fix cache error interrupt handler Cache error interrupt would read DPORT registers, which caused DPORT access protection to kick in. Disable DPORT protection before doing the reads. --- components/esp32/cache_err_int.c | 2 ++ components/esp32/dport_access.c | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/components/esp32/cache_err_int.c b/components/esp32/cache_err_int.c index d8fa649a00..a6de81ce65 100644 --- a/components/esp32/cache_err_int.c +++ b/components/esp32/cache_err_int.c @@ -29,6 +29,7 @@ #include "esp_attr.h" #include "soc/dport_reg.h" #include "sdkconfig.h" +#include "esp_dport_access.h" void esp_cache_err_int_init() { @@ -72,6 +73,7 @@ void esp_cache_err_int_init() int IRAM_ATTR esp_cache_err_get_cpuid() { + esp_dport_access_int_pause(); const uint32_t pro_mask = DPORT_PRO_CPU_DISABLED_CACHE_IA_DRAM1 | DPORT_PRO_CPU_DISABLED_CACHE_IA_DROM0 | diff --git a/components/esp32/dport_access.c b/components/esp32/dport_access.c index 8cafeb4562..af6c92e1ab 100644 --- a/components/esp32/dport_access.c +++ b/components/esp32/dport_access.c @@ -184,7 +184,7 @@ void esp_dport_access_int_init(void) assert(res == pdTRUE); } -void esp_dport_access_int_pause(void) +void IRAM_ATTR esp_dport_access_int_pause(void) { portENTER_CRITICAL_ISR(&g_dport_mux); dport_core_state[0] = DPORT_CORE_STATE_IDLE; @@ -194,7 +194,7 @@ void esp_dport_access_int_pause(void) portEXIT_CRITICAL_ISR(&g_dport_mux); } -void esp_dport_access_int_resume(void) +void IRAM_ATTR esp_dport_access_int_resume(void) { portENTER_CRITICAL_ISR(&g_dport_mux); dport_core_state[0] = DPORT_CORE_STATE_RUNNING;