aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ports/ARM7-LPC214x/GCC/lpc214x_serial.c4
-rw-r--r--readme.txt30
-rw-r--r--src/chevents.c52
-rw-r--r--src/chinit.c6
-rw-r--r--src/chmsg.c10
-rw-r--r--src/chsem.c19
-rw-r--r--src/chsleep.c2
-rw-r--r--src/chthreads.c4
8 files changed, 69 insertions, 58 deletions
diff --git a/ports/ARM7-LPC214x/GCC/lpc214x_serial.c b/ports/ARM7-LPC214x/GCC/lpc214x_serial.c
index 523b93257..6ed0a97b0 100644
--- a/ports/ARM7-LPC214x/GCC/lpc214x_serial.c
+++ b/ports/ARM7-LPC214x/GCC/lpc214x_serial.c
@@ -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:
{
diff --git a/readme.txt b/readme.txt
index 528e0921d..375932bf1 100644
--- a/readme.txt
+++ b/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
diff --git a/src/chevents.c b/src/chevents.c
index 13f20310d..f8d7d971f 100644
--- a/src/chevents.c
+++ b/src/chevents.c
@@ -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 */
diff --git a/src/chinit.c b/src/chinit.c
index 918da1796..b1b6bd7d1 100644
--- a/src/chinit.c
+++ b/src/chinit.c
@@ -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);
}
diff --git a/src/chmsg.c b/src/chmsg.c
index 51675e0fe..844628d75 100644
--- a/src/chmsg.c
+++ b/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);
diff --git a/src/chsem.c b/src/chsem.c
index df783dc7a..61fff37a1 100644
--- a/src/chsem.c
+++ b/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;
}
/**
diff --git a/src/chsleep.c b/src/chsleep.c
index ae6e394b8..3abf22cd2 100644
--- a/src/chsleep.c
+++ b/src/chsleep.c
@@ -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);
}
diff --git a/src/chthreads.c b/src/chthreads.c
index a0729311f..041690af9 100644
--- a/src/chthreads.c
+++ b/src/chthreads.c
@@ -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;