This is the mail archive of the ecos-patches@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

at91 serial driver optimization


Here's a little optimization to the at91 serial driver:



diff -ru packages-orig/devs/serial/arm/at91/current/ChangeLog packages/devs/serial/arm/at91/current/ChangeLog
--- packages-orig/devs/serial/arm/at91/current/ChangeLog	2003-11-24 11:51:03.000000000 +0100
+++ packages/devs/serial/arm/at91/current/ChangeLog	2004-01-16 11:26:01.000000000 +0100
@@ -1,3 +1,9 @@
+2004-01-16  Thomas Koeller  <thomas.koeller@baslerweb.com>
+
+	* src/at91_serial.c: If both a transmitter and a receiver
+	interrupt arrive at the same time, process the receiver
+	interrupt first.
+
 2003-11-21  Thomas Koeller  <thomas.koeller@baslerweb.com>
 
 	* src/at91_serial.c: Fix endless loop that would occur if
diff -ru packages-orig/devs/serial/arm/at91/current/src/at91_serial.c packages/devs/serial/arm/at91/current/src/at91_serial.c
--- packages-orig/devs/serial/arm/at91/current/src/at91_serial.c	2003-11-24 11:51:03.000000000 +0100
+++ packages/devs/serial/arm/at91/current/src/at91_serial.c	2004-01-14 20:18:36.000000000 +0100
@@ -485,37 +485,6 @@
     at91_chan->stat = 0;
     cyg_drv_interrupt_unmask(vector);    
 
-    if (stat & AT91_US_IER_TxRDY) {
-        at91_chan->flags &= ~SIFLG_XMIT_BUSY;
-        (chan->callbacks->xmt_char)(chan);
-        if (at91_chan->flags & SIFLG_XMIT_CONTINUE)
-            HAL_WRITE_UINT32(base + AT91_US_IER, AT91_US_IER_TxRDY);
-    }
-    
-    if (stat & AT91_US_IER_ENDTX) {
-        (chan->callbacks->data_xmt_done)(chan, at91_chan->transmit_size);
-        if (at91_chan->flags & SIFLG_XMIT_CONTINUE) {
-            unsigned char * chars;
-            xmt_req_reply_t res;
-
-            res = (chan->callbacks->data_xmt_req)(chan, 0xffff, &at91_chan->transmit_size, &chars);
-
-            switch (res)
-            {
-                case CYG_XMT_OK:
-                    HAL_WRITE_UINT32(base + AT91_US_TPR, (CYG_WORD32) chars);
-                    HAL_WRITE_UINT32(base + AT91_US_TCR, at91_chan->transmit_size);
-                    at91_chan->flags |= SIFLG_XMIT_CONTINUE;
-                    HAL_WRITE_UINT32(base + AT91_US_IER, AT91_US_IER_ENDTX);
-                    break;
-                default:
-                    // No data or unknown error - can't do anything about it
-                    // CYG_XMT_DISABLED should not happen here!
-                    break;
-            }
-        }
-    }
-
     if (stat & (AT91_US_IER_ENDRX | AT91_US_IER_TIMEOUT)) {
         const cyg_uint8 cb = at91_chan->curbuf, nb = cb ^ 0x01;
         const cyg_uint8 * p = at91_chan->rcv_buffer[cb], * end;
@@ -531,7 +500,7 @@
             base + AT91_US_IER,
             AT91_US_IER_ENDRX | AT91_US_IER_TIMEOUT
         );
-        
+
         while (p < end) {
             rcv_req_reply_t res;
             int space_avail;
@@ -563,5 +532,36 @@
             }
         }
     }
+
+    if (stat & AT91_US_IER_TxRDY) {
+        at91_chan->flags &= ~SIFLG_XMIT_BUSY;
+        (chan->callbacks->xmt_char)(chan);
+        if (at91_chan->flags & SIFLG_XMIT_CONTINUE)
+            HAL_WRITE_UINT32(base + AT91_US_IER, AT91_US_IER_TxRDY);
+    }
+    
+    if (stat & AT91_US_IER_ENDTX) {
+        (chan->callbacks->data_xmt_done)(chan, at91_chan->transmit_size);
+        if (at91_chan->flags & SIFLG_XMIT_CONTINUE) {
+            unsigned char * chars;
+            xmt_req_reply_t res;
+
+            res = (chan->callbacks->data_xmt_req)(chan, 0xffff, &at91_chan->transmit_size, &chars);
+
+            switch (res)
+            {
+                case CYG_XMT_OK:
+                    HAL_WRITE_UINT32(base + AT91_US_TPR, (CYG_WORD32) chars);
+                    HAL_WRITE_UINT32(base + AT91_US_TCR, at91_chan->transmit_size);
+                    at91_chan->flags |= SIFLG_XMIT_CONTINUE;
+                    HAL_WRITE_UINT32(base + AT91_US_IER, AT91_US_IER_ENDTX);
+                    break;
+                default:
+                    // No data or unknown error - can't do anything about it
+                    // CYG_XMT_DISABLED should not happen here!
+                    break;
+            }
+        }
+    }
 }
 #endif

-- 
--------------------------------------------------

Thomas Koeller, Software Development

Basler Vision Technologies
An der Strusbek 60-62
22926 Ahrensburg
Germany

Tel +49 (4102) 463-162
Fax +49 (4102) 463-239

mailto:thomas.koeller@baslerweb.com
http://www.baslerweb.com

==============================


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]