diff options
Diffstat (limited to 'os/kernel/include/chmsg.h')
-rw-r--r-- | os/kernel/include/chmsg.h | 44 |
1 files changed, 36 insertions, 8 deletions
diff --git a/os/kernel/include/chmsg.h b/os/kernel/include/chmsg.h index 438da021f..1803c719d 100644 --- a/os/kernel/include/chmsg.h +++ b/os/kernel/include/chmsg.h @@ -1,5 +1,6 @@ /*
- ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio.
+ ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010,
+ 2011 Giovanni Di Sirio.
This file is part of ChibiOS/RT.
@@ -39,20 +40,47 @@ ((tp)->p_msgqueue.p_next != (Thread *)&(tp)->p_msgqueue)
/**
- * @brief Returns the first message in the queue.
+ * @brief Returns the message carried by the specified thread.
+ * @pre This function must be invoked immediately after exiting a call
+ * to @p chMsgWait().
*
- * @iclass
+ * @param[in] tp pointer to the thread
+ * @return The message carried by the sender.
+ *
+ * @api
+ */
+#define chMsgGet(tp) ((tp)->p_msg)
+
+/**
+ * @brief Returns the message carried by the specified thread.
+ * @pre This function must be invoked immediately after exiting a call
+ * to @p chMsgWait().
+ *
+ * @param[in] tp pointer to the thread
+ * @return The message carried by the sender.
+ *
+ * @sclass
+ */
+#define chMsgGetS(tp) ((tp)->p_msg)
+
+/**
+ * @brief Releases the thread waiting on top of the messages queue.
+ * @pre Invoke this function only after a message has been received
+ * using @p chMsgWait().
+ *
+ * @param[in] tp pointer to the thread
+ * @param[in] msg message to be returned to the sender
+ *
+ * @sclass
*/
-#define chMsgGetI(tp) \
- ((tp)->p_msgqueue.p_next->p_msg)
+#define chMsgReleaseS(tp, msg) chSchWakeupS(tp, msg)
#ifdef __cplusplus
extern "C" {
#endif
msg_t chMsgSend(Thread *tp, msg_t msg);
- msg_t chMsgWait(void);
- msg_t chMsgGet(void);
- void chMsgRelease(msg_t msg);
+ Thread * chMsgWait(void);
+ void chMsgRelease(Thread *tp, msg_t msg);
#ifdef __cplusplus
}
#endif
|