]>
Commit | Line | Data |
---|---|---|
6e6d4a8b JP |
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 | #define LWIP_MALLOC_MEMPOOL(num, size) LWIP_MEMPOOL(POOL_##size, num, size, "MALLOC_"#size) | |
15 | #define LWIP_MALLOC_MEMPOOL_START | |
16 | #define LWIP_MALLOC_MEMPOOL_END | |
17 | #endif /* LWIP_MALLOC_MEMPOOL */ | |
18 | ||
19 | #ifndef LWIP_PBUF_MEMPOOL | |
20 | /* This treats "pbuf pools" just like any other pool. | |
21 | * Allocates buffers for a pbuf struct AND a payload size */ | |
22 | #define LWIP_PBUF_MEMPOOL(name, num, payload, desc) LWIP_MEMPOOL(name, num, (MEMP_ALIGN_SIZE(sizeof(struct pbuf)) + MEMP_ALIGN_SIZE(payload)), desc) | |
23 | #endif /* LWIP_PBUF_MEMPOOL */ | |
24 | ||
25 | ||
26 | /* | |
27 | * A list of internal pools used by LWIP. | |
28 | * | |
29 | * LWIP_MEMPOOL(pool_name, number_elements, element_size, pool_description) | |
30 | * creates a pool name MEMP_pool_name. description is used in stats.c | |
31 | */ | |
32 | #if LWIP_RAW | |
33 | LWIP_MEMPOOL(RAW_PCB, MEMP_NUM_RAW_PCB, sizeof(struct raw_pcb), "RAW_PCB") | |
34 | #endif /* LWIP_RAW */ | |
35 | ||
36 | #if LWIP_UDP | |
37 | LWIP_MEMPOOL(UDP_PCB, MEMP_NUM_UDP_PCB, sizeof(struct udp_pcb), "UDP_PCB") | |
38 | #endif /* LWIP_UDP */ | |
39 | ||
40 | #if LWIP_TCP | |
41 | LWIP_MEMPOOL(TCP_PCB, MEMP_NUM_TCP_PCB, sizeof(struct tcp_pcb), "TCP_PCB") | |
42 | LWIP_MEMPOOL(TCP_PCB_LISTEN, MEMP_NUM_TCP_PCB_LISTEN, sizeof(struct tcp_pcb_listen), "TCP_PCB_LISTEN") | |
43 | LWIP_MEMPOOL(TCP_SEG, MEMP_NUM_TCP_SEG, sizeof(struct tcp_seg), "TCP_SEG") | |
44 | #endif /* LWIP_TCP */ | |
45 | ||
46 | #if IP_REASSEMBLY | |
47 | LWIP_MEMPOOL(REASSDATA, MEMP_NUM_REASSDATA, sizeof(struct ip_reassdata), "REASSDATA") | |
48 | #endif /* IP_REASSEMBLY */ | |
49 | ||
50 | #if LWIP_NETCONN | |
51 | LWIP_MEMPOOL(NETBUF, MEMP_NUM_NETBUF, sizeof(struct netbuf), "NETBUF") | |
52 | LWIP_MEMPOOL(NETCONN, MEMP_NUM_NETCONN, sizeof(struct netconn), "NETCONN") | |
53 | #endif /* LWIP_NETCONN */ | |
54 | ||
55 | #if NO_SYS==0 | |
56 | LWIP_MEMPOOL(TCPIP_MSG_API, MEMP_NUM_TCPIP_MSG_API, sizeof(struct tcpip_msg), "TCPIP_MSG_API") | |
57 | LWIP_MEMPOOL(TCPIP_MSG_INPKT,MEMP_NUM_TCPIP_MSG_INPKT, sizeof(struct tcpip_msg), "TCPIP_MSG_INPKT") | |
58 | #endif /* NO_SYS==0 */ | |
59 | ||
60 | #if ARP_QUEUEING | |
61 | LWIP_MEMPOOL(ARP_QUEUE, MEMP_NUM_ARP_QUEUE, sizeof(struct etharp_q_entry), "ARP_QUEUE") | |
62 | #endif /* ARP_QUEUEING */ | |
63 | ||
64 | #if LWIP_IGMP | |
65 | LWIP_MEMPOOL(IGMP_GROUP, MEMP_NUM_IGMP_GROUP, sizeof(struct igmp_group), "IGMP_GROUP") | |
66 | #endif /* LWIP_IGMP */ | |
67 | ||
68 | #if NO_SYS==0 | |
69 | LWIP_MEMPOOL(SYS_TIMEOUT, MEMP_NUM_SYS_TIMEOUT, sizeof(struct sys_timeo), "SYS_TIMEOUT") | |
70 | #endif /* NO_SYS==0 */ | |
71 | ||
72 | ||
73 | /* | |
74 | * A list of pools of pbuf's used by LWIP. | |
75 | * | |
76 | * LWIP_PBUF_MEMPOOL(pool_name, number_elements, pbuf_payload_size, pool_description) | |
77 | * creates a pool name MEMP_pool_name. description is used in stats.c | |
78 | * This allocates enough space for the pbuf struct and a payload. | |
79 | * (Example: pbuf_payload_size=0 allocates only size for the struct) | |
80 | */ | |
81 | LWIP_PBUF_MEMPOOL(PBUF, MEMP_NUM_PBUF, 0, "PBUF_REF/ROM") | |
82 | LWIP_PBUF_MEMPOOL(PBUF_POOL, PBUF_POOL_SIZE, PBUF_POOL_BUFSIZE, "PBUF_POOL") | |
83 | ||
84 | ||
85 | /* | |
86 | * Allow for user-defined pools; this must be explicitly set in lwipopts.h | |
87 | * since the default is to NOT look for lwippools.h | |
88 | */ | |
89 | #if MEMP_USE_CUSTOM_POOLS | |
90 | #include "lwippools.h" | |
91 | #endif /* MEMP_USE_CUSTOM_POOLS */ | |
92 | ||
93 | /* | |
94 | * REQUIRED CLEANUP: Clear up so we don't get "multiply defined" error later | |
95 | * (#undef is ignored for something that is not defined) | |
96 | */ | |
97 | #undef LWIP_MEMPOOL | |
98 | #undef LWIP_MALLOC_MEMPOOL | |
99 | #undef LWIP_MALLOC_MEMPOOL_START | |
100 | #undef LWIP_MALLOC_MEMPOOL_END | |
101 | #undef LWIP_PBUF_MEMPOOL |