Embed:
(wiki syntax)
Show/hide line numbers
memp_std.h
00001 /* 00002 * SETUP: Make sure we define everything we will need. 00003 * 00004 * We have create three types of pools: 00005 * 1) MEMPOOL - standard pools 00006 * 2) MALLOC_MEMPOOL - to be used by mem_malloc in mem.c 00007 * 3) PBUF_MEMPOOL - a mempool of pbuf's, so include space for the pbuf struct 00008 * 00009 * If the include'r doesn't require any special treatment of each of the types 00010 * above, then will declare #2 & #3 to be just standard mempools. 00011 */ 00012 #ifndef LWIP_MALLOC_MEMPOOL 00013 /* This treats "malloc pools" just like any other pool. 00014 The pools are a little bigger to provide 'size' as the amount of user data. */ 00015 #define LWIP_MALLOC_MEMPOOL(num, size) LWIP_MEMPOOL(POOL_##size, num, (size + sizeof(struct memp_malloc_helper)), "MALLOC_"#size) 00016 #define LWIP_MALLOC_MEMPOOL_START 00017 #define LWIP_MALLOC_MEMPOOL_END 00018 #endif /* LWIP_MALLOC_MEMPOOL */ 00019 00020 #ifndef LWIP_PBUF_MEMPOOL 00021 /* This treats "pbuf pools" just like any other pool. 00022 * Allocates buffers for a pbuf struct AND a payload size */ 00023 #define LWIP_PBUF_MEMPOOL(name, num, payload, desc) LWIP_MEMPOOL(name, num, (MEMP_ALIGN_SIZE(sizeof(struct pbuf)) + MEMP_ALIGN_SIZE(payload)), desc) 00024 #endif /* LWIP_PBUF_MEMPOOL */ 00025 00026 00027 /* 00028 * A list of internal pools used by LWIP. 00029 * 00030 * LWIP_MEMPOOL(pool_name, number_elements, element_size, pool_description) 00031 * creates a pool name MEMP_pool_name. description is used in stats.c 00032 */ 00033 #if LWIP_RAW 00034 LWIP_MEMPOOL(RAW_PCB, MEMP_NUM_RAW_PCB, sizeof(struct raw_pcb), "RAW_PCB") 00035 #endif /* LWIP_RAW */ 00036 00037 #if LWIP_UDP 00038 LWIP_MEMPOOL(UDP_PCB, MEMP_NUM_UDP_PCB, sizeof(struct udp_pcb), "UDP_PCB") 00039 #endif /* LWIP_UDP */ 00040 00041 #if LWIP_TCP 00042 LWIP_MEMPOOL(TCP_PCB, MEMP_NUM_TCP_PCB, sizeof(struct tcp_pcb), "TCP_PCB") 00043 LWIP_MEMPOOL(TCP_PCB_LISTEN, MEMP_NUM_TCP_PCB_LISTEN, sizeof(struct tcp_pcb_listen), "TCP_PCB_LISTEN") 00044 LWIP_MEMPOOL(TCP_SEG, MEMP_NUM_TCP_SEG, sizeof(struct tcp_seg), "TCP_SEG") 00045 #endif /* LWIP_TCP */ 00046 00047 #if IP_REASSEMBLY 00048 LWIP_MEMPOOL(REASSDATA, MEMP_NUM_REASSDATA, sizeof(struct ip_reassdata), "REASSDATA") 00049 #endif /* IP_REASSEMBLY */ 00050 #if IP_FRAG && !IP_FRAG_USES_STATIC_BUF && !LWIP_NETIF_TX_SINGLE_PBUF 00051 LWIP_MEMPOOL(FRAG_PBUF, MEMP_NUM_FRAG_PBUF, sizeof(struct pbuf_custom_ref),"FRAG_PBUF") 00052 #endif /* IP_FRAG && !IP_FRAG_USES_STATIC_BUF && !LWIP_NETIF_TX_SINGLE_PBUF */ 00053 00054 #if LWIP_NETCONN 00055 LWIP_MEMPOOL(NETBUF, MEMP_NUM_NETBUF, sizeof(struct netbuf), "NETBUF") 00056 LWIP_MEMPOOL(NETCONN, MEMP_NUM_NETCONN, sizeof(struct netconn), "NETCONN") 00057 #endif /* LWIP_NETCONN */ 00058 00059 #if NO_SYS==0 00060 LWIP_MEMPOOL(TCPIP_MSG_API, MEMP_NUM_TCPIP_MSG_API, sizeof(struct tcpip_msg), "TCPIP_MSG_API") 00061 #if !LWIP_TCPIP_CORE_LOCKING_INPUT 00062 LWIP_MEMPOOL(TCPIP_MSG_INPKT,MEMP_NUM_TCPIP_MSG_INPKT, sizeof(struct tcpip_msg), "TCPIP_MSG_INPKT") 00063 #endif /* !LWIP_TCPIP_CORE_LOCKING_INPUT */ 00064 #endif /* NO_SYS==0 */ 00065 00066 #if ARP_QUEUEING 00067 LWIP_MEMPOOL(ARP_QUEUE, MEMP_NUM_ARP_QUEUE, sizeof(struct etharp_q_entry), "ARP_QUEUE") 00068 #endif /* ARP_QUEUEING */ 00069 00070 #if LWIP_IGMP 00071 LWIP_MEMPOOL(IGMP_GROUP, MEMP_NUM_IGMP_GROUP, sizeof(struct igmp_group), "IGMP_GROUP") 00072 #endif /* LWIP_IGMP */ 00073 00074 #if (!NO_SYS || (NO_SYS && !NO_SYS_NO_TIMERS)) /* LWIP_TIMERS */ 00075 LWIP_MEMPOOL(SYS_TIMEOUT, MEMP_NUM_SYS_TIMEOUT, sizeof(struct sys_timeo), "SYS_TIMEOUT") 00076 #endif /* LWIP_TIMERS */ 00077 00078 #if LWIP_SNMP 00079 LWIP_MEMPOOL(SNMP_ROOTNODE, MEMP_NUM_SNMP_ROOTNODE, sizeof(struct mib_list_rootnode), "SNMP_ROOTNODE") 00080 LWIP_MEMPOOL(SNMP_NODE, MEMP_NUM_SNMP_NODE, sizeof(struct mib_list_node), "SNMP_NODE") 00081 LWIP_MEMPOOL(SNMP_VARBIND, MEMP_NUM_SNMP_VARBIND, sizeof(struct snmp_varbind), "SNMP_VARBIND") 00082 LWIP_MEMPOOL(SNMP_VALUE, MEMP_NUM_SNMP_VALUE, SNMP_MAX_VALUE_SIZE, "SNMP_VALUE") 00083 #endif /* LWIP_SNMP */ 00084 #if LWIP_DNS && LWIP_SOCKET 00085 LWIP_MEMPOOL(NETDB, MEMP_NUM_NETDB, NETDB_ELEM_SIZE, "NETDB") 00086 #endif /* LWIP_DNS && LWIP_SOCKET */ 00087 #if LWIP_DNS && DNS_LOCAL_HOSTLIST && DNS_LOCAL_HOSTLIST_IS_DYNAMIC 00088 LWIP_MEMPOOL(LOCALHOSTLIST, MEMP_NUM_LOCALHOSTLIST, LOCALHOSTLIST_ELEM_SIZE, "LOCALHOSTLIST") 00089 #endif /* LWIP_DNS && DNS_LOCAL_HOSTLIST && DNS_LOCAL_HOSTLIST_IS_DYNAMIC */ 00090 #if PPP_SUPPORT && PPPOE_SUPPORT 00091 LWIP_MEMPOOL(PPPOE_IF, MEMP_NUM_PPPOE_INTERFACES, sizeof(struct pppoe_softc), "PPPOE_IF") 00092 #endif /* PPP_SUPPORT && PPPOE_SUPPORT */ 00093 00094 /* 00095 * A list of pools of pbuf's used by LWIP. 00096 * 00097 * LWIP_PBUF_MEMPOOL(pool_name, number_elements, pbuf_payload_size, pool_description) 00098 * creates a pool name MEMP_pool_name. description is used in stats.c 00099 * This allocates enough space for the pbuf struct and a payload. 00100 * (Example: pbuf_payload_size=0 allocates only size for the struct) 00101 */ 00102 LWIP_PBUF_MEMPOOL(PBUF, MEMP_NUM_PBUF, 0, "PBUF_REF/ROM") 00103 LWIP_PBUF_MEMPOOL(PBUF_POOL, PBUF_POOL_SIZE, PBUF_POOL_BUFSIZE, "PBUF_POOL") 00104 00105 00106 /* 00107 * Allow for user-defined pools; this must be explicitly set in lwipopts.h 00108 * since the default is to NOT look for lwippools.h 00109 */ 00110 #if MEMP_USE_CUSTOM_POOLS 00111 #include "lwippools.h" 00112 #endif /* MEMP_USE_CUSTOM_POOLS */ 00113 00114 /* 00115 * REQUIRED CLEANUP: Clear up so we don't get "multiply defined" error later 00116 * (#undef is ignored for something that is not defined) 00117 */ 00118 #undef LWIP_MEMPOOL 00119 #undef LWIP_MALLOC_MEMPOOL 00120 #undef LWIP_MALLOC_MEMPOOL_START 00121 #undef LWIP_MALLOC_MEMPOOL_END 00122 #undef LWIP_PBUF_MEMPOOL
Generated on Tue Jul 12 2022 13:17:36 by
![doxygen](doxygen.png)