aboutsummaryrefslogtreecommitdiffstats
path: root/os/various/cpp_wrappers/ch.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'os/various/cpp_wrappers/ch.hpp')
-rw-r--r--os/various/cpp_wrappers/ch.hpp111
1 files changed, 56 insertions, 55 deletions
diff --git a/os/various/cpp_wrappers/ch.hpp b/os/various/cpp_wrappers/ch.hpp
index 53d3cf23b..7588e5ee1 100644
--- a/os/various/cpp_wrappers/ch.hpp
+++ b/os/various/cpp_wrappers/ch.hpp
@@ -28,10 +28,13 @@
#define _CH_HPP_
/**
- * @brief ChibiOS kernel-related classes and interfaces.
+ * @brief ChibiOS-RT kernel-related classes and interfaces.
*/
namespace chibios_rt {
+ /* Forward declarations */
+ class Mutex;
+
/*------------------------------------------------------------------------*
* chibios_rt::System *
*------------------------------------------------------------------------*/
@@ -182,7 +185,7 @@ namespace chibios_rt {
/**
* @brief Embedded @p VirtualTimer structure.
*/
- ::VirtualTimer timer_ref;
+ ::virtual_timer_t timer_ref;
/**
* @brief Enables a virtual timer.
@@ -236,7 +239,7 @@ namespace chibios_rt {
/**
* @brief Pointer to the system thread.
*/
- ::Thread *thread_ref;
+ ::thread_t *thread_ref;
/**
* @brief Thread reference constructor.
@@ -247,7 +250,7 @@ namespace chibios_rt {
*
* @init
*/
- ThreadReference(Thread *tp) : thread_ref(tp) {
+ ThreadReference(thread_t *tp) : thread_ref(tp) {
};
@@ -312,7 +315,7 @@ namespace chibios_rt {
*/
void requestTerminate(void);
-#if CH_USE_WAITEXIT || defined(__DOXYGEN__)
+#if CH_CFG_USE_WAITEXIT || defined(__DOXYGEN__)
/**
* @brief Blocks the execution of the invoking thread until the specified
* thread terminates then the exit code is returned.
@@ -346,9 +349,9 @@ namespace chibios_rt {
* @api
*/
msg_t wait(void);
-#endif /* CH_USE_WAITEXIT */
+#endif /* CH_CFG_USE_WAITEXIT */
-#if CH_USE_MESSAGES || defined(__DOXYGEN__)
+#if CH_CFG_USE_MESSAGES || defined(__DOXYGEN__)
/**
* @brief Sends a message to the thread and returns the answer.
*
@@ -386,9 +389,9 @@ namespace chibios_rt {
* @api
*/
void releaseMessage(msg_t msg);
-#endif /* CH_USE_MESSAGES */
+#endif /* CH_CFG_USE_MESSAGES */
-#if CH_USE_EVENTS || defined(__DOXYGEN__)
+#if CH_CFG_USE_EVENTS || defined(__DOXYGEN__)
/**
* @brief Adds a set of event flags directly to specified @p Thread.
*
@@ -406,10 +409,10 @@ namespace chibios_rt {
* @iclass
*/
void signalEventsI(eventmask_t mask);
-#endif /* CH_USE_EVENTS */
+#endif /* CH_CFG_USE_EVENTS */
-#if CH_USE_DYNAMIC || defined(__DOXYGEN__)
-#endif /* CH_USE_DYNAMIC */
+#if CH_CFG_USE_DYNAMIC || defined(__DOXYGEN__)
+#endif /* CH_CFG_USE_DYNAMIC */
};
/*------------------------------------------------------------------------*
@@ -550,7 +553,7 @@ namespace chibios_rt {
*/
static void yield(void);
-#if CH_USE_MESSAGES || defined(__DOXYGEN__)
+#if CH_CFG_USE_MESSAGES || defined(__DOXYGEN__)
/**
* @brief Waits for a message.
*
@@ -559,9 +562,9 @@ namespace chibios_rt {
* @api
*/
static ThreadReference waitMessage(void);
-#endif /* CH_USE_MESSAGES */
+#endif /* CH_CFG_USE_MESSAGES */
-#if CH_USE_EVENTS || defined(__DOXYGEN__)
+#if CH_CFG_USE_EVENTS || defined(__DOXYGEN__)
/**
* @brief Clears the pending events specified in the mask.
*
@@ -630,7 +633,7 @@ namespace chibios_rt {
*/
static eventmask_t waitAllEvents(eventmask_t ewmask);
-#if CH_USE_EVENTS_TIMEOUT || defined(__DOXYGEN__)
+#if CH_CFG_USE_EVENTS_TIMEOUT || defined(__DOXYGEN__)
/**
* @brief Waits for a single event.
* @details A pending event among those specified in @p ewmask is selected,
@@ -689,7 +692,7 @@ namespace chibios_rt {
*/
static eventmask_t waitAllEventsTimeout(eventmask_t ewmask,
systime_t time);
-#endif /* CH_USE_EVENTS_TIMEOUT */
+#endif /* CH_CFG_USE_EVENTS_TIMEOUT */
/**
* @brief Invokes the event handlers associated to an event flags mask.
@@ -702,9 +705,9 @@ namespace chibios_rt {
*/
static void dispatchEvents(const evhandler_t handlers[],
eventmask_t mask);
-#endif /* CH_USE_EVENTS */
+#endif /* CH_CFG_USE_EVENTS */
-#if CH_USE_MUTEXES || defined(__DOXYGEN__)
+#if CH_CFG_USE_MUTEXES || defined(__DOXYGEN__)
/**
* @brief Unlocks the next owned mutex in reverse lock order.
* @pre The invoking thread <b>must</b> have at least one owned mutex.
@@ -715,7 +718,7 @@ namespace chibios_rt {
*
* @api
*/
- static void unlockMutex(void);
+ static void unlockMutex(Mutex *mp);
/**
* @brief Unlocks the next owned mutex in reverse lock order.
@@ -729,7 +732,7 @@ namespace chibios_rt {
*
* @sclass
*/
- static void unlockMutexS(void);
+ static void unlockMutexS(Mutex *mp);
/**
* @brief Unlocks all the mutexes owned by the invoking thread.
@@ -743,7 +746,7 @@ namespace chibios_rt {
* @api
*/
static void unlockAllMutexes(void);
-#endif /* CH_USE_MUTEXES */
+#endif /* CH_CFG_USE_MUTEXES */
};
/*------------------------------------------------------------------------*
@@ -758,7 +761,7 @@ namespace chibios_rt {
template <int N>
class BaseStaticThread : public BaseThread {
protected:
- WORKING_AREA(wa, N);
+ THD_WORKING_AREA(wa, N);
public:
/**
@@ -789,7 +792,7 @@ namespace chibios_rt {
}
};
-#if CH_USE_SEMAPHORES || defined(__DOXYGEN__)
+#if CH_CFG_USE_SEMAPHORES || defined(__DOXYGEN__)
/*------------------------------------------------------------------------*
* chibios_rt::CounterSemaphore *
*------------------------------------------------------------------------*/
@@ -801,7 +804,7 @@ namespace chibios_rt {
/**
* @brief Embedded @p ::Semaphore structure.
*/
- ::Semaphore sem;
+ ::semaphore_t sem;
/**
* @brief CounterSemaphore constructor.
@@ -963,7 +966,6 @@ namespace chibios_rt {
*/
cnt_t getCounterI(void);
-#if CH_USE_SEMSW || defined(__DOXYGEN__)
/**
* @brief Atomic signal and wait operations.
*
@@ -980,7 +982,6 @@ namespace chibios_rt {
*/
static msg_t signalWait(CounterSemaphore *ssem,
CounterSemaphore *wsem);
-#endif /* CH_USE_SEMSW */
};
/*------------------------------------------------------------------------*
* chibios_rt::BinarySemaphore *
@@ -993,7 +994,7 @@ namespace chibios_rt {
/**
* @brief Embedded @p ::Semaphore structure.
*/
- ::BinarySemaphore bsem;
+ ::binary_semaphore_t bsem;
/**
* @brief BinarySemaphore constructor.
@@ -1135,9 +1136,9 @@ namespace chibios_rt {
*/
bool getStateI(void);
};
-#endif /* CH_USE_SEMAPHORES */
+#endif /* CH_CFG_USE_SEMAPHORES */
-#if CH_USE_MUTEXES || defined(__DOXYGEN__)
+#if CH_CFG_USE_MUTEXES || defined(__DOXYGEN__)
/*------------------------------------------------------------------------*
* chibios_rt::Mutex *
*------------------------------------------------------------------------*/
@@ -1149,7 +1150,7 @@ namespace chibios_rt {
/**
* @brief Embedded @p ::Mutex structure.
*/
- ::Mutex mutex;
+ ::mutex_t mutex;
/**
* @brief Mutex object constructor.
@@ -1216,7 +1217,7 @@ namespace chibios_rt {
void lockS(void);
};
-#if CH_USE_CONDVARS || defined(__DOXYGEN__)
+#if CH_CFG_USE_CONDVARS || defined(__DOXYGEN__)
/*------------------------------------------------------------------------*
* chibios_rt::CondVar *
*------------------------------------------------------------------------*/
@@ -1228,7 +1229,7 @@ namespace chibios_rt {
/**
* @brief Embedded @p ::CondVar structure.
*/
- ::CondVar condvar;
+ ::condition_variable_t condvar;
/**
* @brief CondVar object constructor.
@@ -1310,7 +1311,7 @@ namespace chibios_rt {
*/
msg_t waitS(void);
-#if CH_USE_CONDVARS_TIMEOUT || defined(__DOXYGEN__)
+#if CH_CFG_USE_CONDVARS_TIMEOUT || defined(__DOXYGEN__)
/**
* @brief Waits on the CondVar while releasing the controlling mutex.
*
@@ -1326,12 +1327,12 @@ namespace chibios_rt {
* @api
*/
msg_t waitTimeout(systime_t time);
-#endif /* CH_USE_CONDVARS_TIMEOUT */
+#endif /* CH_CFG_USE_CONDVARS_TIMEOUT */
};
-#endif /* CH_USE_CONDVARS */
-#endif /* CH_USE_MUTEXES */
+#endif /* CH_CFG_USE_CONDVARS */
+#endif /* CH_CFG_USE_MUTEXES */
-#if CH_USE_EVENTS || defined(__DOXYGEN__)
+#if CH_CFG_USE_EVENTS || defined(__DOXYGEN__)
/*------------------------------------------------------------------------*
* chibios_rt::EvtListener *
*------------------------------------------------------------------------*/
@@ -1343,7 +1344,7 @@ namespace chibios_rt {
/**
* @brief Embedded @p ::EventListener structure.
*/
- struct ::EventListener ev_listener;
+ ::event_listener_t ev_listener;
/**
* @brief Returns the pending flags from the listener and clears them.
@@ -1353,7 +1354,7 @@ namespace chibios_rt {
*
* @api
*/
- flagsmask_t getAndClearFlags(void);
+ eventflags_t getAndClearFlags(void);
/**
* @brief Returns the flags associated to an @p EventListener.
@@ -1365,7 +1366,7 @@ namespace chibios_rt {
*
* @iclass
*/
- flagsmask_t getAndClearFlagsI(void);
+ eventflags_t getAndClearFlagsI(void);
};
/*------------------------------------------------------------------------*
@@ -1379,7 +1380,7 @@ namespace chibios_rt {
/**
* @brief Embedded @p ::EventSource structure.
*/
- struct ::EventSource ev_source;
+ ::event_source_t ev_source;
/**
* @brief EvtSource object constructor.
@@ -1433,7 +1434,7 @@ namespace chibios_rt {
*
* @api
*/
- void broadcastFlags(flagsmask_t flags);
+ void broadcastFlags(eventflags_t flags);
/**
* @brief Broadcasts on an event source.
@@ -1445,11 +1446,11 @@ namespace chibios_rt {
*
* @iclass
*/
- void broadcastFlagsI(flagsmask_t flags);
+ void broadcastFlagsI(eventflags_t flags);
};
-#endif /* CH_USE_EVENTS */
+#endif /* CH_CFG_USE_EVENTS */
-#if CH_USE_QUEUES || defined(__DOXYGEN__)
+#if CH_CFG_USE_QUEUES || defined(__DOXYGEN__)
/*------------------------------------------------------------------------*
* chibios_rt::InQueue *
*------------------------------------------------------------------------*/
@@ -1461,7 +1462,7 @@ namespace chibios_rt {
/**
* @brief Embedded @p ::InputQueue structure.
*/
- ::InputQueue iq;
+ ::input_queue_t iq;
public:
/**
@@ -1642,7 +1643,7 @@ namespace chibios_rt {
/**
* @brief Embedded @p ::OutputQueue structure.
*/
- ::OutputQueue oq;
+ ::output_queue_t oq;
public:
/**
@@ -1813,9 +1814,9 @@ namespace chibios_rt {
onfy, link) {
}
};
-#endif /* CH_USE_QUEUES */
+#endif /* CH_CFG_USE_QUEUES */
-#if CH_USE_MAILBOXES || defined(__DOXYGEN__)
+#if CH_CFG_USE_MAILBOXES || defined(__DOXYGEN__)
/*------------------------------------------------------------------------*
* chibios_rt::Mailbox *
*------------------------------------------------------------------------*/
@@ -1827,7 +1828,7 @@ namespace chibios_rt {
/**
* @brief Embedded @p ::Mailbox structure.
*/
- ::Mailbox mb;
+ ::mailbox_t mb;
/**
* @brief Mailbox constructor.
@@ -2066,9 +2067,9 @@ namespace chibios_rt {
(cnt_t)(sizeof mb_buf / sizeof (msg_t))) {
}
};
-#endif /* CH_USE_MAILBOXES */
+#endif /* CH_CFG_USE_MAILBOXES */
-#if CH_USE_MEMPOOLS || defined(__DOXYGEN__)
+#if CH_CFG_USE_MEMPOOLS || defined(__DOXYGEN__)
/*------------------------------------------------------------------------*
* chibios_rt::MemoryPool *
*------------------------------------------------------------------------*/
@@ -2080,7 +2081,7 @@ namespace chibios_rt {
/**
* @brief Embedded @p ::MemoryPool structure.
*/
- ::MemoryPool pool;
+ ::memory_pool_t pool;
/**
* @brief MemoryPool constructor.
@@ -2207,7 +2208,7 @@ namespace chibios_rt {
loadArray(pool_buf, N);
}
};
-#endif /* CH_USE_MEMPOOLS */
+#endif /* CH_CFG_USE_MEMPOOLS */
/*------------------------------------------------------------------------*
* chibios_rt::BaseSequentialStreamInterface *