From 777c1f150bdd732b6065e0b50cea132e14e702ff Mon Sep 17 00:00:00 2001 From: Aram Date: Wed, 21 Jun 2017 15:42:02 +0200 Subject: [PATCH] Fixed usage of FreeRTOS locks --- src/gos/gos_freertos.c | 2 ++ src/gos/gos_freertos.h | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/gos/gos_freertos.c b/src/gos/gos_freertos.c index 7c47aa40..25f61f06 100644 --- a/src/gos/gos_freertos.c +++ b/src/gos/gos_freertos.c @@ -30,6 +30,8 @@ #error "GOS: Either GFX_OS_NO_INIT or GFX_OS_CALL_UGFXMAIN must be defined for FreeRTOS" #endif +PRIVILEGED_DATA static portMUX_TYPE lockMux = portMUX_INITIALIZER_UNLOCKED; + void _gosInit(void) { #if GFX_OS_NO_INIT && !GFX_OS_INIT_NO_WARNING diff --git a/src/gos/gos_freertos.h b/src/gos/gos_freertos.h index 95baedcb..c74fb3ec 100644 --- a/src/gos/gos_freertos.h +++ b/src/gos/gos_freertos.h @@ -84,8 +84,9 @@ extern "C" { #define gfxSystemTicks() xTaskGetTickCount() #define gfxMillisecondsToTicks(ms) ((systemticks_t)((ms) / portTICK_PERIOD_MS)) #define gfxTicksToMilliseconds(ticks) (ticks * portTICK_PERIOD_MS) -#define gfxSystemLock() taskENTER_CRITICAL() -#define gfxSystemUnlock() taskEXIT_CRITICAL() + +#define gfxSystemLock() taskENTER_CRITICAL(&lockMux) +#define gfxSystemUnlock() taskEXIT_CRITICAL(&lockMux) void gfxMutexInit(gfxMutex* s); #define gfxMutexDestroy(pmutex) vSemaphoreDelete(*(pmutex))