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

Function xTaskGenericNotify

tasks.c:5815–5926  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5813#if ( configUSE_TASK_NOTIFICATIONS == 1 )
5814
5815 BaseType_t xTaskGenericNotify( TaskHandle_t xTaskToNotify,
5816 UBaseType_t uxIndexToNotify,
5817 uint32_t ulValue,
5818 eNotifyAction eAction,
5819 uint32_t * pulPreviousNotificationValue )
5820 {
5821 TCB_t * pxTCB;
5822 BaseType_t xReturn = pdPASS;
5823 uint8_t ucOriginalNotifyState;
5824
5825 configASSERT( uxIndexToNotify < configTASK_NOTIFICATION_ARRAY_ENTRIES );
5826 configASSERT( xTaskToNotify );
5827 pxTCB = xTaskToNotify;
5828
5829 taskENTER_CRITICAL();
5830 {
5831 if( pulPreviousNotificationValue != NULL )
5832 {
5833 *pulPreviousNotificationValue = pxTCB->ulNotifiedValue[ uxIndexToNotify ];
5834 }
5835
5836 ucOriginalNotifyState = pxTCB->ucNotifyState[ uxIndexToNotify ];
5837
5838 pxTCB->ucNotifyState[ uxIndexToNotify ] = taskNOTIFICATION_RECEIVED;
5839
5840 switch( eAction )
5841 {
5842 case eSetBits:
5843 pxTCB->ulNotifiedValue[ uxIndexToNotify ] |= ulValue;
5844 break;
5845
5846 case eIncrement:
5847 ( pxTCB->ulNotifiedValue[ uxIndexToNotify ] )++;
5848 break;
5849
5850 case eSetValueWithOverwrite:
5851 pxTCB->ulNotifiedValue[ uxIndexToNotify ] = ulValue;
5852 break;
5853
5854 case eSetValueWithoutOverwrite:
5855
5856 if( ucOriginalNotifyState != taskNOTIFICATION_RECEIVED )
5857 {
5858 pxTCB->ulNotifiedValue[ uxIndexToNotify ] = ulValue;
5859 }
5860 else
5861 {
5862 /* The value could not be written to the task. */
5863 xReturn = pdFAIL;
5864 }
5865
5866 break;
5867
5868 case eNoAction:
5869
5870 /* The task is being notified without its notify value being
5871 * updated. */
5872 break;

Callers 1

MPU_xTaskGenericNotifyFunction · 0.85

Calls 3

uxListRemoveFunction · 0.85
prvYieldForTaskFunction · 0.85

Tested by

no test coverage detected