 
					
				
		
 
					
				
		
/* FUNCTION: ifstats() * * per-iface portion of iface_stats() * * PARAM1: void * pio   - output stream * PARAM2: int ifc      - interface to dump * * EMG - Overloaded function with autonegotiation configuration and soft negotiation * * RETURNS: 0 */intifstats(void * pio, struct net * ifp){ uint16   reg0, reg4, settings; uint8  datarate, duplexe, manual, autodone; char   *cp; datarate = 0; duplexe  = 0; manual   = 0; autodone = 0;  /* get an optional parameter */ cp = nextarg(((GEN_IO)pio)->inbuf); if( *cp ) {  if( strcmp( cp, "soft") == 0 )  {   ns_printf(pio, "\nPerforming Soft Ethernet Negotiation" );       if( SoftEthernetNegotiation( 1 ) )    ns_printf(pio, "\nSuccessfully Negotiated" );    else   {    ns_printf(pio, "\nTry Manual Negotiation" );   }      ns_printf(pio,"\n\n" );   return(0);  }  // We have a parameter  if( strstr(cp, "10") )   datarate = 10;    if( strstr(cp, "100") )   datarate = 100;    if( strstr(cp, "manual") )   manual = 'm';    if( strstr(cp, "auto") )   manual = 'a';    cp = nextarg(((GEN_IO)pio)->inbuf);    if( *cp )  {   if( strstr(cp, "half") )    duplexe = 'h';     if( strstr(cp, "full") )    duplexe = 'f';     }   }   if( datarate || duplexe || manual ) {  ns_printf(pio,"\nSetting ePHY to");   (void)fec_mii_read(0, 0, ®0);  (void)fec_mii_read(0, 4, ®4);  if( datarate == 100 )  {   ns_printf(pio," - 100 Mbps");   reg0 |= 0x2000;  }  else  {   reg0 &= ~0x2000;      ns_printf(pio," - 10 Mbps");  }    if( duplexe == 'f' )  {   ns_printf(pio," - Full Duplex");   reg0 |= 0x0100;   }  else  {   reg0 &= ~0x0100;    ns_printf(pio," - Half Duplex");  }    if( manual == 'm' )  {   ns_printf(pio," - manual");   reg0 &= ~0x1000;   }  if( manual == 'a' )  {   ns_printf(pio," - auto");   reg0 |= 0x1000;   }    if( (datarate == 100) && (duplexe == 'f') )  {   ns_printf(pio," - Advertise 100FD");     reg4 |= 0x0100;  }  else  {   ns_printf(pio," - do NOT Advertise 100FD");   reg4 &= ~0x0100;  }  if( (datarate == 100) && (duplexe == 'h') )  {   ns_printf(pio," - Advertise 100HD");     reg4 |= 0x0080;  }  else  {   ns_printf(pio," - do NOT Advertise 100HD");   reg4 &= ~0x0080;  }  if( (datarate == 10) && (duplexe == 'f') )  {   ns_printf(pio," - Advertise 10FD");     reg4 |= 0x0040;  }  else  {   ns_printf(pio," - do NOT Advertise 10FD");   reg4 &= ~0x0040;  }  if( (datarate == 10) && (duplexe == 'h') )  {   ns_printf(pio," - Advertise 10HD");     reg4 |= 0x0020;  }  else  {   ns_printf(pio," - do NOT Advertise 10HD");   reg4 &= ~0x0020;  }    (void)fec_mii_write( 0, 4, reg4 );  (void)fec_mii_write( 0, 0, reg0 );  (void)fec_mii_write( 0, 0, (reg0|0x0200) ); // Force re-negotiate     ns_printf(pio,"\n\n" );    return 0;  }Message Edited by Alban on 2006-09-08 11:42 AM
 
					
				
		
 
					
				
		
 UK_CF_FAE
		
			UK_CF_FAE
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Message Edited by Alban on 05-11-2006 10:47 AM
 
					
				
		
This stack could be compiled on the CW 6.2? it could be used on other Coldfire w/ FEC?
