/* Set MAC Address function Loads the selected MAC Address in device's registers.  */
void eth_cyclonev_set_mac_addr(uint8_t *address, uint32_t instance, uint32_t n, struct eth_cyclonev_priv *p)
/* Set MAC Address function Loads the selected MAC Address in device's registers.  */
void eth_cyclonev_set_mac_addr(uint8_t *address, uint32_t instance, uint32_t n, struct eth_cyclonev_priv *p)
{
	uint32_t tmpreg;
	if (instance > 1) {
		return;
	}
	if (n > 15) {
		LOG_ERR("Invalid index of MAC Address: %d", n);
		return;
	}
	tmpreg = ((uint32_t)address[5] << 8) | (uint32_t)address[4];
	sys_write32(tmpreg, EMAC_GMAC_MAC_ADDR_HIGH_ADDR(p->base_addr, n));
	tmpreg = ((uint32_t)address[3] << 24) | ((uint32_t)address[2] << 16) |
		 ((uint32_t)address[1] << 8) | address[0];
	sys_write32(tmpreg, EMAC_GMAC_MAC_ADDR_LOW_ADDR(p->base_addr, n));
}