A version of LWIP, provided for backwards compatibility.

Dependents:   AA_DemoBoard DemoBoard HelloServerDemo DemoBoard_RangeIndicator ... more

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers memp_std.h Source File

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 
00051 #if LWIP_NETCONN
00052 LWIP_MEMPOOL(NETBUF,         MEMP_NUM_NETBUF,          sizeof(struct netbuf),         "NETBUF")
00053 LWIP_MEMPOOL(NETCONN,        MEMP_NUM_NETCONN,         sizeof(struct netconn),        "NETCONN")
00054 #endif /* LWIP_NETCONN */
00055 
00056 #if NO_SYS==0
00057 LWIP_MEMPOOL(TCPIP_MSG_API,  MEMP_NUM_TCPIP_MSG_API,   sizeof(struct tcpip_msg),      "TCPIP_MSG_API")
00058 LWIP_MEMPOOL(TCPIP_MSG_INPKT,MEMP_NUM_TCPIP_MSG_INPKT, sizeof(struct tcpip_msg),      "TCPIP_MSG_INPKT")
00059 #endif /* NO_SYS==0 */
00060 
00061 #if ARP_QUEUEING
00062 LWIP_MEMPOOL(ARP_QUEUE,      MEMP_NUM_ARP_QUEUE,       sizeof(struct etharp_q_entry), "ARP_QUEUE")
00063 #endif /* ARP_QUEUEING */
00064 
00065 #if LWIP_IGMP
00066 LWIP_MEMPOOL(IGMP_GROUP,     MEMP_NUM_IGMP_GROUP,      sizeof(struct igmp_group),     "IGMP_GROUP")
00067 #endif /* LWIP_IGMP */
00068 
00069 #if NO_SYS==0
00070 LWIP_MEMPOOL(SYS_TIMEOUT,    MEMP_NUM_SYS_TIMEOUT,     sizeof(struct sys_timeo),      "SYS_TIMEOUT")
00071 #endif /* NO_SYS==0 */
00072 
00073 
00074 /*
00075  * A list of pools of pbuf's used by LWIP.
00076  *
00077  * LWIP_PBUF_MEMPOOL(pool_name, number_elements, pbuf_payload_size, pool_description)
00078  *     creates a pool name MEMP_pool_name. description is used in stats.c
00079  *     This allocates enough space for the pbuf struct and a payload.
00080  *     (Example: pbuf_payload_size=0 allocates only size for the struct)
00081  */
00082 LWIP_PBUF_MEMPOOL(PBUF,      MEMP_NUM_PBUF,            0,                             "PBUF_REF/ROM")
00083 LWIP_PBUF_MEMPOOL(PBUF_POOL, PBUF_POOL_SIZE,           PBUF_POOL_BUFSIZE,             "PBUF_POOL")
00084 
00085 
00086 /*
00087  * Allow for user-defined pools; this must be explicitly set in lwipopts.h
00088  * since the default is to NOT look for lwippools.h
00089  */
00090 #if MEMP_USE_CUSTOM_POOLS
00091 #include "lwippools.h"
00092 #endif /* MEMP_USE_CUSTOM_POOLS */
00093 
00094 /*
00095  * REQUIRED CLEANUP: Clear up so we don't get "multiply defined" error later
00096  * (#undef is ignored for something that is not defined)
00097  */
00098 #undef LWIP_MEMPOOL
00099 #undef LWIP_MALLOC_MEMPOOL
00100 #undef LWIP_MALLOC_MEMPOOL_START
00101 #undef LWIP_MALLOC_MEMPOOL_END
00102 #undef LWIP_PBUF_MEMPOOL