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

This commit is contained in:
gdisirio 2007-09-25 18:41:39 +00:00
parent 619b739d93
commit 95b238fc86
13 changed files with 87 additions and 84 deletions

View File

@ -72,7 +72,7 @@
/** Configuration option: if specified then the Semaphores APIs with priority /** Configuration option: if specified then the Semaphores APIs with priority
* shift are included in the kernel. * shift are included in the kernel.
* @note requires \p CH_USE_SEMAPHORES.*/ * @note requires \p CH_USE_SEMAPHORES.*/
//#define CH_USE_RT_SEMAPHORES #define CH_USE_RT_SEMAPHORES
/** Configuration option: if specified then the Events APIs are included in /** Configuration option: if specified then the Events APIs are included in
* the kernel.*/ * the kernel.*/
@ -82,7 +82,7 @@
* function is included in the kernel. * function is included in the kernel.
* @note requires \p CH_USE_EVENTS. * @note requires \p CH_USE_EVENTS.
* @note requires \p CH_USE_VIRTUAL_TIMERS.*/ * @note requires \p CH_USE_VIRTUAL_TIMERS.*/
//#define CH_USE_EVENTS_TIMEOUT #define CH_USE_EVENTS_TIMEOUT
/** Configuration option: if specified then the Synchronous Messages APIs are /** Configuration option: if specified then the Synchronous Messages APIs are
* included in the kernel.*/ * included in the kernel.*/
@ -92,13 +92,13 @@
* function is included in the kernel. * function is included in the kernel.
* @note requires \p CH_USE_MESSAGES. * @note requires \p CH_USE_MESSAGES.
* @note requires \p CH_USE_VIRTUAL_TIMERS.*/ * @note requires \p CH_USE_VIRTUAL_TIMERS.*/
//#define CH_USE_MESSAGES_TIMEOUT #define CH_USE_MESSAGES_TIMEOUT
/** Configuration option: if specified then the \p chMsgSendWithEvent() /** Configuration option: if specified then the \p chMsgSendWithEvent()
* function is included in the kernel. * function is included in the kernel.
* @note requires \p CH_USE_MESSAGES. * @note requires \p CH_USE_MESSAGES.
* @note requires \p CH_USE_VIRTUAL_TIMERS.*/ * @note requires \p CH_USE_VIRTUAL_TIMERS.*/
//#define CH_USE_MESSAGES_EVENT #define CH_USE_MESSAGES_EVENT
/** Configuration option: if specified then the /** Configuration option: if specified then the
* \p chThdGetExitEventSource() function is included in the kernel. * \p chThdGetExitEventSource() function is included in the kernel.

View File

@ -33,7 +33,7 @@
typedef BYTE8 t_tmode; typedef BYTE8 t_tmode;
typedef BYTE8 t_tstate; typedef BYTE8 t_tstate;
typedef WORD16 t_prio; typedef LONG32 t_prio;
typedef PTR_EQ t_msg; typedef PTR_EQ t_msg;
typedef LONG32 t_eventid; typedef LONG32 t_eventid;
typedef ULONG32 t_eventmask; typedef ULONG32 t_eventmask;

View File

@ -33,7 +33,7 @@
typedef BYTE8 t_tmode; typedef BYTE8 t_tmode;
typedef BYTE8 t_tstate; typedef BYTE8 t_tstate;
typedef WORD16 t_prio; typedef LONG32 t_prio;
typedef PTR_EQ t_msg; typedef PTR_EQ t_msg;
typedef LONG32 t_eventid; typedef LONG32 t_eventid;
typedef ULONG32 t_eventmask; typedef ULONG32 t_eventmask;

View File

@ -33,7 +33,7 @@
typedef BYTE8 t_tmode; typedef BYTE8 t_tmode;
typedef BYTE8 t_tstate; typedef BYTE8 t_tstate;
typedef WORD16 t_prio; typedef LONG32 t_prio;
typedef PTR_EQ t_msg; typedef PTR_EQ t_msg;
typedef LONG32 t_eventid; typedef LONG32 t_eventid;
typedef ULONG32 t_eventmask; typedef ULONG32 t_eventmask;

View File

@ -4,7 +4,7 @@
# Project related configuration options # Project related configuration options
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
PROJECT_NAME = ChibiOS/RT PROJECT_NAME = ChibiOS/RT
PROJECT_NUMBER = "0.2.0 alpha" PROJECT_NUMBER = "0.2.1 alpha"
OUTPUT_DIRECTORY = . OUTPUT_DIRECTORY = .
CREATE_SUBDIRS = NO CREATE_SUBDIRS = NO
OUTPUT_LANGUAGE = English OUTPUT_LANGUAGE = English

View File

@ -17,8 +17,8 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef _LPC2000_SERIAL_H_ #ifndef _LPC214x_SERIAL_H_
#define _LPC2000_SERIAL_H_ #define _LPC214x_SERIAL_H_
void InitSerial(void); void InitSerial(void);
void SetUARTI(UART *u, int speed, int lcr, int fcr); void SetUARTI(UART *u, int speed, int lcr, int fcr);
@ -27,4 +27,4 @@ void UART1IrqHandler(void);
extern FullDuplexDriver COM1, COM2; extern FullDuplexDriver COM1, COM2;
#endif /* _LPC2000_SERIAL_H_*/ #endif /* _LPC214x_SERIAL_H_*/

View File

@ -11,8 +11,10 @@
under ./demos/. under ./demos/.
./ports/ - Architecture/compiler specific portable files. ./ports/ - Architecture/compiler specific portable files.
./demos/ - Demo programs for specific archtectures/boards. ./demos/ - Demo programs for specific archtectures/boards.
./docs/doxifile - Doxigen project file. ./docs/Doxifile - Doxigen project file.
./docs/index.html - ChibiOS/RT documentation (after running doxigen). ./docs/index.html - ChibiOS/RT documentation (after running doxigen). The
documentation is also available on the project web
page: http://chibios.sourceforge.net/
Current ports under ./demos: Current ports under ./demos:
@ -30,6 +32,15 @@ LPC214x-GCC - ChibiOS/RT port for ARM7 LPC2148, the demo targets the
*** Releases *** *** Releases ***
***************************************************************************** *****************************************************************************
*** 0.2.1 ***
- Optimizations in the RT semaphores subsystem. The support for this
subsystem should still be considered experimental and further changes may
happen in future versions.
- Bug fix in the virtual timers handling code, now the timers can be re-armed
from within the callback code in order to create periodic virtual timers.
- Modified the t_prio type in the demos to be 32bits wide instead of 16bits,
this results in a better code in critical sections of the kernel.
*** 0.2.0 *** *** 0.2.0 ***
- Introduced support for ARM in thumb mode. - Introduced support for ARM in thumb mode.
- Optimized context switching when thumb-interworking is not required, one - Optimized context switching when thumb-interworking is not required, one

View File

@ -188,17 +188,7 @@ void chSchTimerHandlerI(void) {
#endif #endif
#ifdef CH_USE_VIRTUAL_TIMERS #ifdef CH_USE_VIRTUAL_TIMERS
if (&dlist != (DeltaList *)dlist.dl_next) { chVTDoTickI();
VirtualTimer *vtp;
--dlist.dl_next->vt_dtime;
while (!(vtp = dlist.dl_next)->vt_dtime) {
vtp->vt_prev->vt_next = vtp->vt_next;
vtp->vt_next->vt_prev = vtp->vt_prev;
vtp->vt_func(vtp->vt_par);
vtp->vt_func = 0; // Required, flags the timer as triggered.
}
}
#endif #endif
} }

View File

@ -288,7 +288,7 @@ void chSemLowerPrioSignal(Semaphore *sp) {
chSysLock(); chSysLock();
if (!--currp->p_rtcnt) { if (!--currp->p_rtcnt) {
currp->p_prio = currp->p_bakprio; currp->p_prio -= MEPRIO;
if (sp->s_cnt++ < 0) if (sp->s_cnt++ < 0)
chSchReadyI(dequeue(sp->s_queue.p_next)); chSchReadyI(dequeue(sp->s_queue.p_next));
chSchRescheduleI(); chSchRescheduleI();
@ -308,14 +308,11 @@ void chSemLowerPrioSignal(Semaphore *sp) {
* option is enabled in \p chconf.h. * option is enabled in \p chconf.h.
*/ */
void chSemRaisePrioSignalWait(Semaphore *sps, Semaphore *spw) { void chSemRaisePrioSignalWait(Semaphore *sps, Semaphore *spw) {
BOOL flag;
chSysLock(); chSysLock();
if (sps->s_cnt++ < 0) if (sps->s_cnt++ < 0)
chSchReadyI(dequeue(sps->s_queue.p_next)), flag = TRUE; chSchReadyI(dequeue(sps->s_queue.p_next));
else
flag = FALSE;
if (--spw->s_cnt < 0) { if (--spw->s_cnt < 0) {
prioenq(currp, &spw->s_queue); prioenq(currp, &spw->s_queue);
@ -323,19 +320,13 @@ void chSemRaisePrioSignalWait(Semaphore *sps, Semaphore *spw) {
if (!currp->p_rtcnt++) if (!currp->p_rtcnt++)
currp->p_prio += MEPRIO; currp->p_prio += MEPRIO;
chSysUnlock();
return;
} }
else {
if (!currp->p_rtcnt++) { if (!currp->p_rtcnt++)
currp->p_bakprio = currp->p_prio;
currp->p_prio += MEPRIO; currp->p_prio += MEPRIO;
flag = TRUE;
}
if( flag)
chSchRescheduleI(); chSchRescheduleI();
}
chSysUnlock(); chSysUnlock();
} }
@ -349,21 +340,20 @@ void chSemRaisePrioSignalWait(Semaphore *sps, Semaphore *spw) {
* option is enabled in \p chconf.h. * option is enabled in \p chconf.h.
*/ */
void chSemLowerPrioSignalWait(Semaphore *sps, Semaphore *spw) { void chSemLowerPrioSignalWait(Semaphore *sps, Semaphore *spw) {
BOOL flag = FALSE;
chSysLock(); chSysLock();
if (!--currp->p_rtcnt) if (!--currp->p_rtcnt)
currp->p_prio = currp->p_bakprio, flag = TRUE; currp->p_prio -= MEPRIO;
if (sps->s_cnt++ < 0) if (sps->s_cnt++ < 0)
chSchReadyI(dequeue(sps->s_queue.p_next)), flag = TRUE; chSchReadyI(dequeue(sps->s_queue.p_next));
if (--spw->s_cnt < 0) { if (--spw->s_cnt < 0) {
enqueue(currp, &spw->s_queue); // enqueue() because the spw is a normal sem. enqueue(currp, &spw->s_queue); // enqueue() because the spw is a normal sem.
chSchGoSleepI(PRWTSEM); chSchGoSleepI(PRWTSEM);
} }
else if (flag) else
chSchRescheduleI(); chSchRescheduleI();
chSysUnlock(); chSysUnlock();

View File

@ -61,7 +61,6 @@ void _InitThread(t_prio prio, t_tmode mode, Thread *tp) {
tp->p_rdymsg = RDY_OK; tp->p_rdymsg = RDY_OK;
#ifdef CH_USE_RT_SEMAPHORES #ifdef CH_USE_RT_SEMAPHORES
tp->p_rtcnt = 0; tp->p_rtcnt = 0;
tp->p_bakprio = prio;
#endif #endif
#ifdef CH_USE_WAITEXIT #ifdef CH_USE_WAITEXIT
tp->p_waiting.p_next = (Thread *)&tp->p_waiting; tp->p_waiting.p_next = (Thread *)&tp->p_waiting;

View File

@ -69,6 +69,20 @@ typedef struct {
extern DeltaList dlist; extern DeltaList dlist;
#define chVTDoTickI() \
if (&dlist != (DeltaList *)dlist.dl_next) { \
VirtualTimer *vtp; \
\
--dlist.dl_next->vt_dtime; \
while (!(vtp = dlist.dl_next)->vt_dtime) { \
t_vtfunc fn = vtp->vt_func; \
vtp->vt_func = 0; \
vtp->vt_prev->vt_next = vtp->vt_next; \
vtp->vt_next->vt_prev = vtp->vt_prev; \
fn(vtp->vt_par); \
} \
}
/* /*
* Virtual Timers APIs. * Virtual Timers APIs.
*/ */

View File

@ -104,9 +104,8 @@ struct Thread {
#endif #endif
#ifdef CH_USE_RT_SEMAPHORES #ifdef CH_USE_RT_SEMAPHORES
/** Priority backup after acquiring a RT semaphore.*/ /** Priority backup after acquiring a RT semaphore.*/
t_prio p_bakprio;
/** RT semaphores depth counter.*/ /** RT semaphores depth counter.*/
WORD16 p_rtcnt; int p_rtcnt;
#endif #endif
}; };

View File

@ -40,7 +40,7 @@
typedef BYTE8 t_tmode; typedef BYTE8 t_tmode;
typedef BYTE8 t_tstate; typedef BYTE8 t_tstate;
typedef WORD16 t_prio; typedef LONG32 t_prio;
typedef PTR_EQ t_msg; typedef PTR_EQ t_msg;
typedef LONG32 t_eventid; typedef LONG32 t_eventid;
typedef ULONG32 t_eventmask; typedef ULONG32 t_eventmask;