feat(freertos) Define USE_FREERTOS_TASK_NOTIFY.

A direct to task notification is an event sent directly to a task, rather than
indirectly to a task via an intermediary object such as a queue, event group or semaphore.
Sending a direct to task notification to a task sets the state of the target task
notification to 'pending'. Just as a task can block on an intermediary object such
as a semaphore to wait for that semaphore to be available, a task can block on a task
notification to wait for that notification's state to become pending.

Unblocking an RTOS task with a direct notification is 45% faster and uses less RAM
than unblocking a task using an intermediary object such as a binary semaphore.

RTOS task notifications can only be used when there is only one task that can be the recipient of the event.

Signed-off-by: Nicușor Cîțu <nicusor.citu@nxp.com>
This commit is contained in:
Nicușor Cîțu
2023-07-10 15:48:07 +03:00
committed by Gabor Kiss-Vamosi
parent c63f1e45c7
commit c146d65a12
3 changed files with 40 additions and 1 deletions

View File

@@ -29,6 +29,14 @@ extern "C" {
* DEFINES
*********************/
/*
* Unblocking an RTOS task with a direct notification is 45% faster and uses less RAM
* than unblocking a task using an intermediary object such as a binary semaphore.
*
* RTOS task notifications can only be used when there is only one task that can be the recipient of the event.
*/
#define USE_FREERTOS_TASK_NOTIFY 1
/**********************
* TYPEDEFS
**********************/
@@ -45,12 +53,16 @@ typedef struct {
} lv_mutex_t;
typedef struct {
#if USE_FREERTOS_TASK_NOTIFY
TaskHandle_t xTaskToNotify;
#else
BaseType_t
xIsInitialized; /**< Set to pdTRUE if this condition variable is initialized, pdFALSE otherwise. */
SemaphoreHandle_t xCondWaitSemaphore; /**< Threads block on this semaphore in lv_thread_sync_wait. */
uint32_t ulWaitingThreads; /**< The number of threads currently waiting on this condition variable. */
SemaphoreHandle_t xSyncMutex; /**< Threads take this mutex before accessing the condition variable. */
BaseType_t xSyncSignal; /**< Set to pdTRUE if the thread is signaled, pdFALSE otherwise. */
#endif
} lv_thread_sync_t;
/**********************