diff options
Diffstat (limited to 'os')
-rw-r--r-- | os/common/ports/ARMCMx/cmsis_os/cmsis_os.c | 32 | ||||
-rw-r--r-- | os/common/ports/ARMCMx/cmsis_os/cmsis_os.h | 2 | ||||
-rw-r--r-- | os/common/ports/ARMCMx/cmsis_os/cmsis_os.mk | 4 | ||||
-rw-r--r-- | os/various/cpp_wrappers/ch.cpp | 8 |
4 files changed, 25 insertions, 21 deletions
diff --git a/os/common/ports/ARMCMx/cmsis_os/cmsis_os.c b/os/common/ports/ARMCMx/cmsis_os/cmsis_os.c index df4b6ba31..6b328ea7f 100644 --- a/os/common/ports/ARMCMx/cmsis_os/cmsis_os.c +++ b/os/common/ports/ARMCMx/cmsis_os/cmsis_os.c @@ -88,10 +88,10 @@ osStatus osKernelInitialize(void) { chSysInit();
chThdSetPriority(HIGHPRIO);
- chPoolObjectInit(&sempool, sizeof(semaphore_t), chCoreAlloc);
+ chPoolObjectInit(&sempool, sizeof(semaphore_t), chCoreAllocAligned);
chPoolLoadArray(&sempool, semaphores, CMSIS_CFG_NUM_SEMAPHORES);
- chPoolObjectInit(&timpool, sizeof(virtual_timer_t), chCoreAlloc);
+ chPoolObjectInit(&timpool, sizeof(virtual_timer_t), chCoreAllocAligned);
chPoolLoadArray(&timpool, timers, CMSIS_CFG_NUM_TIMERS);
return osOK;
@@ -136,7 +136,7 @@ osStatus osThreadTerminate(osThreadId thread_id) { implemented using the registry.*/
chThdExit(0);
}
- chThdTerminate(thread_id);
+ chEvtSignal((thread_t *)thread_id, CH_EVENT_TERMINATE);
chThdWait((thread_t *)thread_id);
return osOK;
@@ -154,17 +154,17 @@ osStatus osThreadSetPriority(osThreadId thread_id, osPriority newprio) { /* Changing priority.*/
#if CH_CFG_USE_MUTEXES
- oldprio = (osPriority)tp->p_realprio;
- if ((tp->p_prio == tp->p_realprio) || ((tprio_t)newprio > tp->p_prio))
- tp->p_prio = (tprio_t)newprio;
- tp->p_realprio = (tprio_t)newprio;
+ oldprio = (osPriority)tp->realprio;
+ if ((tp->prio == tp->realprio) || ((tprio_t)newprio > tp->prio))
+ tp->prio = (tprio_t)newprio;
+ tp->realprio = (tprio_t)newprio;
#else
- oldprio = tp->p_prio;
- tp->p_prio = (tprio_t)newprio;
+ oldprio = tp->prio;
+ tp->prio = (tprio_t)newprio;
#endif
/* The following states need priority queues reordering.*/
- switch (tp->p_state) {
+ switch (tp->state) {
#if CH_CFG_USE_MUTEXES | \
CH_CFG_USE_CONDVARS | \
(CH_CFG_USE_SEMAPHORES && CH_CFG_USE_SEMAPHORES_PRIORITY) | \
@@ -183,13 +183,13 @@ osStatus osThreadSetPriority(osThreadId thread_id, osPriority newprio) { #endif
/* Re-enqueues tp with its new priority on the queue.*/
queue_prio_insert(queue_dequeue(tp),
- (threads_queue_t *)tp->p_u.wtobjp);
+ (threads_queue_t *)tp->u.wtobjp);
break;
#endif
case CH_STATE_READY:
#if CH_DBG_ENABLE_ASSERTS
/* Prevents an assertion in chSchReadyI().*/
- tp->p_state = CH_STATE_CURRENT;
+ tp->state = CH_STATE_CURRENT;
#endif
/* Re-enqueues tp with its new priority on the ready list.*/
chSchReadyI(queue_dequeue(tp));
@@ -261,7 +261,7 @@ int32_t osSignalSet(osThreadId thread_id, int32_t signals) { int32_t oldsignals;
syssts_t sts = chSysGetStatusAndLockX();
- oldsignals = (int32_t)thread_id->p_epending;
+ oldsignals = (int32_t)thread_id->epending;
chEvtSignalI((thread_t *)thread_id, (eventmask_t)signals);
chSysRestoreStatusX(sts);
@@ -276,8 +276,8 @@ int32_t osSignalClear(osThreadId thread_id, int32_t signals) { chSysLock();
- m = thread_id->p_epending & (eventmask_t)signals;
- thread_id->p_epending &= ~(eventmask_t)signals;
+ m = thread_id->epending & (eventmask_t)signals;
+ thread_id->epending &= ~(eventmask_t)signals;
chSysUnlock();
@@ -453,7 +453,7 @@ void *osPoolCAlloc(osPoolId pool_id) { void *object;
object = chPoolAllocI((memory_pool_t *)pool_id);
- memset(object, 0, pool_id->mp_object_size);
+ memset(object, 0, pool_id->object_size);
return object;
}
diff --git a/os/common/ports/ARMCMx/cmsis_os/cmsis_os.h b/os/common/ports/ARMCMx/cmsis_os/cmsis_os.h index 23f12a0b6..41d96baed 100644 --- a/os/common/ports/ARMCMx/cmsis_os/cmsis_os.h +++ b/os/common/ports/ARMCMx/cmsis_os/cmsis_os.h @@ -502,7 +502,7 @@ static inline osStatus osThreadYield(void) { */
static inline osPriority osThreadGetPriority(osThreadId thread_id) {
- return thread_id->p_prio;
+ return thread_id->prio;
}
/**
diff --git a/os/common/ports/ARMCMx/cmsis_os/cmsis_os.mk b/os/common/ports/ARMCMx/cmsis_os/cmsis_os.mk index d679622ad..f31566b76 100644 --- a/os/common/ports/ARMCMx/cmsis_os/cmsis_os.mk +++ b/os/common/ports/ARMCMx/cmsis_os/cmsis_os.mk @@ -1,4 +1,4 @@ # List of the ChibiOS/RT CMSIS RTOS wrapper.
-CMSISRTOSSRC = ${CHIBIOS}/os/rt/ports/ARMCMx/cmsis_os/cmsis_os.c
+CMSISRTOSSRC = ${CHIBIOS}/os/common/ports/ARMCMx/cmsis_os/cmsis_os.c
-CMSISRTOSINC = ${CHIBIOS}/os/rt/ports/ARMCMx/cmsis_os
+CMSISRTOSINC = ${CHIBIOS}/os/common/ports/ARMCMx/cmsis_os
diff --git a/os/various/cpp_wrappers/ch.cpp b/os/various/cpp_wrappers/ch.cpp index f827d285a..bb698d675 100644 --- a/os/various/cpp_wrappers/ch.cpp +++ b/os/various/cpp_wrappers/ch.cpp @@ -78,13 +78,15 @@ namespace chibios_rt { chSysHalt("invoked unimplemented method stop()");
}
+#if CH_CFG_USE_EVENTS
void ThreadReference::requestTerminate(void) {
chDbgAssert(thread_ref != NULL,
"not referenced");
- chThdTerminate(thread_ref);
+ chEvtSignal(thread_ref, CH_EVENT_TERMINATE);
}
+#endif
#if CH_CFG_USE_WAITEXIT
msg_t ThreadReference::wait(void) {
@@ -196,10 +198,12 @@ namespace chibios_rt { chThdExitS(msg);
}
+#if CH_CFG_USE_EVENTS
bool BaseThread::shouldTerminate(void) {
- return chThdShouldTerminateX();
+ return (chEvtGetEventsX() & CH_EVENT_TERMINATE) != 0;
}
+#endif
void BaseThread::sleep(systime_t interval){
|