changeset 1377:7f0a2973835c

Remove direct calls to cyg_interrupt_enable/disable
author gthomas
date Fri, 21 Nov 2003 17:31:40 +0000
parents acb537d1d1d8
children 0c616bec0b15
files packages/devs/eth/rltk/8139/current/ChangeLog packages/devs/eth/rltk/8139/current/src/if_8139.c
diffstat 2 files changed, 15 insertions(+), 25 deletions(-) [+]
line wrap: on
line diff
--- a/packages/devs/eth/rltk/8139/current/ChangeLog
+++ b/packages/devs/eth/rltk/8139/current/ChangeLog
@@ -1,3 +1,9 @@
+2003-11-21  Gary Thomas  <gary@mlbassoc.com>
+
+	* src/if_8139.c: Use cyg_drv_isr_lock/unlock functions for ISR
+	critical sections - much better than calling cyg_interrupt_enable
+	directly.
+
 2003-07-09  Eric Doenges <Eric.Doenges@DynaPel.com>
 
 	* src/if_8139.h: 
--- a/packages/devs/eth/rltk/8139/current/src/if_8139.c
+++ b/packages/devs/eth/rltk/8139/current/src/if_8139.c
@@ -870,7 +870,6 @@ rltk8139_send(struct eth_drv_sc *sc, str
   struct eth_drv_sg *last_sg;
   int desc;
 
-
   rltk8139_info = (Rltk8139_t *)(sc->driver_private);
 
 #ifdef DEBUG_RLTK8139_DRIVER
@@ -890,18 +889,14 @@ rltk8139_send(struct eth_drv_sc *sc, str
    * _really_ mean it, i.e. you _must_ use descriptor #1 after descriptor
    * #0 even if transmission of descriptor #0 has already completed.
    */
-#ifndef CYGPKG_IO_ETH_DRIVERS_STAND_ALONE
-  cyg_interrupt_disable();
-#endif
+  cyg_drv_isr_lock();
 
   /*
    * Sanity check to see if '_send' was called even though there is no free
    * descriptor. This is probably unnecessary.
    */
   if (rltk8139_info->tx_num_free_desc == 0) {
-#ifndef CYGPKG_IO_ETH_DRIVERS_STAND_ALONE
-    cyg_interrupt_enable();
-#endif
+      cyg_drv_isr_unlock();
 #ifdef DEBUG_RLTK8139_DRIVER
     diag_printf("rltk8139_send(%s): no free descriptor available\n",
                 sc->dev_name);
@@ -920,10 +915,8 @@ rltk8139_send(struct eth_drv_sc *sc, str
   /* Decrement the number of free descriptors */
   rltk8139_info->tx_num_free_desc -= 1;
 
-#ifndef CYGPKG_IO_ETH_DRIVERS_STAND_ALONE
   /* Reenable interrupts at this point */
-  cyg_interrupt_enable();
-#endif
+  cyg_drv_isr_unlock();
 
   /*
    * Determine the buffer memory to use and tell the hardware about it.
@@ -1064,24 +1057,19 @@ rltk8139_deliver(struct eth_drv_sc *sc)
      * want to be interrupted at this point.
      */
     while (1) {
-#ifndef CYGPKG_IO_ETH_DRIVERS_STAND_ALONE
-      cyg_interrupt_disable();
-#endif
+      cyg_drv_isr_lock();
 
       /* Check if all descriptors are ready, in which case we are done. */
       if (rltk8139_info->tx_num_free_desc >= NUM_TX_DESC) {
-#ifndef CYGPKG_IO_ETH_DRIVERS_STAND_ALONE
-        cyg_interrupt_enable();
-#endif
+          cyg_drv_isr_unlock();
         break;
       }
 
       desc = (rltk8139_info->tx_free_desc
               - (NUM_TX_DESC - rltk8139_info->tx_num_free_desc))
         & (NUM_TX_DESC - 1);
-#ifndef CYGPKG_IO_ETH_DRIVERS_STAND_ALONE
-      cyg_interrupt_enable();
-#endif
+      cyg_drv_isr_unlock();
+
       /* Get the current status of the descriptor */
       tsd = INL(rltk8139_info->base_address + TSD0 + (desc<<2));
 
@@ -1130,13 +1118,9 @@ rltk8139_deliver(struct eth_drv_sc *sc)
        * Increment the free descriptor count and go through the loop again
        * to see if more descriptors are ready.
        */
-#ifndef CYGPKG_IO_ETH_DRIVERS_STAND_ALONE
-      cyg_interrupt_disable();
-#endif
+      cyg_drv_isr_lock();
       rltk8139_info->tx_num_free_desc += 1;
-#ifndef CYGPKG_IO_ETH_DRIVERS_STAND_ALONE
-      cyg_interrupt_enable();
-#endif
+      cyg_drv_isr_unlock();
     }
   }