From 19aff238cb04c02491e65f391f2fcceb09da4dd5 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Fri, 8 Jan 2010 13:37:23 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1510 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/kernel/src/chlists.c | 22 +++++++++++++--------- os/kernel/src/chsys.c | 4 ++-- 2 files changed, 15 insertions(+), 11 deletions(-) (limited to 'os/kernel/src') diff --git a/os/kernel/src/chlists.c b/os/kernel/src/chlists.c index da48b678e..4b87105bc 100644 --- a/os/kernel/src/chlists.c +++ b/os/kernel/src/chlists.c @@ -28,12 +28,12 @@ #if !CH_OPTIMIZE_SPEED || defined(__DOXYGEN__) /** * @brief Inserts a thread into a priority ordered queue. - * - * @param[in] tp the pointer to the thread to be inserted in the list - * @param[in] tqp the pointer to the threads list header * @note The insertion is done by scanning the list from the highest priority * toward the lowest. * @note This function is @b not an API. + * + * @param[in] tp the pointer to the thread to be inserted in the list + * @param[in] tqp the pointer to the threads list header */ void prio_insert(Thread *tp, ThreadsQueue *tqp) { @@ -52,10 +52,10 @@ void prio_insert(Thread *tp, ThreadsQueue *tqp) { /** * @brief Inserts a Thread into a queue. + * @note This function is @b not an API. * * @param[in] tp the pointer to the thread to be inserted in the list * @param[in] tqp the pointer to the threads list header - * @note This function is @b not an API. */ void queue_insert(Thread *tp, ThreadsQueue *tqp) { @@ -65,10 +65,12 @@ void queue_insert(Thread *tp, ThreadsQueue *tqp) { /** * @brief Removes the first-out Thread from a queue and returns it. + * @note If the queue is priority ordered then this function returns the + * thread with the highest priority. + * @note This function is @b not an API. * * @param[in] tqp the pointer to the threads list header * @return The removed thread pointer. - * @note This function is @b not an API. */ Thread *fifo_remove(ThreadsQueue *tqp) { Thread *tp = tqp->p_next; @@ -79,15 +81,17 @@ Thread *fifo_remove(ThreadsQueue *tqp) { /** * @brief Removes the last-out Thread from a queue and returns it. + * @note If the queue is priority ordered then this function returns the + * thread with the lowest priority. + * @note This function is @b not an API. * * @param[in] tqp the pointer to the threads list header * @return The removed thread pointer. - * @note This function is @b not an API. */ Thread *lifo_remove(ThreadsQueue *tqp) { - Thread *tp = tqp->p_next; + Thread *tp = tqp->p_prev; - (tqp->p_next = tp->p_next)->p_prev = (Thread *)tqp; + (tqp->p_prev = tp->p_prev)->p_next = (Thread *)tqp; return tp; } @@ -95,10 +99,10 @@ Thread *lifo_remove(ThreadsQueue *tqp) { * @brief Removes a Thread from a queue and returns it. * @details The thread is removed from the queue regardless of its relative * position and regardless the used insertion method. + * @note This function is @b not an API. * * @param[in] tp the pointer to the thread to be removed from the queue * @return The removed thread pointer. - * @note This function is @b not an API. */ Thread *dequeue(Thread *tp) { diff --git a/os/kernel/src/chsys.c b/os/kernel/src/chsys.c index 29c225b4c..74ee794a3 100644 --- a/os/kernel/src/chsys.c +++ b/os/kernel/src/chsys.c @@ -99,9 +99,9 @@ void chSysInit(void) { void chSysTimerHandlerI(void) { #if CH_TIME_QUANTUM > 0 - /* running thread has not used up quantum yet? */ + /* Running thread has not used up quantum yet? */ if (rlist.r_preempt > 0) - /* decrement remaining quantum */ + /* Decrement remaining quantum.*/ rlist.r_preempt--; #endif #if CH_DBG_THREADS_PROFILING -- cgit v1.2.3