STM32F769IDiscovery  1.00
uDANTE Audio Networking with STM32F7 DISCO board
memp_std.h
Go to the documentation of this file.
1 /*
2  * SETUP: Make sure we define everything we will need.
3  *
4  * We have create three types of pools:
5  * 1) MEMPOOL - standard pools
6  * 2) MALLOC_MEMPOOL - to be used by mem_malloc in mem.c
7  * 3) PBUF_MEMPOOL - a mempool of pbuf's, so include space for the pbuf struct
8  *
9  * If the include'r doesn't require any special treatment of each of the types
10  * above, then will declare #2 & #3 to be just standard mempools.
11  */
12 #ifndef LWIP_MALLOC_MEMPOOL
13 /* This treats "malloc pools" just like any other pool.
14  The pools are a little bigger to provide 'size' as the amount of user data. */
15 #define LWIP_MALLOC_MEMPOOL(num, size) LWIP_MEMPOOL(POOL_##size, num, (size + LWIP_MEM_ALIGN_SIZE(sizeof(struct memp_malloc_helper))), "MALLOC_"#size)
16 #define LWIP_MALLOC_MEMPOOL_START
17 #define LWIP_MALLOC_MEMPOOL_END
18 #endif /* LWIP_MALLOC_MEMPOOL */
19 
20 #ifndef LWIP_PBUF_MEMPOOL
21 /* This treats "pbuf pools" just like any other pool.
22  * Allocates buffers for a pbuf struct AND a payload size */
23 #define LWIP_PBUF_MEMPOOL(name, num, payload, desc) LWIP_MEMPOOL(name, num, (MEMP_ALIGN_SIZE(sizeof(struct pbuf)) + MEMP_ALIGN_SIZE(payload)), desc)
24 #endif /* LWIP_PBUF_MEMPOOL */
25 
26 
27 /*
28  * A list of internal pools used by LWIP.
29  *
30  * LWIP_MEMPOOL(pool_name, number_elements, element_size, pool_description)
31  * creates a pool name MEMP_pool_name. description is used in stats.c
32  */
33 #if LWIP_RAW
34 LWIP_MEMPOOL(RAW_PCB, MEMP_NUM_RAW_PCB, sizeof(struct raw_pcb), "RAW_PCB")
35 #endif /* LWIP_RAW */
36 
37 #if LWIP_UDP
38 LWIP_MEMPOOL(UDP_PCB, MEMP_NUM_UDP_PCB, sizeof(struct udp_pcb), "UDP_PCB")
39 #endif /* LWIP_UDP */
40 
41 #if LWIP_TCP
42 LWIP_MEMPOOL(TCP_PCB, MEMP_NUM_TCP_PCB, sizeof(struct tcp_pcb), "TCP_PCB")
43 LWIP_MEMPOOL(TCP_PCB_LISTEN, MEMP_NUM_TCP_PCB_LISTEN, sizeof(struct tcp_pcb_listen), "TCP_PCB_LISTEN")
44 LWIP_MEMPOOL(TCP_SEG, MEMP_NUM_TCP_SEG, sizeof(struct tcp_seg), "TCP_SEG")
45 #endif /* LWIP_TCP */
46 
47 #if LWIP_IPV4 && IP_REASSEMBLY
48 LWIP_MEMPOOL(REASSDATA, MEMP_NUM_REASSDATA, sizeof(struct ip_reassdata), "REASSDATA")
49 #endif /* LWIP_IPV4 && IP_REASSEMBLY */
50 #if (IP_FRAG && !IP_FRAG_USES_STATIC_BUF && !LWIP_NETIF_TX_SINGLE_PBUF) || (LWIP_IPV6 && LWIP_IPV6_FRAG)
51 LWIP_MEMPOOL(FRAG_PBUF, MEMP_NUM_FRAG_PBUF, sizeof(struct pbuf_custom_ref),"FRAG_PBUF")
52 #endif /* IP_FRAG && !IP_FRAG_USES_STATIC_BUF && !LWIP_NETIF_TX_SINGLE_PBUF */
53 
54 #if LWIP_NETCONN || LWIP_SOCKET
55 LWIP_MEMPOOL(NETBUF, MEMP_NUM_NETBUF, sizeof(struct netbuf), "NETBUF")
56 LWIP_MEMPOOL(NETCONN, MEMP_NUM_NETCONN, sizeof(struct netconn), "NETCONN")
57 #endif /* LWIP_NETCONN || LWIP_SOCKET */
58 
59 #if NO_SYS==0
60 LWIP_MEMPOOL(TCPIP_MSG_API, MEMP_NUM_TCPIP_MSG_API, sizeof(struct tcpip_msg), "TCPIP_MSG_API")
61 #if LWIP_MPU_COMPATIBLE
62 LWIP_MEMPOOL(API_MSG, MEMP_NUM_API_MSG, sizeof(struct api_msg), "API_MSG")
63 #if LWIP_DNS
64 LWIP_MEMPOOL(DNS_API_MSG, MEMP_NUM_DNS_API_MSG, sizeof(struct dns_api_msg), "DNS_API_MSG")
65 #endif
66 #if LWIP_SOCKET && !LWIP_TCPIP_CORE_LOCKING
67 LWIP_MEMPOOL(SOCKET_SETGETSOCKOPT_DATA, MEMP_NUM_SOCKET_SETGETSOCKOPT_DATA, sizeof(struct lwip_setgetsockopt_data), "SOCKET_SETGETSOCKOPT_DATA")
68 #endif
69 #if LWIP_NETIF_API
70 LWIP_MEMPOOL(NETIFAPI_MSG, MEMP_NUM_NETIFAPI_MSG, sizeof(struct netifapi_msg), "NETIFAPI_MSG")
71 #endif
72 #endif /* LWIP_MPU_COMPATIBLE */
73 #if !LWIP_TCPIP_CORE_LOCKING_INPUT
74 LWIP_MEMPOOL(TCPIP_MSG_INPKT,MEMP_NUM_TCPIP_MSG_INPKT, sizeof(struct tcpip_msg), "TCPIP_MSG_INPKT")
75 #endif /* !LWIP_TCPIP_CORE_LOCKING_INPUT */
76 #endif /* NO_SYS==0 */
77 
78 #if LWIP_IPV4 && LWIP_ARP && ARP_QUEUEING
79 LWIP_MEMPOOL(ARP_QUEUE, MEMP_NUM_ARP_QUEUE, sizeof(struct etharp_q_entry), "ARP_QUEUE")
80 #endif /* LWIP_IPV4 && LWIP_ARP && ARP_QUEUEING */
81 
82 #if LWIP_IGMP
83 LWIP_MEMPOOL(IGMP_GROUP, MEMP_NUM_IGMP_GROUP, sizeof(struct igmp_group), "IGMP_GROUP")
84 #endif /* LWIP_IGMP */
85 
86 #if (!NO_SYS || (NO_SYS && !NO_SYS_NO_TIMERS)) /* LWIP_TIMERS */
87 LWIP_MEMPOOL(SYS_TIMEOUT, MEMP_NUM_SYS_TIMEOUT, sizeof(struct sys_timeo), "SYS_TIMEOUT")
88 #endif /* LWIP_TIMERS */
89 
90 #if LWIP_DNS && LWIP_SOCKET
91 LWIP_MEMPOOL(NETDB, MEMP_NUM_NETDB, NETDB_ELEM_SIZE, "NETDB")
92 #endif /* LWIP_DNS && LWIP_SOCKET */
93 #if LWIP_DNS && DNS_LOCAL_HOSTLIST && DNS_LOCAL_HOSTLIST_IS_DYNAMIC
94 LWIP_MEMPOOL(LOCALHOSTLIST, MEMP_NUM_LOCALHOSTLIST, LOCALHOSTLIST_ELEM_SIZE, "LOCALHOSTLIST")
95 #endif /* LWIP_DNS && DNS_LOCAL_HOSTLIST && DNS_LOCAL_HOSTLIST_IS_DYNAMIC */
96 
97 #if PPP_SUPPORT
98 LWIP_MEMPOOL(PPP_PCB, MEMP_NUM_PPP_PCB, sizeof(ppp_pcb), "PPP_PCB")
99 #if PPPOS_SUPPORT
100 LWIP_MEMPOOL(PPPOS_PCB, MEMP_NUM_PPPOS_INTERFACES, sizeof(pppos_pcb), "PPPOS_PCB")
101 #endif /* PPPOS_SUPPORT */
102 #if PPPOE_SUPPORT
103 LWIP_MEMPOOL(PPPOE_IF, MEMP_NUM_PPPOE_INTERFACES, sizeof(struct pppoe_softc), "PPPOE_IF")
104 #endif /* PPPOE_SUPPORT */
105 #if PPPOL2TP_SUPPORT
106 LWIP_MEMPOOL(PPPOL2TP_PCB, MEMP_NUM_PPPOL2TP_INTERFACES, sizeof(pppol2tp_pcb), "PPPOL2TP_PCB")
107 #endif /* PPPOL2TP_SUPPORT */
108 #endif /* PPP_SUPPORT */
109 
110 #if LWIP_IPV6 && LWIP_ND6_QUEUEING
111 LWIP_MEMPOOL(ND6_QUEUE, MEMP_NUM_ND6_QUEUE, sizeof(struct nd6_q_entry), "ND6_QUEUE")
112 #endif /* LWIP_IPV6 && LWIP_ND6_QUEUEING */
113 
114 #if LWIP_IPV6 && LWIP_IPV6_REASS
115 LWIP_MEMPOOL(IP6_REASSDATA, MEMP_NUM_REASSDATA, sizeof(struct ip6_reassdata), "IP6_REASSDATA")
116 #endif /* LWIP_IPV6 && LWIP_IPV6_REASS */
117 
118 #if LWIP_IPV6 && LWIP_IPV6_MLD
119 LWIP_MEMPOOL(MLD6_GROUP, MEMP_NUM_MLD6_GROUP, sizeof(struct mld_group), "MLD6_GROUP")
120 #endif /* LWIP_IPV6 && LWIP_IPV6_MLD */
121 
122 
123 /*
124  * A list of pools of pbuf's used by LWIP.
125  *
126  * LWIP_PBUF_MEMPOOL(pool_name, number_elements, pbuf_payload_size, pool_description)
127  * creates a pool name MEMP_pool_name. description is used in stats.c
128  * This allocates enough space for the pbuf struct and a payload.
129  * (Example: pbuf_payload_size=0 allocates only size for the struct)
130  */
131 LWIP_PBUF_MEMPOOL(PBUF, MEMP_NUM_PBUF, 0, "PBUF_REF/ROM")
133 
134 
135 /*
136  * Allow for user-defined pools; this must be explicitly set in lwipopts.h
137  * since the default is to NOT look for lwippools.h
138  */
139 #if MEMP_USE_CUSTOM_POOLS
140 #include "lwippools.h"
141 #endif /* MEMP_USE_CUSTOM_POOLS */
142 
143 /*
144  * REQUIRED CLEANUP: Clear up so we don't get "multiply defined" error later
145  * (#undef is ignored for something that is not defined)
146  */
147 #undef LWIP_MEMPOOL
148 #undef LWIP_MALLOC_MEMPOOL
149 #undef LWIP_MALLOC_MEMPOOL_START
150 #undef LWIP_MALLOC_MEMPOOL_END
151 #undef LWIP_PBUF_MEMPOOL
#define MEMP_NUM_PPPOS_INTERFACES
Definition: opt.h:382
#define MEMP_NUM_MLD6_GROUP
Definition: opt.h:2494
#define MEMP_NUM_NETCONN
Definition: opt.h:332
#define MEMP_NUM_LOCALHOSTLIST
Definition: opt.h:366
#define MEMP_NUM_PPPOE_INTERFACES
Definition: opt.h:390
#define MEMP_NUM_UDP_PCB
Definition: lwipopts.h:85
#define MEMP_NUM_ND6_QUEUE
Definition: opt.h:2523
#define MEMP_NUM_API_MSG
Definition: opt.h:412
#define PBUF_POOL_BUFSIZE
Definition: lwipopts.h:105
#define MEMP_NUM_NETDB
Definition: opt.h:358
#define MEMP_NUM_NETBUF
Definition: opt.h:324
#define MEMP_NUM_RAW_PCB
Definition: opt.h:235
#define MEMP_NUM_TCP_PCB_LISTEN
Definition: lwipopts.h:91
#define MEMP_NUM_REASSDATA
Definition: opt.h:276
Definition: pbuf.h:90
#define MEMP_NUM_PBUF
Definition: lwipopts.h:82
#define MEMP_NUM_PPP_PCB
Definition: opt.h:374
#define MEMP_NUM_FRAG_PBUF
Definition: opt.h:287
#define MEMP_NUM_SOCKET_SETGETSOCKOPT_DATA
Definition: opt.h:425
#define MEMP_NUM_ARP_QUEUE
Definition: opt.h:297
#define LWIP_PBUF_MEMPOOL(name, num, payload, desc)
Definition: memp_std.h:23
#define MEMP_NUM_TCPIP_MSG_API
Definition: opt.h:341
#define MEMP_NUM_IGMP_GROUP
Definition: opt.h:307
#define MEMP_NUM_NETIFAPI_MSG
Definition: opt.h:432
#define MEMP_NUM_TCPIP_MSG_INPKT
Definition: opt.h:350
#define MEMP_NUM_SYS_TIMEOUT
Definition: lwipopts.h:97
#define MEMP_NUM_DNS_API_MSG
Definition: opt.h:418
#define PBUF_POOL_SIZE
Definition: lwipopts.h:102
#define LWIP_MEMPOOL(name, num, size, desc)
Definition: memp.c:72
#define MEMP_NUM_PPPOL2TP_INTERFACES
Definition: opt.h:398
#define MEMP_NUM_TCP_SEG
Definition: lwipopts.h:94
#define MEMP_NUM_TCP_PCB
Definition: lwipopts.h:88