diff options
author | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2008-02-21 13:31:30 +0000 |
---|---|---|
committer | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2008-02-21 13:31:30 +0000 |
commit | 05c3be1b2c214a8dd8dcb47c5a615fb1b6406719 (patch) | |
tree | 1c73ffe378b22989fcc81bd09a3c5a6f4abce0c9 /ports | |
parent | f87e32d85c6fc2b400c4dc8db15af1cb4c626907 (diff) | |
download | ChibiOS-05c3be1b2c214a8dd8dcb47c5a615fb1b6406719.tar.gz ChibiOS-05c3be1b2c214a8dd8dcb47c5a615fb1b6406719.tar.bz2 ChibiOS-05c3be1b2c214a8dd8dcb47c5a615fb1b6406719.zip |
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@198 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'ports')
-rw-r--r-- | ports/ARM7-AT91SAM7X/GCC/sam7x_serial.c | 37 |
1 files changed, 16 insertions, 21 deletions
diff --git a/ports/ARM7-AT91SAM7X/GCC/sam7x_serial.c b/ports/ARM7-AT91SAM7X/GCC/sam7x_serial.c index e7a882cb7..2c03511c6 100644 --- a/ports/ARM7-AT91SAM7X/GCC/sam7x_serial.c +++ b/ports/ARM7-AT91SAM7X/GCC/sam7x_serial.c @@ -24,12 +24,12 @@ #include "at91lib/aic.h"
FullDuplexDriver COM1;
-BYTE8 ib1[SERIAL_BUFFERS_SIZE];
-BYTE8 ob1[SERIAL_BUFFERS_SIZE];
+static BYTE8 ib1[SERIAL_BUFFERS_SIZE];
+static BYTE8 ob1[SERIAL_BUFFERS_SIZE];
FullDuplexDriver COM2;
-BYTE8 ib2[SERIAL_BUFFERS_SIZE];
-BYTE8 ob2[SERIAL_BUFFERS_SIZE];
+static BYTE8 ib2[SERIAL_BUFFERS_SIZE];
+static BYTE8 ob2[SERIAL_BUFFERS_SIZE];
static void SetError(AT91_REG csr, FullDuplexDriver *com) {
UWORD16 sts = 0;
@@ -46,27 +46,22 @@ static void SetError(AT91_REG csr, FullDuplexDriver *com) { }
/*
- * Tries hard to clear all the pending interrupt sources, we dont want to
- * go through the whole ISR and have another interrupt soon after.
+ * Serves the pending sources on the USART.
*/
static void ServeInterrupt(AT91PS_USART u, FullDuplexDriver *com) {
- while (u->US_CSR & u->US_IMR) {
-
- if (u->US_CSR & AT91C_US_RXRDY) {
+ if (u->US_CSR & AT91C_US_RXRDY)
chFDDIncomingDataI(com, u->US_RHR);
- }
- else if (u->US_CSR & AT91C_US_TXRDY) {
- t_msg b = chFDDRequestDataI(com);
- if (b < Q_OK)
- u->US_IDR = AT91C_US_TXRDY;
- else
- u->US_THR = b;
- }
- else {
- SetError(u->US_CSR, com);
- u->US_CR = AT91C_US_RSTSTA;
- }
+ if (u->US_CSR & AT91C_US_TXRDY) {
+ t_msg b = chFDDRequestDataI(com);
+ if (b < Q_OK)
+ u->US_IDR = AT91C_US_TXRDY;
+ else
+ u->US_THR = b;
+ }
+ if (u->US_CSR & (AT91C_US_OVRE | AT91C_US_FRAME | AT91C_US_PARE | AT91C_US_RXBRK)) {
+ SetError(u->US_CSR, com);
+ u->US_CR = AT91C_US_RSTSTA;
}
}
|