diff --git a/Kconfig b/Kconfig index c947b375f..44540c9fa 100644 --- a/Kconfig +++ b/Kconfig @@ -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" diff --git a/env_support/cmsis-pack/LVGL.lvgl.pdsc b/env_support/cmsis-pack/LVGL.lvgl.pdsc index 999ed5ce9..e69ba16d8 100644 --- a/env_support/cmsis-pack/LVGL.lvgl.pdsc +++ b/env_support/cmsis-pack/LVGL.lvgl.pdsc @@ -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" diff --git a/src/osal/lv_freertos.c b/src/osal/lv_freertos.c index 69be08de8..0f7f678bc 100644 --- a/src/osal/lv_freertos.c +++ b/src/osal/lv_freertos.c @@ -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(); } } diff --git a/src/osal/lv_freertos.h b/src/osal/lv_freertos.h index 06f98f39a..093500611 100644 --- a/src/osal/lv_freertos.h +++ b/src/osal/lv_freertos.h @@ -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