mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-02-09 05:00:00 +08:00
Merge pull request #58 from BernardXiong/master
Add the first porting for lwip 1.4.1.
This commit is contained in:
@@ -1,10 +1,15 @@
|
||||
# for network related component
|
||||
import os
|
||||
Import('RTT_ROOT')
|
||||
from building import *
|
||||
|
||||
objs = []
|
||||
list = os.listdir(os.path.join(RTT_ROOT, 'components', 'net'))
|
||||
|
||||
# the default version of LWIP is 1.4.0
|
||||
if not GetDepend('RT_USING_LWIP132') and not GetDepend('RT_USING_LWIP141'):
|
||||
AddDepend('RT_USING_LWIP140')
|
||||
|
||||
for d in list:
|
||||
path = os.path.join(RTT_ROOT, 'components', 'net', d)
|
||||
if os.path.isfile(os.path.join(path, 'SConscript')):
|
||||
|
||||
87
components/net/lwip-1.4.1/SConscript
Normal file
87
components/net/lwip-1.4.1/SConscript
Normal file
@@ -0,0 +1,87 @@
|
||||
Import('RTT_ROOT')
|
||||
from building import *
|
||||
|
||||
src = Split("""
|
||||
src/api/api_lib.c
|
||||
src/api/api_msg.c
|
||||
src/api/err.c
|
||||
src/api/netbuf.c
|
||||
src/api/netdb.c
|
||||
src/api/netifapi.c
|
||||
src/api/sockets.c
|
||||
src/api/tcpip.c
|
||||
src/arch/sys_arch.c
|
||||
src/core/def.c
|
||||
src/core/dhcp.c
|
||||
src/core/dns.c
|
||||
src/core/init.c
|
||||
src/core/memp.c
|
||||
src/core/netif.c
|
||||
src/core/pbuf.c
|
||||
src/core/raw.c
|
||||
src/core/stats.c
|
||||
src/core/sys.c
|
||||
src/core/tcp.c
|
||||
src/core/tcp_in.c
|
||||
src/core/tcp_out.c
|
||||
src/core/timers.c
|
||||
src/core/udp.c
|
||||
src/core/ipv4/autoip.c
|
||||
src/core/ipv4/icmp.c
|
||||
src/core/ipv4/igmp.c
|
||||
src/core/ipv4/inet.c
|
||||
src/core/ipv4/inet_chksum.c
|
||||
src/core/ipv4/ip.c
|
||||
src/core/ipv4/ip_addr.c
|
||||
src/core/ipv4/ip_frag.c
|
||||
src/netif/etharp.c
|
||||
src/netif/ethernetif.c
|
||||
src/netif/slipif.c
|
||||
""")
|
||||
|
||||
snmp_src = Split("""
|
||||
src/core/snmp/asn1_dec.c
|
||||
src/core/snmp/asn1_enc.c
|
||||
src/core/snmp/mib2.c
|
||||
src/core/snmp/mib_structs.c
|
||||
src/core/snmp/msg_in.c
|
||||
src/core/snmp/msg_out.c
|
||||
""")
|
||||
|
||||
ppp_src = Split("""
|
||||
src/netif/ppp/auth.c
|
||||
src/netif/ppp/chap.c
|
||||
src/netif/ppp/chpms.c
|
||||
src/netif/ppp/fsm.c
|
||||
src/netif/ppp/ipcp.c
|
||||
src/netif/ppp/lcp.c
|
||||
src/netif/ppp/magic.c
|
||||
src/netif/ppp/md5.c
|
||||
src/netif/ppp/pap.c
|
||||
src/netif/ppp/ppp.c
|
||||
src/netif/ppp/ppp_oe.c
|
||||
src/netif/ppp/randm.c
|
||||
src/netif/ppp/vj.c
|
||||
""")
|
||||
|
||||
# The set of source files associated with this SConscript file.
|
||||
path = [GetCurrentDir() + '/src',
|
||||
GetCurrentDir() + '/src/include',
|
||||
GetCurrentDir() + '/src/include/ipv4',
|
||||
GetCurrentDir() + '/src/arch/include',
|
||||
GetCurrentDir() + '/src/include/netif']
|
||||
|
||||
if GetDepend(['RT_LWIP_SNMP']):
|
||||
src += snmp_src
|
||||
|
||||
if GetDepend(['RT_LWIP_PPP']):
|
||||
src += ppp_src
|
||||
path += [GetCurrentDir() + '/src/netif/ppp']
|
||||
|
||||
# For testing apps
|
||||
if GetDepend(['RT_USING_NETUTILS']):
|
||||
src += Glob('./apps/*.c')
|
||||
|
||||
group = DefineGroup('LwIP', src, depend = ['RT_USING_LWIP', 'RT_USING_LWIP141'], CPPPATH = path)
|
||||
|
||||
Return('group')
|
||||
35
components/net/lwip-1.4.1/src/arch/include/arch/bpstruct.h
Normal file
35
components/net/lwip-1.4.1/src/arch/include/arch/bpstruct.h
Normal file
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright (c) 2001-2003 Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the lwIP TCP/IP stack.
|
||||
*
|
||||
* Author: Adam Dunkels <adam@sics.se>
|
||||
*
|
||||
*/
|
||||
|
||||
#if defined(__ICCARM__)
|
||||
#pragma pack(1)
|
||||
#endif
|
||||
107
components/net/lwip-1.4.1/src/arch/include/arch/cc.h
Normal file
107
components/net/lwip-1.4.1/src/arch/include/arch/cc.h
Normal file
@@ -0,0 +1,107 @@
|
||||
/*
|
||||
* Copyright (c) 2001, Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the lwIP TCP/IP stack.
|
||||
*
|
||||
* Author: Adam Dunkels <adam@sics.se>
|
||||
*
|
||||
* $Id: cc.h,v 1.1.1.1 2004/12/16 14:17:13 bear Exp $
|
||||
*/
|
||||
#ifndef __ARCH_CC_H__
|
||||
#define __ARCH_CC_H__
|
||||
|
||||
#include <rthw.h>
|
||||
#include <rtthread.h>
|
||||
|
||||
typedef rt_uint8_t u8_t;
|
||||
typedef rt_int8_t s8_t;
|
||||
typedef rt_uint16_t u16_t;
|
||||
typedef rt_int16_t s16_t;
|
||||
typedef rt_uint32_t u32_t;
|
||||
typedef rt_int32_t s32_t;
|
||||
typedef rt_uint32_t mem_ptr_t;
|
||||
|
||||
#define U16_F "hu"
|
||||
#define S16_F "hd"
|
||||
#define X16_F "hx"
|
||||
#define U32_F "lu"
|
||||
#define S32_F "ld"
|
||||
#define X32_F "lx"
|
||||
|
||||
#ifdef RT_USING_NEWLIB
|
||||
#include <errno.h>
|
||||
/* some errno not defined in newlib */
|
||||
#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. */
|
||||
#define ESHUTDOWN 180
|
||||
#elif RT_USING_MINILIBC
|
||||
#include <errno.h>
|
||||
#define EADDRNOTAVAIL 99 /* Cannot assign requested address */
|
||||
#else
|
||||
#define LWIP_PROVIDE_ERRNO
|
||||
#endif
|
||||
|
||||
#ifdef RT_USING_MINILIBC
|
||||
#include <time.h>
|
||||
#define LWIP_TIMEVAL_PRIVATE 0
|
||||
#endif
|
||||
|
||||
#if defined(__CC_ARM) /* ARMCC compiler */
|
||||
#define PACK_STRUCT_FIELD(x) x
|
||||
#define PACK_STRUCT_STRUCT __attribute__ ((__packed__))
|
||||
#define PACK_STRUCT_BEGIN
|
||||
#define PACK_STRUCT_END
|
||||
#elif defined(__IAR_SYSTEMS_ICC__) /* IAR Compiler */
|
||||
#define PACK_STRUCT_BEGIN
|
||||
#define PACK_STRUCT_STRUCT
|
||||
#define PACK_STRUCT_END
|
||||
#define PACK_STRUCT_FIELD(x) x
|
||||
#define PACK_STRUCT_USE_INCLUDES
|
||||
#elif defined(__GNUC__) /* GNU GCC Compiler */
|
||||
#define PACK_STRUCT_FIELD(x) x
|
||||
#define PACK_STRUCT_STRUCT __attribute__((packed))
|
||||
#define PACK_STRUCT_BEGIN
|
||||
#define PACK_STRUCT_END
|
||||
#elif defined(_MSC_VER)
|
||||
#define PACK_STRUCT_FIELD(x) x
|
||||
#define PACK_STRUCT_STRUCT
|
||||
#define PACK_STRUCT_BEGIN
|
||||
#define PACK_STRUCT_END
|
||||
#endif
|
||||
|
||||
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)
|
||||
|
||||
|
||||
#include "string.h"
|
||||
|
||||
#endif /* __ARCH_CC_H__ */
|
||||
|
||||
35
components/net/lwip-1.4.1/src/arch/include/arch/epstruct.h
Normal file
35
components/net/lwip-1.4.1/src/arch/include/arch/epstruct.h
Normal file
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright (c) 2001-2003 Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the lwIP TCP/IP stack.
|
||||
*
|
||||
* Author: Adam Dunkels <adam@sics.se>
|
||||
*
|
||||
*/
|
||||
|
||||
#if defined(__ICCARM__)
|
||||
#pragma pack()
|
||||
#endif
|
||||
52
components/net/lwip-1.4.1/src/arch/include/arch/perf.h
Normal file
52
components/net/lwip-1.4.1/src/arch/include/arch/perf.h
Normal file
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* Copyright (c) 2001, Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the lwIP TCP/IP stack.
|
||||
*
|
||||
* Author: Adam Dunkels <adam@sics.se>
|
||||
*
|
||||
* $Id: perf.h,v 1.1.1.1 2004/12/16 14:17:13 bear Exp $
|
||||
*/
|
||||
#ifndef __ARCH_PERF_H__
|
||||
#define __ARCH_PERF_H__
|
||||
|
||||
//#include <sys/times.h>
|
||||
|
||||
#define PERF_START /* null definition */
|
||||
#define PERF_STOP(x) /* null definition */
|
||||
|
||||
/*
|
||||
void perf_print(unsigned long c1l, unsigned long c1h,
|
||||
unsigned long c2l, unsigned long c2h,
|
||||
char *key);
|
||||
|
||||
void perf_print_times(struct tms *start, struct tms *end, char *key);
|
||||
|
||||
void perf_init(char *fname);
|
||||
*/
|
||||
#endif /* __ARCH_PERF_H__ */
|
||||
63
components/net/lwip-1.4.1/src/arch/include/arch/sys_arch.h
Normal file
63
components/net/lwip-1.4.1/src/arch/include/arch/sys_arch.h
Normal file
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
* Copyright (c) 2001, Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the lwIP TCP/IP stack.
|
||||
*
|
||||
* Author: Adam Dunkels <adam@sics.se>
|
||||
*
|
||||
* $Id: sys_arch.h,v 1.3 2005/03/13 16:03:23 bear Exp $
|
||||
*/
|
||||
#ifndef __ARCH_SYS_ARCH_H__
|
||||
#define __ARCH_SYS_ARCH_H__
|
||||
|
||||
#include "arch/cc.h"
|
||||
|
||||
#include <rtthread.h>
|
||||
|
||||
#ifndef BYTE_ORDER
|
||||
#define BYTE_ORDER LITTLE_ENDIAN
|
||||
#endif
|
||||
|
||||
#define SYS_MBOX_NULL RT_NULL
|
||||
#define SYS_SEM_NULL RT_NULL
|
||||
|
||||
typedef u32_t sys_prot_t;
|
||||
|
||||
#define SYS_MBOX_SIZE 10
|
||||
#define SYS_LWIP_TIMER_NAME "timer"
|
||||
#define SYS_LWIP_MBOX_NAME "mbox"
|
||||
#define SYS_LWIP_SEM_NAME "sem"
|
||||
#define SYS_LWIP_MUTEX_NAME "mu"
|
||||
|
||||
typedef rt_sem_t sys_sem_t;
|
||||
typedef rt_mutex_t sys_mutex_t;
|
||||
typedef rt_mailbox_t sys_mbox_t;
|
||||
typedef rt_thread_t sys_thread_t;
|
||||
|
||||
|
||||
#endif /* __ARCH_SYS_ARCH_H__ */
|
||||
635
components/net/lwip-1.4.1/src/arch/sys_arch.c
Normal file
635
components/net/lwip-1.4.1/src/arch/sys_arch.c
Normal file
File diff suppressed because it is too large
Load Diff
35
components/net/lwip-1.4.1/src/include/netif/ethernetif.h
Normal file
35
components/net/lwip-1.4.1/src/include/netif/ethernetif.h
Normal file
@@ -0,0 +1,35 @@
|
||||
#ifndef __NETIF_ETHERNETIF_H__
|
||||
#define __NETIF_ETHERNETIF_H__
|
||||
|
||||
#include "lwip/netif.h"
|
||||
#include <rtthread.h>
|
||||
|
||||
#define NIOCTL_GADDR 0x01
|
||||
#define ETHERNET_MTU 1500
|
||||
|
||||
struct eth_device
|
||||
{
|
||||
/* inherit from rt_device */
|
||||
struct rt_device parent;
|
||||
|
||||
/* network interface for lwip */
|
||||
struct netif *netif;
|
||||
struct rt_semaphore tx_ack;
|
||||
|
||||
rt_uint8_t flags;
|
||||
rt_uint8_t link_changed;
|
||||
rt_uint16_t link_status;
|
||||
|
||||
/* eth device interface */
|
||||
struct pbuf* (*eth_rx)(rt_device_t dev);
|
||||
rt_err_t (*eth_tx)(rt_device_t dev, struct pbuf* p);
|
||||
};
|
||||
|
||||
rt_err_t eth_device_ready(struct eth_device* dev);
|
||||
rt_err_t eth_device_init(struct eth_device * dev, char *name);
|
||||
rt_err_t eth_device_init_with_flag(struct eth_device *dev, char *name, rt_uint8_t flag);
|
||||
rt_err_t eth_device_linkchange(struct eth_device* dev, rt_bool_t up);
|
||||
|
||||
void eth_system_device_init(void);
|
||||
|
||||
#endif /* __NETIF_ETHERNETIF_H__ */
|
||||
333
components/net/lwip-1.4.1/src/lwipopts.h
Normal file
333
components/net/lwip-1.4.1/src/lwipopts.h
Normal file
@@ -0,0 +1,333 @@
|
||||
#ifndef __LWIPOPTS_H__
|
||||
#define __LWIPOPTS_H__
|
||||
|
||||
#include <rtconfig.h>
|
||||
|
||||
#define ERRNO 1
|
||||
|
||||
#define NO_SYS 0
|
||||
#define LWIP_SOCKET 1
|
||||
#define LWIP_NETCONN 1
|
||||
|
||||
#ifdef RT_LWIP_IGMP
|
||||
#define LWIP_IGMP 1
|
||||
#else
|
||||
#define LWIP_IGMP 0
|
||||
#endif
|
||||
|
||||
#ifdef RT_LWIP_ICMP
|
||||
#define LWIP_ICMP 1
|
||||
#else
|
||||
#define LWIP_ICMP 0
|
||||
#endif
|
||||
|
||||
#ifdef RT_LWIP_SNMP
|
||||
#define LWIP_SNMP 1
|
||||
#else
|
||||
#define LWIP_SNMP 0
|
||||
#endif
|
||||
|
||||
#ifdef RT_LWIP_DNS
|
||||
#define LWIP_DNS 1
|
||||
#else
|
||||
#define LWIP_DNS 0
|
||||
#endif
|
||||
|
||||
#define LWIP_HAVE_LOOPIF 0
|
||||
|
||||
#define LWIP_PLATFORM_BYTESWAP 0
|
||||
#define BYTE_ORDER LITTLE_ENDIAN
|
||||
|
||||
/* Enable SO_RCVTIMEO processing. */
|
||||
#define LWIP_SO_RCVTIMEO 1
|
||||
|
||||
/* #define RT_LWIP_DEBUG */
|
||||
|
||||
#ifdef RT_LWIP_DEBUG
|
||||
#define LWIP_DEBUG
|
||||
#endif
|
||||
|
||||
/* ---------- Debug options ---------- */
|
||||
#ifdef LWIP_DEBUG
|
||||
#define SYS_DEBUG LWIP_DBG_OFF
|
||||
#define ETHARP_DEBUG LWIP_DBG_OFF
|
||||
#define PPP_DEBUG LWIP_DBG_OFF
|
||||
#define MEM_DEBUG LWIP_DBG_OFF
|
||||
#define MEMP_DEBUG LWIP_DBG_OFF
|
||||
#define PBUF_DEBUG LWIP_DBG_OFF
|
||||
#define API_LIB_DEBUG LWIP_DBG_OFF
|
||||
#define API_MSG_DEBUG LWIP_DBG_OFF
|
||||
#define TCPIP_DEBUG LWIP_DBG_OFF
|
||||
#define NETIF_DEBUG LWIP_DBG_OFF
|
||||
#define SOCKETS_DEBUG LWIP_DBG_OFF
|
||||
#define DNS_DEBUG LWIP_DBG_OFF
|
||||
#define AUTOIP_DEBUG LWIP_DBG_OFF
|
||||
#define DHCP_DEBUG LWIP_DBG_OFF
|
||||
#define IP_DEBUG LWIP_DBG_OFF
|
||||
#define IP_REASS_DEBUG LWIP_DBG_OFF
|
||||
#define ICMP_DEBUG LWIP_DBG_OFF
|
||||
#define IGMP_DEBUG LWIP_DBG_OFF
|
||||
#define UDP_DEBUG LWIP_DBG_OFF
|
||||
#define TCP_DEBUG LWIP_DBG_OFF
|
||||
#define TCP_INPUT_DEBUG LWIP_DBG_OFF
|
||||
#define TCP_OUTPUT_DEBUG LWIP_DBG_OFF
|
||||
#define TCP_RTO_DEBUG LWIP_DBG_OFF
|
||||
#define TCP_CWND_DEBUG LWIP_DBG_OFF
|
||||
#define TCP_WND_DEBUG LWIP_DBG_OFF
|
||||
#define TCP_FR_DEBUG LWIP_DBG_OFF
|
||||
#define TCP_QLEN_DEBUG LWIP_DBG_OFF
|
||||
#define TCP_RST_DEBUG LWIP_DBG_OFF
|
||||
#endif
|
||||
|
||||
#define LWIP_DBG_TYPES_ON (LWIP_DBG_ON|LWIP_DBG_TRACE|LWIP_DBG_STATE|LWIP_DBG_FRESH|LWIP_DBG_HALT)
|
||||
|
||||
/* ---------- Memory options ---------- */
|
||||
#ifdef RT_LWIP_ALIGN_SIZE
|
||||
#define MEM_ALIGNMENT RT_LWIP_ALIGN_SIZE
|
||||
#else
|
||||
#define MEM_ALIGNMENT 4
|
||||
#endif
|
||||
|
||||
#define MEM_LIBC_MALLOC 1
|
||||
#define mem_malloc rt_malloc
|
||||
#define mem_free rt_free
|
||||
#define mem_calloc rt_calloc
|
||||
|
||||
#ifdef RT_LWIP_USING_RT_MEM
|
||||
#define MEMP_MEM_MALLOC 1
|
||||
#else
|
||||
#define MEMP_MEM_MALLOC 0
|
||||
#endif
|
||||
|
||||
/* 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
|
||||
should be set high. */
|
||||
#define MEMP_NUM_PBUF 16
|
||||
|
||||
/* the number of UDP protocol control blocks. One per active RAW "connection". */
|
||||
#ifdef RT_LWIP_RAW_PCB_NUM
|
||||
#define MEMP_NUM_RAW_PCB RT_LWIP_RAW_PCB_NUM
|
||||
#endif
|
||||
|
||||
/* the number of UDP protocol control blocks. One per active UDP "connection". */
|
||||
#ifdef RT_LWIP_UDP_PCB_NUM
|
||||
#define MEMP_NUM_UDP_PCB RT_LWIP_UDP_PCB_NUM
|
||||
#endif
|
||||
|
||||
/* the number of simulatenously active TCP connections. */
|
||||
#ifdef RT_LWIP_TCP_PCB_NUM
|
||||
#define MEMP_NUM_TCP_PCB RT_LWIP_TCP_PCB_NUM
|
||||
#endif
|
||||
|
||||
/* the number of simultaneously queued TCP */
|
||||
#ifdef RT_LWIP_TCP_SEG_NUM
|
||||
#define MEMP_NUM_TCP_SEG TCP_SND_QUEUELEN
|
||||
#endif
|
||||
|
||||
/* The following four are used only with the sequential API and can be
|
||||
set to 0 if the application only will use the raw API. */
|
||||
/* MEMP_NUM_NETBUF: the number of struct netbufs. */
|
||||
#define MEMP_NUM_NETBUF 2
|
||||
/* MEMP_NUM_NETCONN: the number of struct netconns. */
|
||||
#define MEMP_NUM_NETCONN 4
|
||||
/* MEMP_NUM_TCPIP_MSG_*: the number of struct tcpip_msg, which is used
|
||||
for sequential API communication and incoming packets. Used in
|
||||
src/api/tcpip.c. */
|
||||
#define MEMP_NUM_TCPIP_MSG_API 16
|
||||
#define MEMP_NUM_TCPIP_MSG_INPKT 16
|
||||
|
||||
/* ---------- Pbuf options ---------- */
|
||||
/* PBUF_POOL_SIZE: the number of buffers in the pbuf pool. */
|
||||
#ifdef RT_LWIP_PBUF_NUM
|
||||
#define PBUF_POOL_SIZE RT_LWIP_PBUF_NUM
|
||||
#endif
|
||||
|
||||
/* PBUF_POOL_BUFSIZE: the size of each pbuf in the pbuf pool. */
|
||||
#ifdef RT_LWIP_PBUF_POOL_BUFSIZE
|
||||
#define PBUF_POOL_BUFSIZE RT_LWIP_PBUF_POOL_BUFSIZE
|
||||
#endif
|
||||
|
||||
/* PBUF_LINK_HLEN: the number of bytes that should be allocated for a
|
||||
link level header. */
|
||||
#define PBUF_LINK_HLEN 16
|
||||
|
||||
#ifdef RT_LWIP_ETH_PAD_SIZE
|
||||
#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)
|
||||
|
||||
/* ---------- TCP options ---------- */
|
||||
#ifdef RT_LWIP_TCP
|
||||
#define LWIP_TCP 1
|
||||
#else
|
||||
#define LWIP_TCP 0
|
||||
#endif
|
||||
|
||||
#define TCP_TTL 255
|
||||
|
||||
/* Controls if TCP should queue segments that arrive out of
|
||||
order. Define to 0 if your device is low on memory. */
|
||||
#define TCP_QUEUE_OOSEQ 1
|
||||
|
||||
/* TCP Maximum segment size. */
|
||||
#define TCP_MSS 1460
|
||||
|
||||
/* TCP sender buffer space (bytes). */
|
||||
#define TCP_SND_BUF (TCP_MSS * 2)
|
||||
|
||||
/* TCP sender buffer space (pbufs). This must be at least = 2 *
|
||||
TCP_SND_BUF/TCP_MSS for things to work. */
|
||||
#define TCP_SND_QUEUELEN (4 * TCP_SND_BUF/TCP_MSS)
|
||||
|
||||
/* TCP writable space (bytes). This must be less than or equal
|
||||
to TCP_SND_BUF. It is the amount of space which must be
|
||||
available in the tcp snd_buf for select to return writable */
|
||||
#define TCP_SNDLOWAT (TCP_SND_BUF/2)
|
||||
#define TCP_SNDQUEUELOWAT TCP_SND_QUEUELEN/2
|
||||
|
||||
/* TCP receive window. */
|
||||
#ifdef RT_LWIP_TCP_WND
|
||||
#define TCP_WND RT_LWIP_TCP_WND
|
||||
#else
|
||||
#define TCP_WND (TCP_MSS * 2)
|
||||
#endif
|
||||
|
||||
/* Maximum number of retransmissions of data segments. */
|
||||
#define TCP_MAXRTX 12
|
||||
|
||||
/* Maximum number of retransmissions of SYN segments. */
|
||||
#define TCP_SYNMAXRTX 4
|
||||
|
||||
/* tcpip thread options */
|
||||
#ifdef RT_LWIP_TCPTHREAD_PRIORITY
|
||||
#define TCPIP_MBOX_SIZE RT_LWIP_TCPTHREAD_MBOX_SIZE
|
||||
#define TCPIP_THREAD_PRIO RT_LWIP_TCPTHREAD_PRIORITY
|
||||
#define TCPIP_THREAD_STACKSIZE RT_LWIP_TCPTHREAD_STACKSIZE
|
||||
#else
|
||||
#define TCPIP_MBOX_SIZE 8
|
||||
#define TCPIP_THREAD_PRIO 128
|
||||
#define TCPIP_THREAD_STACKSIZE 4096
|
||||
#endif
|
||||
#define TCPIP_THREAD_NAME "tcpip"
|
||||
#define DEFAULT_TCP_RECVMBOX_SIZE 10
|
||||
|
||||
/* ---------- ARP options ---------- */
|
||||
#define LWIP_ARP 1
|
||||
#define ARP_TABLE_SIZE 10
|
||||
#define ARP_QUEUEING 1
|
||||
|
||||
/* ---------- IP options ---------- */
|
||||
/* Define IP_FORWARD to 1 if you wish to have the ability to forward
|
||||
IP packets across network interfaces. If you are going to run lwIP
|
||||
on a device with only one network interface, define this to 0. */
|
||||
#define IP_FORWARD 0
|
||||
|
||||
/* IP reassembly and segmentation.These are orthogonal even
|
||||
* if they both deal with IP fragments */
|
||||
#define IP_REASSEMBLY 0
|
||||
#define IP_REASS_MAX_PBUFS 10
|
||||
#define MEMP_NUM_REASSDATA 10
|
||||
#define IP_FRAG 0
|
||||
|
||||
/* ---------- ICMP options ---------- */
|
||||
#define ICMP_TTL 255
|
||||
|
||||
/* ---------- DHCP options ---------- */
|
||||
/* Define LWIP_DHCP to 1 if you want DHCP configuration of
|
||||
interfaces. */
|
||||
#ifdef RT_LWIP_DHCP
|
||||
#define LWIP_DHCP 1
|
||||
#else
|
||||
#define LWIP_DHCP 0
|
||||
#endif
|
||||
|
||||
/* 1 if you want to do an ARP check on the offered address
|
||||
(recommended). */
|
||||
#define DHCP_DOES_ARP_CHECK (LWIP_DHCP)
|
||||
|
||||
/* ---------- AUTOIP options ------- */
|
||||
#define LWIP_AUTOIP 0
|
||||
#define LWIP_DHCP_AUTOIP_COOP (LWIP_DHCP && LWIP_AUTOIP)
|
||||
|
||||
/* ---------- UDP options ---------- */
|
||||
#ifdef RT_LWIP_UDP
|
||||
#define LWIP_UDP 1
|
||||
#else
|
||||
#define LWIP_UDP 0
|
||||
#endif
|
||||
|
||||
#define LWIP_UDPLITE 0
|
||||
#define UDP_TTL 255
|
||||
#define DEFAULT_UDP_RECVMBOX_SIZE 1
|
||||
|
||||
/* ---------- RAW options ---------- */
|
||||
#define DEFAULT_RAW_RECVMBOX_SIZE 1
|
||||
#define DEFAULT_ACCEPTMBOX_SIZE 10
|
||||
|
||||
/* ---------- Statistics options ---------- */
|
||||
#ifdef RT_LWIP_STATS
|
||||
#define LWIP_STATS 1
|
||||
#define LWIP_STATS_DISPLAY 1
|
||||
#else
|
||||
#define LWIP_STATS 0
|
||||
#endif
|
||||
|
||||
#if LWIP_STATS
|
||||
#define LINK_STATS 1
|
||||
#define IP_STATS 1
|
||||
#define ICMP_STATS 1
|
||||
#define IGMP_STATS 1
|
||||
#define IPFRAG_STATS 1
|
||||
#define UDP_STATS 1
|
||||
#define TCP_STATS 1
|
||||
#define MEM_STATS 1
|
||||
#define MEMP_STATS 1
|
||||
#define PBUF_STATS 1
|
||||
#define SYS_STATS 1
|
||||
#endif /* LWIP_STATS */
|
||||
|
||||
/* ---------- PPP options ---------- */
|
||||
#ifdef RT_LWIP_PPP
|
||||
#define PPP_SUPPORT 1 /* Set > 0 for PPP */
|
||||
#else
|
||||
#define PPP_SUPPORT 0 /* Set > 0 for PPP */
|
||||
#endif
|
||||
|
||||
#if PPP_SUPPORT
|
||||
#define NUM_PPP 1 /* Max PPP sessions. */
|
||||
|
||||
/* Select modules to enable. Ideally these would be set in the makefile but
|
||||
* we're limited by the command line length so you need to modify the settings
|
||||
* in this file.
|
||||
*/
|
||||
#define PPPOE_SUPPORT 0
|
||||
#define PPPOS_SUPPORT 1
|
||||
|
||||
#define PAP_SUPPORT 1 /* Set > 0 for PAP. */
|
||||
#define CHAP_SUPPORT 1 /* Set > 0 for CHAP. */
|
||||
#define MSCHAP_SUPPORT 0 /* Set > 0 for MSCHAP (NOT FUNCTIONAL!) */
|
||||
#define CBCP_SUPPORT 0 /* Set > 0 for CBCP (NOT FUNCTIONAL!) */
|
||||
#define CCP_SUPPORT 0 /* Set > 0 for CCP (NOT FUNCTIONAL!) */
|
||||
#define VJ_SUPPORT 1 /* Set > 0 for VJ header compression. */
|
||||
#define MD5_SUPPORT 1 /* Set > 0 for MD5 (see also CHAP) */
|
||||
|
||||
#endif /* PPP_SUPPORT */
|
||||
|
||||
/* no read/write/close for socket */
|
||||
#define LWIP_POSIX_SOCKETS_IO_NAMES 0
|
||||
#define LWIP_NETIF_API 1
|
||||
|
||||
/* 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)
|
||||
#ifdef LWIP_IGMP
|
||||
#include <stdlib.h>
|
||||
#define LWIP_RAND rand
|
||||
#endif
|
||||
|
||||
#endif /* __LWIPOPTS_H__ */
|
||||
File diff suppressed because it is too large
Load Diff
@@ -82,6 +82,6 @@ if GetDepend(['RT_LWIP_PPP']):
|
||||
if GetDepend(['RT_USING_NETUTILS']):
|
||||
src += Glob('./apps/*.c')
|
||||
|
||||
group = DefineGroup('LwIP', src, depend = ['RT_USING_LWIP'], CPPPATH = path)
|
||||
group = DefineGroup('LwIP', src, depend = ['RT_USING_LWIP', 'RT_USING_LWIP140'], CPPPATH = path)
|
||||
|
||||
Return('group')
|
||||
|
||||
Reference in New Issue
Block a user