aboutsummaryrefslogtreecommitdiffstats
path: root/src/include
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2007-10-06 08:58:52 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2007-10-06 08:58:52 +0000
commitd6d799ed48f8193bee286187132221f831726a07 (patch)
tree928f9db3dbb76cfdef92405635b8d1b7885e5b5e /src/include
parentff4dd3f8f0f95652f754ab869b136d31d671ac51 (diff)
downloadChibiOS-d6d799ed48f8193bee286187132221f831726a07.tar.gz
ChibiOS-d6d799ed48f8193bee286187132221f831726a07.tar.bz2
ChibiOS-d6d799ed48f8193bee286187132221f831726a07.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@39 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'src/include')
-rw-r--r--src/include/ch.h8
-rw-r--r--src/include/delta.h13
-rw-r--r--src/include/events.h22
-rw-r--r--src/include/lists.h18
-rw-r--r--src/include/messages.h22
-rw-r--r--src/include/queues.h64
-rw-r--r--src/include/scheduler.h22
-rw-r--r--src/include/semaphores.h34
-rw-r--r--src/include/serial.h38
-rw-r--r--src/include/sleep.h17
-rw-r--r--src/include/threads.h30
11 files changed, 179 insertions, 109 deletions
diff --git a/src/include/ch.h b/src/include/ch.h
index aa77df544..b7889a9f5 100644
--- a/src/include/ch.h
+++ b/src/include/ch.h
@@ -92,7 +92,13 @@
#define NULL 0
#endif
-void chSysInit(void);
+#ifdef __cplusplus
+extern "C" {
+#endif
+ void chSysInit(void);
+#ifdef __cplusplus
+}
+#endif
#endif /* _CH_H_ */
diff --git a/src/include/delta.h b/src/include/delta.h
index 7639301e1..46fd3b883 100644
--- a/src/include/delta.h
+++ b/src/include/delta.h
@@ -66,7 +66,6 @@ typedef struct {
t_time dl_dtime;
} DeltaList;
-
extern DeltaList dlist;
#define chVTDoTickI() \
@@ -85,9 +84,15 @@ extern DeltaList dlist;
/*
* Virtual Timers APIs.
*/
-void chVTInit(void);
-void chVTSetI(VirtualTimer *vtp, t_time time, t_vtfunc vtfunc, void *par);
-void chVTResetI(VirtualTimer *vtp);
+#ifdef __cplusplus
+extern "C" {
+#endif
+ void chVTInit(void);
+ void chVTSetI(VirtualTimer *vtp, t_time time, t_vtfunc vtfunc, void *par);
+ void chVTResetI(VirtualTimer *vtp);
+#ifdef __cplusplus
+}
+#endif
#endif /* CH_USE_VIRTUAL_TIMER */
diff --git a/src/include/events.h b/src/include/events.h
index 322f7ec7d..94b277692 100644
--- a/src/include/events.h
+++ b/src/include/events.h
@@ -76,18 +76,24 @@ typedef struct EventSource {
/** Event Handler callback function.*/
typedef void (*t_evhandler)(t_eventid);
-void chEvtRegister(EventSource *esp, EventListener *elp, t_eventid eid);
-void chEvtUnregister(EventSource *esp, EventListener *elp);
-void chEvtClear(t_eventmask mask);
-void chEvtSend(EventSource *esp);
-void chEvtSendI(EventSource *esp);
-t_eventid chEvtWait(t_eventmask ewmask,
- t_evhandler handlers[]);
+#ifdef __cplusplus
+extern "C" {
+#endif
+ void chEvtRegister(EventSource *esp, EventListener *elp, t_eventid eid);
+ void chEvtUnregister(EventSource *esp, EventListener *elp);
+ void chEvtClear(t_eventmask mask);
+ void chEvtSend(EventSource *esp);
+ void chEvtSendI(EventSource *esp);
+ t_eventid chEvtWait(t_eventmask ewmask,
+ t_evhandler handlers[]);
#ifdef CH_USE_EVENTS_TIMEOUT
-t_eventid chEvtWaitTimeout(t_eventmask ewmask,
+ t_eventid chEvtWaitTimeout(t_eventmask ewmask,
t_evhandler handlers[],
t_time time);
#endif
+#ifdef __cplusplus
+}
+#endif
#endif /* CH_USE_EVENTS */
diff --git a/src/include/lists.h b/src/include/lists.h
index 477ab1061..043538457 100644
--- a/src/include/lists.h
+++ b/src/include/lists.h
@@ -55,13 +55,21 @@ typedef struct {
#define list_init(tlp) ((tlp)->p_next = (Thread *)(tlp))
#ifndef CH_OPTIMIZE_SPEED
-void fifo_insert(Thread *tp, ThreadsQueue *tqp);
-Thread *fifo_remove(ThreadsQueue *tqp);
-Thread *dequeue(Thread *tp);
-void list_insert(Thread *tp, ThreadsList *tlp);
-Thread *list_remove(ThreadsList *tlp);
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+ void fifo_insert(Thread *tp, ThreadsQueue *tqp);
+ Thread *fifo_remove(ThreadsQueue *tqp);
+ Thread *dequeue(Thread *tp);
+ void list_insert(Thread *tp, ThreadsList *tlp);
+ Thread *list_remove(ThreadsList *tlp);
+#ifdef __cplusplus
+}
#endif
+#endif /* CH_OPTIMIZE_SPEED */
+
#endif /* _LISTS_H_ */
/** @} */
diff --git a/src/include/messages.h b/src/include/messages.h
index a6ce409f3..a5e88c267 100644
--- a/src/include/messages.h
+++ b/src/include/messages.h
@@ -31,25 +31,31 @@
* Evaluates to TRUE if the thread has pending messages.
*/
#define chMsgIsPendingI(tp) \
- ((tp)->p_msgqueue.p_next != (Thread *)&(tp)->p_msgqueue)
+ ((tp)->p_msgqueue.p_next != (Thread *)&(tp)->p_msgqueue)
/**
* Returns the first message in the queue.
*/
#define chMsgGetI(tp) \
- ((tp)->p_msgqueue.p_next->p_msg)
+ ((tp)->p_msgqueue.p_next->p_msg)
-t_msg chMsgSend(Thread *tp, t_msg msg);
-t_msg chMsgWait(void);
-t_msg chMsgGet(void);
-void chMsgRelease(t_msg msg);
+#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);
#ifdef CH_USE_MESSAGES_EVENT
-t_msg chMsgSendWithEvent(Thread *tp, t_msg msg, EventSource *esp);
+ 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);
+ t_msg chMsgSendTimeout(Thread *tp, t_msg msg, t_time time);
+#endif
+#ifdef __cplusplus
+}
#endif
#endif /* CH_USE_MESSAGES */
diff --git a/src/include/queues.h b/src/include/queues.h
index 117c6e9e8..31258ce69 100644
--- a/src/include/queues.h
+++ b/src/include/queues.h
@@ -84,28 +84,34 @@ typedef struct {
#define chOQIsFull(q) \
(chQSpace(q) <= 0)
-/*
- * Input Queues functions. An Input Queue is usually written into by an
- * interrupt handler and read from a thread.
- */
-void chIQInit(Queue *qp, BYTE8 *buffer, t_size size, t_qnotify inotify);
-void chIQReset(Queue *qp);
-t_msg chIQPutI(Queue *qp, BYTE8 b);
-t_msg chIQGet(Queue *qp);
-t_size chIQRead(Queue *qp, BYTE8 *buffer, t_size n);
+#ifdef __cplusplus
+extern "C" {
+#endif
+ /*
+ * Input Queues functions. An Input Queue is usually written into by an
+ * interrupt handler and read from a thread.
+ */
+ void chIQInit(Queue *qp, BYTE8 *buffer, t_size size, t_qnotify inotify);
+ void chIQReset(Queue *qp);
+ t_msg chIQPutI(Queue *qp, BYTE8 b);
+ t_msg chIQGet(Queue *qp);
+ t_size chIQRead(Queue *qp, BYTE8 *buffer, t_size n);
#ifdef CH_USE_QUEUES_TIMEOUT
-t_msg chIQGetTimeout(Queue *qp, t_time time);
+ t_msg chIQGetTimeout(Queue *qp, t_time 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, BYTE8 *buffer, t_size size, t_qnotify onotify);
-void chOQReset(Queue *queue);
-void chOQPut(Queue *queue, BYTE8 b);
-t_msg chOQGetI(Queue *queue);
-t_size chOQWrite(Queue *queue, BYTE8 *buffer, t_size n);
+ /*
+ * Output Queues functions. An Output Queue is usually written into by a
+ * thread and read from an interrupt handler.
+ */
+ void chOQInit(Queue *queue, BYTE8 *buffer, t_size size, t_qnotify onotify);
+ void chOQReset(Queue *queue);
+ void chOQPut(Queue *queue, BYTE8 b);
+ t_msg chOQGetI(Queue *queue);
+ t_size chOQWrite(Queue *queue, BYTE8 *buffer, t_size n);
+#ifdef __cplusplus
+}
+#endif
#endif /* CH_USE_QUEUES */
#ifdef CH_USE_QUEUES_HALFDUPLEX
@@ -155,14 +161,20 @@ typedef struct {
#define chHDQIsFullReceive(q) \
(chHDQFilledSpace(q) >= chHDQSize(q))
-void chHDQInit(HalfDuplexQueue *qp, BYTE8 *buffer, t_size size,
- t_qnotify inotify, t_qnotify onotify);
-t_msg chHDQGetReceive(HalfDuplexQueue *qp);
-void chHDQPutTransmit(HalfDuplexQueue *qp, BYTE8 b);
-t_msg chHDQGetTransmitI(HalfDuplexQueue *qp);
-t_msg chHDQPutReceiveI(HalfDuplexQueue *qp, BYTE8 b);
+#ifdef __cplusplus
+extern "C" {
+#endif
+ void chHDQInit(HalfDuplexQueue *qp, BYTE8 *buffer, t_size size,
+ t_qnotify inotify, t_qnotify onotify);
+ t_msg chHDQGetReceive(HalfDuplexQueue *qp);
+ void chHDQPutTransmit(HalfDuplexQueue *qp, BYTE8 b);
+ t_msg chHDQGetTransmitI(HalfDuplexQueue *qp);
+ t_msg chHDQPutReceiveI(HalfDuplexQueue *qp, BYTE8 b);
#ifdef CH_USE_QUEUES_TIMEOUT
-t_msg chHDQGetReceiveTimeout(HalfDuplexQueue *qp, t_time time);
+ t_msg chHDQGetReceiveTimeout(HalfDuplexQueue *qp, t_time time);
+#endif
+#ifdef __cplusplus
+}
#endif
#endif /* CH_USE_QUEUES_HALFDUPLEX */
diff --git a/src/include/scheduler.h b/src/include/scheduler.h
index 6a3f7f8f8..884b3936c 100644
--- a/src/include/scheduler.h
+++ b/src/include/scheduler.h
@@ -45,14 +45,20 @@ typedef struct {
/*
* Scheduler APIs.
*/
-void chSchInit(void);
-Thread *chSchReadyI(Thread *tp);
-void chSchGoSleepI(t_tstate newstate);
-void chSchWakeupI(Thread *tp, t_msg msg);
-void chSchRescheduleI(void);
-void chSchDoRescheduleI(void);
-BOOL chSchRescRequiredI(void);
-void chSchTimerHandlerI(void);
+#ifdef __cplusplus
+extern "C" {
+#endif
+ void chSchInit(void);
+ Thread *chSchReadyI(Thread *tp);
+ void chSchGoSleepI(t_tstate newstate);
+ void chSchWakeupI(Thread *tp, t_msg msg);
+ void chSchRescheduleI(void);
+ void chSchDoRescheduleI(void);
+ BOOL chSchRescRequiredI(void);
+ void chSchTimerHandlerI(void);
+#ifdef __cplusplus
+}
+#endif
/**
* Current thread pointer.
diff --git a/src/include/semaphores.h b/src/include/semaphores.h
index c1f3f9db6..dfee499f0 100644
--- a/src/include/semaphores.h
+++ b/src/include/semaphores.h
@@ -37,22 +37,28 @@ typedef struct {
t_cnt s_cnt;
} Semaphore;
-void chSemInit(Semaphore *sp, t_cnt n);
-void chSemReset(Semaphore *sp, t_cnt n);
-void chSemResetI(Semaphore *sp, t_cnt n);
-void chSemWait(Semaphore *sp);
-void chSemWaitS(Semaphore *sp);
-t_msg chSemWaitTimeout(Semaphore *sp, t_time time);
-t_msg chSemWaitTimeoutS(Semaphore *sp, t_time time);
-void chSemSignal(Semaphore *sp);
-void chSemSignalI(Semaphore *sp);
-void chSemSignalWait(Semaphore *sps, Semaphore *spw);
+#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);
+ void chSemWait(Semaphore *sp);
+ void chSemWaitS(Semaphore *sp);
+ t_msg chSemWaitTimeout(Semaphore *sp, t_time time);
+ t_msg chSemWaitTimeoutS(Semaphore *sp, t_time time);
+ void chSemSignal(Semaphore *sp);
+ void chSemSignalI(Semaphore *sp);
+ void chSemSignalWait(Semaphore *sps, Semaphore *spw);
#ifdef CH_USE_RT_SEMAPHORES
-void chSemRaisePrioWait(Semaphore *sp);
-void chSemLowerPrioSignal(Semaphore *sp);
-void chSemRaisePrioSignalWait(Semaphore *sps, Semaphore *spw);
-void chSemLowerPrioSignalWait(Semaphore *sps, Semaphore *spw);
+ void chSemRaisePrioWait(Semaphore *sp);
+ void chSemLowerPrioSignal(Semaphore *sp);
+ void chSemRaisePrioSignalWait(Semaphore *sps, Semaphore *spw);
+ void chSemLowerPrioSignalWait(Semaphore *sps, Semaphore *spw);
+#endif
+#ifdef __cplusplus
+}
#endif
/**
diff --git a/src/include/serial.h b/src/include/serial.h
index 3d33975b1..8e3127bac 100644
--- a/src/include/serial.h
+++ b/src/include/serial.h
@@ -72,13 +72,19 @@ typedef struct {
EventSource sd_sevent;
} FullDuplexDriver;
-void chFDDInit(FullDuplexDriver *sd,
- BYTE8 *ib, t_size isize, t_qnotify inotify,
- BYTE8 *ob, t_size osize, t_qnotify onotify);
-void chFDDIncomingDataI(FullDuplexDriver *sd, BYTE8 b);
-t_msg chFDDRequestDataI(FullDuplexDriver *sd);
-void chFDDAddFlagsI(FullDuplexDriver *sd, t_dflags mask);
-t_dflags chFDDGetAndClearFlags(FullDuplexDriver *sd);
+#ifdef __cplusplus
+extern "C" {
+#endif
+ void chFDDInit(FullDuplexDriver *sd,
+ BYTE8 *ib, t_size isize, t_qnotify inotify,
+ BYTE8 *ob, t_size osize, t_qnotify onotify);
+ void chFDDIncomingDataI(FullDuplexDriver *sd, BYTE8 b);
+ t_msg chFDDRequestDataI(FullDuplexDriver *sd);
+ void chFDDAddFlagsI(FullDuplexDriver *sd, t_dflags mask);
+ t_dflags chFDDGetAndClearFlags(FullDuplexDriver *sd);
+#ifdef __cplusplus
+}
+#endif
/** @see chIQRead()*/
#define chFDDRead(sd, b, n) \
@@ -128,12 +134,18 @@ typedef struct {
EventSource sd_sevent;
} HalfDuplexDriver;
-void chHDDInit(HalfDuplexDriver *sd, BYTE8 *b, t_size size,
- t_qnotify inotify, t_qnotify onotify);
-void chHDDIncomingDataI(HalfDuplexDriver *sd, BYTE8 b);
-t_msg chHDDRequestDataI(HalfDuplexDriver *sd);
-void chHDDAddFlagsI(HalfDuplexDriver *sd, t_dflags mask);
-t_dflags chHDDGetAndClearFlags(HalfDuplexDriver *sd);
+#ifdef __cplusplus
+extern "C" {
+#endif
+ void chHDDInit(HalfDuplexDriver *sd, BYTE8 *b, t_size size,
+ t_qnotify inotify, t_qnotify onotify);
+ void chHDDIncomingDataI(HalfDuplexDriver *sd, BYTE8 b);
+ t_msg chHDDRequestDataI(HalfDuplexDriver *sd);
+ void chHDDAddFlagsI(HalfDuplexDriver *sd, t_dflags mask);
+ t_dflags chHDDGetAndClearFlags(HalfDuplexDriver *sd);
+#ifdef __cplusplus
+}
+#endif
/** @see chHDQGetReceive()*/
#define chHDDGetReceive(sd) \
diff --git a/src/include/sleep.h b/src/include/sleep.h
index 265500908..e3fa2ffda 100644
--- a/src/include/sleep.h
+++ b/src/include/sleep.h
@@ -25,18 +25,19 @@
#ifndef _SLEEP_H_
#define _SLEEP_H_
+#ifdef __cplusplus
+extern "C" {
+#endif
#ifdef CH_USE_SLEEP
-
-void chThdSleep(t_time time);
-
+ void chThdSleep(t_time time);
#ifdef CH_USE_SYSTEMTIME
-
-void chThdSleepUntil(t_time time);
-t_time chSysGetTime(void);
-
+ void chThdSleepUntil(t_time time);
+ t_time chSysGetTime(void);
#endif /* CH_USE_SYSTEMTIME */
-
#endif /* CH_USE_SLEEP */
+#ifdef __cplusplus
+}
+#endif
#endif /* _SLEEP_H_ */
diff --git a/src/include/threads.h b/src/include/threads.h
index 12737de2e..2ed92fa39 100644
--- a/src/include/threads.h
+++ b/src/include/threads.h
@@ -186,10 +186,22 @@ static INLINE Thread *list_remove(ThreadsList *tlp) {
/*
* Threads APIs.
*/
-Thread *chThdCreate(t_prio prio, t_tmode mode, void *workspace,
- t_size wsize, t_tfunc pf, void *arg);
-void chThdResume(Thread *tp);
-void chThdExit(t_msg msg);
+#ifdef __cplusplus
+extern "C" {
+#endif
+ Thread *chThdCreate(t_prio prio, t_tmode mode, void *workspace,
+ t_size wsize, t_tfunc pf, void *arg);
+ void chThdResume(Thread *tp);
+ void chThdExit(t_msg msg);
+#ifdef CH_USE_TERMINATE
+ void chThdTerminate(Thread *tp);
+#endif
+#ifdef CH_USE_WAITEXIT
+ t_msg chThdWait(Thread *tp);
+#endif
+#ifdef __cplusplus
+}
+#endif
/** Returns the pointer to the \p Thread currently in execution.*/
#define chThdSelf() currp
@@ -200,20 +212,11 @@ void chThdExit(t_msg msg);
/** Verifies if the specified thread is in the \p PREXIT state.*/
#define chThdTerminated(tp) ((tp)->p_state == PREXIT)
-#ifdef CH_USE_TERMINATE
/**
* Verifies if the current thread has a termination request pending.
*/
#define chThdShouldTerminate() (currp->p_flags & P_TERMINATE)
-void chThdTerminate(Thread *tp);
-#endif
-
-#ifdef CH_USE_WAITEXIT
-t_msg chThdWait(Thread *tp);
-#endif
-
-#ifdef CH_USE_EXIT_EVENT
/**
* Returns the exit event source for the specified thread. The source is
* signaled when the thread terminates.
@@ -235,7 +238,6 @@ t_msg chThdWait(Thread *tp);
* option is enabled in \p chconf.h.
*/
#define chThdGetExitEventSource(tp) (&(tp)->p_exitesource)
-#endif
#endif /* _THREADS_H_ */