git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@114 35acf78f-673a-0410-8e92-d51de3d6d3f4
parent
f09b563504
commit
a62cb84475
|
@ -62,7 +62,9 @@ static void ServeInterrupt(UART *u, FullDuplexDriver *com) {
|
|||
case IIR_SRC_TIMEOUT:
|
||||
case IIR_SRC_RX:
|
||||
while (u->UART_LSR & LSR_RBR_FULL)
|
||||
chFDDIncomingDataI(com, u->UART_RBR);
|
||||
if (chIQPutI(&com->sd_iqueue, u->UART_RBR) < Q_OK)
|
||||
chFDDAddFlagsI(com, SD_OVERRUN_ERROR);
|
||||
chEvtSendI(&com->sd_ievent);
|
||||
break;
|
||||
case IIR_SRC_TX:
|
||||
{
|
||||
|
|
30
readme.txt
30
readme.txt
|
@ -23,21 +23,31 @@
|
|||
|
||||
Current ports under ./demos:
|
||||
|
||||
Win32-MinGW - ChibiOS/RT simulator and demo into a WIN32 process,
|
||||
MinGW version.
|
||||
Win32-MSVS - ChibiOS/RT simulator and demo into a WIN32 process,
|
||||
Visual Studio 7 or any later version should work.
|
||||
ARM7-LPC214x-GCC - ChibiOS/RT port for ARM7 LPC2148, the demo targets the
|
||||
Olimex LPC-P2148 board. This port can be easily modified
|
||||
for any processor into the LPC2000 family or other
|
||||
boards. The demo can be compiled using YAGARTO or any
|
||||
other GCC-based ARM toolchain. Full demo.
|
||||
AVR-AT90CANx-GCC - Port on AVR AT90CAN128, not complete yet.
|
||||
Win32-MinGW - ChibiOS/RT simulator and demo into a WIN32 process,
|
||||
MinGW version.
|
||||
Win32-MSVS - ChibiOS/RT simulator and demo into a WIN32 process,
|
||||
Visual Studio 7 or any later version should work.
|
||||
ARM7-LPC214x-GCC - ChibiOS/RT port for ARM7 LPC2148, the demo targets the
|
||||
Olimex LPC-P2148 board. This port can be easily
|
||||
modified for any processor into the LPC2000 family or
|
||||
other boards. The demo can be compiled using YAGARTO
|
||||
or any other GCC-based ARM toolchain. Full demo.
|
||||
ARM7-LPC214x-GCC-min - Minimal demo for LPC214X.
|
||||
AVR-AT90CANx-GCC - Port on AVR AT90CAN128, not complete yet.
|
||||
|
||||
*****************************************************************************
|
||||
*** Releases ***
|
||||
*****************************************************************************
|
||||
|
||||
*** 0.4.3 ***
|
||||
- Minor improvement in the LPC214x serial driver, unneeded events were
|
||||
generated.
|
||||
- Size optimization in the events code, now the chEvtWait() reuses the
|
||||
chEvtWaitTimeout() code if it is enabled.
|
||||
- Size optimization in the semaphores code, now the chSemWaitTimeout() just
|
||||
invokes the chSemWaitTimeoutS() inside its system mutex zone.
|
||||
- Fixed a chSysInit() documentation error.
|
||||
|
||||
*** 0.4.2 ***
|
||||
- Added a minimal ARM7-LPC demo, you can use this one as template in order to
|
||||
create your application. It is easier to add subsystems back to the small
|
||||
|
|
|
@ -119,6 +119,7 @@ void chEvtSendI(EventSource *esp) {
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef CH_USE_EVENTS_TIMEOUT
|
||||
/**
|
||||
* The function waits for an event and returns the event identifier, if an
|
||||
* event handler is specified then the handler is executed before returning.
|
||||
|
@ -137,33 +138,14 @@ void chEvtSendI(EventSource *esp) {
|
|||
*/
|
||||
t_eventid chEvtWait(t_eventmask ewmask,
|
||||
const t_evhandler handlers[]) {
|
||||
t_eventid i;
|
||||
t_eventmask m;
|
||||
|
||||
chSysLock();
|
||||
|
||||
if ((currp->p_epending & ewmask) == 0) {
|
||||
currp->p_ewmask = ewmask;
|
||||
chSchGoSleepS(PRWTEVENT);
|
||||
}
|
||||
i = 0, m = 1;
|
||||
while ((currp->p_epending & ewmask & m) == 0)
|
||||
i += 1, m <<= 1;
|
||||
currp->p_epending &= ~m;
|
||||
|
||||
chSysUnlock();
|
||||
|
||||
if (handlers && handlers[i])
|
||||
handlers[i](i);
|
||||
|
||||
return i;
|
||||
return chEvtWaitTimeout(ewmask, handlers, TIME_INFINITE);
|
||||
}
|
||||
|
||||
#ifdef CH_USE_EVENTS_TIMEOUT
|
||||
static void wakeup(void *p) {
|
||||
#ifdef CH_USE_DEBUG
|
||||
if (((Thread *)p)->p_state != PRWTEVENT)
|
||||
chDbgPanic("chevents.c, wakeup()\r\n");
|
||||
chDbgPanic("chevents.c, wakeup()");
|
||||
#endif
|
||||
chSchReadyI(p, RDY_TIMEOUT);
|
||||
}
|
||||
|
@ -223,7 +205,33 @@ t_eventid chEvtWaitTimeout(t_eventmask ewmask,
|
|||
|
||||
return i;
|
||||
}
|
||||
#endif /*CH_USE_EVENTS_TIMEOUT */
|
||||
|
||||
#else /* !CH_USE_EVENTS_TIMEOUT */
|
||||
t_eventid chEvtWait(t_eventmask ewmask,
|
||||
const t_evhandler handlers[]) {
|
||||
t_eventid i;
|
||||
t_eventmask m;
|
||||
|
||||
chSysLock();
|
||||
|
||||
if ((currp->p_epending & ewmask) == 0) {
|
||||
currp->p_ewmask = ewmask;
|
||||
chSchGoSleepS(PRWTEVENT);
|
||||
}
|
||||
i = 0, m = 1;
|
||||
while ((currp->p_epending & ewmask & m) == 0)
|
||||
i += 1, m <<= 1;
|
||||
currp->p_epending &= ~m;
|
||||
|
||||
chSysUnlock();
|
||||
|
||||
if (handlers && handlers[i])
|
||||
handlers[i](i);
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
#endif /* CH_USE_EVENTS_TIMEOUT */
|
||||
|
||||
#endif /* CH_USE_EVENTS */
|
||||
|
||||
|
|
|
@ -53,10 +53,8 @@ void chSysInit(void) {
|
|||
/*
|
||||
* The idle thread is created using the port-provided implementation.
|
||||
* This thread has the lowest priority in the system, its role is just to
|
||||
* execute the chSysPause() and serve interrupts in its context.
|
||||
* In ChibiOS/RT at least one thread in the system *must* execute
|
||||
* chThdPause(), it can be done in a dedicated thread or in the main()
|
||||
* function (that would never exit the call).
|
||||
* serve interrupts in its context while keeping the lowest energy saving
|
||||
* mode compatible with the system status.
|
||||
*/
|
||||
chThdCreate(IDLEPRIO, 0, waIdleThread, sizeof(waIdleThread), (t_tfunc)_IdleThread, NULL);
|
||||
}
|
||||
|
|
10
src/chmsg.c
10
src/chmsg.c
|
@ -67,8 +67,10 @@ t_msg chMsgSendWithEvent(Thread *tp, t_msg msg, EventSource *esp) {
|
|||
chSysLock();
|
||||
|
||||
fifo_insert(currp, &tp->p_msgqueue);
|
||||
// if (tp->p_state == PRWTMSG)
|
||||
// chSchReadyI(tp, RDY_OK);
|
||||
#ifdef CH_USE_DEBUG
|
||||
if (tp->p_state == PRWTMSG)
|
||||
chDbgPanic("chmsg.c, chMsgSendWithEvent()");
|
||||
#endif
|
||||
chEvtSendI(esp);
|
||||
currp->p_msg = msg;
|
||||
chSchGoSleepS(PRSNDMSG);
|
||||
|
@ -84,7 +86,7 @@ static void wakeup(void *p) {
|
|||
|
||||
#ifdef CH_USE_DEBUG
|
||||
if (((Thread *)p)->p_state != PRSNDMSG)
|
||||
chDbgPanic("chmsg.c, wakeup()\r\n");
|
||||
chDbgPanic("chmsg.c, wakeup()");
|
||||
#endif
|
||||
chSchReadyI(dequeue(p), RDY_TIMEOUT);
|
||||
}
|
||||
|
@ -186,7 +188,7 @@ void chMsgRelease(t_msg msg) {
|
|||
|
||||
#ifdef CH_USE_DEBUG
|
||||
if (!chMsgIsPendingI(currp))
|
||||
chDbgPanic("chmsg.c, chMsgRelease()\r\n");
|
||||
chDbgPanic("chmsg.c, chMsgRelease()");
|
||||
#endif
|
||||
chSchWakeupS(fifo_remove(&currp->p_msgqueue), msg);
|
||||
|
||||
|
|
19
src/chsem.c
19
src/chsem.c
|
@ -116,7 +116,7 @@ static void wakeup(void *p) {
|
|||
|
||||
#ifdef CH_USE_DEBUG
|
||||
if (((Thread *)p)->p_state != PRWTSEM)
|
||||
chDbgPanic("chsem.c, wakeup()\r\n");
|
||||
chDbgPanic("chsem.c, wakeup()");
|
||||
#endif
|
||||
chSemFastSignalI(((Thread *)p)->p_semp);
|
||||
chSchReadyI(dequeue(p), RDY_TIMEOUT);
|
||||
|
@ -133,23 +133,10 @@ t_msg chSemWaitTimeout(Semaphore *sp, t_time time) {
|
|||
|
||||
chSysLock();
|
||||
|
||||
if (--sp->s_cnt < 0) {
|
||||
VirtualTimer vt;
|
||||
|
||||
chVTSetI(&vt, time, wakeup, currp);
|
||||
fifo_insert(currp, &sp->s_queue);
|
||||
currp->p_semp = sp;
|
||||
chSchGoSleepS(PRWTSEM);
|
||||
msg = currp->p_rdymsg;
|
||||
if (chVTIsArmedI(&vt))
|
||||
chVTResetI(&vt);
|
||||
|
||||
chSysUnlock();
|
||||
return msg;
|
||||
}
|
||||
msg = chSemWaitTimeoutS(sp, time);
|
||||
|
||||
chSysUnlock();
|
||||
return RDY_OK;
|
||||
return msg;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -29,7 +29,7 @@ static void wakeup(void *p) {
|
|||
|
||||
#ifdef CH_USE_DEBUG
|
||||
if (((Thread *)p)->p_state != PRSLEEP)
|
||||
chDbgPanic("chsleep.c, wakeup()\r\n");
|
||||
chDbgPanic("chsleep.c, wakeup()");
|
||||
#endif
|
||||
chSchReadyI(p, RDY_OK);
|
||||
}
|
||||
|
|
|
@ -139,6 +139,10 @@ void chThdSuspend(Thread **tpp) {
|
|||
|
||||
chSysLock();
|
||||
|
||||
#ifdef CH_USE_DEBUG
|
||||
if (*tpp)
|
||||
chDbgPanic("chthreads.c, chThdSuspend()");
|
||||
#endif
|
||||
*tpp = currp;
|
||||
chSchGoSleepS(PRSUSPENDED);
|
||||
*tpp = NULL;
|
||||
|
|
Loading…
Reference in New Issue