User | Revision | Line number | New contents of line |
mbed714 |
0:d616ece2d859
|
1
|
/*
|
mbed714 |
0:d616ece2d859
|
2
|
* SETUP: Make sure we define everything we will need.
|
mbed714 |
0:d616ece2d859
|
3
|
*
|
mbed714 |
0:d616ece2d859
|
4
|
* We have create three types of pools:
|
mbed714 |
0:d616ece2d859
|
5
|
* 1) MEMPOOL - standard pools
|
mbed714 |
0:d616ece2d859
|
6
|
* 2) MALLOC_MEMPOOL - to be used by mem_malloc in mem.c
|
mbed714 |
0:d616ece2d859
|
7
|
* 3) PBUF_MEMPOOL - a mempool of pbuf's, so include space for the pbuf struct
|
mbed714 |
0:d616ece2d859
|
8
|
*
|
mbed714 |
0:d616ece2d859
|
9
|
* If the include'r doesn't require any special treatment of each of the types
|
mbed714 |
0:d616ece2d859
|
10
|
* above, then will declare #2 & #3 to be just standard mempools.
|
mbed714 |
0:d616ece2d859
|
11
|
*/
|
mbed714 |
0:d616ece2d859
|
12
|
#ifndef LWIP_MALLOC_MEMPOOL
|
mbed714 |
0:d616ece2d859
|
13
|
/* This treats "malloc pools" just like any other pool.
|
mbed714 |
0:d616ece2d859
|
14
|
The pools are a little bigger to provide 'size' as the amount of user data. */
|
mbed714 |
0:d616ece2d859
|
15
|
#define LWIP_MALLOC_MEMPOOL(num, size) LWIP_MEMPOOL(POOL_##size, num, (size + sizeof(struct memp_malloc_helper)), "MALLOC_"#size)
|
mbed714 |
0:d616ece2d859
|
16
|
#define LWIP_MALLOC_MEMPOOL_START
|
mbed714 |
0:d616ece2d859
|
17
|
#define LWIP_MALLOC_MEMPOOL_END
|
mbed714 |
0:d616ece2d859
|
18
|
#endif /* LWIP_MALLOC_MEMPOOL */
|
mbed714 |
0:d616ece2d859
|
19
|
|
mbed714 |
0:d616ece2d859
|
20
|
#ifndef LWIP_PBUF_MEMPOOL
|
mbed714 |
0:d616ece2d859
|
21
|
/* This treats "pbuf pools" just like any other pool.
|
mbed714 |
0:d616ece2d859
|
22
|
* Allocates buffers for a pbuf struct AND a payload size */
|
mbed714 |
0:d616ece2d859
|
23
|
#define LWIP_PBUF_MEMPOOL(name, num, payload, desc) LWIP_MEMPOOL(name, num, (MEMP_ALIGN_SIZE(sizeof(struct pbuf)) + MEMP_ALIGN_SIZE(payload)), desc)
|
mbed714 |
0:d616ece2d859
|
24
|
#endif /* LWIP_PBUF_MEMPOOL */
|
mbed714 |
0:d616ece2d859
|
25
|
|
mbed714 |
0:d616ece2d859
|
26
|
|
mbed714 |
0:d616ece2d859
|
27
|
/*
|
mbed714 |
0:d616ece2d859
|
28
|
* A list of internal pools used by LWIP.
|
mbed714 |
0:d616ece2d859
|
29
|
*
|
mbed714 |
0:d616ece2d859
|
30
|
* LWIP_MEMPOOL(pool_name, number_elements, element_size, pool_description)
|
mbed714 |
0:d616ece2d859
|
31
|
* creates a pool name MEMP_pool_name. description is used in stats.c
|
mbed714 |
0:d616ece2d859
|
32
|
*/
|
mbed714 |
0:d616ece2d859
|
33
|
#if LWIP_RAW
|
mbed714 |
0:d616ece2d859
|
34
|
LWIP_MEMPOOL(RAW_PCB, MEMP_NUM_RAW_PCB, sizeof(struct raw_pcb), "RAW_PCB")
|
mbed714 |
0:d616ece2d859
|
35
|
#endif /* LWIP_RAW */
|
mbed714 |
0:d616ece2d859
|
36
|
|
mbed714 |
0:d616ece2d859
|
37
|
#if LWIP_UDP
|
mbed714 |
0:d616ece2d859
|
38
|
LWIP_MEMPOOL(UDP_PCB, MEMP_NUM_UDP_PCB, sizeof(struct udp_pcb), "UDP_PCB")
|
mbed714 |
0:d616ece2d859
|
39
|
#endif /* LWIP_UDP */
|
mbed714 |
0:d616ece2d859
|
40
|
|
mbed714 |
0:d616ece2d859
|
41
|
#if LWIP_TCP
|
mbed714 |
0:d616ece2d859
|
42
|
LWIP_MEMPOOL(TCP_PCB, MEMP_NUM_TCP_PCB, sizeof(struct tcp_pcb), "TCP_PCB")
|
mbed714 |
0:d616ece2d859
|
43
|
LWIP_MEMPOOL(TCP_PCB_LISTEN, MEMP_NUM_TCP_PCB_LISTEN, sizeof(struct tcp_pcb_listen), "TCP_PCB_LISTEN")
|
mbed714 |
0:d616ece2d859
|
44
|
LWIP_MEMPOOL(TCP_SEG, MEMP_NUM_TCP_SEG, sizeof(struct tcp_seg), "TCP_SEG")
|
mbed714 |
0:d616ece2d859
|
45
|
#endif /* LWIP_TCP */
|
mbed714 |
0:d616ece2d859
|
46
|
|
mbed714 |
0:d616ece2d859
|
47
|
#if IP_REASSEMBLY
|
mbed714 |
0:d616ece2d859
|
48
|
LWIP_MEMPOOL(REASSDATA, MEMP_NUM_REASSDATA, sizeof(struct ip_reassdata), "REASSDATA")
|
mbed714 |
0:d616ece2d859
|
49
|
#endif /* IP_REASSEMBLY */
|
mbed714 |
0:d616ece2d859
|
50
|
#if IP_FRAG && !IP_FRAG_USES_STATIC_BUF && !LWIP_NETIF_TX_SINGLE_PBUF
|
mbed714 |
0:d616ece2d859
|
51
|
LWIP_MEMPOOL(FRAG_PBUF, MEMP_NUM_FRAG_PBUF, sizeof(struct pbuf_custom_ref),"FRAG_PBUF")
|
mbed714 |
0:d616ece2d859
|
52
|
#endif /* IP_FRAG && !IP_FRAG_USES_STATIC_BUF && !LWIP_NETIF_TX_SINGLE_PBUF */
|
mbed714 |
0:d616ece2d859
|
53
|
|
mbed714 |
0:d616ece2d859
|
54
|
#if LWIP_NETCONN
|
mbed714 |
0:d616ece2d859
|
55
|
LWIP_MEMPOOL(NETBUF, MEMP_NUM_NETBUF, sizeof(struct netbuf), "NETBUF")
|
mbed714 |
0:d616ece2d859
|
56
|
LWIP_MEMPOOL(NETCONN, MEMP_NUM_NETCONN, sizeof(struct netconn), "NETCONN")
|
mbed714 |
0:d616ece2d859
|
57
|
#endif /* LWIP_NETCONN */
|
mbed714 |
0:d616ece2d859
|
58
|
|
mbed714 |
0:d616ece2d859
|
59
|
#if NO_SYS==0
|
mbed714 |
0:d616ece2d859
|
60
|
LWIP_MEMPOOL(TCPIP_MSG_API, MEMP_NUM_TCPIP_MSG_API, sizeof(struct tcpip_msg), "TCPIP_MSG_API")
|
mbed714 |
0:d616ece2d859
|
61
|
#if !LWIP_TCPIP_CORE_LOCKING_INPUT
|
mbed714 |
0:d616ece2d859
|
62
|
LWIP_MEMPOOL(TCPIP_MSG_INPKT,MEMP_NUM_TCPIP_MSG_INPKT, sizeof(struct tcpip_msg), "TCPIP_MSG_INPKT")
|
mbed714 |
0:d616ece2d859
|
63
|
#endif /* !LWIP_TCPIP_CORE_LOCKING_INPUT */
|
mbed714 |
0:d616ece2d859
|
64
|
#endif /* NO_SYS==0 */
|
mbed714 |
0:d616ece2d859
|
65
|
|
mbed714 |
0:d616ece2d859
|
66
|
#if ARP_QUEUEING
|
mbed714 |
0:d616ece2d859
|
67
|
LWIP_MEMPOOL(ARP_QUEUE, MEMP_NUM_ARP_QUEUE, sizeof(struct etharp_q_entry), "ARP_QUEUE")
|
mbed714 |
0:d616ece2d859
|
68
|
#endif /* ARP_QUEUEING */
|
mbed714 |
0:d616ece2d859
|
69
|
|
mbed714 |
0:d616ece2d859
|
70
|
#if LWIP_IGMP
|
mbed714 |
0:d616ece2d859
|
71
|
LWIP_MEMPOOL(IGMP_GROUP, MEMP_NUM_IGMP_GROUP, sizeof(struct igmp_group), "IGMP_GROUP")
|
mbed714 |
0:d616ece2d859
|
72
|
#endif /* LWIP_IGMP */
|
mbed714 |
0:d616ece2d859
|
73
|
|
mbed714 |
0:d616ece2d859
|
74
|
#if (!NO_SYS || (NO_SYS && !NO_SYS_NO_TIMERS)) /* LWIP_TIMERS */
|
mbed714 |
0:d616ece2d859
|
75
|
LWIP_MEMPOOL(SYS_TIMEOUT, MEMP_NUM_SYS_TIMEOUT, sizeof(struct sys_timeo), "SYS_TIMEOUT")
|
mbed714 |
0:d616ece2d859
|
76
|
#endif /* LWIP_TIMERS */
|
mbed714 |
0:d616ece2d859
|
77
|
|
mbed714 |
0:d616ece2d859
|
78
|
#if LWIP_SNMP
|
mbed714 |
0:d616ece2d859
|
79
|
LWIP_MEMPOOL(SNMP_ROOTNODE, MEMP_NUM_SNMP_ROOTNODE, sizeof(struct mib_list_rootnode), "SNMP_ROOTNODE")
|
mbed714 |
0:d616ece2d859
|
80
|
LWIP_MEMPOOL(SNMP_NODE, MEMP_NUM_SNMP_NODE, sizeof(struct mib_list_node), "SNMP_NODE")
|
mbed714 |
0:d616ece2d859
|
81
|
LWIP_MEMPOOL(SNMP_VARBIND, MEMP_NUM_SNMP_VARBIND, sizeof(struct snmp_varbind), "SNMP_VARBIND")
|
mbed714 |
0:d616ece2d859
|
82
|
LWIP_MEMPOOL(SNMP_VALUE, MEMP_NUM_SNMP_VALUE, SNMP_MAX_VALUE_SIZE, "SNMP_VALUE")
|
mbed714 |
0:d616ece2d859
|
83
|
#endif /* LWIP_SNMP */
|
mbed714 |
0:d616ece2d859
|
84
|
#if LWIP_DNS && LWIP_SOCKET
|
mbed714 |
0:d616ece2d859
|
85
|
LWIP_MEMPOOL(NETDB, MEMP_NUM_NETDB, NETDB_ELEM_SIZE, "NETDB")
|
mbed714 |
0:d616ece2d859
|
86
|
#endif /* LWIP_DNS && LWIP_SOCKET */
|
mbed714 |
0:d616ece2d859
|
87
|
#if LWIP_DNS && DNS_LOCAL_HOSTLIST && DNS_LOCAL_HOSTLIST_IS_DYNAMIC
|
mbed714 |
0:d616ece2d859
|
88
|
LWIP_MEMPOOL(LOCALHOSTLIST, MEMP_NUM_LOCALHOSTLIST, LOCALHOSTLIST_ELEM_SIZE, "LOCALHOSTLIST")
|
mbed714 |
0:d616ece2d859
|
89
|
#endif /* LWIP_DNS && DNS_LOCAL_HOSTLIST && DNS_LOCAL_HOSTLIST_IS_DYNAMIC */
|
mbed714 |
0:d616ece2d859
|
90
|
#if PPP_SUPPORT && PPPOE_SUPPORT
|
mbed714 |
0:d616ece2d859
|
91
|
LWIP_MEMPOOL(PPPOE_IF, MEMP_NUM_PPPOE_INTERFACES, sizeof(struct pppoe_softc), "PPPOE_IF")
|
mbed714 |
0:d616ece2d859
|
92
|
#endif /* PPP_SUPPORT && PPPOE_SUPPORT */
|
mbed714 |
0:d616ece2d859
|
93
|
|
mbed714 |
0:d616ece2d859
|
94
|
/*
|
mbed714 |
0:d616ece2d859
|
95
|
* A list of pools of pbuf's used by LWIP.
|
mbed714 |
0:d616ece2d859
|
96
|
*
|
mbed714 |
0:d616ece2d859
|
97
|
* LWIP_PBUF_MEMPOOL(pool_name, number_elements, pbuf_payload_size, pool_description)
|
mbed714 |
0:d616ece2d859
|
98
|
* creates a pool name MEMP_pool_name. description is used in stats.c
|
mbed714 |
0:d616ece2d859
|
99
|
* This allocates enough space for the pbuf struct and a payload.
|
mbed714 |
0:d616ece2d859
|
100
|
* (Example: pbuf_payload_size=0 allocates only size for the struct)
|
mbed714 |
0:d616ece2d859
|
101
|
*/
|
mbed714 |
0:d616ece2d859
|
102
|
LWIP_PBUF_MEMPOOL(PBUF, MEMP_NUM_PBUF, 0, "PBUF_REF/ROM")
|
mbed714 |
0:d616ece2d859
|
103
|
LWIP_PBUF_MEMPOOL(PBUF_POOL, PBUF_POOL_SIZE, PBUF_POOL_BUFSIZE, "PBUF_POOL")
|
mbed714 |
0:d616ece2d859
|
104
|
|
mbed714 |
0:d616ece2d859
|
105
|
|
mbed714 |
0:d616ece2d859
|
106
|
/*
|
mbed714 |
0:d616ece2d859
|
107
|
* Allow for user-defined pools; this must be explicitly set in lwipopts.h
|
mbed714 |
0:d616ece2d859
|
108
|
* since the default is to NOT look for lwippools.h
|
mbed714 |
0:d616ece2d859
|
109
|
*/
|
mbed714 |
0:d616ece2d859
|
110
|
#if MEMP_USE_CUSTOM_POOLS
|
mbed714 |
0:d616ece2d859
|
111
|
#include "lwippools.h"
|
mbed714 |
0:d616ece2d859
|
112
|
#endif /* MEMP_USE_CUSTOM_POOLS */
|
mbed714 |
0:d616ece2d859
|
113
|
|
mbed714 |
0:d616ece2d859
|
114
|
/*
|
mbed714 |
0:d616ece2d859
|
115
|
* REQUIRED CLEANUP: Clear up so we don't get "multiply defined" error later
|
mbed714 |
0:d616ece2d859
|
116
|
* (#undef is ignored for something that is not defined)
|
mbed714 |
0:d616ece2d859
|
117
|
*/
|
mbed714 |
0:d616ece2d859
|
118
|
#undef LWIP_MEMPOOL
|
mbed714 |
0:d616ece2d859
|
119
|
#undef LWIP_MALLOC_MEMPOOL
|
mbed714 |
0:d616ece2d859
|
120
|
#undef LWIP_MALLOC_MEMPOOL_START
|
mbed714 |
0:d616ece2d859
|
121
|
#undef LWIP_MALLOC_MEMPOOL_END
|
mbed714 |
0:d616ece2d859
|
122
|
#undef LWIP_PBUF_MEMPOOL
|