Merged in pl4nkton/ugfx/ChibiOS_kernelv4 (pull request #22)
add support for ChibiOS RT 4 kernel
This commit is contained in:
commit
8d66f0233f
2 changed files with 16 additions and 7 deletions
|
@ -20,7 +20,7 @@
|
|||
#error "GOS: CH_USE_SEMAPHORES must be defined in chconf.h"
|
||||
#endif
|
||||
|
||||
#elif CH_KERNEL_MAJOR == 3
|
||||
#elif (CH_KERNEL_MAJOR == 3) || (CH_KERNEL_MAJOR == 4)
|
||||
|
||||
#if !CH_CFG_USE_MUTEXES
|
||||
#error "GOS: CH_CFG_USE_MUTEXES must be defined in chconf.h"
|
||||
|
@ -42,7 +42,7 @@ void _gosInit(void)
|
|||
halInit();
|
||||
chSysInit();
|
||||
}
|
||||
#elif CH_KERNEL_MAJOR == 3
|
||||
#elif (CH_KERNEL_MAJOR == 3) || (CH_KERNEL_MAJOR == 4)
|
||||
if (!chThdGetSelfX()) {
|
||||
halInit();
|
||||
chSysInit();
|
||||
|
@ -102,7 +102,7 @@ void gfxSemInit(gfxSem *psem, semcount_t val, semcount_t limit)
|
|||
|
||||
#if CH_KERNEL_MAJOR == 2
|
||||
chSemInit(&psem->sem, val);
|
||||
#elif CH_KERNEL_MAJOR == 3
|
||||
#elif (CH_KERNEL_MAJOR == 3) || (CH_KERNEL_MAJOR == 4)
|
||||
chSemObjectInit(&psem->sem, val);
|
||||
#endif
|
||||
}
|
||||
|
@ -120,7 +120,7 @@ bool_t gfxSemWait(gfxSem *psem, delaytime_t ms)
|
|||
case TIME_INFINITE: chSemWait(&psem->sem); return TRUE;
|
||||
default: return chSemWaitTimeout(&psem->sem, MS2ST(ms)) != RDY_TIMEOUT;
|
||||
}
|
||||
#elif CH_KERNEL_MAJOR == 3
|
||||
#elif (CH_KERNEL_MAJOR == 3) || (CH_KERNEL_MAJOR == 4)
|
||||
switch(ms) {
|
||||
case TIME_IMMEDIATE: return chSemWaitTimeout(&psem->sem, TIME_IMMEDIATE) != MSG_TIMEOUT;
|
||||
case TIME_INFINITE: chSemWait(&psem->sem); return TRUE;
|
||||
|
@ -158,7 +158,11 @@ gfxThreadHandle gfxThreadCreate(void *stackarea, size_t stacksz, threadpriority_
|
|||
{
|
||||
if (!stackarea) {
|
||||
if (!stacksz) stacksz = 256;
|
||||
#if (CH_KERNEL_MAJOR == 2) || (CH_KERNEL_MAJOR == 3)
|
||||
return chThdCreateFromHeap(0, stacksz, prio, (tfunc_t)fn, param);
|
||||
#elif CH_KERNEL_MAJOR == 4
|
||||
return chThdCreateFromHeap(0, stacksz, "ugfx", prio, (tfunc_t)fn, param);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (!stacksz)
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
#if !defined(TRUE)
|
||||
#define TRUE -1
|
||||
#endif
|
||||
#if CH_KERNEL_MAJOR == 3
|
||||
#if (CH_KERNEL_MAJOR == 3) || (CH_KERNEL_MAJOR == 4)
|
||||
typedef char bool_t;
|
||||
#endif
|
||||
|
||||
|
@ -66,7 +66,7 @@ typedef tprio_t threadpriority_t;
|
|||
|
||||
typedef Mutex gfxMutex;
|
||||
typedef Thread* gfxThreadHandle;
|
||||
#elif CH_KERNEL_MAJOR == 3
|
||||
#elif (CH_KERNEL_MAJOR == 3) || (CH_KERNEL_MAJOR == 4)
|
||||
#undef DECLARE_THREAD_STACK
|
||||
#define DECLARE_THREAD_STACK(a, b) THD_WORKING_AREA(a, b)
|
||||
|
||||
|
@ -95,7 +95,7 @@ extern "C" {
|
|||
#define gfxMutexExit(pmutex) chMtxUnlock()
|
||||
#define gfxExit() chSysHalt()
|
||||
#define gfxHalt(msg) { chDbgPanic(msg); chSysHalt(); }
|
||||
#elif CH_KERNEL_MAJOR == 3
|
||||
#elif (CH_KERNEL_MAJOR == 3) || (CH_KERNEL_MAJOR == 4)
|
||||
#define gfxSystemTicks() chVTGetSystemTimeX()
|
||||
#define gfxMutexInit(pmutex) chMtxObjectInit(pmutex)
|
||||
#define gfxMutexExit(pmutex) chMtxUnlock(pmutex)
|
||||
|
@ -120,8 +120,13 @@ bool_t gfxSemWait(gfxSem *psem, delaytime_t ms);
|
|||
bool_t gfxSemWaitI(gfxSem *psem);
|
||||
void gfxSemSignal(gfxSem *psem);
|
||||
void gfxSemSignalI(gfxSem *psem);
|
||||
#if (CH_KERNEL_MAJOR == 2) || (CH_KERNEL_MAJOR == 3)
|
||||
#define gfxSemCounterI(psem) ((psem)->sem.s_cnt)
|
||||
#define gfxSemCounter(psem) ((psem)->sem.s_cnt)
|
||||
#elif (CH_KERNEL_MAJOR == 4)
|
||||
#define gfxSemCounterI(psem) ((psem)->sem.cnt)
|
||||
#define gfxSemCounter(psem) ((psem)->sem.cnt)
|
||||
#endif
|
||||
gfxThreadHandle gfxThreadCreate(void *stackarea, size_t stacksz, threadpriority_t prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param);
|
||||
#define gfxThreadWait(thread) chThdWait(thread)
|
||||
#define gfxThreadMe() chThdSelf()
|
||||
|
|
Loading…
Add table
Reference in a new issue