1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2024-12-23 12:51:24 +01:00
CommandStation-EX/STM32lwipopts.h.copyme

102 lines
3.3 KiB
Plaintext
Raw Normal View History

2024-11-10 20:15:45 +01:00
/*
* © 2024 Harald Barth
* All rights reserved.
*
* This file is part of CommandStation-EX
*
* This is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* It is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with CommandStation. If not, see <https://www.gnu.org/licenses/>.
*/
//
// Rewrite of the STM32lwipopts.h file from STM
// To be copied into where lwipopts_default.h resides
2024-12-05 22:10:29 +01:00
// typically into STM32Ethernet/src/STM32lwipopts.h
// or STM32Ethernet\src\STM32lwipopts.h
// search for `lwipopts_default.h` and copy this file into the
// same directory but name it STM32lwipopts.h
2024-11-10 20:15:45 +01:00
//
2024-11-04 17:35:34 +01:00
#ifndef __STM32LWIPOPTS_H__
#define __STM32LWIPOPTS_H__
// include this here and then override things we do differnet
#include "lwipopts_default.h"
// we can not include our "defines.h" here
// so we need to duplicate that define
#define MAX_NUM_TCP_CLIENTS_HERE 9
#ifdef MAX_NUM_TCP_CLIENTS
#if MAX_NUM_TCP_CLIENTS != MAX_NUM_TCP_CLIENTS_HERE
#error MAX_NUM_TCP_CLIENTS and MAX_NUM_TCP_CLIENTS_HERE must be same
#endif
#else
#define MAX_NUM_TCP_CLIENTS MAX_NUM_TCP_CLIENTS_HERE
#endif
2024-11-04 17:35:34 +01:00
// increase ARP cache
#undef MEMP_NUM_APR_QUEUE
2024-11-04 17:35:34 +01:00
#define MEMP_NUM_ARP_QUEUE MAX_NUM_TCP_CLIENTS+3 // one for each client (all on different HW) and a few extra
// Example for debug
//#define LWIP_DEBUG 1
//#define TCP_DEBUG LWIP_DBG_ON
2024-11-16 20:50:25 +01:00
// NOT STRICT NECESSARY ANY MORE BUT CAN BE USED TO SAVE RAM
#undef MEM_LIBC_MALLOC
2024-11-16 20:50:25 +01:00
#define MEM_LIBC_MALLOC 1 // use the same malloc as for everything else
#undef MEMP_MEM_MALLOC
2024-11-10 11:31:14 +01:00
#define MEMP_MEM_MALLOC 1 // uses malloc which means no pools which means slower but not mean 32KB up front
2024-11-04 17:35:34 +01:00
#undef MEMP_NUM_TCP_PCB
2024-11-04 17:35:34 +01:00
#define MEMP_NUM_TCP_PCB MAX_NUM_TCP_CLIENTS+1 // one extra so we can reject number N+1 from our code
#define MEMP_NUM_TCP_PCB_LISTEN 6
#undef MEMP_NUM_TCP_SEG
2024-11-04 17:35:34 +01:00
#define MEMP_NUM_TCP_SEG MAX_NUM_TCP_CLIENTS
#undef MEMP_NUM_SYS_TIMEOUT
#define MEMP_NUM_SYS_TIMEOUT MAX_NUM_TCP_CLIENTS+2
2024-11-04 17:35:34 +01:00
#undef PBUF_POOL_SIZE
2024-11-04 17:35:34 +01:00
#define PBUF_POOL_SIZE MAX_NUM_TCP_CLIENTS
#undef LWIO_ICMP
2024-11-04 17:35:34 +01:00
#define LWIP_ICMP 1
#undef LWIP_RAW
2024-11-04 17:35:34 +01:00
#define LWIP_RAW 1 /* PING changed to 1 */
#undef DEFAULT_RAW_RECVMBOX_SIZE
2024-11-04 17:35:34 +01:00
#define DEFAULT_RAW_RECVMBOX_SIZE 3 /* for ICMP PING */
#undef LWIP_DHCP
2024-11-04 17:35:34 +01:00
#define LWIP_DHCP 1
#undef LWIP_UDP
2024-11-04 17:35:34 +01:00
#define LWIP_UDP 1
/*
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.
*/
#if CHECKSUM_GEN_TCP == 1
#error On STM32 TCP checksum should be in HW
2024-11-04 17:35:34 +01:00
#endif
#undef LWIP_IGMP
#define LWIP_IGMP 1
2024-11-04 17:35:34 +01:00
//#define SO_REUSE 1
//#define SO_REUSE_RXTOALL 1
2024-11-04 17:35:34 +01:00
#endif /* __STM32LWIPOPTS_H__ */