]> git.sur5r.net Git - freertos/blob - FreeRTOS-Plus/Demo/FreeRTOS_Plus_UDP_and_CLI_Windows_Simulator/FreeRTOSIPConfig.h
Update license information text files for the CLI, TCP and UDP products to be correct...
[freertos] / FreeRTOS-Plus / Demo / FreeRTOS_Plus_UDP_and_CLI_Windows_Simulator / FreeRTOSIPConfig.h
1 /*\r
2  * FreeRTOS+UDP V1.0.4\r
3  * Copyright (C) 2017 Amazon.com, Inc. or its affiliates.  All Rights Reserved.\r
4  *\r
5  * Permission is hereby granted, free of charge, to any person obtaining a copy of\r
6  * this software and associated documentation files (the "Software"), to deal in\r
7  * the Software without restriction, including without limitation the rights to\r
8  * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\r
9  * the Software, and to permit persons to whom the Software is furnished to do so,\r
10  * subject to the following conditions:\r
11  *\r
12  * The above copyright notice and this permission notice shall be included in all\r
13  * copies or substantial portions of the Software. If you wish to use our Amazon\r
14  * FreeRTOS name, please do so in a fair use way that does not cause confusion.\r
15  *\r
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
18  * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\r
19  * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\r
20  * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
21  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
22  *\r
23  * http://www.FreeRTOS.org\r
24  * http://aws.amazon.com/freertos\r
25  *\r
26  * 1 tab == 4 spaces!\r
27  */\r
28 \r
29 /*****************************************************************************\r
30  *\r
31  * See the following URL for configuration information.\r
32  * http://www.FreeRTOS.org/FreeRTOS-Plus/FreeRTOS_Plus_UDP/UDP_IP_Configuration.shtml\r
33  *\r
34  *****************************************************************************/\r
35 \r
36 #ifndef FREERTOS_IP_CONFIG_H\r
37 #define FREERTOS_IP_CONFIG_H\r
38 \r
39 /* The IP stack executes it its own task (although any application task can make\r
40 use of its services through the published sockets API). ipconfigUDP_TASK_PRIORITY\r
41 sets the priority of the task that executes the IP stack.  The priority is a\r
42 standard FreeRTOS task priority so can take any value from 0 (the lowest\r
43 priority) to (configMAX_PRIORITIES - 1) (the highest priority).\r
44 configMAX_PRIORITIES is a standard FreeRTOS configuration parameter defined in\r
45 FreeRTOSConfig.h, not FreeRTOSIPConfig.h. Consideration needs to be given as to\r
46 the priority assigned to the task executing the IP stack relative to the\r
47 priority assigned to tasks that use the IP stack. */\r
48 #define ipconfigUDP_TASK_PRIORITY                       ( configMAX_PRIORITIES - 2 )\r
49 \r
50 /* The size, in words (not bytes), of the stack allocated to the FreeRTOS+UDP\r
51 task.  This setting is less important when the FreeRTOS Win32 simulator is used\r
52 as the Win32 simulator only stores a fixed amount of information on the task\r
53 stack.  FreeRTOS includes optional stack overflow detection, see:\r
54 http://www.freertos.org/Stacks-and-stack-overflow-checking.html */\r
55 #define ipconfigUDP_TASK_STACK_SIZE_WORDS       ( configMINIMAL_STACK_SIZE * 5 )\r
56 \r
57 /* ipconfigRAND32() is called by the IP stack to generate a random number that\r
58 is then used as a DHCP transaction number.  Random number generation is performed\r
59 via this macro to allow applications to use their own random number generation\r
60 method.  For example, it might be possible to generate a random number by\r
61 sampling noise on an analogue input. */\r
62 #define ipconfigRAND32()        1\r
63 \r
64 /* If ipconfigUSE_NETWORK_EVENT_HOOK is set to 1 then FreeRTOS+UDP will call the\r
65 network event hook at the appropriate times.  If ipconfigUSE_NETWORK_EVENT_HOOK\r
66 is not set to 1 then the network event hook will never be called.  See\r
67 http://www.FreeRTOS.org/FreeRTOS-Plus/FreeRTOS_Plus_UDP/API/vApplicationIPNetworkEventHook.shtml\r
68 */\r
69 #define ipconfigUSE_NETWORK_EVENT_HOOK 1\r
70 \r
71 /* Sockets have a send block time attribute.  If FreeRTOS_sendto() is called but\r
72 a network buffer cannot be obtained then the calling task is held in the Blocked\r
73 state (so other tasks can continue to executed) until either a network buffer\r
74 becomes available or the send block time expires.  If the send block time expires\r
75 then the send operation is aborted.  The maximum allowable send block time is\r
76 capped to the value set by ipconfigMAX_SEND_BLOCK_TIME_TICKS.  Capping the\r
77 maximum allowable send block time prevents prevents a deadlock occurring when\r
78 all the network buffers are in use and the tasks that process (and subsequently\r
79 free) the network buffers are themselves blocked waiting for a network buffer.\r
80 ipconfigMAX_SEND_BLOCK_TIME_TICKS is specified in RTOS ticks.  A time in\r
81 milliseconds can be converted to a time in ticks by dividing the time in\r
82 milliseconds by portTICK_RATE_MS. */\r
83 #define ipconfigMAX_SEND_BLOCK_TIME_TICKS ( 20 / portTICK_RATE_MS )\r
84 \r
85 /* If ipconfigUSE_DHCP is 1 then FreeRTOS+UDP will attempt to retrieve an IP\r
86 address, netmask, DNS server address and gateway address from a DHCP server.  If\r
87 ipconfigUSE_DHCP is 0 then FreeRTOS+UDP will use a static IP address.  The\r
88 stack will revert to using the static IP address even when ipconfigUSE_DHCP is\r
89 set to 1 if a valid configuration cannot be obtained from a DHCP server for any\r
90 reason.  The static configuration used is that passed into the stack by the\r
91 FreeRTOS_IPInit() function call. */\r
92 #define ipconfigUSE_DHCP        1\r
93 \r
94 /* When ipconfigUSE_DHCP is set to 1, DHCP requests will be sent out at\r
95 increasing time intervals until either a reply is received from a DHCP server\r
96 and accepted, or the interval between transmissions reaches\r
97 ipconfigMAXIMUM_DISCOVER_TX_PERIOD.  The IP stack will revert to using the\r
98 static IP address passed as a parameter to FreeRTOS_IPInit() if the\r
99 re-transmission time interval reaches ipconfigMAXIMUM_DISCOVER_TX_PERIOD without\r
100 a DHCP reply being received. */\r
101 #ifdef _WINDOWS_\r
102         /* The windows simulated time is not real time so the max delay is much\r
103         shorter. */\r
104         #define ipconfigMAXIMUM_DISCOVER_TX_PERIOD              ( 999 / portTICK_RATE_MS )\r
105 #else\r
106         #define ipconfigMAXIMUM_DISCOVER_TX_PERIOD              ( 120000 / portTICK_RATE_MS )\r
107 #endif /* _WINDOWS_ */\r
108 \r
109 /* The ARP cache is a table that maps IP addresses to MAC addresses.  The IP\r
110 stack can only send a UDP message to a remove IP address if it knowns the MAC\r
111 address associated with the IP address, or the MAC address of the router used to\r
112 contact the remote IP address.  When a UDP message is received from a remote IP\r
113 address the MAC address and IP address are added to the ARP cache.  When a UDP\r
114 message is sent to a remote IP address that does not already appear in the ARP\r
115 cache then the UDP message is replaced by a ARP message that solicits the\r
116 required MAC address information.  ipconfigARP_CACHE_ENTRIES defines the maximum\r
117 number of entries that can exist in the ARP table at any one time. */\r
118 #define ipconfigARP_CACHE_ENTRIES               6\r
119 \r
120 /* ARP requests that do not result in an ARP response will be re-transmitted a\r
121 maximum of ipconfigMAX_ARP_RETRANSMISSIONS times before the ARP request is\r
122 aborted. */\r
123 #define ipconfigMAX_ARP_RETRANSMISSIONS ( 5 )\r
124 \r
125 /* ipconfigMAX_ARP_AGE defines the maximum time between an entry in the ARP\r
126 table being created or refreshed and the entry being removed because it is stale.\r
127 New ARP requests are sent for ARP cache entries that are nearing their maximum\r
128 age.  ipconfigMAX_ARP_AGE is specified in tens of seconds, so a value of 150 is\r
129 equal to 1500 seconds (or 25 minutes). */\r
130 #define ipconfigMAX_ARP_AGE                     150\r
131 \r
132 /* Implementing FreeRTOS_inet_addr() necessitates the use of string handling\r
133 routines, which are relatively large.  To save code space the full\r
134 FreeRTOS_inet_addr() implementation is made optional, and a smaller and faster\r
135 alternative called FreeRTOS_inet_addr_quick() is provided.  FreeRTOS_inet_addr()\r
136 takes an IP in decimal dot format (for example, "192.168.0.1") as its parameter.\r
137 FreeRTOS_inet_addr_quick() takes an IP address as four separate numerical octets\r
138 (for example, 192, 168, 0, 1) as its parameters.  If\r
139 ipconfigINCLUDE_FULL_INET_ADDR is set to 1 then both FreeRTOS_inet_addr() and\r
140 FreeRTOS_indet_addr_quick() are available.  If ipconfigINCLUDE_FULL_INET_ADDR is\r
141 not set to 1 then only FreeRTOS_indet_addr_quick() is available. */\r
142 #define ipconfigINCLUDE_FULL_INET_ADDR  1\r
143 \r
144 /* ipconfigNUM_NETWORK_BUFFERS defines the total number of network buffer that\r
145 are available to the IP stack.  The total number of network buffers is limited\r
146 to ensure the total amount of RAM that can be consumed by the IP stack is capped\r
147 to a pre-determinable value. */\r
148 #define ipconfigNUM_NETWORK_BUFFERS             45\r
149 \r
150 /* A FreeRTOS queue is used to send events from application tasks to the IP\r
151 stack.  ipconfigEVENT_QUEUE_LENGTH sets the maximum number of events that can\r
152 be queued for processing at any one time.  The event queue must be a minimum of\r
153 5 greater than the total number of network buffers. */\r
154 #define ipconfigEVENT_QUEUE_LENGTH              ( ipconfigNUM_NETWORK_BUFFERS + 5 )\r
155 \r
156 /* The address of a socket is the combination of its IP address and its port\r
157 number.  FreeRTOS_bind() is used to manually allocate a port number to a socket\r
158 (to 'bind' the socket to a port), but manual binding is not normally necessary\r
159 for client sockets (those sockets that initiate outgoing connections rather than\r
160 wait for incoming connections on a known port number).  If\r
161 ipconfigALLOW_SOCKET_SEND_WITHOUT_BIND is set to 1 then calling\r
162 FreeRTOS_sendto() on a socket that has not yet been bound will result in the IP\r
163 stack automatically binding the socket to a port number from the range\r
164 socketAUTO_PORT_ALLOCATION_START_NUMBER to 0xffff.  If\r
165 ipconfigALLOW_SOCKET_SEND_WITHOUT_BIND is set to 0 then calling FreeRTOS_sendto()\r
166 on a socket that has not yet been bound will result in the send operation being\r
167 aborted. */\r
168 #define ipconfigALLOW_SOCKET_SEND_WITHOUT_BIND 1\r
169 \r
170 /* Defines the Time To Live (TTL) values used in outgoing UDP packets. */\r
171 #define updconfigIP_TIME_TO_LIVE                128\r
172 \r
173 /* If ipconfigCAN_FRAGMENT_OUTGOING_PACKETS is set to 1 then UDP packets that\r
174 contain more data than will fit in a single network frame will be fragmented\r
175 across multiple IP packets.  Also see the ipconfigNETWORK_MTU setting.  If\r
176 ipconfigCAN_FRAGMENT_OUTGOING_PACKETS is 1 then (ipconfigNETWORK_MTU - 28) must\r
177 be divisible by 8.  Setting ipconfigCAN_FRAGMENT_OUTGOING_PACKETS to 1 will\r
178 increase both the code size and execution time. */\r
179 #define ipconfigCAN_FRAGMENT_OUTGOING_PACKETS 0\r
180 \r
181 /* The MTU is the maximum number of bytes the payload of a network frame can\r
182 contain.  For normal Ethernet V2 frames the maximum MTU is 1500.  Setting a\r
183 lower value can save RAM, depending on the buffer management scheme used.  If\r
184 ipconfigCAN_FRAGMENT_OUTGOING_PACKETS is 1 then (ipconfigNETWORK_MTU - 28) must\r
185 be divisible by 8. */\r
186 #define ipconfigNETWORK_MTU 1500\r
187 \r
188 /* Set ipconfigUSE_DNS to 1 to include a basic DNS client/resolver.  DNS is used\r
189 through the FreeRTOS_gethostbyname() API function. */\r
190 #define ipconfigUSE_DNS         1\r
191 \r
192 /* If ipconfigREPLY_TO_INCOMING_PINGS is set to 1 then the IP stack will\r
193 generate replies to incoming ICMP echo (ping) requests. */\r
194 #define ipconfigREPLY_TO_INCOMING_PINGS                         1\r
195 \r
196 /* If ipconfigSUPPORT_OUTGOING_PINGS is set to 1 then the\r
197 FreeRTOS_SendPingRequest() API function is available. */\r
198 #define ipconfigSUPPORT_OUTGOING_PINGS                          1\r
199 \r
200 /* If ipconfigSUPPORT_SELECT_FUNCTION is set to 1 then the FreeRTOS_select()\r
201 (and associated) API function is available. */\r
202 #define ipconfigSUPPORT_SELECT_FUNCTION                         1\r
203 \r
204 /* Used for stack testing only, and must be implemented in the network\r
205 interface. */\r
206 #define updconfigLOOPBACK_ETHERNET_PACKETS      0\r
207 \r
208 /* If ipconfigFILTER_OUT_NON_ETHERNET_II_FRAMES is set to 1 then Ethernet frames\r
209 that are not in Ethernet II format will be dropped.  This option is included for\r
210 potential future IP stack developments. */\r
211 #define ipconfigFILTER_OUT_NON_ETHERNET_II_FRAMES 1\r
212 \r
213 /* If ipconfigETHERNET_DRIVER_FILTERS_FRAME_TYPES is set to 1 then it is the\r
214 responsibility of the Ethernet interface to filter out packets that are of no\r
215 interest.  If the Ethernet interface does not implement this functionality, then\r
216 set ipconfigETHERNET_DRIVER_FILTERS_FRAME_TYPES to 0 to have the IP stack\r
217 perform the filtering instead (it is much less efficient for the stack to do it\r
218 because the packet will already have been passed into the stack).  If the\r
219 Ethernet driver does all the necessary filtering in hardware then software\r
220 filtering can be removed by using a value other than 1 or 0. */\r
221 #define ipconfigETHERNET_DRIVER_FILTERS_FRAME_TYPES     1\r
222 \r
223 /* The windows simulator cannot really simulate MAC interrupts, and needs to\r
224 block occasionally to allow other tasks to run. */\r
225 #ifdef _WINDOWS_\r
226         #define configWINDOWS_MAC_INTERRUPT_SIMULATOR_DELAY ( 3 / portTICK_RATE_MS )\r
227 #endif\r
228 \r
229 /* The example IP trace macros are included here so the definitions are\r
230 available in all the FreeRTOS+UDP source files. */\r
231 #include "DemoIPTrace.h"\r
232 \r
233 #endif /* FREERTOS_IP_CONFIG_H */\r