[PATCH] Updated Legacy code in arm rtl22xx

Vipul Nayyar nayyar_vipul at yahoo.com
Fri Jul 12 11:24:57 UTC 2013


---
 c/src/lib/libbsp/arm/rtl22xx/network/network.c | 37 +++++++++++++++-----------
 c/src/libchip/network/cs8900.c                 |  4 +--
 c/src/libchip/network/cs8900.h                 |  4 +--
 3 files changed, 26 insertions(+), 19 deletions(-)

diff --git a/c/src/lib/libbsp/arm/rtl22xx/network/network.c b/c/src/lib/libbsp/arm/rtl22xx/network/network.c
index 3b54862..77dc3e2 100644
--- a/c/src/lib/libbsp/arm/rtl22xx/network/network.c
+++ b/c/src/lib/libbsp/arm/rtl22xx/network/network.c
@@ -3,24 +3,18 @@
 #include <sys/mbuf.h>
 #include <bsp/irq.h>
 #include <libchip/cs8900.h>
+#include <assert.h>
 
 #define CS8900_BASE 0x20000300
 unsigned int bsp_cs8900_io_base = 0;
 unsigned int bsp_cs8900_memory_base = 0;
-cs8900_device *g_cs;
-void cs8900_isr(rtems_irq_hdl_param unused);
-rtems_irq_connect_data cs8900_isr_data = {LPC22xx_INTERRUPT_EINT2,
-                                         cs8900_isr,
-					  NULL,
-					  NULL,
-					  NULL,
-					  NULL};
+void cs8900_isr(cs8900_device *cs);
 
 char g_enetbuf[1520];
 
-void cs8900_isr(rtems_irq_hdl_param unused)
+void cs8900_isr(cs8900_device *cs)
 {
-    cs8900_interrupt(LPC22xx_INTERRUPT_EINT2, g_cs);
+    cs8900_interrupt(LPC22xx_INTERRUPT_EINT2, cs);
 }
 
 /* cs8900_io_set_reg - set one of the I/O addressed registers */
@@ -67,15 +61,28 @@ unsigned short cs8900_mem_get_reg (cs8900_device *cs, unsigned long reg)
     return cs8900_io_get_reg(cs, CS8900_IO_PP_DATA_PORT0);
 }
 
-void cs8900_attach_interrupt (cs8900_device *cs)
+void cs8900_attach_interrupt (void)
 {
-    g_cs = cs;
-    BSP_install_rtems_irq_handler(&cs8900_isr_data);
+    rtems_status_code status = RTEMS_SUCCESSFUL;
+    status = rtems_interrupt_handler_install(
+        LPC22xx_INTERRUPT_EINT2,
+        "Network",
+        RTEMS_INTERRUPT_UNIQUE,
+        (void *)cs8900_isr,
+        NULL
+    );
+    assert(status == RTEMS_SUCCESSFUL);
 }
 
-void cs8900_detach_interrupt (cs8900_device *cs)
+void cs8900_detach_interrupt (void)
 {
-    BSP_remove_rtems_irq_handler(&cs8900_isr_data);
+    rtems_status_code status = RTEMS_SUCCESSFUL;
+    status = rtems_interrupt_handler_remove(
+        LPC22xx_INTERRUPT_EINT2,
+        (void *)cs8900_isr,
+        NULL
+    );
+    assert(status == RTEMS_SUCCESSFUL);
 }
 
 unsigned short cs8900_get_data_block (cs8900_device *cs, unsigned char *data)
diff --git a/c/src/libchip/network/cs8900.c b/c/src/libchip/network/cs8900.c
index 8cd907e..f5bceac 100644
--- a/c/src/libchip/network/cs8900.c
+++ b/c/src/libchip/network/cs8900.c
@@ -398,7 +398,7 @@ cs8900_hardware_init (cs8900_device *cs)
    * Attach the interrupt handler.
    */
 
-  cs8900_attach_interrupt (cs);
+  cs8900_attach_interrupt ();
 
   /*
    * Program the interrupt level we require then enable interrupts.
@@ -1207,7 +1207,7 @@ cs8900_driver_attach (struct rtems_bsdnet_ifconfig *config, int attaching)
     }
 
     cs8900_stop (cs);
-    cs8900_detach_interrupt (cs);
+    cs8900_detach_interrupt ();
   }
 
   return 1;
diff --git a/c/src/libchip/network/cs8900.h b/c/src/libchip/network/cs8900.h
index 2715d31..692aad4 100644
--- a/c/src/libchip/network/cs8900.h
+++ b/c/src/libchip/network/cs8900.h
@@ -644,7 +644,7 @@ void cs8900_get_mac_addr (cs8900_device *cs, unsigned char *mac_address);
  * @param cs Pointer to the device structure.
  */
 
-void cs8900_attach_interrupt (cs8900_device *cs);
+void cs8900_attach_interrupt (void);
 
 /**
  * Detach the device interrupt.
@@ -654,7 +654,7 @@ void cs8900_attach_interrupt (cs8900_device *cs);
  * @param cs Pointer to the device structure.
  */
 
-void cs8900_detach_interrupt (cs8900_device *cs);
+void cs8900_detach_interrupt (void);
 
 /**
  * Write to an IO space register.
-- 
1.7.11.7




More information about the devel mailing list