
www.ti.com
EMAC Functional Architecture
The implementation of these macros using the register layer Chip Support Library (CSL) is shown in Example 3 (USERACCESS0 is assumed).
Note that this implementation does not check the ACK bit on PHY register reads; in other words, it does not follow the procedure outlined in Section 2.7.2.3. As the ALIVE register initially selects a PHY, it is assumed that the PHY is acknowledging read operations. It is possible that a PHY could become inactive at a future point in time. For example, a PHY can have its MDIO addresses changed while the system is running, although it is not a common occurrence. This condition can be tested by periodically checking the PHY state in the ALIVE register.
Example 3. MDIO Register Access Macros
#define PHYREG_read(regadr, phyadr) |
| \ |
|
| \ |
CSL_FMK(MDIO_USERACCESS0_GO,1u) | \ | |
CSL_FMK(MDIO_USERACCESS0_REGADR,regadr) | \ | |
CSL_FMK(MDIO_USERACCESS0_PHYADR,phyadr) |
|
|
#define PHYREG_write(regadr, phyadr, data) |
| \ |
| \ | |
CSL_FMK(MDIO_USERACCESS0_GO,1u) | \ | |
CSL_FMK(MDIO_USERACCESS0_WRITE,1) | \ | |
CSL_FMK(MDIO_USERACCESS0_REGADR,regadr) | \ | |
CSL_FMK(MDIO_USERACCESS0_PHYADR,phyadr) | \ | |
CSL_FMK(MDIO_USERACCESS0_DATA, data) |
|
|
#define PHYREG_wait() |
| \ |
while
#define PHYREG_wait Results(results ) { | \ |
while
42 | Ethernet Media Access Controller (EMAC)/Management Data Input/Output (MDIO) | SPRU975B |