Xilinx UG194 Virtex-5 FPGA Embedded Tri-Mode Ethernet MAC ...
Xilinx UG194 Virtex-5 FPGA Embedded Tri-Mode Ethernet MAC ...
Xilinx UG194 Virtex-5 FPGA Embedded Tri-Mode Ethernet MAC ...
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
R<br />
// Write to the cntlReg_e1 register to load the data into the<br />
// IRENABLE_e1 register and enable all interrupts<br />
dcr_write(E<strong>MAC</strong>1_DCRBASEADDR + 2, 0x000083A4);<br />
<strong>Ethernet</strong> <strong>MAC</strong> Configuration and Address Filter Access<br />
Reading from an <strong>Ethernet</strong> <strong>MAC</strong> Configuration Register<br />
Using the DCR Bus<br />
To read from an <strong>Ethernet</strong> <strong>MAC</strong> configuration register, the user must perform the following<br />
sequence of operations on the DCR bus:<br />
1. To access E<strong>MAC</strong>0, use E<strong>MAC</strong>0_DCRBASEADDR. To access E<strong>MAC</strong>1, use<br />
E<strong>MAC</strong>1_DCRBASEADDR. Write to the cntlReg register, with the write enable bit<br />
cleared to 0, to indicate a read operation and set the address code to the desired<br />
address of the <strong>Ethernet</strong> <strong>MAC</strong> configuration register to be accessed. The address code<br />
maps directly to the <strong>Ethernet</strong> <strong>MAC</strong> address codes given in Table 4-1.<br />
2. Poll the RDYstatus_e# register until the configuration Read-Ready bit is set to 1 or wait<br />
until the DCRHOSTDONEIR interrupt is asserted.<br />
3. Read from the dataRegLSW register to access data from the <strong>Ethernet</strong> <strong>MAC</strong><br />
configuration register.<br />
The following code demonstrates a processor routine to read from an <strong>Ethernet</strong> <strong>MAC</strong><br />
configuration register. To read from the E<strong>MAC</strong>0 transmitter configuration register:<br />
// E<strong>MAC</strong> Configuration Register 0x280 (E<strong>MAC</strong>0 Transmitter Configuration)<br />
// Write the address of E<strong>MAC</strong>0 Transmitter Configuration register to the<br />
// cntlReg_e0 register<br />
dcr_write(E<strong>MAC</strong>0_DCRBASEADDR + 2, 0x00000280);<br />
// Poll the RDYstatus_e0 register<br />
while ( !(dcr_read(E<strong>MAC</strong>0_DCRBASEADDR + 3) & 0x00010000) );<br />
// Read the dataRegLSW with the values returned from the E<strong>MAC</strong>0<br />
// Transmitter Configuration register<br />
dcr_read (E<strong>MAC</strong>0_DCRBASEADDR + 1);<br />
Writing to an <strong>Ethernet</strong> <strong>MAC</strong> Configuration Register<br />
To write to an <strong>Ethernet</strong> <strong>MAC</strong> configuration register, the user must perform the following<br />
sequence of operations on the DCR bus:<br />
1. Write to the dataRegLSW register with the desired value for the <strong>Ethernet</strong> <strong>MAC</strong><br />
configuration register. This value is mapped to the host configuration register.<br />
2. Write to the cntlReg register with the desired address of the <strong>Ethernet</strong> <strong>MAC</strong><br />
configuration register and the write enable bit to logic 1. Use<br />
E<strong>MAC</strong>0_DCRBASEADDR to access E<strong>MAC</strong>0 and E<strong>MAC</strong>1_DCRBASEADDR to access<br />
E<strong>MAC</strong>1.<br />
3. Poll the RDYstatus_e# register until the configuration Write-Ready bit is set to 1 or<br />
wait until the DCRHOSTDONEIR interrupt is asserted.<br />
To write to the E<strong>MAC</strong>1 flow control register:<br />
// E<strong>MAC</strong> Configuration Register 0x2C0 (E<strong>MAC</strong> Flow Control)<br />
// Write to enable the flow control on both the transmit and receive<br />
// side of E<strong>MAC</strong>1, set bits 29 and 30 to 1<br />
dcr_write(E<strong>MAC</strong>1_DCRBASEADDR + 1, 0x60000000);<br />
// Write the address of Flow Control register to the cntlReg_e1<br />
// register, with the write enable bit asserted<br />
dcr_write(E<strong>MAC</strong>1_DCRBASEADDR + 2, 0x000082C0);<br />
TE<strong>MAC</strong> User Guide www.xilinx.com 109<br />
<strong>UG194</strong> (v1.10) February 14, 2011