Skip to content

Commit 0ad7af2

Browse files
committed
Merge branch 'bugfix/fix_nmi_reenter_when_multi_enable_mac_interrupt' into 'master'
fix(xtensa): Fix NMI reenter when multi enable MAC interrupt See merge request sdk/ESP8266_RTOS_SDK!1468
2 parents 7adc7a6 + a3be9fd commit 0ad7af2

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

components/esp8266/include/esp8266/eagle_soc.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@
131131
//}}
132132

133133
//Interrupt remap control registers define{{
134+
#define NMI_INT_ENABLE_REG (PERIPHS_DPORT_BASEADDR)
134135
#define EDGE_INT_ENABLE_REG (PERIPHS_DPORT_BASEADDR + 0x04)
135136
#define WDT_EDGE_INT_ENABLE() SET_PERI_REG_MASK(EDGE_INT_ENABLE_REG, BIT0)
136137
#define TM1_EDGE_INT_ENABLE() SET_PERI_REG_MASK(EDGE_INT_ENABLE_REG, BIT1)

components/freertos/port/esp8266/port.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,24 +285,36 @@ void esp_dport_close_nmi(void)
285285
void IRAM_ATTR vPortETSIntrLock(void)
286286
{
287287
if (NMIIrqIsOn == 0) {
288+
uint32_t regval = REG_READ(NMI_INT_ENABLE_REG);
289+
290+
REG_WRITE(NMI_INT_ENABLE_REG, 0);
291+
288292
vPortEnterCritical();
289293
if (!ESP_NMI_IS_CLOSED()) {
290294
do {
291295
REG_WRITE(INT_ENA_WDEV, WDEV_TSF0_REACH_INT);
292296
} while(REG_READ(INT_ENA_WDEV) != WDEV_TSF0_REACH_INT);
293297
}
298+
299+
REG_WRITE(NMI_INT_ENABLE_REG, regval);
294300
}
295301
}
296302

297303
void IRAM_ATTR vPortETSIntrUnlock(void)
298304
{
299305
if (NMIIrqIsOn == 0) {
306+
uint32_t regval = REG_READ(NMI_INT_ENABLE_REG);
307+
308+
REG_WRITE(NMI_INT_ENABLE_REG, 0);
309+
300310
if (!ESP_NMI_IS_CLOSED()) {
301311
extern uint32_t WDEV_INTEREST_EVENT;
302312

303313
REG_WRITE(INT_ENA_WDEV, WDEV_INTEREST_EVENT);
304314
}
305315
vPortExitCritical();
316+
317+
REG_WRITE(NMI_INT_ENABLE_REG, regval);
306318
}
307319
}
308320

0 commit comments

Comments
 (0)