From 84e044f176cee7c6946b24c36c90f63534b5b369 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Fri, 19 Jul 2013 12:22:31 +0000 Subject: Renamed Thread to thread_t. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/kernel_3_dev@5995 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/kernel/src/chcond.c | 4 ++-- os/kernel/src/chdebug.c | 2 +- os/kernel/src/chdynamic.c | 28 ++++++++++++++-------------- os/kernel/src/chevents.c | 26 +++++++++++++------------- os/kernel/src/chlists.c | 42 +++++++++++++++++++++--------------------- os/kernel/src/chmsg.c | 12 ++++++------ os/kernel/src/chmtx.c | 20 ++++++++++---------- os/kernel/src/chregistry.c | 34 +++++++++++++++++----------------- os/kernel/src/chschd.c | 24 ++++++++++++------------ os/kernel/src/chsem.c | 4 ++-- os/kernel/src/chsys.c | 4 ++-- os/kernel/src/chthreads.c | 33 +++++++++++++++++---------------- 12 files changed, 117 insertions(+), 116 deletions(-) (limited to 'os/kernel/src') diff --git a/os/kernel/src/chcond.c b/os/kernel/src/chcond.c index e6bf51652..99a641122 100644 --- a/os/kernel/src/chcond.c +++ b/os/kernel/src/chcond.c @@ -124,7 +124,7 @@ void chCondBroadcastI(CondVar *cp) { chDbgCheckClassI(); chDbgCheck(cp != NULL, "chCondBroadcastI"); - /* Empties the condition variable queue and inserts all the Threads into the + /* Empties the condition variable queue and inserts all the threads into the ready list in FIFO order. The wakeup message is set to @p RDY_RESET in order to make a chCondBroadcast() detectable from a chCondSignal().*/ while (cp->c_queue.p_next != (void *)&cp->c_queue) @@ -175,7 +175,7 @@ msg_t chCondWait(CondVar *cp) { * @sclass */ msg_t chCondWaitS(CondVar *cp) { - Thread *ctp = currp; + thread_t *ctp = currp; Mutex *mp; msg_t msg; diff --git a/os/kernel/src/chdebug.c b/os/kernel/src/chdebug.c index c69ce8f3f..44058dff8 100644 --- a/os/kernel/src/chdebug.c +++ b/os/kernel/src/chdebug.c @@ -232,7 +232,7 @@ void _trace_init(void) { * * @notapi */ -void dbg_trace(Thread *otp) { +void dbg_trace(thread_t *otp) { dbg_trace_buffer.tb_ptr->se_time = chTimeNow(); dbg_trace_buffer.tb_ptr->se_tp = currp; diff --git a/os/kernel/src/chdynamic.c b/os/kernel/src/chdynamic.c index 632367ca1..3d856a526 100644 --- a/os/kernel/src/chdynamic.c +++ b/os/kernel/src/chdynamic.c @@ -42,7 +42,7 @@ * * @api */ -Thread *chThdAddRef(Thread *tp) { +thread_t *chThdAddRef(thread_t *tp) { chSysLock(); chDbgAssert(tp->p_refs < 255, "chThdAddRef(), #1", "too many references"); @@ -64,7 +64,7 @@ Thread *chThdAddRef(Thread *tp) { * * @api */ -void chThdRelease(Thread *tp) { +void chThdRelease(thread_t *tp) { trefs_t refs; chSysLock(); @@ -114,16 +114,16 @@ void chThdRelease(Thread *tp) { * @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 + * @return The pointer to the @p thread_t structure allocated for * the thread into the working space area. * @retval NULL if the memory cannot be allocated. * * @api */ -Thread *chThdCreateFromHeap(MemoryHeap *heapp, size_t size, - tprio_t prio, tfunc_t pf, void *arg) { +thread_t *chThdCreateFromHeap(MemoryHeap *heapp, size_t size, + tprio_t prio, tfunc_t pf, void *arg) { void *wsp; - Thread *tp; + thread_t *tp; wsp = chHeapAlloc(heapp, size); if (wsp == NULL) @@ -131,9 +131,9 @@ Thread *chThdCreateFromHeap(MemoryHeap *heapp, size_t size, #if CH_DBG_FILL_THREADS _thread_memfill((uint8_t *)wsp, - (uint8_t *)wsp + sizeof(Thread), + (uint8_t *)wsp + sizeof(thread_t), CH_THREAD_FILL_VALUE); - _thread_memfill((uint8_t *)wsp + sizeof(Thread), + _thread_memfill((uint8_t *)wsp + sizeof(thread_t), (uint8_t *)wsp + size, CH_STACK_FILL_VALUE); #endif @@ -163,16 +163,16 @@ Thread *chThdCreateFromHeap(MemoryHeap *heapp, size_t size, * @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 + * @return The pointer to the @p thread_t structure allocated for * the thread into the working space area. * @retval NULL if the memory pool is empty. * * @api */ -Thread *chThdCreateFromMemoryPool(MemoryPool *mp, tprio_t prio, - tfunc_t pf, void *arg) { +thread_t *chThdCreateFromMemoryPool(MemoryPool *mp, tprio_t prio, + tfunc_t pf, void *arg) { void *wsp; - Thread *tp; + thread_t *tp; chDbgCheck(mp != NULL, "chThdCreateFromMemoryPool"); @@ -182,9 +182,9 @@ Thread *chThdCreateFromMemoryPool(MemoryPool *mp, tprio_t prio, #if CH_DBG_FILL_THREADS _thread_memfill((uint8_t *)wsp, - (uint8_t *)wsp + sizeof(Thread), + (uint8_t *)wsp + sizeof(thread_t), CH_THREAD_FILL_VALUE); - _thread_memfill((uint8_t *)wsp + sizeof(Thread), + _thread_memfill((uint8_t *)wsp + sizeof(thread_t), (uint8_t *)wsp + mp->mp_object_size, CH_STACK_FILL_VALUE); #endif diff --git a/os/kernel/src/chevents.c b/os/kernel/src/chevents.c index 1a2285779..0ff5bef73 100644 --- a/os/kernel/src/chevents.c +++ b/os/kernel/src/chevents.c @@ -28,8 +28,8 @@ * @addtogroup events * @details Event Flags, Event Sources and Event Listeners. *

Operation mode

- * Each thread has a mask of pending event flags inside its @p Thread - * structure. + * Each thread has a mask of pending event flags inside its + * @p thread_t structure. * Operations defined for event flags: * - Wait, the invoking thread goes to sleep until a certain * AND/OR combination of event flags becomes pending. @@ -54,7 +54,7 @@ * @pre In order to use the Events APIs the @p CH_USE_EVENTS option must be * enabled in @p chconf.h. * @post Enabling events requires 1-4 (depending on the architecture) - * extra bytes in the @p Thread structure. + * extra bytes in the @p thread_t structure. * @{ */ @@ -212,14 +212,14 @@ flagsmask_t chEvtGetAndClearFlags(EventListener *elp) { } /** - * @brief Adds a set of event flags directly to specified @p Thread. + * @brief Adds a set of event flags directly to the specified @p thread_t. * * @param[in] tp the thread to be signaled * @param[in] mask the event flags set to be ORed * * @api */ -void chEvtSignal(Thread *tp, eventmask_t mask) { +void chEvtSignal(thread_t *tp, eventmask_t mask) { chDbgCheck(tp != NULL, "chEvtSignal"); @@ -230,7 +230,7 @@ void chEvtSignal(Thread *tp, eventmask_t mask) { } /** - * @brief Adds a set of event flags directly to specified @p Thread. + * @brief Adds a set of event flags directly to the specified @p thread_t. * @post This function does not reschedule so a call to a rescheduling * function must be performed before unlocking the kernel. Note that * interrupt handlers always reschedule on exit so an explicit @@ -241,7 +241,7 @@ void chEvtSignal(Thread *tp, eventmask_t mask) { * * @iclass */ -void chEvtSignalI(Thread *tp, eventmask_t mask) { +void chEvtSignalI(thread_t *tp, eventmask_t mask) { chDbgCheckClassI(); chDbgCheck(tp != NULL, "chEvtSignalI"); @@ -341,7 +341,7 @@ void chEvtDispatch(const evhandler_t *handlers, eventmask_t mask) { * @api */ eventmask_t chEvtWaitOne(eventmask_t mask) { - Thread *ctp = currp; + thread_t *ctp = currp; eventmask_t m; chSysLock(); @@ -370,7 +370,7 @@ eventmask_t chEvtWaitOne(eventmask_t mask) { * @api */ eventmask_t chEvtWaitAny(eventmask_t mask) { - Thread *ctp = currp; + thread_t *ctp = currp; eventmask_t m; chSysLock(); @@ -398,7 +398,7 @@ eventmask_t chEvtWaitAny(eventmask_t mask) { * @api */ eventmask_t chEvtWaitAll(eventmask_t mask) { - Thread *ctp = currp; + thread_t *ctp = currp; chSysLock(); @@ -437,7 +437,7 @@ eventmask_t chEvtWaitAll(eventmask_t mask) { * @api */ eventmask_t chEvtWaitOneTimeout(eventmask_t mask, systime_t time) { - Thread *ctp = currp; + thread_t *ctp = currp; eventmask_t m; chSysLock(); @@ -480,7 +480,7 @@ eventmask_t chEvtWaitOneTimeout(eventmask_t mask, systime_t time) { * @api */ eventmask_t chEvtWaitAnyTimeout(eventmask_t mask, systime_t time) { - Thread *ctp = currp; + thread_t *ctp = currp; eventmask_t m; chSysLock(); @@ -521,7 +521,7 @@ eventmask_t chEvtWaitAnyTimeout(eventmask_t mask, systime_t time) { * @api */ eventmask_t chEvtWaitAllTimeout(eventmask_t mask, systime_t time) { - Thread *ctp = currp; + thread_t *ctp = currp; chSysLock(); diff --git a/os/kernel/src/chlists.c b/os/kernel/src/chlists.c index 9e9b276e6..241067ab4 100644 --- a/os/kernel/src/chlists.c +++ b/os/kernel/src/chlists.c @@ -65,15 +65,15 @@ * * @notapi */ -void queue_prio_insert(Thread *tp, threads_queue_t *tqp) { +void queue_prio_insert(thread_t *tp, threads_queue_t *tqp) { /* cp iterates over the queue.*/ - Thread *cp = (Thread *)tqp; + thread_t *cp = (thread_t *)tqp; do { /* Iterate to next thread in queue.*/ cp = cp->p_next; /* Not end of queue? and cp has equal or higher priority than tp?.*/ - } while ((cp != (Thread *)tqp) && (cp->p_prio >= tp->p_prio)); + } while ((cp != (thread_t *)tqp) && (cp->p_prio >= tp->p_prio)); /* Insertion on p_prev.*/ tp->p_next = cp; tp->p_prev = cp->p_prev; @@ -81,22 +81,22 @@ void queue_prio_insert(Thread *tp, threads_queue_t *tqp) { } /** - * @brief Inserts a Thread into a queue. + * @brief Inserts a thread into a 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 * * @notapi */ -void queue_insert(Thread *tp, threads_queue_t *tqp) { +void queue_insert(thread_t *tp, threads_queue_t *tqp) { - tp->p_next = (Thread *)tqp; + tp->p_next = (thread_t *)tqp; tp->p_prev = tqp->p_prev; tp->p_prev->p_next = tqp->p_prev = tp; } /** - * @brief Removes the first-out Thread from a queue and returns it. + * @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. * @@ -105,15 +105,15 @@ void queue_insert(Thread *tp, threads_queue_t *tqp) { * * @notapi */ -Thread *queue_fifo_remove(threads_queue_t *tqp) { - Thread *tp = tqp->p_next; +thread_t *queue_fifo_remove(threads_queue_t *tqp) { + thread_t *tp = tqp->p_next; - (tqp->p_next = tp->p_next)->p_prev = (Thread *)tqp; + (tqp->p_next = tp->p_next)->p_prev = (thread_t *)tqp; return tp; } /** - * @brief Removes the last-out Thread from a queue and returns it. + * @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. * @@ -122,15 +122,15 @@ Thread *queue_fifo_remove(threads_queue_t *tqp) { * * @notapi */ -Thread *queue_lifo_remove(threads_queue_t *tqp) { - Thread *tp = tqp->p_prev; +thread_t *queue_lifo_remove(threads_queue_t *tqp) { + thread_t *tp = tqp->p_prev; - (tqp->p_prev = tp->p_prev)->p_next = (Thread *)tqp; + (tqp->p_prev = tp->p_prev)->p_next = (thread_t *)tqp; return tp; } /** - * @brief Removes a Thread from a queue and returns it. + * @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. * @@ -139,7 +139,7 @@ Thread *queue_lifo_remove(threads_queue_t *tqp) { * * @notapi */ -Thread *queue_dequeue(Thread *tp) { +thread_t *queue_dequeue(thread_t *tp) { tp->p_prev->p_next = tp->p_next; tp->p_next->p_prev = tp->p_prev; @@ -147,21 +147,21 @@ Thread *queue_dequeue(Thread *tp) { } /** - * @brief Pushes a Thread on top of a stack list. + * @brief Pushes a thread_t on top of a stack list. * * @param[in] tp the pointer to the thread to be inserted in the list * @param[in] tlp the pointer to the threads list header * * @notapi */ -void list_insert(Thread *tp, threads_list_t *tlp) { +void list_insert(thread_t *tp, threads_list_t *tlp) { tp->p_next = tlp->p_next; tlp->p_next = tp; } /** - * @brief Pops a Thread from the top of a stack list and returns it. + * @brief Pops a thread from the top of a stack list and returns it. * @pre The list must be non-empty before calling this function. * * @param[in] tlp the pointer to the threads list header @@ -169,9 +169,9 @@ void list_insert(Thread *tp, threads_list_t *tlp) { * * @notapi */ -Thread *list_remove(threads_list_t *tlp) { +thread_t *list_remove(threads_list_t *tlp) { - Thread *tp = tlp->p_next; + thread_t *tp = tlp->p_next; tlp->p_next = tp->p_next; return tp; } diff --git a/os/kernel/src/chmsg.c b/os/kernel/src/chmsg.c index d27713ef0..50e489915 100644 --- a/os/kernel/src/chmsg.c +++ b/os/kernel/src/chmsg.c @@ -40,7 +40,7 @@ * @pre In order to use the message APIs the @p CH_USE_MESSAGES option * must be enabled in @p chconf.h. * @post Enabling messages requires 6-12 (depending on the architecture) - * extra bytes in the @p Thread structure. + * extra bytes in the @p thread_t structure. * @{ */ @@ -65,8 +65,8 @@ * * @api */ -msg_t chMsgSend(Thread *tp, msg_t msg) { - Thread *ctp = currp; +msg_t chMsgSend(thread_t *tp, msg_t msg) { + thread_t *ctp = currp; chDbgCheck(tp != NULL, "chMsgSend"); @@ -96,8 +96,8 @@ msg_t chMsgSend(Thread *tp, msg_t msg) { * * @api */ -Thread *chMsgWait(void) { - Thread *tp; +thread_t *chMsgWait(void) { + thread_t *tp; chSysLock(); if (!chMsgIsPendingI(currp)) @@ -118,7 +118,7 @@ Thread *chMsgWait(void) { * * @api */ -void chMsgRelease(Thread *tp, msg_t msg) { +void chMsgRelease(thread_t *tp, msg_t msg) { chSysLock(); chDbgAssert(tp->p_state == THD_STATE_SNDMSG, diff --git a/os/kernel/src/chmtx.c b/os/kernel/src/chmtx.c index 38ecbed74..f70dd9b20 100644 --- a/os/kernel/src/chmtx.c +++ b/os/kernel/src/chmtx.c @@ -61,7 +61,7 @@ * @pre In order to use the mutex APIs the @p CH_USE_MUTEXES option * must be enabled in @p chconf.h. * @post Enabling mutexes requires 5-12 (depending on the architecture) - * extra bytes in the @p Thread structure. + * extra bytes in the @p thread_t structure. * @{ */ @@ -112,7 +112,7 @@ void chMtxLock(Mutex *mp) { * @sclass */ void chMtxLockS(Mutex *mp) { - Thread *ctp = currp; + thread_t *ctp = currp; chDbgCheckClassS(); chDbgCheck(mp != NULL, "chMtxLockS"); @@ -122,7 +122,7 @@ void chMtxLockS(Mutex *mp) { /* Priority inheritance protocol; explores the thread-mutex dependencies boosting the priority of all the affected threads to equal the priority of the running thread requesting the mutex.*/ - Thread *tp = mp->m_owner; + thread_t *tp = mp->m_owner; /* Does the running thread have higher priority than the mutex owning thread? */ while (tp->p_prio < ctp->p_prio) { @@ -250,7 +250,7 @@ bool_t chMtxTryLockS(Mutex *mp) { * @api */ Mutex *chMtxUnlock(void) { - Thread *ctp = currp; + thread_t *ctp = currp; Mutex *ump, *mp; chSysLock(); @@ -260,13 +260,13 @@ Mutex *chMtxUnlock(void) { chDbgAssert(ctp->p_mtxlist->m_owner == ctp, "chMtxUnlock(), #2", "ownership failure"); - /* Removes the top Mutex from the Thread's owned mutexes list and marks it + /* Removes the top Mutex from the thread's owned mutexes list and marks it as not owned.*/ ump = ctp->p_mtxlist; ctp->p_mtxlist = ump->m_next; /* If a thread is waiting on the mutex then the fun part begins.*/ if (chMtxQueueNotEmptyS(ump)) { - Thread *tp; + thread_t *tp; /* Recalculates the optimal thread priority by scanning the owned mutexes list.*/ @@ -310,7 +310,7 @@ Mutex *chMtxUnlock(void) { * @sclass */ Mutex *chMtxUnlockS(void) { - Thread *ctp = currp; + thread_t *ctp = currp; Mutex *ump, *mp; chDbgCheckClassS(); @@ -327,7 +327,7 @@ Mutex *chMtxUnlockS(void) { ctp->p_mtxlist = ump->m_next; /* If a thread is waiting on the mutex then the fun part begins.*/ if (chMtxQueueNotEmptyS(ump)) { - Thread *tp; + thread_t *tp; /* Recalculates the optimal thread priority by scanning the owned mutexes list.*/ @@ -367,7 +367,7 @@ Mutex *chMtxUnlockS(void) { * @api */ void chMtxUnlockAll(void) { - Thread *ctp = currp; + thread_t *ctp = currp; chSysLock(); if (ctp->p_mtxlist != NULL) { @@ -375,7 +375,7 @@ void chMtxUnlockAll(void) { Mutex *ump = ctp->p_mtxlist; ctp->p_mtxlist = ump->m_next; if (chMtxQueueNotEmptyS(ump)) { - Thread *tp = queue_fifo_remove(&ump->m_queue); + thread_t *tp = queue_fifo_remove(&ump->m_queue); ump->m_owner = tp; ump->m_next = tp->p_mtxlist; tp->p_mtxlist = ump; diff --git a/os/kernel/src/chregistry.c b/os/kernel/src/chregistry.c index 645172833..d567393c1 100644 --- a/os/kernel/src/chregistry.c +++ b/os/kernel/src/chregistry.c @@ -65,31 +65,31 @@ ROMCONST chdebug_t ch_debug = { (CH_KERNEL_PATCH) << 0), (uint8_t)sizeof (void *), (uint8_t)sizeof (systime_t), - (uint8_t)sizeof (Thread), - (uint8_t)_offsetof(Thread, p_prio), - (uint8_t)_offsetof(Thread, p_ctx), - (uint8_t)_offsetof(Thread, p_newer), - (uint8_t)_offsetof(Thread, p_older), - (uint8_t)_offsetof(Thread, p_name), + (uint8_t)sizeof (thread_t), + (uint8_t)_offsetof(thread_t, p_prio), + (uint8_t)_offsetof(thread_t, p_ctx), + (uint8_t)_offsetof(thread_t, p_newer), + (uint8_t)_offsetof(thread_t, p_older), + (uint8_t)_offsetof(thread_t, p_name), #if CH_DBG_ENABLE_STACK_CHECK - (uint8_t)_offsetof(Thread, p_stklimit), + (uint8_t)_offsetof(thread_t, p_stklimit), #else (uint8_t)0, #endif - (uint8_t)_offsetof(Thread, p_state), - (uint8_t)_offsetof(Thread, p_flags), + (uint8_t)_offsetof(thread_t, p_state), + (uint8_t)_offsetof(thread_t, p_flags), #if CH_USE_DYNAMIC - (uint8_t)_offsetof(Thread, p_refs), + (uint8_t)_offsetof(thread_t, p_refs), #else (uint8_t)0, #endif #if CH_TIME_QUANTUM > 0 - (uint8_t)_offsetof(Thread, p_preempt), + (uint8_t)_offsetof(thread_t, p_preempt), #else (uint8_t)0, #endif #if CH_DBG_THREADS_PROFILING - (uint8_t)_offsetof(Thread, p_time) + (uint8_t)_offsetof(thread_t, p_time) #else (uint8_t)0 #endif @@ -107,8 +107,8 @@ ROMCONST chdebug_t ch_debug = { * * @api */ -Thread *chRegFirstThread(void) { - Thread *tp; +thread_t *chRegFirstThread(void) { + thread_t *tp; chSysLock(); tp = rlist.r_newer; @@ -130,12 +130,12 @@ Thread *chRegFirstThread(void) { * * @api */ -Thread *chRegNextThread(Thread *tp) { - Thread *ntp; +thread_t *chRegNextThread(thread_t *tp) { + thread_t *ntp; chSysLock(); ntp = tp->p_newer; - if (ntp == (Thread *)&rlist) + if (ntp == (thread_t *)&rlist) ntp = NULL; #if CH_USE_DYNAMIC else { diff --git a/os/kernel/src/chschd.c b/os/kernel/src/chschd.c index 1333fc400..b957a8152 100644 --- a/os/kernel/src/chschd.c +++ b/os/kernel/src/chschd.c @@ -68,7 +68,7 @@ void _scheduler_init(void) { queue_init(&rlist.r_queue); rlist.r_prio = NOPRIO; #if CH_USE_REGISTRY - rlist.r_newer = rlist.r_older = (Thread *)&rlist; + rlist.r_newer = rlist.r_older = (thread_t *)&rlist; #endif } @@ -88,8 +88,8 @@ void _scheduler_init(void) { * * @iclass */ -Thread *chSchReadyI(Thread *tp) { - Thread *cp; +thread_t *chSchReadyI(thread_t *tp) { + thread_t *cp; chDbgCheckClassI(); @@ -100,7 +100,7 @@ Thread *chSchReadyI(Thread *tp) { "invalid state"); tp->p_state = THD_STATE_READY; - cp = (Thread *)&rlist.r_queue; + cp = (thread_t *)&rlist.r_queue; do { cp = cp->p_next; } while (cp->p_prio >= tp->p_prio); @@ -121,7 +121,7 @@ Thread *chSchReadyI(Thread *tp) { * @sclass */ void chSchGoSleepS(tstate_t newstate) { - Thread *otp; + thread_t *otp; chDbgCheckClassS(); @@ -140,7 +140,7 @@ void chSchGoSleepS(tstate_t newstate) { * Timeout wakeup callback. */ static void wakeup(void *p) { - Thread *tp = (Thread *)p; + thread_t *tp = (thread_t *)p; chSysLockFromIsr(); switch (tp->p_state) { @@ -221,12 +221,12 @@ msg_t chSchGoSleepTimeoutS(tstate_t newstate, systime_t time) { * @note The function assumes that the current thread has the highest * priority. * - * @param[in] ntp the Thread to be made ready + * @param[in] ntp the thread to be made ready * @param[in] msg message to the awakened thread * * @sclass */ -void chSchWakeupS(Thread *ntp, msg_t msg) { +void chSchWakeupS(thread_t *ntp, msg_t msg) { chDbgCheckClassS(); @@ -238,7 +238,7 @@ void chSchWakeupS(Thread *ntp, msg_t msg) { if (ntp->p_prio <= currp->p_prio) chSchReadyI(ntp); else { - Thread *otp = chSchReadyI(currp); + thread_t *otp = chSchReadyI(currp); setcurrp(ntp); ntp->p_state = THD_STATE_CURRENT; chSysSwitch(ntp, otp); @@ -300,7 +300,7 @@ bool chSchIsPreemptionRequired(void) { * @special */ void chSchDoRescheduleBehind(void) { - Thread *otp; + thread_t *otp; otp = currp; /* Picks the first thread from the ready queue and makes it current.*/ @@ -323,7 +323,7 @@ void chSchDoRescheduleBehind(void) { * @special */ void chSchDoRescheduleAhead(void) { - Thread *otp, *cp; + thread_t *otp, *cp; otp = currp; /* Picks the first thread from the ready queue and makes it current.*/ @@ -331,7 +331,7 @@ void chSchDoRescheduleAhead(void) { currp->p_state = THD_STATE_CURRENT; otp->p_state = THD_STATE_READY; - cp = (Thread *)&rlist.r_queue; + cp = (thread_t *)&rlist.r_queue; do { cp = cp->p_next; } while (cp->p_prio > otp->p_prio); diff --git a/os/kernel/src/chsem.c b/os/kernel/src/chsem.c index c91264b9d..04e208e58 100644 --- a/os/kernel/src/chsem.c +++ b/os/kernel/src/chsem.c @@ -305,7 +305,7 @@ void chSemSignalI(Semaphore *sp) { if (++sp->s_cnt <= 0) { /* Note, it is done this way in order to allow a tail call on chSchReadyI().*/ - Thread *tp = queue_fifo_remove(&sp->s_queue); + thread_t *tp = queue_fifo_remove(&sp->s_queue); tp->p_u.rdymsg = RDY_OK; chSchReadyI(tp); } @@ -373,7 +373,7 @@ msg_t chSemSignalWait(Semaphore *sps, Semaphore *spw) { if (++sps->s_cnt <= 0) chSchReadyI(queue_fifo_remove(&sps->s_queue))->p_u.rdymsg = RDY_OK; if (--spw->s_cnt < 0) { - Thread *ctp = currp; + thread_t *ctp = currp; sem_insert(ctp, &spw->s_queue); ctp->p_u.wtobjp = spw; chSchGoSleepS(THD_STATE_WTSEM); diff --git a/os/kernel/src/chsys.c b/os/kernel/src/chsys.c index a6f1d15ba..f960d9b79 100644 --- a/os/kernel/src/chsys.c +++ b/os/kernel/src/chsys.c @@ -75,7 +75,7 @@ void _idle_thread(void *p) { * @special */ void chSysInit(void) { - static Thread mainthread; + static thread_t mainthread; #if CH_DBG_ENABLE_STACK_CHECK extern stkalign_t __main_thread_stack_base__; #endif @@ -97,7 +97,7 @@ void chSysInit(void) { setcurrp(_thread_init(&mainthread, NORMALPRIO)); currp->p_state = THD_STATE_CURRENT; #if CH_DBG_ENABLE_STACK_CHECK - /* This is a special case because the main thread Thread structure is not + /* This is a special case because the main thread thread_t structure is not adjacent to its stack area.*/ currp->p_stklimit = &__main_thread_stack_base__; #endif diff --git a/os/kernel/src/chthreads.c b/os/kernel/src/chthreads.c index 9f176c6a0..bc161ba52 100644 --- a/os/kernel/src/chthreads.c +++ b/os/kernel/src/chthreads.c @@ -90,7 +90,7 @@ * * @notapi */ -Thread *_thread_init(Thread *tp, tprio_t prio) { +thread_t *_thread_init(thread_t *tp, tprio_t prio) { tp->p_prio = prio; tp->p_state = THD_STATE_SUSPENDED; @@ -166,15 +166,16 @@ void _thread_memfill(uint8_t *startp, uint8_t *endp, uint8_t v) { * @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 + * @return The pointer to the @p thread_t structure allocated for * the thread into the working space area. * * @iclass */ -Thread *chThdCreateI(void *wsp, size_t size, +thread_t *chThdCreateI(void *wsp, size_t size, tprio_t prio, tfunc_t pf, void *arg) { - /* Thread structure is laid out in the lower part of the thread workspace.*/ - Thread *tp = wsp; + /* The thread structure is laid out in the lower part of the thread + workspace.*/ + thread_t *tp = wsp; chDbgCheckClassI(); @@ -196,20 +197,20 @@ Thread *chThdCreateI(void *wsp, size_t size, * @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 + * @return The pointer to the @p thread_t structure allocated for * the thread into the working space area. * * @api */ -Thread *chThdCreateStatic(void *wsp, size_t size, - tprio_t prio, tfunc_t pf, void *arg) { - Thread *tp; +thread_t *chThdCreateStatic(void *wsp, size_t size, + tprio_t prio, tfunc_t pf, void *arg) { + thread_t *tp; #if CH_DBG_FILL_THREADS _thread_memfill((uint8_t *)wsp, - (uint8_t *)wsp + sizeof(Thread), + (uint8_t *)wsp + sizeof(thread_t), CH_THREAD_FILL_VALUE); - _thread_memfill((uint8_t *)wsp + sizeof(Thread), + _thread_memfill((uint8_t *)wsp + sizeof(thread_t), (uint8_t *)wsp + size, CH_STACK_FILL_VALUE); #endif @@ -264,7 +265,7 @@ tprio_t chThdSetPriority(tprio_t newprio) { * * @api */ -Thread *chThdResume(Thread *tp) { +thread_t *chThdResume(thread_t *tp) { chSysLock(); chDbgAssert(tp->p_state == THD_STATE_SUSPENDED, @@ -287,7 +288,7 @@ Thread *chThdResume(Thread *tp) { * * @api */ -void chThdTerminate(Thread *tp) { +void chThdTerminate(thread_t *tp) { chSysLock(); tp->p_flags |= THD_TERMINATE; @@ -381,7 +382,7 @@ void chThdExit(msg_t msg) { * @sclass */ void chThdExitS(msg_t msg) { - Thread *tp = currp; + thread_t *tp = currp; tp->p_u.exitcode = msg; #if defined(THREAD_EXT_EXIT_HOOK) @@ -423,7 +424,7 @@ void chThdExitS(msg_t msg) { * @pre The configuration option @p CH_USE_WAITEXIT must be enabled in * order to use this function. * @post Enabling @p chThdWait() requires 2-4 (depending on the - * architecture) extra bytes in the @p Thread structure. + * architecture) extra bytes in the @p thread_t structure. * @post After invoking @p chThdWait() the thread pointer becomes invalid * and must not be used as parameter for further system calls. * @note If @p CH_USE_DYNAMIC is not specified this function just waits for @@ -434,7 +435,7 @@ void chThdExitS(msg_t msg) { * * @api */ -msg_t chThdWait(Thread *tp) { +msg_t chThdWait(thread_t *tp) { msg_t msg; chDbgCheck(tp != NULL, "chThdWait"); -- cgit v1.2.3