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