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.
This commit is contained in:
Ivan Grokhotkov 2020-05-29 22:23:54 +02:00
parent 03bb2774d9
commit 614a580bbb
2 changed files with 3 additions and 3 deletions

View file

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

View file

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