This is the mail archive of the ecos-patches@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Support for snmp dot3 mib in ks32c5000 ethernet driver


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.

Roland
-- 

___________________________________________________

VS Vision Systems GmbH, Industrial Image Processing
Dipl.-Ing. Roland Caßebohm
Aspelohe 27A, D-22848 Norderstedt, Germany
http://www.visionsystems.de
___________________________________________________
Index: packages/devs/eth/arm/ks32c5000/current/ChangeLog
===================================================================
RCS file: /home/cassebohm/net/USERS/CVSROOT/VSprojects/ecos/packages/devs/eth/arm/ks32c5000/current/ChangeLog,v
retrieving revision 1.1.1.1.2.1
diff -u -5 -p -r1.1.1.1.2.1 ChangeLog
--- packages/devs/eth/arm/ks32c5000/current/ChangeLog	9 Oct 2003 16:08:58 -0000	1.1.1.1.2.1
+++ packages/devs/eth/arm/ks32c5000/current/ChangeLog	9 Oct 2003 16:11:21 -0000
@@ -1,5 +1,18 @@
+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-10-09  Roland Cassebohm  <roland.cassebohm@visionsystems.de>
 
 	* src/rtl8201.c: New file. Added RTL8201 PHY support.
 	* cdl/ks32c5000_eth.cdl: CDL to allow configuration of the above.
 
Index: packages/devs/eth/arm/ks32c5000/current/src/ks5000_ether.c
===================================================================
RCS file: /home/cassebohm/net/USERS/CVSROOT/VSprojects/ecos/packages/devs/eth/arm/ks32c5000/current/src/ks5000_ether.c,v
retrieving revision 1.1.1.1
diff -u -5 -p -r1.1.1.1 ks5000_ether.c
--- packages/devs/eth/arm/ks32c5000/current/src/ks5000_ether.c	29 Sep 2003 15:15:43 -0000	1.1.1.1
+++ packages/devs/eth/arm/ks32c5000/current/src/ks5000_ether.c	9 Oct 2003 16:07:22 -0000
@@ -675,10 +675,12 @@ static tEthBuffer *ks32c5000_eth_get_rec
 }
 
 //======================================================================
 static int EthInit(U08* mac_address)
 {
+  unsigned linkStatus;
+
   if (mac_address)
     debug2_printf("EthInit(%02x:%02x:%02x:%02x:%02x:%02x)\n",
                 mac_address[0],mac_address[1],mac_address[2],
                 mac_address[3],mac_address[4],mac_address[5]);
   else
@@ -731,10 +733,29 @@ static int EthInit(U08* mac_address)
               *((volatile unsigned char*)CAM_BaseAddr+2),
               *((volatile unsigned char*)CAM_BaseAddr+3),
               *((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
   debug2_printf("Hardware CRC\n");
 #endif
@@ -1108,11 +1129,11 @@ 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");
   
   if (!firstTime)
     return;
@@ -1182,10 +1203,13 @@ static bool ks32c5000_eth_init(struct cy
   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)  
   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);
   cyg_drv_interrupt_unmask(CYGNUM_HAL_INTERRUPT_ETH_BDMA_RX);
   cyg_drv_interrupt_unmask(CYGNUM_HAL_INTERRUPT_ETH_BDMA_TX);
@@ -1231,15 +1255,33 @@ static int ks32c5000_eth_control(struct 
 #if defined(CYGPKG_NET)      
      case ETH_DRV_GET_IF_STATS_UD:
      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      
      case ETH_DRV_SET_MAC_ADDRESS: {
          int act;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]