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