增加所有文件

This commit is contained in:
2025-11-07 20:19:23 +08:00
parent b7376523b6
commit 846bd3bbda
8445 changed files with 3006231 additions and 5934 deletions

View File

@@ -0,0 +1,67 @@
/*
* Copyright (c) 2017 Simon Goldschmidt
* 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: Simon Goldschmdit <goldsimon@gmx.de>
*
*/
#ifndef LWIP_ARCH_CC_H
#define LWIP_ARCH_CC_H
#if __GNUC__
#define LWIP_TIMEVAL_PRIVATE 0
#if __SES_ARM
#include <sys/time.h>
#else
#include <sys/_timeval.h>
#endif
#elif __ICCARM__
#define LWIP_TIMEVAL_PRIVATE 1
#endif
#define U16_F "u"
#define S16_F "d"
#define X16_F "x"
#define U32_F "u"
#define S32_F "d"
#define X32_F "x"
#define SZT_F "zu"
#define printf printf_
extern int printf_(const char* format, ...);
#define LWIP_NO_UNISTD_H 1
#define LWIP_CHKSUM_ALGORITHM 2
#define LWIP_PLATFORM_DIAG(x) do {printf x;} while (0)
#define LWIP_PLATFORM_ASSERT(x) do {printf(x); while(1);} while (0)
//typedef int ssize_t;
#endif /* LWIP_ARCH_CC_H */

View File

@@ -0,0 +1,46 @@
/*
* Copyright (c) 2017 Simon Goldschmidt
* 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: Simon Goldschmdit <goldsimon@gmx.de>
*
*/
#ifndef LWIP_ARCH_SYS_ARCH_H
#define LWIP_ARCH_SYS_ARCH_H
#define MBOX_MAGIC 'mbox'
#define SEM_MAGIC 'sem'
typedef void *sys_thread_t;
typedef void *sys_mutex_t;
typedef void *sys_sem_t;
typedef void *sys_mbox_t;
#endif /* LWIP_ARCH_SYS_ARCH_H */

View File

@@ -0,0 +1,122 @@
/**
* @file
*
* lwIP Options Configuration
*/
/*
* Copyright (c) 2001-2004 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>
*
*/
#ifndef LWIP_LWIPOPTS_H
#define LWIP_LWIPOPTS_H
#define NO_SYS 1
#define LWIP_NETCONN 0
#define LWIP_SOCKET 0
/*
* Include user defined options first. Anything not defined in these files
* will be set to standard values. Override anything you don't like!
*/
// use libc malloc
#define MEM_LIBC_MALLOC 0
#define MEMP_USE_CUSTOM_POOLS 1
#define MEM_USE_POOLS 1
// Create static memory pools
#define MEMP_MEM_MALLOC 0
/* Memory block size alignes to 4 bytes, because ARM may access memory block
* by using ldrd/strd instruction which needs 4 bytes alignment
*/
#define MEM_ALIGNMENT 4
// these don't actually affect anything
// unless MEMP_MEM_MALLOC is 0
#define MEM_SIZE (16 * 1024)
#define MEMP_NUM_UDP_PCB 128
#define MEMP_NUM_TCP_PCB 128
#define MEMP_NUM_TCP_PCB_LISTEN 128
#define MEMP_NUM_NETBUF 32
#define MEMP_NUM_NETCONN 32
#define MEMP_NUM_NETDB 32
#define LWIP_COMPAT_SOCKETS 1
#define LWIP_SO_RCVTIMEO 1
#define LWIP_SO_RCVBUF 1
#define LWIP_DHCP 0
#define LWIP_AUTOIP 0
#define LWIP_DHCP_AUTOIP_COOP 0
#define LWIP_DNS 0
#define LWIP_NETIF_HOSTNAME 1
#define LWIP_NETIF_STATUS_CALLBACK 1
#define LWIP_NETIF_HWADDRHINT 1
#define LWIP_NETIF_LOOPBACK 1
#define LWIP_HAVE_LOOPIF 1
#define TCPIP_THREAD_STACKSIZE 4096
#define TCPIP_THREAD_PRIO osPriorityRealtime
#define TCPIP_MBOX_SIZE 16
#define DEFAULT_THREAD_PRIO (osPriorityNormal - 1)
#define DEFAULT_THREAD_STACKSIZE 4096
#define DEFAULT_RAW_RECVMBOX_SIZE 16
#define DEFAULT_UDP_RECVMBOX_SIZE 16
#define DEFAULT_TCP_RECVMBOX_SIZE 16
#define DEFAULT_ACCEPTMBOX_SIZE 16
#define LWIP_STATS_DISPLAY 1
#define LWIP_ERRNO_STDINCLUDE
#define SYS_LIGHTWEIGHT_PROT 0
#define LWIP_DEBUG 1
#define LWIP_RAW 1
#define MEMP_NUM_SYS_TIMEOUT 17
//#define PBUF_DEBUG LWIP_DBG_ON
//#define TCP_OUTPUT_DEBUG LWIP_DBG_ON
//#define LWIP_DBG_MIN_LEVEL 0
/* TCP Maximum segment size. */
#define TCP_MSS 1460
#define TCP_SND_BUF (12 * TCP_MSS)
#define TCP_SND_QUEUELEN 80
#define MEMP_NUM_TCP_SEG TCP_SND_QUEUELEN
#endif /* LWIP_LWIPOPTS_H */

View File

@@ -0,0 +1,51 @@
#ifndef NET_DEV_H_
#define NET_DEV_H_
#include <lwip/opt.h>
#include <lwip/netif.h>
#include <lwip/pbuf.h>
#include <lwip/err.h>
struct net_driver_s;
/* Link layer type. This type is used with netdev_register in order to
* identify the type of the network driver.
*/
enum net_lltype_e {
NET_LL_ETHERNET = 0, /* Ethernet */
NET_LL_LOOPBACK, /* Local loopback */
NET_LL_SLIP, /* Serial Line Internet Protocol (SLIP) */
NET_LL_TUN, /* TUN Virtual Network Device */
NET_LL_BLUETOOTH, /* Bluetooth */
NET_LL_IEEE80211, /* IEEE 802.11 */
NET_LL_IEEE802154, /* IEEE 802.15.4 MAC */
NET_LL_PKTRADIO /* Non-standard packet radio */
};
struct net_driver_s {
struct netif d_netif;
u8_t d_lltype; /* See enum net_lltype_e */
/** IP address configuration in network byte order */
ip_addr_t d_ipaddr;
ip_addr_t d_netmask;
ip_addr_t d_gateway;
err_t (*d_init)(struct net_driver_s *dev);
err_t (*d_txavail)(struct net_driver_s *dev, struct pbuf *p);
u32_t (*d_getmac)(struct net_driver_s *dev, void *buf, u32_t max_len);
u32_t (*d_getmtu)(struct net_driver_s *dev);
void *d_private;
};
err_t netdev_register(struct net_driver_s *dev, enum net_lltype_e lltype);
static inline void netdev_input(struct net_driver_s *dev, struct pbuf *p) {
if (dev->d_netif.input(p, &dev->d_netif) != ERR_OK) {
pbuf_free(p);
}
}
#endif /* NET_DEV_H_ */