/* Setup the EMAC for the link : speed 100M/10M and Full/Half duplex  */
void EMAC_SetLinkSpeed(unsigned char speed, unsigned char fullduplex)
/* Setup the EMAC for the link : speed 100M/10M and Full/Half duplex  */
void EMAC_SetLinkSpeed(unsigned char speed, unsigned char fullduplex)
{
    unsigned int ncfgr;
    ncfgr = AT91C_BASE_EMAC->EMAC_NCFGR;
    ncfgr &= ~(AT91C_EMAC_SPD | AT91C_EMAC_FD);
    if (speed) {
        ncfgr |= AT91C_EMAC_SPD;
    }
    if (fullduplex) {
        ncfgr |= AT91C_EMAC_FD;
    }
    AT91C_BASE_EMAC->EMAC_NCFGR = ncfgr;
}