aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2007-10-19 13:00:24 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2007-10-19 13:00:24 +0000
commitbca8923f622aa26a55b9b9ae834b1094487498c4 (patch)
tree67b90674acf78ebe02ef9c5025b7e227866a3cc8
parentde194f4d9668de0783095d1815493b722fb65aed (diff)
downloadChibiOS-bca8923f622aa26a55b9b9ae834b1094487498c4.tar.gz
ChibiOS-bca8923f622aa26a55b9b9ae834b1094487498c4.tar.bz2
ChibiOS-bca8923f622aa26a55b9b9ae834b1094487498c4.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@58 35acf78f-673a-0410-8e92-d51de3d6d3f4
-rw-r--r--demos/Win32-MSVS/ch.vcproj3
-rw-r--r--readme.txt4
-rw-r--r--src/chevents.c12
-rw-r--r--src/include/ch.h4
-rw-r--r--src/include/inline.h61
-rw-r--r--src/include/threads.h38
6 files changed, 74 insertions, 48 deletions
diff --git a/demos/Win32-MSVS/ch.vcproj b/demos/Win32-MSVS/ch.vcproj
index 8764f059d..26dd9557e 100644
--- a/demos/Win32-MSVS/ch.vcproj
+++ b/demos/Win32-MSVS/ch.vcproj
@@ -216,6 +216,9 @@
RelativePath="..\..\src\include\events.h">
</File>
<File
+ RelativePath="..\..\src\include\inline.h">
+ </File>
+ <File
RelativePath="..\..\src\include\lists.h">
</File>
<File
diff --git a/readme.txt b/readme.txt
index 2e398401e..db56b33a8 100644
--- a/readme.txt
+++ b/readme.txt
@@ -40,6 +40,10 @@ AVR-AT90CANx-GCC - Port on AVR AT90CAN128, not complete yet.
*** 0.3.5 ***
- Space optimization in events code.
+- Changed the behavior of chEvtWaitTimeout() when the timeout parameter is
+ set to zero, now it is consistent with all the other syscalls that have a
+ timeout option.
+- Reorganized all the inline definitions into a single file (inline.h).
*** 0.3.4 ***
- Fixed a problem in chVTSetI().
diff --git a/src/chevents.c b/src/chevents.c
index 796577ace..93d93ff3d 100644
--- a/src/chevents.c
+++ b/src/chevents.c
@@ -177,15 +177,13 @@ static void unwait(void *p) {
* have indexes from zero up the higher registered event
* identifier. The array can be NULL or contain NULL elements
* (no callback specified).
- * @param time the number of ticks before the operation timouts, if set to
- * zero then the function exits immediatly with \p RDY_TIMEOUT if
- * there are not serviceable events pending
+ * @param time the number of ticks before the operation timouts
* @return the event identifier or \p RDY_TIMEOUT the specified time expired or
* if the timeout was set to zero and no serviceable pending events
* were present
* @note Only a single event is served in the function, the one with the
* lowest event id. The function is meant to be invoked into a loop so
- * that all events are received and served.<br>
+ * that all events are received and served.<br>
* This means that Event Listeners with a lower event identifier have
* an higher priority.
* @note The function is available only if the \p CH_USE_EVENTS_TIMEOUT
@@ -202,12 +200,6 @@ t_eventid chEvtWaitTimeout(t_eventmask ewmask,
if ((currp->p_epending & ewmask) == 0) {
VirtualTimer vt;
- if (time == 0) {
-
- chSysUnlock();
- return RDY_TIMEOUT;
- }
-
chVTSetI(&vt, time, unwait, currp);
currp->p_ewmask = ewmask;
chSchGoSleepS(PRWTEVENT);
diff --git a/src/include/ch.h b/src/include/ch.h
index b7889a9f5..9df1b8363 100644
--- a/src/include/ch.h
+++ b/src/include/ch.h
@@ -67,6 +67,10 @@
#include "threads.h"
#endif
+#ifndef _INLINE_H_
+#include "inline.h"
+#endif
+
#ifndef _SLEEP_H_
#include "sleep.h"
#endif
diff --git a/src/include/inline.h b/src/include/inline.h
new file mode 100644
index 000000000..afcfb9ae3
--- /dev/null
+++ b/src/include/inline.h
@@ -0,0 +1,61 @@
+/*
+ ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio.
+
+ This file is part of ChibiOS/RT.
+
+ ChibiOS/RT is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ ChibiOS/RT is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef _INLINE_H_
+#define _INLINE_H_
+
+/*
+ * Inlined functions if CH_OPTIMIZE_SPEED is enabled.
+ */
+#ifdef CH_OPTIMIZE_SPEED
+static INLINE void fifo_insert(Thread *tp, ThreadsQueue *tqp) {
+
+ tp->p_prev = (tp->p_next = (Thread *)tqp)->p_prev;
+ tp->p_prev->p_next = tqp->p_prev = tp;
+}
+
+static INLINE Thread *fifo_remove(ThreadsQueue *tqp) {
+ Thread *tp = tqp->p_next;
+
+ (tqp->p_next = tp->p_next)->p_prev = (Thread *)tqp;
+ return tp;
+}
+
+static INLINE Thread *dequeue(Thread *tp) {
+
+ tp->p_prev->p_next = tp->p_next;
+ tp->p_next->p_prev = tp->p_prev;
+ return tp;
+}
+
+static INLINE void list_insert(Thread *tp, ThreadsList *tlp) {
+
+ tp->p_next = tlp->p_next;
+ tlp->p_next = tp;
+}
+
+static INLINE Thread *list_remove(ThreadsList *tlp) {
+
+ Thread *tp = tlp->p_next;
+ tlp->p_next = tp->p_next;
+ return tp;
+}
+#endif /* CH_OPTIMIZE_SPEED */
+
+#endif /* _INLINE_H_ */
diff --git a/src/include/threads.h b/src/include/threads.h
index 3e1713d31..f97148087 100644
--- a/src/include/threads.h
+++ b/src/include/threads.h
@@ -146,44 +146,6 @@ void _InitThread(t_prio prio, t_tmode mode, Thread *tp);
typedef t_msg (*t_tfunc)(void *);
/*
- * Inlined functions if CH_OPTIMIZE_SPEED is enabled.
- */
-#ifdef CH_OPTIMIZE_SPEED
-static INLINE void fifo_insert(Thread *tp, ThreadsQueue *tqp) {
-
- tp->p_prev = (tp->p_next = (Thread *)tqp)->p_prev;
- tp->p_prev->p_next = tqp->p_prev = tp;
-}
-
-static INLINE Thread *fifo_remove(ThreadsQueue *tqp) {
- Thread *tp = tqp->p_next;
-
- (tqp->p_next = tp->p_next)->p_prev = (Thread *)tqp;
- return tp;
-}
-
-static INLINE Thread *dequeue(Thread *tp) {
-
- tp->p_prev->p_next = tp->p_next;
- tp->p_next->p_prev = tp->p_prev;
- return tp;
-}
-
-static INLINE void list_insert(Thread *tp, ThreadsList *tlp) {
-
- tp->p_next = tlp->p_next;
- tlp->p_next = tp;
-}
-
-static INLINE Thread *list_remove(ThreadsList *tlp) {
-
- Thread *tp = tlp->p_next;
- tlp->p_next = tp->p_next;
- return tp;
-}
-#endif
-
-/*
* Threads APIs.
*/
#ifdef __cplusplus