source: UsbWattMeter/trunk/lwip-1.4.1/src/include/lwip/memp_std.h@ 164

Last change on this file since 164 was 164, checked in by coas-nagasima, 6 years ago

TOPPERS/ECNLサンプルアプリ「USB充電器電力計」を追加

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
  • Property svn:mime-type set to text/x-chdr
File size: 5.4 KB
Line 
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 + 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
34LWIP_MEMPOOL(RAW_PCB, MEMP_NUM_RAW_PCB, sizeof(struct raw_pcb), "RAW_PCB")
35#endif /* LWIP_RAW */
36
37#if LWIP_UDP
38LWIP_MEMPOOL(UDP_PCB, MEMP_NUM_UDP_PCB, sizeof(struct udp_pcb), "UDP_PCB")
39#endif /* LWIP_UDP */
40
41#if LWIP_TCP
42LWIP_MEMPOOL(TCP_PCB, MEMP_NUM_TCP_PCB, sizeof(struct tcp_pcb), "TCP_PCB")
43LWIP_MEMPOOL(TCP_PCB_LISTEN, MEMP_NUM_TCP_PCB_LISTEN, sizeof(struct tcp_pcb_listen), "TCP_PCB_LISTEN")
44LWIP_MEMPOOL(TCP_SEG, MEMP_NUM_TCP_SEG, sizeof(struct tcp_seg), "TCP_SEG")
45#endif /* LWIP_TCP */
46
47#if IP_REASSEMBLY
48LWIP_MEMPOOL(REASSDATA, MEMP_NUM_REASSDATA, sizeof(struct ip_reassdata), "REASSDATA")
49#endif /* IP_REASSEMBLY */
50#if IP_FRAG && !IP_FRAG_USES_STATIC_BUF && !LWIP_NETIF_TX_SINGLE_PBUF
51LWIP_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
55LWIP_MEMPOOL(NETBUF, MEMP_NUM_NETBUF, sizeof(struct netbuf), "NETBUF")
56LWIP_MEMPOOL(NETCONN, MEMP_NUM_NETCONN, sizeof(struct netconn), "NETCONN")
57#endif /* LWIP_NETCONN */
58
59#if NO_SYS==0
60LWIP_MEMPOOL(TCPIP_MSG_API, MEMP_NUM_TCPIP_MSG_API, sizeof(struct tcpip_msg), "TCPIP_MSG_API")
61#if !LWIP_TCPIP_CORE_LOCKING_INPUT
62LWIP_MEMPOOL(TCPIP_MSG_INPKT,MEMP_NUM_TCPIP_MSG_INPKT, sizeof(struct tcpip_msg), "TCPIP_MSG_INPKT")
63#endif /* !LWIP_TCPIP_CORE_LOCKING_INPUT */
64#endif /* NO_SYS==0 */
65
66#if LWIP_ARP && ARP_QUEUEING
67LWIP_MEMPOOL(ARP_QUEUE, MEMP_NUM_ARP_QUEUE, sizeof(struct etharp_q_entry), "ARP_QUEUE")
68#endif /* LWIP_ARP && ARP_QUEUEING */
69
70#if LWIP_IGMP
71LWIP_MEMPOOL(IGMP_GROUP, MEMP_NUM_IGMP_GROUP, sizeof(struct igmp_group), "IGMP_GROUP")
72#endif /* LWIP_IGMP */
73
74#if (!NO_SYS || (NO_SYS && !NO_SYS_NO_TIMERS)) /* LWIP_TIMERS */
75LWIP_MEMPOOL(SYS_TIMEOUT, MEMP_NUM_SYS_TIMEOUT, sizeof(struct sys_timeo), "SYS_TIMEOUT")
76#endif /* LWIP_TIMERS */
77
78#if LWIP_SNMP
79LWIP_MEMPOOL(SNMP_ROOTNODE, MEMP_NUM_SNMP_ROOTNODE, sizeof(struct mib_list_rootnode), "SNMP_ROOTNODE")
80LWIP_MEMPOOL(SNMP_NODE, MEMP_NUM_SNMP_NODE, sizeof(struct mib_list_node), "SNMP_NODE")
81LWIP_MEMPOOL(SNMP_VARBIND, MEMP_NUM_SNMP_VARBIND, sizeof(struct snmp_varbind), "SNMP_VARBIND")
82LWIP_MEMPOOL(SNMP_VALUE, MEMP_NUM_SNMP_VALUE, SNMP_MAX_VALUE_SIZE, "SNMP_VALUE")
83#endif /* LWIP_SNMP */
84#if LWIP_DNS && LWIP_SOCKET
85LWIP_MEMPOOL(NETDB, MEMP_NUM_NETDB, NETDB_ELEM_SIZE, "NETDB")
86#endif /* LWIP_DNS && LWIP_SOCKET */
87#if LWIP_DNS && DNS_LOCAL_HOSTLIST && DNS_LOCAL_HOSTLIST_IS_DYNAMIC
88LWIP_MEMPOOL(LOCALHOSTLIST, MEMP_NUM_LOCALHOSTLIST, LOCALHOSTLIST_ELEM_SIZE, "LOCALHOSTLIST")
89#endif /* LWIP_DNS && DNS_LOCAL_HOSTLIST && DNS_LOCAL_HOSTLIST_IS_DYNAMIC */
90#if PPP_SUPPORT && PPPOE_SUPPORT
91LWIP_MEMPOOL(PPPOE_IF, MEMP_NUM_PPPOE_INTERFACES, sizeof(struct pppoe_softc), "PPPOE_IF")
92#endif /* PPP_SUPPORT && PPPOE_SUPPORT */
93
94/*
95 * A list of pools of pbuf's used by LWIP.
96 *
97 * LWIP_PBUF_MEMPOOL(pool_name, number_elements, pbuf_payload_size, pool_description)
98 * creates a pool name MEMP_pool_name. description is used in stats.c
99 * This allocates enough space for the pbuf struct and a payload.
100 * (Example: pbuf_payload_size=0 allocates only size for the struct)
101 */
102LWIP_PBUF_MEMPOOL(PBUF, MEMP_NUM_PBUF, 0, "PBUF_REF/ROM")
103LWIP_PBUF_MEMPOOL(PBUF_POOL, PBUF_POOL_SIZE, PBUF_POOL_BUFSIZE, "PBUF_POOL")
104
105
106/*
107 * Allow for user-defined pools; this must be explicitly set in lwipopts.h
108 * since the default is to NOT look for lwippools.h
109 */
110#if MEMP_USE_CUSTOM_POOLS
111#include "lwippools.h"
112#endif /* MEMP_USE_CUSTOM_POOLS */
113
114/*
115 * REQUIRED CLEANUP: Clear up so we don't get "multiply defined" error later
116 * (#undef is ignored for something that is not defined)
117 */
118#undef LWIP_MEMPOOL
119#undef LWIP_MALLOC_MEMPOOL
120#undef LWIP_MALLOC_MEMPOOL_START
121#undef LWIP_MALLOC_MEMPOOL_END
122#undef LWIP_PBUF_MEMPOOL
Note: See TracBrowser for help on using the repository browser.