static void setMACAddress() {
	unsigned long ulUser0, ulUser1;

	/* Try to get the device MAC address from flash or use a fixed MAC to allow initial configuration */
	ROM_FlashUserGet(&ulUser0, &ulUser1);

	if ((ulUser0 == 0xffffffff) || (ulUser1 == 0xffffffff)) {
		interface.hwaddr[0] = 0xAA;
		interface.hwaddr[1] = 0x00;
		interface.hwaddr[2] = 0x00;
		interface.hwaddr[3] = 0xFF;
		interface.hwaddr[4] = 0xff;
		interface.hwaddr[5] = 0xff;
	} else {
		/* Convert the MAC address from flash into sequence of bytes. */
		interface.hwaddr[0] = ((ulUser0 >> 0) & 0xff);
		interface.hwaddr[1] = ((ulUser0 >> 8) & 0xff);
		interface.hwaddr[2] = ((ulUser0 >> 16) & 0xff);
		interface.hwaddr[3] = ((ulUser1 >> 0) & 0xff);
		interface.hwaddr[4] = ((ulUser1 >> 8) & 0xff);
		interface.hwaddr[5] = ((ulUser1 >> 16) & 0xff);
	}

	/* Program the MAC address. */
	EthernetMACAddrSet(ETH_BASE, interface.hwaddr);
	interface.hwaddr_len = 6;
}
//*****************************************************************************
//
// Set the SimpliciTI device address as the least significant 4 digits of the
// device Ethernet MAC address.  This ensures that the address is unique across
// Stellaris devices.  If the MAC address has not been set, we return false to
// indicate failure.
//
//*****************************************************************************
tBoolean
SetSimpliciTIAddress(void)
{
    unsigned long ulUser0, ulUser1;
    addr_t sAddr;

    //
    // Make sure we are using 4 byte addressing.
    //
    ASSERT(NET_ADDR_SIZE == 4);

    //
    // Get the MAC address from the non-volatile user registers.
    //
    ROM_FlashUserGet(&ulUser0, &ulUser1);

    //
    // Has the MAC address been programmed?
    //
    if((ulUser0 == 0xffffffff) || (ulUser1 == 0xffffffff))
    {
        //
        // No - we don't have an address so return a failure.
        //
        UpdateStatus(false, "Flash user registers are clear");
        UpdateStatus(true, "Error - address not set!");
        return(false);
    }
    else
    {
        //
        // The MAC address is stored with 3 bytes in each of the 2 flash user
        // registers.  Extract the least significant 4 MAC bytes for use as the
        // SimpliciTI device address.
        //
        sAddr.addr[0] = ((ulUser1 >> 16) & 0xff);
        sAddr.addr[1] = ((ulUser1 >>  8) & 0xff);
        sAddr.addr[2] = ((ulUser1 >>  0) & 0xff);
        sAddr.addr[3] = ((ulUser0 >> 16) & 0xff);

        //
        // SimpliciTI requires that the first byte of the device address is
        // never either 0x00 or 0xFF so we check for these cases and invert the
        // first bit if either is detected.  This does result in the
        // possibility of two devices having the same address but, for example
        // purposes, is likely to be fine.
        //
        if((sAddr.addr[0] == 0x00) || (sAddr.addr[0] == 0xFF))
        {
            sAddr.addr[0] ^= 0x80;
        }

        //
        // Tell the SimpliciTI stack which device address we want to use.
        //
        SMPL_Ioctl(IOCTL_OBJ_ADDR, IOCTL_ACT_SET, &sAddr);
    }

    //
    // If we get here, all is well.
    //
    return(true);
}