Embedded WebSockets Experiment

Dependencies:   mbed MD5

Committer:
nandgate
Date:
Tue Jul 26 05:30:53 2011 +0000
Revision:
0:6dee052a3fa4

        

Who changed what in which revision?

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