From 243f1975096846b8f3e6f5013dc9d80e0cb4c231 Mon Sep 17 00:00:00 2001 From: hathach Date: Wed, 18 Sep 2013 20:52:07 +0700 Subject: [PATCH] clean up lwip --- vendor/lwip/lpclwip/arch/cc.h | 8 +-- vendor/lwip/lpclwip/arch/lpc18xx_43xx_emac.c | 15 ++--- vendor/lwip/lpclwip/arch/lpc_debug.c | 63 -------------------- vendor/lwip/lpclwip/lpc_phy_lan8720.c | 1 + vendor/lwip/lwip/src/core/mem.c | 1 + 5 files changed, 14 insertions(+), 74 deletions(-) delete mode 100644 vendor/lwip/lpclwip/arch/lpc_debug.c diff --git a/vendor/lwip/lpclwip/arch/cc.h b/vendor/lwip/lpclwip/arch/cc.h index 3650e5105..6fbbbd24e 100644 --- a/vendor/lwip/lpclwip/arch/cc.h +++ b/vendor/lwip/lpclwip/arch/cc.h @@ -33,6 +33,7 @@ #define __CC_H__ #include +#include "common/assertion.h" /* Types based on stdint.h */ typedef uint8_t u8_t; @@ -86,14 +87,13 @@ typedef uintptr_t mem_ptr_t; #define LWIP_CHKSUM_ALGORITHM 1 #ifdef LWIP_DEBUG -void assert_printf(char *msg, int line, char *file); /* Plaform specific diagnostic output */ -#define LWIP_PLATFORM_DIAG(vars) printf vars -#define LWIP_PLATFORM_ASSERT(flag) { assert_printf((flag), __LINE__, __FILE__); } +#define LWIP_PLATFORM_DIAG(vars) printf(vars) +#define LWIP_PLATFORM_ASSERT(flag) hal_debugger_breakpoint() #else #define LWIP_PLATFORM_DIAG(msg) { ; } -#define LWIP_PLATFORM_ASSERT(flag) { while (1); } +#define LWIP_PLATFORM_ASSERT(flag) hal_debugger_breakpoint() #endif #endif /* __CC_H__ */ diff --git a/vendor/lwip/lpclwip/arch/lpc18xx_43xx_emac.c b/vendor/lwip/lpclwip/arch/lpc18xx_43xx_emac.c index 7f5106d83..887a628c8 100644 --- a/vendor/lwip/lpclwip/arch/lpc18xx_43xx_emac.c +++ b/vendor/lwip/lpclwip/arch/lpc18xx_43xx_emac.c @@ -891,13 +891,13 @@ static err_t low_level_init(struct netif *netif) /* Reset MAC Subsystem internal registers and logic */ LPC_ETHERNET->DMA_BUS_MODE |= DMA_BM_SWR; - timeout = 3; - while (LPC_ETHERNET->DMA_BUS_MODE & DMA_BM_SWR) { - msDelay(1); - timeout--; - if (timeout == 0) - return ERR_TIMEOUT; - } +// timeout = 3; +// while (LPC_ETHERNET->DMA_BUS_MODE & DMA_BM_SWR) { +// msDelay(1); +// timeout--; +// if (timeout == 0) +// return ERR_TIMEOUT; +// } LPC_ETHERNET->DMA_BUS_MODE = DMA_BM_ATDS | DMA_BM_PBL(1) | DMA_BM_RPBL(1); /* Save MAC address */ @@ -1020,6 +1020,7 @@ err_t lpc_etharp_output(struct netif *netif, struct pbuf *q, * ERR_MEM if private data couldn't be allocated * any other err_t on error */ +void boardGetMACaddr(uint8_t *macaddr); // FIXME ethernet err_t lpc_enetif_init(struct netif *netif) { err_t err; diff --git a/vendor/lwip/lpclwip/arch/lpc_debug.c b/vendor/lwip/lpclwip/arch/lpc_debug.c deleted file mode 100644 index 08ee3d52f..000000000 --- a/vendor/lwip/lpclwip/arch/lpc_debug.c +++ /dev/null @@ -1,63 +0,0 @@ -/********************************************************************** -* $Id$ lpc_debug.c 2011-11-20 -*//** -* @file lpc_debug.c -* @brief LWIP debug re-direction -* @version 1.0 -* @date 20. Nov. 2011 -* @author NXP MCU SW Application Team -* -* 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. -**********************************************************************/ - -#include "lwip/opt.h" - -/** @ingroup lwip_lpc_debug - * @{ - */ - -#ifdef LWIP_DEBUG - -/** \brief Displays an error message on assertion - - This function will display an error message on an assertion - to the debug output. - - \param[in] msg Error message to display - \param[in] line Line number in file with error - \param[in] file Filename with error - */ -void assert_printf(char *msg, int line, char *file) -{ - if (msg) { - LWIP_DEBUGF(LWIP_DBG_ON, ("%s:%d in file %s\n", msg, line, file)); - while (1) { - /* Fast LED flash */ - led_set(0); - msDelay(100); - led_set(1); - msDelay(100); - } - } -} - -#endif /* LWIP_DEBUG */ - -/** - * @} - */ - -/* --------------------------------- End Of File ------------------------------ */ diff --git a/vendor/lwip/lpclwip/lpc_phy_lan8720.c b/vendor/lwip/lpclwip/lpc_phy_lan8720.c index 0a47332b3..1fa8b1b90 100644 --- a/vendor/lwip/lpclwip/lpc_phy_lan8720.c +++ b/vendor/lwip/lpclwip/lpc_phy_lan8720.c @@ -29,6 +29,7 @@ #include "lwip/snmp.h" #include "boards/board.h" +#include "arch/lpc_arch.h" // FIXME Ethernet #include "lpc_phy.h" /** @defgroup lan8720_phy PHY status and control for the LAN8720. diff --git a/vendor/lwip/lwip/src/core/mem.c b/vendor/lwip/lwip/src/core/mem.c index 1659a2c7a..bc0f6fcab 100644 --- a/vendor/lwip/lwip/src/core/mem.c +++ b/vendor/lwip/lwip/src/core/mem.c @@ -179,6 +179,7 @@ struct mem { * how that space is calculated). */ #ifndef LWIP_RAM_HEAP_POINTER /** the heap. we need one struct mem at the end and some room for alignment */ + __attribute__ ((section(".data.$RAM4"))) u8_t ram_heap[MEM_SIZE_ALIGNED + (2*SIZEOF_STRUCT_MEM) + MEM_ALIGNMENT]; #define LWIP_RAM_HEAP_POINTER ram_heap #endif /* LWIP_RAM_HEAP_POINTER */