blob: 093500611e1c62bf8673bfcbb4621d10812317b5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
/**
* @file lv_freertos.h
*
*/
/**
* Copyright 2023 NXP
*
* SPDX-License-Identifier: MIT
*/
#ifndef LV_FREERTOS_H
#define LV_FREERTOS_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "lv_os.h"
#if LV_USE_OS == LV_OS_FREERTOS
#if (ESP_PLATFORM)
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "freertos/semphr.h"
#else
#include "FreeRTOS.h"
#include "task.h"
#include "semphr.h"
#endif
/*********************
* 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
**********************/
typedef struct {
void (*pvStartRoutine)(void *); /**< Application thread function. */
void * xTaskArg; /**< Arguments for application thread function. */
TaskHandle_t xTaskHandle; /**< FreeRTOS task handle. */
} lv_thread_t;
typedef struct {
BaseType_t xIsInitialized; /**< Set to pdTRUE if this mutex is initialized, pdFALSE otherwise. */
SemaphoreHandle_t xMutex; /**< FreeRTOS mutex. */
} 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;
/**********************
* GLOBAL PROTOTYPES
**********************/
/**********************
* MACROS
**********************/
#endif /*LV_USE_OS == LV_OS_FREERTOS*/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_FREERTOS_H*/
|