/* Definitions for error constants. */ #define ERR_OK 0 /* No error, everything OK. */ #define ERR_MEM -1 /* Out of memory error. */ #define ERR_BUF -2 /* Buffer error. */ #define ERR_TIMEOUT -3 /* Timeout. */ #define ERR_RTE -4 /* Routing problem. */ #define ERR_INPROGRESS -5 /* Operation in progress */ #define ERR_VAL -6 /* Illegal value. */ #define ERR_WOULDBLOCK -7 /* Operation would block. */ #define ERR_USE -8 /* Address in use. */ #define ERR_ISCONN -9 /* Already connected. */ #define ERR_IS_FATAL(e) ((e) < ERR_ISCONN) #define ERR_ABRT -10 /* Connection aborted. */ #define ERR_RST -11 /* Connection reset. */ #define ERR_CLSD -12 /* Connection closed. */ #define ERR_CONN -13 /* Not connected. */ #define ERR_ARG -14 /* Illegal argument. */ #define ERR_IF -15 /* Low-level netif error */ |
/* Low level init of the MAC and PHY */ static err_t low_level_init(struct netif *netif) { struct lpc_enetdata *lpc_netifdata = netif->state; /* Initialize via Chip ENET function */ Chip_ENET_Init(LPC_ETHERNET, BOARD_ENET_PHY_ADDR); /* Save MAC address */ Chip_ENET_SetADDR(LPC_ETHERNET, netif->hwaddr); /* Initial MAC configuration for checksum offload, full duplex, 100Mbps, disable receive own in half duplex, inter-frame gap of 64-bits */ LPC_ETHERNET->MAC_CONFIG = MAC_CFG_BL(0) | MAC_CFG_IPC | MAC_CFG_DM | MAC_CFG_DO | MAC_CFG_FES | MAC_CFG_PS | MAC_CFG_IFG(3); /* Setup filter */ #if IP_SOF_BROADCAST_RECV LPC_ETHERNET->MAC_FRAME_FILTER = MAC_FF_PR | MAC_FF_RA; #else LPC_ETHERNET->MAC_FRAME_FILTER = 0;/* Only matching MAC address */ #endif /* Initialize the PHY */ #if defined(USE_RMII) if (lpc_phy_init(true, msDelay) != SUCCESS) { return ERROR; <-----------------------------------!!!!!!!!!!!!!!!! - Incorrect - !!!!!!!!!!!!!!!!!!!!!!!! } intMask = RDES_CE | RDES_DE | RDES_RE | RDES_RWT | RDES_LC | RDES_OE | RDES_SAF | RDES_AFM; #else if (lpc_phy_init(false, msDelay) != SUCCESS) { return ERROR; <-----------------------------------!!!!!!!!!!!!!!!! - Incorrect - !!!!!!!!!!!!!!!!!!!!!!!! } intMask = RDES_CE | RDES_RE | RDES_RWT | RDES_LC | RDES_OE | RDES_SAF | RDES_AFM; #endif /* Setup transmit and receive descriptors */ if (lpc_tx_setup(lpc_netifdata) != ERR_OK) { return ERR_BUF; } if (lpc_rx_setup(lpc_netifdata) != ERR_OK) { return ERR_BUF; } |