Texas Instruments TMS320C645x DSP 사용자 설명서

다운로드
페이지 148
www.ti.com
2.7.2.2
Writing Data to a PHY Register
2.7.2.3
Reading Data From a PHY Register
2.7.2.4
Example of MDIO Register Access Code
EMAC Functional Architecture
The MDIO module includes a user access register (USERACCESSn) to directly access a specified PHY
device. To write a PHY register, perform the following:
1. Ensure that the GO bit in the USERACCESSregister is cleared.
2. Write to the GO, WRITE, REGADR, PHYADR, and DATA bits in USERACCESScorresponding to the
desired PHY and PHY register.
3. The write operation to the PHY is scheduled and completed by the MDIO module. Completion of the
write operation can be determined by polling the GO bit in USERACCESSfor a 0.
4. Completion of the operation sets the corresponding bit in the USERINTRAW register for the
USERACCESSused. If interrupts have been enabled on this bit using the USERINTMASKSET
register, then the bit is also set in the USERINTMASKED register and an interrupt is triggered on the
DSP.
The MDIO module includes a user access register (USERACCESSn) to directly access a specified PHY
device. To read a PHY register, perform the following:
1. Ensure that the GO bit in the USERACCESSregister is cleared.
2. Write to the GO, REGADR, and PHYADR bits in USERACCESScorresponding to the desired PHY
and PHY register.
3. The read data value is available in the DATA bits of USERACCESSafter the module completes the
read operation on the serial bus. Completion of the read operation can be determined by polling the
GO and ACK bits in USERACCESSn. Once the GO bit has cleared, the ACK bit is set on a successful
read.
4. Completion of the operation sets the corresponding bit in the USERINTRAW register for the
USERACCESSused. If interrupts have been enabled on this bit using the USERINTMASKSET
register, then the bit is also set in the USERINTMASKED register and an interrupt is triggered on the
DSP.
The MDIO module uses the USERACCESSregister to access the PHY control registers. Software
functions that implement the access process include the following four macros:
PHYREG_read (regadr, phyadr )
Start the process of reading a PHY register
PHYREG_write(regadr, phyadr, data )
Start the process of writing a PHY register
PHYREG_wait ( )
Synchronize operation (make sure read/write is
idle)
PHYREG_wait Results (results )
Wait for read to complete and return data read
It is not necessary to wait after a write operation, as long as the status is checked before every operation
to make sure the MDIO hardware is idle. An alternative approach is to call PHYREG_wait () after every
write, and PHYREG_wait Results () after every read, then the hardware can be assumed to be idle when
starting a new operation.
SPRU975B – August 2006
Ethernet Media Access Controller (EMAC)/Management Data Input/Output (MDIO)
41