MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / EMACPHYWrite

Function EMACPHYWrite

bsp/tm4c129x/libraries/driverlib/emac.c:2851–2892  ·  view source on GitHub ↗

Writes to the PHY register. \param ui32Base is the base address of the controller. \param ui8PhyAddr is the physical address of the PHY to access. \param ui8RegAddr is the address of the PHY register to be accessed. \param ui16Data is the data to be written to the PHY register. This function writes the \e ui16Data value to the PHY register specified by \e ui8RegAddr. \return None.

Source from the content-addressed store, hash-verified

2849//
2850//*****************************************************************************
2851void
2852EMACPHYWrite(uint32_t ui32Base, uint8_t ui8PhyAddr, uint8_t ui8RegAddr,
2853 uint16_t ui16Data)
2854{
2855 //
2856 // Parameter sanity check.
2857 //
2858 ASSERT(ui32Base == EMAC0_BASE);
2859
2860 //
2861 // Parameter sanity check.
2862 //
2863 ASSERT(ui8PhyAddr < 32);
2864
2865 //
2866 // Make sure the MII is idle.
2867 //
2868 while(HWREG(ui32Base + EMAC_O_MIIADDR) & EMAC_MIIADDR_MIIB)
2869 {
2870 }
2871
2872 //
2873 // Write the value provided.
2874 //
2875 HWREG(ui32Base + EMAC_O_MIIDATA) = ui16Data;
2876
2877 //
2878 // Tell the MAC to write the given PHY register.
2879 //
2880 HWREG(ui32Base + EMAC_O_MIIADDR) =
2881 ((HWREG(ui32Base + EMAC_O_MIIADDR) &
2882 EMAC_MIIADDR_CR_M) | (ui8RegAddr << EMAC_MIIADDR_MII_S) |
2883 (ui8PhyAddr << EMAC_MIIADDR_PLA_S) | EMAC_MIIADDR_MIIW |
2884 EMAC_MIIADDR_MIIB);
2885
2886 //
2887 // Wait for the write to complete.
2888 //
2889 while(HWREG(ui32Base + EMAC_O_MIIADDR) & EMAC_MIIADDR_MIIB)
2890 {
2891 }
2892}
2893
2894//*****************************************************************************
2895//

Callers 8

EMACPHYExtendedReadFunction · 0.70
EMACPHYExtendedWriteFunction · 0.70
EMACPHYPowerOffFunction · 0.70
EMACPHYPowerOnFunction · 0.70
EMACPHYMMDWriteFunction · 0.70
EMACPHYMMDReadFunction · 0.70
tivaif_hwinitFunction · 0.50
PHY_WriteFunction · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected