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

Function EMACAddrGet

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

Gets one of the MAC addresses stored in the Ethernet controller. \param ui32Base is the base address of the controller. \param ui32Index is the zero-based index of the MAC address to return. \param pui8MACAddr is the pointer to the location in which to store the array of MAC-48 address octets. This function reads the currently programmed MAC address into the \e pui8MACAddr buffer. The \e ui32In

Source from the content-addressed store, hash-verified

1232//
1233//*****************************************************************************
1234void
1235EMACAddrGet(uint32_t ui32Base, uint32_t ui32Index, uint8_t *pui8MACAddr)
1236{
1237 uint32_t ui32Val;
1238
1239 //
1240 // Parameter sanity check.
1241 //
1242 ASSERT(ui32Index < NUM_MAC_ADDR);
1243 ASSERT(pui8MACAddr);
1244
1245 //
1246 // Get the first 4 bytes of the MAC address.
1247 //
1248 ui32Val = HWREG(ui32Base + EMAC_O_ADDRL(ui32Index));
1249 pui8MACAddr[0] = ui32Val & 0xFF;
1250 pui8MACAddr[1] = (ui32Val >> 8) & 0xFF;
1251 pui8MACAddr[2] = (ui32Val >> 16) & 0xFF;
1252 pui8MACAddr[3] = (ui32Val >> 24) & 0xFF;
1253
1254 //
1255 // Get the last 2 bytes of the MAC address.
1256 //
1257 ui32Val = HWREG(ui32Base + EMAC_O_ADDRH(ui32Index));
1258 pui8MACAddr[4] = ui32Val & 0xFF;
1259 pui8MACAddr[5] = (ui32Val >> 8) & 0xFF;
1260}
1261
1262//*****************************************************************************
1263//

Callers 1

tivaif_hwinitFunction · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected