Hello,
I am using task notifications as event groups. Most of events are passed from interrupt but I also need to send one bit from different task in order to perform safe clean and task exit.
Task is responsible for processing audio samples and then place them in StreamBuffer. This is where problems begin. If I notify task which is in blocked state waiting for free space in StreamBuffer then somehow it is ignored. It never unblocks task. If I change code to non blocking by setting timeouts to 0 everything is working correctly.
It’s something obvious that I am missing here…
~~~
while(1)
{
xTaskNotifyWait( 0x00, /* Don’t clear any bits on entry.
/
UINT32_MAX, / Clear all bits on exit.
/
&ulNotificationValue, / Receives the notification value.
/
portMAX_DELAY ); / Block indefinitely. */
if(ulNotificationValue & EventStop){
goto cleanup;
}
if(ulNotificationValue & EventOutBufferHalfFull){
// Code here will blocked until there is free space in StreamBuffer
}
if(ulNotificationValue & EventOutBufferFull){
// Same as above
}
}
cleanup:
// clean and vTaskDelete(NULL)
~~~
Interrupt routine:
~~~
void IRQ(void)
{
BaseType
t xHigherPriorityTaskWoken = pdFALSE;
codecevent_t state = EventInBufferHalfFull;
/* Notify the task that the transmission is complete. */
if(codec_in_worker_handler){
xTaskNotifyFromISR(codec_in_worker_handler,state,eSetBits , &xHigherPriorityTaskWoken);
}
....
}
~~~
And Stop event being send from another task:
~~~
codec
eventt state = EventStop;
// Send close event to worker
xTaskNotify(codec_in_worker_handler,state,eSetBits);
~~~
Any ideas ?
Best regards
Mateusz Piesta