154 lines
5.4 KiB
C
154 lines
5.4 KiB
C
#ifndef _LWIPOPTS_H
|
|
#define _LWIPOPTS_H
|
|
|
|
// Generally you would define your own explicit list of lwIP options
|
|
// (see https://www.nongnu.org/lwip/2_1_x/group__lwip__opts.html)
|
|
//
|
|
|
|
#ifndef NO_SYS
|
|
#define NO_SYS 0 /* with FreeRTOS (pico_cyw43_arch_lwip_sys_freertos), this needs to be set to 0 */
|
|
#endif
|
|
// allow override in some examples
|
|
#ifndef LWIP_SOCKET
|
|
#define LWIP_SOCKET 1
|
|
#endif
|
|
#if PICO_CYW43_ARCH_POLL
|
|
#define MEM_LIBC_MALLOC 1
|
|
#else
|
|
// MEM_LIBC_MALLOC is incompatible with non polling versions
|
|
#define MEM_LIBC_MALLOC 0
|
|
#endif
|
|
#define MEM_ALIGNMENT 4
|
|
#define MEM_SIZE 16000
|
|
#define MEMP_NUM_TCP_SEG 32
|
|
#define MEMP_NUM_ARP_QUEUE 10
|
|
#define PBUF_POOL_SIZE (2*24)
|
|
#define LWIP_ARP 1
|
|
#define LWIP_ETHERNET 1
|
|
#define LWIP_ICMP 1
|
|
#define LWIP_RAW 1
|
|
#define TCP_WND (8 * TCP_MSS)
|
|
#define TCP_MSS 1460
|
|
#define TCP_SND_BUF (8 * TCP_MSS)
|
|
#define TCP_SND_QUEUELEN ((4 * (TCP_SND_BUF) + (TCP_MSS - 1)) / (TCP_MSS))
|
|
#define LWIP_NETIF_STATUS_CALLBACK 1
|
|
#define LWIP_NETIF_LINK_CALLBACK 1
|
|
#define LWIP_NETIF_HOSTNAME 1
|
|
#define LWIP_NETCONN 1
|
|
#define MEM_STATS 0
|
|
#define SYS_STATS 0
|
|
#define MEMP_STATS 0
|
|
#define LINK_STATS 0
|
|
// #define ETH_PAD_SIZE 2
|
|
#define LWIP_CHKSUM_ALGORITHM 3
|
|
#define LWIP_DHCP 1
|
|
#define LWIP_IPV4 1
|
|
#define LWIP_TCP 1
|
|
#define LWIP_UDP 1
|
|
#define LWIP_DNS 1
|
|
#define LWIP_TCP_KEEPALIVE 1
|
|
#define LWIP_NETIF_TX_SINGLE_PBUF 1
|
|
#define DHCP_DOES_ARP_CHECK 0
|
|
#define LWIP_DHCP_DOES_ACD_CHECK 0
|
|
|
|
#ifndef NDEBUG
|
|
#define LWIP_DEBUG 1
|
|
#define LWIP_STATS 1
|
|
#define LWIP_STATS_DISPLAY 1
|
|
#endif
|
|
|
|
#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 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 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
|
|
#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
|
|
|
|
#if !NO_SYS
|
|
#define TCPIP_THREAD_STACKSIZE 1024
|
|
#define TCPIP_THREAD_PRIO 3
|
|
#define DEFAULT_THREAD_STACKSIZE 1024
|
|
#define DEFAULT_RAW_RECVMBOX_SIZE 8
|
|
#define TCPIP_MBOX_SIZE 8
|
|
#define LWIP_TIMEVAL_PRIVATE 0
|
|
|
|
// not necessary, can be done either way
|
|
#define LWIP_TCPIP_CORE_LOCKING_INPUT 1
|
|
#endif
|
|
|
|
/* You need to increase MEMP_NUM_SYS_TIMEOUT by one if you use MQTT!
|
|
* see https://forums.raspberrypi.com/viewtopic.php?t=341914
|
|
*/
|
|
#define MEMP_NUM_SYS_TIMEOUT (LWIP_NUM_SYS_TIMEOUT_INTERNAL + 1)
|
|
#define MQTT_REQ_MAX_IN_FLIGHT (5) /* maximum of subscribe requests */
|
|
|
|
#define DEFAULT_UDP_RECVMBOX_SIZE TCPIP_MBOX_SIZE
|
|
#define DEFAULT_TCP_RECVMBOX_SIZE TCPIP_MBOX_SIZE
|
|
#define DEFAULT_ACCEPTMBOX_SIZE TCPIP_MBOX_SIZE
|
|
|
|
/* 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. */
|
|
#ifndef MEMP_NUM_PBUF
|
|
#define MEMP_NUM_PBUF 15
|
|
#endif
|
|
/* MEMP_NUM_UDP_PCB: the number of UDP protocol control blocks. One
|
|
per active UDP "connection". */
|
|
#ifndef MEMP_NUM_UDP_PCB
|
|
#define MEMP_NUM_UDP_PCB 6
|
|
#endif
|
|
/* MEMP_NUM_TCP_PCB: the number of simulatenously active TCP
|
|
connections. */
|
|
#ifndef MEMP_NUM_TCP_PCB
|
|
#define MEMP_NUM_TCP_PCB 10
|
|
#endif
|
|
/* MEMP_NUM_TCP_PCB_LISTEN: the number of listening TCP
|
|
connections. */
|
|
#ifndef MEMP_NUM_TCP_PCB_LISTEN
|
|
#define MEMP_NUM_TCP_PCB_LISTEN 6
|
|
#endif
|
|
/* MEMP_NUM_TCP_SEG: the number of simultaneously queued TCP
|
|
segments. */
|
|
#ifndef MEMP_NUM_TCP_SEG
|
|
#define MEMP_NUM_TCP_SEG 22
|
|
#endif
|
|
/* MEMP_NUM_SYS_TIMEOUT: the number of simulateously active
|
|
timeouts. */
|
|
#ifndef MEMP_NUM_SYS_TIMEOUT
|
|
#define MEMP_NUM_SYS_TIMEOUT 10
|
|
#endif
|
|
|
|
/* ---------- Pbuf options ---------- */
|
|
/* PBUF_POOL_SIZE: the number of buffers in the pbuf pool. */
|
|
#ifndef PBUF_POOL_SIZE
|
|
#define PBUF_POOL_SIZE 5
|
|
#endif
|
|
|
|
/* PBUF_POOL_BUFSIZE: the size of each pbuf in the pbuf pool. */
|
|
/* Default value is defined in lwip\src\include\lwip\opt.h as
|
|
* LWIP_MEM_ALIGN_SIZE(TCP_MSS+40+PBUF_LINK_ENCAPSULATION_HLEN+PBUF_LINK_HLEN)*/
|
|
|
|
#endif
|