From 1f8b5efc21a029e8fae647fde31d703cf0d1be23 Mon Sep 17 00:00:00 2001 From: Joel Bodenmann Date: Tue, 13 Oct 2015 21:43:17 +0200 Subject: Fixing Keil RTOX port. Now compiling (untested) --- src/gos/gos_keil.c | 14 ++++++++++---- src/gos/gos_keil.h | 20 ++++++++++++-------- 2 files changed, 22 insertions(+), 12 deletions(-) (limited to 'src/gos') diff --git a/src/gos/gos_keil.c b/src/gos/gos_keil.c index 72b37404..6e491300 100644 --- a/src/gos/gos_keil.c +++ b/src/gos/gos_keil.c @@ -10,6 +10,8 @@ #if GFX_USE_OS_KEIL +void _gosHeapInit(void); + void _gosInit(void) { #if !GFX_OS_NO_INIT @@ -30,12 +32,12 @@ void _gosDeinit(void) void gfxMutexInit(gfxMutex* pmutex) { - pmutex->id = osMutexCreate(pmutex->osMutex(id)); + pmutex->id = osMutexCreate(&(pmutex->def)); } void gfxSemInit(gfxSem* psem, semcount_t val, semcount_t limit) { - psem->id = osSemaphoreCreate(psem->osSemaphore(id), limit); + psem->id = osSemaphoreCreate(&(psem->def), limit); while(val--) osSemaphoreRelease(psem->id); } @@ -67,9 +69,13 @@ void gfxSemSignalI(gfxSem* psem) gfxThreadHandle gfxThreadCreate(void* stackarea, size_t stacksz, threadpriority_t prio, DECLARE_THREAD_FUNCTION((*fn),p), void* param) { - osThreadDef(ugfx_thread, prio, 1, stacksz); + osThreadDef_t def; + def.pthread = fn; + def.tpriority = prio; + def.instances = 1; + def.stacksize = stacksz; - return osThreadCreate(osThread(ugfx_thread), param); + return osThreadCreate(&def, param); } threadreturn_t gfxThreadWait(gfxThreadHandle thread) { diff --git a/src/gos/gos_keil.h b/src/gos/gos_keil.h index df2db720..f966b956 100644 --- a/src/gos/gos_keil.h +++ b/src/gos/gos_keil.h @@ -15,6 +15,8 @@ #if GFX_USE_OS_KEIL +#include "cmsis_os.h" + #ifndef GFX_OS_HEAP_SIZE #define GFX_OS_HEAP_SIZE 10240 #endif @@ -23,6 +25,8 @@ /* Type definitions */ /*===========================================================================*/ +typedef uint8_t bool_t; + #define TIME_IMMEDIATE 0 #define TIME_INFINITE osWaitForever typedef uint32_t delaytime_t; @@ -37,14 +41,14 @@ typedef osPriority threadpriority_t; #define HIGH_PRIORITY osPriorityHigh typedef struct gfxSem { - osSemaphoreId id; - osSemaphoreDef(id); - } gfxSem; + osSemaphoreDef_t def; + osSemaphoreId id; +} gfxSem; typedef struct gfxMutex { - osMutexId id; - osMutexDef(id); - } gfxMutex; + osMutexDef_t def; + osMutexId id; +} gfxMutex; typedef osThreadId gfxThreadHandle; @@ -89,10 +93,10 @@ gfxThreadHandle gfxThreadCreate(void* stackarea, size_t stacksz, threadpriority_ #endif /*===========================================================================*/ -/* Use the generic thread handling and heap handling */ +/* Use the generic heap handling */ /*===========================================================================*/ -#define GOS_NEED_X_HEAP TRUE +#define GOS_NEED_X_HEAP TRUE #include "gos_x_heap.h" #endif /* GFX_USE_OS_KEIL */ -- cgit v1.2.3