From 632b01602850ba71d2f2a5dab66cc23dbc2d066b Mon Sep 17 00:00:00 2001 From: Konstantin Kondrashov Date: Tue, 25 Jun 2019 19:23:10 +0800 Subject: [PATCH] esp32: Dis interrupts up to 5 lvl for DPORT Disable interrupts for both DPORT workarounds up to 5 lvl. Closes: https://esp32.com/viewtopic.php?f=2&t=10981&sid=d125cec233070ed4d2c5410bf5d3d74a Closes: IDF-728 --- components/esp32/Kconfig | 7 +++++++ components/esp32/dport_access.c | 2 +- components/esp32/dport_panic_highint_hdl.S | 9 +++++++-- components/esp32/include/esp32/dport_access.h | 2 +- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/components/esp32/Kconfig b/components/esp32/Kconfig index 6fdfcc3e2a..847560fe05 100644 --- a/components/esp32/Kconfig +++ b/components/esp32/Kconfig @@ -741,6 +741,13 @@ menu "ESP32-specific" Please note that the actual length will be reduced by BT_RESERVE_DRAM if Bluetooth controller is enabled. + config ESP32_DPORT_DIS_INTERRUPT_LVL + int "Disable the interrupt level for the DPORT workarounds" + default 5 + help + To prevent interrupting DPORT workarounds, + need to disable interrupt with a maximum used level in the system. + endmenu # ESP32-Specific menu "Power Management" diff --git a/components/esp32/dport_access.c b/components/esp32/dport_access.c index de828eb061..2c83583350 100644 --- a/components/esp32/dport_access.c +++ b/components/esp32/dport_access.c @@ -256,7 +256,7 @@ uint32_t IRAM_ATTR esp_dport_access_reg_read(uint32_t reg) unsigned int intLvl; __asm__ __volatile__ (\ "movi %[APB], "XTSTR(0x3ff40078)"\n"\ - "rsil %[LVL], "XTSTR(3)"\n"\ + "rsil %[LVL], "XTSTR(CONFIG_ESP32_DPORT_DIS_INTERRUPT_LVL)"\n"\ "l32i %[APB], %[APB], 0\n"\ "l32i %[REG], %[REG], 0\n"\ "wsr %[LVL], "XTSTR(PS)"\n"\ diff --git a/components/esp32/dport_panic_highint_hdl.S b/components/esp32/dport_panic_highint_hdl.S index 924d77b2f0..7291628635 100644 --- a/components/esp32/dport_panic_highint_hdl.S +++ b/components/esp32/dport_panic_highint_hdl.S @@ -31,9 +31,10 @@ Interrupt , a high-priority interrupt, is used for several things: */ -#define L4_INTR_STACK_SIZE 8 +#define L4_INTR_STACK_SIZE 12 #define L4_INTR_A2_OFFSET 0 #define L4_INTR_A3_OFFSET 4 +#define L4_INTR_A4_OFFSET 8 .data _l4_intr_stack: .space L4_INTR_STACK_SIZE @@ -145,10 +146,11 @@ xt_highint4: movi a0, (1<