NXP LPC1768 Ethernet driver for lwip and CMSIS-RTOS
Dependents: EthernetInterface EthernetInterface EthernetInterface_RSF EthernetInterface ... more
Legacy Networking Libraries
This is an mbed 2 networking library. For mbed 5, the networking libraries have been revised to better support additional network stacks and thread safety here.
This library is based on the code of the NXP LPC port of the Lightweight TCP/IP Stack
Copyright(C) 2011, NXP Semiconductor All rights reserved. Software that is described herein is for illustrative purposes only which provides customers with programming information regarding the products. This software is supplied "AS IS" without any warranties. NXP Semiconductors assumes no responsibility or liability for the use of the software, conveys no license or title under any patent, copyright, or mask work right to the product. NXP Semiconductors reserves the right to make changes in the software without notification. NXP Semiconductors also make no representation or warranty that such application will be suitable for the specified use without further testing or modification.
Diff: arch/TARGET_Freescale/k64f_emac.c
- Revision:
- 20:620d381e7f4c
- Parent:
- 19:007f4e6b2776
- Child:
- 21:10cdd9fe0509
--- a/arch/TARGET_Freescale/k64f_emac.c Fri Sep 19 13:45:16 2014 +0100 +++ b/arch/TARGET_Freescale/k64f_emac.c Mon Sep 22 17:30:30 2014 +0100 @@ -148,7 +148,7 @@ if (bidx == RX_PBUF_AUTO_INDEX) k64f_enet->rx_fill_index = idx; - enet_hal_active_rxbd(BOARD_DEBUG_ENET_INSTANCE); + enet_hal_active_rxbd(BOARD_DEBUG_ENET_INSTANCE_ADDR); LWIP_DEBUGF(UDP_LPC_EMAC | LWIP_DBG_TRACE, ("k64f_rxqueue_pbuf: pbuf packet queued: %p (free desc=%d)\n", p, @@ -296,7 +296,7 @@ static err_t low_level_init(struct netif *netif) { enet_dev_if_t * enetIfPtr; - uint32_t device = BOARD_DEBUG_ENET_INSTANCE; + uint32_t device = BOARD_DEBUG_ENET_INSTANCE_ADDR; enet_rxbd_config_t rxbdCfg; enet_txbd_config_t txbdCfg; enet_phy_speed_t phy_speed; @@ -305,10 +305,10 @@ k64f_init_eth_hardware(); /* Initialize device*/ - enetIfPtr = (enet_dev_if_t *)&enetDevIf[device]; + enetIfPtr = (enet_dev_if_t *)&enetDevIf[BOARD_DEBUG_ENET_INSTANCE]; enetIfPtr->deviceNumber = device; - enetIfPtr->macCfgPtr = &g_enetMacCfg[device]; - enetIfPtr->phyCfgPtr = &g_enetPhyCfg[device]; + enetIfPtr->macCfgPtr = &g_enetMacCfg[BOARD_DEBUG_ENET_INSTANCE]; + enetIfPtr->phyCfgPtr = &g_enetPhyCfg[BOARD_DEBUG_ENET_INSTANCE]; enetIfPtr->macApiPtr = &g_enetMacApi; enetIfPtr->phyApiPtr = (void *)&g_enetPhyApi; memcpy(enetIfPtr->macCfgPtr->macAddr, (char*)netif->hwaddr, kEnetMacAddrLen); @@ -317,7 +317,7 @@ enetIfPtr->macContextPtr = (enet_mac_context_t *)calloc(1, sizeof(enet_mac_context_t)); if (!enetIfPtr->macContextPtr) { return ERR_BUF; - } + } /* Initialize enet buffers*/ if(k64f_rx_setup(netif, &rxbdCfg) != ERR_OK) { @@ -353,7 +353,7 @@ BW_ENET_TCR_FDEN(enetIfPtr->deviceNumber, phy_duplex == kEnetFullDuplex ? kEnetCfgFullDuplex : kEnetCfgHalfDuplex); /* Enable Ethernet module*/ - enet_hal_config_ethernet(device, true, true); + enet_hal_config_ethernet(BOARD_DEBUG_ENET_INSTANCE_ADDR, true, true); /* Active Receive buffer descriptor must be done after module enable*/ enet_hal_active_rxbd(enetIfPtr->deviceNumber); @@ -380,7 +380,7 @@ { /*Clear interrupt*/ enet_hal_clear_interrupt(((enet_dev_if_t *)enetIfPtr)->deviceNumber, kEnetTxFrameInterrupt); - sys_sem_signal(&k64f_enetdata.TxCleanSem); + sys_sem_signal(&k64f_enetdata.TxCleanSem); } /** @@ -393,7 +393,7 @@ * \return ERR_OK or error code */ err_t k64f_etharp_output(struct netif *netif, struct pbuf *q, ip_addr_t *ipaddr) -{ +{ /* Only send packet is link is up */ if (netif->flags & NETIF_FLAG_LINK_UP) return etharp_output(netif, q, ipaddr); @@ -701,7 +701,7 @@ } k64f_enet->tx_produce_index = idx; - enet_hal_active_txbd(BOARD_DEBUG_ENET_INSTANCE); + enet_hal_active_txbd(BOARD_DEBUG_ENET_INSTANCE_ADDR); LINK_STATS_INC(link.xmit); /* Restore access */ @@ -844,7 +844,7 @@ } void eth_arch_enable_interrupts(void) { - enet_hal_config_interrupt(BOARD_DEBUG_ENET_INSTANCE, (kEnetTxFrameInterrupt | kEnetRxFrameInterrupt), true); + enet_hal_config_interrupt(BOARD_DEBUG_ENET_INSTANCE_ADDR, (kEnetTxFrameInterrupt | kEnetRxFrameInterrupt), true); INT_SYS_EnableIRQ(enet_irq_ids[BOARD_DEBUG_ENET_INSTANCE][enetIntMap[kEnetRxfInt]]); INT_SYS_EnableIRQ(enet_irq_ids[BOARD_DEBUG_ENET_INSTANCE][enetIntMap[kEnetTxfInt]]); }