[PATCH] Updated Legacy code in arm edb7312

Vipul Nayyar nayyar_vipul at yahoo.com
Wed Jul 10 14:52:28 UTC 2013


---
 c/src/lib/libbsp/arm/edb7312/clock/clockdrv.c  | 49 +++++++++++---------------
 c/src/lib/libbsp/arm/edb7312/network/network.c | 27 +++++++++-----
 2 files changed, 39 insertions(+), 37 deletions(-)

diff --git a/c/src/lib/libbsp/arm/edb7312/clock/clockdrv.c b/c/src/lib/libbsp/arm/edb7312/clock/clockdrv.c
index bd77dd6..af0448ff7 100644
--- a/c/src/lib/libbsp/arm/edb7312/clock/clockdrv.c
+++ b/c/src/lib/libbsp/arm/edb7312/clock/clockdrv.c
@@ -12,24 +12,14 @@
 #include <ep7312.h>
 #include <bsp.h>
 #include <bsp/irq.h>
+#include <assert.h>
 
 #if ON_SKYEYE==1
   #define CLOCK_DRIVER_USE_FAST_IDLE
 #endif
 
 void Clock_isr(rtems_irq_hdl_param arg);
-static void clock_isr_on(const rtems_irq_connect_data *unused);
-static void clock_isr_off(const rtems_irq_connect_data *unused);
-static int clock_isr_is_on(const rtems_irq_connect_data *irq);
-
-rtems_irq_connect_data clock_isr_data = {
-  .name   = BSP_TC1OI,
-  .hdl    = Clock_isr,
-  .handle = NULL,
-  .on     = clock_isr_on,
-  .off    = clock_isr_off,
-  .isOn   = clock_isr_is_on,
-};
+uint32_t clock_driver_get_nanoseconds_since_last_tick(void);
 
 #define Clock_driver_support_at_tick()                \
   do {                                                \
@@ -38,8 +28,16 @@ rtems_irq_connect_data clock_isr_data = {
 
 #define Clock_driver_support_install_isr( _new, _old ) \
   do {                                                 \
+    rtems_status_code status = RTEMS_SUCCESSFUL;       \
     (_old) = NULL; /* avoid warning */;                \
-    BSP_install_rtems_irq_handler(&clock_isr_data);    \
+    status = rtems_interrupt_handler_install(          \
+        BSP_TC1OI,                                     \
+        "Clock",                                       \
+        RTEMS_INTERRUPT_UNIQUE,                        \
+        Clock_isr,                                     \
+        NULL                                           \
+    );                                                 \
+    assert(status == RTEMS_SUCCESSFUL);                \
   } while(0)
 
 /*
@@ -60,9 +58,15 @@ rtems_irq_connect_data clock_isr_data = {
     *EP7312_TC1EOI = 0xFFFFFFFF;                    \
   } while (0)
 
-#define Clock_driver_support_shutdown_hardware()                        \
-  do {                                                                  \
-    BSP_remove_rtems_irq_handler(&clock_isr_data);                  \
+#define Clock_driver_support_shutdown_hardware()    \
+  do {                                              \
+    rtems_status_code status = RTEMS_SUCCESSFUL;    \
+    status = rtems_interrupt_handler_remove(        \
+        BSP_TC1OI,                                  \
+        Clock_isr,                                  \
+        NULL                                        \
+    );                                              \
+    assert(status == RTEMS_SUCCESSFUL);             \
   } while (0)
 
 /**
@@ -76,17 +80,4 @@ uint32_t clock_driver_get_nanoseconds_since_last_tick(void)
 #define Clock_driver_nanoseconds_since_last_tick \
   clock_driver_get_nanoseconds_since_last_tick
 
-static void clock_isr_on(const rtems_irq_connect_data *unused)
-{
-}
-
-static void clock_isr_off(const rtems_irq_connect_data *unused)
-{
-}
-
-static int clock_isr_is_on(const rtems_irq_connect_data *irq)
-{
-  return 1;
-}
-
 #include "../../../shared/clockdrv_shell.h"
diff --git a/c/src/lib/libbsp/arm/edb7312/network/network.c b/c/src/lib/libbsp/arm/edb7312/network/network.c
index 1db4d02..ce139ec 100644
--- a/c/src/lib/libbsp/arm/edb7312/network/network.c
+++ b/c/src/lib/libbsp/arm/edb7312/network/network.c
@@ -2,18 +2,13 @@
 #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 = {BSP_EINT3,
-					  cs8900_isr,
-					  NULL,
-					  NULL,
-					  NULL,
-					  NULL};
 
 char g_enetbuf[1520];
 
@@ -68,13 +63,29 @@ unsigned short cs8900_mem_get_reg (cs8900_device *cs, unsigned long reg)
 
 void cs8900_attach_interrupt (cs8900_device *cs)
 {
+    rtems_status_code status = RTEMS_SUCCESSFUL;
     g_cs = cs;
-    BSP_install_rtems_irq_handler(&cs8900_isr_data);
+
+    status = rtems_interrupt_handler_install(
+        BSP_EINT3,
+        "Network",
+        RTEMS_INTERRUPT_UNIQUE,
+        cs8900_isr,
+        NULL
+    );
+    assert(status == RTEMS_SUCCESSFUL);
 }
 
 void cs8900_detach_interrupt (cs8900_device *cs)
 {
-    BSP_remove_rtems_irq_handler(&cs8900_isr_data);
+    rtems_status_code status = RTEMS_SUCCESSFUL;
+
+    status = rtems_interrupt_handler_remove(
+        BSP_EINT3,
+        cs8900_isr,
+        NULL
+    );
+    assert(status == RTEMS_SUCCESSFUL);
 }
 
 unsigned short cs8900_get_data_block (cs8900_device *cs, unsigned char *data)
-- 
1.7.11.7




More information about the devel mailing list