Hey, this is not a support related matter, more a exchange of an idea.
I have yet to find a source that explain this, but I might just have overseen it.
The Idea is:
I have one interrupt routine, in my case from a timer, but really it can come from what ever.
The interrupt routine then handles 2 notification to 2 different task.
The interrupt routine look like this:
This code will then notify both task, using the one timer interrupt. Which can be useful on platforms with limited hardware, ex. timers.
I have already run some test with code, and I seems to work, but I want to know if this is the “correct” way of doing this, or if there is a more correct way to do it.
Note, you do NOT need multiple ‘was woken’ flags, as each notification call will set the flag true if a higher priority task was woken, and leave it unchanged if not (which is why you need to initialize it to false at the beginning).
Just make all your calls use the one xHigherPriorityTaskWoken flag, and test it at the end.
That will work but there is no need for the xTempPriorityWoken variable as the OR’ing [effectively] happens inside the xTaskNotifyFromISR() function. So the following will have the same outcome:
void IRQ_Timer1()
{
BaseType_t xHigherPriorityTaskWoken = pdFALSE;
for (int i = 0; i < task_count; i++)
{
//
xTaskNotifyFromISR(timer_task[i], 0x01, 1, &xHigherPriorityTaskWoken );
}
portYIELD_FROM_ISR(xHigherPriorityTaskWoken);
}
I have done as you recommended, and it works just as well as my original, so thanks for the pointer.
I original put the OR’ing in, to avoid that xHigherPriorityTaskWoken to be overwritten by a lower task in the array, which I was afraid would prevent the portYIELD_FROM_ISR to yield. Is that not an issue?
The “FromISR” functions only ever set the “HigherPriorityTaskWoken” flag to true. If a higher priority task is not woken then the flag is left unmodified (it is not cleared).