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.
| 2849 | // |
| 2850 | //***************************************************************************** |
| 2851 | void |
| 2852 | EMACPHYWrite(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 | // |
no outgoing calls
no test coverage detected