patch for smsc lan91cxx ethernet driver

Andrew Lunn andrew@lunn.ch
Tue Jan 6 19:33:00 GMT 2004


On Mon, Dec 29, 2003 at 02:47:10PM +0100, Uwe Kindler wrote:
> Hello,
> 
> because the interrupt priority of the EDOSK-2674 board is configurable (8
> priorities from 0 - 7) it is necessary to provide an interrupt priority
> value when creating the lan91cxx interrupt with cyg_drv_interrupt_create. If
> the platform provides the interrupt priority with the new value
> CYGNUM_DEVS_ETH_SMSC_LAN91CXX_INT_PRIO, then this should be used for
> interrupt priority.
> 
> I would like to suggest the following patch.

I think using CDL is a nicer solution. I've made the interrupt
priority a CDL option with a default value of 3 so we retain the
original behavior. You can then override it as needed. 

In the hardware specific part of the ethernet driver put something like

   requires CYGNUM_DEVS_ETH_SMSC_LAN91CXX_INT_PRIO==4

The CDL engine will then override the default value with 4.

Please could you test this patch and let me know how it goes.

       Andrew
-------------- next part --------------
Index: devs/eth/smsc/lan91cxx/current/ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/devs/eth/smsc/lan91cxx/current/ChangeLog,v
retrieving revision 1.16
diff -u -r1.16 ChangeLog
--- devs/eth/smsc/lan91cxx/current/ChangeLog	19 Dec 2003 11:34:16 -0000	1.16
+++ devs/eth/smsc/lan91cxx/current/ChangeLog	6 Jan 2004 19:29:45 -0000
@@ -1,3 +1,9 @@
+2004-01-06  Andrew Lunn  <andrew.lunn@ascom.ch>
+
+        * cdl/smsc_lan91cxx_eth_drivers.cdl: 
+	* src/if_lan91cxx.c (smsc_lan91cxx_init): Allow the interrupt
+	priority to be overrode by the HW specific part of the driver.
+
 2003-12-19  Gary Parnes  <garyp@logicpd.com>
 
 	* src/smsc_lan91cxx.h (get_banksel): Allow this function to be 
Index: devs/eth/smsc/lan91cxx/current/cdl/smsc_lan91cxx_eth_drivers.cdl
===================================================================
RCS file: /cvs/ecos/ecos/packages/devs/eth/smsc/lan91cxx/current/cdl/smsc_lan91cxx_eth_drivers.cdl,v
retrieving revision 1.5
diff -u -r1.5 smsc_lan91cxx_eth_drivers.cdl
--- devs/eth/smsc/lan91cxx/current/cdl/smsc_lan91cxx_eth_drivers.cdl	3 Mar 2003 14:44:18 -0000	1.5
+++ devs/eth/smsc/lan91cxx/current/cdl/smsc_lan91cxx_eth_drivers.cdl	6 Jan 2004 19:29:46 -0000
@@ -9,6 +9,7 @@
 ## -------------------------------------------
 ## This file is part of eCos, the Embedded Configurable Operating System.
 ## Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
+## Copyright (C) 2004 Andrew Lunn
 ##
 ## eCos is free software; you can redistribute it and/or modify it under
 ## the terms of the GNU General Public License as published by the Free
@@ -76,6 +77,17 @@
 	    into the EEPROM associated with the interface, so that the new
 	    MAC address is permanently recorded.  Doing this should be a
 	    carefully chosen decision, hence this option."
+    }
+
+    cdl_option CYGNUM_DEVS_ETH_SMSC_LAN91CXX_INT_PRIO {
+        display "Interrupt priority when registering interrupt handler"
+        flavor  data
+        default_value 3
+        description "
+            When registering the interrupt handler this specifies the 
+            priority of the interrupt. Some hardware platforms require
+            values other than the default given here. Such platforms
+            can then override this value in the hardware specific package. "
     }
 
     cdl_interface CYGINT_DEVS_ETH_SMSC_LAN91CXX_STATIC_ESA {
Index: devs/eth/smsc/lan91cxx/current/src/if_lan91cxx.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/devs/eth/smsc/lan91cxx/current/src/if_lan91cxx.c,v
retrieving revision 1.14
diff -u -r1.14 if_lan91cxx.c
--- devs/eth/smsc/lan91cxx/current/src/if_lan91cxx.c	10 Dec 2003 12:33:47 -0000	1.14
+++ devs/eth/smsc/lan91cxx/current/src/if_lan91cxx.c	6 Jan 2004 19:29:49 -0000
@@ -10,6 +10,7 @@
 // This file is part of eCos, the Embedded Configurable Operating System.
 // Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
 // Copyright (C) 2003 Nick Garnett 
+// Copyright (C) 2004 Andrew Lunn
 //
 // eCos is free software; you can redistribute it and/or modify it under
 // the terms of the GNU General Public License as published by the Free
@@ -288,7 +289,7 @@
 #ifndef CYGPKG_IO_ETH_DRIVERS_STAND_ALONE
     // Initialize environment, setup interrupt handler
     cyg_drv_interrupt_create(cpd->interrupt,
-                             3, // Priority - what goes here?
+                             CYGNUM_DEVS_ETH_SMSC_LAN91CXX_INT_PRIO,
                              (cyg_addrword_t)sc, //  Data item passed to interrupt handler
                              (cyg_ISR_t *)lan91cxx_isr,
                              (cyg_DSR_t *)eth_drv_dsr, // The logical driver DSR


More information about the Ecos-patches mailing list