diff options
author | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2013-01-02 14:01:11 +0000 |
---|---|---|
committer | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2013-01-02 14:01:11 +0000 |
commit | 04db761f7e787b9f920aa2c264b6133d1b1815ff (patch) | |
tree | 5fe525bb05241369d907bc9d7c607424d04bb003 /os/various/cpp_wrappers/ch.cpp | |
parent | c66db01792f60dfc8af534e2d7fbcb326efb4873 (diff) | |
download | ChibiOS-04db761f7e787b9f920aa2c264b6133d1b1815ff.tar.gz ChibiOS-04db761f7e787b9f920aa2c264b6133d1b1815ff.tar.bz2 ChibiOS-04db761f7e787b9f920aa2c264b6133d1b1815ff.zip |
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@5017 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/various/cpp_wrappers/ch.cpp')
-rw-r--r-- | os/various/cpp_wrappers/ch.cpp | 62 |
1 files changed, 55 insertions, 7 deletions
diff --git a/os/various/cpp_wrappers/ch.cpp b/os/various/cpp_wrappers/ch.cpp index 5faf6d37c..d6dd61ff7 100644 --- a/os/various/cpp_wrappers/ch.cpp +++ b/os/various/cpp_wrappers/ch.cpp @@ -52,6 +52,11 @@ namespace chibios_rt { return chTimeNow();
}
+ bool isTimeWithin(systime_t start, systime_t end) {
+
+ return (bool)chTimeIsWithin(start, end);
+ }
+
/*------------------------------------------------------------------------*
* chibios_rt::Timer *
*------------------------------------------------------------------------*/
@@ -209,6 +214,11 @@ namespace chibios_rt { chThdExit(msg);
}
+ void BaseThread::exitS(msg_t msg) {
+
+ chThdExitS(msg);
+ }
+
bool BaseThread::shouldTerminate(void) {
return (bool)chThdShouldTerminate();
@@ -224,6 +234,11 @@ namespace chibios_rt { chThdSleepUntil(time);
}
+ void BaseThread::yield(void) {
+
+ chThdYield();
+ }
+
#if CH_USE_MESSAGES
msg_t BaseThread::getMessage(ThreadReference* trp) {
@@ -289,6 +304,23 @@ namespace chibios_rt { }
#endif /* CH_USE_EVENTS */
+#if CH_USE_MUTEXES
+ void BaseThread::unlockMutex(void) {
+
+ chMtxUnlock();
+ }
+
+ void BaseThread::unlockMutexS(void) {
+
+ chMtxUnlockS();
+ }
+
+ void BaseThread::unlockAllMutexes(void) {
+
+ chMtxUnlockAll();
+ }
+#endif /* CH_USE_MUTEXES */
+
#if CH_USE_SEMAPHORES
/*------------------------------------------------------------------------*
* chibios_rt::Semaphore *
@@ -349,7 +381,8 @@ namespace chibios_rt { }
#if CH_USE_SEMSW
- msg_t Semaphore::signalWait(Semaphore *ssem, Semaphore *wsem) {
+ msg_t Semaphore::signalWait(chibios_rt::Semaphore *ssem,
+ chibios_rt::Semaphore *wsem) {
return chSemSignalWait(&ssem->sem, &wsem->sem);
}
@@ -370,19 +403,19 @@ namespace chibios_rt { return chMtxTryLock(&mutex);
}
- void Mutex::lock(void) {
+ bool Mutex::tryLockS(void) {
- chMtxLock(&mutex);
+ return chMtxTryLockS(&mutex);
}
- void Mutex::unlock(void) {
+ void Mutex::lock(void) {
- chMtxUnlock();
+ chMtxLock(&mutex);
}
- void Mutex::unlockAll(void) {
+ void Mutex::lockS(void) {
- chMtxUnlockAll();
+ chMtxLockS(&mutex);
}
#if CH_USE_CONDVARS
@@ -399,16 +432,31 @@ namespace chibios_rt { chCondSignal(&condvar);
}
+ void CondVar::signalI(void) {
+
+ chCondSignalI(&condvar);
+ }
+
void CondVar::broadcast(void) {
chCondBroadcast(&condvar);
}
+ void CondVar::broadcastI(void) {
+
+ chCondBroadcastI(&condvar);
+ }
+
msg_t CondVar::wait(void) {
return chCondWait(&condvar);
}
+ msg_t CondVar::waitS(void) {
+
+ return chCondWaitS(&condvar);
+ }
+
#if CH_USE_CONDVARS_TIMEOUT
msg_t CondVar::waitTimeout(systime_t time) {
|