freertos: fix compilation errors with portMUX debugging enabled
Fixes https://github.com/espressif/esp-idf/issues/1057 Ref TW15702.
This commit is contained in:
parent
8e47c355fa
commit
715d081341
4 changed files with 11 additions and 3 deletions
|
@ -54,7 +54,11 @@ esp_err_t esp_apptrace_lock_take(esp_apptrace_lock_t *lock, esp_apptrace_tmo_t *
|
||||||
// FIXME: if mux is busy it is not good idea to loop during the whole tmo with disabled IRQs.
|
// FIXME: if mux is busy it is not good idea to loop during the whole tmo with disabled IRQs.
|
||||||
// So we check mux state using zero tmo, restore IRQs and let others tasks/IRQs to run on this CPU
|
// So we check mux state using zero tmo, restore IRQs and let others tasks/IRQs to run on this CPU
|
||||||
// while we are doing our own tmo check.
|
// while we are doing our own tmo check.
|
||||||
|
#ifdef CONFIG_FREERTOS_PORTMUX_DEBUG
|
||||||
|
bool success = vPortCPUAcquireMutexTimeout(&lock->mux, 0, __FUNCTION__, __LINE__);
|
||||||
|
#else
|
||||||
bool success = vPortCPUAcquireMutexTimeout(&lock->mux, 0);
|
bool success = vPortCPUAcquireMutexTimeout(&lock->mux, 0);
|
||||||
|
#endif
|
||||||
if (success) {
|
if (success) {
|
||||||
lock->int_state = int_state;
|
lock->int_state = int_state;
|
||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
|
@ -75,7 +79,11 @@ esp_err_t esp_apptrace_lock_give(esp_apptrace_lock_t *lock)
|
||||||
unsigned int_state = lock->int_state;
|
unsigned int_state = lock->int_state;
|
||||||
// after call to the following func we can not be sure that lock->int_state
|
// after call to the following func we can not be sure that lock->int_state
|
||||||
// is not overwritten by other CPU who has acquired the mux just after we released it. See esp_apptrace_lock_take().
|
// is not overwritten by other CPU who has acquired the mux just after we released it. See esp_apptrace_lock_take().
|
||||||
|
#ifdef CONFIG_FREERTOS_PORTMUX_DEBUG
|
||||||
|
vPortCPUReleaseMutex(&lock->mux, __FUNCTION__, __LINE__);
|
||||||
|
#else
|
||||||
vPortCPUReleaseMutex(&lock->mux);
|
vPortCPUReleaseMutex(&lock->mux);
|
||||||
|
#endif
|
||||||
portEXIT_CRITICAL_NESTED(int_state);
|
portEXIT_CRITICAL_NESTED(int_state);
|
||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -206,7 +206,7 @@ void vPortCPUInitializeMutex(portMUX_TYPE *mux);
|
||||||
#ifdef CONFIG_FREERTOS_PORTMUX_DEBUG
|
#ifdef CONFIG_FREERTOS_PORTMUX_DEBUG
|
||||||
void vPortCPUAcquireMutex(portMUX_TYPE *mux, const char *function, int line);
|
void vPortCPUAcquireMutex(portMUX_TYPE *mux, const char *function, int line);
|
||||||
bool vPortCPUAcquireMutexTimeout(portMUX_TYPE *mux, int timeout_cycles, const char *function, int line);
|
bool vPortCPUAcquireMutexTimeout(portMUX_TYPE *mux, int timeout_cycles, const char *function, int line);
|
||||||
portBASE_TYPE vPortCPUReleaseMutex(portMUX_TYPE *mux, const char *function, int line);
|
void vPortCPUReleaseMutex(portMUX_TYPE *mux, const char *function, int line);
|
||||||
|
|
||||||
|
|
||||||
void vTaskEnterCritical( portMUX_TYPE *mux, const char *function, int line );
|
void vTaskEnterCritical( portMUX_TYPE *mux, const char *function, int line );
|
||||||
|
|
|
@ -319,7 +319,7 @@ void vPortCPUAcquireMutex(portMUX_TYPE *mux, const char *fnName, int line) {
|
||||||
portEXIT_CRITICAL_NESTED(irqStatus);
|
portEXIT_CRITICAL_NESTED(irqStatus);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool vPortCPUAcquireMutexTimeout(portMUX_TYPE *mux, uint32_t timeout_cycles, const char *fnName, int line) {
|
bool vPortCPUAcquireMutexTimeout(portMUX_TYPE *mux, int timeout_cycles, const char *fnName, int line) {
|
||||||
unsigned int irqStatus = portENTER_CRITICAL_NESTED();
|
unsigned int irqStatus = portENTER_CRITICAL_NESTED();
|
||||||
bool result = vPortCPUAcquireMutexIntsDisabled(mux, timeout_cycles, fnName, line);
|
bool result = vPortCPUAcquireMutexIntsDisabled(mux, timeout_cycles, fnName, line);
|
||||||
portEXIT_CRITICAL_NESTED(irqStatus);
|
portEXIT_CRITICAL_NESTED(irqStatus);
|
||||||
|
|
|
@ -2841,7 +2841,7 @@ void vTaskSwitchContext( void )
|
||||||
//Exit critical region manually as well: release the mux now, interrupts will be re-enabled when we
|
//Exit critical region manually as well: release the mux now, interrupts will be re-enabled when we
|
||||||
//exit the function.
|
//exit the function.
|
||||||
#ifdef CONFIG_FREERTOS_PORTMUX_DEBUG
|
#ifdef CONFIG_FREERTOS_PORTMUX_DEBUG
|
||||||
vPortCPUReleaseMutex( &xTaskQueueMutex, function, line );
|
vPortCPUReleaseMutex( &xTaskQueueMutex, __FUNCTION__, __LINE__ );
|
||||||
#else
|
#else
|
||||||
vPortCPUReleaseMutex( &xTaskQueueMutex );
|
vPortCPUReleaseMutex( &xTaskQueueMutex );
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue