Forum Discussion
Altera_Forum
Honored Contributor
12 years agoIf you are using Nios II, uCOS and the NicheStack, then the Altera drivers will already have configured the PHY's chip MDIO address in the mdio_addr1 register. Then you can directly access the PHY's registers.
For that you will need to include in your c code the driver file triple_speed_ethernet_regs.h, and from that use the macro IORD_ALTERA_TSEMAC_MDIO(base, mdio, reg_num) to read a PHY register or IOWR_ALTERA_TSEMAC_MDIO(base, mdio, reg_num, data) to write it. base is the TSE IP base address (as defined in system.h, something like TSE_BASE), mdio is 1, reg_num is the register number (20 in your case) and value the value you want to write.