aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorinmarket <inmarket@ugfx.io>2017-08-16 17:59:53 +1000
committerinmarket <inmarket@ugfx.io>2017-08-16 17:59:53 +1000
commitf0f28e24535b6bcd53c50bb6609ca300a2cf6a63 (patch)
treecdfe01743b38335d78d4326c7ba54bfe741ac850
parent2b4bd12ffa7239f81a85cea1183a1a13b36fc7c0 (diff)
downloaduGFX-f0f28e24535b6bcd53c50bb6609ca300a2cf6a63.tar.gz
uGFX-f0f28e24535b6bcd53c50bb6609ca300a2cf6a63.tar.bz2
uGFX-f0f28e24535b6bcd53c50bb6609ca300a2cf6a63.zip
CHibiOS fixes from removing gfxSemCounter()
-rw-r--r--src/gos/gos_chibios.c37
1 files changed, 26 insertions, 11 deletions
diff --git a/src/gos/gos_chibios.c b/src/gos/gos_chibios.c
index b54f32ea..8bad8ed6 100644
--- a/src/gos/gos_chibios.c
+++ b/src/gos/gos_chibios.c
@@ -139,8 +139,13 @@ bool_t gfxSemWait(gfxSem *psem, delaytime_t ms)
bool_t gfxSemWaitI(gfxSem *psem)
{
- if (chSemGetCounterI(&psem->sem) <= 0)
- return FALSE;
+ #if (CH_KERNEL_MAJOR == 2) || (CH_KERNEL_MAJOR == 3)
+ if (psem->sem.s_cnt <= 0)
+ return GFalse;
+ #elif (CH_KERNEL_MAJOR == 4)
+ if (psem->sem.cnt <= 0)
+ return GFalse;
+ #endif
chSemFastWaitI(&psem->sem);
return TRUE;
}
@@ -149,8 +154,13 @@ void gfxSemSignal(gfxSem *psem)
{
chSysLock();
- if (psem->sem.s_cnt < psem->limit)
- chSemSignalI(&psem->sem);
+ #if (CH_KERNEL_MAJOR == 2) || (CH_KERNEL_MAJOR == 3)
+ if (psem->sem.s_cnt < psem->limit)
+ chSemSignalI(&psem->sem);
+ #elif (CH_KERNEL_MAJOR == 4)
+ if (psem->sem.cnt < psem->limit)
+ chSemSignalI(&psem->sem);
+ #endif
chSchRescheduleS();
chSysUnlock();
@@ -158,19 +168,24 @@ void gfxSemSignal(gfxSem *psem)
void gfxSemSignalI(gfxSem *psem)
{
- if (psem->sem.s_cnt < psem->limit)
- chSemSignalI(&psem->sem);
+ #if (CH_KERNEL_MAJOR == 2) || (CH_KERNEL_MAJOR == 3)
+ if (psem->sem.s_cnt < psem->limit)
+ chSemSignalI(&psem->sem);
+ #elif (CH_KERNEL_MAJOR == 4)
+ if (psem->sem.cnt < psem->limit)
+ chSemSignalI(&psem->sem);
+ #endif
}
gfxThreadHandle gfxThreadCreate(void *stackarea, size_t stacksz, threadpriority_t prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param)
{
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 (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)