A version of LWIP, provided for backwards compatibility.
Dependents: AA_DemoBoard DemoBoard HelloServerDemo DemoBoard_RangeIndicator ... more
trunk/Core/lwIP/include/lwip/memp_std.h@0:5e1631496985, 2012-05-08 (annotated)
- Committer:
- root@mbed.org
- Date:
- Tue May 08 15:32:10 2012 +0100
- Revision:
- 0:5e1631496985
initial commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
root@mbed.org | 0:5e1631496985 | 1 | /* |
root@mbed.org | 0:5e1631496985 | 2 | * SETUP: Make sure we define everything we will need. |
root@mbed.org | 0:5e1631496985 | 3 | * |
root@mbed.org | 0:5e1631496985 | 4 | * We have create three types of pools: |
root@mbed.org | 0:5e1631496985 | 5 | * 1) MEMPOOL - standard pools |
root@mbed.org | 0:5e1631496985 | 6 | * 2) MALLOC_MEMPOOL - to be used by mem_malloc in mem.c |
root@mbed.org | 0:5e1631496985 | 7 | * 3) PBUF_MEMPOOL - a mempool of pbuf's, so include space for the pbuf struct |
root@mbed.org | 0:5e1631496985 | 8 | * |
root@mbed.org | 0:5e1631496985 | 9 | * If the include'r doesn't require any special treatment of each of the types |
root@mbed.org | 0:5e1631496985 | 10 | * above, then will declare #2 & #3 to be just standard mempools. |
root@mbed.org | 0:5e1631496985 | 11 | */ |
root@mbed.org | 0:5e1631496985 | 12 | #ifndef LWIP_MALLOC_MEMPOOL |
root@mbed.org | 0:5e1631496985 | 13 | /* This treats "malloc pools" just like any other pool. |
root@mbed.org | 0:5e1631496985 | 14 | The pools are a little bigger to provide 'size' as the amount of user data. */ |
root@mbed.org | 0:5e1631496985 | 15 | #define LWIP_MALLOC_MEMPOOL(num, size) LWIP_MEMPOOL(POOL_##size, num, (size + sizeof(struct memp_malloc_helper)), "MALLOC_"#size) |
root@mbed.org | 0:5e1631496985 | 16 | #define LWIP_MALLOC_MEMPOOL_START |
root@mbed.org | 0:5e1631496985 | 17 | #define LWIP_MALLOC_MEMPOOL_END |
root@mbed.org | 0:5e1631496985 | 18 | #endif /* LWIP_MALLOC_MEMPOOL */ |
root@mbed.org | 0:5e1631496985 | 19 | |
root@mbed.org | 0:5e1631496985 | 20 | #ifndef LWIP_PBUF_MEMPOOL |
root@mbed.org | 0:5e1631496985 | 21 | /* This treats "pbuf pools" just like any other pool. |
root@mbed.org | 0:5e1631496985 | 22 | * Allocates buffers for a pbuf struct AND a payload size */ |
root@mbed.org | 0:5e1631496985 | 23 | #define LWIP_PBUF_MEMPOOL(name, num, payload, desc) LWIP_MEMPOOL(name, num, (MEMP_ALIGN_SIZE(sizeof(struct pbuf)) + MEMP_ALIGN_SIZE(payload)), desc) |
root@mbed.org | 0:5e1631496985 | 24 | #endif /* LWIP_PBUF_MEMPOOL */ |
root@mbed.org | 0:5e1631496985 | 25 | |
root@mbed.org | 0:5e1631496985 | 26 | |
root@mbed.org | 0:5e1631496985 | 27 | /* |
root@mbed.org | 0:5e1631496985 | 28 | * A list of internal pools used by LWIP. |
root@mbed.org | 0:5e1631496985 | 29 | * |
root@mbed.org | 0:5e1631496985 | 30 | * LWIP_MEMPOOL(pool_name, number_elements, element_size, pool_description) |
root@mbed.org | 0:5e1631496985 | 31 | * creates a pool name MEMP_pool_name. description is used in stats.c |
root@mbed.org | 0:5e1631496985 | 32 | */ |
root@mbed.org | 0:5e1631496985 | 33 | #if LWIP_RAW |
root@mbed.org | 0:5e1631496985 | 34 | LWIP_MEMPOOL(RAW_PCB, MEMP_NUM_RAW_PCB, sizeof(struct raw_pcb), "RAW_PCB") |
root@mbed.org | 0:5e1631496985 | 35 | #endif /* LWIP_RAW */ |
root@mbed.org | 0:5e1631496985 | 36 | |
root@mbed.org | 0:5e1631496985 | 37 | #if LWIP_UDP |
root@mbed.org | 0:5e1631496985 | 38 | LWIP_MEMPOOL(UDP_PCB, MEMP_NUM_UDP_PCB, sizeof(struct udp_pcb), "UDP_PCB") |
root@mbed.org | 0:5e1631496985 | 39 | #endif /* LWIP_UDP */ |
root@mbed.org | 0:5e1631496985 | 40 | |
root@mbed.org | 0:5e1631496985 | 41 | #if LWIP_TCP |
root@mbed.org | 0:5e1631496985 | 42 | LWIP_MEMPOOL(TCP_PCB, MEMP_NUM_TCP_PCB, sizeof(struct tcp_pcb), "TCP_PCB") |
root@mbed.org | 0:5e1631496985 | 43 | LWIP_MEMPOOL(TCP_PCB_LISTEN, MEMP_NUM_TCP_PCB_LISTEN, sizeof(struct tcp_pcb_listen), "TCP_PCB_LISTEN") |
root@mbed.org | 0:5e1631496985 | 44 | LWIP_MEMPOOL(TCP_SEG, MEMP_NUM_TCP_SEG, sizeof(struct tcp_seg), "TCP_SEG") |
root@mbed.org | 0:5e1631496985 | 45 | #endif /* LWIP_TCP */ |
root@mbed.org | 0:5e1631496985 | 46 | |
root@mbed.org | 0:5e1631496985 | 47 | #if IP_REASSEMBLY |
root@mbed.org | 0:5e1631496985 | 48 | LWIP_MEMPOOL(REASSDATA, MEMP_NUM_REASSDATA, sizeof(struct ip_reassdata), "REASSDATA") |
root@mbed.org | 0:5e1631496985 | 49 | #endif /* IP_REASSEMBLY */ |
root@mbed.org | 0:5e1631496985 | 50 | |
root@mbed.org | 0:5e1631496985 | 51 | #if LWIP_NETCONN |
root@mbed.org | 0:5e1631496985 | 52 | LWIP_MEMPOOL(NETBUF, MEMP_NUM_NETBUF, sizeof(struct netbuf), "NETBUF") |
root@mbed.org | 0:5e1631496985 | 53 | LWIP_MEMPOOL(NETCONN, MEMP_NUM_NETCONN, sizeof(struct netconn), "NETCONN") |
root@mbed.org | 0:5e1631496985 | 54 | #endif /* LWIP_NETCONN */ |
root@mbed.org | 0:5e1631496985 | 55 | |
root@mbed.org | 0:5e1631496985 | 56 | #if NO_SYS==0 |
root@mbed.org | 0:5e1631496985 | 57 | LWIP_MEMPOOL(TCPIP_MSG_API, MEMP_NUM_TCPIP_MSG_API, sizeof(struct tcpip_msg), "TCPIP_MSG_API") |
root@mbed.org | 0:5e1631496985 | 58 | LWIP_MEMPOOL(TCPIP_MSG_INPKT,MEMP_NUM_TCPIP_MSG_INPKT, sizeof(struct tcpip_msg), "TCPIP_MSG_INPKT") |
root@mbed.org | 0:5e1631496985 | 59 | #endif /* NO_SYS==0 */ |
root@mbed.org | 0:5e1631496985 | 60 | |
root@mbed.org | 0:5e1631496985 | 61 | #if ARP_QUEUEING |
root@mbed.org | 0:5e1631496985 | 62 | LWIP_MEMPOOL(ARP_QUEUE, MEMP_NUM_ARP_QUEUE, sizeof(struct etharp_q_entry), "ARP_QUEUE") |
root@mbed.org | 0:5e1631496985 | 63 | #endif /* ARP_QUEUEING */ |
root@mbed.org | 0:5e1631496985 | 64 | |
root@mbed.org | 0:5e1631496985 | 65 | #if LWIP_IGMP |
root@mbed.org | 0:5e1631496985 | 66 | LWIP_MEMPOOL(IGMP_GROUP, MEMP_NUM_IGMP_GROUP, sizeof(struct igmp_group), "IGMP_GROUP") |
root@mbed.org | 0:5e1631496985 | 67 | #endif /* LWIP_IGMP */ |
root@mbed.org | 0:5e1631496985 | 68 | |
root@mbed.org | 0:5e1631496985 | 69 | #if NO_SYS==0 |
root@mbed.org | 0:5e1631496985 | 70 | LWIP_MEMPOOL(SYS_TIMEOUT, MEMP_NUM_SYS_TIMEOUT, sizeof(struct sys_timeo), "SYS_TIMEOUT") |
root@mbed.org | 0:5e1631496985 | 71 | #endif /* NO_SYS==0 */ |
root@mbed.org | 0:5e1631496985 | 72 | |
root@mbed.org | 0:5e1631496985 | 73 | |
root@mbed.org | 0:5e1631496985 | 74 | /* |
root@mbed.org | 0:5e1631496985 | 75 | * A list of pools of pbuf's used by LWIP. |
root@mbed.org | 0:5e1631496985 | 76 | * |
root@mbed.org | 0:5e1631496985 | 77 | * LWIP_PBUF_MEMPOOL(pool_name, number_elements, pbuf_payload_size, pool_description) |
root@mbed.org | 0:5e1631496985 | 78 | * creates a pool name MEMP_pool_name. description is used in stats.c |
root@mbed.org | 0:5e1631496985 | 79 | * This allocates enough space for the pbuf struct and a payload. |
root@mbed.org | 0:5e1631496985 | 80 | * (Example: pbuf_payload_size=0 allocates only size for the struct) |
root@mbed.org | 0:5e1631496985 | 81 | */ |
root@mbed.org | 0:5e1631496985 | 82 | LWIP_PBUF_MEMPOOL(PBUF, MEMP_NUM_PBUF, 0, "PBUF_REF/ROM") |
root@mbed.org | 0:5e1631496985 | 83 | LWIP_PBUF_MEMPOOL(PBUF_POOL, PBUF_POOL_SIZE, PBUF_POOL_BUFSIZE, "PBUF_POOL") |
root@mbed.org | 0:5e1631496985 | 84 | |
root@mbed.org | 0:5e1631496985 | 85 | |
root@mbed.org | 0:5e1631496985 | 86 | /* |
root@mbed.org | 0:5e1631496985 | 87 | * Allow for user-defined pools; this must be explicitly set in lwipopts.h |
root@mbed.org | 0:5e1631496985 | 88 | * since the default is to NOT look for lwippools.h |
root@mbed.org | 0:5e1631496985 | 89 | */ |
root@mbed.org | 0:5e1631496985 | 90 | #if MEMP_USE_CUSTOM_POOLS |
root@mbed.org | 0:5e1631496985 | 91 | #include "lwippools.h" |
root@mbed.org | 0:5e1631496985 | 92 | #endif /* MEMP_USE_CUSTOM_POOLS */ |
root@mbed.org | 0:5e1631496985 | 93 | |
root@mbed.org | 0:5e1631496985 | 94 | /* |
root@mbed.org | 0:5e1631496985 | 95 | * REQUIRED CLEANUP: Clear up so we don't get "multiply defined" error later |
root@mbed.org | 0:5e1631496985 | 96 | * (#undef is ignored for something that is not defined) |
root@mbed.org | 0:5e1631496985 | 97 | */ |
root@mbed.org | 0:5e1631496985 | 98 | #undef LWIP_MEMPOOL |
root@mbed.org | 0:5e1631496985 | 99 | #undef LWIP_MALLOC_MEMPOOL |
root@mbed.org | 0:5e1631496985 | 100 | #undef LWIP_MALLOC_MEMPOOL_START |
root@mbed.org | 0:5e1631496985 | 101 | #undef LWIP_MALLOC_MEMPOOL_END |
root@mbed.org | 0:5e1631496985 | 102 | #undef LWIP_PBUF_MEMPOOL |