SNMP agent attached to SPI slave

Dependencies:   mbed

Committer:
lorcansmith
Date:
Mon Aug 13 15:07:40 2012 +0000
Revision:
0:2a53a4c3238c
v1.1 release includes ioAlarm traps

Who changed what in which revision?

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