1 /*
2  * FreeRTOS+TCP <DEVELOPMENT BRANCH>
3  * Copyright (C) 2022 Amazon.com, Inc. or its affiliates.  All Rights Reserved.
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a copy of
6  * this software and associated documentation files (the "Software"), to deal in
7  * the Software without restriction, including without limitation the rights to
8  * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9  * the Software, and to permit persons to whom the Software is furnished to do so,
10  * subject to the following conditions:
11  *
12  * The above copyright notice and this permission notice shall be included in all
13  * copies or substantial portions of the Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17  * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18  * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19  * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21  *
22  * http://aws.amazon.com/freertos
23  * http://www.FreeRTOS.org
24  */
25 
26 #ifndef FREERTOS_CONFIG_H
27 #define FREERTOS_CONFIG_H
28 
29 /*-----------------------------------------------------------
30 * Application specific definitions.
31 *
32 * These definitions should be adjusted for your particular hardware and
33 * application requirements.
34 *
35 * THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE
36 * FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
37 * http://www.freertos.org/a00110.html
38 *
39 * The bottom of this file contains some constants specific to running the UDP
40 * stack in this demo.  Constants specific to FreeRTOS+TCP itself (rather than
41 * the demo) are contained in FreeRTOSIPConfig.h.
42 *----------------------------------------------------------*/
43 #define configENABLE_BACKWARD_COMPATIBILITY        1
44 #define configUSE_PREEMPTION                       1
45 #define configUSE_PORT_OPTIMISED_TASK_SELECTION    1
46 #define configMAX_PRIORITIES                       ( 7 )
47 #define configTICK_RATE_HZ                         ( 1000 )                  /* In this non-real time simulated environment the tick frequency has to be at least a multiple of the Win32 tick frequency, and therefore very slow. */
48 #define configMINIMAL_STACK_SIZE                   ( ( unsigned short ) 60 ) /* In this simulated case, the stack only has to hold one small structure as the real stack is part of the Win32 thread. */
49 #define configTOTAL_HEAP_SIZE                      ( ( size_t ) ( 2048U * 1024U ) )
50 #define configMAX_TASK_NAME_LEN                    ( 15 )
51 #ifndef configUSE_16_BIT_TICKS
52     #define configUSE_16_BIT_TICKS                 0
53 #endif
54 #define configIDLE_SHOULD_YIELD                    1
55 #ifndef configUSE_MUTEXES
56     #define configUSE_MUTEXES                      1
57 #endif
58 #ifndef configUSE_RECURSIVE_MUTEXES
59     #define configUSE_RECURSIVE_MUTEXES            1
60 #endif
61 #define configQUEUE_REGISTRY_SIZE                  0
62 #define configUSE_APPLICATION_TASK_TAG             1
63 #define configUSE_COUNTING_SEMAPHORES              1
64 #define configUSE_ALTERNATIVE_API                  0
65 #define configNUM_THREAD_LOCAL_STORAGE_POINTERS    3      /* FreeRTOS+FAT requires 2 pointers if a CWD is supported. */
66 #define configRECORD_STACK_HIGH_ADDRESS            1
67 
68 /* Hook function related definitions. */
69 #ifndef configUSE_TICK_HOOK
70     #define configUSE_TICK_HOOK           0
71 #endif
72 #define configUSE_IDLE_HOOK               1
73 #define configUSE_MALLOC_FAILED_HOOK      1
74 #define configCHECK_FOR_STACK_OVERFLOW    0               /* Not applicable to the Win32 port. */
75 
76 /* Software timer related definitions. */
77 #define configUSE_TIMERS                  1
78 #define configTIMER_TASK_PRIORITY         ( configMAX_PRIORITIES - 1 )
79 #define configTIMER_QUEUE_LENGTH          5
80 #define configTIMER_TASK_STACK_DEPTH      ( configMINIMAL_STACK_SIZE * 2 )
81 
82 /* Event group related definitions. */
83 #define configUSE_EVENT_GROUPS            1
84 
85 /* Memory allocation strategy. */
86 #ifndef configSUPPORT_DYNAMIC_ALLOCATION
87     #define configSUPPORT_DYNAMIC_ALLOCATION    1
88 #endif
89 #ifndef configSUPPORT_STATIC_ALLOCATION
90     #define configSUPPORT_STATIC_ALLOCATION     1
91 #endif
92 
93 
94 /* Set the following definitions to 1 to include the API function, or zero
95  * to exclude the API function. */
96 #define INCLUDE_vTaskPrioritySet                1
97 #define INCLUDE_uxTaskPriorityGet               1
98 #define INCLUDE_vTaskDelete                     1
99 #define INCLUDE_vTaskCleanUpResources           0
100 #ifndef INCLUDE_vTaskSuspend
101     #define INCLUDE_vTaskSuspend                1
102 #endif
103 #define INCLUDE_vTaskDelayUntil                 1
104 #define INCLUDE_vTaskDelay                      1
105 #define INCLUDE_uxTaskGetStackHighWaterMark     1
106 #ifndef INCLUDE_xTaskGetSchedulerState
107     #define INCLUDE_xTaskGetSchedulerState      1
108 #endif
109 #define INCLUDE_xTimerGetTimerTaskHandle        0
110 #define INCLUDE_xTaskGetIdleTaskHandle          0
111 #define INCLUDE_xQueueGetMutexHolder            1
112 #define INCLUDE_eTaskGetState                   1
113 #define INCLUDE_xEventGroupSetBitsFromISR       1
114 #define INCLUDE_xTimerPendFunctionCall          1
115 #define INCLUDE_xTaskGetCurrentTaskHandle       1
116 #define INCLUDE_xTaskAbortDelay                 1
117 
118 /* This demo makes use of one or more example stats formatting functions.  These
119  * format the raw data provided by the uxTaskGetSystemState() function in to human
120  * readable ASCII form.  See the notes in the implementation of vTaskList() within
121  * FreeRTOS/Source/tasks.c for limitations.  configUSE_STATS_FORMATTING_FUNCTIONS
122  * is set to 2 so the formatting functions are included without the stdio.h being
123  * included in tasks.c.  That is because this project defines its own sprintf()
124  * functions. */
125 #define configUSE_STATS_FORMATTING_FUNCTIONS    0
126 
127 /* Assert call defined for debug builds. */
128 extern void vAssertCalled( const char * pcFile,
129                            uint32_t ulLine );
130 #ifndef configASSERT
131     #define configASSERT( x )    if( ( x ) == 0 ) vAssertCalled( __FILE__, __LINE__ )
132 #endif
133 
134 /* Remove logging in formal verification */
135 #define configPRINTF( X )
136 
137 /* Non-format version thread-safe print. */
138 #define configPRINT_STRING( X )
139 
140 /* Application specific definitions follow. **********************************/
141 
142 /* If configINCLUDE_DEMO_DEBUG_STATS is set to one, then a few basic IP trace
143  * macros are defined to gather some UDP stack statistics that can then be viewed
144  * through the CLI interface. */
145 #define configINCLUDE_DEMO_DEBUG_STATS       1
146 
147 /* The size of the global output buffer that is available for use when there
148  * are multiple command interpreters running at once (for example, one on a UART
149  * and one on TCP/IP).  This is done to prevent an output buffer being defined by
150  * each implementation - which would waste RAM.  In this case, there is only one
151  * command interpreter running, and it has its own local output buffer, so the
152  * global buffer is just set to be one byte long as it is not used and should not
153  * take up unnecessary RAM. */
154 #define configCOMMAND_INT_MAX_OUTPUT_SIZE    1
155 
156 /* Only used when running in the FreeRTOS Windows simulator.  Defines the
157  * priority of the task used to simulate Ethernet interrupts. */
158 #define configMAC_ISR_SIMULATOR_PRIORITY     ( configMAX_PRIORITIES - 1 )
159 
160 /* This demo creates a virtual network connection by accessing the raw Ethernet
161  * or WiFi data to and from a real network connection.  Many computers have more
162  * than one real network port, and configNETWORK_INTERFACE_TO_USE is used to tell
163  * the demo which real port should be used to create the virtual port.  The ports
164  * available are displayed on the console when the application is executed.  For
165  * example, on my development laptop setting configNETWORK_INTERFACE_TO_USE to 4
166  * results in the wired network being used, while setting
167  * configNETWORK_INTERFACE_TO_USE to 2 results in the wireless network being
168  * used. */
169 #define configNETWORK_INTERFACE_TO_USE       ( 0L )
170 
171 /* The address of an echo server that will be used by the two demo echo client
172  * tasks:
173  * http://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_Echo_Clients.html,
174  * http://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/UDP_Echo_Clients.html. */
175 #define configECHO_SERVER_ADDR0              192
176 #define configECHO_SERVER_ADDR1              168
177 #define configECHO_SERVER_ADDR2              2
178 #define configECHO_SERVER_ADDR3              6
179 #define configTCP_ECHO_CLIENT_PORT           7
180 
181 /* Default MAC address configuration.  The demo creates a virtual network
182  * connection that uses this MAC address by accessing the raw Ethernet/WiFi data
183  * to and from a real network connection on the host PC.  See the
184  * configNETWORK_INTERFACE_TO_USE definition above for information on how to
185  * configure the real network connection to use. */
186 #define configMAC_ADDR0                      0x00
187 #define configMAC_ADDR1                      0x11
188 #define configMAC_ADDR2                      0x22
189 #define configMAC_ADDR3                      0x33
190 #define configMAC_ADDR4                      0x44
191 #define configMAC_ADDR5                      0x21
192 
193 /* Default IP address configuration.  Used in ipconfigUSE_DHCP is set to 0, or
194  * ipconfigUSE_DHCP is set to 1 but a DNS server cannot be contacted. */
195 #define configIP_ADDR0                       192
196 #define configIP_ADDR1                       168
197 #define configIP_ADDR2                       0
198 #define configIP_ADDR3                       105
199 
200 /* Default gateway IP address configuration.  Used in ipconfigUSE_DHCP is set to
201  * 0, or ipconfigUSE_DHCP is set to 1 but a DNS server cannot be contacted. */
202 #define configGATEWAY_ADDR0                  192
203 #define configGATEWAY_ADDR1                  168
204 #define configGATEWAY_ADDR2                  0
205 #define configGATEWAY_ADDR3                  1
206 
207 /* Default DNS server configuration.  OpenDNS addresses are 208.67.222.222 and
208  * 208.67.220.220.  Used in ipconfigUSE_DHCP is set to 0, or ipconfigUSE_DHCP is
209  * set to 1 but a DNS server cannot be contacted.*/
210 #define configDNS_SERVER_ADDR0               208
211 #define configDNS_SERVER_ADDR1               67
212 #define configDNS_SERVER_ADDR2               222
213 #define configDNS_SERVER_ADDR3               222
214 
215 /* Default netmask configuration.  Used in ipconfigUSE_DHCP is set to 0, or
216  * ipconfigUSE_DHCP is set to 1 but a DNS server cannot be contacted. */
217 #define configNET_MASK0                      255
218 #define configNET_MASK1                      255
219 #define configNET_MASK2                      255
220 #define configNET_MASK3                      0
221 
222 /* The UDP port to which print messages are sent. */
223 #define configPRINT_PORT                     ( 15000 )
224 
225 #define configPROFILING                      ( 0 )
226 
227 /* Pseudo random number generator used by some demo tasks. */
228 extern uint32_t ulRand();
229 #define configRAND32()    ulRand()
230 
231 /* The platform that FreeRTOS is running on. */
232 #define configPLATFORM_NAME    "WinSim"
233 
234 #endif /* FREERTOS_CONFIG_H */
235