Files
base/middleware/lwip/contrib/ports/freertos/include/lwipopts.h
2025-11-07 09:57:14 +08:00

176 lines
5.3 KiB
C

/**
* @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
#include <armv7-r/irq.h>
#include <FreeRTOSConfig.h>
#define NO_SYS 0
#define LWIP_NETCONN 1
#define LWIP_SOCKET 1
#define LWIP_NETIF_API (NO_SYS==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
#define LWIP_SUPPORT_CUSTOM_PBUF 1
/* 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)
/* 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
#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
/* ---------- Pbuf options ---------- */
/* PBUF_POOL_SIZE: the number of buffers in the pbuf pool. */
#define PBUF_POOL_SIZE 32
/* PBUF_POOL_BUFSIZE: the size of each pbuf in the pbuf pool. */
//#define PBUF_POOL_BUFSIZE 256
/** 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)
#define SYS_ARCH_DECL_PROTECT(lev) irq_state_t lev
#define SYS_ARCH_PROTECT(lev) lev = arch_irq_save()
#define SYS_ARCH_UNPROTECT(lev) arch_irq_restore(lev)
#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 (configMAX_PRIORITIES - 1)
#define TCPIP_MBOX_SIZE 16
#define DEFAULT_THREAD_PRIO 30
#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 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_WND (10 * TCP_MSS)
#define TCP_SND_BUF (12 * TCP_MSS)
#define TCP_SND_QUEUELEN 80
#define MEMP_NUM_TCP_SEG TCP_SND_QUEUELEN
#define LWIP_TCPIP_CORE_LOCKING 1
#define LWIP_TCPIP_CORE_LOCKING_INPUT 1
#define LWIP_FREERTOS_CHECK_CORE_LOCKING 1
#if LWIP_TCPIP_CORE_LOCKING
void sys_mark_tcpip_thread(void);
#define LWIP_MARK_TCPIP_THREAD() sys_mark_tcpip_thread()
void sys_check_core_locking(void);
#define LWIP_ASSERT_CORE_LOCKED() sys_check_core_locking()
void sys_lock_tcpip_core(void);
#define LOCK_TCPIP_CORE() sys_lock_tcpip_core()
void sys_unlock_tcpip_core(void);
#define UNLOCK_TCPIP_CORE() sys_unlock_tcpip_core()
#else
#define LWIP_MARK_TCPIP_THREAD()
#define LWIP_ASSERT_CORE_LOCKED()
#define LOCK_TCPIP_CORE()
#define UNLOCK_TCPIP_CORE()
#endif
#endif /* LWIP_LWIPOPTS_H */