From 547378a329e31bfd2d83f342a0de22b69c34f0e6 Mon Sep 17 00:00:00 2001 From: Zhang Jun Hao Date: Wed, 25 Nov 2020 11:15:17 +0800 Subject: [PATCH] fix(freertos): disable other task before disable nmi --- components/freertos/port/esp8266/port.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/components/freertos/port/esp8266/port.c b/components/freertos/port/esp8266/port.c index 2dc081e3..91c7cdc0 100644 --- a/components/freertos/port/esp8266/port.c +++ b/components/freertos/port/esp8266/port.c @@ -283,9 +283,10 @@ void IRAM_ATTR vPortETSIntrLock(void) if (NMIIrqIsOn == 0) { uint32_t regval = REG_READ(NMI_INT_ENABLE_REG); + vPortEnterCritical(); + REG_WRITE(NMI_INT_ENABLE_REG, 0); - vPortEnterCritical(); if (!ESP_NMI_IS_CLOSED()) { do { REG_WRITE(INT_ENA_WDEV, WDEV_TSF0_REACH_INT); @@ -308,9 +309,10 @@ void IRAM_ATTR vPortETSIntrUnlock(void) REG_WRITE(INT_ENA_WDEV, WDEV_INTEREST_EVENT); } - vPortExitCritical(); REG_WRITE(NMI_INT_ENABLE_REG, regval); + + vPortExitCritical(); } }