Configures basic Ethernet MAC operation parameters. \param ui32Base is the base address of the Ethernet controller. \param ui32Config provides various flags and values configuring the MAC. \param ui32ModeFlags provides configuration relating to the transmit and receive DMA engines. \param ui32RxMaxFrameSize sets the maximum receive frame size above which an error is reported. This function is ca
| 825 | // |
| 826 | //***************************************************************************** |
| 827 | void |
| 828 | EMACConfigSet(uint32_t ui32Base, uint32_t ui32Config, uint32_t ui32ModeFlags, |
| 829 | uint32_t ui32RxMaxFrameSize) |
| 830 | { |
| 831 | // |
| 832 | // Parameter sanity check. Note that we allow TX_ENABLED and RX_ENABLED |
| 833 | // here because we'll mask them off before writing the value and this |
| 834 | // makes back-to-back EMACConfigGet/EMACConfigSet calls work without the |
| 835 | // caller needing to explicitly remove these bits from the parameter. |
| 836 | // |
| 837 | ASSERT((ui32Config & ~(VALID_CONFIG_FLAGS | EMAC_CONFIG_TX_ENABLED | |
| 838 | EMAC_CONFIG_RX_ENABLED)) == 0); |
| 839 | ASSERT(!ui32RxMaxFrameSize || ((ui32RxMaxFrameSize < 0x4000) && |
| 840 | (ui32RxMaxFrameSize > 1522))); |
| 841 | |
| 842 | // |
| 843 | // Set the configuration flags as specified. Note that we unconditionally |
| 844 | // OR in the EMAC_CFG_PS bit here since this implementation supports only |
| 845 | // MII and RMII interfaces to the PHYs. |
| 846 | // |
| 847 | HWREG(ui32Base + EMAC_O_CFG) = |
| 848 | ((HWREG(ui32Base + EMAC_O_CFG) & ~VALID_CONFIG_FLAGS) | ui32Config | |
| 849 | EMAC_CFG_PS); |
| 850 | |
| 851 | // |
| 852 | // Set the maximum receive frame size. If 0 is passed, this implies |
| 853 | // that the default maximum frame size should be used so just turn off |
| 854 | // the override. |
| 855 | // |
| 856 | if(ui32RxMaxFrameSize) |
| 857 | { |
| 858 | HWREG(ui32Base + EMAC_O_WDOGTO) = ui32RxMaxFrameSize | EMAC_WDOGTO_PWE; |
| 859 | } |
| 860 | else |
| 861 | { |
| 862 | HWREG(ui32Base + EMAC_O_WDOGTO) &= ~EMAC_WDOGTO_PWE; |
| 863 | } |
| 864 | |
| 865 | // |
| 866 | // Set the operating mode register. |
| 867 | // |
| 868 | HWREG(ui32Base + EMAC_O_DMAOPMODE) = ui32ModeFlags; |
| 869 | } |
| 870 | |
| 871 | //***************************************************************************** |
| 872 | // |
no outgoing calls
no test coverage detected