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

Function xTaskGenericNotifyFromISR

tasks.c:5933–6058  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5931#if ( configUSE_TASK_NOTIFICATIONS == 1 )
5932
5933 BaseType_t xTaskGenericNotifyFromISR( TaskHandle_t xTaskToNotify,
5934 UBaseType_t uxIndexToNotify,
5935 uint32_t ulValue,
5936 eNotifyAction eAction,
5937 uint32_t * pulPreviousNotificationValue,
5938 BaseType_t * pxHigherPriorityTaskWoken )
5939 {
5940 TCB_t * pxTCB;
5941 uint8_t ucOriginalNotifyState;
5942 BaseType_t xReturn = pdPASS;
5943 UBaseType_t uxSavedInterruptStatus;
5944
5945 configASSERT( xTaskToNotify );
5946 configASSERT( uxIndexToNotify < configTASK_NOTIFICATION_ARRAY_ENTRIES );
5947
5948 /* RTOS ports that support interrupt nesting have the concept of a
5949 * maximum system call (or maximum API call) interrupt priority.
5950 * Interrupts that are above the maximum system call priority are keep
5951 * permanently enabled, even when the RTOS kernel is in a critical section,
5952 * but cannot make any calls to FreeRTOS API functions. If configASSERT()
5953 * is defined in FreeRTOSConfig.h then
5954 * portASSERT_IF_INTERRUPT_PRIORITY_INVALID() will result in an assertion
5955 * failure if a FreeRTOS API function is called from an interrupt that has
5956 * been assigned a priority above the configured maximum system call
5957 * priority. Only FreeRTOS functions that end in FromISR can be called
5958 * from interrupts that have been assigned a priority at or (logically)
5959 * below the maximum system call interrupt priority. FreeRTOS maintains a
5960 * separate interrupt safe API to ensure interrupt entry is as fast and as
5961 * simple as possible. More information (albeit Cortex-M specific) is
5962 * provided on the following link:
5963 * https://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html */
5964 portASSERT_IF_INTERRUPT_PRIORITY_INVALID();
5965
5966 pxTCB = xTaskToNotify;
5967
5968 uxSavedInterruptStatus = portSET_INTERRUPT_MASK_FROM_ISR();
5969 {
5970 if( pulPreviousNotificationValue != NULL )
5971 {
5972 *pulPreviousNotificationValue = pxTCB->ulNotifiedValue[ uxIndexToNotify ];
5973 }
5974
5975 ucOriginalNotifyState = pxTCB->ucNotifyState[ uxIndexToNotify ];
5976 pxTCB->ucNotifyState[ uxIndexToNotify ] = taskNOTIFICATION_RECEIVED;
5977
5978 switch( eAction )
5979 {
5980 case eSetBits:
5981 pxTCB->ulNotifiedValue[ uxIndexToNotify ] |= ulValue;
5982 break;
5983
5984 case eIncrement:
5985 ( pxTCB->ulNotifiedValue[ uxIndexToNotify ] )++;
5986 break;
5987
5988 case eSetValueWithOverwrite:
5989 pxTCB->ulNotifiedValue[ uxIndexToNotify ] = ulValue;
5990 break;

Callers

nothing calls this directly

Calls 3

uxListRemoveFunction · 0.85
vListInsertEndFunction · 0.85
prvYieldForTaskFunction · 0.85

Tested by

no test coverage detected