Sam Walsh / F7_Ethernet

Dependents:   Nucleo_F746ZG_Ethernet_MQTT_Ultrasound

Fork of F7_Ethernet by Dieter Graef

Committer:
EmbeddedSam
Date:
Mon Oct 24 12:59:21 2016 +0000
Revision:
2:b4727195c450
Parent:
0:d26c1b55cfca
working with 1 ultrasound sensor approx 10hz update rate on mqtt

Who changed what in which revision?

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