[rtems commit] bsp/csb337: Use IRQ extensions API

Sebastian Huber sebh at rtems.org
Sun Jul 7 12:56:07 UTC 2013


Module:    rtems
Branch:    master
Commit:    6886a485301330b1347b89432b2c49287dc41010
Changeset: http://git.rtems.org/rtems/commit/?id=6886a485301330b1347b89432b2c49287dc41010

Author:    Vipul Nayyar <nayyar_vipul at yahoo.com>
Date:      Sun Jul  7 15:00:45 2013 +0200

bsp/csb337: Use IRQ extensions API

Fix warnings.

---

 c/src/lib/libbsp/arm/csb337/network/network.c |   53 ++++++++-----------------
 1 files changed, 17 insertions(+), 36 deletions(-)

diff --git a/c/src/lib/libbsp/arm/csb337/network/network.c b/c/src/lib/libbsp/arm/csb337/network/network.c
index e31bcc0..9e0a4be 100644
--- a/c/src/lib/libbsp/arm/csb337/network/network.c
+++ b/c/src/lib/libbsp/arm/csb337/network/network.c
@@ -22,6 +22,7 @@
 
 #include <errno.h>
 #include <rtems/error.h>
+#include <assert.h>
 
 #include <sys/param.h>
 #include <sys/mbuf.h>
@@ -83,20 +84,7 @@
   #define START_TRANSMIT_EVENT    RTEMS_EVENT_2
 
 static void at91rm9200_emac_isr (rtems_irq_hdl_param unused);
-static void at91rm9200_emac_isr_on(const rtems_irq_connect_data *unused);
-static void at91rm9200_emac_isr_off(const rtems_irq_connect_data *unused);
-static int at91rm9200_emac_isr_is_on(const rtems_irq_connect_data *irq);
-
-/* Replace the first value with the clock's interrupt name. */
-rtems_irq_connect_data at91rm9200_emac_isr_data = {
-    AT91RM9200_INT_EMAC,
-    at91rm9200_emac_isr,
-    NULL,
-    at91rm9200_emac_isr_on,
-    at91rm9200_emac_isr_off,
-    at91rm9200_emac_isr_is_on
-};
-
+static void at91rm9200_emac_isr_on(void);
 
 /* use the values defined in linkcmds for our use of SRAM */
 extern void * at91rm9200_emac_rxbuf_hdrs;
@@ -209,11 +197,11 @@ static int at91rm9200_emac_ioctl (struct ifnet *ifp,
                                   ioctl_command_t command,
                                   caddr_t data);
 
-
+#if csb637
 /*
  * phyread(): Read the PHY
  */
-uint32_t phyread(uint8_t reg)
+static uint32_t phyread(uint8_t reg)
 {
   EMAC_REG(EMAC_MAN) = (0x01 << 30  /* Start of Frame Delimiter */
             | 0x02 << 28            /* Operation, 0x01 = Write, 0x02 = Read */
@@ -234,11 +222,12 @@ uint32_t phyread(uint8_t reg)
 
   return EMAC_REG(EMAC_MAN) & 0xffff;
 }
+#endif
 
 /*
  * phywrite(): Write the PHY
  */
-void phywrite(uint8_t reg, uint16_t data)
+static void phywrite(uint8_t reg, uint16_t data)
 {
   EMAC_REG(EMAC_MAN) = (0x01 << 30 /* Start of Frame Delimiter */
              | 0x01 << 28          /* Operation, 0x01 = Write, 0x02 = Read */
@@ -358,6 +347,7 @@ void at91rm9200_emac_init(void *arg)
 {
     at91rm9200_emac_softc_t     *sc = arg;
     struct ifnet *ifp = &sc->arpcom.ac_if;
+    rtems_status_code status = RTEMS_SUCCESSFUL;
 
     /*
      *This is for stuff that only gets done once (at91rm9200_emac_init()
@@ -382,7 +372,15 @@ void at91rm9200_emac_init(void *arg)
     AIC_SMR_REG(AIC_SMR_EMAC) = AIC_SMR_PRIOR(EMAC_INT_PRIORITY);
 
     /* install the interrupt handler */
-    BSP_install_rtems_irq_handler(&at91rm9200_emac_isr_data);
+    status = rtems_interrupt_handler_install(
+        AT91RM9200_INT_EMAC,
+        "Network",
+        RTEMS_INTERRUPT_UNIQUE,
+        at91rm9200_emac_isr,
+        NULL
+    );
+    assert(status == RTEMS_SUCCESSFUL);
+    at91rm9200_emac_isr_on();
 
     /* EMAC doesn't support promiscuous, so ignore requests */
     if (ifp->if_flags & IFF_PROMISC) {
@@ -767,7 +765,7 @@ void at91rm9200_emac_stats (at91rm9200_emac_softc_t *sc)
 
 
 /* Enables at91rm9200_emac interrupts. */
-static void at91rm9200_emac_isr_on(const rtems_irq_connect_data *unused)
+static void at91rm9200_emac_isr_on(void)
 {
     /* Enable various TX/RX interrupts */
     EMAC_REG(EMAC_IER) = (EMAC_INT_RCOM | /* Receive complete */
@@ -779,23 +777,6 @@ static void at91rm9200_emac_isr_on(const rtems_irq_connect_data *unused)
     return;
 }
 
-/* Disables at91rm9200_emac interrupts */
-static void at91rm9200_emac_isr_off(const rtems_irq_connect_data *unused)
-{
-    /* disable all various TX/RX interrupts */
-    EMAC_REG(EMAC_IDR) = 0xffffffff;
-    return;
-}
-
-/* Tests to see if at91rm9200_emac interrupts are enabled, and
- * returns non-0 if so.
- * If interrupt is not enabled, returns 0.
- */
-static int at91rm9200_emac_isr_is_on(const rtems_irq_connect_data *irq)
-{
-    return EMAC_REG(EMAC_IMR); /* any interrupts enabled? */
-}
-
 /*  Driver ioctl handler */
 static int
 at91rm9200_emac_ioctl (struct ifnet *ifp, ioctl_command_t command, caddr_t data)




More information about the vc mailing list