From 25ddb1c801f06a3be7171e20dcfd46d11a75f112 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Fri, 19 Jul 2013 14:51:35 +0000 Subject: First cleanup pass finished, queues and streams not yet removed. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/kernel_3_dev@5999 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/kernel/include/chmsg.h | 69 +++++++++++++++++++++++++++++++++++------------ 1 file changed, 52 insertions(+), 17 deletions(-) (limited to 'os/kernel/include/chmsg.h') diff --git a/os/kernel/include/chmsg.h b/os/kernel/include/chmsg.h index be3103db9..1e9099c73 100644 --- a/os/kernel/include/chmsg.h +++ b/os/kernel/include/chmsg.h @@ -31,17 +31,55 @@ #if CH_USE_MESSAGES || defined(__DOXYGEN__) -/** - * @name Macro Functions - * @{ - */ +/*===========================================================================*/ +/* Module constants. */ +/*===========================================================================*/ + +/*===========================================================================*/ +/* Module pre-compile time settings. */ +/*===========================================================================*/ + +/*===========================================================================*/ +/* Derived constants and error checks. */ +/*===========================================================================*/ + +/*===========================================================================*/ +/* Module data structures and types. */ +/*===========================================================================*/ + +/*===========================================================================*/ +/* Module macros. */ +/*===========================================================================*/ + +/*===========================================================================*/ +/* External declarations. */ +/*===========================================================================*/ + +#ifdef __cplusplus +extern "C" { +#endif + msg_t chMsgSend(thread_t *tp, msg_t msg); + thread_t * chMsgWait(void); + void chMsgRelease(thread_t *tp, msg_t msg); +#ifdef __cplusplus +} +#endif + +/*===========================================================================*/ +/* External declarations. */ +/*===========================================================================*/ + /** * @brief Evaluates to TRUE if the thread has pending messages. * * @iclass */ -#define chMsgIsPendingI(tp) \ - ((tp)->p_msgqueue.p_next != (thread_t *)&(tp)->p_msgqueue) +static inline bool chMsgIsPendingI(thread_t *tp) { + + chDbgCheckClassI(); + + return (bool)(tp->p_msgqueue.p_next != (thread_t *)&tp->p_msgqueue); +} /** * @brief Returns the message carried by the specified thread. @@ -53,7 +91,10 @@ * * @api */ -#define chMsgGet(tp) ((tp)->p_msg) +static inline msg_t chMsgGet(thread_t *tp) { + + return tp->p_msg; +} /** * @brief Releases the thread waiting on top of the messages queue. @@ -65,18 +106,12 @@ * * @sclass */ -#define chMsgReleaseS(tp, msg) chSchWakeupS(tp, msg) -/** @} */ +static inline void chMsgReleaseS(thread_t *tp, msg_t msg) { -#ifdef __cplusplus -extern "C" { -#endif - msg_t chMsgSend(thread_t *tp, msg_t msg); - thread_t * chMsgWait(void); - void chMsgRelease(thread_t *tp, msg_t msg); -#ifdef __cplusplus + chDbgCheckClassS(); + + chSchWakeupS(tp, msg); } -#endif #endif /* CH_USE_MESSAGES */ -- cgit v1.2.3