aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2007-10-24 13:33:36 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2007-10-24 13:33:36 +0000
commit50c4097379658f404fa4124d0b1ca3b3330aeaf2 (patch)
treee8dc6eadca55f3c254e2f69f9c4d2e0bfe9d2766
parent81a6458087801c73384f6d03eace650d0ea90828 (diff)
downloadChibiOS-50c4097379658f404fa4124d0b1ca3b3330aeaf2.tar.gz
ChibiOS-50c4097379658f404fa4124d0b1ca3b3330aeaf2.tar.bz2
ChibiOS-50c4097379658f404fa4124d0b1ca3b3330aeaf2.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@63 35acf78f-673a-0410-8e92-d51de3d6d3f4
-rw-r--r--ports/ARM7-LPC214x/GCC/lpc214x_serial.c66
1 files changed, 35 insertions, 31 deletions
diff --git a/ports/ARM7-LPC214x/GCC/lpc214x_serial.c b/ports/ARM7-LPC214x/GCC/lpc214x_serial.c
index 71dbc0b7b..296c725ee 100644
--- a/ports/ARM7-LPC214x/GCC/lpc214x_serial.c
+++ b/ports/ARM7-LPC214x/GCC/lpc214x_serial.c
@@ -67,16 +67,16 @@ static void ServeInterrupt(UART *u, FullDuplexDriver *com) {
case IIR_SRC_TX:
{
#ifdef FIFO_PRELOAD
- int i = 0;
- while (i < FIFO_PRELOAD) {
- t_msg b = chFDDRequestDataI(com);
+ int i = FIFO_PRELOAD;
+ do {
+ t_msg b = chOQGetI(&com->sd_oqueue);
if (b < Q_OK) {
u->UART_IER &= ~IER_THRE;
+ chEvtSendI(&com->sd_oevent);
break;
}
u->UART_THR = b;
- i++;
- }
+ } while (--i);
#else
t_msg b = chFDDRequestDataI(com);
if (b < Q_OK)
@@ -92,6 +92,16 @@ static void ServeInterrupt(UART *u, FullDuplexDriver *com) {
}
}
+void UART0Irq(void) {
+
+ ServeInterrupt(U0Base, &COM1);
+}
+
+void UART1Irq(void) {
+
+ ServeInterrupt(U1Base, &COM2);
+}
+
/*
* Invoked by the high driver when one or more bytes are inserted in the
* output queue.
@@ -99,20 +109,22 @@ static void ServeInterrupt(UART *u, FullDuplexDriver *com) {
static void OutNotify1(void) {
UART *u = U0Base;
- if (u->UART_LSR & LSR_THRE) {
#ifdef FIFO_PRELOAD
- int i = 0;
- while (i < FIFO_PRELOAD) {
+ if (u->UART_LSR & LSR_THRE) {
+ int i = FIFO_PRELOAD;
+ do {
t_msg b = chOQGetI(&COM1.sd_oqueue);
- if (b < Q_OK)
- break;
+ if (b < Q_OK) {
+ chEvtSendI(&COM1.sd_oevent);
+ return;
+ }
u->UART_THR = b;
- i++;
- }
+ } while (--i);
+ }
#else
+ if (u->UART_LSR & LSR_THRE)
u->UART_THR = chOQGetI(&COM1.sd_oqueue);
#endif
- }
u->UART_IER |= IER_THRE;
}
@@ -123,33 +135,25 @@ static void OutNotify1(void) {
static void OutNotify2(void) {
UART *u = U1Base;
- if (u->UART_LSR & LSR_THRE) {
#ifdef FIFO_PRELOAD
- int i = 0;
- while (i < FIFO_PRELOAD) {
+ if (u->UART_LSR & LSR_THRE) {
+ int i = FIFO_PRELOAD;
+ do {
t_msg b = chOQGetI(&COM2.sd_oqueue);
- if (b < Q_OK)
- break;
+ if (b < Q_OK) {
+ chEvtSendI(&COM2.sd_oevent);
+ return;
+ }
u->UART_THR = b;
- i++;
- }
+ } while (--i);
+ }
#else
+ if (u->UART_LSR & LSR_THRE)
u->UART_THR = chOQGetI(&COM2.sd_oqueue);
#endif
- }
u->UART_IER |= IER_THRE;
}
-void UART0Irq(void) {
-
- ServeInterrupt(U0Base, &COM1);
-}
-
-void UART1Irq(void) {
-
- ServeInterrupt(U1Base, &COM2);
-}
-
/*
* UART setup, must be invoked with interrupts disabled.
*/