I've implemented a fault task in the FreeRTOS which is taking a binary semaphore used as a fault flag. That fault flag is triggered by the STM32 HAL error callback functions, such as HAL_I2C_ErrorCallback
or HAL_UART_ErrorCallback
. If an error occurs, error callbacks functions will call signalFault()
function, which will raise the fault flag by giving the binary semaphore.
My question is: is my signalFault()
function treated as an interrupt service routine (ISR) or not, because it is being called in the HAL ISR error callbacks? Do I need to call xSemaphoreGiveFromISR()
or xSemaphoreGive()
function in signalFault()
function to raise the fault flag?
Sure, you should use xSemaphoreGiveFromISR
if the calling context is an ISR.
A function called from an ISR is still part of the ISR.