git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@58 35acf78f-673a-0410-8e92-d51de3d6d3f4

master
gdisirio 2007-10-19 13:00:24 +00:00
parent de194f4d96
commit bca8923f62
6 changed files with 74 additions and 48 deletions

View File

@ -215,6 +215,9 @@
<File
RelativePath="..\..\src\include\events.h">
</File>
<File
RelativePath="..\..\src\include\inline.h">
</File>
<File
RelativePath="..\..\src\include\lists.h">
</File>

View File

@ -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().

View File

@ -177,9 +177,7 @@ 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
@ -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);

View File

@ -67,6 +67,10 @@
#include "threads.h"
#endif
#ifndef _INLINE_H_
#include "inline.h"
#endif
#ifndef _SLEEP_H_
#include "sleep.h"
#endif

61
src/include/inline.h Normal file
View File

@ -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_ */

View File

@ -145,44 +145,6 @@ void _InitThread(t_prio prio, t_tmode mode, Thread *tp);
/** Thread function.*/
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.
*/