Mercurial > flash_v2
changeset 1067:632d04548506
* src/ks5000_ether.c: Some tidies of the previous changes.
* cdl/ks32c5000_eth.cdl: Clarify option description and rename
CYGVAR_DEVS_ETH_ARM_KS32C5000_REDBOOT_HOLDS_ESA_ETH0 to
CYGSEM_DEVS_ETH_ARM_KS32C5000_REDBOOT_HOLDS_ESA_ETH0.
* cdl/ks32c5000_eth.cdl: Added support for MAC address to be used
from RedBoot's FLASH configuration data.
* src/ks5000_ether.c: Updated driver to work with LWIP stack as
well as the BSD stack. Added support for MAC address to be used
from RedBoot's FLASH configuration data.
| author | jlarmour |
|---|---|
| date | Tue, 24 Jun 2003 04:53:17 +0000 |
| parents | 053c9ef37f3e |
| children | 745b55b432de |
| files | packages/devs/eth/arm/ks32c5000/current/ChangeLog packages/devs/eth/arm/ks32c5000/current/cdl/ks32c5000_eth.cdl packages/devs/eth/arm/ks32c5000/current/src/ks5000_ether.c |
| diffstat | 3 files changed, 116 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/packages/devs/eth/arm/ks32c5000/current/ChangeLog +++ b/packages/devs/eth/arm/ks32c5000/current/ChangeLog @@ -1,3 +1,18 @@ +2003-06-24 Jonathan Larmour <jifl@eCosCentric.com> + + * src/ks5000_ether.c: Some tidies of the previous changes. + * cdl/ks32c5000_eth.cdl: Clarify option description and rename + CYGVAR_DEVS_ETH_ARM_KS32C5000_REDBOOT_HOLDS_ESA_ETH0 to + CYGSEM_DEVS_ETH_ARM_KS32C5000_REDBOOT_HOLDS_ESA_ETH0. + +2003-05-26 Chris Garry <cgarry@sweeneydesign.co.uk> + + * cdl/ks32c5000_eth.cdl: Added support for MAC address to be used + from RedBoot's FLASH configuration data. + * src/ks5000_ether.c: Updated driver to work with LWIP stack as + well as the BSD stack. Added support for MAC address to be used + from RedBoot's FLASH configuration data. + 2003-04-08 Michael Checky <Michael_Checky@Thermoking.com> * cdl/ks32c5000_eth.cdl: CYGINT_DEVS_ETH_ARM_KS32C5000_PHY can now
--- a/packages/devs/eth/arm/ks32c5000/current/cdl/ks32c5000_eth.cdl +++ b/packages/devs/eth/arm/ks32c5000/current/cdl/ks32c5000_eth.cdl @@ -155,10 +155,49 @@ cdl_package CYGPKG_DEVS_ETH_ARM_KS32C500 description "This option specifies the MII address of the PHY" } + cdl_component CYGPKG_DEVS_ETH_ARM_KS32C5000_REDBOOT_HOLDS_ESA { + display "RedBoot manages ESA initialization data" + flavor bool + default_value 0 + + active_if CYGSEM_HAL_VIRTUAL_VECTOR_SUPPORT + active_if (CYGPKG_REDBOOT || CYGSEM_HAL_USE_ROM_MONITOR) + + description "Enabling this option will allow the ethernet + station address to be acquired from RedBoot's configuration data, + stored in flash memory. It can be overridden individually by the + 'Set the ethernet station address' option for each interface." + + cdl_component CYGPKG_DEVS_ETH_ARM_KS32C5000_REDBOOT_HOLDS_ESA_VARS { + display "Export RedBoot command to set ESA in FLASH config" + flavor none + no_define + + description " + This component contains options which, when enabled, allow + RedBoot to support the setting of the ESA in the FLASH + configuration. This can then subsequently be accessed by + applications using virtual vector calls if those applications + are also built with + CYGPKG_DEVS_ETH_ARM_KS32C5000_REDBOOT_HOLDS_ESA enabled." + + cdl_option CYGSEM_DEVS_ETH_ARM_KS32C5000_REDBOOT_HOLDS_ESA_ETH0 { + display "RedBoot manages ESA for eth0" + flavor bool + default_value 1 + active_if CYGSEM_REDBOOT_FLASH_CONFIG + active_if CYGPKG_REDBOOT_NETWORKING + } + } + } + cdl_option CYGPKG_DEVS_ETH_ARM_KS32C5000_MACADDR { - display "Ethernet address for eth0" + display "Ethernet station (MAC) address for eth0" flavor data default_value {"0x08, 0x88, 0x12, 0x34, 0x56, 0x78"} + description "The default ethernet station address. This is the + MAC address used when no value is found in the + RedBoot FLASH configuration field." } cdl_option CYGPKG_DEVS_ETH_ARM_KS32C5000_CFLAGS_ADD {
--- a/packages/devs/eth/arm/ks32c5000/current/src/ks5000_ether.c +++ b/packages/devs/eth/arm/ks32c5000/current/src/ks5000_ether.c @@ -55,14 +55,18 @@ #include <pkgconf/devs_eth_arm_ks32c5000.h> #include <pkgconf/io_eth_drivers.h> +#include <errno.h> #if defined(CYGPKG_IO) #include <pkgconf/io.h> #include <cyg/io/io.h> #include <cyg/io/devtab.h> -#else -// need to provide fake values for errno -#define EIO 1 -#define EINVAL 2 +#endif +// need to provide fake values for errno? +#ifndef EIO +# define EIO 1 +#endif +#ifndef EINVAL +# define EINVAL 2 #endif #include <cyg/infra/cyg_type.h> // Common type definitions and support @@ -77,7 +81,7 @@ #include <pkgconf/redboot.h> #endif -#if !defined(CYGPKG_NET) +#ifndef CYGINT_IO_ETH_INT_SUPPORT_REQUIRED #define cyg_drv_interrupt_unmask(v) /* noop */ #define cyg_drv_interrupt_mask(v) /* noop */ #define cyg_drv_isr_lock() /* noop */ @@ -123,6 +127,42 @@ #define SoftwareCRC 0 #endif +// -------------------------------------------------------------- +// RedBoot configuration options for managing ESAs for us + +// Decide whether to have redboot config vars for it... +#if defined(CYGSEM_REDBOOT_FLASH_CONFIG) && defined(CYGPKG_REDBOOT_NETWORKING) +#include <redboot.h> +#include <flash_config.h> + +#ifdef CYGSEM_DEVS_ETH_ARM_KS32C5000_REDBOOT_HOLDS_ESA_ETH0 +RedBoot_config_option("Network hardware address [MAC] for eth0", + eth0_esa_data, + ALWAYS_ENABLED, true, + CONFIG_ESA, 0); +#endif + +#endif // CYGPKG_REDBOOT_NETWORKING && CYGSEM_REDBOOT_FLASH_CONFIG + +// and initialization code to read them +// - independent of whether we are building RedBoot right now: +#ifdef CYGPKG_DEVS_ETH_ARM_KS32C5000_REDBOOT_HOLDS_ESA + +#include <cyg/hal/hal_if.h> + +#ifndef CONFIG_ESA +#define CONFIG_ESA (6) +#endif + +#define CYGHWR_DEVS_ETH_ARM_KS32C5000_GET_ESA( mac_address, ok ) \ +CYG_MACRO_START \ + ok = CYGACC_CALL_IF_FLASH_CFG_OP( CYGNUM_CALL_IF_FLASH_CFG_GET, \ + "eth0_esa_data", mac_address, CONFIG_ESA); \ +CYG_MACRO_END + +#endif // CYGPKG_DEVS_ETH_I82559_ETH_REDBOOT_HOLDS_ESA + + #if CYGINT_DEVS_ETH_ARM_KS32C5000_PHY // functions to read/write Phy chip registers via MII interface // on 32c5000. These need to be non-static since they're used @@ -182,8 +222,11 @@ typedef struct } MAC_FRAME; #if defined(CYGPKG_NET) +struct ether_drv_stats ifStats; +#endif + +#if defined(CYGINT_IO_ETH_INT_SUPPORT_REQUIRED) static cyg_drv_mutex_t txMutex; -struct ether_drv_stats ifStats; #endif typedef struct @@ -477,7 +520,7 @@ static void initFreeList(void) static int ks32c5000_eth_buffer_send(tEthBuffer *buf) { -#if defined(CYGPKG_NET) +#if defined(CYGINT_IO_ETH_INT_SUPPORT_REQUIRED) while (!configDone) cyg_thread_delay(10); #endif @@ -659,7 +702,6 @@ static int EthInit(U08* mac_address) CAMCON = CAMConfigVar; // set up our MAC address - if (mac_address) { *((volatile U32*)CAM_BaseAddr) = @@ -1124,11 +1166,18 @@ ks32c5000_priv_data_t ks32c5000_priv_dat #define eth_drv_init(sc,enaddr) ((sc)->funs->eth_drv->init)(sc, enaddr) #define eth_drv_recv(sc,len) ((sc)->funs->eth_drv->recv)(sc, len) -static unsigned char myMacAddr[6] = { CYGPKG_DEVS_ETH_ARM_KS32C5000_MACADDR }; - static bool ks32c5000_eth_init(struct cyg_netdevtab_entry *tab) { + unsigned char myMacAddr[6] = { CYGPKG_DEVS_ETH_ARM_KS32C5000_MACADDR }; struct eth_drv_sc *sc = (struct eth_drv_sc *)tab->device_instance; + bool ok; + +#ifdef CYGHWR_DEVS_ETH_ARM_KS32C5000_GET_ESA + // Get MAC address from RedBoot configuration variables + CYGHWR_DEVS_ETH_ARM_KS32C5000_GET_ESA(&myMacAddr[0], ok); + // If this call fails myMacAddr is unchanged and MAC address from CDL is used +#endif + debug1_printf("ks32c5000_eth_init()\n"); debug1_printf(" MAC address %02x:%02x:%02x:%02x:%02x:%02x\n",myMacAddr[0],myMacAddr[1],myMacAddr[2],myMacAddr[3],myMacAddr[4],myMacAddr[5]); #if defined(CYGPKG_NET) @@ -1383,3 +1432,5 @@ NETDEVTAB_ENTRY(ks32c5000_netdev, "ks32c5000", ks32c5000_eth_init, &ks32c5000_sc); + +// EOF ks5000_ether.c
