ProjetoBB

Dependencies:   F7_Ethernet WebSocketClient mbed mcp3008

Fork of Nucleo_F746ZG_Ethernet by Dieter Graef

Committer:
DieterGraef
Date:
Sat Jun 18 10:49:12 2016 +0000
Revision:
0:f9b6112278fe
Ethernet for the NUCLEO STM32F746 Board Testprogram uses DHCP and NTP to set the clock

Who changed what in which revision?

UserRevisionLine numberNew contents of line
DieterGraef 0:f9b6112278fe 1 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
DieterGraef 0:f9b6112278fe 2 // Copyright (c) Microsoft Corporation. All rights reserved.
DieterGraef 0:f9b6112278fe 3 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
DieterGraef 0:f9b6112278fe 4
DieterGraef 0:f9b6112278fe 5 #ifndef _DRIVERS_NETWORK_DEFINES_LWIP_H_
DieterGraef 0:f9b6112278fe 6 #define _DRIVERS_NETWORK_DEFINES_LWIP_H_ 1
DieterGraef 0:f9b6112278fe 7
DieterGraef 0:f9b6112278fe 8 /* Pick min, default or max configuration based on platform */
DieterGraef 0:f9b6112278fe 9 #include <lwip_selector.h>
DieterGraef 0:f9b6112278fe 10
DieterGraef 0:f9b6112278fe 11 #if !defined(NETWORK_MEMORY_PROFILE_LWIP__small) && !defined(NETWORK_MEMORY_PROFILE_LWIP__medium) && !defined(NETWORK_MEMORY_PROFILE_LWIP__large) && !defined(NETWORK_MEMORY_PROFILE_LWIP__custom)
DieterGraef 0:f9b6112278fe 12 #error You must define a NETWORK_MEMORY_PROFILE_LWIP_xxx for this platform
DieterGraef 0:f9b6112278fe 13 #endif
DieterGraef 0:f9b6112278fe 14
DieterGraef 0:f9b6112278fe 15 #define TCPIP_LWIP 1
DieterGraef 0:f9b6112278fe 16
DieterGraef 0:f9b6112278fe 17 /* min, default, max configuration for lwIP. Values have initially
DieterGraef 0:f9b6112278fe 18 been taken from lwiopts.small.h, lwipopts.h and lwipopts.big.h */
DieterGraef 0:f9b6112278fe 19
DieterGraef 0:f9b6112278fe 20 /* MEM_SIZE: the size of the heap memory. If the application will send
DieterGraef 0:f9b6112278fe 21 a lot of data that needs to be copied, this should be set high. */
DieterGraef 0:f9b6112278fe 22 #define MEM_SIZE__min (16*1024)
DieterGraef 0:f9b6112278fe 23 #define MEM_SIZE__default (64*1024)
DieterGraef 0:f9b6112278fe 24 #define MEM_SIZE__max (1024*1024) // TODO - this seems a bit extreme
DieterGraef 0:f9b6112278fe 25
DieterGraef 0:f9b6112278fe 26 /* MEMP_NUM_PBUF: the number of memp struct pbufs. If the application
DieterGraef 0:f9b6112278fe 27 sends a lot of data out of ROM (or other static memory), this
DieterGraef 0:f9b6112278fe 28 should be set high. */
DieterGraef 0:f9b6112278fe 29 #define MEMP_NUM_PBUF__min 16
DieterGraef 0:f9b6112278fe 30 #define MEMP_NUM_PBUF__default 32
DieterGraef 0:f9b6112278fe 31 #define MEMP_NUM_PBUF__max 32
DieterGraef 0:f9b6112278fe 32
DieterGraef 0:f9b6112278fe 33 /* MEMP_NUM_UDP_PCB: the number of UDP protocol control blocks. One
DieterGraef 0:f9b6112278fe 34 per active UDP "connection". */
DieterGraef 0:f9b6112278fe 35 #define MEMP_NUM_UDP_PCB__min 6
DieterGraef 0:f9b6112278fe 36 #define MEMP_NUM_UDP_PCB__default 8
DieterGraef 0:f9b6112278fe 37 #define MEMP_NUM_UDP_PCB__max 16
DieterGraef 0:f9b6112278fe 38
DieterGraef 0:f9b6112278fe 39 /* MEMP_NUM_TCP_PCB: the number of simulatenously active TCP
DieterGraef 0:f9b6112278fe 40 connections. */
DieterGraef 0:f9b6112278fe 41 #define MEMP_NUM_TCP_PCB__min 8
DieterGraef 0:f9b6112278fe 42 #define MEMP_NUM_TCP_PCB__default 16
DieterGraef 0:f9b6112278fe 43 #define MEMP_NUM_TCP_PCB__max 32
DieterGraef 0:f9b6112278fe 44
DieterGraef 0:f9b6112278fe 45 /* MEMP_NUM_TCP_PCB_LISTEN: the number of listening TCP
DieterGraef 0:f9b6112278fe 46 connections. */
DieterGraef 0:f9b6112278fe 47 #define MEMP_NUM_TCP_PCB_LISTEN__min 4
DieterGraef 0:f9b6112278fe 48 #define MEMP_NUM_TCP_PCB_LISTEN__default 8
DieterGraef 0:f9b6112278fe 49 #define MEMP_NUM_TCP_PCB_LISTEN__max 12
DieterGraef 0:f9b6112278fe 50
DieterGraef 0:f9b6112278fe 51 /* MEMP_NUM_TCP_SEG: the number of simultaneously queued TCP
DieterGraef 0:f9b6112278fe 52 segments. */
DieterGraef 0:f9b6112278fe 53 #define MEMP_NUM_TCP_SEG__min 32
DieterGraef 0:f9b6112278fe 54 #define MEMP_NUM_TCP_SEG__default 64
DieterGraef 0:f9b6112278fe 55 #define MEMP_NUM_TCP_SEG__max 128
DieterGraef 0:f9b6112278fe 56
DieterGraef 0:f9b6112278fe 57 /* MEMP_NUM_SYS_TIMEOUT: the number of simulateously active
DieterGraef 0:f9b6112278fe 58 timeouts. */
DieterGraef 0:f9b6112278fe 59 #define MEMP_NUM_SYS_TIMEOUT__min 8 // set to 3 in lwiopts.small.h but didn't compile
DieterGraef 0:f9b6112278fe 60 #define MEMP_NUM_SYS_TIMEOUT__default 12
DieterGraef 0:f9b6112278fe 61 #define MEMP_NUM_SYS_TIMEOUT__max 16
DieterGraef 0:f9b6112278fe 62
DieterGraef 0:f9b6112278fe 63 /* MEMP_NUM_NETBUF: the number of struct netbufs. */
DieterGraef 0:f9b6112278fe 64 #define MEMP_NUM_NETBUF__min 8
DieterGraef 0:f9b6112278fe 65 #define MEMP_NUM_NETBUF__default 16
DieterGraef 0:f9b6112278fe 66 #define MEMP_NUM_NETBUF__max 32
DieterGraef 0:f9b6112278fe 67
DieterGraef 0:f9b6112278fe 68 /* MEMP_NUM_NETCONN: the number of struct netconns. */
DieterGraef 0:f9b6112278fe 69 #define MEMP_NUM_NETCONN__min 10
DieterGraef 0:f9b6112278fe 70 #define MEMP_NUM_NETCONN__default 20
DieterGraef 0:f9b6112278fe 71 #define MEMP_NUM_NETCONN__max 40
DieterGraef 0:f9b6112278fe 72
DieterGraef 0:f9b6112278fe 73 /* PBUF_POOL_SIZE: the number of buffers in the pbuf pool. */
DieterGraef 0:f9b6112278fe 74 #define PBUF_POOL_SIZE__min 40
DieterGraef 0:f9b6112278fe 75 #define PBUF_POOL_SIZE__default 128
DieterGraef 0:f9b6112278fe 76 #define PBUF_POOL_SIZE__max 256
DieterGraef 0:f9b6112278fe 77
DieterGraef 0:f9b6112278fe 78 /* PBUF_POOL_BUFSIZE: the size of each pbuf in the pbuf pool. */
DieterGraef 0:f9b6112278fe 79 #define PBUF_POOL_BUFSIZE__min 512
DieterGraef 0:f9b6112278fe 80 #define PBUF_POOL_BUFSIZE__default 1024
DieterGraef 0:f9b6112278fe 81 #define PBUF_POOL_BUFSIZE__max 2048
DieterGraef 0:f9b6112278fe 82
DieterGraef 0:f9b6112278fe 83 /* TCP Maximum segment size. */
DieterGraef 0:f9b6112278fe 84 #define TCP_MSS__min 536
DieterGraef 0:f9b6112278fe 85 #define TCP_MSS__default 1460
DieterGraef 0:f9b6112278fe 86 #define TCP_MSS__max 1460
DieterGraef 0:f9b6112278fe 87
DieterGraef 0:f9b6112278fe 88 /* TCP sender buffer space (bytes). */
DieterGraef 0:f9b6112278fe 89 #define TCP_SND_BUF__min (2*TCP_MSS)
DieterGraef 0:f9b6112278fe 90 #define TCP_SND_BUF__default (4*TCP_MSS)
DieterGraef 0:f9b6112278fe 91 #define TCP_SND_BUF__max (8*TCP_MSS)
DieterGraef 0:f9b6112278fe 92
DieterGraef 0:f9b6112278fe 93 /* TCP sender buffer space (pbufs). This must be at least = 2 *
DieterGraef 0:f9b6112278fe 94 TCP_SND_BUF/TCP_MSS for things to work. */
DieterGraef 0:f9b6112278fe 95 #define TCP_SND_QUEUELEN__min ((2*TCP_SND_BUF)/TCP_MSS)
DieterGraef 0:f9b6112278fe 96 #define TCP_SND_QUEUELEN__default ((4*TCP_SND_BUF)/TCP_MSS)
DieterGraef 0:f9b6112278fe 97 #define TCP_SND_QUEUELEN__max ((8*TCP_SND_BUF)/TCP_MSS)
DieterGraef 0:f9b6112278fe 98
DieterGraef 0:f9b6112278fe 99 /* TCP receive window. */
DieterGraef 0:f9b6112278fe 100 #define TCP_WND__min (2*1024)
DieterGraef 0:f9b6112278fe 101 #define TCP_WND__default (8*1024)
DieterGraef 0:f9b6112278fe 102 #define TCP_WND__max (32*1024)
DieterGraef 0:f9b6112278fe 103
DieterGraef 0:f9b6112278fe 104 /* TCP writable space (bytes). This must be less than or equal
DieterGraef 0:f9b6112278fe 105 to TCP_SND_BUF. It is the amount of space which must be
DieterGraef 0:f9b6112278fe 106 available in the tcp snd_buf for select to return writable */
DieterGraef 0:f9b6112278fe 107 #define TCP_SNDLOWAT__min (TCP_SND_BUF/2)
DieterGraef 0:f9b6112278fe 108 #define TCP_SNDLOWAT__default (TCP_SND_BUF/2)
DieterGraef 0:f9b6112278fe 109 #define TCP_SNDLOWAT__max (TCP_SND_BUF/32)
DieterGraef 0:f9b6112278fe 110
DieterGraef 0:f9b6112278fe 111
DieterGraef 0:f9b6112278fe 112 //--// RAM Profiles
DieterGraef 0:f9b6112278fe 113
DieterGraef 0:f9b6112278fe 114 #ifdef NETWORK_MEMORY_PROFILE_LWIP__small
DieterGraef 0:f9b6112278fe 115 #define PLATFORM_DEPENDENT__MEM_SIZE MEM_SIZE__min
DieterGraef 0:f9b6112278fe 116 #define PLATFORM_DEPENDENT__MEMP_NUM_PBUF MEMP_NUM_PBUF__min
DieterGraef 0:f9b6112278fe 117 #define PLATFORM_DEPENDENT__MEMP_NUM_UDP_PCB MEMP_NUM_UDP_PCB__min
DieterGraef 0:f9b6112278fe 118 #define PLATFORM_DEPENDENT__MEMP_NUM_TCP_PCB MEMP_NUM_TCP_PCB__min
DieterGraef 0:f9b6112278fe 119 #define PLATFORM_DEPENDENT__MEMP_NUM_TCP_PCB_LISTEN MEMP_NUM_TCP_PCB_LISTEN__min
DieterGraef 0:f9b6112278fe 120 #define PLATFORM_DEPENDENT__MEMP_NUM_TCP_SEG MEMP_NUM_TCP_SEG__min
DieterGraef 0:f9b6112278fe 121 #define PLATFORM_DEPENDENT__MEMP_NUM_SYS_TIMEOUT MEMP_NUM_SYS_TIMEOUT__min
DieterGraef 0:f9b6112278fe 122 #define PLATFORM_DEPENDENT__MEMP_NUM_NETBUF MEMP_NUM_NETBUF__min
DieterGraef 0:f9b6112278fe 123 #define PLATFORM_DEPENDENT__MEMP_NUM_NETCONN MEMP_NUM_NETCONN__min
DieterGraef 0:f9b6112278fe 124 #define PLATFORM_DEPENDENT__PBUF_POOL_SIZE PBUF_POOL_SIZE__min
DieterGraef 0:f9b6112278fe 125 #define PLATFORM_DEPENDENT__PBUF_POOL_BUFSIZE PBUF_POOL_BUFSIZE__min
DieterGraef 0:f9b6112278fe 126 #define PLATFORM_DEPENDENT__TCP_MSS TCP_MSS__min
DieterGraef 0:f9b6112278fe 127 #define PLATFORM_DEPENDENT__TCP_SND_BUF TCP_SND_BUF__min
DieterGraef 0:f9b6112278fe 128 #define PLATFORM_DEPENDENT__TCP_SND_QUEUELEN TCP_SND_QUEUELEN__min
DieterGraef 0:f9b6112278fe 129 #define PLATFORM_DEPENDENT__TCP_WND TCP_WND__min
DieterGraef 0:f9b6112278fe 130 #define PLATFORM_DEPENDENT__TCP_SNDLOWAT TCP_SNDLOWAT__min
DieterGraef 0:f9b6112278fe 131 #endif
DieterGraef 0:f9b6112278fe 132
DieterGraef 0:f9b6112278fe 133 #ifdef NETWORK_MEMORY_PROFILE_LWIP__medium
DieterGraef 0:f9b6112278fe 134 #define PLATFORM_DEPENDENT__MEM_SIZE MEM_SIZE__default
DieterGraef 0:f9b6112278fe 135 #define PLATFORM_DEPENDENT__MEMP_NUM_PBUF MEMP_NUM_PBUF__default
DieterGraef 0:f9b6112278fe 136 #define PLATFORM_DEPENDENT__MEMP_NUM_UDP_PCB MEMP_NUM_UDP_PCB__default
DieterGraef 0:f9b6112278fe 137 #define PLATFORM_DEPENDENT__MEMP_NUM_TCP_PCB MEMP_NUM_TCP_PCB__default
DieterGraef 0:f9b6112278fe 138 #define PLATFORM_DEPENDENT__MEMP_NUM_TCP_PCB_LISTEN MEMP_NUM_TCP_PCB_LISTEN__default
DieterGraef 0:f9b6112278fe 139 #define PLATFORM_DEPENDENT__MEMP_NUM_TCP_SEG MEMP_NUM_TCP_SEG__default
DieterGraef 0:f9b6112278fe 140 #define PLATFORM_DEPENDENT__MEMP_NUM_SYS_TIMEOUT MEMP_NUM_SYS_TIMEOUT__default
DieterGraef 0:f9b6112278fe 141 #define PLATFORM_DEPENDENT__MEMP_NUM_NETBUF MEMP_NUM_NETBUF__default
DieterGraef 0:f9b6112278fe 142 #define PLATFORM_DEPENDENT__MEMP_NUM_NETCONN MEMP_NUM_NETCONN__default
DieterGraef 0:f9b6112278fe 143 #define PLATFORM_DEPENDENT__PBUF_POOL_SIZE PBUF_POOL_SIZE__default
DieterGraef 0:f9b6112278fe 144 #define PLATFORM_DEPENDENT__PBUF_POOL_BUFSIZE PBUF_POOL_BUFSIZE__default
DieterGraef 0:f9b6112278fe 145 #define PLATFORM_DEPENDENT__TCP_MSS TCP_MSS__default
DieterGraef 0:f9b6112278fe 146 #define PLATFORM_DEPENDENT__TCP_SND_BUF TCP_SND_BUF__default
DieterGraef 0:f9b6112278fe 147 #define PLATFORM_DEPENDENT__TCP_SND_QUEUELEN TCP_SND_QUEUELEN__default
DieterGraef 0:f9b6112278fe 148 #define PLATFORM_DEPENDENT__TCP_WND TCP_WND__default
DieterGraef 0:f9b6112278fe 149 #define PLATFORM_DEPENDENT__TCP_SNDLOWAT TCP_SNDLOWAT__default
DieterGraef 0:f9b6112278fe 150 #endif
DieterGraef 0:f9b6112278fe 151
DieterGraef 0:f9b6112278fe 152 #ifdef NETWORK_MEMORY_PROFILE_LWIP__large
DieterGraef 0:f9b6112278fe 153 #define PLATFORM_DEPENDENT__MEM_SIZE MEM_SIZE__max
DieterGraef 0:f9b6112278fe 154 #define PLATFORM_DEPENDENT__MEMP_NUM_PBUF MEMP_NUM_PBUF__max
DieterGraef 0:f9b6112278fe 155 #define PLATFORM_DEPENDENT__MEMP_NUM_UDP_PCB MEMP_NUM_UDP_PCB__max
DieterGraef 0:f9b6112278fe 156 #define PLATFORM_DEPENDENT__MEMP_NUM_TCP_PCB MEMP_NUM_TCP_PCB__max
DieterGraef 0:f9b6112278fe 157 #define PLATFORM_DEPENDENT__MEMP_NUM_TCP_PCB_LISTEN MEMP_NUM_TCP_PCB_LISTEN__max
DieterGraef 0:f9b6112278fe 158 #define PLATFORM_DEPENDENT__MEMP_NUM_TCP_SEG MEMP_NUM_TCP_SEG__max
DieterGraef 0:f9b6112278fe 159 #define PLATFORM_DEPENDENT__MEMP_NUM_SYS_TIMEOUT MEMP_NUM_SYS_TIMEOUT__max
DieterGraef 0:f9b6112278fe 160 #define PLATFORM_DEPENDENT__MEMP_NUM_NETBUF MEMP_NUM_NETBUF__max
DieterGraef 0:f9b6112278fe 161 #define PLATFORM_DEPENDENT__MEMP_NUM_NETCONN MEMP_NUM_NETCONN__max
DieterGraef 0:f9b6112278fe 162 #define PLATFORM_DEPENDENT__PBUF_POOL_SIZE PBUF_POOL_SIZE__max
DieterGraef 0:f9b6112278fe 163 #define PLATFORM_DEPENDENT__PBUF_POOL_BUFSIZE PBUF_POOL_BUFSIZE__max
DieterGraef 0:f9b6112278fe 164 #define PLATFORM_DEPENDENT__TCP_MSS TCP_MSS__max
DieterGraef 0:f9b6112278fe 165 #define PLATFORM_DEPENDENT__TCP_SND_BUF TCP_SND_BUF__max
DieterGraef 0:f9b6112278fe 166 #define PLATFORM_DEPENDENT__TCP_SND_QUEUELEN TCP_SND_QUEUELEN__max
DieterGraef 0:f9b6112278fe 167 #define PLATFORM_DEPENDENT__TCP_WND TCP_WND__max
DieterGraef 0:f9b6112278fe 168 #define PLATFORM_DEPENDENT__TCP_SNDLOWAT TCP_SNDLOWAT__max
DieterGraef 0:f9b6112278fe 169 #endif
DieterGraef 0:f9b6112278fe 170
DieterGraef 0:f9b6112278fe 171 #ifdef NETWORK_MEMORY_PROFILE_LWIP__custom
DieterGraef 0:f9b6112278fe 172 #define PLATFORM_DEPENDENT__MEM_SIZE MEM_SIZE__custom
DieterGraef 0:f9b6112278fe 173 #define PLATFORM_DEPENDENT__MEMP_NUM_PBUF MEMP_NUM_PBUF__custom
DieterGraef 0:f9b6112278fe 174 #define PLATFORM_DEPENDENT__MEMP_NUM_UDP_PCB MEMP_NUM_UDP_PCB__custom
DieterGraef 0:f9b6112278fe 175 #define PLATFORM_DEPENDENT__MEMP_NUM_TCP_PCB MEMP_NUM_TCP_PCB__custom
DieterGraef 0:f9b6112278fe 176 #define PLATFORM_DEPENDENT__MEMP_NUM_TCP_PCB_LISTEN MEMP_NUM_TCP_PCB_LISTEN__custom
DieterGraef 0:f9b6112278fe 177 #define PLATFORM_DEPENDENT__MEMP_NUM_TCP_SEG MEMP_NUM_TCP_SEG__custom
DieterGraef 0:f9b6112278fe 178 #define PLATFORM_DEPENDENT__MEMP_NUM_SYS_TIMEOUT MEMP_NUM_SYS_TIMEOUT__custom
DieterGraef 0:f9b6112278fe 179 #define PLATFORM_DEPENDENT__MEMP_NUM_NETBUF MEMP_NUM_NETBUF__custom
DieterGraef 0:f9b6112278fe 180 #define PLATFORM_DEPENDENT__MEMP_NUM_NETCONN MEMP_NUM_NETCONN__custom
DieterGraef 0:f9b6112278fe 181 #define PLATFORM_DEPENDENT__PBUF_POOL_SIZE PBUF_POOL_SIZE__custom
DieterGraef 0:f9b6112278fe 182 #define PLATFORM_DEPENDENT__PBUF_POOL_BUFSIZE PBUF_POOL_BUFSIZE__custom
DieterGraef 0:f9b6112278fe 183 #define PLATFORM_DEPENDENT__TCP_MSS TCP_MSS__custom
DieterGraef 0:f9b6112278fe 184 #define PLATFORM_DEPENDENT__TCP_SND_BUF TCP_SND_BUF__custom
DieterGraef 0:f9b6112278fe 185 #define PLATFORM_DEPENDENT__TCP_SND_QUEUELEN TCP_SND_QUEUELEN__custom
DieterGraef 0:f9b6112278fe 186 #define PLATFORM_DEPENDENT__TCP_WND TCP_WND__custom
DieterGraef 0:f9b6112278fe 187 #define PLATFORM_DEPENDENT__TCP_SNDLOWAT TCP_SNDLOWAT__custom
DieterGraef 0:f9b6112278fe 188 #endif
DieterGraef 0:f9b6112278fe 189
DieterGraef 0:f9b6112278fe 190 #define PLATFORM_DEPENDENT__SOCKETS_MAX_COUNT (PLATFORM_DEPENDENT__MEMP_NUM_UDP_PCB + PLATFORM_DEPENDENT__MEMP_NUM_TCP_PCB)
DieterGraef 0:f9b6112278fe 191
DieterGraef 0:f9b6112278fe 192 #endif // _DRIVERS_NETWORK_DEFINES_LWIP_H_
DieterGraef 0:f9b6112278fe 193