changeset 785:4596374adb31

* src/if_innovator.c (removed file) * include/devs_eth_innovator.inl * cdl/innovator_eth_drivers.cdl: Reworked to support flash, CDL, and eeprom ESA assignment, in that priority.
author jlarmour
date Mon, 03 Mar 2003 14:43:21 +0000
parents e942a29011aa
children fead836699b5
files packages/devs/eth/arm/innovator/current/ChangeLog packages/devs/eth/arm/innovator/current/cdl/innovator_eth_drivers.cdl packages/devs/eth/arm/innovator/current/include/devs_eth_innovator.inl
diffstat 3 files changed, 108 insertions(+), 83 deletions(-) [+]
line wrap: on
line diff
--- a/packages/devs/eth/arm/innovator/current/ChangeLog
+++ b/packages/devs/eth/arm/innovator/current/ChangeLog
@@ -1,3 +1,10 @@
+2003-02-14  Patrick Doyle  <wpd@delcomsys.com>
+
+	* src/if_innovator.c (removed file)
+	* include/devs_eth_innovator.inl
+	* cdl/innovator_eth_drivers.cdl: Reworked to support flash, CDL,
+	and eeprom ESA assignment, in that priority.
+
 2003-02-05  Patrick Doyle <wpd@delcomsys.com>
 	* cdl/innovator_eth_drivers.cdl
 	* include/devs_eth_innovator.inl
--- a/packages/devs/eth/arm/innovator/current/cdl/innovator_eth_drivers.cdl
+++ b/packages/devs/eth/arm/innovator/current/cdl/innovator_eth_drivers.cdl
@@ -50,26 +50,22 @@
 # ====================================================================
 
 cdl_package CYGPKG_DEVS_ETH_ARM_INNOVATOR {
-
     display       "Innovator SMC91C96 ethernet driver"
 
     parent        CYGPKG_IO_ETH_DRIVERS
     active_if	  CYGPKG_IO_ETH_DRIVERS
     active_if	  CYGPKG_HAL_ARM_ARM9_INNOVATOR
 
-    # chip wired in PCMCIA, 16-bit mode, no EEPROM
-    # -- the chip is probably not wired in PCMCIA mode & I saw an EEPROM for it
+    include_dir   cyg/io
 
-    implements    CYGHWR_NET_DRIVERS
-    implements    CYGHWR_NET_DRIVER_ETH0
-    implements    CYGINT_DEVS_ETH_SMSC_LAN91CXX_REQUIRED
-#    implements    CYGINT_DEVS_ETH_SMSC_LAN91CXX_STATIC_ESA
-    
-    requires      CYGPKG_DEVS_ETH_SMSC_LAN91CXX
     description   "Ethernet driver for Innovator boards."
 
-    include_dir   cyg/io
-    compile       if_innovator.c
+    # Arguably this should do in the generic package
+    # but then there is a logic loop so you can never enable it.
+
+    cdl_interface CYGINT_DEVS_ETH_SMSC_LAN91CXX_REQUIRED {
+        display   "SMSC LAN91CXX driver required"
+    }
 
     define_proc {
         puts $::cdl_system_header "/***** ethernet driver proc output start *****/"
@@ -77,42 +73,45 @@ cdl_package CYGPKG_DEVS_ETH_ARM_INNOVATO
         puts $::cdl_system_header "#define CYGDAT_DEVS_ETH_SMSC_LAN91CXX_CFG <pkgconf/devs_eth_arm_innovator.h>"
         puts $::cdl_system_header "/*****  ethernet driver proc output end  *****/"
     }
-    
-    # Arguably this should do in the generic package
-    # but then there is a logic loop so you can never enable it.
-
-    cdl_interface CYGINT_DEVS_ETH_SMSC_LAN91CXX_REQUIRED {
-        display   "SMSC LAN91CXX driver required"
-    }
 
-    cdl_option CYGDAT_DEVS_ETH_ARM_INNOVATOR_NAME {
-        display       "Device name for the ethernet driver"
-        flavor        data
-        default_value {"\"eth0\""}
+    cdl_component CYGPKG_DEVS_ETH_ARM_INNOVATOR_ETH0 {
+        display       "Innovator ethernet port driver"
+        flavor        bool
+        default_value 1
         description   "
-            This option sets the name of the ethernet device for the
-            ethernet port."
-    }
+            This option includes the ethernet device driver for the
+            Innovator port."
+
+        implements    CYGHWR_NET_DRIVERS
+        implements    CYGHWR_NET_DRIVER_ETH0
+        implements    CYGINT_DEVS_ETH_SMSC_LAN91CXX_REQUIRED
 
-    cdl_option CYGDAT_DEVS_ETH_ARM_INNOVATOR_ESA {
-        display       "The ethernet station address (MAC)"
-        flavor        data
-        default_value {"{0x12, 0x13, 0x14, 0x15, 0x16, 0x17}"}
-        description   "A static ethernet station address. 
-            Caution: Booting two systems with the same MAC on the same
-            network, will cause severe conflicts."
-        active_if     !CYGSEM_DEVS_ETH_ARM_INNOVATOR_REDBOOT_ESA
-    }
+        cdl_option CYGDAT_DEVS_ETH_ARM_INNOVATOR_ETH0_NAME {
+            display       "Device name for the ETH0 ethernet driver"
+            flavor        data
+            default_value {"\"eth0\""}
+            description   "
+                This option sets the name of the ethernet device."
+        }
 
-    cdl_option CYGSEM_DEVS_ETH_ARM_INNOVATOR_REDBOOT_ESA {
-        display "Use the RedBoot ESA (MAC address)"
-        default_value 0
-        flavor        bool
-        description   "
-            Use the ESA that is stored as a RedBoot variable instead of
-            a static ESA." 
+        cdl_component CYGSEM_DEVS_ETH_ARM_INNOVATOR_ETH0_SET_ESA {
+            display       "Set the ethernet station address"
+            flavor        bool
+            default_value 0
+            description   "Enabling this option will allow the ethernet
+            station address to be forced to the value set by the
+            configuration.  This may be required if the hardware does
+            not include a serial EEPROM for the ESA."
+            
+            cdl_option CYGDAT_DEVS_ETH_ARM_INNOVATOR_ETH0_ESA {
+                display       "The ethernet station address (MAC)"
+                flavor        data
+                default_value {"{0x12, 0x13, 0x14, 0x15, 0x16, 0x17}"}
+                description   "A static ethernet station address. 
+                    Caution: Booting two systems with the same MAC on the same
+                    network, will cause severe conflicts."
+            }
+        }
     }
-
 }
 
-# EOF innovator_eth_drivers.cdl
--- a/packages/devs/eth/arm/innovator/current/include/devs_eth_innovator.inl
+++ b/packages/devs/eth/arm/innovator/current/include/devs_eth_innovator.inl
@@ -52,58 +52,76 @@
 #include <cyg/hal/hal_intr.h>          
 #include <cyg/hal/innovator.h>
 
-//  #define CYGNUM_DEVS_ETH_SMSC_LAN91CXX_SHIFT_ADDR    2
-
-// MAC address is stored as a Redboot config option
 #ifdef CYGPKG_REDBOOT
-#include <pkgconf/redboot.h>
-#ifdef CYGSEM_REDBOOT_FLASH_CONFIG
-#include <redboot.h>
-#include <flash_config.h>
-
-RedBoot_config_option("Network hardware address [MAC]",
-                      innovator_esa,
-                      ALWAYS_ENABLED, true,
-                      CONFIG_ESA, 0
-    );
-#endif
+# include <pkgconf/redboot.h>
+# ifdef CYGSEM_REDBOOT_FLASH_CONFIG
+#  include <redboot.h>
+#  include <flash_config.h>
+# endif
 #endif
 
-// ESA address fetch function
-static void innovator_get_ESA(struct lan91cxx_priv_data *cpd)
+#ifdef CYGPKG_DEVS_ETH_ARM_INNOVATOR_ETH0
+
+#if defined(CYGPKG_REDBOOT) && defined(CYGSEM_REDBOOT_FLASH_CONFIG)
+RedBoot_config_option("Set " CYGDAT_DEVS_ETH_ARM_INNOVATOR_ETH0_NAME " network hardware address [MAC]",
+                      eth0_esa,
+                      ALWAYS_ENABLED, true,
+                      CONFIG_BOOL, false
+    );
+RedBoot_config_option(CYGDAT_DEVS_ETH_ARM_INNOVATOR_ETH0_NAME " network hardware address [MAC]",
+                      eth0_esa_data,
+                      "eth0_esa", true,
+                      CONFIG_ESA, 0
+    );
+#endif // CYGPKG_REDBOOT && CYGSEM_REDBOOT_FLASH_CONFIG
+
+#ifdef CYGSEM_HAL_VIRTUAL_VECTOR_SUPPORT
+// Note that this section *is* active in an application, outside RedBoot,
+// where the above section is not included.
+
+# include <cyg/hal/hal_if.h>
+
+# ifndef CONFIG_ESA
+#  define CONFIG_ESA (6)
+# endif
+# ifndef CONFIG_BOOL
+#  define CONFIG_BOOL (1)
+# endif
+
+cyg_bool
+_innovator_provide_eth0_esa(struct lan91cxx_priv_data* cpd)
 {
-    // Fetch hardware address from RedBoot config
-#if defined(CYGSEM_DEVS_ETH_ARM_INNOVATOR_REDBOOT_ESA)
-#if defined(CYGPKG_REDBOOT) && \
-    defined(CYGSEM_REDBOOT_FLASH_CONFIG)
-    flash_get_config("innovator_esa", cpd->enaddr, CONFIG_ESA);
-#else
-#error "No RedBoot flash configuration to store ESA"
-#endif
-#else
-    unsigned char static_esa[] = CYGDAT_DEVS_ETH_ARM_INNOVATOR_ESA;
-    memcpy(cpd->enaddr, static_esa, 6);
-#endif
+    cyg_bool set_esa;
+    int ok;
+    ok = CYGACC_CALL_IF_FLASH_CFG_OP( CYGNUM_CALL_IF_FLASH_CFG_GET,
+                                      "eth0_esa", &set_esa, CONFIG_BOOL);
+    if (ok && set_esa) {
+        ok = CYGACC_CALL_IF_FLASH_CFG_OP( CYGNUM_CALL_IF_FLASH_CFG_GET,
+                                          "eth0_esa_data", cpd->enaddr, CONFIG_ESA);
+    }
+    return ok && set_esa;
 }
 
-static lan91cxx_priv_data lan91cxx_eth0_priv_data = { 
+#endif // CYGSEM_HAL_VIRTUAL_VECTOR_SUPPORT
 
-    config_enaddr : innovator_get_ESA,
-#ifndef CYGSEM_DEVS_ETH_ARM_INNOVATOR_REDBOOT_ESA    
-    enaddr: CYGDAT_DEVS_ETH_ARM_INNOVATOR_ESA,
+static lan91cxx_priv_data lan91cxx_eth0_priv_data = { 
+    base : (unsigned short *) 0x08000300,
+#ifdef CYGSEM_DEVS_ETH_ARM_INNOVATOR_ETH0_SET_ESA
+    enaddr        : CYGDAT_DEVS_ETH_ARM_INNOVATOR_ETH0_ESA,
+    hardwired_esa : true,
+#else
+    hardwired_esa : false,
 #endif
-#if 0
-    base : (unsigned short *) SA1110_FHH_ETH_IOBASE,
-    attbase : (unsigned char *) SA1110_FHH_ETH_MMBASE,
-    interrupt : SA1110_IRQ_GPIO_ETH
+#ifdef CYGSEM_HAL_VIRTUAL_VECTOR_SUPPORT
+    provide_esa   : &_innovator_provide_eth0_esa,
 #else
-    base : (unsigned short *) 0x08000300,
+    provide_esa   : NULL,
 #endif
 };
 
 ETH_DRV_SC(lan91cxx_sc,
            &lan91cxx_eth0_priv_data,          // Driver specific data
-           CYGDAT_DEVS_ETH_ARM_INNOVATOR_NAME, // Name for device
+           CYGDAT_DEVS_ETH_ARM_INNOVATOR_ETH0_NAME, // Name for device
            lan91cxx_start,
            lan91cxx_stop,
            lan91cxx_control,
@@ -116,10 +134,11 @@ ETH_DRV_SC(lan91cxx_sc,
 );
 
 NETDEVTAB_ENTRY(lan91cxx_netdev, 
-                "lan91cxx_" CYGDAT_DEVS_ETH_ARM_INNOVATOR_NAME,
+                "lan91cxx_" CYGDAT_DEVS_ETH_ARM_INNOVATOR_ETH0_NAME,
                 smsc_lan91cxx_init,
                 &lan91cxx_sc);
 
-//EOF devs_eth_innovator.inl
+#endif // CYGPKG_DEVS_ETH_ARM_INNOVATOR_ETH0
 
 
+