Explorar o código

freertos, soc: don't lower INTLEVEL when entering critical sections

This fixes the issue where XTOS_SET_INTLEVEL would lower INTLEVEL from
4 to 3, when eTaskGetState is invoked during the core dump, triggered
from the interrupt watchdog.
Ivan Grokhotkov %!s(int64=5) %!d(string=hai) anos
pai
achega
614a580bbb

+ 1 - 1
components/freertos/xtensa/include/freertos/portmacro.h

@@ -144,7 +144,7 @@ static inline uint32_t xPortGetCoreID(void);
 // They can be called from interrupts too.
 // WARNING: Only applies to current CPU. See notes above.
 static inline unsigned portENTER_CRITICAL_NESTED(void) {
-	unsigned state = XTOS_SET_INTLEVEL(XCHAL_EXCM_LEVEL);
+	unsigned state = XTOS_SET_MIN_INTLEVEL(XCHAL_EXCM_LEVEL);
 	portbenchmarkINTERRUPT_DISABLE();
 	return state;
 }

+ 2 - 2
components/soc/include/soc/spinlock.h

@@ -67,7 +67,7 @@ static inline bool __attribute__((always_inline)) spinlock_acquire(spinlock_t *l
     uint32_t core_id, other_core_id;
    
     assert(lock);
-    irq_status = XTOS_SET_INTLEVEL(XCHAL_EXCM_LEVEL);    
+    irq_status = XTOS_SET_MIN_INTLEVEL(XCHAL_EXCM_LEVEL);    
  
     if(timeout != SPINLOCK_WAIT_FOREVER){
         RSR(CCOUNT, ccount_start);   
@@ -139,7 +139,7 @@ static inline void __attribute__((always_inline)) spinlock_release(spinlock_t *l
     uint32_t core_id;
 
     assert(lock);
-    irq_status = XTOS_SET_INTLEVEL(XCHAL_EXCM_LEVEL);
+    irq_status = XTOS_SET_MIN_INTLEVEL(XCHAL_EXCM_LEVEL);
         
     RSR(PRID, core_id);
     assert(core_id == lock->owner); // This is a mutex we didn't lock, or it's corrupt