sdk-core v2026.11.05
PS2 SDK - core tier (build-critical EE/IOP modules)
Loading...
Searching...
No Matches
memp_std.h
Go to the documentation of this file.
1
9
10/*
11 * SETUP: Make sure we define everything we will need.
12 *
13 * We have create three types of pools:
14 * 1) MEMPOOL - standard pools
15 * 2) MALLOC_MEMPOOL - to be used by mem_malloc in mem.c
16 * 3) PBUF_MEMPOOL - a mempool of pbuf's, so include space for the pbuf struct
17 *
18 * If the include'r doesn't require any special treatment of each of the types
19 * above, then will declare #2 & #3 to be just standard mempools.
20 */
21#ifndef LWIP_MALLOC_MEMPOOL
22/* This treats "malloc pools" just like any other pool.
23 The pools are a little bigger to provide 'size' as the amount of user data. */
24#define LWIP_MALLOC_MEMPOOL(num, size) LWIP_MEMPOOL(POOL_##size, num, (size + LWIP_MEM_ALIGN_SIZE(sizeof(struct memp_malloc_helper))), "MALLOC_"#size)
25#define LWIP_MALLOC_MEMPOOL_START
26#define LWIP_MALLOC_MEMPOOL_END
27#endif /* LWIP_MALLOC_MEMPOOL */
28
29#ifndef LWIP_PBUF_MEMPOOL
30/* This treats "pbuf pools" just like any other pool.
31 * Allocates buffers for a pbuf struct AND a payload size */
32#define LWIP_PBUF_MEMPOOL(name, num, payload, desc) LWIP_MEMPOOL(name, num, (LWIP_MEM_ALIGN_SIZE(sizeof(struct pbuf)) + LWIP_MEM_ALIGN_SIZE(payload)), desc)
33#endif /* LWIP_PBUF_MEMPOOL */
34
35
36/*
37 * A list of internal pools used by LWIP.
38 *
39 * LWIP_MEMPOOL(pool_name, number_elements, element_size, pool_description)
40 * creates a pool name MEMP_pool_name. description is used in stats.c
41 */
42#if LWIP_RAW
43LWIP_MEMPOOL(RAW_PCB, MEMP_NUM_RAW_PCB, sizeof(struct raw_pcb), "RAW_PCB")
44#endif /* LWIP_RAW */
45
46#if LWIP_UDP
47LWIP_MEMPOOL(UDP_PCB, MEMP_NUM_UDP_PCB, sizeof(struct udp_pcb), "UDP_PCB")
48#endif /* LWIP_UDP */
49
50#if LWIP_TCP
51LWIP_MEMPOOL(TCP_PCB, MEMP_NUM_TCP_PCB, sizeof(struct tcp_pcb), "TCP_PCB")
52LWIP_MEMPOOL(TCP_PCB_LISTEN, MEMP_NUM_TCP_PCB_LISTEN, sizeof(struct tcp_pcb_listen), "TCP_PCB_LISTEN")
53LWIP_MEMPOOL(TCP_SEG, MEMP_NUM_TCP_SEG, sizeof(struct tcp_seg), "TCP_SEG")
54#endif /* LWIP_TCP */
55
56#if LWIP_ALTCP && LWIP_TCP
57LWIP_MEMPOOL(ALTCP_PCB, MEMP_NUM_ALTCP_PCB, sizeof(struct altcp_pcb), "ALTCP_PCB")
58#endif /* LWIP_ALTCP && LWIP_TCP */
59
60#if LWIP_IPV4 && IP_REASSEMBLY
61LWIP_MEMPOOL(REASSDATA, MEMP_NUM_REASSDATA, sizeof(struct ip_reassdata), "REASSDATA")
62#endif /* LWIP_IPV4 && IP_REASSEMBLY */
63#if (IP_FRAG && !LWIP_NETIF_TX_SINGLE_PBUF) || (LWIP_IPV6 && LWIP_IPV6_FRAG)
64LWIP_MEMPOOL(FRAG_PBUF, MEMP_NUM_FRAG_PBUF, sizeof(struct pbuf_custom_ref),"FRAG_PBUF")
65#endif /* IP_FRAG && !LWIP_NETIF_TX_SINGLE_PBUF || (LWIP_IPV6 && LWIP_IPV6_FRAG) */
66
67#if LWIP_NETCONN || LWIP_SOCKET
68LWIP_MEMPOOL(NETBUF, MEMP_NUM_NETBUF, sizeof(struct netbuf), "NETBUF")
69LWIP_MEMPOOL(NETCONN, MEMP_NUM_NETCONN, sizeof(struct netconn), "NETCONN")
70#endif /* LWIP_NETCONN || LWIP_SOCKET */
71
72#if NO_SYS==0
73LWIP_MEMPOOL(TCPIP_MSG_API, MEMP_NUM_TCPIP_MSG_API, sizeof(struct tcpip_msg), "TCPIP_MSG_API")
74#if LWIP_MPU_COMPATIBLE
75LWIP_MEMPOOL(API_MSG, MEMP_NUM_API_MSG, sizeof(struct api_msg), "API_MSG")
76#if LWIP_DNS
77LWIP_MEMPOOL(DNS_API_MSG, MEMP_NUM_DNS_API_MSG, sizeof(struct dns_api_msg), "DNS_API_MSG")
78#endif
79#if LWIP_SOCKET && !LWIP_TCPIP_CORE_LOCKING
80LWIP_MEMPOOL(SOCKET_SETGETSOCKOPT_DATA, MEMP_NUM_SOCKET_SETGETSOCKOPT_DATA, sizeof(struct lwip_setgetsockopt_data), "SOCKET_SETGETSOCKOPT_DATA")
81#endif
82#if LWIP_SOCKET && (LWIP_SOCKET_SELECT || LWIP_SOCKET_POLL)
83LWIP_MEMPOOL(SELECT_CB, MEMP_NUM_SELECT_CB, sizeof(struct lwip_select_cb), "SELECT_CB")
84#endif /* LWIP_SOCKET && (LWIP_SOCKET_SELECT || LWIP_SOCKET_POLL) */
85#if LWIP_NETIF_API
86LWIP_MEMPOOL(NETIFAPI_MSG, MEMP_NUM_NETIFAPI_MSG, sizeof(struct netifapi_msg), "NETIFAPI_MSG")
87#endif
88#endif /* LWIP_MPU_COMPATIBLE */
89#if !LWIP_TCPIP_CORE_LOCKING_INPUT
90LWIP_MEMPOOL(TCPIP_MSG_INPKT,MEMP_NUM_TCPIP_MSG_INPKT, sizeof(struct tcpip_msg), "TCPIP_MSG_INPKT")
91#endif /* !LWIP_TCPIP_CORE_LOCKING_INPUT */
92#endif /* NO_SYS==0 */
93
94#if LWIP_IPV4 && LWIP_ARP && ARP_QUEUEING
95LWIP_MEMPOOL(ARP_QUEUE, MEMP_NUM_ARP_QUEUE, sizeof(struct etharp_q_entry), "ARP_QUEUE")
96#endif /* LWIP_IPV4 && LWIP_ARP && ARP_QUEUEING */
97
98#if LWIP_IGMP
99LWIP_MEMPOOL(IGMP_GROUP, MEMP_NUM_IGMP_GROUP, sizeof(struct igmp_group), "IGMP_GROUP")
100#endif /* LWIP_IGMP */
101
102#if LWIP_TIMERS && !LWIP_TIMERS_CUSTOM
103LWIP_MEMPOOL(SYS_TIMEOUT, MEMP_NUM_SYS_TIMEOUT, sizeof(struct sys_timeo), "SYS_TIMEOUT")
104#endif /* LWIP_TIMERS && !LWIP_TIMERS_CUSTOM */
105
106#if LWIP_DNS && LWIP_SOCKET
107LWIP_MEMPOOL(NETDB, MEMP_NUM_NETDB, NETDB_ELEM_SIZE, "NETDB")
108#endif /* LWIP_DNS && LWIP_SOCKET */
109#if LWIP_DNS && DNS_LOCAL_HOSTLIST && DNS_LOCAL_HOSTLIST_IS_DYNAMIC
110LWIP_MEMPOOL(LOCALHOSTLIST, MEMP_NUM_LOCALHOSTLIST, LOCALHOSTLIST_ELEM_SIZE, "LOCALHOSTLIST")
111#endif /* LWIP_DNS && DNS_LOCAL_HOSTLIST && DNS_LOCAL_HOSTLIST_IS_DYNAMIC */
112
113#if LWIP_IPV6 && LWIP_ND6_QUEUEING
114LWIP_MEMPOOL(ND6_QUEUE, MEMP_NUM_ND6_QUEUE, sizeof(struct nd6_q_entry), "ND6_QUEUE")
115#endif /* LWIP_IPV6 && LWIP_ND6_QUEUEING */
116
117#if LWIP_IPV6 && LWIP_IPV6_REASS
118LWIP_MEMPOOL(IP6_REASSDATA, MEMP_NUM_REASSDATA, sizeof(struct ip6_reassdata), "IP6_REASSDATA")
119#endif /* LWIP_IPV6 && LWIP_IPV6_REASS */
120
121#if LWIP_IPV6 && LWIP_IPV6_MLD
122LWIP_MEMPOOL(MLD6_GROUP, MEMP_NUM_MLD6_GROUP, sizeof(struct mld_group), "MLD6_GROUP")
123#endif /* LWIP_IPV6 && LWIP_IPV6_MLD */
124
125
126/*
127 * A list of pools of pbuf's used by LWIP.
128 *
129 * LWIP_PBUF_MEMPOOL(pool_name, number_elements, pbuf_payload_size, pool_description)
130 * creates a pool name MEMP_pool_name. description is used in stats.c
131 * This allocates enough space for the pbuf struct and a payload.
132 * (Example: pbuf_payload_size=0 allocates only size for the struct)
133 */
134LWIP_MEMPOOL(PBUF, MEMP_NUM_PBUF, sizeof(struct pbuf), "PBUF_REF/ROM")
135LWIP_PBUF_MEMPOOL(PBUF_POOL, PBUF_POOL_SIZE, PBUF_POOL_BUFSIZE, "PBUF_POOL")
136
137
138/*
139 * Allow for user-defined pools; this must be explicitly set in lwipopts.h
140 * since the default is to NOT look for lwippools.h
141 */
142#if MEMP_USE_CUSTOM_POOLS
143#include "lwippools.h"
144#endif /* MEMP_USE_CUSTOM_POOLS */
145
146/*
147 * REQUIRED CLEANUP: Clear up so we don't get "multiply defined" error later
148 * (#undef is ignored for something that is not defined)
149 */
150#undef LWIP_MEMPOOL
151#undef LWIP_MALLOC_MEMPOOL
152#undef LWIP_MALLOC_MEMPOOL_START
153#undef LWIP_MALLOC_MEMPOOL_END
154#undef LWIP_PBUF_MEMPOOL
#define MEMP_NUM_TCP_PCB_LISTEN
Definition opt.h:455
#define MEMP_NUM_ARP_QUEUE
Definition opt.h:502
#define MEMP_NUM_REASSDATA
Definition opt.h:481
#define MEMP_NUM_FRAG_PBUF
Definition opt.h:492
#define MEMP_NUM_ALTCP_PCB
Definition opt.h:473
#define MEMP_NUM_NETDB
Definition opt.h:578
#define MEMP_NUM_RAW_PCB
Definition opt.h:430
#define MEMP_NUM_DNS_API_MSG
Definition opt.h:606
#define MEMP_NUM_SYS_TIMEOUT
Definition opt.h:527
#define MEMP_NUM_API_MSG
Definition opt.h:600
#define MEMP_NUM_NETBUF
Definition opt.h:535
#define MEMP_NUM_SELECT_CB
Definition opt.h:552
#define MEMP_NUM_PBUF
Definition opt.h:422
#define MEMP_NUM_TCP_SEG
Definition opt.h:463
#define MEMP_NUM_LOCALHOSTLIST
Definition opt.h:586
#define MEMP_NUM_IGMP_GROUP
Definition opt.h:512
#define MEMP_NUM_SOCKET_SETGETSOCKOPT_DATA
Definition opt.h:613
#define MEMP_NUM_NETIFAPI_MSG
Definition opt.h:620
#define MEMP_NUM_TCPIP_MSG_API
Definition opt.h:561
#define MEMP_NUM_MLD6_GROUP
Definition opt.h:2630
#define MEMP_NUM_ND6_QUEUE
Definition opt.h:2653
#define PBUF_POOL_BUFSIZE
Definition opt.h:1617
@ PBUF_POOL
Definition tcpip.h:229
#define PBUF_POOL_SIZE
Definition lwipopts.h:124
#define MEMP_NUM_TCPIP_MSG_INPKT
Definition lwipopts.h:113
Definition tcpip.h:234