diff options
author | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2013-07-19 13:17:42 +0000 |
---|---|---|
committer | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2013-07-19 13:17:42 +0000 |
commit | d58064a533743df77e52f9d76385a9e0ea1d0227 (patch) | |
tree | 2e76847d1640e8c9f27a0c2fc0bf8ce60ba4b0b4 /os/kernel/src/chcond.c | |
parent | 84e044f176cee7c6946b24c36c90f63534b5b369 (diff) | |
download | ChibiOS-d58064a533743df77e52f9d76385a9e0ea1d0227.tar.gz ChibiOS-d58064a533743df77e52f9d76385a9e0ea1d0227.tar.bz2 ChibiOS-d58064a533743df77e52f9d76385a9e0ea1d0227.zip |
Still work in progress.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/kernel_3_dev@5996 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/kernel/src/chcond.c')
-rw-r--r-- | os/kernel/src/chcond.c | 98 |
1 files changed, 61 insertions, 37 deletions
diff --git a/os/kernel/src/chcond.c b/os/kernel/src/chcond.c index 99a641122..5903e062f 100644 --- a/os/kernel/src/chcond.c +++ b/os/kernel/src/chcond.c @@ -25,14 +25,14 @@ * @file chcond.c
* @brief Condition Variables code.
*
- * @addtogroup condvars Condition Variables
+ * @addtogroup condition variables Condition Variables
* @details This module implements the Condition Variables mechanism. Condition
- * variables are an extensions to the Mutex subsystem and cannot
+ * variables are an extensions to the mutex subsystem and cannot
* work alone.
* <h2>Operation mode</h2>
* The condition variable is a synchronization object meant to be
- * used inside a zone protected by a @p Mutex. Mutexes and CondVars
- * together can implement a Monitor construct.
+ * used inside a zone protected by a mutex. Mutexes and condition
+ * variables together can implement a Monitor construct.
* @pre In order to use the condition variable APIs the @p CH_USE_CONDVARS
* option must be enabled in @p chconf.h.
* @{
@@ -40,16 +40,40 @@ #include "ch.h"
-#if (CH_USE_CONDVARS && CH_USE_MUTEXES) || defined(__DOXYGEN__)
+#if CH_USE_CONDVARS || defined(__DOXYGEN__)
+
+/*===========================================================================*/
+/* Module local definitions. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Module exported variables. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Module local types. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Module local variables. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Module local functions. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Module exported functions. */
+/*===========================================================================*/
/**
- * @brief Initializes s @p CondVar structure.
+ * @brief Initializes s @p condition_variable_t structure.
*
- * @param[out] cp pointer to a @p CondVar structure
+ * @param[out] cp pointer to a @p condition_variable_t structure
*
* @init
*/
-void chCondInit(CondVar *cp) {
+void chCondInit(condition_variable_t *cp) {
chDbgCheck(cp != NULL, "chCondInit");
@@ -59,11 +83,11 @@ void chCondInit(CondVar *cp) { /**
* @brief Signals one thread that is waiting on the condition variable.
*
- * @param[in] cp pointer to the @p CondVar structure
+ * @param[in] cp pointer to the @p condition_variable_t structure
*
* @api
*/
-void chCondSignal(CondVar *cp) {
+void chCondSignal(condition_variable_t *cp) {
chDbgCheck(cp != NULL, "chCondSignal");
@@ -80,11 +104,11 @@ void chCondSignal(CondVar *cp) { * interrupt handlers always reschedule on exit so an explicit
* reschedule must not be performed in ISRs.
*
- * @param[in] cp pointer to the @p CondVar structure
+ * @param[in] cp pointer to the @p condition_variable_t structure
*
* @iclass
*/
-void chCondSignalI(CondVar *cp) {
+void chCondSignalI(condition_variable_t *cp) {
chDbgCheckClassI();
chDbgCheck(cp != NULL, "chCondSignalI");
@@ -96,11 +120,11 @@ void chCondSignalI(CondVar *cp) { /**
* @brief Signals all threads that are waiting on the condition variable.
*
- * @param[in] cp pointer to the @p CondVar structure
+ * @param[in] cp pointer to the @p condition_variable_t structure
*
* @api
*/
-void chCondBroadcast(CondVar *cp) {
+void chCondBroadcast(condition_variable_t *cp) {
chSysLock();
chCondBroadcastI(cp);
@@ -115,11 +139,11 @@ void chCondBroadcast(CondVar *cp) { * interrupt handlers always reschedule on exit so an explicit
* reschedule must not be performed in ISRs.
*
- * @param[in] cp pointer to the @p CondVar structure
+ * @param[in] cp pointer to the @p condition_variable_t structure
*
* @iclass
*/
-void chCondBroadcastI(CondVar *cp) {
+void chCondBroadcastI(condition_variable_t *cp) {
chDbgCheckClassI();
chDbgCheck(cp != NULL, "chCondBroadcastI");
@@ -138,17 +162,17 @@ void chCondBroadcastI(CondVar *cp) { * is performed atomically.
* @pre The invoking thread <b>must</b> have at least one owned mutex.
*
- * @param[in] cp pointer to the @p CondVar structure
+ * @param[in] cp pointer to the @p condition_variable_t structure
* @return A message specifying how the invoking thread has been
* released from the condition variable.
- * @retval RDY_OK if the condvar has been signaled using
+ * @retval RDY_OK if the condition variable has been signaled using
* @p chCondSignal().
- * @retval RDY_RESET if the condvar has been signaled using
+ * @retval RDY_RESET if the condition variable has been signaled using
* @p chCondBroadcast().
*
* @api
*/
-msg_t chCondWait(CondVar *cp) {
+msg_t chCondWait(condition_variable_t *cp) {
msg_t msg;
chSysLock();
@@ -164,17 +188,17 @@ msg_t chCondWait(CondVar *cp) { * is performed atomically.
* @pre The invoking thread <b>must</b> have at least one owned mutex.
*
- * @param[in] cp pointer to the @p CondVar structure
+ * @param[in] cp pointer to the @p condition_variable_t structure
* @return A message specifying how the invoking thread has been
* released from the condition variable.
- * @retval RDY_OK if the condvar has been signaled using
+ * @retval RDY_OK if the condition variable has been signaled using
* @p chCondSignal().
- * @retval RDY_RESET if the condvar has been signaled using
+ * @retval RDY_RESET if the condition variable has been signaled using
* @p chCondBroadcast().
*
* @sclass
*/
-msg_t chCondWaitS(CondVar *cp) {
+msg_t chCondWaitS(condition_variable_t *cp) {
thread_t *ctp = currp;
Mutex *mp;
msg_t msg;
@@ -206,7 +230,7 @@ msg_t chCondWaitS(CondVar *cp) { * @post Exiting the function because a timeout does not re-acquire the
* mutex, the mutex ownership is lost.
*
- * @param[in] cp pointer to the @p CondVar structure
+ * @param[in] cp pointer to the @p condition_variable_t structure
* @param[in] time the number of ticks before the operation timeouts, the
* special values are handled as follow:
* - @a TIME_INFINITE no timeout.
@@ -214,16 +238,16 @@ msg_t chCondWaitS(CondVar *cp) { * .
* @return A message specifying how the invoking thread has been
* released from the condition variable.
- * @retval RDY_OK if the condvar has been signaled using
+ * @retval RDY_OK if the condition variable has been signaled using
* @p chCondSignal().
- * @retval RDY_RESET if the condvar has been signaled using
+ * @retval RDY_RESET if the condition variable has been signaled using
* @p chCondBroadcast().
- * @retval RDY_TIMEOUT if the condvar has not been signaled within the
- * specified timeout.
+ * @retval RDY_TIMEOUT if the condition variable has not been signaled within
+ * the specified timeout.
*
* @api
*/
-msg_t chCondWaitTimeout(CondVar *cp, systime_t time) {
+msg_t chCondWaitTimeout(condition_variable_t *cp, systime_t time) {
msg_t msg;
chSysLock();
@@ -243,7 +267,7 @@ msg_t chCondWaitTimeout(CondVar *cp, systime_t time) { * @post Exiting the function because a timeout does not re-acquire the
* mutex, the mutex ownership is lost.
*
- * @param[in] cp pointer to the @p CondVar structure
+ * @param[in] cp pointer to the @p condition_variable_t structure
* @param[in] time the number of ticks before the operation timeouts, the
* special values are handled as follow:
* - @a TIME_INFINITE no timeout.
@@ -251,16 +275,16 @@ msg_t chCondWaitTimeout(CondVar *cp, systime_t time) { * .
* @return A message specifying how the invoking thread has been
* released from the condition variable.
- * @retval RDY_OK if the condvar has been signaled using
+ * @retval RDY_OK if the condition variable has been signaled using
* @p chCondSignal().
- * @retval RDY_RESET if the condvar has been signaled using
+ * @retval RDY_RESET if the condition variable has been signaled using
* @p chCondBroadcast().
- * @retval RDY_TIMEOUT if the condvar has not been signaled within the
- * specified timeout.
+ * @retval RDY_TIMEOUT if the condition variable has not been signaled within
+ * the specified timeout.
*
* @sclass
*/
-msg_t chCondWaitTimeoutS(CondVar *cp, systime_t time) {
+msg_t chCondWaitTimeoutS(condition_variable_t *cp, systime_t time) {
Mutex *mp;
msg_t msg;
@@ -280,6 +304,6 @@ msg_t chCondWaitTimeoutS(CondVar *cp, systime_t time) { }
#endif /* CH_USE_CONDVARS_TIMEOUT */
-#endif /* CH_USE_CONDVARS && CH_USE_MUTEXES */
+#endif /* CH_USE_CONDVARS */
/** @} */
|