aboutsummaryrefslogtreecommitdiffstats
path: root/os/kernel/include
diff options
context:
space:
mode:
Diffstat (limited to 'os/kernel/include')
-rw-r--r--os/kernel/include/ch.h2
-rw-r--r--os/kernel/include/chdebug.h4
-rw-r--r--os/kernel/include/chdynamic.h12
-rw-r--r--os/kernel/include/chevents.h6
-rw-r--r--os/kernel/include/chlists.h52
-rw-r--r--os/kernel/include/chmsg.h8
-rw-r--r--os/kernel/include/chmtx.h2
-rw-r--r--os/kernel/include/chregistry.h8
-rw-r--r--os/kernel/include/chschd.h12
-rw-r--r--os/kernel/include/chthreads.h43
10 files changed, 73 insertions, 76 deletions
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
}