We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

AR# 21139

9.1i EDK - How do I make my VxWorks 5.x EMAC drivers compatible with auto-negotiable PHYs?


The EMAC drivers provided for VxWorks 5.x are not directly compatible with auto-negotiable PHYs. The OPB Ethernet v1.02a documentation states, "It is the responsibility of the software to ensure that this mode matches the PHY, if the PHY is operating in auto-negotiation mode." 


How can I do this?


You can access the PHY through the management interface, then set or clear the EMAC options that control the core's full-duplex operation using the level "1" interface for the EMAC drivers. Sample code for this operation is as follows: 


 #include "xemac_end_adapter.h" 



The PhyAddr is a factor of the board design, but is usually 0. The Unit 

is associated with the order in which VxWorks loaded an EMAC instance. 

For designs that have a single EMAC, the Unit should be 0. 



void SetDuplex(int PhyAddr, int Unit) 

XEmac *MacPtr = XEmacEndAdapter_GetDriver(Unit); 

Xuint16 Data; 

Xuint32 Options; 

if (MacPtr == NULL) 

return; /* VxWorks hasn't loaded this unit */ 


Options = XEmac_GetOptions(MacPtr); 


/* Check PHY's MII control register */ 

XEmac_PhyRead(MacPtr, PhyAddr, 0, &Data); 

if (Data & 0x0100) 

/* Operating in full duplex */ 

XEmac_SetOptions(MacPtr, Options & XEM_FDUPLEX_OPTION); 


/* Operating in half-duplex */ 

XEmac_SetOptions(MacPtr, Options & ~XEM_FDUPLEX_OPTION); 



The constants used to check the data should be the same for all PHYs that follow MII standards.

AR# 21139
Date 05/19/2014
Status Archive
Type General Article
Page Bookmarked