mirror of
https://github.com/lvgl/lvgl.git
synced 2026-05-24 16:37:18 +08:00
feat(freertos): support Espressif's FreeRTOS flavor (#5862)
This commit is contained in:
@@ -154,7 +154,7 @@ menu "LVGL configuration"
|
||||
default 4 if LV_OS_RTTHREAD
|
||||
default 5 if LV_OS_WINDOWS
|
||||
default 255 if LV_OS_CUSTOM
|
||||
|
||||
|
||||
config LV_OS_CUSTOM_INCLUDE
|
||||
string "Custom OS include header"
|
||||
default "stdint.h"
|
||||
|
||||
@@ -782,7 +782,7 @@
|
||||
* - LV_OS_CMSIS_RTOS2
|
||||
* - LV_OS_RTTHREAD
|
||||
* - LV_OS_WINDOWS
|
||||
* - LV_OS_CUSTOM
|
||||
* - LV_OS_CUSTOM
|
||||
*/
|
||||
#define LV_USE_OS LV_OS_PTHREAD
|
||||
|
||||
@@ -805,7 +805,7 @@
|
||||
* - LV_OS_CMSIS_RTOS2
|
||||
* - LV_OS_RTTHREAD
|
||||
* - LV_OS_WINDOWS
|
||||
* - LV_OS_CUSTOM
|
||||
* - LV_OS_CUSTOM
|
||||
*/
|
||||
#define LV_USE_OS LV_OS_FREERTOS
|
||||
|
||||
@@ -828,7 +828,7 @@
|
||||
* - LV_OS_CMSIS_RTOS2
|
||||
* - LV_OS_RTTHREAD
|
||||
* - LV_OS_WINDOWS
|
||||
* - LV_OS_CUSTOM
|
||||
* - LV_OS_CUSTOM
|
||||
*/
|
||||
#define LV_USE_OS LV_OS_CMSIS_RTOS2
|
||||
|
||||
@@ -851,7 +851,7 @@
|
||||
* - LV_OS_CMSIS_RTOS2
|
||||
* - LV_OS_RTTHREAD
|
||||
* - LV_OS_WINDOWS
|
||||
* - LV_OS_CUSTOM
|
||||
* - LV_OS_CUSTOM
|
||||
*/
|
||||
#define LV_USE_OS LV_OS_RTTHREAD
|
||||
|
||||
@@ -874,7 +874,7 @@
|
||||
* - LV_OS_CMSIS_RTOS2
|
||||
* - LV_OS_RTTHREAD
|
||||
* - LV_OS_WINDOWS
|
||||
* - LV_OS_CUSTOM
|
||||
* - LV_OS_CUSTOM
|
||||
*/
|
||||
#define LV_USE_OS LV_OS_WINDOWS
|
||||
|
||||
@@ -898,7 +898,7 @@
|
||||
* - LV_OS_CMSIS_RTOS2
|
||||
* - LV_OS_RTTHREAD
|
||||
* - LV_OS_WINDOWS
|
||||
* - LV_OS_CUSTOM
|
||||
* - LV_OS_CUSTOM
|
||||
*/
|
||||
#define LV_USE_OS LV_OS_CUSTOM
|
||||
#define LV_OS_CUSTOM_INCLUDE "lv_os_custom.h"
|
||||
|
||||
+22
-6
@@ -16,9 +16,13 @@
|
||||
|
||||
#if LV_USE_OS == LV_OS_FREERTOS
|
||||
|
||||
#include "atomic.h"
|
||||
#include "../misc/lv_log.h"
|
||||
#if (ESP_PLATFORM)
|
||||
#include "freertos/atomic.h"
|
||||
#else
|
||||
#include "atomic.h"
|
||||
#endif
|
||||
|
||||
#include "../misc/lv_log.h"
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
@@ -55,10 +59,22 @@ static void prvTestAndDecrement(lv_thread_sync_t * pxCond,
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
|
||||
#if (ESP_PLATFORM)
|
||||
static portMUX_TYPE critSectionMux = portMUX_INITIALIZER_UNLOCKED;
|
||||
#endif
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#if (ESP_PLATFORM)
|
||||
#define _enter_critical() taskENTER_CRITICAL(&critSectionMux);
|
||||
#define _exit_critical() taskEXIT_CRITICAL(&critSectionMux);
|
||||
#else
|
||||
#define _enter_critical() taskENTER_CRITICAL();
|
||||
#define _exit_critical() taskEXIT_CRITICAL();
|
||||
#endif
|
||||
|
||||
/**********************
|
||||
* GLOBAL FUNCTIONS
|
||||
**********************/
|
||||
@@ -336,7 +352,7 @@ static void prvCheckMutexInit(lv_mutex_t * pxMutex)
|
||||
if(pxMutex->xIsInitialized == pdFALSE) {
|
||||
/* Mutex initialization must be in a critical section to prevent two threads
|
||||
* from initializing it at the same time. */
|
||||
taskENTER_CRITICAL();
|
||||
_enter_critical();
|
||||
|
||||
/* Check again that the mutex is still uninitialized, i.e. it wasn't
|
||||
* initialized while this function was waiting to enter the critical
|
||||
@@ -346,7 +362,7 @@ static void prvCheckMutexInit(lv_mutex_t * pxMutex)
|
||||
}
|
||||
|
||||
/* Exit the critical section. */
|
||||
taskEXIT_CRITICAL();
|
||||
_exit_critical();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -385,7 +401,7 @@ static void prvCheckCondInit(lv_thread_sync_t * pxCond)
|
||||
if(pxCond->xIsInitialized == pdFALSE) {
|
||||
/* Cond initialization must be in a critical section to prevent two
|
||||
* threads from initializing it at the same time. */
|
||||
taskENTER_CRITICAL();
|
||||
_enter_critical();
|
||||
|
||||
/* Check again that the condition is still uninitialized, i.e. it wasn't
|
||||
* initialized while this function was waiting to enter the critical
|
||||
@@ -395,7 +411,7 @@ static void prvCheckCondInit(lv_thread_sync_t * pxCond)
|
||||
}
|
||||
|
||||
/* Exit the critical section. */
|
||||
taskEXIT_CRITICAL();
|
||||
_exit_critical();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -23,9 +23,15 @@ extern "C" {
|
||||
|
||||
#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
|
||||
|
||||
Reference in New Issue
Block a user