From 84e044f176cee7c6946b24c36c90f63534b5b369 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Fri, 19 Jul 2013 12:22:31 +0000 Subject: [PATCH] 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 --- demos/ARMCM4-STM32F303-DISCOVERY/chconf.h | 4 +- os/kernel/include/ch.h | 2 +- os/kernel/include/chdebug.h | 4 +- os/kernel/include/chdynamic.h | 12 +++--- os/kernel/include/chevents.h | 6 +-- os/kernel/include/chlists.h | 52 +++++++++++------------ os/kernel/include/chmsg.h | 8 ++-- os/kernel/include/chmtx.h | 2 +- os/kernel/include/chregistry.h | 8 ++-- os/kernel/include/chschd.h | 12 +++--- os/kernel/include/chthreads.h | 43 +++++++++---------- 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 +++++++------- os/kernel/templates/chconf.h | 4 +- os/kernel/templates/chcore.c | 2 +- os/kernel/templates/chcore.h | 6 +-- os/ports/GCC/ARMCMx/chcore_v7m.c | 2 +- os/ports/GCC/ARMCMx/chcore_v7m.h | 6 +-- test/test.c | 2 +- test/test.h | 2 +- test/testbmk.c | 12 +++--- test/testdyn.c | 6 +-- test/testevt.c | 2 +- test/testmsg.c | 2 +- 34 files changed, 215 insertions(+), 217 deletions(-) diff --git a/demos/ARMCM4-STM32F303-DISCOVERY/chconf.h b/demos/ARMCM4-STM32F303-DISCOVERY/chconf.h index f943ea80c..7b8a8389b 100644 --- a/demos/ARMCM4-STM32F303-DISCOVERY/chconf.h +++ b/demos/ARMCM4-STM32F303-DISCOVERY/chconf.h @@ -422,7 +422,7 @@ /** * @brief Debug option, threads profiling. - * @details If enabled then a field is added to the @p Thread structure that + * @details If enabled then a field is added to the @p thread_t structure that * counts the system ticks occurred while executing the thread. * * @note The default is @p TRUE. @@ -444,7 +444,7 @@ /** * @brief Threads descriptor structure extension. - * @details User fields added to the end of the @p Thread structure. + * @details User fields added to the end of the @p thread_t structure. */ #if !defined(THREAD_EXT_FIELDS) || defined(__DOXYGEN__) #define THREAD_EXT_FIELDS \ diff --git a/os/kernel/include/ch.h b/os/kernel/include/ch.h index 0b5cea586..1237a3ae9 100644 --- a/os/kernel/include/ch.h +++ b/os/kernel/include/ch.h @@ -102,7 +102,7 @@ /* Forward declaration of the thread structure, it is used in most modules.*/ -typedef struct Thread Thread; +typedef struct thread thread_t; /* Inclusion of all the kernel sub-headers.*/ #include "chconf.h" diff --git a/os/kernel/include/chdebug.h b/os/kernel/include/chdebug.h index 4a75474e2..33363cbca 100644 --- a/os/kernel/include/chdebug.h +++ b/os/kernel/include/chdebug.h @@ -105,7 +105,7 @@ */ typedef struct { systime_t se_time; /**< @brief Time of the switch event. */ - Thread *se_tp; /**< @brief Switched in thread. */ + thread_t *se_tp; /**< @brief Switched in thread. */ void *se_wtobjp; /**< @brief Object where going to sleep.*/ uint8_t se_state; /**< @brief Switched out thread state. */ } ch_swc_event_t; @@ -232,7 +232,7 @@ extern "C" { #endif #if CH_DBG_ENABLE_TRACE || defined(__DOXYGEN__) void _trace_init(void); - void dbg_trace(Thread *otp); + void dbg_trace(thread_t *otp); #endif #if CH_DBG_ENABLED extern const char *dbg_panic_msg; diff --git a/os/kernel/include/chdynamic.h b/os/kernel/include/chdynamic.h index 3ac79a5f4..d28909aca 100644 --- a/os/kernel/include/chdynamic.h +++ b/os/kernel/include/chdynamic.h @@ -47,15 +47,15 @@ #ifdef __cplusplus extern "C" { #endif - Thread *chThdAddRef(Thread *tp); - void chThdRelease(Thread *tp); + thread_t *chThdAddRef(thread_t *tp); + void chThdRelease(thread_t *tp); #if CH_USE_HEAP - 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); #endif #if CH_USE_MEMPOOLS - 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); #endif #ifdef __cplusplus } diff --git a/os/kernel/include/chevents.h b/os/kernel/include/chevents.h index ec5c1cb93..87996353b 100644 --- a/os/kernel/include/chevents.h +++ b/os/kernel/include/chevents.h @@ -43,7 +43,7 @@ struct EventListener { EventListener *el_next; /**< @brief Next Event Listener registered on the Event Source. */ - Thread *el_listener; /**< @brief Thread interested in the + thread_t *el_listener; /**< @brief Thread interested in the Event Source. */ eventmask_t el_mask; /**< @brief Event flags mask associated by the thread to the Event @@ -173,8 +173,8 @@ extern "C" { eventmask_t chEvtAddEvents(eventmask_t mask); flagsmask_t chEvtGetAndClearFlags(EventListener *elp); flagsmask_t chEvtGetAndClearFlagsI(EventListener *elp); - void chEvtSignal(Thread *tp, eventmask_t mask); - void chEvtSignalI(Thread *tp, eventmask_t mask); + void chEvtSignal(thread_t *tp, eventmask_t mask); + void chEvtSignalI(thread_t *tp, eventmask_t mask); void chEvtBroadcastFlags(EventSource *esp, flagsmask_t flags); void chEvtBroadcastFlagsI(EventSource *esp, flagsmask_t flags); void chEvtDispatch(const evhandler_t *handlers, eventmask_t mask); diff --git a/os/kernel/include/chlists.h b/os/kernel/include/chlists.h index ec5bd4c9c..83552040a 100644 --- a/os/kernel/include/chlists.h +++ b/os/kernel/include/chlists.h @@ -56,7 +56,7 @@ * * @param[in] name the name of the threads queue variable */ -#define _threads_queue_t_DATA(name) {(Thread *)&name, (Thread *)&name} +#define _threads_queue_t_DATA(name) {(thread_t *)&name, (thread_t *)&name} /** * @brief Static threads queue initializer. @@ -83,7 +83,7 @@ */ static inline void list_init(threads_list_t *tlp) { - tlp->p_next = (Thread *)tlp; + tlp->p_next = (thread_t *)tlp; } /** @@ -91,9 +91,9 @@ static inline void list_init(threads_list_t *tlp) { * * @notapi */ -static inline bool_t list_isempty(threads_list_t *tlp) { +static inline bool list_isempty(threads_list_t *tlp) { - return (bool_t)(tlp->p_next == (Thread *)tlp); + return (bool)(tlp->p_next == (thread_t *)tlp); } /** @@ -101,9 +101,9 @@ static inline bool_t list_isempty(threads_list_t *tlp) { * * @notapi */ -static inline bool_t list_notempty(threads_list_t *tlp) { +static inline bool list_notempty(threads_list_t *tlp) { - return (bool_t)(tlp->p_next != (Thread *)tlp); + return (bool)(tlp->p_next != (thread_t *)tlp); } /** @@ -113,7 +113,7 @@ static inline bool_t list_notempty(threads_list_t *tlp) { */ static inline void queue_init(threads_queue_t *tqp) { - tqp->p_next = tqp->p_prev = (Thread *)tqp; + tqp->p_next = tqp->p_prev = (thread_t *)tqp; } /** @@ -121,9 +121,9 @@ static inline void queue_init(threads_queue_t *tqp) { * * @notapi */ -static inline bool_t queue_isempty(threads_queue_t *tqp) { +static inline bool queue_isempty(threads_queue_t *tqp) { - return (bool_t)(tqp->p_next == (Thread *)tqp); + return (bool)(tqp->p_next == (thread_t *)tqp); } /** @@ -131,60 +131,60 @@ static inline bool_t queue_isempty(threads_queue_t *tqp) { * * @notapi */ -static inline bool_t queue_notempty(threads_queue_t *tqp) { +static inline bool queue_notempty(threads_queue_t *tqp) { - return (bool_t)(tqp->p_next != (Thread *)tqp); + return (bool)(tqp->p_next != (thread_t *)tqp); } /* If the performance code path has been chosen then all the following functions are inlined into the various kernel modules.*/ #if CH_OPTIMIZE_SPEED -static inline void list_insert(Thread *tp, threads_list_t *tlp) { +static inline void list_insert(thread_t *tp, threads_list_t *tlp) { tp->p_next = tlp->p_next; tlp->p_next = tp; } -static inline Thread *list_remove(threads_list_t *tlp) { +static inline 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; } -static inline void queue_prio_insert(Thread *tp, threads_queue_t *tqp) { +static inline void queue_prio_insert(thread_t *tp, threads_queue_t *tqp) { - Thread *cp = (Thread *)tqp; + thread_t *cp = (thread_t *)tqp; do { cp = cp->p_next; - } while ((cp != (Thread *)tqp) && (cp->p_prio >= tp->p_prio)); + } while ((cp != (thread_t *)tqp) && (cp->p_prio >= tp->p_prio)); tp->p_next = cp; tp->p_prev = cp->p_prev; tp->p_prev->p_next = cp->p_prev = tp; } -static inline void queue_insert(Thread *tp, threads_queue_t *tqp) { +static inline 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; } -static inline Thread *queue_fifo_remove(threads_queue_t *tqp) { - Thread *tp = tqp->p_next; +static inline 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; } -static inline Thread *queue_lifo_remove(threads_queue_t *tqp) { - Thread *tp = tqp->p_prev; +static inline 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; } -static inline Thread *queue_dequeue(Thread *tp) { +static inline thread_t *queue_dequeue(thread_t *tp) { tp->p_prev->p_next = tp->p_next; tp->p_next->p_prev = tp->p_prev; diff --git a/os/kernel/include/chmsg.h b/os/kernel/include/chmsg.h index e613a6aad..be3103db9 100644 --- a/os/kernel/include/chmsg.h +++ b/os/kernel/include/chmsg.h @@ -41,7 +41,7 @@ * @iclass */ #define chMsgIsPendingI(tp) \ - ((tp)->p_msgqueue.p_next != (Thread *)&(tp)->p_msgqueue) + ((tp)->p_msgqueue.p_next != (thread_t *)&(tp)->p_msgqueue) /** * @brief Returns the message carried by the specified thread. @@ -71,9 +71,9 @@ #ifdef __cplusplus extern "C" { #endif - msg_t chMsgSend(Thread *tp, msg_t msg); - Thread * chMsgWait(void); - void chMsgRelease(Thread *tp, msg_t msg); + msg_t chMsgSend(thread_t *tp, msg_t msg); + thread_t * chMsgWait(void); + void chMsgRelease(thread_t *tp, msg_t msg); #ifdef __cplusplus } #endif diff --git a/os/kernel/include/chmtx.h b/os/kernel/include/chmtx.h index 2d271153a..bc0057e80 100644 --- a/os/kernel/include/chmtx.h +++ b/os/kernel/include/chmtx.h @@ -37,7 +37,7 @@ typedef struct Mutex { threads_queue_t m_queue; /**< @brief Queue of the threads sleeping on this Mutex. */ - Thread *m_owner; /**< @brief Owner @p Thread pointer or + thread_t *m_owner; /**< @brief Owner @p thread_t pointer or @p NULL. */ struct Mutex *m_next; /**< @brief Next @p Mutex into an owner-list or @p NULL. */ diff --git a/os/kernel/include/chregistry.h b/os/kernel/include/chregistry.h index 446de7aca..552e9d598 100644 --- a/os/kernel/include/chregistry.h +++ b/os/kernel/include/chregistry.h @@ -41,7 +41,7 @@ typedef struct { uint16_t ch_version; /**< @brief Encoded ChibiOS/RT version. */ uint8_t ch_ptrsize; /**< @brief Size of a pointer. */ uint8_t ch_timesize; /**< @brief Size of a @p systime_t. */ - uint8_t ch_threadsize; /**< @brief Size of a @p Thread struct. */ + uint8_t ch_threadsize; /**< @brief Size of a @p thread_t. */ uint8_t cf_off_prio; /**< @brief Offset of @p p_prio field. */ uint8_t cf_off_ctx; /**< @brief Offset of @p p_ctx field. */ uint8_t cf_off_newer; /**< @brief Offset of @p p_newer field. */ @@ -108,7 +108,7 @@ typedef struct { * @param[in] tp thread to add to the registry */ #define REG_INSERT(tp) { \ - (tp)->p_newer = (Thread *)&rlist; \ + (tp)->p_newer = (thread_t *)&rlist; \ (tp)->p_older = rlist.r_older; \ (tp)->p_older->p_newer = rlist.r_older = (tp); \ } @@ -117,8 +117,8 @@ typedef struct { extern "C" { #endif extern ROMCONST chdebug_t ch_debug; - Thread *chRegFirstThread(void); - Thread *chRegNextThread(Thread *tp); + thread_t *chRegFirstThread(void); + thread_t *chRegNextThread(thread_t *tp); #ifdef __cplusplus } #endif diff --git a/os/kernel/include/chschd.h b/os/kernel/include/chschd.h index 574c9c2fa..619800362 100644 --- a/os/kernel/include/chschd.h +++ b/os/kernel/include/chschd.h @@ -99,11 +99,11 @@ typedef struct { struct context r_ctx; /**< @brief Not used, present because offsets. */ #if CH_USE_REGISTRY || defined(__DOXYGEN__) - Thread *r_newer; /**< @brief Newer registry element. */ - Thread *r_older; /**< @brief Older registry element. */ + thread_t *r_newer; /**< @brief Newer registry element. */ + thread_t *r_older; /**< @brief Older registry element. */ #endif - /* End of the fields shared with the Thread structure.*/ - Thread *r_current; /**< @brief The currently running + /* End of the fields shared with the thread_t structure.*/ + thread_t *r_current; /**< @brief The currently running thread. */ } ready_list_t; @@ -151,10 +151,10 @@ extern ready_list_t rlist; extern "C" { #endif void _scheduler_init(void); - Thread *chSchReadyI(Thread *tp); + thread_t *chSchReadyI(thread_t *tp); void chSchGoSleepS(tstate_t newstate); msg_t chSchGoSleepTimeoutS(tstate_t newstate, systime_t time); - void chSchWakeupS(Thread *tp, msg_t msg); + void chSchWakeupS(thread_t *tp, msg_t msg); void chSchRescheduleS(void); bool chSchIsPreemptionRequired(void); void chSchDoRescheduleBehind(void); diff --git a/os/kernel/include/chthreads.h b/os/kernel/include/chthreads.h index 95fd5c4d8..452ffd37d 100644 --- a/os/kernel/include/chthreads.h +++ b/os/kernel/include/chthreads.h @@ -103,7 +103,7 @@ typedef struct Mutex Mutex; */ typedef struct { - Thread *p_next; /**< @brief Next in the list/queue. */ + thread_t *p_next; /**< @brief Next in the list/queue. */ } threads_list_t; /** @@ -112,8 +112,8 @@ typedef struct { * @brief Generic threads bidirectional linked list header and element. */ typedef struct { - Thread *p_next; /**< @brief Next in the list/queue. */ - Thread *p_prev; /**< @brief Previous in the queue. */ + thread_t *p_next; /**< @brief Next in the list/queue. */ + thread_t *p_prev; /**< @brief Previous in the queue. */ } threads_queue_t; /** @@ -122,18 +122,18 @@ typedef struct { * @brief Structure representing a thread. * @note Not all the listed fields are always needed, by switching off some * not needed ChibiOS/RT subsystems it is possible to save RAM space - * by shrinking the @p Thread structure. + * by shrinking the @p thread_t structure. */ -typedef struct Thread { - Thread *p_next; /**< @brief Next in the list/queue. */ +typedef struct thread { + thread_t *p_next; /**< @brief Next in the list/queue. */ /* End of the fields shared with the threads_list_t structure.*/ - Thread *p_prev; /**< @brief Previous in the queue. */ + thread_t *p_prev; /**< @brief Previous in the queue. */ /* End of the fields shared with the threads_queue_t structure.*/ tprio_t p_prio; /**< @brief Thread priority. */ struct context p_ctx; /**< @brief Processor context. */ #if CH_USE_REGISTRY || defined(__DOXYGEN__) - Thread *p_newer; /**< @brief Newer registry element. */ - Thread *p_older; /**< @brief Older registry element. */ + thread_t *p_newer; /**< @brief Newer registry element. */ + thread_t *p_older; /**< @brief Older registry element. */ #endif /* End of the fields shared with the ReadyList structure. */ #if CH_USE_REGISTRY || defined(__DOXYGEN__) @@ -254,10 +254,10 @@ typedef struct Thread { /* Extra fields defined in chconf.h.*/ THREAD_EXT_FIELDS #endif -} Thread; +} thread_t; /** - * @brief Thread function. + * @brief Thread function. */ typedef msg_t (*tfunc_t)(void *); @@ -270,7 +270,7 @@ typedef msg_t (*tfunc_t)(void *); * @{ */ /** - * @brief Returns a pointer to the current @p Thread. + * @brief Returns a pointer to the current @p thread_t. * @note Can be invoked in any context. * * @special @@ -386,30 +386,27 @@ typedef msg_t (*tfunc_t)(void *); /* External declarations. */ /*===========================================================================*/ -/* - * Threads APIs. - */ #ifdef __cplusplus extern "C" { #endif - Thread *_thread_init(Thread *tp, tprio_t prio); + thread_t *_thread_init(thread_t *tp, tprio_t prio); #if CH_DBG_FILL_THREADS void _thread_memfill(uint8_t *startp, uint8_t *endp, uint8_t v); #endif - Thread *chThdCreateI(void *wsp, size_t size, - tprio_t prio, tfunc_t pf, void *arg); - Thread *chThdCreateStatic(void *wsp, size_t size, - tprio_t prio, tfunc_t pf, void *arg); + thread_t *chThdCreateI(void *wsp, size_t size, + tprio_t prio, tfunc_t pf, void *arg); + thread_t *chThdCreateStatic(void *wsp, size_t size, + tprio_t prio, tfunc_t pf, void *arg); tprio_t chThdSetPriority(tprio_t newprio); - Thread *chThdResume(Thread *tp); - void chThdTerminate(Thread *tp); + thread_t *chThdResume(thread_t *tp); + void chThdTerminate(thread_t *tp); void chThdSleep(systime_t time); void chThdSleepUntil(systime_t time); void chThdYield(void); void chThdExit(msg_t msg); void chThdExitS(msg_t msg); #if CH_USE_WAITEXIT - msg_t chThdWait(Thread *tp); + msg_t chThdWait(thread_t *tp); #endif #ifdef __cplusplus } 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"); diff --git a/os/kernel/templates/chconf.h b/os/kernel/templates/chconf.h index ae54d3edf..1e570c3cc 100644 --- a/os/kernel/templates/chconf.h +++ b/os/kernel/templates/chconf.h @@ -426,7 +426,7 @@ /** * @brief Debug option, threads profiling. - * @details If enabled then a field is added to the @p Thread structure that + * @details If enabled then a field is added to the @p thread_t structure that * counts the system ticks occurred while executing the thread. * * @note The default is @p TRUE. @@ -448,7 +448,7 @@ /** * @brief Threads descriptor structure extension. - * @details User fields added to the end of the @p Thread structure. + * @details User fields added to the end of the @p thread_t structure. */ #if !defined(THREAD_EXT_FIELDS) || defined(__DOXYGEN__) #define THREAD_EXT_FIELDS \ diff --git a/os/kernel/templates/chcore.c b/os/kernel/templates/chcore.c index 7639d9dd7..1f7db903c 100644 --- a/os/kernel/templates/chcore.c +++ b/os/kernel/templates/chcore.c @@ -128,7 +128,7 @@ void port_halt(void) { * @param[in] ntp the thread to be switched in * @param[in] otp the thread to be switched out */ -void port_switch(Thread *ntp, Thread *otp) { +void port_switch(thread_t *ntp, thread_t *otp) { } /** @} */ diff --git a/os/kernel/templates/chcore.h b/os/kernel/templates/chcore.h index f73b3b0c8..c993c724e 100644 --- a/os/kernel/templates/chcore.h +++ b/os/kernel/templates/chcore.h @@ -124,7 +124,7 @@ struct intctx { }; /** - * @brief Platform dependent part of the @p Thread structure. + * @brief Platform dependent part of the @p thread_t structure. * @details This structure usually contains just the saved stack pointer * defined as a pointer to a @p intctx structure. */ @@ -148,7 +148,7 @@ struct context { /** * @brief Computes the thread working area global size. */ -#define THD_WA_SIZE(n) STACK_ALIGN(sizeof(Thread) + \ +#define THD_WA_SIZE(n) STACK_ALIGN(sizeof(thread_t) + \ sizeof(struct intctx) + \ sizeof(struct extctx) + \ (n) + (PORT_INT_REQUIRED_STACK)) @@ -203,7 +203,7 @@ extern "C" { void port_enable(void); void port_wait_for_interrupt(void); void port_halt(void); - void port_switch(Thread *ntp, Thread *otp); + void port_switch(thread_t *ntp, thread_t *otp); #ifdef __cplusplus } #endif diff --git a/os/ports/GCC/ARMCMx/chcore_v7m.c b/os/ports/GCC/ARMCMx/chcore_v7m.c index ad92a9f07..be6888ce5 100644 --- a/os/ports/GCC/ARMCMx/chcore_v7m.c +++ b/os/ports/GCC/ARMCMx/chcore_v7m.c @@ -226,7 +226,7 @@ void _port_switch_from_isr(void) { #if !defined(__DOXYGEN__) __attribute__((naked)) #endif -void _port_switch(Thread *ntp, Thread *otp) { +void _port_switch(thread_t *ntp, thread_t *otp) { asm volatile ("push {r4, r5, r6, r7, r8, r9, r10, r11, lr}" : : : "memory"); diff --git a/os/ports/GCC/ARMCMx/chcore_v7m.h b/os/ports/GCC/ARMCMx/chcore_v7m.h index 86921ee64..2d99db7a0 100644 --- a/os/ports/GCC/ARMCMx/chcore_v7m.h +++ b/os/ports/GCC/ARMCMx/chcore_v7m.h @@ -291,7 +291,7 @@ struct intctx { #endif /* !defined(__DOXYGEN__) */ /** - * @brief Platform dependent part of the @p Thread structure. + * @brief Platform dependent part of the @p thread_t structure. * @details In this port the structure just holds a pointer to the @p intctx * structure representing the stack pointer at context switch time. */ @@ -321,7 +321,7 @@ struct context { /** * @brief Computes the thread working area global size. */ -#define THD_WA_SIZE(n) STACK_ALIGN(sizeof(Thread) + \ +#define THD_WA_SIZE(n) STACK_ALIGN(sizeof(thread_t) + \ sizeof(struct intctx) + \ sizeof(struct extctx) + \ (n) + (PORT_INT_REQUIRED_STACK)) @@ -508,7 +508,7 @@ extern "C" { void _port_irq_epilogue(void); void _port_switch_from_isr(void); void _port_exit_from_isr(void); - void _port_switch(Thread *ntp, Thread *otp); + void _port_switch(thread_t *ntp, thread_t *otp); void _port_thread_start(void); #if !CH_OPTIMIZE_SPEED void _port_lock(void); diff --git a/test/test.c b/test/test.c index b7c92ceaf..86e53499b 100644 --- a/test/test.c +++ b/test/test.c @@ -70,7 +70,7 @@ union test_buffers test; /* * Pointers to the spawned threads. */ -Thread *threads[MAX_THREADS]; +thread_t *threads[MAX_THREADS]; /* * Pointers to the working areas. diff --git a/test/test.h b/test/test.h index fbdfa27f0..136631d8f 100644 --- a/test/test.h +++ b/test/test.h @@ -162,7 +162,7 @@ extern "C" { } #if !defined(__DOXYGEN__) -extern Thread *threads[MAX_THREADS]; +extern thread_t *threads[MAX_THREADS]; extern union test_buffers test; extern void * ROMCONST wa[]; extern bool_t test_timer_done; diff --git a/test/testbmk.c b/test/testbmk.c index 1ed9f1409..e2f0df833 100644 --- a/test/testbmk.c +++ b/test/testbmk.c @@ -62,7 +62,7 @@ static Mutex mtx1; #endif static msg_t thread1(void *p) { - Thread *tp; + thread_t *tp; msg_t msg; (void)p; @@ -77,7 +77,7 @@ static msg_t thread1(void *p) { #ifdef __GNUC__ __attribute__((noinline)) #endif -static unsigned int msg_loop_test(Thread *tp) { +static unsigned int msg_loop_test(thread_t *tp) { uint32_t n = 0; test_wait_tick(); @@ -202,7 +202,7 @@ ROMCONST struct testcase testbmk3 = { msg_t thread4(void *p) { msg_t msg; - Thread *self = chThdSelf(); + thread_t *self = chThdSelf(); (void)p; chSysLock(); @@ -215,7 +215,7 @@ msg_t thread4(void *p) { } static void bmk4_execute(void) { - Thread *tp; + thread_t *tp; uint32_t n; tp = threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriority()+1, thread4, NULL); @@ -635,12 +635,12 @@ static void bmk13_execute(void) { test_print("--- System: "); test_printn(sizeof(ready_list_t) + sizeof(VTList) + PORT_IDLE_THREAD_STACK_SIZE + - (sizeof(Thread) + sizeof(struct intctx) + + (sizeof(thread_t) + sizeof(struct intctx) + sizeof(struct extctx) + PORT_INT_REQUIRED_STACK) * 2); test_println(" bytes"); test_print("--- Thread: "); - test_printn(sizeof(Thread)); + test_printn(sizeof(thread_t)); test_println(" bytes"); test_print("--- Timer : "); test_printn(sizeof(VirtualTimer)); diff --git a/test/testdyn.c b/test/testdyn.c index 8e54c81a1..ebfb00a4b 100644 --- a/test/testdyn.c +++ b/test/testdyn.c @@ -188,8 +188,8 @@ ROMCONST struct testcase testdyn2 = { * coverage. */ -static bool_t regfind(Thread *tp) { - Thread *ftp; +static bool_t regfind(thread_t *tp) { + thread_t *ftp; bool_t found = FALSE; ftp = chRegFirstThread(); @@ -206,7 +206,7 @@ static void dyn3_setup(void) { } static void dyn3_execute(void) { - Thread *tp; + thread_t *tp; tprio_t prio = chThdGetPriority(); /* Testing references increase/decrease and final detach.*/ diff --git a/test/testevt.c b/test/testevt.c index d1291c406..5daa7f1e3 100644 --- a/test/testevt.c +++ b/test/testevt.c @@ -133,7 +133,7 @@ static void evt2_setup(void) { static msg_t thread1(void *p) { chThdSleepMilliseconds(50); - chEvtSignal((Thread *)p, 1); + chEvtSignal((thread_t *)p, 1); return 0; } diff --git a/test/testmsg.c b/test/testmsg.c index 3ffaa6bf7..7a1ef1175 100644 --- a/test/testmsg.c +++ b/test/testmsg.c @@ -65,7 +65,7 @@ static msg_t thread(void *p) { } static void msg1_execute(void) { - Thread *tp; + thread_t *tp; msg_t msg; /*