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

Function vTaskGenericNotifyGiveFromISR

tasks.c:6065–6140  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6063#if ( configUSE_TASK_NOTIFICATIONS == 1 )
6064
6065 void vTaskGenericNotifyGiveFromISR( TaskHandle_t xTaskToNotify,
6066 UBaseType_t uxIndexToNotify,
6067 BaseType_t * pxHigherPriorityTaskWoken )
6068 {
6069 TCB_t * pxTCB;
6070 uint8_t ucOriginalNotifyState;
6071 UBaseType_t uxSavedInterruptStatus;
6072
6073 configASSERT( xTaskToNotify );
6074 configASSERT( uxIndexToNotify < configTASK_NOTIFICATION_ARRAY_ENTRIES );
6075
6076 /* RTOS ports that support interrupt nesting have the concept of a
6077 * maximum system call (or maximum API call) interrupt priority.
6078 * Interrupts that are above the maximum system call priority are keep
6079 * permanently enabled, even when the RTOS kernel is in a critical section,
6080 * but cannot make any calls to FreeRTOS API functions. If configASSERT()
6081 * is defined in FreeRTOSConfig.h then
6082 * portASSERT_IF_INTERRUPT_PRIORITY_INVALID() will result in an assertion
6083 * failure if a FreeRTOS API function is called from an interrupt that has
6084 * been assigned a priority above the configured maximum system call
6085 * priority. Only FreeRTOS functions that end in FromISR can be called
6086 * from interrupts that have been assigned a priority at or (logically)
6087 * below the maximum system call interrupt priority. FreeRTOS maintains a
6088 * separate interrupt safe API to ensure interrupt entry is as fast and as
6089 * simple as possible. More information (albeit Cortex-M specific) is
6090 * provided on the following link:
6091 * https://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html */
6092 portASSERT_IF_INTERRUPT_PRIORITY_INVALID();
6093
6094 pxTCB = xTaskToNotify;
6095
6096 uxSavedInterruptStatus = portSET_INTERRUPT_MASK_FROM_ISR();
6097 {
6098 ucOriginalNotifyState = pxTCB->ucNotifyState[ uxIndexToNotify ];
6099 pxTCB->ucNotifyState[ uxIndexToNotify ] = taskNOTIFICATION_RECEIVED;
6100
6101 /* 'Giving' is equivalent to incrementing a count in a counting
6102 * semaphore. */
6103 ( pxTCB->ulNotifiedValue[ uxIndexToNotify ] )++;
6104
6105 traceTASK_NOTIFY_GIVE_FROM_ISR( uxIndexToNotify );
6106
6107 /* If the task is in the blocked state specifically to wait for a
6108 * notification then unblock it now. */
6109 if( ucOriginalNotifyState == taskWAITING_NOTIFICATION )
6110 {
6111 /* The task should not have been on an event list. */
6112 configASSERT( listLIST_ITEM_CONTAINER( &( pxTCB->xEventListItem ) ) == NULL );
6113
6114 if( uxSchedulerSuspended == ( UBaseType_t ) pdFALSE )
6115 {
6116 ( void ) uxListRemove( &( pxTCB->xStateListItem ) );
6117 prvAddTaskToReadyList( pxTCB );
6118 }
6119 else
6120 {
6121 /* The delayed and ready lists cannot be accessed, so hold
6122 * this task pending until the scheduler is resumed. */

Callers

nothing calls this directly

Calls 3

uxListRemoveFunction · 0.85
vListInsertEndFunction · 0.85
prvYieldForTaskFunction · 0.85

Tested by

no test coverage detected