Mercurial > flash_v2
changeset 1350:83bf536405e0
* src/ks5000_ether.c: Set ifStats.description only one time while
initialization, it will never change.
Set ifStats.supports_dot3 to 1, to support snmp mib dot3.
Set ifStats.snmp_chipset to be interpreted as "nullobjid" in the
snmp dot3 agent. It is not a string it is an oid as byte array.
The link status of the phy are read while initializion and in the
command ETH_DRV_GET_IF_STATS to be up to date without phy interrupt
support.
Change firstTime in installInterrupts() to be static to be sure
interrupts will only one time be installed.
| author | asl |
|---|---|
| date | Tue, 04 Nov 2003 19:37:13 +0000 |
| parents | 4444f5b3be7b |
| children | 2aef5613bac9 |
| files | packages/devs/eth/arm/ks32c5000/current/ChangeLog packages/devs/eth/arm/ks32c5000/current/src/ks5000_ether.c |
| diffstat | 2 files changed, 62 insertions(+), 5 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,16 @@ +2003-10-09 Roland Cassebohm <roland.cassebohm@visionsystems.de> + + * src/ks5000_ether.c: Set ifStats.description only one time while + initialization, it will never change. + Set ifStats.supports_dot3 to 1, to support snmp mib dot3. + Set ifStats.snmp_chipset to be interpreted as "nullobjid" in the + snmp dot3 agent. It is not a string it is an oid as byte array. + The link status of the phy are read while initializion and in the + command ETH_DRV_GET_IF_STATS to be up to date without phy interrupt + support. + Change firstTime in installInterrupts() to be static to be sure + interrupts will only one time be installed. + 2003-06-24 Jonathan Larmour <jifl@eCosCentric.com> * src/ks5000_ether.c: Some tidies of the previous changes.
--- a/packages/devs/eth/arm/ks32c5000/current/src/ks5000_ether.c +++ b/packages/devs/eth/arm/ks32c5000/current/src/ks5000_ether.c @@ -677,6 +677,10 @@ static tEthBuffer *ks32c5000_eth_get_rec //====================================================================== static int EthInit(U08* mac_address) { +#if CYGINT_DEVS_ETH_ARM_KS32C5000_PHY && defined(CYGPKG_NET) + unsigned linkStatus; +#endif + if (mac_address) debug2_printf("EthInit(%02x:%02x:%02x:%02x:%02x:%02x)\n", mac_address[0],mac_address[1],mac_address[2], @@ -733,6 +737,25 @@ static int EthInit(U08* mac_address) *((volatile unsigned char*)CAM_BaseAddr+4), *((volatile unsigned char*)CAM_BaseAddr+5)); +#if CYGINT_DEVS_ETH_ARM_KS32C5000_PHY && defined(CYGPKG_NET) + // Read link status to be up to date + linkStatus = PhyStatus(); + if (linkStatus & PhyStatus_FullDuplex) + ifStats.duplex = 3; + else + ifStats.duplex = 2; + + if (linkStatus & PhyStatus_LinkUp) + ifStats.operational = 3; + else + ifStats.operational = 2; + + if (linkStatus & PhyStatus_100Mb) + ifStats.speed = 100000000; + else + ifStats.speed = 10000000; +#endif + #if SoftwareCRC debug2_printf("Software CRC\n"); #else @@ -1110,7 +1133,7 @@ static void ks32c5000_eth_deliver(struct static void installInterrupts(void) { extern struct eth_drv_sc ks32c5000_sc; - bool firstTime=true; + static bool firstTime=true; debug1_printf("ks5000_ether: installInterrupts()\n"); @@ -1184,6 +1207,9 @@ static bool ks32c5000_eth_init(struct cy ifStats.duplex = 1; //unknown ifStats.operational = 1; //unknown ifStats.tx_queue_len = MAX_TX_FRAME_DESCRIPTORS; + strncpy(ifStats.description,"Ethernet device",sizeof(ifStats.description)); + ifStats.snmp_chipset[0] = 0; + ifStats.supports_dot3 = 1; // support dot3 #endif installInterrupts(); EthInit(myMacAddr); @@ -1233,11 +1259,29 @@ static int ks32c5000_eth_control(struct case ETH_DRV_GET_IF_STATS: { struct ether_drv_stats *p = (struct ether_drv_stats*)data; + +#if CYGINT_DEVS_ETH_ARM_KS32C5000_PHY + unsigned linkStatus; + + // Read link status to be up to date + linkStatus = PhyStatus(); + if (linkStatus & PhyStatus_FullDuplex) + ifStats.duplex = 3; + else + ifStats.duplex = 2; + + if (linkStatus & PhyStatus_LinkUp) + ifStats.operational = 3; + else + ifStats.operational = 2; + + if (linkStatus & PhyStatus_100Mb) + ifStats.speed = 100000000; + else + ifStats.speed = 10000000; +#endif + *p = ifStats; - strncpy(p->description,"description goes here",sizeof(p->description)-1); - p->description[sizeof(p->description)-1] = '\0'; - strncpy(p->snmp_chipset,"chipset name",sizeof(p->snmp_chipset)-1); - p->snmp_chipset[sizeof(p->snmp_chipset)-1] = '\0'; return 0; } #endif
