Version of http://mbed.org/cookbook/NetServicesTribute with setting set the same for LPC2368

Dependents:   UDPSocketExample 24LCxx_I2CApp WeatherPlatform_pachube HvZServerLib ... more

Committer:
simon
Date:
Tue Nov 23 14:15:36 2010 +0000
Revision:
0:350011bf8be7
Experimental version for testing UDP

Who changed what in which revision?

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