aboutsummaryrefslogtreecommitdiffstats
path: root/os/rt/include
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2013-08-17 11:04:57 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2013-08-17 11:04:57 +0000
commit4f49b546b101841d523df17806bea67b269a2a85 (patch)
tree4690183f1989a0caff203b688c0dbdf25f9c26d6 /os/rt/include
parentbfa3ba9f00d263a15d6d6b2dec2aa0b81058df27 (diff)
downloadChibiOS-4f49b546b101841d523df17806bea67b269a2a85.tar.gz
ChibiOS-4f49b546b101841d523df17806bea67b269a2a85.tar.bz2
ChibiOS-4f49b546b101841d523df17806bea67b269a2a85.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/kernel_3_dev@6167 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/rt/include')
-rw-r--r--os/rt/include/chlists.h26
-rw-r--r--os/rt/include/chthreads.h40
2 files changed, 48 insertions, 18 deletions
diff --git a/os/rt/include/chlists.h b/os/rt/include/chlists.h
index 69a42bcce..1384dc58f 100644
--- a/os/rt/include/chlists.h
+++ b/os/rt/include/chlists.h
@@ -20,9 +20,9 @@
/**
* @file chlists.h
- * @brief Thread queues/lists inlined code.
+ * @brief Thread queues and lists header.
*
- * @addtogroup internals
+ * @addtogroup queues_list
* @{
*/
@@ -72,6 +72,16 @@
/* External declarations. */
/*===========================================================================*/
+#ifdef __cplusplus
+extern "C" {
+#endif
+ msg_t chQueueGoSleepTimeoutS(threads_queue_t *tqp, systime_t time);
+ void chQueueWakeupOneI(threads_queue_t *tqp, msg_t msg);
+ void chQueueWakeupAllI(threads_queue_t *tqp, msg_t msg);
+#ifdef __cplusplus
+}
+#endif
+
/*===========================================================================*/
/* Module inline functions. */
/*===========================================================================*/
@@ -192,4 +202,16 @@ static inline thread_t *queue_dequeue(thread_t *tp) {
}
#endif /* CH_CFG_OPTIMIZE_SPEED */
+/**
+ * @brief Initializes a threads queue object.
+ *
+ * @param[out] tqp pointer to the threads queue object
+ *
+ * @init
+ */
+static inline void chQueueObjectInit(threads_queue_t *tqp) {
+
+ queue_init(tqp);
+}
+
#endif /* _CHLISTS_H_ */
diff --git a/os/rt/include/chthreads.h b/os/rt/include/chthreads.h
index d27de04a9..18fb962d4 100644
--- a/os/rt/include/chthreads.h
+++ b/os/rt/include/chthreads.h
@@ -41,20 +41,20 @@
#define CH_STATE_CURRENT 1 /**< @brief Currently running. */
#define CH_STATE_WTSTART 2 /**< @brief Created but not started. */
#define CH_STATE_SUSPENDED 3 /**< @brief Created in suspended state. */
-#define CH_STATE_WTSEM 4 /**< @brief Waiting on a semaphore. */
-#define CH_STATE_WTMTX 5 /**< @brief Waiting on a mutex. */
-#define CH_STATE_WTCOND 6 /**< @brief Waiting on a condition
+#define CH_STATE_QUEUED 4 /**< @brief Waiting on an I/O queue. */
+#define CH_STATE_WTSEM 5 /**< @brief Waiting on a semaphore. */
+#define CH_STATE_WTMTX 6 /**< @brief Waiting on a mutex. */
+#define CH_STATE_WTCOND 7 /**< @brief Waiting on a condition
variable. */
-#define CH_STATE_SLEEPING 7 /**< @brief Waiting in @p chThdSleep()
+#define CH_STATE_SLEEPING 8 /**< @brief Waiting in @p chThdSleep()
or @p chThdSleepUntil(). */
-#define CH_STATE_WTEXIT 8 /**< @brief Waiting in @p chThdWait(). */
-#define CH_STATE_WTOREVT 9 /**< @brief Waiting for an event. */
-#define CH_STATE_WTANDEVT 10 /**< @brief Waiting for several events. */
-#define CH_STATE_SNDMSGQ 11 /**< @brief Sending a message, in queue.*/
-#define CH_STATE_SNDMSG 12 /**< @brief Sent a message, waiting
+#define CH_STATE_WTEXIT 9 /**< @brief Waiting in @p chThdWait(). */
+#define CH_STATE_WTOREVT 10 /**< @brief Waiting for an event. */
+#define CH_STATE_WTANDEVT 11 /**< @brief Waiting for several events. */
+#define CH_STATE_SNDMSGQ 12 /**< @brief Sending a message, in queue.*/
+#define CH_STATE_SNDMSG 13 /**< @brief Sent a message, waiting
answer. */
-#define CH_STATE_WTMSG 13 /**< @brief Waiting for a message. */
-#define CH_STATE_WTQUEUE 14 /**< @brief Waiting on an I/O queue. */
+#define CH_STATE_WTMSG 14 /**< @brief Waiting for a message. */
#define CH_STATE_FINAL 15 /**< @brief Thread terminated. */
/**
@@ -63,9 +63,9 @@
* indexed using the numeric thread state values.
*/
#define CH_STATE_NAMES \
- "READY", "WTSTART", "CURRENT", "SUSPENDED", "WTSEM", "WTMTX", "WTCOND", \
- "SLEEPING", "WTEXIT", "WTOREVT", "WTANDEVT", "SNDMSGQ", "SNDMSG", \
- "WTMSG", "WTQUEUE", "FINAL"
+ "READY", "WTSTART", "CURRENT", "SUSPENDED", "QUEUED", "WTSEM", "WTMTX", \
+ "WTCOND", "SLEEPING", "WTEXIT", "WTOREVT", "WTANDEVT", "SNDMSGQ", \
+ "SNDMSG", "WTMSG", "FINAL"
/** @} */
/**
@@ -93,6 +93,10 @@
/* Module data structures and types. */
/*===========================================================================*/
+/**
+ * @brief Type of a thread reference.
+ */
+typedef thread_t * thread_reference_t;
/**
* @brief Thread function.
@@ -161,8 +165,12 @@ extern "C" {
tprio_t prio, tfunc_t pf, void *arg);
thread_t *chThdCreateStatic(void *wsp, size_t size,
tprio_t prio, tfunc_t pf, void *arg);
+ thread_t *chThdStart(thread_t *tp);
tprio_t chThdSetPriority(tprio_t newprio);
- thread_t *chThdResume(thread_t *tp);
+ msg_t chThreadSuspendS(thread_reference_t *trp);
+ void chThreadResumeI(thread_reference_t *trp, msg_t msg);
+ void chThreadResumeS(thread_reference_t *trp, msg_t msg);
+ void chThreadResume(thread_reference_t *trp, msg_t msg);
void chThdTerminate(thread_t *tp);
void chThdSleep(systime_t time);
void chThdSleepUntil(systime_t time);
@@ -249,7 +257,7 @@ static inline bool chThdShouldTerminateX(void) {
*
* @param[in] tp pointer to the thread
*
- * @xclass
+ * @iclass
*/
static inline thread_t *chThdStartI(thread_t *tp) {