/** ****************************************************************************** * @file lwipopts.h * @author MCD Application Team * @version V1.0.0 * @date 31-October-2011 * @brief lwIP Options Configuration. * This file is based on Utilities\lwip_v1.3.2\src\include\lwip\opt.h * and contains the lwIP configuration for the STM32F4x7 demonstration. ****************************************************************************** * @attention * * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. * *

© COPYRIGHT 2011 STMicroelectronics

****************************************************************************** */ #ifndef __LWIPOPTS_H__ #define __LWIPOPTS_H__ // You can either define #define SYS_LIGHTWEIGHT_PROT 1 // required when using FreeRTOS! #include "g8_xos.h" #define SYS_ARCH_DECL_PROTECT(lev) // ignore this #define SYS_ARCH_PROTECT(lev) XOS_EnterCritical() #define SYS_ARCH_UNPROTECT(lev) XOS_LeaveCritical() #define ETHARP_TRUST_IP_MAC 1 #define IP_REASSEMBLY 0 #define IP_FRAG 0 #define ARP_QUEUEING 0 #define TCP_LISTEN_BACKLOG 1 // SNTP _EXTERN_C void HouseKeeping_SetNTPTime(uint32_t sec, uint32_t us); _END_EXTERN_C #define SNTP_SET_SYSTEM_TIME_US(sec, us) HouseKeeping_SetNTPTime(sec, us) #define SNTP_SERVER_ADDRESS "213.161.194.93","204.152.184.72" //#define SNTP_UPDATE_DELAY 60000 // every minute, for testing //#define SNTP_SERVER_ADDRESS "213.161.194.93","204.152.184.72","0.us.pool.ntp.org","1.us.pool.ntp.org","2.us.pool.ntp.org","3.us.pool.ntp.org" #define SNTP_SUPPORT_MULTIPLE_SERVERS 1 #define LWIP_NETIF_STATUS_CALLBACK 1 /** * NO_SYS==1: Provides VERY minimal functionality. Otherwise, * use lwIP facilities. */ #define NO_SYS 0 #define LWIP_NETIF_API 1 // use thread safe API /* ---------- 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. */ #define MEM_ALIGNMENT 4 /* 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. */ #define MEM_SIZE (5*1024) /* 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 100 /* MEMP_NUM_UDP_PCB: the number of UDP protocol control blocks. One per active UDP "connection". */ #define MEMP_NUM_UDP_PCB 6 /* MEMP_NUM_TCP_PCB: the number of simulatenously active TCP connections. */ #define MEMP_NUM_TCP_PCB 10 /* MEMP_NUM_TCP_PCB_LISTEN: the number of listening TCP connections. */ #define MEMP_NUM_TCP_PCB_LISTEN 5 /* MEMP_NUM_TCP_SEG: the number of simultaneously queued TCP segments. */ #define MEMP_NUM_TCP_SEG 20 /* MEMP_NUM_SYS_TIMEOUT: the number of simulateously active timeouts. */ #define MEMP_NUM_SYS_TIMEOUT 10 /* ---------- Pbuf options ---------- */ /* PBUF_POOL_SIZE: the number of buffers in the pbuf pool. */ #define PBUF_POOL_SIZE 20 /* PBUF_POOL_BUFSIZE: the size of each pbuf in the pbuf pool. */ #define PBUF_POOL_BUFSIZE 500 /* ---------- TCP options ---------- */ #define LWIP_TCP 1 #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 0 /* TCP Maximum segment size. */ #define TCP_MSS (1500 - 40) /* TCP_MSS = (Ethernet MTU - IP header size - TCP header size) */ /* TCP sender buffer space (bytes). */ #define TCP_SND_BUF (2*TCP_MSS) // was 5 /* 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. */ //#define TCP_SND_QUEUELEN (2* TCP_SND_BUF/TCP_MSS) // was 4 /* TCP receive window. */ #define TCP_WND (2*TCP_MSS) /* ---------- ICMP options ---------- */ #define LWIP_ICMP 1 /* ---------- DHCP options ---------- */ /* Define LWIP_DHCP to 1 if you want DHCP configuration of interfaces.\ */ #define LWIP_DHCP 1 /* Uses Link-Local address if necessary (169.254.xxx.xxx) */ // for some reason, setting this to 1 causes the netif to get corrupted. //#define LWIP_AUTOIP 1 /* cooperate AUTOIP with DHCP */ //#define LWIP_DHCP_AUTOIP_COOP 1 /* ---------- UDP options ---------- */ #define LWIP_UDP 1 #define UDP_TTL 255 /* ---------- Statistics options ---------- */ #define LWIP_PROVIDE_ERRNO 1 #define PPP_SUPPORT 1 #define __u_char_defined #if PPP_SUPPORT == 1 # define PPP_INPROC_OWNTHREAD 0 # define PPPOS_RX_BUFSIZE 1 // I will handle the RX buffer myself. 0 is not allowed. # define PPPOS_SUPPORT 1 // over serial # define PPP_THREAD_STACKSIZE 1024 # define PPPOE_SUPPORT 0 // over ethernet # define PPP_THREAD_NAME "pppInProc" #define PAP_SUPPORT 1 // Password Auth Proto. //#define CHAP_SUPPORT 1 // Challenge Handshake Authentication Protocol. //#define VJ_SUPPORT 0 // compression //#define MD5_SUPPORT 1 //#define PPP_MAXIDLEFLAG 1000 #endif #ifdef PPP_NEW # define u_short uint16_t # define u_char uint8_t # define u_int uint32_t # define u_long uint32_t # define LWIP_PPP_API 1 # define PPP_LOG_BUFSIZ 64 // was 1024. see ppp/utils.c #endif /* -------------------------------------- ---------- Checksum options ---------- -------------------------------------- */ /* The STM32F4x7 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. */ //#define CHECKSUM_BY_HARDWARE #ifdef CHECKSUM_BY_HARDWARE /* 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 #else /* 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 #endif /* ---------------------------------------------- ---------- Sequential layer options ---------- ---------------------------------------------- */ /** * LWIP_NETCONN==1: Enable Netconn API (require to use api_lib.c) */ #define LWIP_NETCONN 1 /* ------------------------------------ ---------- Socket options ---------- ------------------------------------ */ /** * LWIP_SOCKET==1: Enable Socket API (require to use sockets.c) */ #define LWIP_SOCKET 1 #define ERRNO 1 #define LWIP_DNS 1 // forward packets between multiple interfaces (ie PPP to ethernet) #define IP_FORWARD 1 // for custom DHCP *server*, we ned to accept certain UDP ports /** Some defines for DHCP to let link-layer-addressed packets through while the * netif is down. * To use this in your own application/protocol, define LWIP_IP_ACCEPT_UDP_PORT * to return 1 if the port is accepted and 0 if the port is not accepted. */ #define LWIP_IP_ACCEPT_UDP_PORT(port) ((port == 67 || port == 68)?1:0) #define LWIP_HOOK_IP4_ROUTE(dest) (((dest)->addr == 0xFFFFFFFF)?netif_find("st0"):NULL) /* ----------------------------------- ---------- DEBUG options ---------- ----------------------------------- */ #define LWIP_DEBUG 1 #if defined(_DLIB_FILE_DESCRIPTOR) && _DLIB_FILE_DESCRIPTOR == 0 #define fflush(x) #endif #include #include #include "g8_serial_debug.h" #define LWIP_PLATFORM_DIAG(x) do { printf x;} while(0) #define LWIP_PLATFORM_DIAG_EX(a,x) do { if ((a) & LWIP_DBG_LEVEL_SERIOUS) printf(ANSI_YELLOW); printf x; if ((a) & LWIP_DBG_LEVEL_SERIOUS) printf(ANSI_NORMAL);} while(0) #define LWIP_PLATFORM_ASSERT(x) do { printf("Assertion \"%s\" failed at line %d in %s\n", \ x, __LINE__, __FILE__); fflush(NULL); abort(); } while(0) #define LWIP_ERROR(message, expression, handler) do { if (!(expression)) { \ printf("Assertion \"%s\" failed at line %d in %s\n", message, __LINE__, __FILE__); \ fflush(NULL);handler;} } while(0) #define ETHARP_DEBUG LWIP_DBG_OFF #define NETIF_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 SOCKETS_DEBUG LWIP_DBG_OFF #define ICMP_DEBUG LWIP_DBG_OFF #define IGMP_DEBUG LWIP_DBG_OFF #define INET_DEBUG LWIP_DBG_OFF #define IP_DEBUG LWIP_DBG_OFF #define IP_REASS_DEBUG LWIP_DBG_OFF #define RAW_DEBUG LWIP_DBG_OFF #define MEM_DEBUG LWIP_DBG_OFF #define MEMP_DEBUG LWIP_DBG_OFF #define SYS_DEBUG LWIP_DBG_OFF #define TIMERS_DEBUG LWIP_DBG_OFF #define TCP_DEBUG LWIP_DBG_OFF #define TCP_INPUT_DEBUG LWIP_DBG_OFF #define TCP_FR_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_OUTPUT_DEBUG LWIP_DBG_OFF #define TCP_RST_DEBUG LWIP_DBG_OFF #define TCP_QLEN_DEBUG LWIP_DBG_OFF #define UDP_DEBUG LWIP_DBG_OFF #define TCPIP_DEBUG LWIP_DBG_OFF #define PPP_DEBUG LWIP_DBG_OFF #define SLIP_DEBUG LWIP_DBG_OFF #define DHCP_DEBUG LWIP_DBG_OFF #define AUTOIP_DEBUG LWIP_DBG_OFF #define SNMP_MSG_DEBUG LWIP_DBG_OFF #define SNMP_MIB_DEBUG LWIP_DBG_OFF #define DNS_DEBUG LWIP_DBG_OFF #define LWIP_STATS 1 //#define LINK_STATS 0 #define IP_STATS 1 #define IPFRAG_STATS 1 //#define ICMP_STATS 0 //#define IGMP_STATS 0 //#define UDP_STATS 0 #define TCP_STATS 1 #define MEM_STATS 1 #define MEMP_STATS 1 #define SYS_STATS 1 #define LWIP_STATS_DISPLAY 1 //#define IP6_STATS 0 //#define ICMP6_STATS 0 //#define IP6_FRAG_STATS 0 //#define MLD6_STATS 0 //#define ND6_STATS 0 /* --------------------------------- ---------- OS options ---------- --------------------------------- */ #define TCPIP_THREAD_STACKSIZE 1500 /*1500*/ // 1368 according to stack analysis #define TCPIP_MBOX_SIZE 8 #define DEFAULT_UDP_RECVMBOX_SIZE 2000 #define DEFAULT_TCP_RECVMBOX_SIZE 2000 #define DEFAULT_ACCEPTMBOX_SIZE 2000 //#define DEFAULT_THREAD_STACKSIZE 1024 #define TCPIP_THREAD_PRIO (configMAX_PRIORITIES - 2) #endif /* __LWIPOPTS_H__ */ /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/