[Patch] Removing legacy method from arm csb337

Vipul Nayyar nayyar_vipul at yahoo.com
Tue Jul 2 11:26:40 UTC 2013


Hello,

Thanks for pointing out the mistakes in the previous patches. Updated the csb337 patch, and did away with the use of rtems_irq_connect_data structure in the file. Is this what you were suggesting ? Hoping I've followed the indentation rules.

commit d24fbcb472b0164ed4e6b51233155df7f6dd57b4
Author: Vipul Nayyar <nayyar_vipul at yahoo.com>
Date:   Tue Jul 2 16:52:29 2013 +0530

    Updated Legacy code in arm csb337

diff --git a/c/src/lib/libbsp/arm/csb337/network/network.c b/c/src/lib/libbsp/arm/csb337/network/network.c
index e31bcc0..1c1dd0e 100644
--- a/c/src/lib/libbsp/arm/csb337/network/network.c
+++ b/c/src/lib/libbsp/arm/csb337/network/network.c
@@ -87,17 +87,6 @@ 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
-};
-
-
 /* use the values defined in linkcmds for our use of SRAM */
 extern void * at91rm9200_emac_rxbuf_hdrs;
 extern void * at91rm9200_emac_txbuf;
@@ -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,19 @@ 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
+    );
+    if (status != RTEMS_SUCCESSFUL) {
+        rtems_fatal(
+          RTEMS_FATAL_SOURCE_BSP_SPECIFIC,
+          BSP_GENERIC_FATAL_INTERRUPT_INITIALIZATION
+        );
+    }
 
     /* EMAC doesn't support promiscuous, so ignore requests */
     if (ifp->if_flags & IFF_PROMISC) {


Regards
Vipul Nayyar 



________________________________
 From: Sebastian Huber <sebastian.huber at embedded-brains.de>
To: rtems-devel at rtems.org 
Sent: Tuesday, 2 July 2013 1:00 PM
Subject: Re: [Patch] Removing legacy method from arm csb337
 

On 07/02/2013 09:18 AM, Andreas Heinig wrote:
> On Tuesday 02 July 2013 14:52:52 Vipul Nayyar wrote:
>> >Hello Andreas,
>> >
>> >Thanks Andreas for pointing out that silly mistake. I didn't focus on other
>> >variables being used. I've updated the patch, and wanted to ask, what
>> >should be done when status code returned is not successful ?
>> >
>> >commit 9b21c1effe34cb716c00ea1c11777ef16ce9c7cc
>> >Author: Vipul Nayyar<nayyar_vipul at yahoo.com>
>> >Date:   Tue Jul 2 12:20:49 2013 +0530
>> >
>> >     Updated Legacy code in arm csb337
>> >
>> >diff --git a/c/src/lib/libbsp/arm/csb337/network/network.c
>> >b/c/src/lib/libbsp/arm/csb337/network/network.c index e31bcc0..53d60d2
>> >100644
>> >--- a/c/src/lib/libbsp/arm/csb337/network/network.c
>> >+++ b/c/src/lib/libbsp/arm/csb337/network/network.c
>> >@@ -358,6 +358,7 @@ void at91rm9200_emac_init(void *arg)
>> >  {
>> >      at91rm9200_emac_softc_t     *sc = arg;
>> >      struct ifnet *ifp = &sc->arpcom.ac_if;
>> >+    rtems_status_code stc = RTEMS_SUCCESSFUL;
> I think you should name the rtems_status_code either 'sc' or 'status'. These
> names are used by default in most of the RTEMS modules.

Yes, status is a good name.

>
> In your case I suggest to rename the at91rm9200_emac_softc_t variable, because
> sc is confusing here anyway.

The "sc" is the standard name for this in BSD code.

-- 
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax     : +49 89 189 47 41-09
E-Mail  : sebastian.huber at embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
_______________________________________________
rtems-devel mailing list
rtems-devel at rtems.org
http://www.rtems.org/mailman/listinfo/rtems-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20130702/3a72e54b/attachment-0001.html>


More information about the devel mailing list