cleanup code for IAR compiler
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@50 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
parent
8e76594241
commit
ab5a04e05a
|
@ -31,12 +31,12 @@ sys_sem_t sys_sem_new(u8_t count)
|
||||||
|
|
||||||
rt_snprintf(tname, RT_NAME_MAX, "%s%d", SYS_LWIP_SEM_NAME, counter);
|
rt_snprintf(tname, RT_NAME_MAX, "%s%d", SYS_LWIP_SEM_NAME, counter);
|
||||||
|
|
||||||
#ifdef LWIP_DEBUG
|
#if SYS_DEBUG
|
||||||
{
|
{
|
||||||
struct rt_thread *thread;
|
struct rt_thread *thread;
|
||||||
|
|
||||||
thread = rt_thread_self();
|
thread = rt_thread_self();
|
||||||
LWIP_DEBUGF(TCPIP_DEBUG, ("%s, Create sem: %s \n",thread->name, tname));
|
LWIP_DEBUGF(SYS_DEBUG, ("%s, Create sem: %s \n",thread->name, tname));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -47,12 +47,12 @@ sys_sem_t sys_sem_new(u8_t count)
|
||||||
|
|
||||||
void sys_sem_free(sys_sem_t sem)
|
void sys_sem_free(sys_sem_t sem)
|
||||||
{
|
{
|
||||||
#ifdef LWIP_DEBUG
|
#if SYS_DEBUG
|
||||||
{
|
{
|
||||||
struct rt_thread *thread;
|
struct rt_thread *thread;
|
||||||
thread = rt_thread_self();
|
thread = rt_thread_self();
|
||||||
|
|
||||||
LWIP_DEBUGF(TCPIP_DEBUG, ("%s, Delete sem: %s \n",thread->name,
|
LWIP_DEBUGF(SYS_DEBUG, ("%s, Delete sem: %s \n",thread->name,
|
||||||
sem->parent.parent.name));
|
sem->parent.parent.name));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -64,12 +64,12 @@ void sys_sem_free(sys_sem_t sem)
|
||||||
|
|
||||||
void sys_sem_signal(sys_sem_t sem)
|
void sys_sem_signal(sys_sem_t sem)
|
||||||
{
|
{
|
||||||
#ifdef LWIP_DEBUG
|
#if SYS_DEBUG
|
||||||
{
|
{
|
||||||
struct rt_thread *thread;
|
struct rt_thread *thread;
|
||||||
thread = rt_thread_self();
|
thread = rt_thread_self();
|
||||||
|
|
||||||
LWIP_DEBUGF(TCPIP_DEBUG, ("%s, Release signal: %s , %d\n",thread->name,
|
LWIP_DEBUGF(SYS_DEBUG, ("%s, Release signal: %s , %d\n",thread->name,
|
||||||
sem->parent.parent.name, sem->value));
|
sem->parent.parent.name, sem->value));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -87,12 +87,12 @@ u32_t sys_arch_sem_wait(sys_sem_t sem, u32_t timeout)
|
||||||
|
|
||||||
/* get the begin tick */
|
/* get the begin tick */
|
||||||
tick = rt_tick_get();
|
tick = rt_tick_get();
|
||||||
#ifdef LWIP_DEBUG
|
#if SYS_DEBUG
|
||||||
{
|
{
|
||||||
struct rt_thread *thread;
|
struct rt_thread *thread;
|
||||||
thread = rt_thread_self();
|
thread = rt_thread_self();
|
||||||
|
|
||||||
LWIP_DEBUGF(TCPIP_DEBUG, ("%s, Wait sem: %s , %d\n",thread->name,
|
LWIP_DEBUGF(SYS_DEBUG, ("%s, Wait sem: %s , %d\n",thread->name,
|
||||||
sem->parent.parent.name, sem->value));
|
sem->parent.parent.name, sem->value));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -128,12 +128,12 @@ sys_mbox_t sys_mbox_new(int size)
|
||||||
|
|
||||||
rt_snprintf(tname, RT_NAME_MAX, "%s%d", SYS_LWIP_MBOX_NAME, counter);
|
rt_snprintf(tname, RT_NAME_MAX, "%s%d", SYS_LWIP_MBOX_NAME, counter);
|
||||||
|
|
||||||
#ifdef LWIP_DEBUG
|
#if SYS_DEBUG
|
||||||
{
|
{
|
||||||
struct rt_thread *thread;
|
struct rt_thread *thread;
|
||||||
thread = rt_thread_self();
|
thread = rt_thread_self();
|
||||||
|
|
||||||
LWIP_DEBUGF(TCPIP_DEBUG, ("%s, Create mbox: %s \n",thread->name, tname));
|
LWIP_DEBUGF(SYS_DEBUG, ("%s, Create mbox: %s \n",thread->name, tname));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -144,12 +144,12 @@ sys_mbox_t sys_mbox_new(int size)
|
||||||
|
|
||||||
void sys_mbox_free(sys_mbox_t mbox)
|
void sys_mbox_free(sys_mbox_t mbox)
|
||||||
{
|
{
|
||||||
#ifdef LWIP_DEBUG
|
#if SYS_DEBUG
|
||||||
{
|
{
|
||||||
struct rt_thread *thread;
|
struct rt_thread *thread;
|
||||||
thread = rt_thread_self();
|
thread = rt_thread_self();
|
||||||
|
|
||||||
LWIP_DEBUGF(TCPIP_DEBUG, ("%s, Delete mbox: %s\n",thread->name,
|
LWIP_DEBUGF(SYS_DEBUG, ("%s, Delete mbox: %s\n",thread->name,
|
||||||
mbox->parent.parent.name));
|
mbox->parent.parent.name));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -161,12 +161,12 @@ void sys_mbox_free(sys_mbox_t mbox)
|
||||||
|
|
||||||
void sys_mbox_post(sys_mbox_t mbox, void *msg)
|
void sys_mbox_post(sys_mbox_t mbox, void *msg)
|
||||||
{
|
{
|
||||||
#ifdef LWIP_DEBUG
|
#if SYS_DEBUG
|
||||||
{
|
{
|
||||||
struct rt_thread *thread;
|
struct rt_thread *thread;
|
||||||
thread = rt_thread_self();
|
thread = rt_thread_self();
|
||||||
|
|
||||||
LWIP_DEBUGF(TCPIP_DEBUG, ("%s, Post mail: %s ,0x%x\n",thread->name,
|
LWIP_DEBUGF(SYS_DEBUG, ("%s, Post mail: %s ,0x%x\n",thread->name,
|
||||||
mbox->parent.parent.name, (rt_uint32_t)msg));
|
mbox->parent.parent.name, (rt_uint32_t)msg));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -178,12 +178,12 @@ void sys_mbox_post(sys_mbox_t mbox, void *msg)
|
||||||
|
|
||||||
err_t sys_mbox_trypost(sys_mbox_t mbox, void *msg)
|
err_t sys_mbox_trypost(sys_mbox_t mbox, void *msg)
|
||||||
{
|
{
|
||||||
#ifdef LWIP_DEBUG
|
#if SYS_DEBUG
|
||||||
{
|
{
|
||||||
struct rt_thread *thread;
|
struct rt_thread *thread;
|
||||||
thread = rt_thread_self();
|
thread = rt_thread_self();
|
||||||
|
|
||||||
LWIP_DEBUGF(TCPIP_DEBUG, ("%s, Post mail: %s ,0x%x\n",thread->name,
|
LWIP_DEBUGF(SYS_DEBUG, ("%s, Post mail: %s ,0x%x\n",thread->name,
|
||||||
mbox->parent.parent.name, (rt_uint32_t)msg));
|
mbox->parent.parent.name, (rt_uint32_t)msg));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -216,12 +216,12 @@ u32_t sys_arch_mbox_fetch(sys_mbox_t mbox, void **msg, u32_t timeout)
|
||||||
if(ret == -RT_ETIMEOUT) return SYS_ARCH_TIMEOUT;
|
if(ret == -RT_ETIMEOUT) return SYS_ARCH_TIMEOUT;
|
||||||
else if (ret == RT_EOK) ret = 1;
|
else if (ret == RT_EOK) ret = 1;
|
||||||
|
|
||||||
#ifdef LWIP_DEBUG
|
#if SYS_DEBUG
|
||||||
{
|
{
|
||||||
struct rt_thread *thread;
|
struct rt_thread *thread;
|
||||||
thread = rt_thread_self();
|
thread = rt_thread_self();
|
||||||
|
|
||||||
LWIP_DEBUGF(TCPIP_DEBUG, ("%s, Fetch mail: %s , 0x%x\n",thread->name,
|
LWIP_DEBUGF(SYS_DEBUG, ("%s, Fetch mail: %s , 0x%x\n",thread->name,
|
||||||
mbox->parent.parent.name, *(rt_uint32_t **)msg));
|
mbox->parent.parent.name, *(rt_uint32_t **)msg));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -245,12 +245,12 @@ u32_t sys_arch_mbox_tryfetch(sys_mbox_t mbox, void **msg)
|
||||||
if(ret == -RT_ETIMEOUT) return SYS_ARCH_TIMEOUT;
|
if(ret == -RT_ETIMEOUT) return SYS_ARCH_TIMEOUT;
|
||||||
else if (ret == RT_EOK) ret = 1;
|
else if (ret == RT_EOK) ret = 1;
|
||||||
|
|
||||||
#ifdef LWIP_DEBUG
|
#if SYS_DEBUG
|
||||||
{
|
{
|
||||||
struct rt_thread *thread;
|
struct rt_thread *thread;
|
||||||
thread = rt_thread_self();
|
thread = rt_thread_self();
|
||||||
|
|
||||||
LWIP_DEBUGF(TCPIP_DEBUG, ("%s, Fetch mail: %s , 0x%x\n",thread->name,
|
LWIP_DEBUGF(SYS_DEBUG, ("%s, Fetch mail: %s , 0x%x\n",thread->name,
|
||||||
mbox->parent.parent.name, *(rt_uint32_t **)msg));
|
mbox->parent.parent.name, *(rt_uint32_t **)msg));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,62 +1,61 @@
|
||||||
#include <rtthread.h>
|
#include <rtthread.h>
|
||||||
#ifdef RT_USING_FINSH
|
#ifdef RT_USING_FINSH
|
||||||
#include <finsh.h>
|
#include <finsh.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "lwip/debug.h"
|
#include "lwip/debug.h"
|
||||||
#include "lwip/mem.h"
|
#include "lwip/mem.h"
|
||||||
#include "lwip/memp.h"
|
#include "lwip/sys.h"
|
||||||
#include "lwip/sys.h"
|
#include "lwip/stats.h"
|
||||||
#include "lwip/stats.h"
|
#include "lwip/tcpip.h"
|
||||||
#include "lwip/tcpip.h"
|
#include "lwip/ip_addr.h"
|
||||||
#include "lwip/ip_addr.h"
|
#include "lwip/dhcp.h"
|
||||||
#include "lwip/dhcp.h"
|
|
||||||
|
#include "netif/ethernetif.h"
|
||||||
#include "netif/ethernetif.h"
|
#include "netif/etharp.h"
|
||||||
#include "netif/etharp.h"
|
|
||||||
|
/*
|
||||||
/*
|
* lwip system initial entry
|
||||||
* lwip system initial entry
|
*/
|
||||||
*/
|
void lwip_sys_init()
|
||||||
void lwip_sys_init()
|
{
|
||||||
{
|
struct ip_addr ipaddr, netmask, gw;
|
||||||
struct ip_addr ipaddr, netmask, gw;
|
|
||||||
|
#if LWIP_DHCP
|
||||||
#if LWIP_DHCP
|
rt_uint32_t mscnt = 0;
|
||||||
rt_uint32_t mscnt = 0;
|
|
||||||
|
IP4_ADDR(&gw, 0,0,0,0);
|
||||||
IP4_ADDR(&gw, 0,0,0,0);
|
IP4_ADDR(&ipaddr, 0,0,0,0);
|
||||||
IP4_ADDR(&ipaddr, 0,0,0,0);
|
IP4_ADDR(&netmask, 0,0,0,0);
|
||||||
IP4_ADDR(&netmask, 0,0,0,0);
|
#else
|
||||||
#else
|
IP4_ADDR(&ipaddr, RT_LWIP_IPADDR0, RT_LWIP_IPADDR1, RT_LWIP_IPADDR2, RT_LWIP_IPADDR3);
|
||||||
IP4_ADDR(&ipaddr, RT_LWIP_IPADDR0, RT_LWIP_IPADDR1, RT_LWIP_IPADDR2, RT_LWIP_IPADDR3);
|
IP4_ADDR(&gw, RT_LWIP_GWADDR0, RT_LWIP_GWADDR1, RT_LWIP_GWADDR2, RT_LWIP_GWADDR3);
|
||||||
IP4_ADDR(&gw, RT_LWIP_GWADDR0, RT_LWIP_GWADDR1, RT_LWIP_GWADDR2, RT_LWIP_GWADDR3);
|
IP4_ADDR(&netmask, RT_LWIP_MSKADDR0, RT_LWIP_MSKADDR1, RT_LWIP_MSKADDR2, RT_LWIP_MSKADDR3);
|
||||||
IP4_ADDR(&netmask, RT_LWIP_MSKADDR0, RT_LWIP_MSKADDR1, RT_LWIP_MSKADDR2, RT_LWIP_MSKADDR3);
|
#endif
|
||||||
#endif
|
|
||||||
|
tcpip_init(RT_NULL, RT_NULL);
|
||||||
tcpip_init(RT_NULL, RT_NULL);
|
|
||||||
|
netif_set_addr(netif_default, &ipaddr, &netmask, &gw);
|
||||||
netif_set_addr(netif_default, &ipaddr, &netmask, &gw);
|
netif_set_up(netif_default);
|
||||||
netif_set_up(netif_default);
|
|
||||||
|
#if LWIP_DHCP
|
||||||
#if LWIP_DHCP
|
/* use DHCP client */
|
||||||
/* use DHCP client */
|
dhcp_start(netif_default);
|
||||||
dhcp_start(netif_default);
|
|
||||||
|
while (1) {
|
||||||
while (1) {
|
rt_thread_delay(DHCP_FINE_TIMER_MSECS);
|
||||||
rt_thread_delay(DHCP_FINE_TIMER_MSECS);
|
|
||||||
|
dhcp_fine_tmr();
|
||||||
dhcp_fine_tmr();
|
mscnt += DHCP_FINE_TIMER_MSECS;
|
||||||
mscnt += DHCP_FINE_TIMER_MSECS;
|
if (mscnt >= DHCP_COARSE_TIMER_SECS*1000)
|
||||||
if (mscnt >= DHCP_COARSE_TIMER_SECS*1000)
|
{
|
||||||
{
|
dhcp_coarse_tmr();
|
||||||
dhcp_coarse_tmr();
|
mscnt = 0;
|
||||||
mscnt = 0;
|
}
|
||||||
}
|
}
|
||||||
}
|
#endif
|
||||||
#endif
|
|
||||||
|
#if defined(RT_USING_FINSH) && (LWIP_STATS_DISPLAY)
|
||||||
#if defined(RT_USING_FINSH) && (LWIP_STATS_DISPLAY)
|
finsh_syscall_append("lwip_info", (syscall_func)stats_display);
|
||||||
finsh_syscall_append("lwip_info", (syscall_func)stats_display);
|
#endif
|
||||||
#endif
|
}
|
||||||
}
|
|
||||||
|
|
|
@ -40,7 +40,7 @@
|
||||||
#define LWIP_PLATFORM_BYTESWAP 0
|
#define LWIP_PLATFORM_BYTESWAP 0
|
||||||
#define BYTE_ORDER LITTLE_ENDIAN
|
#define BYTE_ORDER LITTLE_ENDIAN
|
||||||
|
|
||||||
// #define RT_LWIP_DEBUG
|
/* #define RT_LWIP_DEBUG */
|
||||||
|
|
||||||
#ifdef RT_LWIP_DEBUG
|
#ifdef RT_LWIP_DEBUG
|
||||||
#define LWIP_DEBUG
|
#define LWIP_DEBUG
|
||||||
|
@ -52,7 +52,7 @@
|
||||||
#define ETHARP_DEBUG LWIP_DBG_OFF
|
#define ETHARP_DEBUG LWIP_DBG_OFF
|
||||||
#define PPP_DEBUG LWIP_DBG_OFF
|
#define PPP_DEBUG LWIP_DBG_OFF
|
||||||
#define MEM_DEBUG LWIP_DBG_OFF
|
#define MEM_DEBUG LWIP_DBG_OFF
|
||||||
#define MEMP_DEBUG LWIP_DBG_ON
|
#define MEMP_DEBUG LWIP_DBG_OFF
|
||||||
#define PBUF_DEBUG LWIP_DBG_OFF
|
#define PBUF_DEBUG LWIP_DBG_OFF
|
||||||
#define API_LIB_DEBUG LWIP_DBG_OFF
|
#define API_LIB_DEBUG LWIP_DBG_OFF
|
||||||
#define API_MSG_DEBUG LWIP_DBG_OFF
|
#define API_MSG_DEBUG LWIP_DBG_OFF
|
||||||
|
@ -63,8 +63,8 @@
|
||||||
#define AUTOIP_DEBUG LWIP_DBG_OFF
|
#define AUTOIP_DEBUG LWIP_DBG_OFF
|
||||||
#define DHCP_DEBUG LWIP_DBG_OFF
|
#define DHCP_DEBUG LWIP_DBG_OFF
|
||||||
#define IP_DEBUG LWIP_DBG_OFF
|
#define IP_DEBUG LWIP_DBG_OFF
|
||||||
#define IP_REASS_DEBUG LWIP_DBG_OFF
|
#define IP_REASS_DEBUG LWIP_DBG_ON
|
||||||
#define ICMP_DEBUG LWIP_DBG_OFF
|
#define ICMP_DEBUG LWIP_DBG_ON
|
||||||
#define IGMP_DEBUG LWIP_DBG_OFF
|
#define IGMP_DEBUG LWIP_DBG_OFF
|
||||||
#define UDP_DEBUG LWIP_DBG_OFF
|
#define UDP_DEBUG LWIP_DBG_OFF
|
||||||
#define TCP_DEBUG LWIP_DBG_OFF
|
#define TCP_DEBUG LWIP_DBG_OFF
|
||||||
|
@ -84,9 +84,9 @@
|
||||||
#define MEM_ALIGNMENT RT_ALIGN_SIZE
|
#define MEM_ALIGNMENT RT_ALIGN_SIZE
|
||||||
|
|
||||||
#define MEM_LIBC_MALLOC 1
|
#define MEM_LIBC_MALLOC 1
|
||||||
#define malloc rt_malloc
|
#define mem_malloc rt_malloc
|
||||||
#define free rt_free
|
#define mem_free rt_free
|
||||||
#define calloc rt_calloc
|
#define mem_calloc rt_calloc
|
||||||
|
|
||||||
/* MEMP_NUM_PBUF: the number of memp struct pbufs. If the application
|
/* MEMP_NUM_PBUF: the number of memp struct pbufs. If the application
|
||||||
sends a lot of data out of ROM (or other static memory), this
|
sends a lot of data out of ROM (or other static memory), this
|
||||||
|
|
Loading…
Reference in New Issue