MCPcopy Create free account
hub / github.com/FreeRTOS/FreeRTOS-Kernel / xTaskGenericNotifyWait

Function xTaskGenericNotifyWait

tasks.c:5729–5808  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5727#if ( configUSE_TASK_NOTIFICATIONS == 1 )
5728
5729 BaseType_t xTaskGenericNotifyWait( UBaseType_t uxIndexToWait,
5730 uint32_t ulBitsToClearOnEntry,
5731 uint32_t ulBitsToClearOnExit,
5732 uint32_t * pulNotificationValue,
5733 TickType_t xTicksToWait )
5734 {
5735 BaseType_t xReturn;
5736
5737 configASSERT( uxIndexToWait < configTASK_NOTIFICATION_ARRAY_ENTRIES );
5738
5739 taskENTER_CRITICAL();
5740 {
5741 /* Only block if a notification is not already pending. */
5742 if( pxCurrentTCB->ucNotifyState[ uxIndexToWait ] != taskNOTIFICATION_RECEIVED )
5743 {
5744 /* Clear bits in the task's notification value as bits may get
5745 * set by the notifying task or interrupt. This can be used to
5746 * clear the value to zero. */
5747 pxCurrentTCB->ulNotifiedValue[ uxIndexToWait ] &= ~ulBitsToClearOnEntry;
5748
5749 /* Mark this task as waiting for a notification. */
5750 pxCurrentTCB->ucNotifyState[ uxIndexToWait ] = taskWAITING_NOTIFICATION;
5751
5752 if( xTicksToWait > ( TickType_t ) 0 )
5753 {
5754 prvAddCurrentTaskToDelayedList( xTicksToWait, pdTRUE );
5755 traceTASK_NOTIFY_WAIT_BLOCK( uxIndexToWait );
5756
5757 /* All ports are written to allow a yield in a critical
5758 * section (some will yield immediately, others wait until the
5759 * critical section exits) - but it is not something that
5760 * application code should ever do. */
5761 vTaskYieldWithinAPI();
5762 }
5763 else
5764 {
5765 mtCOVERAGE_TEST_MARKER();
5766 }
5767 }
5768 else
5769 {
5770 mtCOVERAGE_TEST_MARKER();
5771 }
5772 }
5773 taskEXIT_CRITICAL();
5774
5775 taskENTER_CRITICAL();
5776 {
5777 traceTASK_NOTIFY_WAIT( uxIndexToWait );
5778
5779 if( pulNotificationValue != NULL )
5780 {
5781 /* Output the current notification value, which may or may not
5782 * have changed. */
5783 *pulNotificationValue = pxCurrentTCB->ulNotifiedValue[ uxIndexToWait ];
5784 }
5785
5786 /* If ucNotifyValue is set then either the task never entered the

Callers 1

Calls 2

vTaskYieldWithinAPIFunction · 0.85

Tested by

no test coverage detected