/* Set the MAC address for this driver/device. The address is a 48-bit value. The device must be stopped before calling this function. */
XStatus XEmac_SetMacAddress(XEmac *InstancePtr, u8 *AddressPtr)
/* Set the MAC address for this driver/device. The address is a 48-bit value. The device must be stopped before calling this function. */
XStatus XEmac_SetMacAddress(XEmac *InstancePtr, u8 *AddressPtr)
{
	u32 MacAddr = 0;
	XASSERT_NONVOID(InstancePtr != NULL);
	XASSERT_NONVOID(AddressPtr != NULL);
	XASSERT_NONVOID(InstancePtr->IsReady == XCOMPONENT_IS_READY);
	if (InstancePtr->IsStarted == XCOMPONENT_IS_STARTED) {
		return XST_DEVICE_IS_STARTED;
	}
	MacAddr = (AddressPtr[0] << 8) | AddressPtr[1];
	XIo_Out32(InstancePtr->BaseAddress + XEM_SAH_OFFSET, MacAddr);
	MacAddr = (AddressPtr[2] << 24) | (AddressPtr[3] << 16) |
	    (AddressPtr[4] << 8) | AddressPtr[5];
	XIo_Out32(InstancePtr->BaseAddress + XEM_SAL_OFFSET, MacAddr);
	return XST_SUCCESS;
}