aboutsummaryrefslogtreecommitdiffstats
path: root/os/various
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2013-01-03 16:17:42 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2013-01-03 16:17:42 +0000
commitb5da4b76b5810b41900432832f178280069d8d91 (patch)
treea17b3f5413acc5e61ce4888f5bbe82cd939b7a88 /os/various
parent05c30c4e651909ec86e43c16bccea85d180e39c0 (diff)
downloadChibiOS-b5da4b76b5810b41900432832f178280069d8d91.tar.gz
ChibiOS-b5da4b76b5810b41900432832f178280069d8d91.tar.bz2
ChibiOS-b5da4b76b5810b41900432832f178280069d8d91.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@5027 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/various')
-rw-r--r--os/various/cpp_wrappers/ch.cpp36
-rw-r--r--os/various/cpp_wrappers/ch.hpp55
2 files changed, 47 insertions, 44 deletions
diff --git a/os/various/cpp_wrappers/ch.cpp b/os/various/cpp_wrappers/ch.cpp
index 6751dc391..e8db4c013 100644
--- a/os/various/cpp_wrappers/ch.cpp
+++ b/os/various/cpp_wrappers/ch.cpp
@@ -188,6 +188,16 @@ namespace chibios_rt {
return (bool)chMsgIsPendingI(thread_ref);
}
+
+ msg_t ThreadReference::getMessage(void) {
+
+ return chMsgGet(thread_ref);
+ }
+
+ void ThreadReference::releaseMessage(msg_t msg) {
+
+ chMsgRelease(thread_ref, msg);
+ }
#endif /* CH_USE_MESSAGES */
#if CH_USE_EVENTS
@@ -212,9 +222,21 @@ namespace chibios_rt {
}
+ msg_t BaseThread::main(void) {
+
+ return 0;
+ }
+
+ ThreadReference BaseThread::start(tprio_t prio) {
+
+ (void)prio;
+
+ return *this;
+ };
+
msg_t _thd_start(void *arg) {
- return ((BaseThread *)arg)->Main();
+ return ((BaseThread *)arg)->main();
}
void BaseThread::setName(const char *tname) {
@@ -257,18 +279,6 @@ namespace chibios_rt {
chThdYield();
}
-#if CH_USE_MESSAGES
- msg_t BaseThread::getMessage(ThreadReference* trp) {
-
- return chMsgGet(trp->thread_ref);
- }
-
- void BaseThread::releaseMessage(ThreadReference* trp, msg_t msg) {
-
- chMsgRelease(trp->thread_ref, msg);
- }
-#endif /* CH_USE_MESSAGES */
-
#if CH_USE_EVENTS
eventmask_t BaseThread::getAndClearEvents(eventmask_t mask) {
diff --git a/os/various/cpp_wrappers/ch.hpp b/os/various/cpp_wrappers/ch.hpp
index 2f2d5bfe0..05bc1b33d 100644
--- a/os/various/cpp_wrappers/ch.hpp
+++ b/os/various/cpp_wrappers/ch.hpp
@@ -221,7 +221,7 @@ namespace chibios_rt {
*
* @init
*/
- ThreadReference(Thread * tp) : thread_ref(tp) {
+ ThreadReference(Thread *tp) : thread_ref(tp) {
};
@@ -330,6 +330,26 @@ namespace chibios_rt {
* @api
*/
bool isPendingMessage(void);
+
+ /**
+ * @brief Returns an enqueued message or @p NULL.
+ *
+ * @param[in] trp the sender thread reference
+ * @return The incoming message.
+ *
+ * @api
+ */
+ msg_t getMessage(void);
+
+ /**
+ * @brief Releases the next message in queue with a reply.
+ *
+ * @param[in] trp the sender thread reference
+ * @param[in] msg the answer message
+ *
+ * @api
+ */
+ void releaseMessage(msg_t msg);
#endif /* CH_USE_MESSAGES */
#if CH_USE_EVENTS || defined(__DOXYGEN__)
@@ -380,9 +400,7 @@ namespace chibios_rt {
*
* @api
*/
- virtual msg_t Main(void) {
- return 0;
- };
+ virtual msg_t main(void);
/**
* @brief Creates and starts a system thread.
@@ -393,12 +411,7 @@ namespace chibios_rt {
*
* @api
*/
- virtual ThreadReference start(tprio_t prio) {
-
- (void)prio;
-
- return *this;
- };
+ virtual ThreadReference start(tprio_t prio);
/**
* @brief Sets the current thread name.
@@ -510,26 +523,6 @@ namespace chibios_rt {
* @api
*/
static ThreadReference waitMessage(void);
-
- /**
- * @brief Returns an enqueued message or @p NULL.
- *
- * @param[in] trp the sender thread reference
- * @return The incoming message.
- *
- * @api
- */
- static msg_t getMessage(ThreadReference* trp);
-
- /**
- * @brief Releases the next message in queue with a reply.
- *
- * @param[in] trp the sender thread reference
- * @param[in] msg the answer message
- *
- * @api
- */
- static void releaseMessage(ThreadReference* trp, msg_t msg);
#endif /* CH_USE_MESSAGES */
#if CH_USE_EVENTS || defined(__DOXYGEN__)
@@ -750,7 +743,7 @@ namespace chibios_rt {
*
* @api
*/
- ThreadReference start(tprio_t prio) {
+ virtual ThreadReference start(tprio_t prio) {
msg_t _thd_start(void *arg);
thread_ref = chThdCreateStatic(wa, sizeof(wa), prio, _thd_start, this);