clean up lwip

This commit is contained in:
hathach 2013-09-18 20:52:07 +07:00
parent 1cd2d5cf36
commit 243f197509
5 changed files with 14 additions and 74 deletions

View File

@ -33,6 +33,7 @@
#define __CC_H__
#include <stdint.h>
#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__ */

View File

@ -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;

View File

@ -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 ------------------------------ */

View File

@ -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.

View File

@ -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 */