aboutsummaryrefslogtreecommitdiffstats
path: root/src/include
diff options
context:
space:
mode:
Diffstat (limited to 'src/include')
-rw-r--r--src/include/ch.h3
-rw-r--r--src/include/debug.h8
-rw-r--r--src/include/delta.h12
-rw-r--r--src/include/events.h18
-rw-r--r--src/include/messages.h14
-rw-r--r--src/include/mutexes.h4
-rw-r--r--src/include/queues.h36
-rw-r--r--src/include/scheduler.h16
-rw-r--r--src/include/semaphores.h16
-rw-r--r--src/include/serial.h26
-rw-r--r--src/include/sleep.h4
-rw-r--r--src/include/threads.h34
12 files changed, 92 insertions, 99 deletions
diff --git a/src/include/ch.h b/src/include/ch.h
index 52d3dd772..4f729a450 100644
--- a/src/include/ch.h
+++ b/src/include/ch.h
@@ -100,9 +100,6 @@
#ifndef TRUE
#define TRUE 1
#endif
-#ifndef NULL
-#define NULL 0
-#endif
#ifdef __cplusplus
extern "C" {
diff --git a/src/include/debug.h b/src/include/debug.h
index 226d80dd6..f902e1ebb 100644
--- a/src/include/debug.h
+++ b/src/include/debug.h
@@ -38,13 +38,13 @@
typedef struct {
void *cse_wtobjp;
- t_time cse_time;
- UWORD16 cse_state: 4;
- UWORD16 cse_tid: 12;
+ systime_t cse_time;
+ uint16_t cse_state: 4;
+ uint16_t cse_tid: 12;
} CtxSwcEvent;
typedef struct {
- t_size tb_size;
+ size_t tb_size;
CtxSwcEvent *tb_ptr;
CtxSwcEvent tb_buffer[TRACE_BUFFER_SIZE];
} TraceBuffer;
diff --git a/src/include/delta.h b/src/include/delta.h
index 4365eb482..1f7a584f0 100644
--- a/src/include/delta.h
+++ b/src/include/delta.h
@@ -28,7 +28,7 @@
#ifdef CH_USE_VIRTUAL_TIMERS
/** Virtual Timer callback function.*/
-typedef void (*t_vtfunc)(void *);
+typedef void (*vtfunc_t)(void *);
typedef struct VirtualTimer VirtualTimer;
@@ -41,10 +41,10 @@ struct VirtualTimer {
/** Previous timer in the delta list.*/
VirtualTimer *vt_prev;
/** Time delta before timeout.*/
- t_time vt_dtime;
+ systime_t vt_dtime;
/** Timer callback function pointer. The pointer is reset to zero after
the callback is invoked.*/
- t_vtfunc vt_func;
+ vtfunc_t vt_func;
/** Timer callback function parameter.*/
void *vt_par;
};
@@ -63,7 +63,7 @@ typedef struct {
/** Last timer in the list.*/
VirtualTimer *dl_prev;
/** Not used but it must be set to /p MAXDELTA.*/
- t_time dl_dtime;
+ systime_t dl_dtime;
} DeltaList;
extern DeltaList dlist;
@@ -74,7 +74,7 @@ extern DeltaList dlist;
\
--dlist.dl_next->vt_dtime; \
while (!(vtp = dlist.dl_next)->vt_dtime) { \
- t_vtfunc fn = vtp->vt_func; \
+ vtfunc_t fn = vtp->vt_func; \
vtp->vt_func = 0; \
(vtp->vt_next->vt_prev = (VirtualTimer *)&dlist)->vt_next = vtp->vt_next; \
fn(vtp->vt_par); \
@@ -91,7 +91,7 @@ extern DeltaList dlist;
extern "C" {
#endif
void chVTInit(void);
- void chVTSetI(VirtualTimer *vtp, t_time time, t_vtfunc vtfunc, void *par);
+ void chVTSetI(VirtualTimer *vtp, systime_t time, vtfunc_t vtfunc, void *par);
void chVTResetI(VirtualTimer *vtp);
#ifdef __cplusplus
}
diff --git a/src/include/events.h b/src/include/events.h
index 78b695910..8cfb0109f 100644
--- a/src/include/events.h
+++ b/src/include/events.h
@@ -41,7 +41,7 @@ struct EventListener {
/** Thread interested in the Event Source.*/
Thread *el_listener;
/** Event identifier associated by the thread to the Event Source.*/
- t_eventid el_id;
+ eventid_t el_id;
};
/**
@@ -74,22 +74,22 @@ typedef struct EventSource {
/** Event Handler callback function.*/
-typedef void (*t_evhandler)(t_eventid);
+typedef void (*evhandler_t)(eventid_t);
#ifdef __cplusplus
extern "C" {
#endif
- void chEvtRegister(EventSource *esp, EventListener *elp, t_eventid eid);
+ void chEvtRegister(EventSource *esp, EventListener *elp, eventid_t eid);
void chEvtUnregister(EventSource *esp, EventListener *elp);
- void chEvtClear(t_eventmask mask);
+ void chEvtClear(eventmask_t mask);
void chEvtSend(EventSource *esp);
void chEvtSendI(EventSource *esp);
- t_eventid chEvtWait(t_eventmask ewmask,
- const t_evhandler handlers[]);
+ eventid_t chEvtWait(eventmask_t ewmask,
+ const evhandler_t handlers[]);
#ifdef CH_USE_EVENTS_TIMEOUT
- t_eventid chEvtWaitTimeout(t_eventmask ewmask,
- const t_evhandler handlers[],
- t_time time);
+ eventid_t chEvtWaitTimeout(eventmask_t ewmask,
+ const evhandler_t handlers[],
+ systime_t time);
#endif
#ifdef __cplusplus
}
diff --git a/src/include/messages.h b/src/include/messages.h
index a5e88c267..ae6ae9bb3 100644
--- a/src/include/messages.h
+++ b/src/include/messages.h
@@ -42,17 +42,13 @@
#ifdef __cplusplus
extern "C" {
#endif
- t_msg chMsgSend(Thread *tp, t_msg msg);
- t_msg chMsgWait(void);
- t_msg chMsgGet(void);
- void chMsgRelease(t_msg msg);
+ msg_t chMsgSend(Thread *tp, msg_t msg);
+ msg_t chMsgWait(void);
+ msg_t chMsgGet(void);
+ void chMsgRelease(msg_t msg);
#ifdef CH_USE_MESSAGES_EVENT
- t_msg chMsgSendWithEvent(Thread *tp, t_msg msg, EventSource *esp);
-#endif
-
-#ifdef CH_USE_MESSAGES_TIMEOUT
- t_msg chMsgSendTimeout(Thread *tp, t_msg msg, t_time time);
+ msg_t chMsgSendWithEvent(Thread *tp, msg_t msg, EventSource *esp);
#endif
#ifdef __cplusplus
}
diff --git a/src/include/mutexes.h b/src/include/mutexes.h
index 022e62dea..9e9c704cc 100644
--- a/src/include/mutexes.h
+++ b/src/include/mutexes.h
@@ -44,8 +44,8 @@ extern "C" {
void chMtxInit(Mutex *mp);
void chMtxLock(Mutex *mp);
void chMtxLockS(Mutex *mp);
- t_bool chMtxTryLock(Mutex *mp);
- t_bool chMtxTryLockS(Mutex *mp);
+ bool_t chMtxTryLock(Mutex *mp);
+ bool_t chMtxTryLockS(Mutex *mp);
void chMtxUnlock(void);
void chMtxUnlockS(void);
void chMtxUnlockAll(void);
diff --git a/src/include/queues.h b/src/include/queues.h
index a28539fd5..5c480e8cf 100644
--- a/src/include/queues.h
+++ b/src/include/queues.h
@@ -26,7 +26,7 @@
#define _QUEUES_H_
/** Queue notification callback type.*/
-typedef void (*t_qnotify)(void);
+typedef void (*qnotify_t)(void);
/** Returned by the queue functions if the operation is successful.*/
#define Q_OK RDY_OK
@@ -56,7 +56,7 @@ typedef struct {
/** Counter semaphore.*/
Semaphore q_sem;
/** Data notification callback.*/
- t_qnotify q_notify;
+ qnotify_t q_notify;
} Queue;
/** Returns the queue's buffer size.*/
@@ -91,24 +91,24 @@ extern "C" {
* Input Queues functions. An Input Queue is usually written into by an
* interrupt handler and read from a thread.
*/
- void chIQInit(Queue *qp, uint8_t *buffer, t_size size, t_qnotify inotify);
+ void chIQInit(Queue *qp, uint8_t *buffer, size_t size, qnotify_t inotify);
void chIQReset(Queue *qp);
- t_msg chIQPutI(Queue *qp, uint8_t b);
- t_msg chIQGet(Queue *qp);
- t_size chIQRead(Queue *qp, uint8_t *buffer, t_size n);
+ msg_t chIQPutI(Queue *qp, uint8_t b);
+ msg_t chIQGet(Queue *qp);
+ size_t chIQRead(Queue *qp, uint8_t *buffer, size_t n);
#ifdef CH_USE_QUEUES_TIMEOUT
- t_msg chIQGetTimeout(Queue *qp, t_time time);
+ msg_t chIQGetTimeout(Queue *qp, systime_t time);
#endif
/*
* Output Queues functions. An Output Queue is usually written into by a
* thread and read from an interrupt handler.
*/
- void chOQInit(Queue *queue, uint8_t *buffer, t_size size, t_qnotify onotify);
+ void chOQInit(Queue *queue, uint8_t *buffer, size_t size, qnotify_t onotify);
void chOQReset(Queue *queue);
void chOQPut(Queue *queue, uint8_t b);
- t_msg chOQGetI(Queue *queue);
- t_size chOQWrite(Queue *queue, uint8_t *buffer, t_size n);
+ msg_t chOQGetI(Queue *queue);
+ size_t chOQWrite(Queue *queue, uint8_t *buffer, size_t n);
#ifdef __cplusplus
}
#endif
@@ -132,9 +132,9 @@ typedef struct {
/** Output counter semaphore.*/
Semaphore hdq_osem;
/** Input data notification callback.*/
- t_qnotify hdq_inotify;
+ qnotify_t hdq_inotify;
/** Output data notification callback.*/
- t_qnotify hdq_onotify;
+ qnotify_t hdq_onotify;
} HalfDuplexQueue;
/** Returns the queue's buffer size.*/
@@ -164,14 +164,14 @@ typedef struct {
#ifdef __cplusplus
extern "C" {
#endif
- void chHDQInit(HalfDuplexQueue *qp, uint8_t *buffer, t_size size,
- t_qnotify inotify, t_qnotify onotify);
- t_msg chHDQGetReceive(HalfDuplexQueue *qp);
+ void chHDQInit(HalfDuplexQueue *qp, uint8_t *buffer, size_t size,
+ qnotify_t inotify, qnotify_t onotify);
+ msg_t chHDQGetReceive(HalfDuplexQueue *qp);
void chHDQPutTransmit(HalfDuplexQueue *qp, uint8_t b);
- t_msg chHDQGetTransmitI(HalfDuplexQueue *qp);
- t_msg chHDQPutReceiveI(HalfDuplexQueue *qp, uint8_t b);
+ msg_t chHDQGetTransmitI(HalfDuplexQueue *qp);
+ msg_t chHDQPutReceiveI(HalfDuplexQueue *qp, uint8_t b);
#ifdef CH_USE_QUEUES_TIMEOUT
- t_msg chHDQGetReceiveTimeout(HalfDuplexQueue *qp, t_time time);
+ msg_t chHDQGetReceiveTimeout(HalfDuplexQueue *qp, systime_t time);
#endif
#ifdef __cplusplus
}
diff --git a/src/include/scheduler.h b/src/include/scheduler.h
index f238002a1..0cd4bff7a 100644
--- a/src/include/scheduler.h
+++ b/src/include/scheduler.h
@@ -39,13 +39,13 @@
*/
typedef struct {
ThreadsQueue r_queue;
- t_prio r_prio;
- t_cnt r_preempt;
+ tprio_t r_prio;
+ cnt_t r_preempt;
#ifndef CH_CURRP_REGISTER_CACHE
Thread *r_current;
#endif
#ifdef CH_USE_SYSTEMTIME
- volatile t_time r_stime;
+ volatile systime_t r_stime;
#endif
} ReadyList;
@@ -58,13 +58,13 @@ extern ReadyList rlist;
extern "C" {
#endif
void chSchInit(void);
- void chSchReadyI(Thread *tp, t_msg msg);
- void chSchGoSleepS(t_tstate newstate);
- t_msg chSchGoSleepTimeoutS(t_tstate newstate, t_time time);
- void chSchWakeupS(Thread *tp, t_msg msg);
+ void chSchReadyI(Thread *tp, msg_t msg);
+ void chSchGoSleepS(tstate_t newstate);
+ msg_t chSchGoSleepTimeoutS(tstate_t newstate, systime_t time);
+ void chSchWakeupS(Thread *tp, msg_t msg);
void chSchDoRescheduleI(void);
void chSchRescheduleS(void);
- t_bool chSchRescRequiredI(void);
+ bool_t chSchRescRequiredI(void);
#ifdef __cplusplus
}
#endif
diff --git a/src/include/semaphores.h b/src/include/semaphores.h
index 0457da81d..c894629a4 100644
--- a/src/include/semaphores.h
+++ b/src/include/semaphores.h
@@ -34,20 +34,20 @@ typedef struct {
/** Queue of the threads sleeping on this Semaphore.*/
ThreadsQueue s_queue;
/** The Semaphore counter.*/
- t_cnt s_cnt;
+ cnt_t s_cnt;
} Semaphore;
#ifdef __cplusplus
extern "C" {
#endif
- void chSemInit(Semaphore *sp, t_cnt n);
- void chSemReset(Semaphore *sp, t_cnt n);
- void chSemResetI(Semaphore *sp, t_cnt n);
- t_msg chSemWait(Semaphore *sp);
- t_msg chSemWaitS(Semaphore *sp);
+ void chSemInit(Semaphore *sp, cnt_t n);
+ void chSemReset(Semaphore *sp, cnt_t n);
+ void chSemResetI(Semaphore *sp, cnt_t n);
+ msg_t chSemWait(Semaphore *sp);
+ msg_t chSemWaitS(Semaphore *sp);
#ifdef CH_USE_SEMAPHORES_TIMEOUT
- t_msg chSemWaitTimeout(Semaphore *sp, t_time time);
- t_msg chSemWaitTimeoutS(Semaphore *sp, t_time time);
+ msg_t chSemWaitTimeout(Semaphore *sp, systime_t time);
+ msg_t chSemWaitTimeoutS(Semaphore *sp, systime_t time);
#endif
void chSemSignal(Semaphore *sp);
void chSemSignalI(Semaphore *sp);
diff --git a/src/include/serial.h b/src/include/serial.h
index 4edef1e19..4b7b02b7c 100644
--- a/src/include/serial.h
+++ b/src/include/serial.h
@@ -41,7 +41,7 @@
#define SD_BREAK_DETECTED 32
/** Serial Driver condition flags type.*/
-typedef uint16_t t_dflags;
+typedef uint16_t dflags_t;
#ifdef CH_USE_SERIAL_FULLDUPLEX
@@ -66,7 +66,7 @@ typedef struct {
/** I/O driver status flags. This field should not be read directly but
* the \p chFDDGetAndClearFlags() funtion should be used instead.*/
- t_dflags sd_flags;
+ dflags_t sd_flags;
/** Status Change \p EventSource. This event is generated when a
* condition flag was changed.*/
EventSource sd_sevent;
@@ -76,12 +76,12 @@ typedef struct {
extern "C" {
#endif
void chFDDInit(FullDuplexDriver *sd,
- uint8_t *ib, t_size isize, t_qnotify inotify,
- uint8_t *ob, t_size osize, t_qnotify onotify);
+ uint8_t *ib, size_t isize, qnotify_t inotify,
+ uint8_t *ob, size_t osize, qnotify_t onotify);
void chFDDIncomingDataI(FullDuplexDriver *sd, uint8_t b);
- t_msg chFDDRequestDataI(FullDuplexDriver *sd);
- void chFDDAddFlagsI(FullDuplexDriver *sd, t_dflags mask);
- t_dflags chFDDGetAndClearFlags(FullDuplexDriver *sd);
+ msg_t chFDDRequestDataI(FullDuplexDriver *sd);
+ void chFDDAddFlagsI(FullDuplexDriver *sd, dflags_t mask);
+ dflags_t chFDDGetAndClearFlags(FullDuplexDriver *sd);
#ifdef __cplusplus
}
#endif
@@ -128,7 +128,7 @@ typedef struct {
/** I/O driver status flags. This field should not be read directly but
* the \p chHDDGetAndClearFlags() funtion should be used
* instead.*/
- t_dflags sd_flags;
+ dflags_t sd_flags;
/** Status Change Event Source. This event is generated when a condition
* flag was changed.*/
EventSource sd_sevent;
@@ -137,12 +137,12 @@ typedef struct {
#ifdef __cplusplus
extern "C" {
#endif
- void chHDDInit(HalfDuplexDriver *sd, uint8_t *b, t_size size,
- t_qnotify inotify, t_qnotify onotify);
+ void chHDDInit(HalfDuplexDriver *sd, uint8_t *b, size_t size,
+ qnotify_t inotify, qnotify_t onotify);
void chHDDIncomingDataI(HalfDuplexDriver *sd, uint8_t b);
- t_msg chHDDRequestDataI(HalfDuplexDriver *sd);
- void chHDDAddFlagsI(HalfDuplexDriver *sd, t_dflags mask);
- t_dflags chHDDGetAndClearFlags(HalfDuplexDriver *sd);
+ msg_t chHDDRequestDataI(HalfDuplexDriver *sd);
+ void chHDDAddFlagsI(HalfDuplexDriver *sd, dflags_t mask);
+ dflags_t chHDDGetAndClearFlags(HalfDuplexDriver *sd);
#ifdef __cplusplus
}
#endif
diff --git a/src/include/sleep.h b/src/include/sleep.h
index 022b7be23..808fbc560 100644
--- a/src/include/sleep.h
+++ b/src/include/sleep.h
@@ -29,7 +29,7 @@
extern "C" {
#endif
#ifdef CH_USE_SLEEP
- void chThdSleep(t_time time);
+ void chThdSleep(systime_t time);
#endif /* CH_USE_SLEEP */
#ifdef __cplusplus
}
@@ -55,7 +55,7 @@ extern "C" {
#define chThdSleepUntil(t) { \
chSysLock(); \
chSchGoSleepTimeoutS(PRSLEEP, \
- (t_time)((t) - chSysGetTime())) \
+ (systime_t)((t) - chSysGetTime())) \
chSysUnlock(); \
}
#endif /* CH_USE_SYSTEMTIME */
diff --git a/src/include/threads.h b/src/include/threads.h
index a0c2189da..11674b322 100644
--- a/src/include/threads.h
+++ b/src/include/threads.h
@@ -39,14 +39,14 @@ struct Thread {
Thread *p_prev;
/* End of the fields shared with the ThreadsQueue structure. */
/** The thread priority.*/
- t_prio p_prio;
+ tprio_t p_prio;
/* End of the fields shared with the ReadyList structure. */
/** Thread identifier. */
- t_tid p_tid;
+ tid_t p_tid;
/** Current thread state.*/
- t_tstate p_state;
+ tstate_t p_state;
/** Mode flags.*/
- t_tmode p_flags;
+ tmode_t p_flags;
/** Machine dependent processor context.*/
Context p_ctx;
/*
@@ -56,9 +56,9 @@ struct Thread {
*/
union {
/** Thread wakeup code (only valid when exiting the \p PRREADY state).*/
- t_msg p_rdymsg;
+ msg_t p_rdymsg;
/** The thread exit code (only while in \p PREXIT state).*/
- t_msg p_exitcode;
+ msg_t p_exitcode;
#ifdef CH_USE_SEMAPHORES
/** Semaphore where the thread is waiting on (only in \p PRWTSEM state).*/
Semaphore *p_wtsemp;
@@ -73,7 +73,7 @@ struct Thread {
#endif
#ifdef CH_USE_EVENTS
/** Enabled events mask (only while in \p PRWTEVENT state).*/
- t_eventmask p_ewmask;
+ eventmask_t p_ewmask;
#endif
#ifdef CH_USE_TRACE
/** Kernel object where the thread is waiting on. It is only valid when
@@ -94,16 +94,16 @@ struct Thread {
#endif
#ifdef CH_USE_MESSAGES
ThreadsQueue p_msgqueue;
- t_msg p_msg;
+ msg_t p_msg;
#endif
#ifdef CH_USE_EVENTS
/** Pending events mask.*/
- t_eventmask p_epending;
+ eventmask_t p_epending;
#endif
#ifdef CH_USE_MUTEXES
/** Owner mutexes list, \p NULL terminated.*/
Mutex *p_mtxlist;
- t_prio p_realprio;
+ tprio_t p_realprio;
#endif
};
@@ -159,10 +159,10 @@ struct Thread {
#define ABSPRIO 255
/* Not an API, don't use into the application code.*/
-void _InitThread(t_prio prio, t_tmode mode, Thread *tp);
+void _InitThread(tprio_t prio, tmode_t mode, Thread *tp);
/** Thread function.*/
-typedef t_msg (*t_tfunc)(void *);
+typedef msg_t (*tfunc_t)(void *);
/*
* Threads APIs.
@@ -170,10 +170,10 @@ typedef t_msg (*t_tfunc)(void *);
#ifdef __cplusplus
extern "C" {
#endif
- Thread *chThdCreate(t_prio prio, t_tmode mode, void *workspace,
- t_size wsize, t_tfunc pf, void *arg);
- void chThdSetPriority(t_prio newprio);
- void chThdExit(t_msg msg);
+ Thread *chThdCreate(tprio_t prio, tmode_t mode, void *workspace,
+ size_t wsize, tfunc_t pf, void *arg);
+ void chThdSetPriority(tprio_t newprio);
+ void chThdExit(msg_t msg);
#ifdef CH_USE_RESUME
void chThdResume(Thread *tp);
#endif
@@ -184,7 +184,7 @@ extern "C" {
void chThdTerminate(Thread *tp);
#endif
#ifdef CH_USE_WAITEXIT
- t_msg chThdWait(Thread *tp);
+ msg_t chThdWait(Thread *tp);
#endif
#ifdef __cplusplus
}