Programming Examples
8-130
ADSP-BF537 Blackfin Processor Hardware Reference
PHY Control Routines
The
EMAC_STAAD
register provides the option of either polling the
STABUSY
bit or getting an interrupt during each MIM block access. The function in
polls the
STABUSY
bit and should be placed after each read or
write command to the PHY register.
Listing 8-7. Poll MIM Block
//
/* Wait until the previous MDC/MDIO transaction has completed */
//
void PollMdcDone(void)
{
/* poll the STABUSY bit */
while(*pEMAC_STAADD & STABUSY)
}
Shown in
SET_PHYAD
and
SET_REGAD
macros shift the
PHY-
Addr
and
RegAddr
values to the appropriate field within the
EMAC_STAADD
register. The other macros
STAOP
,
STAIE
, and
STABUSY
, also set bits in the
STAADD
register. Use of the
STAOP
macro controls the read and write trans-
fer of the MIM block.
Listing 8-8. Write Access to the PHY
//
/* Write an off-chip register in a PHY through the MDC/MDIO port
*/
//
void WrPHYReg(u16 PHYAddr, u16 RegAddr, u16 Data)
{
PollMdcDone();
*pEMAC_STADAT = Data;
*pEMAC_STAADD = SET_PHYAD(PHYAddr) | \
Summary of Contents for Blackfin ADSP-BF537
Page 42: ...Contents xlii ADSP BF537 Blackfin Processor Hardware Reference ...
Page 90: ...Development Tools 1 32 ADSP BF537 Blackfin Processor Hardware Reference ...
Page 138: ...Programming Examples 4 26 ADSP BF537 Blackfin Processor Hardware Reference ...
Page 340: ...SDC Programming Examples 6 84 ADSP BF537 Blackfin Processor Hardware Reference ...
Page 606: ...Programming Examples 9 94 ADSP BF537 Blackfin Processor Hardware Reference ...
Page 660: ...Programming Examples 10 54 ADSP BF537 Blackfin Processor Hardware Reference ...
Page 720: ...Electrical Specifications 11 60 ADSP BF537 Blackfin Processor Hardware Reference ...
Page 840: ...Programming Examples 13 42 ADSP BF537 Blackfin Processor Hardware Reference ...
Page 876: ...Programming Examples 14 36 ADSP BF537 Blackfin Processor Hardware Reference ...
Page 938: ...Programming Examples 15 62 ADSP BF537 Blackfin Processor Hardware Reference ...
Page 958: ...Programming Examples 17 12 ADSP BF537 Blackfin Processor Hardware Reference ...
Page 986: ...Programming Examples 18 28 ADSP BF537 Blackfin Processor Hardware Reference ...
Page 1162: ...G 26 ADSP BF537 Blackfin Processor Hardware Reference ...
Page 1218: ...Index I 56 ADSP BF537 Blackfin Processor Hardware Reference ...