279 lines
10 KiB
C
Raw Normal View History

2019-10-24 17:37:35 +08:00
/**
******************************************************************************
* @file LwIP/LwIP_HTTP_Server_Raw/Inc/lwipopts.h
* @author MCD Application Team
* @brief lwIP Options Configuration.
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2017 STMicroelectronics International N.V.
* All rights reserved.</center></h2>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted, provided that the following conditions are met:
*
* 1. Redistribution 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 STMicroelectronics nor the names of other
* contributors to this software may be used to endorse or promote products
* derived from this software without specific written permission.
* 4. This software, including modifications and/or derivative works of this
* software, must execute solely and exclusively on microcontroller or
* microprocessor devices manufactured by or for STMicroelectronics.
* 5. Redistribution and use of this software other than as permitted under
* this license is void and will automatically terminate your rights under
* this license.
*
* THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY
* RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT
* SHALL STMICROELECTRONICS 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.
*
******************************************************************************
*/
#ifndef __LWIPOPTS_H__
#define __LWIPOPTS_H__
2019-10-24 18:03:30 +08:00
/* 设置1开启串口打印调试信息方便排查网络问题 */
2019-10-24 17:37:35 +08:00
#if 0
2019-10-24 18:03:30 +08:00
#define LWIP_DEBUG 1
#define LWIP_DBG_MIN_LEVEL LWIP_DBG_LEVEL_ALL
#define LWIP_DBG_TYPES_ON LWIP_DBG_ON
#define ETHARP_DEBUG LWIP_DBG_ON
#define NETIF_DEBUG LWIP_DBG_ON
#define PBUF_DEBUG LWIP_DBG_OFF
#define API_LIB_DEBUG LWIP_DBG_ON
#define API_MSG_DEBUG LWIP_DBG_ON
#define SOCKETS_DEBUG LWIP_DBG_ON
#define ICMP_DEBUG LWIP_DBG_ON
#define IGMP_DEBUG LWIP_DBG_ON
#define INET_DEBUG LWIP_DBG_ON
#define IP_DEBUG LWIP_DBG_ON
#define IP_REASS_DEBUG LWIP_DBG_ON
#define RAW_DEBUG LWIP_DBG_ON
#define MEM_DEBUG LWIP_DBG_OFF
#define MEMP_DEBUG LWIP_DBG_OFF
#define SYS_DEBUG LWIP_DBG_ON
#define TIMERS_DEBUG LWIP_DBG_OFF
#define TCP_DEBUG LWIP_DBG_ON
#define TCP_INPUT_DEBUG LWIP_DBG_ON
#define TCP_FR_DEBUG LWIP_DBG_ON
#define TCP_RTO_DEBUG LWIP_DBG_ON
#define TCP_CWND_DEBUG LWIP_DBG_ON
#define TCP_WND_DEBUG LWIP_DBG_ON
#define TCP_OUTPUT_DEBUG LWIP_DBG_ON
#define TCP_RST_DEBUG LWIP_DBG_ON
#define TCP_QLEN_DEBUG LWIP_DBG_ON
#define UDP_DEBUG LWIP_DBG_ON
#define TCPIP_DEBUG LWIP_DBG_ON
#define SLIP_DEBUG LWIP_DBG_ON
#define DHCP_DEBUG LWIP_DBG_ON
#define AUTOIP_DEBUG LWIP_DBG_ON
#define DNS_DEBUG LWIP_DBG_ON
#define IP6_DEBUG LWIP_DBG_ON
2019-10-24 17:37:35 +08:00
#endif
/**
* SYS_LIGHTWEIGHT_PROT==1: if you want inter-task protection for certain
* critical regions during buffer allocation, deallocation and memory
* allocation and deallocation.
*/
2019-10-24 18:03:30 +08:00
#define SYS_LIGHTWEIGHT_PROT 0
2019-10-24 17:37:35 +08:00
/**
* NO_SYS==1: Provides VERY minimal functionality. Otherwise,
* use lwIP facilities.
*/
2019-10-24 18:03:30 +08:00
#define NO_SYS 1
2019-10-24 17:37:35 +08:00
/* ---------- Memory options ---------- */
/* MEM_ALIGNMENT: should be set to the alignment of the CPU for which
lwIP is compiled. 4 byte alignment -> define MEM_ALIGNMENT to 4, 2
byte alignment -> define MEM_ALIGNMENT to 2. */
2019-10-24 18:03:30 +08:00
#define MEM_ALIGNMENT 4
2019-10-24 17:37:35 +08:00
/* MEM_SIZE: the size of the heap memory. If the application will send
a lot of data that needs to be copied, this should be set high. */
2019-10-24 18:03:30 +08:00
#define MEM_SIZE (10 * 1024)
2019-10-24 17:37:35 +08:00
/* Relocate the LwIP RAM heap pointer */
2019-10-24 18:03:30 +08:00
#define LWIP_RAM_HEAP_POINTER (0x30044000)
2019-10-24 17:37:35 +08:00
/* 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. */
2019-10-24 18:03:30 +08:00
#define MEMP_NUM_PBUF 10
2019-10-24 17:37:35 +08:00
/* MEMP_NUM_UDP_PCB: the number of UDP protocol control blocks. One
per active UDP "connection". */
2019-10-24 18:03:30 +08:00
#define MEMP_NUM_UDP_PCB 6
2019-10-24 17:37:35 +08:00
/* MEMP_NUM_TCP_PCB: the number of simulatenously active TCP
connections. */
2019-10-24 18:03:30 +08:00
#define MEMP_NUM_TCP_PCB 10
2019-10-24 17:37:35 +08:00
/* MEMP_NUM_TCP_PCB_LISTEN: the number of listening TCP
connections. */
#define MEMP_NUM_TCP_PCB_LISTEN 6
/* MEMP_NUM_TCP_SEG: the number of simultaneously queued TCP
segments. */
2019-10-24 18:03:30 +08:00
#define MEMP_NUM_TCP_SEG 8
2019-10-24 17:37:35 +08:00
/* MEMP_NUM_SYS_TIMEOUT: the number of simulateously active
timeouts. */
2019-10-24 18:03:30 +08:00
#define MEMP_NUM_SYS_TIMEOUT 10
2019-10-24 17:37:35 +08:00
/* ---------- Pbuf options ---------- */
/* PBUF_POOL_SIZE: the number of buffers in the pbuf pool.
@ note: used to allocate Tx pbufs only */
2019-10-24 18:03:30 +08:00
#define PBUF_POOL_SIZE 4
2019-10-24 17:37:35 +08:00
/* PBUF_POOL_BUFSIZE: the size of each pbuf in the pbuf pool */
2019-10-24 18:03:30 +08:00
#define PBUF_POOL_BUFSIZE 1528
2019-10-24 17:37:35 +08:00
/* LWIP_SUPPORT_CUSTOM_PBUF == 1: to pass directly MAC Rx buffers to the stack
no copy is needed */
2019-10-24 18:03:30 +08:00
#define LWIP_SUPPORT_CUSTOM_PBUF 1
2019-10-24 17:37:35 +08:00
/*
------------------------------------------------
---------- Network Interfaces options ----------
------------------------------------------------
*/
2019-10-24 18:03:30 +08:00
#define LWIP_NETIF_LINK_CALLBACK 1
2019-10-24 17:37:35 +08:00
/* ---------- TCP options ---------- */
2019-10-24 18:03:30 +08:00
#define LWIP_TCP 1
#define TCP_TTL 255
2019-10-24 17:37:35 +08:00
/* Controls if TCP should queue segments that arrive out of
order. Define to 0 if your device is low on memory. */
2019-10-24 18:03:30 +08:00
#define TCP_QUEUE_OOSEQ 0
2019-10-24 17:37:35 +08:00
/* TCP Maximum segment size. */
2019-10-24 18:03:30 +08:00
#define TCP_MSS (1500 - 40) /* TCP_MSS = (Ethernet MTU - IP header size - TCP header size) */
2019-10-24 17:37:35 +08:00
/* TCP sender buffer space (bytes). */
2019-10-24 18:03:30 +08:00
#define TCP_SND_BUF (4 * TCP_MSS)
2019-10-24 17:37:35 +08:00
/* TCP_SND_QUEUELEN: TCP sender buffer space (pbufs). This must be at least
as much as (2 * TCP_SND_BUF/TCP_MSS) for things to work. */
2019-10-24 18:03:30 +08:00
#define TCP_SND_QUEUELEN (2 * TCP_SND_BUF / TCP_MSS)
2019-10-24 17:37:35 +08:00
/* TCP receive window. */
2019-10-24 18:03:30 +08:00
#define TCP_WND (2 * TCP_MSS)
2019-10-24 17:37:35 +08:00
/* ---------- ICMP options ---------- */
2019-10-24 18:03:30 +08:00
#define LWIP_ICMP 1
2019-10-24 17:37:35 +08:00
/* ---------- DHCP options ---------- */
2019-10-24 18:03:30 +08:00
#define LWIP_DHCP 0
2019-10-24 17:37:35 +08:00
/* ---------- UDP options ---------- */
2019-10-24 18:03:30 +08:00
#define LWIP_UDP 1
#define UDP_TTL 255
2019-10-24 17:37:35 +08:00
/* ---------- Statistics options ---------- */
#define LWIP_STATS 0
/*
--------------------------------------
---------- Checksum options ----------
--------------------------------------
*/
/*
The STM32H7xx allows computing and verifying the IP, UDP, TCP and ICMP checksums by hardware:
- To use this feature let the following define uncommented.
- To disable it and process by CPU comment the the checksum.
*/
2019-10-24 18:03:30 +08:00
#define CHECKSUM_BY_HARDWARE
2019-10-24 17:37:35 +08:00
#ifdef CHECKSUM_BY_HARDWARE
2019-10-24 18:03:30 +08:00
/* CHECKSUM_GEN_IP==0: Generate checksums by hardware for outgoing IP packets.*/
#define CHECKSUM_GEN_IP 0
/* CHECKSUM_GEN_UDP==0: Generate checksums by hardware for outgoing UDP packets.*/
#define CHECKSUM_GEN_UDP 0
/* CHECKSUM_GEN_TCP==0: Generate checksums by hardware for outgoing TCP packets.*/
#define CHECKSUM_GEN_TCP 0
/* CHECKSUM_CHECK_IP==0: Check checksums by hardware for incoming IP packets.*/
#define CHECKSUM_CHECK_IP 0
/* CHECKSUM_CHECK_UDP==0: Check checksums by hardware for incoming UDP packets.*/
#define CHECKSUM_CHECK_UDP 0
/* CHECKSUM_CHECK_TCP==0: Check checksums by hardware for incoming TCP packets.*/
#define CHECKSUM_CHECK_TCP 0
/* CHECKSUM_CHECK_ICMP==0: Check checksums by hardware for incoming ICMP packets.*/
#define CHECKSUM_GEN_ICMP 0
2019-10-24 17:37:35 +08:00
#else
2019-10-24 18:03:30 +08:00
/* CHECKSUM_GEN_IP==1: Generate checksums in software for outgoing IP packets.*/
#define CHECKSUM_GEN_IP 1
/* CHECKSUM_GEN_UDP==1: Generate checksums in software for outgoing UDP packets.*/
#define CHECKSUM_GEN_UDP 1
/* CHECKSUM_GEN_TCP==1: Generate checksums in software for outgoing TCP packets.*/
#define CHECKSUM_GEN_TCP 1
/* CHECKSUM_CHECK_IP==1: Check checksums in software for incoming IP packets.*/
#define CHECKSUM_CHECK_IP 1
/* CHECKSUM_CHECK_UDP==1: Check checksums in software for incoming UDP packets.*/
#define CHECKSUM_CHECK_UDP 1
/* CHECKSUM_CHECK_TCP==1: Check checksums in software for incoming TCP packets.*/
#define CHECKSUM_CHECK_TCP 1
/* CHECKSUM_CHECK_ICMP==1: Check checksums by hardware for incoming ICMP packets.*/
#define CHECKSUM_GEN_ICMP 1
2019-10-24 17:37:35 +08:00
#endif
/*
----------------------------------------------
---------- Sequential layer options ----------
----------------------------------------------
*/
/**
* LWIP_NETCONN==1: Enable Netconn API (require to use api_lib.c)
*/
2019-10-24 18:03:30 +08:00
#define LWIP_NETCONN 0
2019-10-24 17:37:35 +08:00
/*
------------------------------------
---------- Socket options ----------
------------------------------------
*/
/**
* LWIP_SOCKET==1: Enable Socket API (require to use sockets.c)
*/
2019-10-24 18:03:30 +08:00
#define LWIP_SOCKET 0
2019-10-24 17:37:35 +08:00
/*
------------------------------------
---------- httpd options ----------
------------------------------------
*/
/** Set this to 1 to support CGI */
2019-10-24 18:03:30 +08:00
#define LWIP_HTTPD_CGI 1
2019-10-24 17:37:35 +08:00
/** Set this to 1 to support SSI (Server-Side-Includes) */
2019-10-24 18:03:30 +08:00
#define LWIP_HTTPD_SSI 1
2019-10-24 17:37:35 +08:00
/** Set this to 1 to include "fsdata_custom.c" instead of "fsdata.c" for the
* file system (to prevent changing the file included in CVS) */
2019-10-24 18:03:30 +08:00
#define HTTPD_USE_CUSTOM_FSDATA 1
2019-10-24 17:37:35 +08:00
/*
---------------------------------
---------- ASSERT options ----------
---------------------------------
*/
#define LWIP_NOASSERT
#endif /* __LWIPOPTS_H__ */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/