diff options
author | inmarket <andrewh@inmarket.com.au> | 2018-07-07 17:05:18 +1000 |
---|---|---|
committer | inmarket <andrewh@inmarket.com.au> | 2018-07-07 17:05:18 +1000 |
commit | e2fb6820d013420bf9a69ac5b8955f9ebb6af4f0 (patch) | |
tree | d1df5479f32a0e47f8db07031a48bb88f0fc3a27 /src/gos/gos_chibios.h | |
parent | 41271d632b74f5cf47c30d3b699eb6b2786f2136 (diff) | |
download | uGFX-e2fb6820d013420bf9a69ac5b8955f9ebb6af4f0.tar.gz uGFX-e2fb6820d013420bf9a69ac5b8955f9ebb6af4f0.tar.bz2 uGFX-e2fb6820d013420bf9a69ac5b8955f9ebb6af4f0.zip |
Add support for ChibiOS V5 - Thanks Vrollei
Diffstat (limited to 'src/gos/gos_chibios.h')
-rw-r--r-- | src/gos/gos_chibios.h | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/gos/gos_chibios.h b/src/gos/gos_chibios.h index 7c0d1447..d97d1e9f 100644 --- a/src/gos/gos_chibios.h +++ b/src/gos/gos_chibios.h @@ -45,7 +45,7 @@ typedef tprio_t threadpriority_t; #define DECLARE_THREAD_FUNCTION(fnName, param) threadreturn_t fnName(void *param) #define THREAD_RETURN(retval) return retval -#if CH_KERNEL_MAJOR == 2 +#if CH_KERNEL_MAJOR <= 2 typedef struct { Semaphore sem; semcount_t limit; @@ -53,7 +53,7 @@ typedef tprio_t threadpriority_t; typedef Mutex gfxMutex; typedef Thread* gfxThreadHandle; -#elif (CH_KERNEL_MAJOR == 3) || (CH_KERNEL_MAJOR == 4) +#else #undef DECLARE_THREAD_STACK #define DECLARE_THREAD_STACK(a, b) THD_WORKING_AREA(a, b) @@ -72,24 +72,29 @@ typedef tprio_t threadpriority_t; /*===========================================================================*/ // First the kernel version specific ones -#if CH_KERNEL_MAJOR == 2 +#if CH_KERNEL_MAJOR <= 2 #define gfxSystemTicks() chTimeNow() #define gfxMutexInit(pmutex) chMtxInit(pmutex) #define gfxMutexExit(pmutex) chMtxUnlock() #define gfxExit() chSysHalt() #define gfxHalt(msg) { chDbgPanic(msg); chSysHalt(); } -#elif (CH_KERNEL_MAJOR == 3) || (CH_KERNEL_MAJOR == 4) +#else #define gfxSystemTicks() chVTGetSystemTimeX() #define gfxMutexInit(pmutex) chMtxObjectInit(pmutex) #define gfxMutexExit(pmutex) chMtxUnlock(pmutex) #define gfxExit() osalSysHalt("gfx_exit") -#define gfxHalt(msg) { chSysHalt(msg); } + #define gfxHalt(msg) { chSysHalt(msg); } +#endif + +#if CH_KERNEL_MAJOR <= 4 + #define gfxMillisecondsToTicks(ms) MS2ST(ms) +#else + #define gfxMillisecondsToTicks(ms) TIME_MS2I(ms) #endif #define gfxAlloc(sz) chHeapAlloc(0, sz) #define gfxFree(ptr) chHeapFree(ptr) #define gfxYield() chThdYield() -#define gfxMillisecondsToTicks(ms) MS2ST(ms) #define gfxSystemLock() chSysLock() #define gfxSystemUnlock() chSysUnlock() #define gfxMutexDestroy(pmutex) (void)pmutex |