Fixing Keil RTOX port. Now compiling (untested)

This commit is contained in:
Joel Bodenmann 2015-10-13 21:43:17 +02:00
parent 9d3fc8b36c
commit 1f8b5efc21
2 changed files with 22 additions and 12 deletions

View file

@ -10,6 +10,8 @@
#if GFX_USE_OS_KEIL #if GFX_USE_OS_KEIL
void _gosHeapInit(void);
void _gosInit(void) void _gosInit(void)
{ {
#if !GFX_OS_NO_INIT #if !GFX_OS_NO_INIT
@ -30,12 +32,12 @@ void _gosDeinit(void)
void gfxMutexInit(gfxMutex* pmutex) 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) 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--) while(val--)
osSemaphoreRelease(psem->id); 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) 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) { threadreturn_t gfxThreadWait(gfxThreadHandle thread) {

View file

@ -15,6 +15,8 @@
#if GFX_USE_OS_KEIL #if GFX_USE_OS_KEIL
#include "cmsis_os.h"
#ifndef GFX_OS_HEAP_SIZE #ifndef GFX_OS_HEAP_SIZE
#define GFX_OS_HEAP_SIZE 10240 #define GFX_OS_HEAP_SIZE 10240
#endif #endif
@ -23,6 +25,8 @@
/* Type definitions */ /* Type definitions */
/*===========================================================================*/ /*===========================================================================*/
typedef uint8_t bool_t;
#define TIME_IMMEDIATE 0 #define TIME_IMMEDIATE 0
#define TIME_INFINITE osWaitForever #define TIME_INFINITE osWaitForever
typedef uint32_t delaytime_t; typedef uint32_t delaytime_t;
@ -37,14 +41,14 @@ typedef osPriority threadpriority_t;
#define HIGH_PRIORITY osPriorityHigh #define HIGH_PRIORITY osPriorityHigh
typedef struct gfxSem { typedef struct gfxSem {
osSemaphoreId id; osSemaphoreDef_t def;
osSemaphoreDef(id); osSemaphoreId id;
} gfxSem; } gfxSem;
typedef struct gfxMutex { typedef struct gfxMutex {
osMutexId id; osMutexDef_t def;
osMutexDef(id); osMutexId id;
} gfxMutex; } gfxMutex;
typedef osThreadId gfxThreadHandle; typedef osThreadId gfxThreadHandle;
@ -89,10 +93,10 @@ gfxThreadHandle gfxThreadCreate(void* stackarea, size_t stacksz, threadpriority_
#endif #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" #include "gos_x_heap.h"
#endif /* GFX_USE_OS_KEIL */ #endif /* GFX_USE_OS_KEIL */