mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-02-07 01:44:41 +08:00
[lwip] integrate and improve lwipopts.h (#5613)
* [lwip-2.1.2] improve lwipopts.h * 增加LWIP RTT侧版本定义 * 移动调整cc.h和lwipopts.h定义 * lwip2.1.2 2.0.3抽出lwipopts.h lwippools.h * remove lwip1.4.1 lwipopts.h * [update] modify the default config through v1.4.1 * delete the useless macro and modify some unclear comments. * [lwipopts.h] 完善头文件相关宏以及临界区保护相关宏 * remove latest version label Co-authored-by: liuxianliang <liuxianliang@rt-thread.com>
This commit is contained in:
committed by
GitHub
parent
d28654570d
commit
b2fa700c2a
@@ -22,7 +22,13 @@ if RT_USING_LWIP
|
||||
|
||||
endchoice
|
||||
|
||||
if (RT_USING_LWIP203 || RT_USING_LWIP212)
|
||||
config RT_USING_LWIP_VER_NUM
|
||||
hex
|
||||
default 0x20102 if RT_USING_LWIP212
|
||||
default 0x20003 if RT_USING_LWIP203
|
||||
default 0x10401 if RT_USING_LWIP141
|
||||
|
||||
if (RT_USING_LWIP_VER_NUM >= 0x20000)
|
||||
config RT_USING_LWIP_IPV6
|
||||
bool "IPV6 protocol"
|
||||
default n
|
||||
|
||||
@@ -63,8 +63,7 @@ src/netif/ppp/vj.c
|
||||
""")
|
||||
|
||||
# The set of source files associated with this SConscript file.
|
||||
path = [GetCurrentDir() + '/src',
|
||||
GetCurrentDir() + '/src/include',
|
||||
path = [GetCurrentDir() + '/src/include',
|
||||
GetCurrentDir() + '/src/include/ipv4',
|
||||
GetCurrentDir() + '/src/include/netif']
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -59,8 +59,7 @@ ppp_src = Glob("src/netif/ppp/*.c") + Glob("src/netif/ppp/polarssl/*c")
|
||||
src = src + ipv4_src
|
||||
|
||||
# The set of source files associated with this SConscript file.
|
||||
path = [GetCurrentDir() + '/src',
|
||||
GetCurrentDir() + '/src/include',
|
||||
path = [GetCurrentDir() + '/src/include',
|
||||
GetCurrentDir() + '/src/include/ipv4',
|
||||
GetCurrentDir() + '/src/include/netif']
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -234,8 +234,7 @@ src += lwipsixlowpan_SRCS
|
||||
|
||||
src += lwipcore4_SRCS
|
||||
|
||||
path = [cwd + '/src',
|
||||
cwd + '/src/include',
|
||||
path = [cwd + '/src/include',
|
||||
cwd + '/src/include/netif']
|
||||
|
||||
if not GetDepend('RT_USING_SAL'):
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
#if 1
|
||||
LWIP_MALLOC_MEMPOOL_START
|
||||
LWIP_MALLOC_MEMPOOL((unsigned char)128, 256)
|
||||
LWIP_MALLOC_MEMPOOL((unsigned char)128, 512)
|
||||
LWIP_MALLOC_MEMPOOL((unsigned char)128, 1024)
|
||||
LWIP_MALLOC_MEMPOOL((unsigned char)128, 1514)
|
||||
LWIP_MALLOC_MEMPOOL((unsigned char)128, 1536)
|
||||
LWIP_MALLOC_MEMPOOL((unsigned char)128, 4096)
|
||||
LWIP_MALLOC_MEMPOOL_END
|
||||
#endif
|
||||
@@ -56,7 +56,7 @@
|
||||
#endif /* ARCH_CPU_BIG_ENDIAN */
|
||||
#endif /* BYTE_ORDER */
|
||||
|
||||
#ifdef RT_USING_LWIP141
|
||||
#if RT_USING_LWIP_VER_NUM < 0x20000
|
||||
#include <stdint.h>
|
||||
typedef uint8_t u8_t;
|
||||
typedef int8_t s8_t;
|
||||
@@ -72,20 +72,7 @@ typedef uintptr_t mem_ptr_t;
|
||||
#define U32_F "lu"
|
||||
#define S32_F "ld"
|
||||
#define X32_F "lx"
|
||||
#endif /* RT_USING_LWIP141 */
|
||||
|
||||
#include <sys/errno.h>
|
||||
/* some errno not defined in newlib */
|
||||
#ifndef ENSRNOTFOUND
|
||||
#define ENSRNOTFOUND 163 /* Domain name not found */
|
||||
/* WARNING: ESHUTDOWN also not defined in newlib. We chose
|
||||
180 here because the number "108" which is used
|
||||
in arch.h has been assigned to another error code. */
|
||||
#endif
|
||||
|
||||
/* LWIP_TIMEVAL_PRIVATE: provided by <sys/time.h> */
|
||||
#include <sys/time.h>
|
||||
#define LWIP_TIMEVAL_PRIVATE 0
|
||||
#endif /* RT_USING_LWIP_VER_NUM < 0x20000 */
|
||||
|
||||
#if defined(__CC_ARM) /* ARMCC compiler */
|
||||
#define PACK_STRUCT_FIELD(x) x
|
||||
@@ -119,8 +106,4 @@ void sys_arch_assert(const char* file, int line);
|
||||
#define LWIP_PLATFORM_DIAG(x) do {rt_kprintf x;} while(0)
|
||||
#define LWIP_PLATFORM_ASSERT(x) do {rt_kprintf(x); sys_arch_assert(__FILE__, __LINE__);}while(0)
|
||||
|
||||
#define SYS_ARCH_DECL_PROTECT(level) register rt_base_t level
|
||||
#define SYS_ARCH_PROTECT(level) do {level = rt_hw_interrupt_disable();} while(0)
|
||||
#define SYS_ARCH_UNPROTECT(level) do {rt_hw_interrupt_enable(level);} while(0)
|
||||
|
||||
#endif /* __ARCH_CC_H__ */
|
||||
|
||||
@@ -1,12 +1,50 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2022, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2022-02-23 Meco Man integrate v1.4.1 v2.0.3 and v2.1.2 porting layer
|
||||
* 2022-02-25 xiangxistu modify the default config through v1.4.1
|
||||
*/
|
||||
|
||||
#ifndef __LWIPOPTS_H__
|
||||
#define __LWIPOPTS_H__
|
||||
|
||||
#include <rtconfig.h>
|
||||
|
||||
#define LWIP_ERRNO_STDINCLUDE
|
||||
#define LWIP_SOCKET_SELECT 1
|
||||
#define LWIP_SOCKET_POLL 1
|
||||
/* ---------- LIBC and standard header files ---------- */
|
||||
#include <limits.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/errno.h>
|
||||
#define LWIP_ERRNO_INCLUDE "sys/errno.h"
|
||||
|
||||
#define LWIP_TIMEVAL_PRIVATE 0
|
||||
#define LWIP_NO_UNISTD_H 0
|
||||
#define LWIP_NO_STDDEF_H 0
|
||||
#define LWIP_NO_STDINT_H 0
|
||||
#define LWIP_NO_INTTYPES_H 0
|
||||
#define LWIP_NO_LIMITS_H 0
|
||||
#define LWIP_NO_CTYPE_H 0
|
||||
#define LWIP_SOCKET_SELECT 1
|
||||
#define LWIP_SOCKET_POLL 1
|
||||
|
||||
#define LWIP_RAND rand
|
||||
|
||||
#ifndef SSIZE_MAX
|
||||
#define SSIZE_MAX INT_MAX
|
||||
#endif
|
||||
|
||||
/* some errno not defined in newlib */
|
||||
#ifndef ENSRNOTFOUND
|
||||
#define ENSRNOTFOUND 163 /* Domain name not found */
|
||||
#endif
|
||||
|
||||
/* ---------- Basic Configuration ---------- */
|
||||
#define LWIP_IPV4 1
|
||||
|
||||
#ifdef RT_USING_LWIP_IPV6
|
||||
@@ -16,6 +54,7 @@
|
||||
#endif /* RT_USING_LWIP_IPV6 */
|
||||
|
||||
#define NO_SYS 0
|
||||
#define SYS_LIGHTWEIGHT_PROT 1
|
||||
#define LWIP_SOCKET 1
|
||||
#define LWIP_NETCONN 1
|
||||
|
||||
@@ -227,19 +266,19 @@
|
||||
|
||||
#define LWIP_DBG_TYPES_ON (LWIP_DBG_ON|LWIP_DBG_TRACE|LWIP_DBG_STATE|LWIP_DBG_FRESH|LWIP_DBG_HALT)
|
||||
|
||||
# ifndef __STRICT_ANSI__
|
||||
# define SSIZE_MAX LONG_MAX
|
||||
# endif
|
||||
|
||||
#define LWIP_NO_UNISTD_H 0
|
||||
|
||||
/* ---------- Memory options ---------- */
|
||||
#define MEMCPY(dst,src,len) rt_memcpy(dst,src,len)
|
||||
#define SMEMCPY(dst,src,len) MEMCPY(dst,src,len)
|
||||
|
||||
#ifdef RT_LWIP_MEM_ALIGNMENT
|
||||
#define MEM_ALIGNMENT RT_LWIP_MEM_ALIGNMENT
|
||||
#else
|
||||
#define MEM_ALIGNMENT 4
|
||||
#endif
|
||||
|
||||
#define MEMP_OVERFLOW_CHECK 1
|
||||
#define LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT 1
|
||||
|
||||
//#define MEM_LIBC_MALLOC 1
|
||||
//#define MEM_USE_POOLS 1
|
||||
//#define MEMP_USE_CUSTOM_POOLS 1
|
||||
@@ -313,13 +352,6 @@
|
||||
#define ETH_PAD_SIZE RT_LWIP_ETH_PAD_SIZE
|
||||
#endif
|
||||
|
||||
/** SYS_LIGHTWEIGHT_PROT
|
||||
* define SYS_LIGHTWEIGHT_PROT in lwipopts.h if you want inter-task protection
|
||||
* for certain critical regions during buffer allocation, deallocation and memory
|
||||
* allocation and deallocation.
|
||||
*/
|
||||
#define SYS_LIGHTWEIGHT_PROT (NO_SYS==0)
|
||||
|
||||
#ifdef LWIP_USING_NAT
|
||||
#define IP_NAT 1
|
||||
#else
|
||||
@@ -552,23 +584,8 @@
|
||||
#define LWIP_NETIF_API 1
|
||||
#endif
|
||||
|
||||
#ifdef LWIP_IGMP
|
||||
#include <stdlib.h>
|
||||
#define LWIP_RAND rand
|
||||
#endif
|
||||
/*
|
||||
------------------------------------
|
||||
---------- Socket options ----------
|
||||
------------------------------------
|
||||
*/
|
||||
/*
|
||||
* LWIP_SOCKET==1: Enable Socket API (require to use sockets.c)
|
||||
*/
|
||||
#ifndef LWIP_SOCKET
|
||||
#define LWIP_SOCKET 1
|
||||
#endif
|
||||
#include <fcntl.h>
|
||||
#include <sys/ioctl.h>
|
||||
/* MEMP_NUM_SYS_TIMEOUT: the number of simulateously active timeouts. */
|
||||
#define MEMP_NUM_SYS_TIMEOUT (LWIP_TCP + IP_REASSEMBLY + LWIP_ARP + (2*LWIP_DHCP) + LWIP_AUTOIP + LWIP_IGMP + LWIP_DNS + PPP_SUPPORT)
|
||||
|
||||
/*
|
||||
* LWIP_COMPAT_SOCKETS==1: Enable BSD-style sockets functions names.
|
||||
@@ -619,26 +636,10 @@
|
||||
#define SO_REUSE 0
|
||||
#endif
|
||||
|
||||
/*
|
||||
------------------------------------
|
||||
------- Applications options -------
|
||||
------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* Max. length of TFTP filename
|
||||
*/
|
||||
#ifdef RT_LWIP_TFTP_MAX_FILENAME_LEN
|
||||
#define TFTP_MAX_FILENAME_LEN RT_LWIP_TFTP_MAX_FILENAME_LEN
|
||||
#elif defined(RT_DFS_ELM_MAX_LFN)
|
||||
#define TFTP_MAX_FILENAME_LEN RT_DFS_ELM_MAX_LFN
|
||||
#else
|
||||
#define TFTP_MAX_FILENAME_LEN 64
|
||||
#endif
|
||||
|
||||
|
||||
#if RT_USING_LWIP_VER_NUM >= 0x20000 /* >= v2.0.0 */
|
||||
#define LWIP_HOOK_IP4_ROUTE_SRC(dest, src) lwip_ip4_route_src(dest, src)
|
||||
#include "lwip/ip_addr.h"
|
||||
struct netif *lwip_ip4_route_src(const ip4_addr_t *dest, const ip4_addr_t *src);
|
||||
#endif /* RT_USING_LWIP_VER_NUM >= 0x20000 */
|
||||
|
||||
#endif /* __LWIPOPTS_H__ */
|
||||
@@ -5,7 +5,7 @@
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2022-02-22 liuxianliang integrate v1.4.1 v2.0.3 and v2.1.2 porting layer
|
||||
* 2022-02-22 xiangxistu integrate v1.4.1 v2.0.3 and v2.1.2 porting layer
|
||||
*/
|
||||
|
||||
#ifndef __NETIF_ETHERNETIF_H__
|
||||
|
||||
@@ -527,7 +527,6 @@ u32_t sys_now(void)
|
||||
return rt_tick_get_millisecond();
|
||||
}
|
||||
|
||||
#if LWIP_VERSION_MAJOR >= 2U /* >= v2.x */
|
||||
RT_WEAK void mem_init(void)
|
||||
{
|
||||
}
|
||||
@@ -553,7 +552,6 @@ void mem_free(void *mem)
|
||||
{
|
||||
rt_free(mem);
|
||||
}
|
||||
#endif /* LWIP_VERSION_MAJOR >= 2U */
|
||||
|
||||
#ifdef RT_LWIP_PPP
|
||||
u32_t sio_read(sio_fd_t fd, u8_t *buf, u32_t size)
|
||||
@@ -593,7 +591,7 @@ void ppp_trace(int level, const char *format, ...)
|
||||
}
|
||||
#endif /* RT_LWIP_PPP */
|
||||
|
||||
#if (LWIP_VERSION_MAJOR * 100 + LWIP_VERSION_MINOR) >= 201 /* >= v2.1.0 */
|
||||
#if LWIP_VERSION_MAJOR >= 2 /* >= v2.x */
|
||||
#if MEM_OVERFLOW_CHECK || MEMP_OVERFLOW_CHECK
|
||||
/**
|
||||
* Check if a mep element was victim of an overflow or underflow
|
||||
@@ -633,8 +631,8 @@ void mem_overflow_check_raw(void *p, size_t size, const char *descr1, const char
|
||||
#endif /* MEM_SANITY_REGION_BEFORE_ALIGNED > 0 */
|
||||
#else
|
||||
LWIP_UNUSED_ARG(p);
|
||||
LWIP_UNUSED_ARG(desc);
|
||||
LWIP_UNUSED_ARG(descr);
|
||||
LWIP_UNUSED_ARG(descr1);
|
||||
LWIP_UNUSED_ARG(descr2);
|
||||
#endif /* MEM_SANITY_REGION_AFTER_ALIGNED || MEM_SANITY_REGION_BEFORE_ALIGNED */
|
||||
}
|
||||
|
||||
@@ -655,7 +653,7 @@ void mem_overflow_init_raw(void *p, size_t size)
|
||||
#endif
|
||||
#else /* MEM_SANITY_REGION_BEFORE_ALIGNED > 0 || MEM_SANITY_REGION_AFTER_ALIGNED > 0 */
|
||||
LWIP_UNUSED_ARG(p);
|
||||
LWIP_UNUSED_ARG(desc);
|
||||
LWIP_UNUSED_ARG(size);
|
||||
#endif /* MEM_SANITY_REGION_BEFORE_ALIGNED > 0 || MEM_SANITY_REGION_AFTER_ALIGNED > 0 */
|
||||
}
|
||||
#endif /* MEM_OVERFLOW_CHECK || MEMP_OVERFLOW_CHECK */
|
||||
@@ -685,7 +683,7 @@ struct netif *lwip_ip4_route_src(const ip4_addr_t *dest, const ip4_addr_t *src)
|
||||
return netif;
|
||||
}
|
||||
#endif /* LWIP_HOOK_IP4_ROUTE_SRC */
|
||||
#endif /* (LWIP_VERSION_MAJOR * 100 + LWIP_VERSION_MINOR) >= 201 */
|
||||
#endif /*LWIP_VERSION_MAJOR >= 2 */
|
||||
|
||||
#if LWIP_SOCKET
|
||||
#include <lwip/sockets.h>
|
||||
|
||||
Reference in New Issue
Block a user