fix(freertos): Fix broken portable macro portTRY_ENTER_CRITICAL_SAFE()

This commit fixes a bug where the portTRY_ENTER_CRITICAL_SAFE() for the
Xtensa and RISC-V FreeRTOS ports were broken as it did not correctly use
the timeout parameter.

Merges: https://github.com/espressif/esp-idf/pull/13022
This commit is contained in:
Andy Lin 2024-01-21 04:08:54 +08:00 committed by Sudeep Mohanty
parent f909dddde7
commit 4f6deb9f61
2 changed files with 10 additions and 5 deletions

View File

@ -146,7 +146,7 @@ typedef uint32_t TickType_t;
UBaseType_t xPortSetInterruptMaskFromISR(void);
/**
* @brief Reenable interrupts in a nested manner (meant to be called from ISRs)
* @brief Re-enable interrupts in a nested manner (meant to be called from ISRs)
*
* @warning Only applies to current CPU.
* @param prev_int_level Previous interrupt level
@ -510,7 +510,7 @@ void vPortTCBPreDeleteHook( void *pxTCB );
#define portENTER_CRITICAL_ISR(mux) vPortEnterCriticalMultiCore(mux)
#define portEXIT_CRITICAL_ISR(mux) vPortExitCriticalMultiCore(mux)
#define portTRY_ENTER_CRITICAL_SAFE(mux, timeout) xPortEnterCriticalTimeoutSafe(mux)
#define portTRY_ENTER_CRITICAL_SAFE(mux, timeout) xPortEnterCriticalTimeoutSafe(mux, timeout)
#define portENTER_CRITICAL_SAFE(mux) vPortEnterCriticalSafe(mux)
#define portEXIT_CRITICAL_SAFE(mux) vPortExitCriticalSafe(mux)
#else
@ -544,7 +544,12 @@ void vPortTCBPreDeleteHook( void *pxTCB );
portEXIT_CRITICAL(mux); \
} \
})
#define portTRY_ENTER_CRITICAL_SAFE(mux, timeout) portENTER_CRITICAL_SAFE(mux, timeout)
#define portTRY_ENTER_CRITICAL_SAFE(mux, timeout) ({ \
(void)timeout; \
portENTER_CRITICAL_SAFE(mux); \
BaseType_t ret = pdPASS; \
ret; \
})
#endif /* (configNUM_CORES > 1) */

View File

@ -172,7 +172,7 @@ BaseType_t xPortInterruptedFromISRContext(void);
static inline UBaseType_t xPortSetInterruptMaskFromISR(void);
/**
* @brief Reenable interrupts in a nested manner (meant to be called from ISRs)
* @brief Re-enable interrupts in a nested manner (meant to be called from ISRs)
*
* @warning Only applies to current CPU.
* @param prev_level Previous interrupt level
@ -460,7 +460,7 @@ void vPortTCBPreDeleteHook( void *pxTCB );
#define portENTER_CRITICAL_ISR(mux) vPortEnterCritical(mux)
#define portEXIT_CRITICAL_ISR(mux) vPortExitCritical(mux)
#define portTRY_ENTER_CRITICAL_SAFE(mux, timeout) xPortEnterCriticalTimeoutSafe(mux)
#define portTRY_ENTER_CRITICAL_SAFE(mux, timeout) xPortEnterCriticalTimeoutSafe(mux, timeout)
#define portENTER_CRITICAL_SAFE(mux) vPortEnterCriticalSafe(mux)
#define portEXIT_CRITICAL_SAFE(mux) vPortExitCriticalSafe(mux)