• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 HPMicro
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 #ifndef HPMICRO_LWIPOPTS_H
16 #define HPMICRO_LWIPOPTS_H
17 
18 #include "lwip/lwipopts.h"
19 #undef MEM_SIZE
20 #define MEM_SIZE 128*1024
21 
22 #undef ETH_PAD_SIZE
23 #define ETH_PAD_SIZE 0
24 
25 /*
26    --------------------------------------
27    ---------- Checksum options ----------
28    --------------------------------------
29 */
30 #undef LWIP_CHECKSUM_ON_COPY
31 #define LWIP_CHECKSUM_ON_COPY           0
32 
33 #undef TCP_WND
34 #define TCP_WND 8192
35 
36 #undef TCPIP_THREAD_STACKSIZE
37 #define TCPIP_THREAD_STACKSIZE 4096
38 
39 #undef LWIP_CONFIG_NUM_SOCKETS
40 #define LWIP_CONFIG_NUM_SOCKETS 16
41 
42 
43 /*
44 Some MCUs allow computing and verifying the IP, UDP, TCP and ICMP checksums by hardware:
45  - To use this feature let the following define uncommented.
46  - To disable it and process by CPU comment the  the checksum.
47 */
48 
49 #define CHECKSUM_BY_HARDWARE 1
50 #if CHECKSUM_BY_HARDWARE
51   /* CHECKSUM_GEN_IP==0: Generate checksums by hardware for outgoing IP packets.*/
52   #define CHECKSUM_GEN_IP                 0
53   /* CHECKSUM_GEN_UDP==0: Generate checksums by hardware for outgoing UDP packets.*/
54   #define CHECKSUM_GEN_UDP                0
55   /* CHECKSUM_GEN_TCP==0: Generate checksums by hardware for outgoing TCP packets.*/
56   #define CHECKSUM_GEN_TCP                0
57   /* CHECKSUM_CHECK_IP==0: Check checksums by hardware for incoming IP packets.*/
58   #define CHECKSUM_CHECK_IP               0
59   /* CHECKSUM_CHECK_UDP==0: Check checksums by hardware for incoming UDP packets.*/
60   #define CHECKSUM_CHECK_UDP              0
61   /* CHECKSUM_CHECK_TCP==0: Check checksums by hardware for incoming TCP packets.*/
62   #define CHECKSUM_CHECK_TCP              0
63   /* CHECKSUM_CHECK_ICMP==0: Check checksums by hardware for incoming ICMP packets.*/
64   #define CHECKSUM_GEN_ICMP               0
65 #else
66   /* CHECKSUM_GEN_IP==1: Generate checksums in software for outgoing IP packets.*/
67   #define CHECKSUM_GEN_IP                 1
68   /* CHECKSUM_GEN_UDP==1: Generate checksums in software for outgoing UDP packets.*/
69   #define CHECKSUM_GEN_UDP                1
70   /* CHECKSUM_GEN_TCP==1: Generate checksums in software for outgoing TCP packets.*/
71   #define CHECKSUM_GEN_TCP                1
72   /* CHECKSUM_CHECK_IP==1: Check checksums in software for incoming IP packets.*/
73   #define CHECKSUM_CHECK_IP               1
74   /* CHECKSUM_CHECK_UDP==1: Check checksums in software for incoming UDP packets.*/
75   #define CHECKSUM_CHECK_UDP              1
76   /* CHECKSUM_CHECK_TCP==1: Check checksums in software for incoming TCP packets.*/
77   #define CHECKSUM_CHECK_TCP              1
78   /* CHECKSUM_CHECK_ICMP==1: Check checksums by hardware for incoming ICMP packets.*/
79   #define CHECKSUM_GEN_ICMP               1
80 #endif
81 
82 #endif
83 
84