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 #define LWIP_MALLOC_MEMPOOL(num, size) LWIP_MEMPOOL(POOL_##size, num, size, "MALLOC_"#size)
00015 #define LWIP_MALLOC_MEMPOOL_START
00016 #define LWIP_MALLOC_MEMPOOL_END
00017 #endif /* LWIP_MALLOC_MEMPOOL */ 
00018 
00019 #ifndef LWIP_PBUF_MEMPOOL
00020 /* This treats "pbuf pools" just like any other pool.
00021  * Allocates buffers for a pbuf struct AND a payload size */
00022 #define LWIP_PBUF_MEMPOOL(name, num, payload, desc) LWIP_MEMPOOL(name, num, (MEMP_ALIGN_SIZE(sizeof(struct pbuf)) + MEMP_ALIGN_SIZE(payload)), desc)
00023 #endif /* LWIP_PBUF_MEMPOOL */
00024 
00025 
00026 /*
00027  * A list of internal pools used by LWIP.
00028  *
00029  * LWIP_MEMPOOL(pool_name, number_elements, element_size, pool_description)
00030  *     creates a pool name MEMP_pool_name. description is used in stats.c
00031  */
00032 #if LWIP_RAW
00033 LWIP_MEMPOOL(RAW_PCB,        MEMP_NUM_RAW_PCB,         sizeof(struct raw_pcb),        "RAW_PCB")
00034 #endif /* LWIP_RAW */
00035 
00036 #if LWIP_UDP
00037 LWIP_MEMPOOL(UDP_PCB,        MEMP_NUM_UDP_PCB,         sizeof(struct udp_pcb),        "UDP_PCB")
00038 #endif /* LWIP_UDP */
00039 
00040 #if LWIP_TCP
00041 LWIP_MEMPOOL(TCP_PCB,        MEMP_NUM_TCP_PCB,         sizeof(struct tcp_pcb),        "TCP_PCB")
00042 LWIP_MEMPOOL(TCP_PCB_LISTEN, MEMP_NUM_TCP_PCB_LISTEN,  sizeof(struct tcp_pcb_listen), "TCP_PCB_LISTEN")
00043 LWIP_MEMPOOL(TCP_SEG,        MEMP_NUM_TCP_SEG,         sizeof(struct tcp_seg),        "TCP_SEG")
00044 #endif /* LWIP_TCP */
00045 
00046 #if IP_REASSEMBLY
00047 LWIP_MEMPOOL(REASSDATA,      MEMP_NUM_REASSDATA,       sizeof(struct ip_reassdata),   "REASSDATA")
00048 #endif /* IP_REASSEMBLY */
00049 
00050 #if LWIP_NETCONN
00051 LWIP_MEMPOOL(NETBUF,         MEMP_NUM_NETBUF,          sizeof(struct netbuf),         "NETBUF")
00052 LWIP_MEMPOOL(NETCONN,        MEMP_NUM_NETCONN,         sizeof(struct netconn),        "NETCONN")
00053 #endif /* LWIP_NETCONN */
00054 
00055 #if NO_SYS==0
00056 LWIP_MEMPOOL(TCPIP_MSG_API,  MEMP_NUM_TCPIP_MSG_API,   sizeof(struct tcpip_msg),      "TCPIP_MSG_API")
00057 LWIP_MEMPOOL(TCPIP_MSG_INPKT,MEMP_NUM_TCPIP_MSG_INPKT, sizeof(struct tcpip_msg),      "TCPIP_MSG_INPKT")
00058 #endif /* NO_SYS==0 */
00059 
00060 #if ARP_QUEUEING
00061 LWIP_MEMPOOL(ARP_QUEUE,      MEMP_NUM_ARP_QUEUE,       sizeof(struct etharp_q_entry), "ARP_QUEUE")
00062 #endif /* ARP_QUEUEING */
00063 
00064 #if LWIP_IGMP
00065 LWIP_MEMPOOL(IGMP_GROUP,     MEMP_NUM_IGMP_GROUP,      sizeof(struct igmp_group),     "IGMP_GROUP")
00066 #endif /* LWIP_IGMP */
00067 
00068 #if NO_SYS==0
00069 LWIP_MEMPOOL(SYS_TIMEOUT,    MEMP_NUM_SYS_TIMEOUT,     sizeof(struct sys_timeo),      "SYS_TIMEOUT")
00070 #endif /* NO_SYS==0 */
00071 
00072 
00073 /*
00074  * A list of pools of pbuf's used by LWIP.
00075  *
00076  * LWIP_PBUF_MEMPOOL(pool_name, number_elements, pbuf_payload_size, pool_description)
00077  *     creates a pool name MEMP_pool_name. description is used in stats.c
00078  *     This allocates enough space for the pbuf struct and a payload.
00079  *     (Example: pbuf_payload_size=0 allocates only size for the struct)
00080  */
00081 LWIP_PBUF_MEMPOOL(PBUF,      MEMP_NUM_PBUF,            0,                             "PBUF_REF/ROM")
00082 LWIP_PBUF_MEMPOOL(PBUF_POOL, PBUF_POOL_SIZE,           PBUF_POOL_BUFSIZE,             "PBUF_POOL")
00083 
00084 
00085 /*
00086  * Allow for user-defined pools; this must be explicitly set in lwipopts.h
00087  * since the default is to NOT look for lwippools.h
00088  */
00089 #if MEMP_USE_CUSTOM_POOLS
00090 #include "lwippools.h"
00091 #endif /* MEMP_USE_CUSTOM_POOLS */
00092 
00093 /*
00094  * REQUIRED CLEANUP: Clear up so we don't get "multiply defined" error later
00095  * (#undef is ignored for something that is not defined)
00096  */
00097 #undef LWIP_MEMPOOL
00098 #undef LWIP_MALLOC_MEMPOOL
00099 #undef LWIP_MALLOC_MEMPOOL_START
00100 #undef LWIP_MALLOC_MEMPOOL_END
00101 #undef LWIP_PBUF_MEMPOOL