aboutsummaryrefslogtreecommitdiffstats
path: root/os/kernel/src
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2013-07-19 13:17:42 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2013-07-19 13:17:42 +0000
commitd58064a533743df77e52f9d76385a9e0ea1d0227 (patch)
tree2e76847d1640e8c9f27a0c2fc0bf8ce60ba4b0b4 /os/kernel/src
parent84e044f176cee7c6946b24c36c90f63534b5b369 (diff)
downloadChibiOS-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')
-rw-r--r--os/kernel/src/chcond.c98
-rw-r--r--os/kernel/src/chdynamic.c24
-rw-r--r--os/kernel/src/chevents.c25
-rw-r--r--os/kernel/src/chschd.c4
-rw-r--r--os/kernel/src/chsem.c46
-rw-r--r--os/kernel/src/chvt.c12
6 files changed, 141 insertions, 68 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 */
/** @} */
diff --git a/os/kernel/src/chdynamic.c b/os/kernel/src/chdynamic.c
index 3d856a526..76d4ba561 100644
--- a/os/kernel/src/chdynamic.c
+++ b/os/kernel/src/chdynamic.c
@@ -31,6 +31,30 @@
#if CH_USE_DYNAMIC || defined(__DOXYGEN__)
+/*===========================================================================*/
+/* Module local definitions. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Module exported variables. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Module local types. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Module local variables. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Module local functions. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Module exported functions. */
+/*===========================================================================*/
+
/**
* @brief Adds a reference to a thread object.
* @pre The configuration option @p CH_USE_DYNAMIC must be enabled in order
diff --git a/os/kernel/src/chevents.c b/os/kernel/src/chevents.c
index 0ff5bef73..5685f285f 100644
--- a/os/kernel/src/chevents.c
+++ b/os/kernel/src/chevents.c
@@ -61,6 +61,31 @@
#include "ch.h"
#if CH_USE_EVENTS || defined(__DOXYGEN__)
+
+/*===========================================================================*/
+/* Module local definitions. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Module exported variables. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Module local types. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Module local variables. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Module local functions. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Module exported functions. */
+/*===========================================================================*/
+
/**
* @brief Registers an Event Listener on an Event Source.
* @details Once a thread has registered as listener on an event source it
diff --git a/os/kernel/src/chschd.c b/os/kernel/src/chschd.c
index b957a8152..b99afbbb9 100644
--- a/os/kernel/src/chschd.c
+++ b/os/kernel/src/chschd.c
@@ -153,7 +153,7 @@ static void wakeup(void *p) {
(CH_USE_CONDVARS && CH_USE_CONDVARS_TIMEOUT)
#if CH_USE_SEMAPHORES
case THD_STATE_WTSEM:
- chSemFastSignalI((Semaphore *)tp->p_u.wtobjp);
+ chSemFastSignalI((semaphore_t *)tp->p_u.wtobjp);
/* Falls into, intentional. */
#endif
#if CH_USE_QUEUES
@@ -197,7 +197,7 @@ msg_t chSchGoSleepTimeoutS(tstate_t newstate, systime_t time) {
chDbgCheckClassS();
if (TIME_INFINITE != time) {
- VirtualTimer vt;
+ virtual_timer_t vt;
chVTDoSetI(&vt, time, wakeup, currp);
chSchGoSleepS(newstate);
diff --git a/os/kernel/src/chsem.c b/os/kernel/src/chsem.c
index 04e208e58..73d156c02 100644
--- a/os/kernel/src/chsem.c
+++ b/os/kernel/src/chsem.c
@@ -70,13 +70,13 @@
/**
* @brief Initializes a semaphore with the specified counter value.
*
- * @param[out] sp pointer to a @p Semaphore structure
+ * @param[out] sp pointer to a @p semaphore_t structure
* @param[in] n initial value of the semaphore counter. Must be
* non-negative.
*
* @init
*/
-void chSemInit(Semaphore *sp, cnt_t n) {
+void chSemInit(semaphore_t *sp, cnt_t n) {
chDbgCheck((sp != NULL) && (n >= 0), "chSemInit");
@@ -93,13 +93,13 @@ void chSemInit(Semaphore *sp, cnt_t n) {
* rather than a signal because the @p chSemWait() will return
* @p RDY_RESET instead of @p RDY_OK.
*
- * @param[in] sp pointer to a @p Semaphore structure
+ * @param[in] sp pointer to a @p semaphore_t structure
* @param[in] n the new value of the semaphore counter. The value must
* be non-negative.
*
* @api
*/
-void chSemReset(Semaphore *sp, cnt_t n) {
+void chSemReset(semaphore_t *sp, cnt_t n) {
chSysLock();
chSemResetI(sp, n);
@@ -120,13 +120,13 @@ void chSemReset(Semaphore *sp, cnt_t n) {
* rather than a signal because the @p chSemWait() will return
* @p RDY_RESET instead of @p RDY_OK.
*
- * @param[in] sp pointer to a @p Semaphore structure
+ * @param[in] sp pointer to a @p semaphore_t structure
* @param[in] n the new value of the semaphore counter. The value must
* be non-negative.
*
* @iclass
*/
-void chSemResetI(Semaphore *sp, cnt_t n) {
+void chSemResetI(semaphore_t *sp, cnt_t n) {
cnt_t cnt;
chDbgCheckClassI();
@@ -145,7 +145,7 @@ void chSemResetI(Semaphore *sp, cnt_t n) {
/**
* @brief Performs a wait operation on a semaphore.
*
- * @param[in] sp pointer to a @p Semaphore structure
+ * @param[in] sp pointer to a @p semaphore_t structure
* @return A message specifying how the invoking thread has been
* released from the semaphore.
* @retval RDY_OK if the thread has not stopped on the semaphore or the
@@ -154,7 +154,7 @@ void chSemResetI(Semaphore *sp, cnt_t n) {
*
* @api
*/
-msg_t chSemWait(Semaphore *sp) {
+msg_t chSemWait(semaphore_t *sp) {
msg_t msg;
chSysLock();
@@ -166,7 +166,7 @@ msg_t chSemWait(Semaphore *sp) {
/**
* @brief Performs a wait operation on a semaphore.
*
- * @param[in] sp pointer to a @p Semaphore structure
+ * @param[in] sp pointer to a @p semaphore_t structure
* @return A message specifying how the invoking thread has been
* released from the semaphore.
* @retval RDY_OK if the thread has not stopped on the semaphore or the
@@ -175,7 +175,7 @@ msg_t chSemWait(Semaphore *sp) {
*
* @sclass
*/
-msg_t chSemWaitS(Semaphore *sp) {
+msg_t chSemWaitS(semaphore_t *sp) {
chDbgCheckClassS();
chDbgCheck(sp != NULL, "chSemWaitS");
@@ -196,7 +196,7 @@ msg_t chSemWaitS(Semaphore *sp) {
/**
* @brief Performs a wait operation on a semaphore with timeout specification.
*
- * @param[in] sp pointer to a @p Semaphore structure
+ * @param[in] sp pointer to a @p semaphore_t structure
* @param[in] time the number of ticks before the operation timeouts,
* the following special values are allowed:
* - @a TIME_IMMEDIATE immediate timeout.
@@ -212,7 +212,7 @@ msg_t chSemWaitS(Semaphore *sp) {
*
* @api
*/
-msg_t chSemWaitTimeout(Semaphore *sp, systime_t time) {
+msg_t chSemWaitTimeout(semaphore_t *sp, systime_t time) {
msg_t msg;
chSysLock();
@@ -224,7 +224,7 @@ msg_t chSemWaitTimeout(Semaphore *sp, systime_t time) {
/**
* @brief Performs a wait operation on a semaphore with timeout specification.
*
- * @param[in] sp pointer to a @p Semaphore structure
+ * @param[in] sp pointer to a @p semaphore_t structure
* @param[in] time the number of ticks before the operation timeouts,
* the following special values are allowed:
* - @a TIME_IMMEDIATE immediate timeout.
@@ -240,7 +240,7 @@ msg_t chSemWaitTimeout(Semaphore *sp, systime_t time) {
*
* @sclass
*/
-msg_t chSemWaitTimeoutS(Semaphore *sp, systime_t time) {
+msg_t chSemWaitTimeoutS(semaphore_t *sp, systime_t time) {
chDbgCheckClassS();
chDbgCheck(sp != NULL, "chSemWaitTimeoutS");
@@ -264,11 +264,11 @@ msg_t chSemWaitTimeoutS(Semaphore *sp, systime_t time) {
/**
* @brief Performs a signal operation on a semaphore.
*
- * @param[in] sp pointer to a @p Semaphore structure
+ * @param[in] sp pointer to a @p semaphore_t structure
*
* @api
*/
-void chSemSignal(Semaphore *sp) {
+void chSemSignal(semaphore_t *sp) {
chDbgCheck(sp != NULL, "chSemSignal");
chDbgAssert(((sp->s_cnt >= 0) && queue_isempty(&sp->s_queue)) ||
@@ -289,11 +289,11 @@ void chSemSignal(Semaphore *sp) {
* interrupt handlers always reschedule on exit so an explicit
* reschedule must not be performed in ISRs.
*
- * @param[in] sp pointer to a @p Semaphore structure
+ * @param[in] sp pointer to a @p semaphore_t structure
*
* @iclass
*/
-void chSemSignalI(Semaphore *sp) {
+void chSemSignalI(semaphore_t *sp) {
chDbgCheckClassI();
chDbgCheck(sp != NULL, "chSemSignalI");
@@ -318,13 +318,13 @@ void chSemSignalI(Semaphore *sp) {
* interrupt handlers always reschedule on exit so an explicit
* reschedule must not be performed in ISRs.
*
- * @param[in] sp pointer to a @p Semaphore structure
+ * @param[in] sp pointer to a @p semaphore_t structure
* @param[in] n value to be added to the semaphore counter. The value
* must be positive.
*
* @iclass
*/
-void chSemAddCounterI(Semaphore *sp, cnt_t n) {
+void chSemAddCounterI(semaphore_t *sp, cnt_t n) {
chDbgCheckClassI();
chDbgCheck((sp != NULL) && (n > 0), "chSemAddCounterI");
@@ -346,8 +346,8 @@ void chSemAddCounterI(Semaphore *sp, cnt_t n) {
* @pre The configuration option @p CH_USE_SEMSW must be enabled in order
* to use this function.
*
- * @param[in] sps pointer to a @p Semaphore structure to be signaled
- * @param[in] spw pointer to a @p Semaphore structure to wait on
+ * @param[in] sps pointer to a @p semaphore_t structure to be signaled
+ * @param[in] spw pointer to a @p semaphore_t structure to wait on
* @return A message specifying how the invoking thread has been
* released from the semaphore.
* @retval RDY_OK if the thread has not stopped on the semaphore or the
@@ -356,7 +356,7 @@ void chSemAddCounterI(Semaphore *sp, cnt_t n) {
*
* @api
*/
-msg_t chSemSignalWait(Semaphore *sps, Semaphore *spw) {
+msg_t chSemSignalWait(semaphore_t *sps, semaphore_t *spw) {
msg_t msg;
chDbgCheck((sps != NULL) && (spw != NULL), "chSemSignalWait");
diff --git a/os/kernel/src/chvt.c b/os/kernel/src/chvt.c
index e93b2244c..3bccd1ac8 100644
--- a/os/kernel/src/chvt.c
+++ b/os/kernel/src/chvt.c
@@ -40,7 +40,7 @@
/**
* @brief Virtual timers delta list header.
*/
-VTList vtlist;
+virtual_timers_list_t vtlist;
/*===========================================================================*/
/* Module local types. */
@@ -99,7 +99,7 @@ bool chVTIsTimeWithin(systime_t time, systime_t start, systime_t end) {
* @pre The timer must not be already armed before calling this function.
* @note The callback function is invoked from interrupt context.
*
- * @param[out] vtp the @p VirtualTimer structure pointer
+ * @param[out] vtp the @p virtual_timer_t structure pointer
* @param[in] delay the number of ticks before the operation timeouts, the
* special values are handled as follow:
* - @a TIME_INFINITE is allowed but interpreted as a
@@ -114,9 +114,9 @@ bool chVTIsTimeWithin(systime_t time, systime_t start, systime_t end) {
*
* @iclass
*/
-void chVTDoSetI(VirtualTimer *vtp, systime_t delay,
+void chVTDoSetI(virtual_timer_t *vtp, systime_t delay,
vtfunc_t vtfunc, void *par) {
- VirtualTimer *p;
+ virtual_timer_t *p;
chDbgCheckClassI();
chDbgCheck((vtp != NULL) && (vtfunc != NULL) && (delay != TIME_IMMEDIATE),
@@ -141,11 +141,11 @@ void chVTDoSetI(VirtualTimer *vtp, systime_t delay,
* @brief Disables a Virtual Timer.
* @pre The timer must be in armed state before calling this function.
*
- * @param[in] vtp the @p VirtualTimer structure pointer
+ * @param[in] vtp the @p virtual_timer_t structure pointer
*
* @iclass
*/
-void chVTDoResetI(VirtualTimer *vtp) {
+void chVTDoResetI(virtual_timer_t *vtp) {
chDbgCheckClassI();
chDbgCheck(vtp != NULL, "chVTDoResetI");