From 6f6e1a6401eda000dce198150937c7919b4c9855 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Wed, 23 Feb 2011 18:59:39 +0000 Subject: Improved messages subsystem. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2759 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/kernel/include/chmsg.h | 41 ++++++++++++++++++++++++++++++++++------- 1 file changed, 34 insertions(+), 7 deletions(-) (limited to 'os/kernel/include/chmsg.h') diff --git a/os/kernel/include/chmsg.h b/os/kernel/include/chmsg.h index 438da021f..b2e8ef51e 100644 --- a/os/kernel/include/chmsg.h +++ b/os/kernel/include/chmsg.h @@ -39,20 +39,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 -- cgit v1.2.3 From e7e79a6ccb4f3e320b2b8b7bad1b14d65218641d Mon Sep 17 00:00:00 2001 From: gdisirio Date: Fri, 18 Mar 2011 18:38:08 +0000 Subject: License updated. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2827 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/kernel/include/chmsg.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'os/kernel/include/chmsg.h') diff --git a/os/kernel/include/chmsg.h b/os/kernel/include/chmsg.h index b2e8ef51e..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. -- cgit v1.2.3