From 745d8c15044781f1215f2188edcc402fafadd059 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 16 Jun 2013 16:30:00 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/kernel_3_dev@5861 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/kernel/src/chmsg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'os/kernel/src/chmsg.c') diff --git a/os/kernel/src/chmsg.c b/os/kernel/src/chmsg.c index ad97da79c..d27713ef0 100644 --- a/os/kernel/src/chmsg.c +++ b/os/kernel/src/chmsg.c @@ -102,7 +102,7 @@ Thread *chMsgWait(void) { chSysLock(); if (!chMsgIsPendingI(currp)) chSchGoSleepS(THD_STATE_WTMSG); - tp = fifo_remove(&currp->p_msgqueue); + tp = queue_fifo_remove(&currp->p_msgqueue); tp->p_state = THD_STATE_SNDMSG; chSysUnlock(); return tp; -- cgit v1.2.3 From 84e044f176cee7c6946b24c36c90f63534b5b369 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Fri, 19 Jul 2013 12:22:31 +0000 Subject: Renamed Thread to thread_t. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/kernel_3_dev@5995 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/kernel/src/chmsg.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'os/kernel/src/chmsg.c') diff --git a/os/kernel/src/chmsg.c b/os/kernel/src/chmsg.c index d27713ef0..50e489915 100644 --- a/os/kernel/src/chmsg.c +++ b/os/kernel/src/chmsg.c @@ -40,7 +40,7 @@ * @pre In order to use the message APIs the @p CH_USE_MESSAGES option * must be enabled in @p chconf.h. * @post Enabling messages requires 6-12 (depending on the architecture) - * extra bytes in the @p Thread structure. + * extra bytes in the @p thread_t structure. * @{ */ @@ -65,8 +65,8 @@ * * @api */ -msg_t chMsgSend(Thread *tp, msg_t msg) { - Thread *ctp = currp; +msg_t chMsgSend(thread_t *tp, msg_t msg) { + thread_t *ctp = currp; chDbgCheck(tp != NULL, "chMsgSend"); @@ -96,8 +96,8 @@ msg_t chMsgSend(Thread *tp, msg_t msg) { * * @api */ -Thread *chMsgWait(void) { - Thread *tp; +thread_t *chMsgWait(void) { + thread_t *tp; chSysLock(); if (!chMsgIsPendingI(currp)) @@ -118,7 +118,7 @@ Thread *chMsgWait(void) { * * @api */ -void chMsgRelease(Thread *tp, msg_t msg) { +void chMsgRelease(thread_t *tp, msg_t msg) { chSysLock(); chDbgAssert(tp->p_state == THD_STATE_SNDMSG, -- cgit v1.2.3 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/src/chmsg.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'os/kernel/src/chmsg.c') diff --git a/os/kernel/src/chmsg.c b/os/kernel/src/chmsg.c index 50e489915..b53f91979 100644 --- a/os/kernel/src/chmsg.c +++ b/os/kernel/src/chmsg.c @@ -48,12 +48,32 @@ #if CH_USE_MESSAGES || defined(__DOXYGEN__) +/*===========================================================================*/ +/* Module exported variables. */ +/*===========================================================================*/ + +/*===========================================================================*/ +/* Module local types. */ +/*===========================================================================*/ + +/*===========================================================================*/ +/* Module local variables. */ +/*===========================================================================*/ + +/*===========================================================================*/ +/* Module local functions. */ +/*===========================================================================*/ + #if CH_USE_MESSAGES_PRIORITY #define msg_insert(tp, qp) prio_insert(tp, qp) #else #define msg_insert(tp, qp) queue_insert(tp, qp) #endif +/*===========================================================================*/ +/* Module exported functions. */ +/*===========================================================================*/ + /** * @brief Sends a message to the specified thread. * @details The sender is stopped until the receiver executes a -- cgit v1.2.3 From 49d71a01abeefa000a4cd7a556052d826b096d49 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 20 Jul 2013 10:12:44 +0000 Subject: Renamed or added prefix to all hernel configuration options. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/kernel_3_dev@6010 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/kernel/src/chmsg.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'os/kernel/src/chmsg.c') diff --git a/os/kernel/src/chmsg.c b/os/kernel/src/chmsg.c index b53f91979..535143b7c 100644 --- a/os/kernel/src/chmsg.c +++ b/os/kernel/src/chmsg.c @@ -36,8 +36,8 @@ * architectures function pointers can be larger that @p msg_t.
* Messages are usually processed in FIFO order but it is possible to * process them in priority order by enabling the - * @p CH_USE_MESSAGES_PRIORITY option in @p chconf.h.
- * @pre In order to use the message APIs the @p CH_USE_MESSAGES option + * @p CH_CFG_USE_MESSAGES_PRIORITY option in @p chconf.h.
+ * @pre In order to use the message APIs the @p CH_CFG_USE_MESSAGES option * must be enabled in @p chconf.h. * @post Enabling messages requires 6-12 (depending on the architecture) * extra bytes in the @p thread_t structure. @@ -46,7 +46,7 @@ #include "ch.h" -#if CH_USE_MESSAGES || defined(__DOXYGEN__) +#if CH_CFG_USE_MESSAGES || defined(__DOXYGEN__) /*===========================================================================*/ /* Module exported variables. */ @@ -64,7 +64,7 @@ /* Module local functions. */ /*===========================================================================*/ -#if CH_USE_MESSAGES_PRIORITY +#if CH_CFG_USE_MESSAGES_PRIORITY #define msg_insert(tp, qp) prio_insert(tp, qp) #else #define msg_insert(tp, qp) queue_insert(tp, qp) @@ -147,6 +147,6 @@ void chMsgRelease(thread_t *tp, msg_t msg) { chSysUnlock(); } -#endif /* CH_USE_MESSAGES */ +#endif /* CH_CFG_USE_MESSAGES */ /** @} */ -- cgit v1.2.3 From 40f413d3c97a7694703938cd031ce15912b29ff7 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Wed, 24 Jul 2013 14:54:26 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/kernel_3_dev@6025 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/kernel/src/chmsg.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'os/kernel/src/chmsg.c') diff --git a/os/kernel/src/chmsg.c b/os/kernel/src/chmsg.c index 535143b7c..1e99cce3f 100644 --- a/os/kernel/src/chmsg.c +++ b/os/kernel/src/chmsg.c @@ -94,9 +94,9 @@ msg_t chMsgSend(thread_t *tp, msg_t msg) { ctp->p_msg = msg; ctp->p_u.wtobjp = &tp->p_msgqueue; msg_insert(ctp, &tp->p_msgqueue); - if (tp->p_state == THD_STATE_WTMSG) + if (tp->p_state == CH_STATE_WTMSG) chSchReadyI(tp); - chSchGoSleepS(THD_STATE_SNDMSGQ); + chSchGoSleepS(CH_STATE_SNDMSGQ); msg = ctp->p_u.rdymsg; chSysUnlock(); return msg; @@ -121,9 +121,9 @@ thread_t *chMsgWait(void) { chSysLock(); if (!chMsgIsPendingI(currp)) - chSchGoSleepS(THD_STATE_WTMSG); + chSchGoSleepS(CH_STATE_WTMSG); tp = queue_fifo_remove(&currp->p_msgqueue); - tp->p_state = THD_STATE_SNDMSG; + tp->p_state = CH_STATE_SNDMSG; chSysUnlock(); return tp; } @@ -141,7 +141,7 @@ thread_t *chMsgWait(void) { void chMsgRelease(thread_t *tp, msg_t msg) { chSysLock(); - chDbgAssert(tp->p_state == THD_STATE_SNDMSG, + chDbgAssert(tp->p_state == CH_STATE_SNDMSG, "chMsgRelease(), #1", "invalid state"); chMsgReleaseS(tp, msg); chSysUnlock(); -- cgit v1.2.3 From eb7a1a15b23341693864c6fc13ac5eab5c1d6122 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 10 Aug 2013 14:50:32 +0000 Subject: Removed 2nd parameter to assertion and check macros. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/kernel_3_dev@6122 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/kernel/src/chmsg.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'os/kernel/src/chmsg.c') diff --git a/os/kernel/src/chmsg.c b/os/kernel/src/chmsg.c index 1e99cce3f..335b46c61 100644 --- a/os/kernel/src/chmsg.c +++ b/os/kernel/src/chmsg.c @@ -88,7 +88,7 @@ msg_t chMsgSend(thread_t *tp, msg_t msg) { thread_t *ctp = currp; - chDbgCheck(tp != NULL, "chMsgSend"); + chDbgCheck(tp != NULL); chSysLock(); ctp->p_msg = msg; @@ -141,8 +141,7 @@ thread_t *chMsgWait(void) { void chMsgRelease(thread_t *tp, msg_t msg) { chSysLock(); - chDbgAssert(tp->p_state == CH_STATE_SNDMSG, - "chMsgRelease(), #1", "invalid state"); + chDbgAssert(tp->p_state == CH_STATE_SNDMSG, "invalid state"); chMsgReleaseS(tp, msg); chSysUnlock(); } -- cgit v1.2.3 From a1435e018bfc9919cb76b1356509ecc883767fb4 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 10 Aug 2013 14:51:16 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/kernel_3_dev@6123 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/kernel/src/chmsg.c | 151 -------------------------------------------------- 1 file changed, 151 deletions(-) delete mode 100644 os/kernel/src/chmsg.c (limited to 'os/kernel/src/chmsg.c') diff --git a/os/kernel/src/chmsg.c b/os/kernel/src/chmsg.c deleted file mode 100644 index 335b46c61..000000000 --- a/os/kernel/src/chmsg.c +++ /dev/null @@ -1,151 +0,0 @@ -/* - ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, - 2011,2012,2013 Giovanni Di Sirio. - - This file is part of ChibiOS/RT. - - ChibiOS/RT is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - ChibiOS/RT is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -/** - * @file chmsg.c - * @brief Messages code. - * - * @addtogroup messages - * @details Synchronous inter-thread messages APIs and services. - *

Operation Mode

- * Synchronous messages are an easy to use and fast IPC mechanism, - * threads can both act as message servers and/or message clients, - * the mechanism allows data to be carried in both directions. Note - * that messages are not copied between the client and server threads - * but just a pointer passed so the exchange is very time - * efficient.
- * Messages are scalar data types of type @p msg_t that are guaranteed - * to be size compatible with data pointers. Note that on some - * architectures function pointers can be larger that @p msg_t.
- * Messages are usually processed in FIFO order but it is possible to - * process them in priority order by enabling the - * @p CH_CFG_USE_MESSAGES_PRIORITY option in @p chconf.h.
- * @pre In order to use the message APIs the @p CH_CFG_USE_MESSAGES option - * must be enabled in @p chconf.h. - * @post Enabling messages requires 6-12 (depending on the architecture) - * extra bytes in the @p thread_t structure. - * @{ - */ - -#include "ch.h" - -#if CH_CFG_USE_MESSAGES || defined(__DOXYGEN__) - -/*===========================================================================*/ -/* Module exported variables. */ -/*===========================================================================*/ - -/*===========================================================================*/ -/* Module local types. */ -/*===========================================================================*/ - -/*===========================================================================*/ -/* Module local variables. */ -/*===========================================================================*/ - -/*===========================================================================*/ -/* Module local functions. */ -/*===========================================================================*/ - -#if CH_CFG_USE_MESSAGES_PRIORITY -#define msg_insert(tp, qp) prio_insert(tp, qp) -#else -#define msg_insert(tp, qp) queue_insert(tp, qp) -#endif - -/*===========================================================================*/ -/* Module exported functions. */ -/*===========================================================================*/ - -/** - * @brief Sends a message to the specified thread. - * @details The sender is stopped until the receiver executes a - * @p chMsgRelease()after receiving the message. - * - * @param[in] tp the pointer to the thread - * @param[in] msg the message - * @return The answer message from @p chMsgRelease(). - * - * @api - */ -msg_t chMsgSend(thread_t *tp, msg_t msg) { - thread_t *ctp = currp; - - chDbgCheck(tp != NULL); - - chSysLock(); - ctp->p_msg = msg; - ctp->p_u.wtobjp = &tp->p_msgqueue; - msg_insert(ctp, &tp->p_msgqueue); - if (tp->p_state == CH_STATE_WTMSG) - chSchReadyI(tp); - chSchGoSleepS(CH_STATE_SNDMSGQ); - msg = ctp->p_u.rdymsg; - chSysUnlock(); - return msg; -} - -/** - * @brief Suspends the thread and waits for an incoming message. - * @post After receiving a message the function @p chMsgGet() must be - * called in order to retrieve the message and then @p chMsgRelease() - * must be invoked in order to acknowledge the reception and send - * the answer. - * @note If the message is a pointer then you can assume that the data - * pointed by the message is stable until you invoke @p chMsgRelease() - * because the sending thread is suspended until then. - * - * @return A reference to the thread carrying the message. - * - * @api - */ -thread_t *chMsgWait(void) { - thread_t *tp; - - chSysLock(); - if (!chMsgIsPendingI(currp)) - chSchGoSleepS(CH_STATE_WTMSG); - tp = queue_fifo_remove(&currp->p_msgqueue); - tp->p_state = CH_STATE_SNDMSG; - chSysUnlock(); - return tp; -} - -/** - * @brief Releases a sender thread specifying a response message. - * @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 - * - * @api - */ -void chMsgRelease(thread_t *tp, msg_t msg) { - - chSysLock(); - chDbgAssert(tp->p_state == CH_STATE_SNDMSG, "invalid state"); - chMsgReleaseS(tp, msg); - chSysUnlock(); -} - -#endif /* CH_CFG_USE_MESSAGES */ - -/** @} */ -- cgit v1.2.3