aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/chschd.c14
-rw-r--r--src/chsys.c1
-rw-r--r--src/chthreads.c35
-rw-r--r--src/include/threads.h35
4 files changed, 54 insertions, 31 deletions
diff --git a/src/chschd.c b/src/chschd.c
index b246d8f57..23b9871f9 100644
--- a/src/chschd.c
+++ b/src/chschd.c
@@ -122,11 +122,15 @@ static void wakeup(void *p) {
* to sleep is awakened after the specified time has elapsed.
*
* @param[in] newstate the new thread state
- * @param[in] time the number of ticks before the operation timeouts,
- * the special value @p TIME_INFINITE is allowed.
- * It is not possible to specify @p TIME_IMMEDIATE as timeout
- * specification, it is interpreted as a normal time
- * specification.
+ * @param[in] time the number of ticks before the operation timeouts, the
+ * special values are handled as follow:
+ * - @a TIME_INFINITE the thread enters an infinite sleep
+ * state, this is equivalent to invoking @p chSchGoSleepS()
+ * but, of course, less efficient.
+ * - @a TIME_IMMEDIATE this value is accepted but interpreted
+ * as a normal time specification not as an immediate timeout
+ * specification.
+ * .
* @return The wakeup message.
* @retval RDY_TIMEOUT if a timeout occurs.
* @note The function must be called in the system mutex zone.
diff --git a/src/chsys.c b/src/chsys.c
index cedd3d28b..217e2f2da 100644
--- a/src/chsys.c
+++ b/src/chsys.c
@@ -75,7 +75,6 @@ void chSysInit(void) {
chSysEnable();
/*
- * The idle thread is created using the port-provided implementation.
* This thread has the lowest priority in the system, its role is just to
* serve interrupts in its context while keeping the lowest energy saving
* mode compatible with the system status.
diff --git a/src/chthreads.c b/src/chthreads.c
index 70db14130..5a7a98943 100644
--- a/src/chthreads.c
+++ b/src/chthreads.c
@@ -73,10 +73,8 @@ static void memfill(uint8_t *startp, uint8_t *endp, uint8_t v) {
*
* @param[out] workspace pointer to a working area dedicated to the thread
* stack
- * @param[in] wsize size of the working area.
- * @param[in] prio the priority level for the new thread. Usually the threads
- * are created with priority @p NORMALPRIO, priorities
- * can range from @p LOWPRIO to @p HIGHPRIO.
+ * @param[in] wsize size of the working area
+ * @param[in] prio the priority level for the new thread
* @param[in] pf the thread function
* @param[in] arg an argument passed to the thread function. It can be @p NULL.
* @return The pointer to the @p Thread structure allocated for the
@@ -112,10 +110,8 @@ Thread *chThdInit(void *workspace, size_t wsize,
*
* @param[out] workspace pointer to a working area dedicated to the thread
* stack
- * @param[in] wsize size of the working area.
- * @param[in] prio the priority level for the new thread. Usually the threads
- * are created with priority @p NORMALPRIO, priorities
- * can range from @p LOWPRIO to @p HIGHPRIO.
+ * @param[in] wsize size of the working area
+ * @param[in] prio the priority level for the new thread
* @param[in] pf the thread function
* @param[in] arg an argument passed to the thread function. It can be @p NULL.
* @return The pointer to the @p Thread structure allocated for the
@@ -134,9 +130,7 @@ Thread *chThdCreateStatic(void *workspace, size_t wsize,
* @brief Creates a new thread allocating the memory from the heap.
*
* @param[in] wsize size of the working area to be allocated
- * @param[in] prio the priority level for the new thread. Usually the threads
- * are created with priority @p NORMALPRIO, priorities
- * can range from @p LOWPRIO to @p HIGHPRIO.
+ * @param[in] prio the priority level for the new thread
* @param[in] pf the thread function
* @param[in] arg an argument passed to the thread function. It can be @p NULL.
* @return The pointer to the @p Thread structure allocated for the
@@ -168,9 +162,7 @@ Thread *chThdCreateFromHeap(size_t wsize, tprio_t prio,
* Pool.
*
* @param[in] mp the memory pool
- * @param[in] prio the priority level for the new thread. Usually the threads
- * are created with priority @p NORMALPRIO, priorities
- * can range from @p LOWPRIO to @p HIGHPRIO.
+ * @param[in] prio the priority level for the new thread
* @param[in] pf the thread function
* @param[in] arg an argument passed to the thread function. It can be @p NULL.
* @return The pointer to the @p Thread structure allocated for the
@@ -207,7 +199,7 @@ Thread *chThdCreateFromMemoryPool(MemoryPool *mp, tprio_t prio,
* @param[in] newprio the new priority level of the running thread
* @return The old priority level.
* @note The function returns the real thread priority regardless of the
- * actual priority that could be higher than the real priority because
+ * current priority that could be higher than the real priority because
* the priority inheritance mechanism.
*/
tprio_t chThdSetPriority(tprio_t newprio) {
@@ -268,13 +260,18 @@ void chThdTerminate(Thread *tp) {
/**
* @brief Suspends the invoking thread for the specified time.
*
- * @param[in] time the delay in system ticks, the values @p TIME_IMMEDIATE and
- * @p TIME_INFINITE are not allowed
+ * @param[in] time the delay in system ticks, the special values are handled as
+ * follow:
+ * - @a TIME_INFINITE the thread enters an infinite sleep
+ * state.
+ * - @a TIME_IMMEDIATE this value is accepted but interpreted
+ * as a normal time specification not as an immediate timeout
+ * specification.
+ * .
*/
void chThdSleep(systime_t time) {
- chDbgCheck((time != TIME_IMMEDIATE) && (time != TIME_INFINITE),
- "chThdSleep");
+ chDbgCheck(time != TIME_INFINITE, "chThdSleep");
chSysLock();
chThdSleepS(time);
diff --git a/src/include/threads.h b/src/include/threads.h
index 961ef5b0b..e7c56d3c7 100644
--- a/src/include/threads.h
+++ b/src/include/threads.h
@@ -190,35 +190,54 @@ extern "C" {
/** Returns the pointer to the @p Thread currently in execution.*/
#define chThdSelf() currp
-/** Returns the thread priority.*/
+/** Returns the current thread priority.*/
#define chThdGetPriority() (currp->p_prio)
/** Returns the pointer to the @p Thread local storage area, if any.*/
#define chThdLS() (void *)(currp + 1)
-/** Verifies if the specified thread is in the @p PREXIT state.*/
+/**
+ * Verifies if the specified thread is in the @p PREXIT state.
+ *
+ * @param[in] tp the pointer to the thread
+ * @retval TRUE thread terminated.
+ * @retval FALSE thread not terminated.
+ */
#define chThdTerminated(tp) ((tp)->p_state == PREXIT)
/**
* Verifies if the current thread has a termination request pending.
+ *
+ * @retval TRUE termination request pended.
+ * @retval FALSE termination request not pended.
*/
#define chThdShouldTerminate() (currp->p_flags & P_TERMINATE)
/**
- * Resumes a thread created with the @p P_SUSPENDED option or suspended with
- * @p chThdSuspend().
- * @param tp the pointer to the thread
+ * Resumes a thread created with @p chThdInit().
+ *
+ * @param[in] tp the pointer to the thread
*/
#define chThdResumeI(tp) chSchReadyI(tp)
/**
* Suspends the invoking thread for the specified time.
- * @param time the delay in system ticks
+ *
+ * @param[in] time the delay in system ticks, the special values are handled as
+ * follow:
+ * - @a TIME_INFINITE the thread enters an infinite sleep
+ * state.
+ * - @a TIME_IMMEDIATE this value is accepted but interpreted
+ * as a normal time specification not as an immediate timeout
+ * specification.
+ * .
*/
#define chThdSleepS(time) chSchGoSleepTimeoutS(PRSLEEP, time)
/**
* Delays the invoking thread for the specified number of seconds.
+ *
+ * @param[in] sec the time in seconds
* @note The specified time is rounded up to a value allowed by the real
* system clock.
* @note The maximum specified value is implementation dependent.
@@ -227,6 +246,8 @@ extern "C" {
/**
* Delays the invoking thread for the specified number of milliseconds.
+ *
+ * @param[in] msec the time in milliseconds
* @note The specified time is rounded up to a value allowed by the real
* system clock.
* @note The maximum specified value is implementation dependent.
@@ -235,6 +256,8 @@ extern "C" {
/**
* Delays the invoking thread for the specified number of microseconds.
+ *
+ * @param[in] usec the time in microseconds
* @note The specified time is rounded up to a value allowed by the real
* system clock.
* @note The maximum specified value is implementation dependent.