arch/arm/src/lpc17xx/lpc17_ethernet.c
/****************************************************************************
 * Function: lpc17_ethreset
 *
 * Description:
 *   Configure and reset the Ethernet module, leaving it in a disabled state.
 *
 * Parameters:
 *   priv   - Reference to the driver state structure
 *
 * Returned Value:
 *   OK on success; a negated errno on failure
 *
 * Assumptions:
 *
 ****************************************************************************/
lpc17_ethreset
Description:
Configure and reset the Ethernet module, leaving it in a disabled state.

priv   - Reference to the driver state structure

Returned Value:
OK on success; a negated errno on failure


lpc17_ethreset Description : Configure and reset the Ethernet module leaving it in a disabled state . priv - Reference to the driver state structure Returned Value : OK on success ; a negated errno on failure
static void lpc17_ethreset(struct lpc17_driver_s *priv)
{
  irqstate_t flags;
  flags = irqsave();
  lpc17_putreg((ETH_MAC1_TXRST    | ETH_MAC1_MCSTXRST | ETH_MAC1_RXRST |
                ETH_MAC1_MCSRXRST | ETH_MAC1_SIMRST   | ETH_MAC1_SOFTRST),
               LPC17_ETH_MAC1);
  lpc17_putreg((ETH_CMD_REGRST | ETH_CMD_TXRST | ETH_CMD_RXRST),
               LPC17_ETH_CMD);
  up_udelay(50);
  lpc17_putreg(0, LPC17_ETH_MAC1);
  lpc17_putreg(ETH_CMD_RMII, LPC17_ETH_CMD);
  lpc17_putreg(0, LPC17_ETH_MAC2);
  lpc17_putreg(0, LPC17_ETH_SUPP);
  lpc17_putreg(0, LPC17_ETH_TEST);
  lpc17_putreg(18, LPC17_ETH_IPGR);
  lpc17_putreg(((15 << ETH_CLRT_RMAX_SHIFT) | (55 << ETH_CLRT_COLWIN_SHIFT)),
               LPC17_ETH_CLRT);
  lpc17_putreg(LPC17_MAXPACKET_SIZE, LPC17_ETH_MAXF);
  lpc17_putreg(0, LPC17_ETH_INTEN);
  lpc17_putreg(0xffffffff, LPC17_ETH_INTCLR);
  irqrestore(flags);
}
static void lpc17_ethreset ( struct lpc17_driver_s * priv ) { irqstate_t flags ; flags = irqsave ( ) ; lpc17_putreg ( ( ETH_MAC1_TXRST | ETH_MAC1_MCSTXRST | ETH_MAC1_RXRST | ETH_MAC1_MCSRXRST | ETH_MAC1_SIMRST | ETH_MAC1_SOFTRST ) , LPC17_ETH_MAC1 ) ; lpc17_putreg ( ( ETH_CMD_REGRST | ETH_CMD_TXRST | ETH_CMD_RXRST ) , LPC17_ETH_CMD ) ; up_udelay ( 50 ) ; lpc17_putreg ( 0 , LPC17_ETH_MAC1 ) ; lpc17_putreg ( ETH_CMD_RMII , LPC17_ETH_CMD ) ; lpc17_putreg ( 0 , LPC17_ETH_MAC2 ) ; lpc17_putreg ( 0 , LPC17_ETH_SUPP ) ; lpc17_putreg ( 0 , LPC17_ETH_TEST ) ; lpc17_putreg ( 18 , LPC17_ETH_IPGR ) ; lpc17_putreg ( ( ( 15 << ETH_CLRT_RMAX_SHIFT ) | ( 55 << ETH_CLRT_COLWIN_SHIFT ) ) , LPC17_ETH_CLRT ) ; lpc17_putreg ( LPC17_MAXPACKET_SIZE , LPC17_ETH_MAXF ) ; lpc17_putreg ( 0 , LPC17_ETH_INTEN ) ; lpc17_putreg ( 0xffffffff , LPC17_ETH_INTCLR ) ; irqrestore ( flags ) ; }
Function: lpc17_ethreset
 Description:
   Configure and reset the Ethernet module, leaving it in a disabled state.
Function : lpc17_ethreset Description : Configure and reset the Ethernet module leaving it in a disabled state .
/* Reset the MAC */ /* Put the MAC into the reset state */ /* Disable RX/RX, clear modes, reset all control registers */ /* Take the MAC out of the reset state */ /* The RMII bit must be set on initialization (I'm not sure this needs
   * to be done here but... oh well).
   */ /* Set other misc configuration-related registers to default values */ /* Set the Maximum Frame size register. "This field resets to the value
   * 0x0600, which represents a maximum receive frame of 1536 octets. An
   * untagged maximum size Ethernet frame is 1518 octets. A tagged frame adds
   * four octets for a total of 1522 octets. If a shorter maximum length
   * restriction is desired, program this 16-bit field."
   */ /* Disable all Ethernet controller interrupts */ /* Clear any pending interrupts (shouldn't be any) */