Chapter 2. API Reference
When task notifications are being used as a binary or counting semaphore equivalent then the task being no-
tified should wait for the notification using the ulTaskNotificationTakeIndexed() API function rather than the
xTaskNotifyWaitIndexed() API function.
NOTE Each notification within the array operates independently - a task can only block on one notification
within the array at a time and will not be unblocked by a notification sent to any other array index.
Backward compatibility information: Prior to FreeRTOS V10.4.0 each task had a single “notification value”
, and all task notification API functions operated on that value. Replacing the single notification value with
an array of notification values necessitated a new set of API functions that could address specific notifications
within the array. xTaskNotifyGive() is the original API function, and remains backward compatible by always
operating on the notification value at index 0 in the array. Calling xTaskNotifyGive() is equivalent to calling
xTaskNotifyGiveIndexed() with the uxIndexToNotify parameter set to 0.
Return xTaskNotifyGive() is a macro that calls xTaskNotify() with the eAction parameter set to eIncrement
- so pdPASS is always returned.
Parameters
• xTaskToNotify: The handle of the task being notified. The handle to a task can be returned
from the xTaskCreate() API function used to create the task, and the handle of the currently running
task can be obtained by calling xTaskGetCurrentTaskHandle().
• uxIndexToNotify: The index within the target task’s array of notification values
to which the notification is to be sent. uxIndexToNotify must be less than config-
TASK_NOTIFICATION_ARRAY_ENTRIES. xTaskNotifyGive() does not have this parameter
and always sends notifications to index 0.
xTaskNotifyGiveIndexed(xTaskToNotify, uxIndexToNotify)
vTaskNotifyGiveFromISR(xTaskToNotify, pxHigherPriorityTaskWoken)
vTaskNotifyGiveIndexedFromISR(xTaskToNotify, uxIndexToNotify, pxHigherPriorityTaskWo-
ken)
ulTaskNotifyTake(xClearCountOnExit, xTicksToWait)
ulTaskNotifyTakeIndexed(uxIndexToWaitOn, xClearCountOnExit, xTicksToWait)
xTaskNotifyStateClear(xTask)
xTaskNotifyStateClearIndexed(xTask, uxIndexToClear)
ulTaskNotifyValueClear(xTask, ulBitsToClear)
ulTaskNotifyValueClearIndexed(xTask, uxIndexToClear, ulBitsToClear)
Type Definitions
typedef struct tskTaskControlBlock *TaskHandle_t
typedef BaseType_t (*TaskHookFunction_t)(void *)
Defines the prototype to which the application task hook function must conform.
typedef void (*TlsDeleteCallbackFunction_t)(int, void *)
Prototype of local storage pointer deletion callback.
Enumerations
enum eTaskState
Task states returned by eTaskGetState.
Values:
eRunning = 0
eReady
eBlocked
eSuspended
Espressif Systems 882
Submit Document Feedback
Release v4.4