s-igren
(S Igren)
May 14, 2023, 1:50pm
1
I know that while using RTOS api in ISR i have to check for higher priority task for context switching.
My question here is, i am calling 2 api function in ISR, as below
xQueueSendFromISR( state, void * ) &lu8Command,
&xHigherPriorityTaskWoken);
and
xEventGroupSetBitsFromISR(status, BIT_TX_DONE,
&xHigherPriorityTaskWoken);
So how do i handle
if (xHigherPriorityTaskWoken) {
portYIELD_FROM_ISR(xHigherPriorityTaskWoken);
}
Do i have to call i twice after every api call or calling it once is safe ?
hs2
(Hartmut Schaefer)
May 14, 2023, 1:59pm
2
The thing is that the FromISR functions only set the xHigherPriorityTaskWoken to pdTRUE if applicable. Hence the variable must be initialized to pdFALSE.
So it’s designed to call it just once or alternatively simply the portEND_SWITCHING_ISR wrapper at the end of the ISR.
1 Like
s-igren
(S Igren)
May 22, 2023, 5:10am
3
Hey @hs2 Thanks for reply
sorry i got occupied with some other work. So i should call portEND_SWITCHING_ISRTRUE at end ?
also do i have to call FromISR from freertos timer callback ?
aggarg
(Gaurav Aggarwal)
May 22, 2023, 6:05am
4
Yes, that is right.
Do you mean portEND_SWITCHING_ISR? If so, no, you do not need to call it form a FreeRTOS timer callback.
1 Like