diff options
Diffstat (limited to 'lib/chibios/demos/STM32/RT-STM32F107-OLIMEX_P107-LWIP')
11 files changed, 2635 insertions, 0 deletions
diff --git a/lib/chibios/demos/STM32/RT-STM32F107-OLIMEX_P107-LWIP/Makefile b/lib/chibios/demos/STM32/RT-STM32F107-OLIMEX_P107-LWIP/Makefile new file mode 100644 index 000000000..3b68ca352 --- /dev/null +++ b/lib/chibios/demos/STM32/RT-STM32F107-OLIMEX_P107-LWIP/Makefile | |||
@@ -0,0 +1,191 @@ | |||
1 | ############################################################################## | ||
2 | # Build global options | ||
3 | # NOTE: Can be overridden externally. | ||
4 | # | ||
5 | |||
6 | # Compiler options here. | ||
7 | ifeq ($(USE_OPT),) | ||
8 | USE_OPT = -O2 -ggdb -fomit-frame-pointer -falign-functions=16 | ||
9 | endif | ||
10 | |||
11 | # C specific options here (added to USE_OPT). | ||
12 | ifeq ($(USE_COPT),) | ||
13 | USE_COPT = | ||
14 | endif | ||
15 | |||
16 | # C++ specific options here (added to USE_OPT). | ||
17 | ifeq ($(USE_CPPOPT),) | ||
18 | USE_CPPOPT = -fno-rtti | ||
19 | endif | ||
20 | |||
21 | # Enable this if you want the linker to remove unused code and data. | ||
22 | ifeq ($(USE_LINK_GC),) | ||
23 | USE_LINK_GC = yes | ||
24 | endif | ||
25 | |||
26 | # Linker extra options here. | ||
27 | ifeq ($(USE_LDOPT),) | ||
28 | USE_LDOPT = | ||
29 | endif | ||
30 | |||
31 | # Enable this if you want link time optimizations (LTO). | ||
32 | ifeq ($(USE_LTO),) | ||
33 | USE_LTO = yes | ||
34 | endif | ||
35 | |||
36 | # Enable this if you want to see the full log while compiling. | ||
37 | ifeq ($(USE_VERBOSE_COMPILE),) | ||
38 | USE_VERBOSE_COMPILE = no | ||
39 | endif | ||
40 | |||
41 | # If enabled, this option makes the build process faster by not compiling | ||
42 | # modules not used in the current configuration. | ||
43 | ifeq ($(USE_SMART_BUILD),) | ||
44 | USE_SMART_BUILD = yes | ||
45 | endif | ||
46 | |||
47 | # | ||
48 | # Build global options | ||
49 | ############################################################################## | ||
50 | |||
51 | ############################################################################## | ||
52 | # Architecture or project specific options | ||
53 | # | ||
54 | |||
55 | # Stack size to be allocated to the Cortex-M process stack. This stack is | ||
56 | # the stack used by the main() thread. | ||
57 | ifeq ($(USE_PROCESS_STACKSIZE),) | ||
58 | USE_PROCESS_STACKSIZE = 0x400 | ||
59 | endif | ||
60 | |||
61 | # Stack size to the allocated to the Cortex-M main/exceptions stack. This | ||
62 | # stack is used for processing interrupts and exceptions. | ||
63 | ifeq ($(USE_EXCEPTIONS_STACKSIZE),) | ||
64 | USE_EXCEPTIONS_STACKSIZE = 0x400 | ||
65 | endif | ||
66 | |||
67 | # Enables the use of FPU (no, softfp, hard). | ||
68 | ifeq ($(USE_FPU),) | ||
69 | USE_FPU = no | ||
70 | endif | ||
71 | |||
72 | # FPU-related options. | ||
73 | ifeq ($(USE_FPU_OPT),) | ||
74 | USE_FPU_OPT = -mfloat-abi=$(USE_FPU) -mfpu=fpv4-sp-d16 | ||
75 | endif | ||
76 | |||
77 | # | ||
78 | # Architecture or project specific options | ||
79 | ############################################################################## | ||
80 | |||
81 | ############################################################################## | ||
82 | # Project, target, sources and paths | ||
83 | # | ||
84 | |||
85 | # Define project name here | ||
86 | PROJECT = ch | ||
87 | |||
88 | # Target settings. | ||
89 | MCU = cortex-m3 | ||
90 | |||
91 | # Imported source files and paths. | ||
92 | CHIBIOS := ../../.. | ||
93 | CONFDIR := ./cfg | ||
94 | BUILDDIR := ./build | ||
95 | DEPDIR := ./.dep | ||
96 | |||
97 | # Licensing files. | ||
98 | include $(CHIBIOS)/os/license/license.mk | ||
99 | # Startup files. | ||
100 | include $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC/mk/startup_stm32f1xx.mk | ||
101 | # HAL-OSAL files (optional). | ||
102 | include $(CHIBIOS)/os/hal/hal.mk | ||
103 | include $(CHIBIOS)/os/hal/ports/STM32/STM32F1xx/platform_f105_f107.mk | ||
104 | include $(CHIBIOS)/os/hal/boards/OLIMEX_STM32_P107/board.mk | ||
105 | include $(CHIBIOS)/os/hal/osal/rt-nil/osal.mk | ||
106 | # RTOS files (optional). | ||
107 | include $(CHIBIOS)/os/rt/rt.mk | ||
108 | include $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/port_v7m.mk | ||
109 | # Auto-build files in ./source recursively. | ||
110 | include $(CHIBIOS)/tools/mk/autobuild.mk | ||
111 | # Other files (optional). | ||
112 | include $(CHIBIOS)/test/lib/test.mk | ||
113 | include $(CHIBIOS)/test/rt/rt_test.mk | ||
114 | include $(CHIBIOS)/test/oslib/oslib_test.mk | ||
115 | include $(CHIBIOS)/os/various/lwip_bindings/lwip.mk | ||
116 | |||
117 | # Define linker script file here | ||
118 | LDSCRIPT= $(STARTUPLD)/STM32F107xC.ld | ||
119 | |||
120 | # C sources that can be compiled in ARM or THUMB mode depending on the global | ||
121 | # setting. | ||
122 | CSRC = $(ALLCSRC) \ | ||
123 | $(TESTSRC) \ | ||
124 | $(CHIBIOS)/os/various/evtimer.c \ | ||
125 | web/web.c main.c | ||
126 | |||
127 | # C++ sources that can be compiled in ARM or THUMB mode depending on the global | ||
128 | # setting. | ||
129 | CPPSRC = $(ALLCPPSRC) | ||
130 | |||
131 | # List ASM source files here. | ||
132 | ASMSRC = $(ALLASMSRC) | ||
133 | |||
134 | # List ASM with preprocessor source files here. | ||
135 | ASMXSRC = $(ALLXASMSRC) | ||
136 | |||
137 | # Inclusion directories. | ||
138 | INCDIR = $(CONFDIR) $(ALLINC) $(TESTINC) | ||
139 | |||
140 | # Define C warning options here. | ||
141 | CWARN = -Wall -Wextra -Wundef -Wstrict-prototypes | ||
142 | |||
143 | # Define C++ warning options here. | ||
144 | CPPWARN = -Wall -Wextra -Wundef | ||
145 | |||
146 | # | ||
147 | # Project, target, sources and paths | ||
148 | ############################################################################## | ||
149 | |||
150 | ############################################################################## | ||
151 | # Start of user section | ||
152 | # | ||
153 | |||
154 | # List all user C define here, like -D_DEBUG=1 | ||
155 | UDEFS = | ||
156 | |||
157 | # Define ASM defines here | ||
158 | UADEFS = | ||
159 | |||
160 | # List all user directories here | ||
161 | UINCDIR = | ||
162 | |||
163 | # List the user directory to look for the libraries here | ||
164 | ULIBDIR = | ||
165 | |||
166 | # List all user libraries here | ||
167 | ULIBS = | ||
168 | |||
169 | # | ||
170 | # End of user section | ||
171 | ############################################################################## | ||
172 | |||
173 | ############################################################################## | ||
174 | # Common rules | ||
175 | # | ||
176 | |||
177 | RULESPATH = $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC/mk | ||
178 | include $(RULESPATH)/arm-none-eabi.mk | ||
179 | include $(RULESPATH)/rules.mk | ||
180 | |||
181 | # | ||
182 | # Common rules | ||
183 | ############################################################################## | ||
184 | |||
185 | ############################################################################## | ||
186 | # Custom rules | ||
187 | # | ||
188 | |||
189 | # | ||
190 | # Custom rules | ||
191 | ############################################################################## | ||
diff --git a/lib/chibios/demos/STM32/RT-STM32F107-OLIMEX_P107-LWIP/cfg/chconf.h b/lib/chibios/demos/STM32/RT-STM32F107-OLIMEX_P107-LWIP/cfg/chconf.h new file mode 100644 index 000000000..233a70df5 --- /dev/null +++ b/lib/chibios/demos/STM32/RT-STM32F107-OLIMEX_P107-LWIP/cfg/chconf.h | |||
@@ -0,0 +1,756 @@ | |||
1 | /* | ||
2 | ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio | ||
3 | |||
4 | Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | you may not use this file except in compliance with the License. | ||
6 | You may obtain a copy of the License at | ||
7 | |||
8 | http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | |||
10 | Unless required by applicable law or agreed to in writing, software | ||
11 | distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | See the License for the specific language governing permissions and | ||
14 | limitations under the License. | ||
15 | */ | ||
16 | |||
17 | /** | ||
18 | * @file rt/templates/chconf.h | ||
19 | * @brief Configuration file template. | ||
20 | * @details A copy of this file must be placed in each project directory, it | ||
21 | * contains the application specific kernel settings. | ||
22 | * | ||
23 | * @addtogroup config | ||
24 | * @details Kernel related settings and hooks. | ||
25 | * @{ | ||
26 | */ | ||
27 | |||
28 | #ifndef CHCONF_H | ||
29 | #define CHCONF_H | ||
30 | |||
31 | #define _CHIBIOS_RT_CONF_ | ||
32 | #define _CHIBIOS_RT_CONF_VER_6_1_ | ||
33 | |||
34 | /*===========================================================================*/ | ||
35 | /** | ||
36 | * @name System timers settings | ||
37 | * @{ | ||
38 | */ | ||
39 | /*===========================================================================*/ | ||
40 | |||
41 | /** | ||
42 | * @brief System time counter resolution. | ||
43 | * @note Allowed values are 16, 32 or 64 bits. | ||
44 | */ | ||
45 | #if !defined(CH_CFG_ST_RESOLUTION) | ||
46 | #define CH_CFG_ST_RESOLUTION 32 | ||
47 | #endif | ||
48 | |||
49 | /** | ||
50 | * @brief System tick frequency. | ||
51 | * @details Frequency of the system timer that drives the system ticks. This | ||
52 | * setting also defines the system tick time unit. | ||
53 | */ | ||
54 | #if !defined(CH_CFG_ST_FREQUENCY) | ||
55 | #define CH_CFG_ST_FREQUENCY 1000 | ||
56 | #endif | ||
57 | |||
58 | /** | ||
59 | * @brief Time intervals data size. | ||
60 | * @note Allowed values are 16, 32 or 64 bits. | ||
61 | */ | ||
62 | #if !defined(CH_CFG_INTERVALS_SIZE) | ||
63 | #define CH_CFG_INTERVALS_SIZE 32 | ||
64 | #endif | ||
65 | |||
66 | /** | ||
67 | * @brief Time types data size. | ||
68 | * @note Allowed values are 16 or 32 bits. | ||
69 | */ | ||
70 | #if !defined(CH_CFG_TIME_TYPES_SIZE) | ||
71 | #define CH_CFG_TIME_TYPES_SIZE 32 | ||
72 | #endif | ||
73 | |||
74 | /** | ||
75 | * @brief Time delta constant for the tick-less mode. | ||
76 | * @note If this value is zero then the system uses the classic | ||
77 | * periodic tick. This value represents the minimum number | ||
78 | * of ticks that is safe to specify in a timeout directive. | ||
79 | * The value one is not valid, timeouts are rounded up to | ||
80 | * this value. | ||
81 | */ | ||
82 | #if !defined(CH_CFG_ST_TIMEDELTA) | ||
83 | #define CH_CFG_ST_TIMEDELTA 0 | ||
84 | #endif | ||
85 | |||
86 | /** @} */ | ||
87 | |||
88 | /*===========================================================================*/ | ||
89 | /** | ||
90 | * @name Kernel parameters and options | ||
91 | * @{ | ||
92 | */ | ||
93 | /*===========================================================================*/ | ||
94 | |||
95 | /** | ||
96 | * @brief Round robin interval. | ||
97 | * @details This constant is the number of system ticks allowed for the | ||
98 | * threads before preemption occurs. Setting this value to zero | ||
99 | * disables the preemption for threads with equal priority and the | ||
100 | * round robin becomes cooperative. Note that higher priority | ||
101 | * threads can still preempt, the kernel is always preemptive. | ||
102 | * @note Disabling the round robin preemption makes the kernel more compact | ||
103 | * and generally faster. | ||
104 | * @note The round robin preemption is not supported in tickless mode and | ||
105 | * must be set to zero in that case. | ||
106 | */ | ||
107 | #if !defined(CH_CFG_TIME_QUANTUM) | ||
108 | #define CH_CFG_TIME_QUANTUM 0 | ||
109 | #endif | ||
110 | |||
111 | /** | ||
112 | * @brief Idle thread automatic spawn suppression. | ||
113 | * @details When this option is activated the function @p chSysInit() | ||
114 | * does not spawn the idle thread. The application @p main() | ||
115 | * function becomes the idle thread and must implement an | ||
116 | * infinite loop. | ||
117 | */ | ||
118 | #if !defined(CH_CFG_NO_IDLE_THREAD) | ||
119 | #define CH_CFG_NO_IDLE_THREAD FALSE | ||
120 | #endif | ||
121 | |||
122 | /** @} */ | ||
123 | |||
124 | /*===========================================================================*/ | ||
125 | /** | ||
126 | * @name Performance options | ||
127 | * @{ | ||
128 | */ | ||
129 | /*===========================================================================*/ | ||
130 | |||
131 | /** | ||
132 | * @brief OS optimization. | ||
133 | * @details If enabled then time efficient rather than space efficient code | ||
134 | * is used when two possible implementations exist. | ||
135 | * | ||
136 | * @note This is not related to the compiler optimization options. | ||
137 | * @note The default is @p TRUE. | ||
138 | */ | ||
139 | #if !defined(CH_CFG_OPTIMIZE_SPEED) | ||
140 | #define CH_CFG_OPTIMIZE_SPEED TRUE | ||
141 | #endif | ||
142 | |||
143 | /** @} */ | ||
144 | |||
145 | /*===========================================================================*/ | ||
146 | /** | ||
147 | * @name Subsystem options | ||
148 | * @{ | ||
149 | */ | ||
150 | /*===========================================================================*/ | ||
151 | |||
152 | /** | ||
153 | * @brief Time Measurement APIs. | ||
154 | * @details If enabled then the time measurement APIs are included in | ||
155 | * the kernel. | ||
156 | * | ||
157 | * @note The default is @p TRUE. | ||
158 | */ | ||
159 | #if !defined(CH_CFG_USE_TM) | ||
160 | #define CH_CFG_USE_TM TRUE | ||
161 | #endif | ||
162 | |||
163 | /** | ||
164 | * @brief Threads registry APIs. | ||
165 | * @details If enabled then the registry APIs are included in the kernel. | ||
166 | * | ||
167 | * @note The default is @p TRUE. | ||
168 | */ | ||
169 | #if !defined(CH_CFG_USE_REGISTRY) | ||
170 | #define CH_CFG_USE_REGISTRY TRUE | ||
171 | #endif | ||
172 | |||
173 | /** | ||
174 | * @brief Threads synchronization APIs. | ||
175 | * @details If enabled then the @p chThdWait() function is included in | ||
176 | * the kernel. | ||
177 | * | ||
178 | * @note The default is @p TRUE. | ||
179 | */ | ||
180 | #if !defined(CH_CFG_USE_WAITEXIT) | ||
181 | #define CH_CFG_USE_WAITEXIT TRUE | ||
182 | #endif | ||
183 | |||
184 | /** | ||
185 | * @brief Semaphores APIs. | ||
186 | * @details If enabled then the Semaphores APIs are included in the kernel. | ||
187 | * | ||
188 | * @note The default is @p TRUE. | ||
189 | */ | ||
190 | #if !defined(CH_CFG_USE_SEMAPHORES) | ||
191 | #define CH_CFG_USE_SEMAPHORES TRUE | ||
192 | #endif | ||
193 | |||
194 | /** | ||
195 | * @brief Semaphores queuing mode. | ||
196 | * @details If enabled then the threads are enqueued on semaphores by | ||
197 | * priority rather than in FIFO order. | ||
198 | * | ||
199 | * @note The default is @p FALSE. Enable this if you have special | ||
200 | * requirements. | ||
201 | * @note Requires @p CH_CFG_USE_SEMAPHORES. | ||
202 | */ | ||
203 | #if !defined(CH_CFG_USE_SEMAPHORES_PRIORITY) | ||
204 | #define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE | ||
205 | #endif | ||
206 | |||
207 | /** | ||
208 | * @brief Mutexes APIs. | ||
209 | * @details If enabled then the mutexes APIs are included in the kernel. | ||
210 | * | ||
211 | * @note The default is @p TRUE. | ||
212 | */ | ||
213 | #if !defined(CH_CFG_USE_MUTEXES) | ||
214 | #define CH_CFG_USE_MUTEXES TRUE | ||
215 | #endif | ||
216 | |||
217 | /** | ||
218 | * @brief Enables recursive behavior on mutexes. | ||
219 | * @note Recursive mutexes are heavier and have an increased | ||
220 | * memory footprint. | ||
221 | * | ||
222 | * @note The default is @p FALSE. | ||
223 | * @note Requires @p CH_CFG_USE_MUTEXES. | ||
224 | */ | ||
225 | #if !defined(CH_CFG_USE_MUTEXES_RECURSIVE) | ||
226 | #define CH_CFG_USE_MUTEXES_RECURSIVE FALSE | ||
227 | #endif | ||
228 | |||
229 | /** | ||
230 | * @brief Conditional Variables APIs. | ||
231 | * @details If enabled then the conditional variables APIs are included | ||
232 | * in the kernel. | ||
233 | * | ||
234 | * @note The default is @p TRUE. | ||
235 | * @note Requires @p CH_CFG_USE_MUTEXES. | ||
236 | */ | ||
237 | #if !defined(CH_CFG_USE_CONDVARS) | ||
238 | #define CH_CFG_USE_CONDVARS TRUE | ||
239 | #endif | ||
240 | |||
241 | /** | ||
242 | * @brief Conditional Variables APIs with timeout. | ||
243 | * @details If enabled then the conditional variables APIs with timeout | ||
244 | * specification are included in the kernel. | ||
245 | * | ||
246 | * @note The default is @p TRUE. | ||
247 | * @note Requires @p CH_CFG_USE_CONDVARS. | ||
248 | */ | ||
249 | #if !defined(CH_CFG_USE_CONDVARS_TIMEOUT) | ||
250 | #define CH_CFG_USE_CONDVARS_TIMEOUT TRUE | ||
251 | #endif | ||
252 | |||
253 | /** | ||
254 | * @brief Events Flags APIs. | ||
255 | * @details If enabled then the event flags APIs are included in the kernel. | ||
256 | * | ||
257 | * @note The default is @p TRUE. | ||
258 | */ | ||
259 | #if !defined(CH_CFG_USE_EVENTS) | ||
260 | #define CH_CFG_USE_EVENTS TRUE | ||
261 | #endif | ||
262 | |||
263 | /** | ||
264 | * @brief Events Flags APIs with timeout. | ||
265 | * @details If enabled then the events APIs with timeout specification | ||
266 | * are included in the kernel. | ||
267 | * | ||
268 | * @note The default is @p TRUE. | ||
269 | * @note Requires @p CH_CFG_USE_EVENTS. | ||
270 | */ | ||
271 | #if !defined(CH_CFG_USE_EVENTS_TIMEOUT) | ||
272 | #define CH_CFG_USE_EVENTS_TIMEOUT TRUE | ||
273 | #endif | ||
274 | |||
275 | /** | ||
276 | * @brief Synchronous Messages APIs. | ||
277 | * @details If enabled then the synchronous messages APIs are included | ||
278 | * in the kernel. | ||
279 | * | ||
280 | * @note The default is @p TRUE. | ||
281 | */ | ||
282 | #if !defined(CH_CFG_USE_MESSAGES) | ||
283 | #define CH_CFG_USE_MESSAGES TRUE | ||
284 | #endif | ||
285 | |||
286 | /** | ||
287 | * @brief Synchronous Messages queuing mode. | ||
288 | * @details If enabled then messages are served by priority rather than in | ||
289 | * FIFO order. | ||
290 | * | ||
291 | * @note The default is @p FALSE. Enable this if you have special | ||
292 | * requirements. | ||
293 | * @note Requires @p CH_CFG_USE_MESSAGES. | ||
294 | */ | ||
295 | #if !defined(CH_CFG_USE_MESSAGES_PRIORITY) | ||
296 | #define CH_CFG_USE_MESSAGES_PRIORITY FALSE | ||
297 | #endif | ||
298 | |||
299 | /** | ||
300 | * @brief Dynamic Threads APIs. | ||
301 | * @details If enabled then the dynamic threads creation APIs are included | ||
302 | * in the kernel. | ||
303 | * | ||
304 | * @note The default is @p TRUE. | ||
305 | * @note Requires @p CH_CFG_USE_WAITEXIT. | ||
306 | * @note Requires @p CH_CFG_USE_HEAP and/or @p CH_CFG_USE_MEMPOOLS. | ||
307 | */ | ||
308 | #if !defined(CH_CFG_USE_DYNAMIC) | ||
309 | #define CH_CFG_USE_DYNAMIC TRUE | ||
310 | #endif | ||
311 | |||
312 | /** @} */ | ||
313 | |||
314 | /*===========================================================================*/ | ||
315 | /** | ||
316 | * @name OSLIB options | ||
317 | * @{ | ||
318 | */ | ||
319 | /*===========================================================================*/ | ||
320 | |||
321 | /** | ||
322 | * @brief Mailboxes APIs. | ||
323 | * @details If enabled then the asynchronous messages (mailboxes) APIs are | ||
324 | * included in the kernel. | ||
325 | * | ||
326 | * @note The default is @p TRUE. | ||
327 | * @note Requires @p CH_CFG_USE_SEMAPHORES. | ||
328 | */ | ||
329 | #if !defined(CH_CFG_USE_MAILBOXES) | ||
330 | #define CH_CFG_USE_MAILBOXES TRUE | ||
331 | #endif | ||
332 | |||
333 | /** | ||
334 | * @brief Core Memory Manager APIs. | ||
335 | * @details If enabled then the core memory manager APIs are included | ||
336 | * in the kernel. | ||
337 | * | ||
338 | * @note The default is @p TRUE. | ||
339 | */ | ||
340 | #if !defined(CH_CFG_USE_MEMCORE) | ||
341 | #define CH_CFG_USE_MEMCORE TRUE | ||
342 | #endif | ||
343 | |||
344 | /** | ||
345 | * @brief Managed RAM size. | ||
346 | * @details Size of the RAM area to be managed by the OS. If set to zero | ||
347 | * then the whole available RAM is used. The core memory is made | ||
348 | * available to the heap allocator and/or can be used directly through | ||
349 | * the simplified core memory allocator. | ||
350 | * | ||
351 | * @note In order to let the OS manage the whole RAM the linker script must | ||
352 | * provide the @p __heap_base__ and @p __heap_end__ symbols. | ||
353 | * @note Requires @p CH_CFG_USE_MEMCORE. | ||
354 | */ | ||
355 | #if !defined(CH_CFG_MEMCORE_SIZE) | ||
356 | #define CH_CFG_MEMCORE_SIZE 0 | ||
357 | #endif | ||
358 | |||
359 | /** | ||
360 | * @brief Heap Allocator APIs. | ||
361 | * @details If enabled then the memory heap allocator APIs are included | ||
362 | * in the kernel. | ||
363 | * | ||
364 | * @note The default is @p TRUE. | ||
365 | * @note Requires @p CH_CFG_USE_MEMCORE and either @p CH_CFG_USE_MUTEXES or | ||
366 | * @p CH_CFG_USE_SEMAPHORES. | ||
367 | * @note Mutexes are recommended. | ||
368 | */ | ||
369 | #if !defined(CH_CFG_USE_HEAP) | ||
370 | #define CH_CFG_USE_HEAP TRUE | ||
371 | #endif | ||
372 | |||
373 | /** | ||
374 | * @brief Memory Pools Allocator APIs. | ||
375 | * @details If enabled then the memory pools allocator APIs are included | ||
376 | * in the kernel. | ||
377 | * | ||
378 | * @note The default is @p TRUE. | ||
379 | */ | ||
380 | #if !defined(CH_CFG_USE_MEMPOOLS) | ||
381 | #define CH_CFG_USE_MEMPOOLS TRUE | ||
382 | #endif | ||
383 | |||
384 | /** | ||
385 | * @brief Objects FIFOs APIs. | ||
386 | * @details If enabled then the objects FIFOs APIs are included | ||
387 | * in the kernel. | ||
388 | * | ||
389 | * @note The default is @p TRUE. | ||
390 | */ | ||
391 | #if !defined(CH_CFG_USE_OBJ_FIFOS) | ||
392 | #define CH_CFG_USE_OBJ_FIFOS TRUE | ||
393 | #endif | ||
394 | |||
395 | /** | ||
396 | * @brief Pipes APIs. | ||
397 | * @details If enabled then the pipes APIs are included | ||
398 | * in the kernel. | ||
399 | * | ||
400 | * @note The default is @p TRUE. | ||
401 | */ | ||
402 | #if !defined(CH_CFG_USE_PIPES) | ||
403 | #define CH_CFG_USE_PIPES TRUE | ||
404 | #endif | ||
405 | |||
406 | /** | ||
407 | * @brief Objects Caches APIs. | ||
408 | * @details If enabled then the objects caches APIs are included | ||
409 | * in the kernel. | ||
410 | * | ||
411 | * @note The default is @p TRUE. | ||
412 | */ | ||
413 | #if !defined(CH_CFG_USE_OBJ_CACHES) | ||
414 | #define CH_CFG_USE_OBJ_CACHES TRUE | ||
415 | #endif | ||
416 | |||
417 | /** | ||
418 | * @brief Delegate threads APIs. | ||
419 | * @details If enabled then the delegate threads APIs are included | ||
420 | * in the kernel. | ||
421 | * | ||
422 | * @note The default is @p TRUE. | ||
423 | */ | ||
424 | #if !defined(CH_CFG_USE_DELEGATES) | ||
425 | #define CH_CFG_USE_DELEGATES TRUE | ||
426 | #endif | ||
427 | |||
428 | /** | ||
429 | * @brief Jobs Queues APIs. | ||
430 | * @details If enabled then the jobs queues APIs are included | ||
431 | * in the kernel. | ||
432 | * | ||
433 | * @note The default is @p TRUE. | ||
434 | */ | ||
435 | #if !defined(CH_CFG_USE_JOBS) | ||
436 | #define CH_CFG_USE_JOBS TRUE | ||
437 | #endif | ||
438 | |||
439 | /** @} */ | ||
440 | |||
441 | /*===========================================================================*/ | ||
442 | /** | ||
443 | * @name Objects factory options | ||
444 | * @{ | ||
445 | */ | ||
446 | /*===========================================================================*/ | ||
447 | |||
448 | /** | ||
449 | * @brief Objects Factory APIs. | ||
450 | * @details If enabled then the objects factory APIs are included in the | ||
451 | * kernel. | ||
452 | * | ||
453 | * @note The default is @p FALSE. | ||
454 | */ | ||
455 | #if !defined(CH_CFG_USE_FACTORY) | ||
456 | #define CH_CFG_USE_FACTORY TRUE | ||
457 | #endif | ||
458 | |||
459 | /** | ||
460 | * @brief Maximum length for object names. | ||
461 | * @details If the specified length is zero then the name is stored by | ||
462 | * pointer but this could have unintended side effects. | ||
463 | */ | ||
464 | #if !defined(CH_CFG_FACTORY_MAX_NAMES_LENGTH) | ||
465 | #define CH_CFG_FACTORY_MAX_NAMES_LENGTH 8 | ||
466 | #endif | ||
467 | |||
468 | /** | ||
469 | * @brief Enables the registry of generic objects. | ||
470 | */ | ||
471 | #if !defined(CH_CFG_FACTORY_OBJECTS_REGISTRY) | ||
472 | #define CH_CFG_FACTORY_OBJECTS_REGISTRY TRUE | ||
473 | #endif | ||
474 | |||
475 | /** | ||
476 | * @brief Enables factory for generic buffers. | ||
477 | */ | ||
478 | #if !defined(CH_CFG_FACTORY_GENERIC_BUFFERS) | ||
479 | #define CH_CFG_FACTORY_GENERIC_BUFFERS TRUE | ||
480 | #endif | ||
481 | |||
482 | /** | ||
483 | * @brief Enables factory for semaphores. | ||
484 | */ | ||
485 | #if !defined(CH_CFG_FACTORY_SEMAPHORES) | ||
486 | #define CH_CFG_FACTORY_SEMAPHORES TRUE | ||
487 | #endif | ||
488 | |||
489 | /** | ||
490 | * @brief Enables factory for mailboxes. | ||
491 | */ | ||
492 | #if !defined(CH_CFG_FACTORY_MAILBOXES) | ||
493 | #define CH_CFG_FACTORY_MAILBOXES TRUE | ||
494 | #endif | ||
495 | |||
496 | /** | ||
497 | * @brief Enables factory for objects FIFOs. | ||
498 | */ | ||
499 | #if !defined(CH_CFG_FACTORY_OBJ_FIFOS) | ||
500 | #define CH_CFG_FACTORY_OBJ_FIFOS TRUE | ||
501 | #endif | ||
502 | |||
503 | /** | ||
504 | * @brief Enables factory for Pipes. | ||
505 | */ | ||
506 | #if !defined(CH_CFG_FACTORY_PIPES) || defined(__DOXYGEN__) | ||
507 | #define CH_CFG_FACTORY_PIPES TRUE | ||
508 | #endif | ||
509 | |||
510 | /** @} */ | ||
511 | |||
512 | /*===========================================================================*/ | ||
513 | /** | ||
514 | * @name Debug options | ||
515 | * @{ | ||
516 | */ | ||
517 | /*===========================================================================*/ | ||
518 | |||
519 | /** | ||
520 | * @brief Debug option, kernel statistics. | ||
521 | * | ||
522 | * @note The default is @p FALSE. | ||
523 | */ | ||
524 | #if !defined(CH_DBG_STATISTICS) | ||
525 | #define CH_DBG_STATISTICS FALSE | ||
526 | #endif | ||
527 | |||
528 | /** | ||
529 | * @brief Debug option, system state check. | ||
530 | * @details If enabled the correct call protocol for system APIs is checked | ||
531 | * at runtime. | ||
532 | * | ||
533 | * @note The default is @p FALSE. | ||
534 | */ | ||
535 | #if !defined(CH_DBG_SYSTEM_STATE_CHECK) | ||
536 | #define CH_DBG_SYSTEM_STATE_CHECK FALSE | ||
537 | #endif | ||
538 | |||
539 | /** | ||
540 | * @brief Debug option, parameters checks. | ||
541 | * @details If enabled then the checks on the API functions input | ||
542 | * parameters are activated. | ||
543 | * | ||
544 | * @note The default is @p FALSE. | ||
545 | */ | ||
546 | #if !defined(CH_DBG_ENABLE_CHECKS) | ||
547 | #define CH_DBG_ENABLE_CHECKS FALSE | ||
548 | #endif | ||
549 | |||
550 | /** | ||
551 | * @brief Debug option, consistency checks. | ||
552 | * @details If enabled then all the assertions in the kernel code are | ||
553 | * activated. This includes consistency checks inside the kernel, | ||
554 | * runtime anomalies and port-defined checks. | ||
555 | * | ||
556 | * @note The default is @p FALSE. | ||
557 | */ | ||
558 | #if !defined(CH_DBG_ENABLE_ASSERTS) | ||
559 | #define CH_DBG_ENABLE_ASSERTS FALSE | ||
560 | #endif | ||
561 | |||
562 | /** | ||
563 | * @brief Debug option, trace buffer. | ||
564 | * @details If enabled then the trace buffer is activated. | ||
565 | * | ||
566 | * @note The default is @p CH_DBG_TRACE_MASK_DISABLED. | ||
567 | */ | ||
568 | #if !defined(CH_DBG_TRACE_MASK) | ||
569 | #define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED | ||
570 | #endif | ||
571 | |||
572 | /** | ||
573 | * @brief Trace buffer entries. | ||
574 | * @note The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is | ||
575 | * different from @p CH_DBG_TRACE_MASK_DISABLED. | ||
576 | */ | ||
577 | #if !defined(CH_DBG_TRACE_BUFFER_SIZE) | ||
578 | #define CH_DBG_TRACE_BUFFER_SIZE 128 | ||
579 | #endif | ||
580 | |||
581 | /** | ||
582 | * @brief Debug option, stack checks. | ||
583 | * @details If enabled then a runtime stack check is performed. | ||
584 | * | ||
585 | * @note The default is @p FALSE. | ||
586 | * @note The stack check is performed in a architecture/port dependent way. | ||
587 | * It may not be implemented or some ports. | ||
588 | * @note The default failure mode is to halt the system with the global | ||
589 | * @p panic_msg variable set to @p NULL. | ||
590 | */ | ||
591 | #if !defined(CH_DBG_ENABLE_STACK_CHECK) | ||
592 | #define CH_DBG_ENABLE_STACK_CHECK FALSE | ||
593 | #endif | ||
594 | |||
595 | /** | ||
596 | * @brief Debug option, stacks initialization. | ||
597 | * @details If enabled then the threads working area is filled with a byte | ||
598 | * value when a thread is created. This can be useful for the | ||
599 | * runtime measurement of the used stack. | ||
600 | * | ||
601 | * @note The default is @p FALSE. | ||
602 | */ | ||
603 | #if !defined(CH_DBG_FILL_THREADS) | ||
604 | #define CH_DBG_FILL_THREADS FALSE | ||
605 | #endif | ||
606 | |||
607 | /** | ||
608 | * @brief Debug option, threads profiling. | ||
609 | * @details If enabled then a field is added to the @p thread_t structure that | ||
610 | * counts the system ticks occurred while executing the thread. | ||
611 | * | ||
612 | * @note The default is @p FALSE. | ||
613 | * @note This debug option is not currently compatible with the | ||
614 | * tickless mode. | ||
615 | */ | ||
616 | #if !defined(CH_DBG_THREADS_PROFILING) | ||
617 | #define CH_DBG_THREADS_PROFILING FALSE | ||
618 | #endif | ||
619 | |||
620 | /** @} */ | ||
621 | |||
622 | /*===========================================================================*/ | ||
623 | /** | ||
624 | * @name Kernel hooks | ||
625 | * @{ | ||
626 | */ | ||
627 | /*===========================================================================*/ | ||
628 | |||
629 | /** | ||
630 | * @brief System structure extension. | ||
631 | * @details User fields added to the end of the @p ch_system_t structure. | ||
632 | */ | ||
633 | #define CH_CFG_SYSTEM_EXTRA_FIELDS \ | ||
634 | /* Add threads custom fields here.*/ | ||
635 | |||
636 | /** | ||
637 | * @brief System initialization hook. | ||
638 | * @details User initialization code added to the @p chSysInit() function | ||
639 | * just before interrupts are enabled globally. | ||
640 | */ | ||
641 | #define CH_CFG_SYSTEM_INIT_HOOK() { \ | ||
642 | /* Add threads initialization code here.*/ \ | ||
643 | } | ||
644 | |||
645 | /** | ||
646 | * @brief Threads descriptor structure extension. | ||
647 | * @details User fields added to the end of the @p thread_t structure. | ||
648 | */ | ||
649 | #define CH_CFG_THREAD_EXTRA_FIELDS \ | ||
650 | /* Add threads custom fields here.*/ | ||
651 | |||
652 | /** | ||
653 | * @brief Threads initialization hook. | ||
654 | * @details User initialization code added to the @p _thread_init() function. | ||
655 | * | ||
656 | * @note It is invoked from within @p _thread_init() and implicitly from all | ||
657 | * the threads creation APIs. | ||
658 | */ | ||
659 | #define CH_CFG_THREAD_INIT_HOOK(tp) { \ | ||
660 | /* Add threads initialization code here.*/ \ | ||
661 | } | ||
662 | |||
663 | /** | ||
664 | * @brief Threads finalization hook. | ||
665 | * @details User finalization code added to the @p chThdExit() API. | ||
666 | */ | ||
667 | #define CH_CFG_THREAD_EXIT_HOOK(tp) { \ | ||
668 | /* Add threads finalization code here.*/ \ | ||
669 | } | ||
670 | |||
671 | /** | ||
672 | * @brief Context switch hook. | ||
673 | * @details This hook is invoked just before switching between threads. | ||
674 | */ | ||
675 | #define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) { \ | ||
676 | /* Context switch code here.*/ \ | ||
677 | } | ||
678 | |||
679 | /** | ||
680 | * @brief ISR enter hook. | ||
681 | */ | ||
682 | #define CH_CFG_IRQ_PROLOGUE_HOOK() { \ | ||
683 | /* IRQ prologue code here.*/ \ | ||
684 | } | ||
685 | |||
686 | /** | ||
687 | * @brief ISR exit hook. | ||
688 | */ | ||
689 | #define CH_CFG_IRQ_EPILOGUE_HOOK() { \ | ||
690 | /* IRQ epilogue code here.*/ \ | ||
691 | } | ||
692 | |||
693 | /** | ||
694 | * @brief Idle thread enter hook. | ||
695 | * @note This hook is invoked within a critical zone, no OS functions | ||
696 | * should be invoked from here. | ||
697 | * @note This macro can be used to activate a power saving mode. | ||
698 | */ | ||
699 | #define CH_CFG_IDLE_ENTER_HOOK() { \ | ||
700 | /* Idle-enter code here.*/ \ | ||
701 | } | ||
702 | |||
703 | /** | ||
704 | * @brief Idle thread leave hook. | ||
705 | * @note This hook is invoked within a critical zone, no OS functions | ||
706 | * should be invoked from here. | ||
707 | * @note This macro can be used to deactivate a power saving mode. | ||
708 | */ | ||
709 | #define CH_CFG_IDLE_LEAVE_HOOK() { \ | ||
710 | /* Idle-leave code here.*/ \ | ||
711 | } | ||
712 | |||
713 | /** | ||
714 | * @brief Idle Loop hook. | ||
715 | * @details This hook is continuously invoked by the idle thread loop. | ||
716 | */ | ||
717 | #define CH_CFG_IDLE_LOOP_HOOK() { \ | ||
718 | /* Idle loop code here.*/ \ | ||
719 | } | ||
720 | |||
721 | /** | ||
722 | * @brief System tick event hook. | ||
723 | * @details This hook is invoked in the system tick handler immediately | ||
724 | * after processing the virtual timers queue. | ||
725 | */ | ||
726 | #define CH_CFG_SYSTEM_TICK_HOOK() { \ | ||
727 | /* System tick event code here.*/ \ | ||
728 | } | ||
729 | |||
730 | /** | ||
731 | * @brief System halt hook. | ||
732 | * @details This hook is invoked in case to a system halting error before | ||
733 | * the system is halted. | ||
734 | */ | ||
735 | #define CH_CFG_SYSTEM_HALT_HOOK(reason) { \ | ||
736 | /* System halt code here.*/ \ | ||
737 | } | ||
738 | |||
739 | /** | ||
740 | * @brief Trace hook. | ||
741 | * @details This hook is invoked each time a new record is written in the | ||
742 | * trace buffer. | ||
743 | */ | ||
744 | #define CH_CFG_TRACE_HOOK(tep) { \ | ||
745 | /* Trace code here.*/ \ | ||
746 | } | ||
747 | |||
748 | /** @} */ | ||
749 | |||
750 | /*===========================================================================*/ | ||
751 | /* Port-specific settings (override port settings defaulted in chcore.h). */ | ||
752 | /*===========================================================================*/ | ||
753 | |||
754 | #endif /* CHCONF_H */ | ||
755 | |||
756 | /** @} */ | ||
diff --git a/lib/chibios/demos/STM32/RT-STM32F107-OLIMEX_P107-LWIP/cfg/ffconf.h b/lib/chibios/demos/STM32/RT-STM32F107-OLIMEX_P107-LWIP/cfg/ffconf.h new file mode 100644 index 000000000..18af4c94e --- /dev/null +++ b/lib/chibios/demos/STM32/RT-STM32F107-OLIMEX_P107-LWIP/cfg/ffconf.h | |||
@@ -0,0 +1,272 @@ | |||
1 | /* CHIBIOS FIX */ | ||
2 | #include "ch.h" | ||
3 | |||
4 | /*---------------------------------------------------------------------------/ | ||
5 | / FatFs - Configuration file | ||
6 | /---------------------------------------------------------------------------*/ | ||
7 | |||
8 | #define FFCONF_DEF 87030 /* Revision ID */ | ||
9 | |||
10 | /*---------------------------------------------------------------------------/ | ||
11 | / Function Configurations | ||
12 | /---------------------------------------------------------------------------*/ | ||
13 | |||
14 | #define FF_FS_READONLY 0 | ||
15 | /* This option switches read-only configuration. (0:Read/Write or 1:Read-only) | ||
16 | / Read-only configuration removes writing API functions, f_write(), f_sync(), | ||
17 | / f_unlink(), f_mkdir(), f_chmod(), f_rename(), f_truncate(), f_getfree() | ||
18 | / and optional writing functions as well. */ | ||
19 | |||
20 | |||
21 | #define FF_FS_MINIMIZE 0 | ||
22 | /* This option defines minimization level to remove some basic API functions. | ||
23 | / | ||
24 | / 0: All basic functions are enabled. | ||
25 | / 1: f_stat(), f_getfree(), f_unlink(), f_mkdir(), f_truncate() and f_rename() | ||
26 | / are removed. | ||
27 | / 2: f_opendir(), f_readdir() and f_closedir() are removed in addition to 1. | ||
28 | / 3: f_lseek() function is removed in addition to 2. */ | ||
29 | |||
30 | |||
31 | #define FF_USE_STRFUNC 0 | ||
32 | /* This option switches string functions, f_gets(), f_putc(), f_puts() and f_printf(). | ||
33 | / | ||
34 | / 0: Disable string functions. | ||
35 | / 1: Enable without LF-CRLF conversion. | ||
36 | / 2: Enable with LF-CRLF conversion. */ | ||
37 | |||
38 | |||
39 | #define FF_USE_FIND 0 | ||
40 | /* This option switches filtered directory read functions, f_findfirst() and | ||
41 | / f_findnext(). (0:Disable, 1:Enable 2:Enable with matching altname[] too) */ | ||
42 | |||
43 | |||
44 | #define FF_USE_MKFS 0 | ||
45 | /* This option switches f_mkfs() function. (0:Disable or 1:Enable) */ | ||
46 | |||
47 | |||
48 | #define FF_USE_FASTSEEK 0 | ||
49 | /* This option switches fast seek function. (0:Disable or 1:Enable) */ | ||
50 | |||
51 | |||
52 | #define FF_USE_EXPAND 0 | ||
53 | /* This option switches f_expand function. (0:Disable or 1:Enable) */ | ||
54 | |||
55 | |||
56 | #define FF_USE_CHMOD 0 | ||
57 | /* This option switches attribute manipulation functions, f_chmod() and f_utime(). | ||
58 | / (0:Disable or 1:Enable) Also FF_FS_READONLY needs to be 0 to enable this option. */ | ||
59 | |||
60 | |||
61 | #define FF_USE_LABEL 0 | ||
62 | /* This option switches volume label functions, f_getlabel() and f_setlabel(). | ||
63 | / (0:Disable or 1:Enable) */ | ||
64 | |||
65 | |||
66 | #define FF_USE_FORWARD 0 | ||
67 | /* This option switches f_forward() function. (0:Disable or 1:Enable) */ | ||
68 | |||
69 | |||
70 | /*---------------------------------------------------------------------------/ | ||
71 | / Locale and Namespace Configurations | ||
72 | /---------------------------------------------------------------------------*/ | ||
73 | |||
74 | #define FF_CODE_PAGE 850 | ||
75 | /* This option specifies the OEM code page to be used on the target system. | ||
76 | / Incorrect code page setting can cause a file open failure. | ||
77 | / | ||
78 | / 437 - U.S. | ||
79 | / 720 - Arabic | ||
80 | / 737 - Greek | ||
81 | / 771 - KBL | ||
82 | / 775 - Baltic | ||
83 | / 850 - Latin 1 | ||
84 | / 852 - Latin 2 | ||
85 | / 855 - Cyrillic | ||
86 | / 857 - Turkish | ||
87 | / 860 - Portuguese | ||
88 | / 861 - Icelandic | ||
89 | / 862 - Hebrew | ||
90 | / 863 - Canadian French | ||
91 | / 864 - Arabic | ||
92 | / 865 - Nordic | ||
93 | / 866 - Russian | ||
94 | / 869 - Greek 2 | ||
95 | / 932 - Japanese (DBCS) | ||
96 | / 936 - Simplified Chinese (DBCS) | ||
97 | / 949 - Korean (DBCS) | ||
98 | / 950 - Traditional Chinese (DBCS) | ||
99 | / 0 - Include all code pages above and configured by f_setcp() | ||
100 | */ | ||
101 | |||
102 | |||
103 | #define FF_USE_LFN 3 | ||
104 | #define FF_MAX_LFN 255 | ||
105 | /* The FF_USE_LFN switches the support for LFN (long file name). | ||
106 | / | ||
107 | / 0: Disable LFN. FF_MAX_LFN has no effect. | ||
108 | / 1: Enable LFN with static working buffer on the BSS. Always NOT thread-safe. | ||
109 | / 2: Enable LFN with dynamic working buffer on the STACK. | ||
110 | / 3: Enable LFN with dynamic working buffer on the HEAP. | ||
111 | / | ||
112 | / To enable the LFN, Unicode handling functions (option/unicode.c) must be added | ||
113 | / to the project. The working buffer occupies (FF_MAX_LFN + 1) * 2 bytes and | ||
114 | / additional 608 bytes at exFAT enabled. FF_MAX_LFN can be in range from 12 to 255. | ||
115 | / It should be set 255 to support full featured LFN operations. | ||
116 | / When use stack for the working buffer, take care on stack overflow. When use heap | ||
117 | / memory for the working buffer, memory management functions, ff_memalloc() and | ||
118 | / ff_memfree(), must be added to the project. */ | ||
119 | |||
120 | |||
121 | #define FF_LFN_UNICODE 0 | ||
122 | /* This option switches character encoding on the API, 0:ANSI/OEM or 1:UTF-16, | ||
123 | / when LFN is enabled. Also behavior of string I/O functions will be affected by | ||
124 | / this option. When LFN is not enabled, this option has no effect. | ||
125 | */ | ||
126 | |||
127 | |||
128 | #define FF_STRF_ENCODE 3 | ||
129 | /* When FF_LFN_UNICODE = 1 with LFN enabled, string I/O functions, f_gets(), | ||
130 | / f_putc(), f_puts and f_printf() convert the character encoding in it. | ||
131 | / This option selects assumption of character encoding ON THE FILE to be | ||
132 | / read/written via those functions. | ||
133 | / | ||
134 | / 0: ANSI/OEM | ||
135 | / 1: UTF-16LE | ||
136 | / 2: UTF-16BE | ||
137 | / 3: UTF-8 | ||
138 | */ | ||
139 | |||
140 | |||
141 | #define FF_FS_RPATH 0 | ||
142 | /* This option configures support for relative path. | ||
143 | / | ||
144 | / 0: Disable relative path and remove related functions. | ||
145 | / 1: Enable relative path. f_chdir() and f_chdrive() are available. | ||
146 | / 2: f_getcwd() function is available in addition to 1. | ||
147 | */ | ||
148 | |||
149 | |||
150 | /*---------------------------------------------------------------------------/ | ||
151 | / Drive/Volume Configurations | ||
152 | /---------------------------------------------------------------------------*/ | ||
153 | |||
154 | #define FF_VOLUMES 1 | ||
155 | /* Number of volumes (logical drives) to be used. (1-10) */ | ||
156 | |||
157 | |||
158 | #define FF_STR_VOLUME_ID 0 | ||
159 | #define FF_VOLUME_STRS "RAM","NAND","CF","SD","SD2","USB","USB2","USB3" | ||
160 | /* FF_STR_VOLUME_ID switches string support for volume ID. | ||
161 | / When FF_STR_VOLUME_ID is set to 1, also pre-defined strings can be used as drive | ||
162 | / number in the path name. FF_VOLUME_STRS defines the drive ID strings for each | ||
163 | / logical drives. Number of items must be equal to FF_VOLUMES. Valid characters for | ||
164 | / the drive ID strings are: A-Z and 0-9. */ | ||
165 | |||
166 | |||
167 | #define FF_MULTI_PARTITION 0 | ||
168 | /* This option switches support for multiple volumes on the physical drive. | ||
169 | / By default (0), each logical drive number is bound to the same physical drive | ||
170 | / number and only an FAT volume found on the physical drive will be mounted. | ||
171 | / When this function is enabled (1), each logical drive number can be bound to | ||
172 | / arbitrary physical drive and partition listed in the VolToPart[]. Also f_fdisk() | ||
173 | / funciton will be available. */ | ||
174 | |||
175 | |||
176 | #define FF_MIN_SS 512 | ||
177 | #define FF_MAX_SS 512 | ||
178 | /* This set of options configures the range of sector size to be supported. (512, | ||
179 | / 1024, 2048 or 4096) Always set both 512 for most systems, generic memory card and | ||
180 | / harddisk. But a larger value may be required for on-board flash memory and some | ||
181 | / type of optical media. When FF_MAX_SS is larger than FF_MIN_SS, FatFs is configured | ||
182 | / for variable sector size mode and disk_ioctl() function needs to implement | ||
183 | / GET_SECTOR_SIZE command. */ | ||
184 | |||
185 | |||
186 | #define FF_USE_TRIM 0 | ||
187 | /* This option switches support for ATA-TRIM. (0:Disable or 1:Enable) | ||
188 | / To enable Trim function, also CTRL_TRIM command should be implemented to the | ||
189 | / disk_ioctl() function. */ | ||
190 | |||
191 | |||
192 | #define FF_FS_NOFSINFO 0 | ||
193 | /* If you need to know correct free space on the FAT32 volume, set bit 0 of this | ||
194 | / option, and f_getfree() function at first time after volume mount will force | ||
195 | / a full FAT scan. Bit 1 controls the use of last allocated cluster number. | ||
196 | / | ||
197 | / bit0=0: Use free cluster count in the FSINFO if available. | ||
198 | / bit0=1: Do not trust free cluster count in the FSINFO. | ||
199 | / bit1=0: Use last allocated cluster number in the FSINFO if available. | ||
200 | / bit1=1: Do not trust last allocated cluster number in the FSINFO. | ||
201 | */ | ||
202 | |||
203 | |||
204 | |||
205 | /*---------------------------------------------------------------------------/ | ||
206 | / System Configurations | ||
207 | /---------------------------------------------------------------------------*/ | ||
208 | |||
209 | #define FF_FS_TINY 0 | ||
210 | /* This option switches tiny buffer configuration. (0:Normal or 1:Tiny) | ||
211 | / At the tiny configuration, size of file object (FIL) is shrinked FF_MAX_SS bytes. | ||
212 | / Instead of private sector buffer eliminated from the file object, common sector | ||
213 | / buffer in the filesystem object (FATFS) is used for the file data transfer. */ | ||
214 | |||
215 | |||
216 | #define FF_FS_EXFAT 1 | ||
217 | /* This option switches support for exFAT filesystem. (0:Disable or 1:Enable) | ||
218 | / When enable exFAT, also LFN needs to be enabled. | ||
219 | / Note that enabling exFAT discards ANSI C (C89) compatibility. */ | ||
220 | |||
221 | |||
222 | #define FF_FS_NORTC 1 | ||
223 | #define FF_NORTC_MON 5 | ||
224 | #define FF_NORTC_MDAY 1 | ||
225 | #define FF_NORTC_YEAR 2017 | ||
226 | /* The option FF_FS_NORTC switches timestamp functiton. If the system does not have | ||
227 | / any RTC function or valid timestamp is not needed, set FF_FS_NORTC = 1 to disable | ||
228 | / the timestamp function. All objects modified by FatFs will have a fixed timestamp | ||
229 | / defined by FF_NORTC_MON, FF_NORTC_MDAY and FF_NORTC_YEAR in local time. | ||
230 | / To enable timestamp function (FF_FS_NORTC = 0), get_fattime() function need to be | ||
231 | / added to the project to read current time form real-time clock. FF_NORTC_MON, | ||
232 | / FF_NORTC_MDAY and FF_NORTC_YEAR have no effect. | ||
233 | / These options have no effect at read-only configuration (FF_FS_READONLY = 1). */ | ||
234 | |||
235 | |||
236 | #define FF_FS_LOCK 0 | ||
237 | /* The option FF_FS_LOCK switches file lock function to control duplicated file open | ||
238 | / and illegal operation to open objects. This option must be 0 when FF_FS_READONLY | ||
239 | / is 1. | ||
240 | / | ||
241 | / 0: Disable file lock function. To avoid volume corruption, application program | ||
242 | / should avoid illegal open, remove and rename to the open objects. | ||
243 | / >0: Enable file lock function. The value defines how many files/sub-directories | ||
244 | / can be opened simultaneously under file lock control. Note that the file | ||
245 | / lock control is independent of re-entrancy. */ | ||
246 | |||
247 | |||
248 | #define FF_FS_REENTRANT 0 | ||
249 | #define FF_FS_TIMEOUT MS2ST(1000) | ||
250 | #define FF_SYNC_t semaphore_t* | ||
251 | /* The option FF_FS_REENTRANT switches the re-entrancy (thread safe) of the FatFs | ||
252 | / module itself. Note that regardless of this option, file access to different | ||
253 | / volume is always re-entrant and volume control functions, f_mount(), f_mkfs() | ||
254 | / and f_fdisk() function, are always not re-entrant. Only file/directory access | ||
255 | / to the same volume is under control of this function. | ||
256 | / | ||
257 | / 0: Disable re-entrancy. FF_FS_TIMEOUT and FF_SYNC_t have no effect. | ||
258 | / 1: Enable re-entrancy. Also user provided synchronization handlers, | ||
259 | / ff_req_grant(), ff_rel_grant(), ff_del_syncobj() and ff_cre_syncobj() | ||
260 | / function, must be added to the project. Samples are available in | ||
261 | / option/syscall.c. | ||
262 | / | ||
263 | / The FF_FS_TIMEOUT defines timeout period in unit of time tick. | ||
264 | / The FF_SYNC_t defines O/S dependent sync object type. e.g. HANDLE, ID, OS_EVENT*, | ||
265 | / SemaphoreHandle_t and etc. A header file for O/S definitions needs to be | ||
266 | / included somewhere in the scope of ff.h. */ | ||
267 | |||
268 | /* #include <windows.h> // O/S definitions */ | ||
269 | |||
270 | |||
271 | |||
272 | /*--- End of configuration options ---*/ | ||
diff --git a/lib/chibios/demos/STM32/RT-STM32F107-OLIMEX_P107-LWIP/cfg/halconf.h b/lib/chibios/demos/STM32/RT-STM32F107-OLIMEX_P107-LWIP/cfg/halconf.h new file mode 100644 index 000000000..beacb37bb --- /dev/null +++ b/lib/chibios/demos/STM32/RT-STM32F107-OLIMEX_P107-LWIP/cfg/halconf.h | |||
@@ -0,0 +1,531 @@ | |||
1 | /* | ||
2 | ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio | ||
3 | |||
4 | Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | you may not use this file except in compliance with the License. | ||
6 | You may obtain a copy of the License at | ||
7 | |||
8 | http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | |||
10 | Unless required by applicable law or agreed to in writing, software | ||
11 | distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | See the License for the specific language governing permissions and | ||
14 | limitations under the License. | ||
15 | */ | ||
16 | |||
17 | /** | ||
18 | * @file templates/halconf.h | ||
19 | * @brief HAL configuration header. | ||
20 | * @details HAL configuration file, this file allows to enable or disable the | ||
21 | * various device drivers from your application. You may also use | ||
22 | * this file in order to override the device drivers default settings. | ||
23 | * | ||
24 | * @addtogroup HAL_CONF | ||
25 | * @{ | ||
26 | */ | ||
27 | |||
28 | #ifndef HALCONF_H | ||
29 | #define HALCONF_H | ||
30 | |||
31 | #define _CHIBIOS_HAL_CONF_ | ||
32 | #define _CHIBIOS_HAL_CONF_VER_7_1_ | ||
33 | |||
34 | #include "mcuconf.h" | ||
35 | |||
36 | /** | ||
37 | * @brief Enables the PAL subsystem. | ||
38 | */ | ||
39 | #if !defined(HAL_USE_PAL) || defined(__DOXYGEN__) | ||
40 | #define HAL_USE_PAL TRUE | ||
41 | #endif | ||
42 | |||
43 | /** | ||
44 | * @brief Enables the ADC subsystem. | ||
45 | */ | ||
46 | #if !defined(HAL_USE_ADC) || defined(__DOXYGEN__) | ||
47 | #define HAL_USE_ADC FALSE | ||
48 | #endif | ||
49 | |||
50 | /** | ||
51 | * @brief Enables the CAN subsystem. | ||
52 | */ | ||
53 | #if !defined(HAL_USE_CAN) || defined(__DOXYGEN__) | ||
54 | #define HAL_USE_CAN FALSE | ||
55 | #endif | ||
56 | |||
57 | /** | ||
58 | * @brief Enables the cryptographic subsystem. | ||
59 | */ | ||
60 | #if !defined(HAL_USE_CRY) || defined(__DOXYGEN__) | ||
61 | #define HAL_USE_CRY FALSE | ||
62 | #endif | ||
63 | |||
64 | /** | ||
65 | * @brief Enables the DAC subsystem. | ||
66 | */ | ||
67 | #if !defined(HAL_USE_DAC) || defined(__DOXYGEN__) | ||
68 | #define HAL_USE_DAC FALSE | ||
69 | #endif | ||
70 | |||
71 | /** | ||
72 | * @brief Enables the EFlash subsystem. | ||
73 | */ | ||
74 | #if !defined(HAL_USE_EFL) || defined(__DOXYGEN__) | ||
75 | #define HAL_USE_EFL FALSE | ||
76 | #endif | ||
77 | |||
78 | /** | ||
79 | * @brief Enables the GPT subsystem. | ||
80 | */ | ||
81 | #if !defined(HAL_USE_GPT) || defined(__DOXYGEN__) | ||
82 | #define HAL_USE_GPT FALSE | ||
83 | #endif | ||
84 | |||
85 | /** | ||
86 | * @brief Enables the I2C subsystem. | ||
87 | */ | ||
88 | #if !defined(HAL_USE_I2C) || defined(__DOXYGEN__) | ||
89 | #define HAL_USE_I2C FALSE | ||
90 | #endif | ||
91 | |||
92 | /** | ||
93 | * @brief Enables the I2S subsystem. | ||
94 | */ | ||
95 | #if !defined(HAL_USE_I2S) || defined(__DOXYGEN__) | ||
96 | #define HAL_USE_I2S FALSE | ||
97 | #endif | ||
98 | |||
99 | /** | ||
100 | * @brief Enables the ICU subsystem. | ||
101 | */ | ||
102 | #if !defined(HAL_USE_ICU) || defined(__DOXYGEN__) | ||
103 | #define HAL_USE_ICU FALSE | ||
104 | #endif | ||
105 | |||
106 | /** | ||
107 | * @brief Enables the MAC subsystem. | ||
108 | */ | ||
109 | #if !defined(HAL_USE_MAC) || defined(__DOXYGEN__) | ||
110 | #define HAL_USE_MAC TRUE | ||
111 | #endif | ||
112 | |||
113 | /** | ||
114 | * @brief Enables the MMC_SPI subsystem. | ||
115 | */ | ||
116 | #if !defined(HAL_USE_MMC_SPI) || defined(__DOXYGEN__) | ||
117 | #define HAL_USE_MMC_SPI FALSE | ||
118 | #endif | ||
119 | |||
120 | /** | ||
121 | * @brief Enables the PWM subsystem. | ||
122 | */ | ||
123 | #if !defined(HAL_USE_PWM) || defined(__DOXYGEN__) | ||
124 | #define HAL_USE_PWM FALSE | ||
125 | #endif | ||
126 | |||
127 | /** | ||
128 | * @brief Enables the RTC subsystem. | ||
129 | */ | ||
130 | #if !defined(HAL_USE_RTC) || defined(__DOXYGEN__) | ||
131 | #define HAL_USE_RTC FALSE | ||
132 | #endif | ||
133 | |||
134 | /** | ||
135 | * @brief Enables the SDC subsystem. | ||
136 | */ | ||
137 | #if !defined(HAL_USE_SDC) || defined(__DOXYGEN__) | ||
138 | #define HAL_USE_SDC FALSE | ||
139 | #endif | ||
140 | |||
141 | /** | ||
142 | * @brief Enables the SERIAL subsystem. | ||
143 | */ | ||
144 | #if !defined(HAL_USE_SERIAL) || defined(__DOXYGEN__) | ||
145 | #define HAL_USE_SERIAL TRUE | ||
146 | #endif | ||
147 | |||
148 | /** | ||
149 | * @brief Enables the SERIAL over USB subsystem. | ||
150 | */ | ||
151 | #if !defined(HAL_USE_SERIAL_USB) || defined(__DOXYGEN__) | ||
152 | #define HAL_USE_SERIAL_USB FALSE | ||
153 | #endif | ||
154 | |||
155 | /** | ||
156 | * @brief Enables the SIO subsystem. | ||
157 | */ | ||
158 | #if !defined(HAL_USE_SIO) || defined(__DOXYGEN__) | ||
159 | #define HAL_USE_SIO FALSE | ||
160 | #endif | ||
161 | |||
162 | /** | ||
163 | * @brief Enables the SPI subsystem. | ||
164 | */ | ||
165 | #if !defined(HAL_USE_SPI) || defined(__DOXYGEN__) | ||
166 | #define HAL_USE_SPI FALSE | ||
167 | #endif | ||
168 | |||
169 | /** | ||
170 | * @brief Enables the TRNG subsystem. | ||
171 | */ | ||
172 | #if !defined(HAL_USE_TRNG) || defined(__DOXYGEN__) | ||
173 | #define HAL_USE_TRNG FALSE | ||
174 | #endif | ||
175 | |||
176 | /** | ||
177 | * @brief Enables the UART subsystem. | ||
178 | */ | ||
179 | #if !defined(HAL_USE_UART) || defined(__DOXYGEN__) | ||
180 | #define HAL_USE_UART FALSE | ||
181 | #endif | ||
182 | |||
183 | /** | ||
184 | * @brief Enables the USB subsystem. | ||
185 | */ | ||
186 | #if !defined(HAL_USE_USB) || defined(__DOXYGEN__) | ||
187 | #define HAL_USE_USB FALSE | ||
188 | #endif | ||
189 | |||
190 | /** | ||
191 | * @brief Enables the WDG subsystem. | ||
192 | */ | ||
193 | #if !defined(HAL_USE_WDG) || defined(__DOXYGEN__) | ||
194 | #define HAL_USE_WDG FALSE | ||
195 | #endif | ||
196 | |||
197 | /** | ||
198 | * @brief Enables the WSPI subsystem. | ||
199 | */ | ||
200 | #if !defined(HAL_USE_WSPI) || defined(__DOXYGEN__) | ||
201 | #define HAL_USE_WSPI FALSE | ||
202 | #endif | ||
203 | |||
204 | /*===========================================================================*/ | ||
205 | /* PAL driver related settings. */ | ||
206 | /*===========================================================================*/ | ||
207 | |||
208 | /** | ||
209 | * @brief Enables synchronous APIs. | ||
210 | * @note Disabling this option saves both code and data space. | ||
211 | */ | ||
212 | #if !defined(PAL_USE_CALLBACKS) || defined(__DOXYGEN__) | ||
213 | #define PAL_USE_CALLBACKS FALSE | ||
214 | #endif | ||
215 | |||
216 | /** | ||
217 | * @brief Enables synchronous APIs. | ||
218 | * @note Disabling this option saves both code and data space. | ||
219 | */ | ||
220 | #if !defined(PAL_USE_WAIT) || defined(__DOXYGEN__) | ||
221 | #define PAL_USE_WAIT FALSE | ||
222 | #endif | ||
223 | |||
224 | /*===========================================================================*/ | ||
225 | /* ADC driver related settings. */ | ||
226 | /*===========================================================================*/ | ||
227 | |||
228 | /** | ||
229 | * @brief Enables synchronous APIs. | ||
230 | * @note Disabling this option saves both code and data space. | ||
231 | */ | ||
232 | #if !defined(ADC_USE_WAIT) || defined(__DOXYGEN__) | ||
233 | #define ADC_USE_WAIT TRUE | ||
234 | #endif | ||
235 | |||
236 | /** | ||
237 | * @brief Enables the @p adcAcquireBus() and @p adcReleaseBus() APIs. | ||
238 | * @note Disabling this option saves both code and data space. | ||
239 | */ | ||
240 | #if !defined(ADC_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) | ||
241 | #define ADC_USE_MUTUAL_EXCLUSION TRUE | ||
242 | #endif | ||
243 | |||
244 | /*===========================================================================*/ | ||
245 | /* CAN driver related settings. */ | ||
246 | /*===========================================================================*/ | ||
247 | |||
248 | /** | ||
249 | * @brief Sleep mode related APIs inclusion switch. | ||
250 | */ | ||
251 | #if !defined(CAN_USE_SLEEP_MODE) || defined(__DOXYGEN__) | ||
252 | #define CAN_USE_SLEEP_MODE TRUE | ||
253 | #endif | ||
254 | |||
255 | /** | ||
256 | * @brief Enforces the driver to use direct callbacks rather than OSAL events. | ||
257 | */ | ||
258 | #if !defined(CAN_ENFORCE_USE_CALLBACKS) || defined(__DOXYGEN__) | ||
259 | #define CAN_ENFORCE_USE_CALLBACKS FALSE | ||
260 | #endif | ||
261 | |||
262 | /*===========================================================================*/ | ||
263 | /* CRY driver related settings. */ | ||
264 | /*===========================================================================*/ | ||
265 | |||
266 | /** | ||
267 | * @brief Enables the SW fall-back of the cryptographic driver. | ||
268 | * @details When enabled, this option, activates a fall-back software | ||
269 | * implementation for algorithms not supported by the underlying | ||
270 | * hardware. | ||
271 | * @note Fall-back implementations may not be present for all algorithms. | ||
272 | */ | ||
273 | #if !defined(HAL_CRY_USE_FALLBACK) || defined(__DOXYGEN__) | ||
274 | #define HAL_CRY_USE_FALLBACK FALSE | ||
275 | #endif | ||
276 | |||
277 | /** | ||
278 | * @brief Makes the driver forcibly use the fall-back implementations. | ||
279 | */ | ||
280 | #if !defined(HAL_CRY_ENFORCE_FALLBACK) || defined(__DOXYGEN__) | ||
281 | #define HAL_CRY_ENFORCE_FALLBACK FALSE | ||
282 | #endif | ||
283 | |||
284 | /*===========================================================================*/ | ||
285 | /* DAC driver related settings. */ | ||
286 | /*===========================================================================*/ | ||
287 | |||
288 | /** | ||
289 | * @brief Enables synchronous APIs. | ||
290 | * @note Disabling this option saves both code and data space. | ||
291 | */ | ||
292 | #if !defined(DAC_USE_WAIT) || defined(__DOXYGEN__) | ||
293 | #define DAC_USE_WAIT TRUE | ||
294 | #endif | ||
295 | |||
296 | /** | ||
297 | * @brief Enables the @p dacAcquireBus() and @p dacReleaseBus() APIs. | ||
298 | * @note Disabling this option saves both code and data space. | ||
299 | */ | ||
300 | #if !defined(DAC_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) | ||
301 | #define DAC_USE_MUTUAL_EXCLUSION TRUE | ||
302 | #endif | ||
303 | |||
304 | /*===========================================================================*/ | ||
305 | /* I2C driver related settings. */ | ||
306 | /*===========================================================================*/ | ||
307 | |||
308 | /** | ||
309 | * @brief Enables the mutual exclusion APIs on the I2C bus. | ||
310 | */ | ||
311 | #if !defined(I2C_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) | ||
312 | #define I2C_USE_MUTUAL_EXCLUSION TRUE | ||
313 | #endif | ||
314 | |||
315 | /*===========================================================================*/ | ||
316 | /* MAC driver related settings. */ | ||
317 | /*===========================================================================*/ | ||
318 | |||
319 | /** | ||
320 | * @brief Enables the zero-copy API. | ||
321 | */ | ||
322 | #if !defined(MAC_USE_ZERO_COPY) || defined(__DOXYGEN__) | ||
323 | #define MAC_USE_ZERO_COPY FALSE | ||
324 | #endif | ||
325 | |||
326 | /** | ||
327 | * @brief Enables an event sources for incoming packets. | ||
328 | */ | ||
329 | #if !defined(MAC_USE_EVENTS) || defined(__DOXYGEN__) | ||
330 | #define MAC_USE_EVENTS TRUE | ||
331 | #endif | ||
332 | |||
333 | /*===========================================================================*/ | ||
334 | /* MMC_SPI driver related settings. */ | ||
335 | /*===========================================================================*/ | ||
336 | |||
337 | /** | ||
338 | * @brief Delays insertions. | ||
339 | * @details If enabled this options inserts delays into the MMC waiting | ||
340 | * routines releasing some extra CPU time for the threads with | ||
341 | * lower priority, this may slow down the driver a bit however. | ||
342 | * This option is recommended also if the SPI driver does not | ||
343 | * use a DMA channel and heavily loads the CPU. | ||
344 | */ | ||
345 | #if !defined(MMC_NICE_WAITING) || defined(__DOXYGEN__) | ||
346 | #define MMC_NICE_WAITING TRUE | ||
347 | #endif | ||
348 | |||
349 | /*===========================================================================*/ | ||
350 | /* SDC driver related settings. */ | ||
351 | /*===========================================================================*/ | ||
352 | |||
353 | /** | ||
354 | * @brief Number of initialization attempts before rejecting the card. | ||
355 | * @note Attempts are performed at 10mS intervals. | ||
356 | */ | ||
357 | #if !defined(SDC_INIT_RETRY) || defined(__DOXYGEN__) | ||
358 | #define SDC_INIT_RETRY 100 | ||
359 | #endif | ||
360 | |||
361 | /** | ||
362 | * @brief Include support for MMC cards. | ||
363 | * @note MMC support is not yet implemented so this option must be kept | ||
364 | * at @p FALSE. | ||
365 | */ | ||
366 | #if !defined(SDC_MMC_SUPPORT) || defined(__DOXYGEN__) | ||
367 | #define SDC_MMC_SUPPORT FALSE | ||
368 | #endif | ||
369 | |||
370 | /** | ||
371 | * @brief Delays insertions. | ||
372 | * @details If enabled this options inserts delays into the MMC waiting | ||
373 | * routines releasing some extra CPU time for the threads with | ||
374 | * lower priority, this may slow down the driver a bit however. | ||
375 | */ | ||
376 | #if !defined(SDC_NICE_WAITING) || defined(__DOXYGEN__) | ||
377 | #define SDC_NICE_WAITING TRUE | ||
378 | #endif | ||
379 | |||
380 | /** | ||
381 | * @brief OCR initialization constant for V20 cards. | ||
382 | */ | ||
383 | #if !defined(SDC_INIT_OCR_V20) || defined(__DOXYGEN__) | ||
384 | #define SDC_INIT_OCR_V20 0x50FF8000U | ||
385 | #endif | ||
386 | |||
387 | /** | ||
388 | * @brief OCR initialization constant for non-V20 cards. | ||
389 | */ | ||
390 | #if !defined(SDC_INIT_OCR) || defined(__DOXYGEN__) | ||
391 | #define SDC_INIT_OCR 0x80100000U | ||
392 | #endif | ||
393 | |||
394 | /*===========================================================================*/ | ||
395 | /* SERIAL driver related settings. */ | ||
396 | /*===========================================================================*/ | ||
397 | |||
398 | /** | ||
399 | * @brief Default bit rate. | ||
400 | * @details Configuration parameter, this is the baud rate selected for the | ||
401 | * default configuration. | ||
402 | */ | ||
403 | #if !defined(SERIAL_DEFAULT_BITRATE) || defined(__DOXYGEN__) | ||
404 | #define SERIAL_DEFAULT_BITRATE 38400 | ||
405 | #endif | ||
406 | |||
407 | /** | ||
408 | * @brief Serial buffers size. | ||
409 | * @details Configuration parameter, you can change the depth of the queue | ||
410 | * buffers depending on the requirements of your application. | ||
411 | * @note The default is 16 bytes for both the transmission and receive | ||
412 | * buffers. | ||
413 | */ | ||
414 | #if !defined(SERIAL_BUFFERS_SIZE) || defined(__DOXYGEN__) | ||
415 | #define SERIAL_BUFFERS_SIZE 16 | ||
416 | #endif | ||
417 | |||
418 | /*===========================================================================*/ | ||
419 | /* SERIAL_USB driver related setting. */ | ||
420 | /*===========================================================================*/ | ||
421 | |||
422 | /** | ||
423 | * @brief Serial over USB buffers size. | ||
424 | * @details Configuration parameter, the buffer size must be a multiple of | ||
425 | * the USB data endpoint maximum packet size. | ||
426 | * @note The default is 256 bytes for both the transmission and receive | ||
427 | * buffers. | ||
428 | */ | ||
429 | #if !defined(SERIAL_USB_BUFFERS_SIZE) || defined(__DOXYGEN__) | ||
430 | #define SERIAL_USB_BUFFERS_SIZE 256 | ||
431 | #endif | ||
432 | |||
433 | /** | ||
434 | * @brief Serial over USB number of buffers. | ||
435 | * @note The default is 2 buffers. | ||
436 | */ | ||
437 | #if !defined(SERIAL_USB_BUFFERS_NUMBER) || defined(__DOXYGEN__) | ||
438 | #define SERIAL_USB_BUFFERS_NUMBER 2 | ||
439 | #endif | ||
440 | |||
441 | /*===========================================================================*/ | ||
442 | /* SPI driver related settings. */ | ||
443 | /*===========================================================================*/ | ||
444 | |||
445 | /** | ||
446 | * @brief Enables synchronous APIs. | ||
447 | * @note Disabling this option saves both code and data space. | ||
448 | */ | ||
449 | #if !defined(SPI_USE_WAIT) || defined(__DOXYGEN__) | ||
450 | #define SPI_USE_WAIT TRUE | ||
451 | #endif | ||
452 | |||
453 | /** | ||
454 | * @brief Enables circular transfers APIs. | ||
455 | * @note Disabling this option saves both code and data space. | ||
456 | */ | ||
457 | #if !defined(SPI_USE_CIRCULAR) || defined(__DOXYGEN__) | ||
458 | #define SPI_USE_CIRCULAR FALSE | ||
459 | #endif | ||
460 | |||
461 | /** | ||
462 | * @brief Enables the @p spiAcquireBus() and @p spiReleaseBus() APIs. | ||
463 | * @note Disabling this option saves both code and data space. | ||
464 | */ | ||
465 | #if !defined(SPI_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) | ||
466 | #define SPI_USE_MUTUAL_EXCLUSION TRUE | ||
467 | #endif | ||
468 | |||
469 | /** | ||
470 | * @brief Handling method for SPI CS line. | ||
471 | * @note Disabling this option saves both code and data space. | ||
472 | */ | ||
473 | #if !defined(SPI_SELECT_MODE) || defined(__DOXYGEN__) | ||
474 | #define SPI_SELECT_MODE SPI_SELECT_MODE_PAD | ||
475 | #endif | ||
476 | |||
477 | /*===========================================================================*/ | ||
478 | /* UART driver related settings. */ | ||
479 | /*===========================================================================*/ | ||
480 | |||
481 | /** | ||
482 | * @brief Enables synchronous APIs. | ||
483 | * @note Disabling this option saves both code and data space. | ||
484 | */ | ||
485 | #if !defined(UART_USE_WAIT) || defined(__DOXYGEN__) | ||
486 | #define UART_USE_WAIT FALSE | ||
487 | #endif | ||
488 | |||
489 | /** | ||
490 | * @brief Enables the @p uartAcquireBus() and @p uartReleaseBus() APIs. | ||
491 | * @note Disabling this option saves both code and data space. | ||
492 | */ | ||
493 | #if !defined(UART_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) | ||
494 | #define UART_USE_MUTUAL_EXCLUSION FALSE | ||
495 | #endif | ||
496 | |||
497 | /*===========================================================================*/ | ||
498 | /* USB driver related settings. */ | ||
499 | /*===========================================================================*/ | ||
500 | |||
501 | /** | ||
502 | * @brief Enables synchronous APIs. | ||
503 | * @note Disabling this option saves both code and data space. | ||
504 | */ | ||
505 | #if !defined(USB_USE_WAIT) || defined(__DOXYGEN__) | ||
506 | #define USB_USE_WAIT FALSE | ||
507 | #endif | ||
508 | |||
509 | /*===========================================================================*/ | ||
510 | /* WSPI driver related settings. */ | ||
511 | /*===========================================================================*/ | ||
512 | |||
513 | /** | ||
514 | * @brief Enables synchronous APIs. | ||
515 | * @note Disabling this option saves both code and data space. | ||
516 | */ | ||
517 | #if !defined(WSPI_USE_WAIT) || defined(__DOXYGEN__) | ||
518 | #define WSPI_USE_WAIT TRUE | ||
519 | #endif | ||
520 | |||
521 | /** | ||
522 | * @brief Enables the @p wspiAcquireBus() and @p wspiReleaseBus() APIs. | ||
523 | * @note Disabling this option saves both code and data space. | ||
524 | */ | ||
525 | #if !defined(WSPI_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) | ||
526 | #define WSPI_USE_MUTUAL_EXCLUSION TRUE | ||
527 | #endif | ||
528 | |||
529 | #endif /* HALCONF_H */ | ||
530 | |||
531 | /** @} */ | ||
diff --git a/lib/chibios/demos/STM32/RT-STM32F107-OLIMEX_P107-LWIP/cfg/httpd_opts.h b/lib/chibios/demos/STM32/RT-STM32F107-OLIMEX_P107-LWIP/cfg/httpd_opts.h new file mode 100644 index 000000000..340db15f6 --- /dev/null +++ b/lib/chibios/demos/STM32/RT-STM32F107-OLIMEX_P107-LWIP/cfg/httpd_opts.h | |||
@@ -0,0 +1,323 @@ | |||
1 | /** | ||
2 | * @file | ||
3 | * HTTP server options list | ||
4 | */ | ||
5 | |||
6 | /* | ||
7 | * Copyright (c) 2001-2003 Swedish Institute of Computer Science. | ||
8 | * All rights reserved. | ||
9 | * | ||
10 | * Redistribution and use in source and binary forms, with or without modification, | ||
11 | * are permitted provided that the following conditions are met: | ||
12 | * | ||
13 | * 1. Redistributions of source code must retain the above copyright notice, | ||
14 | * this list of conditions and the following disclaimer. | ||
15 | * 2. Redistributions in binary form must reproduce the above copyright notice, | ||
16 | * this list of conditions and the following disclaimer in the documentation | ||
17 | * and/or other materials provided with the distribution. | ||
18 | * 3. The name of the author may not be used to endorse or promote products | ||
19 | * derived from this software without specific prior written permission. | ||
20 | * | ||
21 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED | ||
22 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
23 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT | ||
24 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | ||
25 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT | ||
26 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
27 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | ||
29 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY | ||
30 | * OF SUCH DAMAGE. | ||
31 | * | ||
32 | * This file is part of the lwIP TCP/IP stack. | ||
33 | * | ||
34 | * Author: Adam Dunkels <[email protected]> | ||
35 | * | ||
36 | * This version of the file has been modified by Texas Instruments to offer | ||
37 | * simple server-side-include (SSI) and Common Gateway Interface (CGI) | ||
38 | * capability. | ||
39 | */ | ||
40 | |||
41 | #ifndef LWIP_HDR_APPS_HTTPD_OPTS_H | ||
42 | #define LWIP_HDR_APPS_HTTPD_OPTS_H | ||
43 | |||
44 | #include "lwip/opt.h" | ||
45 | |||
46 | /** | ||
47 | * @defgroup httpd_opts Options | ||
48 | * @ingroup httpd | ||
49 | * @{ | ||
50 | */ | ||
51 | |||
52 | /** Set this to 1 to support CGI (old style) */ | ||
53 | #if !defined LWIP_HTTPD_CGI || defined __DOXYGEN__ | ||
54 | #define LWIP_HTTPD_CGI 0 | ||
55 | #endif | ||
56 | |||
57 | /** Set this to 1 to support CGI (new style) */ | ||
58 | #if !defined LWIP_HTTPD_CGI_SSI || defined __DOXYGEN__ | ||
59 | #define LWIP_HTTPD_CGI_SSI 0 | ||
60 | #endif | ||
61 | |||
62 | /** Set this to 1 to support SSI (Server-Side-Includes) */ | ||
63 | #if !defined LWIP_HTTPD_SSI || defined __DOXYGEN__ | ||
64 | #define LWIP_HTTPD_SSI 0 | ||
65 | #endif | ||
66 | |||
67 | /** Set this to 1 to implement an SSI tag handler callback that gets a const char* | ||
68 | * to the tag (instead of an index into a pre-registered array of known tags) */ | ||
69 | #if !defined LWIP_HTTPD_SSI_RAW || defined __DOXYGEN__ | ||
70 | #define LWIP_HTTPD_SSI_RAW 0 | ||
71 | #endif | ||
72 | |||
73 | /** Set this to 1 to support HTTP POST */ | ||
74 | #if !defined LWIP_HTTPD_SUPPORT_POST || defined __DOXYGEN__ | ||
75 | #define LWIP_HTTPD_SUPPORT_POST 0 | ||
76 | #endif | ||
77 | |||
78 | /* The maximum number of parameters that the CGI handler can be sent. */ | ||
79 | #if !defined LWIP_HTTPD_MAX_CGI_PARAMETERS || defined __DOXYGEN__ | ||
80 | #define LWIP_HTTPD_MAX_CGI_PARAMETERS 16 | ||
81 | #endif | ||
82 | |||
83 | /** LWIP_HTTPD_SSI_MULTIPART==1: SSI handler function is called with 2 more | ||
84 | * arguments indicating a counter for insert string that are too long to be | ||
85 | * inserted at once: the SSI handler function must then set 'next_tag_part' | ||
86 | * which will be passed back to it in the next call. */ | ||
87 | #if !defined LWIP_HTTPD_SSI_MULTIPART || defined __DOXYGEN__ | ||
88 | #define LWIP_HTTPD_SSI_MULTIPART 0 | ||
89 | #endif | ||
90 | |||
91 | /* The maximum length of the string comprising the tag name */ | ||
92 | #if !defined LWIP_HTTPD_MAX_TAG_NAME_LEN || defined __DOXYGEN__ | ||
93 | #define LWIP_HTTPD_MAX_TAG_NAME_LEN 8 | ||
94 | #endif | ||
95 | |||
96 | /* The maximum length of string that can be returned to replace any given tag */ | ||
97 | #if !defined LWIP_HTTPD_MAX_TAG_INSERT_LEN || defined __DOXYGEN__ | ||
98 | #define LWIP_HTTPD_MAX_TAG_INSERT_LEN 192 | ||
99 | #endif | ||
100 | |||
101 | #if !defined LWIP_HTTPD_POST_MANUAL_WND || defined __DOXYGEN__ | ||
102 | #define LWIP_HTTPD_POST_MANUAL_WND 0 | ||
103 | #endif | ||
104 | |||
105 | /** This string is passed in the HTTP header as "Server: " */ | ||
106 | #if !defined HTTPD_SERVER_AGENT || defined __DOXYGEN__ | ||
107 | #define HTTPD_SERVER_AGENT "lwIP/" LWIP_VERSION_STRING " (http://savannah.nongnu.org/projects/lwip)" | ||
108 | #endif | ||
109 | |||
110 | /** Set this to 1 if you want to include code that creates HTTP headers | ||
111 | * at runtime. Default is off: HTTP headers are then created statically | ||
112 | * by the makefsdata tool. Static headers mean smaller code size, but | ||
113 | * the (readonly) fsdata will grow a bit as every file includes the HTTP | ||
114 | * header. */ | ||
115 | #if !defined LWIP_HTTPD_DYNAMIC_HEADERS || defined __DOXYGEN__ | ||
116 | #define LWIP_HTTPD_DYNAMIC_HEADERS 0 | ||
117 | #endif | ||
118 | |||
119 | #if !defined HTTPD_DEBUG || defined __DOXYGEN__ | ||
120 | #define HTTPD_DEBUG LWIP_DBG_OFF | ||
121 | #endif | ||
122 | |||
123 | /** Set this to 1 to use a memp pool for allocating | ||
124 | * struct http_state instead of the heap. | ||
125 | */ | ||
126 | #if !defined HTTPD_USE_MEM_POOL || defined __DOXYGEN__ | ||
127 | #define HTTPD_USE_MEM_POOL 0 | ||
128 | #endif | ||
129 | |||
130 | /** The server port for HTTPD to use */ | ||
131 | #if !defined HTTPD_SERVER_PORT || defined __DOXYGEN__ | ||
132 | #define HTTPD_SERVER_PORT 80 | ||
133 | #endif | ||
134 | |||
135 | /** Maximum retries before the connection is aborted/closed. | ||
136 | * - number of times pcb->poll is called -> default is 4*500ms = 2s; | ||
137 | * - reset when pcb->sent is called | ||
138 | */ | ||
139 | #if !defined HTTPD_MAX_RETRIES || defined __DOXYGEN__ | ||
140 | #define HTTPD_MAX_RETRIES 4 | ||
141 | #endif | ||
142 | |||
143 | /** The poll delay is X*500ms */ | ||
144 | #if !defined HTTPD_POLL_INTERVAL || defined __DOXYGEN__ | ||
145 | #define HTTPD_POLL_INTERVAL 4 | ||
146 | #endif | ||
147 | |||
148 | /** Priority for tcp pcbs created by HTTPD (very low by default). | ||
149 | * Lower priorities get killed first when running out of memory. | ||
150 | */ | ||
151 | #if !defined HTTPD_TCP_PRIO || defined __DOXYGEN__ | ||
152 | #define HTTPD_TCP_PRIO TCP_PRIO_MIN | ||
153 | #endif | ||
154 | |||
155 | /** Set this to 1 to enable timing each file sent */ | ||
156 | #if !defined LWIP_HTTPD_TIMING || defined __DOXYGEN__ | ||
157 | #define LWIP_HTTPD_TIMING 0 | ||
158 | #endif | ||
159 | /** Set this to 1 to enable timing each file sent */ | ||
160 | #if !defined HTTPD_DEBUG_TIMING || defined __DOXYGEN__ | ||
161 | #define HTTPD_DEBUG_TIMING LWIP_DBG_OFF | ||
162 | #endif | ||
163 | |||
164 | /** Set this to one to show error pages when parsing a request fails instead | ||
165 | of simply closing the connection. */ | ||
166 | #if !defined LWIP_HTTPD_SUPPORT_EXTSTATUS || defined __DOXYGEN__ | ||
167 | #define LWIP_HTTPD_SUPPORT_EXTSTATUS 0 | ||
168 | #endif | ||
169 | |||
170 | /** Set this to 0 to drop support for HTTP/0.9 clients (to save some bytes) */ | ||
171 | #if !defined LWIP_HTTPD_SUPPORT_V09 || defined __DOXYGEN__ | ||
172 | #define LWIP_HTTPD_SUPPORT_V09 1 | ||
173 | #endif | ||
174 | |||
175 | /** Set this to 1 to enable HTTP/1.1 persistent connections. | ||
176 | * ATTENTION: If the generated file system includes HTTP headers, these must | ||
177 | * include the "Connection: keep-alive" header (pass argument "-11" to makefsdata). | ||
178 | */ | ||
179 | #if !defined LWIP_HTTPD_SUPPORT_11_KEEPALIVE || defined __DOXYGEN__ | ||
180 | #define LWIP_HTTPD_SUPPORT_11_KEEPALIVE 0 | ||
181 | #endif | ||
182 | |||
183 | /** Set this to 1 to support HTTP request coming in in multiple packets/pbufs */ | ||
184 | #if !defined LWIP_HTTPD_SUPPORT_REQUESTLIST || defined __DOXYGEN__ | ||
185 | #define LWIP_HTTPD_SUPPORT_REQUESTLIST 1 | ||
186 | #endif | ||
187 | |||
188 | #if LWIP_HTTPD_SUPPORT_REQUESTLIST | ||
189 | /** Number of rx pbufs to enqueue to parse an incoming request (up to the first | ||
190 | newline) */ | ||
191 | #if !defined LWIP_HTTPD_REQ_QUEUELEN || defined __DOXYGEN__ | ||
192 | #define LWIP_HTTPD_REQ_QUEUELEN 5 | ||
193 | #endif | ||
194 | |||
195 | /** Number of (TCP payload-) bytes (in pbufs) to enqueue to parse and incoming | ||
196 | request (up to the first double-newline) */ | ||
197 | #if !defined LWIP_HTTPD_REQ_BUFSIZE || defined __DOXYGEN__ | ||
198 | #define LWIP_HTTPD_REQ_BUFSIZE LWIP_HTTPD_MAX_REQ_LENGTH | ||
199 | #endif | ||
200 | |||
201 | /** Defines the maximum length of a HTTP request line (up to the first CRLF, | ||
202 | copied from pbuf into this a global buffer when pbuf- or packet-queues | ||
203 | are received - otherwise the input pbuf is used directly) */ | ||
204 | #if !defined LWIP_HTTPD_MAX_REQ_LENGTH || defined __DOXYGEN__ | ||
205 | #define LWIP_HTTPD_MAX_REQ_LENGTH LWIP_MIN(1023, (LWIP_HTTPD_REQ_QUEUELEN * PBUF_POOL_BUFSIZE)) | ||
206 | #endif | ||
207 | #endif /* LWIP_HTTPD_SUPPORT_REQUESTLIST */ | ||
208 | |||
209 | /** This is the size of a static buffer used when URIs end with '/'. | ||
210 | * In this buffer, the directory requested is concatenated with all the | ||
211 | * configured default file names. | ||
212 | * Set to 0 to disable checking default filenames on non-root directories. | ||
213 | */ | ||
214 | #if !defined LWIP_HTTPD_MAX_REQUEST_URI_LEN || defined __DOXYGEN__ | ||
215 | #define LWIP_HTTPD_MAX_REQUEST_URI_LEN 63 | ||
216 | #endif | ||
217 | |||
218 | /** Maximum length of the filename to send as response to a POST request, | ||
219 | * filled in by the application when a POST is finished. | ||
220 | */ | ||
221 | #if !defined LWIP_HTTPD_POST_MAX_RESPONSE_URI_LEN || defined __DOXYGEN__ | ||
222 | #define LWIP_HTTPD_POST_MAX_RESPONSE_URI_LEN 63 | ||
223 | #endif | ||
224 | |||
225 | /** Set this to 0 to not send the SSI tag (default is on, so the tag will | ||
226 | * be sent in the HTML page */ | ||
227 | #if !defined LWIP_HTTPD_SSI_INCLUDE_TAG || defined __DOXYGEN__ | ||
228 | #define LWIP_HTTPD_SSI_INCLUDE_TAG 1 | ||
229 | #endif | ||
230 | |||
231 | /** Set this to 1 to call tcp_abort when tcp_close fails with memory error. | ||
232 | * This can be used to prevent consuming all memory in situations where the | ||
233 | * HTTP server has low priority compared to other communication. */ | ||
234 | #if !defined LWIP_HTTPD_ABORT_ON_CLOSE_MEM_ERROR || defined __DOXYGEN__ | ||
235 | #define LWIP_HTTPD_ABORT_ON_CLOSE_MEM_ERROR 0 | ||
236 | #endif | ||
237 | |||
238 | /** Set this to 1 to kill the oldest connection when running out of | ||
239 | * memory for 'struct http_state' or 'struct http_ssi_state'. | ||
240 | * ATTENTION: This puts all connections on a linked list, so may be kind of slow. | ||
241 | */ | ||
242 | #if !defined LWIP_HTTPD_KILL_OLD_ON_CONNECTIONS_EXCEEDED || defined __DOXYGEN__ | ||
243 | #define LWIP_HTTPD_KILL_OLD_ON_CONNECTIONS_EXCEEDED 0 | ||
244 | #endif | ||
245 | |||
246 | /** Set this to 1 to send URIs without extension without headers | ||
247 | * (who uses this at all??) */ | ||
248 | #if !defined LWIP_HTTPD_OMIT_HEADER_FOR_EXTENSIONLESS_URI || defined __DOXYGEN__ | ||
249 | #define LWIP_HTTPD_OMIT_HEADER_FOR_EXTENSIONLESS_URI 0 | ||
250 | #endif | ||
251 | |||
252 | /** Default: Tags are sent from struct http_state and are therefore volatile */ | ||
253 | #if !defined HTTP_IS_TAG_VOLATILE || defined __DOXYGEN__ | ||
254 | #define HTTP_IS_TAG_VOLATILE(ptr) TCP_WRITE_FLAG_COPY | ||
255 | #endif | ||
256 | |||
257 | /* By default, the httpd is limited to send 2*pcb->mss to keep resource usage low | ||
258 | when http is not an important protocol in the device. */ | ||
259 | #if !defined HTTPD_LIMIT_SENDING_TO_2MSS || defined __DOXYGEN__ | ||
260 | #define HTTPD_LIMIT_SENDING_TO_2MSS 1 | ||
261 | #endif | ||
262 | |||
263 | /* Define this to a function that returns the maximum amount of data to enqueue. | ||
264 | The function have this signature: u16_t fn(struct tcp_pcb* pcb); */ | ||
265 | #if !defined HTTPD_MAX_WRITE_LEN || defined __DOXYGEN__ | ||
266 | #if HTTPD_LIMIT_SENDING_TO_2MSS | ||
267 | #define HTTPD_MAX_WRITE_LEN(pcb) (2 * tcp_mss(pcb)) | ||
268 | #endif | ||
269 | #endif | ||
270 | |||
271 | /*------------------- FS OPTIONS -------------------*/ | ||
272 | |||
273 | /** Set this to 1 and provide the functions: | ||
274 | * - "int fs_open_custom(struct fs_file *file, const char *name)" | ||
275 | * Called first for every opened file to allow opening files | ||
276 | * that are not included in fsdata(_custom).c | ||
277 | * - "void fs_close_custom(struct fs_file *file)" | ||
278 | * Called to free resources allocated by fs_open_custom(). | ||
279 | */ | ||
280 | #if !defined LWIP_HTTPD_CUSTOM_FILES || defined __DOXYGEN__ | ||
281 | #define LWIP_HTTPD_CUSTOM_FILES 0 | ||
282 | #endif | ||
283 | |||
284 | /** Set this to 1 to support fs_read() to dynamically read file data. | ||
285 | * Without this (default=off), only one-block files are supported, | ||
286 | * and the contents must be ready after fs_open(). | ||
287 | */ | ||
288 | #if !defined LWIP_HTTPD_DYNAMIC_FILE_READ || defined __DOXYGEN__ | ||
289 | #define LWIP_HTTPD_DYNAMIC_FILE_READ 0 | ||
290 | #endif | ||
291 | |||
292 | /** Set this to 1 to include an application state argument per file | ||
293 | * that is opened. This allows to keep a state per connection/file. | ||
294 | */ | ||
295 | #if !defined LWIP_HTTPD_FILE_STATE || defined __DOXYGEN__ | ||
296 | #define LWIP_HTTPD_FILE_STATE 0 | ||
297 | #endif | ||
298 | |||
299 | /** HTTPD_PRECALCULATED_CHECKSUM==1: include precompiled checksums for | ||
300 | * predefined (MSS-sized) chunks of the files to prevent having to calculate | ||
301 | * the checksums at runtime. */ | ||
302 | #if !defined HTTPD_PRECALCULATED_CHECKSUM || defined __DOXYGEN__ | ||
303 | #define HTTPD_PRECALCULATED_CHECKSUM 0 | ||
304 | #endif | ||
305 | |||
306 | /** LWIP_HTTPD_FS_ASYNC_READ==1: support asynchronous read operations | ||
307 | * (fs_read_async returns FS_READ_DELAYED and calls a callback when finished). | ||
308 | */ | ||
309 | #if !defined LWIP_HTTPD_FS_ASYNC_READ || defined __DOXYGEN__ | ||
310 | #define LWIP_HTTPD_FS_ASYNC_READ 0 | ||
311 | #endif | ||
312 | |||
313 | /** Set this to 1 to include "fsdata_custom.c" instead of "fsdata.c" for the | ||
314 | * file system (to prevent changing the file included in CVS) */ | ||
315 | #if !defined HTTPD_USE_CUSTOM_FSDATA || defined __DOXYGEN__ | ||
316 | #define HTTPD_USE_CUSTOM_FSDATA 0 | ||
317 | #endif | ||
318 | |||
319 | /** | ||
320 | * @} | ||
321 | */ | ||
322 | |||
323 | #endif /* LWIP_HDR_APPS_HTTPD_OPTS_H */ | ||
diff --git a/lib/chibios/demos/STM32/RT-STM32F107-OLIMEX_P107-LWIP/cfg/lwipopts.h b/lib/chibios/demos/STM32/RT-STM32F107-OLIMEX_P107-LWIP/cfg/lwipopts.h new file mode 100644 index 000000000..712f295ac --- /dev/null +++ b/lib/chibios/demos/STM32/RT-STM32F107-OLIMEX_P107-LWIP/cfg/lwipopts.h | |||
@@ -0,0 +1,54 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2001-2003 Swedish Institute of Computer Science. | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without modification, | ||
6 | * are permitted provided that the following conditions are met: | ||
7 | * | ||
8 | * 1. Redistributions of source code must retain the above copyright notice, | ||
9 | * this list of conditions and the following disclaimer. | ||
10 | * 2. Redistributions in binary form must reproduce the above copyright notice, | ||
11 | * this list of conditions and the following disclaimer in the documentation | ||
12 | * and/or other materials provided with the distribution. | ||
13 | * 3. The name of the author may not be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED | ||
17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
18 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT | ||
19 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | ||
20 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT | ||
21 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | ||
24 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY | ||
25 | * OF SUCH DAMAGE. | ||
26 | * | ||
27 | * This file is part of the lwIP TCP/IP stack. | ||
28 | * | ||
29 | * Author: Simon Goldschmidt | ||
30 | * | ||
31 | */ | ||
32 | #ifndef LWIP_HDR_LWIPOPTS_H__ | ||
33 | #define LWIP_HDR_LWIPOPTS_H__ | ||
34 | |||
35 | /* Fixed settings mandated by the ChibiOS integration.*/ | ||
36 | #include "static_lwipopts.h" | ||
37 | |||
38 | /* Optional, application-specific settings.*/ | ||
39 | #if !defined(TCPIP_MBOX_SIZE) | ||
40 | #define TCPIP_MBOX_SIZE MEMP_NUM_PBUF | ||
41 | #endif | ||
42 | #if !defined(TCPIP_THREAD_STACKSIZE) | ||
43 | #define TCPIP_THREAD_STACKSIZE 1024 | ||
44 | #endif | ||
45 | |||
46 | /* Use ChibiOS specific priorities. */ | ||
47 | #if !defined(TCPIP_THREAD_PRIO) | ||
48 | #define TCPIP_THREAD_PRIO (LOWPRIO + 1) | ||
49 | #endif | ||
50 | #if !defined(LWIP_THREAD_PRIORITY) | ||
51 | #define LWIP_THREAD_PRIORITY (LOWPRIO) | ||
52 | #endif | ||
53 | |||
54 | #endif /* LWIP_HDR_LWIPOPTS_H__ */ | ||
diff --git a/lib/chibios/demos/STM32/RT-STM32F107-OLIMEX_P107-LWIP/cfg/mcuconf.h b/lib/chibios/demos/STM32/RT-STM32F107-OLIMEX_P107-LWIP/cfg/mcuconf.h new file mode 100755 index 000000000..5d4843913 --- /dev/null +++ b/lib/chibios/demos/STM32/RT-STM32F107-OLIMEX_P107-LWIP/cfg/mcuconf.h | |||
@@ -0,0 +1,223 @@ | |||
1 | /* | ||
2 | ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio | ||
3 | |||
4 | Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | you may not use this file except in compliance with the License. | ||
6 | You may obtain a copy of the License at | ||
7 | |||
8 | http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | |||
10 | Unless required by applicable law or agreed to in writing, software | ||
11 | distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | See the License for the specific language governing permissions and | ||
14 | limitations under the License. | ||
15 | */ | ||
16 | |||
17 | #ifndef MCUCONF_H | ||
18 | #define MCUCONF_H | ||
19 | |||
20 | /* | ||
21 | * STM32F107 drivers configuration. | ||
22 | * The following settings override the default settings present in | ||
23 | * the various device driver implementation headers. | ||
24 | * Note that the settings for each driver only have effect if the whole | ||
25 | * driver is enabled in halconf.h. | ||
26 | * | ||
27 | * IRQ priorities: | ||
28 | * 15...0 Lowest...Highest. | ||
29 | * | ||
30 | * DMA priorities: | ||
31 | * 0...3 Lowest...Highest. | ||
32 | */ | ||
33 | |||
34 | #define STM32F107_MCUCONF | ||
35 | |||
36 | /* | ||
37 | * HAL driver system settings. | ||
38 | */ | ||
39 | #define STM32_NO_INIT FALSE | ||
40 | #define STM32_HSI_ENABLED TRUE | ||
41 | #define STM32_LSI_ENABLED FALSE | ||
42 | #define STM32_HSE_ENABLED TRUE | ||
43 | #define STM32_LSE_ENABLED FALSE | ||
44 | #define STM32_SW STM32_SW_PLL | ||
45 | #define STM32_PLLSRC STM32_PLLSRC_PREDIV1 | ||
46 | #define STM32_PREDIV1SRC STM32_PREDIV1SRC_PLL2 | ||
47 | #define STM32_PREDIV1_VALUE 5 | ||
48 | #define STM32_PLLMUL_VALUE 9 | ||
49 | #define STM32_PREDIV2_VALUE 5 | ||
50 | #define STM32_PLL2MUL_VALUE 8 | ||
51 | #define STM32_PLL3MUL_VALUE 10 | ||
52 | #define STM32_HPRE STM32_HPRE_DIV1 | ||
53 | #define STM32_PPRE1 STM32_PPRE1_DIV2 | ||
54 | #define STM32_PPRE2 STM32_PPRE2_DIV2 | ||
55 | #define STM32_ADCPRE STM32_ADCPRE_DIV4 | ||
56 | #define STM32_OTG_CLOCK_REQUIRED TRUE | ||
57 | #define STM32_OTGFSPRE STM32_OTGFSPRE_DIV3 | ||
58 | #define STM32_I2S_CLOCK_REQUIRED FALSE | ||
59 | #define STM32_MCOSEL STM32_MCOSEL_PLL3 | ||
60 | #define STM32_RTCSEL STM32_RTCSEL_HSEDIV | ||
61 | #define STM32_PVD_ENABLE FALSE | ||
62 | #define STM32_PLS STM32_PLS_LEV0 | ||
63 | |||
64 | /* | ||
65 | * IRQ system settings. | ||
66 | */ | ||
67 | #define STM32_IRQ_EXTI0_PRIORITY 6 | ||
68 | #define STM32_IRQ_EXTI1_PRIORITY 6 | ||
69 | #define STM32_IRQ_EXTI2_PRIORITY 6 | ||
70 | #define STM32_IRQ_EXTI3_PRIORITY 6 | ||
71 | #define STM32_IRQ_EXTI4_PRIORITY 6 | ||
72 | #define STM32_IRQ_EXTI5_9_PRIORITY 6 | ||
73 | #define STM32_IRQ_EXTI10_15_PRIORITY 6 | ||
74 | #define STM32_IRQ_EXTI16_PRIORITY 6 | ||
75 | #define STM32_IRQ_EXTI17_PRIORITY 6 | ||
76 | #define STM32_IRQ_EXTI18_PRIORITY 6 | ||
77 | #define STM32_IRQ_EXTI19_PRIORITY 6 | ||
78 | |||
79 | /* | ||
80 | * ADC driver system settings. | ||
81 | */ | ||
82 | #define STM32_ADC_USE_ADC1 FALSE | ||
83 | #define STM32_ADC_ADC1_DMA_PRIORITY 2 | ||
84 | #define STM32_ADC_ADC1_IRQ_PRIORITY 6 | ||
85 | |||
86 | /* | ||
87 | * CAN driver system settings. | ||
88 | */ | ||
89 | #define STM32_CAN_USE_CAN1 FALSE | ||
90 | #define STM32_CAN_USE_CAN2 FALSE | ||
91 | #define STM32_CAN_CAN1_IRQ_PRIORITY 11 | ||
92 | #define STM32_CAN_CAN2_IRQ_PRIORITY 11 | ||
93 | |||
94 | /* | ||
95 | * GPT driver system settings. | ||
96 | */ | ||
97 | #define STM32_GPT_USE_TIM1 FALSE | ||
98 | #define STM32_GPT_USE_TIM2 FALSE | ||
99 | #define STM32_GPT_USE_TIM3 FALSE | ||
100 | #define STM32_GPT_USE_TIM4 FALSE | ||
101 | #define STM32_GPT_USE_TIM5 FALSE | ||
102 | #define STM32_GPT_USE_TIM8 FALSE | ||
103 | #define STM32_GPT_TIM1_IRQ_PRIORITY 7 | ||
104 | #define STM32_GPT_TIM2_IRQ_PRIORITY 7 | ||
105 | #define STM32_GPT_TIM3_IRQ_PRIORITY 7 | ||
106 | #define STM32_GPT_TIM4_IRQ_PRIORITY 7 | ||
107 | #define STM32_GPT_TIM5_IRQ_PRIORITY 7 | ||
108 | #define STM32_GPT_TIM8_IRQ_PRIORITY 7 | ||
109 | |||
110 | /* | ||
111 | * I2C driver system settings. | ||
112 | */ | ||
113 | #define STM32_I2C_USE_I2C1 FALSE | ||
114 | #define STM32_I2C_USE_I2C2 FALSE | ||
115 | #define STM32_I2C_BUSY_TIMEOUT 50 | ||
116 | #define STM32_I2C_I2C1_IRQ_PRIORITY 5 | ||
117 | #define STM32_I2C_I2C2_IRQ_PRIORITY 5 | ||
118 | #define STM32_I2C_I2C1_DMA_PRIORITY 3 | ||
119 | #define STM32_I2C_I2C2_DMA_PRIORITY 3 | ||
120 | #define STM32_I2C_DMA_ERROR_HOOK(i2cp) osalSysHalt("DMA failure") | ||
121 | |||
122 | /* | ||
123 | * ICU driver system settings. | ||
124 | */ | ||
125 | #define STM32_ICU_USE_TIM1 FALSE | ||
126 | #define STM32_ICU_USE_TIM2 FALSE | ||
127 | #define STM32_ICU_USE_TIM3 FALSE | ||
128 | #define STM32_ICU_USE_TIM4 FALSE | ||
129 | #define STM32_ICU_USE_TIM5 FALSE | ||
130 | #define STM32_ICU_USE_TIM8 FALSE | ||
131 | #define STM32_ICU_TIM1_IRQ_PRIORITY 7 | ||
132 | #define STM32_ICU_TIM2_IRQ_PRIORITY 7 | ||
133 | #define STM32_ICU_TIM3_IRQ_PRIORITY 7 | ||
134 | #define STM32_ICU_TIM4_IRQ_PRIORITY 7 | ||
135 | #define STM32_ICU_TIM5_IRQ_PRIORITY 7 | ||
136 | #define STM32_ICU_TIM8_IRQ_PRIORITY 7 | ||
137 | |||
138 | /* | ||
139 | * PWM driver system settings. | ||
140 | */ | ||
141 | #define STM32_PWM_USE_ADVANCED FALSE | ||
142 | #define STM32_PWM_USE_TIM1 FALSE | ||
143 | #define STM32_PWM_USE_TIM2 FALSE | ||
144 | #define STM32_PWM_USE_TIM3 FALSE | ||
145 | #define STM32_PWM_USE_TIM4 FALSE | ||
146 | #define STM32_PWM_USE_TIM5 FALSE | ||
147 | #define STM32_PWM_USE_TIM8 FALSE | ||
148 | #define STM32_PWM_TIM1_IRQ_PRIORITY 7 | ||
149 | #define STM32_PWM_TIM2_IRQ_PRIORITY 7 | ||
150 | #define STM32_PWM_TIM3_IRQ_PRIORITY 7 | ||
151 | #define STM32_PWM_TIM4_IRQ_PRIORITY 7 | ||
152 | #define STM32_PWM_TIM5_IRQ_PRIORITY 7 | ||
153 | #define STM32_PWM_TIM8_IRQ_PRIORITY 7 | ||
154 | |||
155 | /* | ||
156 | * RTC driver system settings. | ||
157 | */ | ||
158 | #define STM32_RTC_IRQ_PRIORITY 15 | ||
159 | |||
160 | /* | ||
161 | * SERIAL driver system settings. | ||
162 | */ | ||
163 | #define STM32_SERIAL_USE_USART1 FALSE | ||
164 | #define STM32_SERIAL_USE_USART2 FALSE | ||
165 | #define STM32_SERIAL_USE_USART3 TRUE | ||
166 | #define STM32_SERIAL_USE_UART4 FALSE | ||
167 | #define STM32_SERIAL_USE_UART5 FALSE | ||
168 | #define STM32_SERIAL_USART1_PRIORITY 12 | ||
169 | #define STM32_SERIAL_USART2_PRIORITY 12 | ||
170 | #define STM32_SERIAL_USART3_PRIORITY 12 | ||
171 | #define STM32_SERIAL_UART4_PRIORITY 12 | ||
172 | #define STM32_SERIAL_UART5_PRIORITY 12 | ||
173 | |||
174 | /* | ||
175 | * SPI driver system settings. | ||
176 | */ | ||
177 | #define STM32_SPI_USE_SPI1 FALSE | ||
178 | #define STM32_SPI_USE_SPI2 FALSE | ||
179 | #define STM32_SPI_USE_SPI3 FALSE | ||
180 | #define STM32_SPI_SPI1_DMA_PRIORITY 1 | ||
181 | #define STM32_SPI_SPI2_DMA_PRIORITY 1 | ||
182 | #define STM32_SPI_SPI3_DMA_PRIORITY 1 | ||
183 | #define STM32_SPI_SPI1_IRQ_PRIORITY 10 | ||
184 | #define STM32_SPI_SPI2_IRQ_PRIORITY 10 | ||
185 | #define STM32_SPI_SPI3_IRQ_PRIORITY 10 | ||
186 | #define STM32_SPI_DMA_ERROR_HOOK(spip) osalSysHalt("DMA failure") | ||
187 | |||
188 | /* | ||
189 | * ST driver system settings. | ||
190 | */ | ||
191 | #define STM32_ST_IRQ_PRIORITY 8 | ||
192 | #define STM32_ST_USE_TIMER 2 | ||
193 | |||
194 | /* | ||
195 | * UART driver system settings. | ||
196 | */ | ||
197 | #define STM32_UART_USE_USART1 FALSE | ||
198 | #define STM32_UART_USE_USART2 FALSE | ||
199 | #define STM32_UART_USE_USART3 FALSE | ||
200 | #define STM32_UART_USART1_IRQ_PRIORITY 12 | ||
201 | #define STM32_UART_USART2_IRQ_PRIORITY 12 | ||
202 | #define STM32_UART_USART3_IRQ_PRIORITY 12 | ||
203 | #define STM32_UART_USART1_DMA_PRIORITY 0 | ||
204 | #define STM32_UART_USART2_DMA_PRIORITY 0 | ||
205 | #define STM32_UART_USART3_DMA_PRIORITY 0 | ||
206 | #define STM32_UART_DMA_ERROR_HOOK(uartp) osalSysHalt("DMA failure") | ||
207 | |||
208 | /* | ||
209 | * USB driver system settings. | ||
210 | */ | ||
211 | #define STM32_USB_USE_OTG1 FALSE | ||
212 | #define STM32_USB_OTG1_IRQ_PRIORITY 14 | ||
213 | #define STM32_USB_OTG1_RX_FIFO_SIZE 512 | ||
214 | #define STM32_USB_OTG_THREAD_PRIO LOWPRIO | ||
215 | #define STM32_USB_OTG_THREAD_STACK_SIZE 128 | ||
216 | #define STM32_USB_OTGFIFO_FILL_BASEPRI 0 | ||
217 | |||
218 | /* | ||
219 | * WDG driver system settings. | ||
220 | */ | ||
221 | #define STM32_WDG_USE_IWDG FALSE | ||
222 | |||
223 | #endif /* MCUCONF_H */ | ||
diff --git a/lib/chibios/demos/STM32/RT-STM32F107-OLIMEX_P107-LWIP/main.c b/lib/chibios/demos/STM32/RT-STM32F107-OLIMEX_P107-LWIP/main.c new file mode 100644 index 000000000..fc984a3fa --- /dev/null +++ b/lib/chibios/demos/STM32/RT-STM32F107-OLIMEX_P107-LWIP/main.c | |||
@@ -0,0 +1,85 @@ | |||
1 | /* | ||
2 | ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio | ||
3 | |||
4 | Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | you may not use this file except in compliance with the License. | ||
6 | You may obtain a copy of the License at | ||
7 | |||
8 | http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | |||
10 | Unless required by applicable law or agreed to in writing, software | ||
11 | distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | See the License for the specific language governing permissions and | ||
14 | limitations under the License. | ||
15 | */ | ||
16 | |||
17 | #include "ch.h" | ||
18 | #include "hal.h" | ||
19 | #include "rt_test_root.h" | ||
20 | #include "oslib_test_root.h" | ||
21 | |||
22 | #include "lwipthread.h" | ||
23 | |||
24 | #include "web/web.h" | ||
25 | |||
26 | /* | ||
27 | * Green LED blinker thread, times are in milliseconds. | ||
28 | */ | ||
29 | static THD_WORKING_AREA(waThread1, 128); | ||
30 | static THD_FUNCTION(Thread1, arg) { | ||
31 | |||
32 | (void)arg; | ||
33 | chRegSetThreadName("blinker"); | ||
34 | while (TRUE) { | ||
35 | palClearPad(GPIOC, GPIOC_LED_STATUS1); | ||
36 | chThdSleepMilliseconds(500); | ||
37 | palSetPad(GPIOC, GPIOC_LED_STATUS1); | ||
38 | chThdSleepMilliseconds(500); | ||
39 | } | ||
40 | } | ||
41 | |||
42 | /* | ||
43 | * Application entry point. | ||
44 | */ | ||
45 | int main(void) { | ||
46 | |||
47 | /* | ||
48 | * System initializations. | ||
49 | * - HAL initialization, this also initializes the configured device drivers | ||
50 | * and performs the board-specific initializations. | ||
51 | * - Kernel initialization, the main() function becomes a thread and the | ||
52 | * RTOS is active. | ||
53 | */ | ||
54 | halInit(); | ||
55 | chSysInit(); | ||
56 | lwipInit(NULL); | ||
57 | |||
58 | /* | ||
59 | * Activates the serial driver 3 using the driver default configuration. | ||
60 | */ | ||
61 | sdStart(&SD3, NULL); | ||
62 | |||
63 | /* | ||
64 | * Creates the blinker thread. | ||
65 | */ | ||
66 | chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL); | ||
67 | |||
68 | /* | ||
69 | * Creates the HTTP thread (it changes priority internally). | ||
70 | */ | ||
71 | chThdCreateStatic(wa_http_server, sizeof(wa_http_server), NORMALPRIO + 1, | ||
72 | http_server, NULL); | ||
73 | |||
74 | /* | ||
75 | * Normal main() thread activity, in this demo it does nothing except | ||
76 | * sleeping in a loop and check the button state. | ||
77 | */ | ||
78 | while (true) { | ||
79 | if (palReadPad(GPIOC, GPIOC_SWITCH_TAMPER) == 0) { | ||
80 | test_execute((BaseSequentialStream *)&SD3, &rt_test_suite); | ||
81 | test_execute((BaseSequentialStream *)&SD3, &oslib_test_suite); | ||
82 | } | ||
83 | chThdSleepMilliseconds(500); | ||
84 | } | ||
85 | } | ||
diff --git a/lib/chibios/demos/STM32/RT-STM32F107-OLIMEX_P107-LWIP/readme.txt b/lib/chibios/demos/STM32/RT-STM32F107-OLIMEX_P107-LWIP/readme.txt new file mode 100644 index 000000000..081a8b03b --- /dev/null +++ b/lib/chibios/demos/STM32/RT-STM32F107-OLIMEX_P107-LWIP/readme.txt | |||
@@ -0,0 +1,28 @@ | |||
1 | ***************************************************************************** | ||
2 | ** ChibiOS/RT port for ARM-Cortex-M3 STM32F107. ** | ||
3 | ***************************************************************************** | ||
4 | |||
5 | ** TARGET ** | ||
6 | |||
7 | The demo runs on an Olimex STM32-P107 board. | ||
8 | |||
9 | ** The Demo ** | ||
10 | |||
11 | The demo currently just flashes a LED using a thread and serves HTTP requests | ||
12 | at address 192.168.1.20 on port 80. | ||
13 | The button activates che ChibiOS/RT test suite, output on SD3. | ||
14 | |||
15 | ** Build Procedure ** | ||
16 | |||
17 | The demo has been tested by using the free Codesourcery GCC-based toolchain | ||
18 | and YAGARTO. | ||
19 | Just modify the TRGT line in the makefile in order to use different GCC ports. | ||
20 | |||
21 | ** Notes ** | ||
22 | |||
23 | Some files used by the demo are not part of ChibiOS/RT but are copyright of | ||
24 | ST Microelectronics and are licensed under a different license. | ||
25 | Also note that not all the files present in the ST library are distributed | ||
26 | with ChibiOS/RT, you can find the whole library on the ST web site: | ||
27 | |||
28 | http://www.st.com | ||
diff --git a/lib/chibios/demos/STM32/RT-STM32F107-OLIMEX_P107-LWIP/web/web.c b/lib/chibios/demos/STM32/RT-STM32F107-OLIMEX_P107-LWIP/web/web.c new file mode 100644 index 000000000..61f41edc1 --- /dev/null +++ b/lib/chibios/demos/STM32/RT-STM32F107-OLIMEX_P107-LWIP/web/web.c | |||
@@ -0,0 +1,121 @@ | |||
1 | /* | ||
2 | ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio | ||
3 | |||
4 | Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | you may not use this file except in compliance with the License. | ||
6 | You may obtain a copy of the License at | ||
7 | |||
8 | http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | |||
10 | Unless required by applicable law or agreed to in writing, software | ||
11 | distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | See the License for the specific language governing permissions and | ||
14 | limitations under the License. | ||
15 | */ | ||
16 | |||
17 | /* | ||
18 | * This file is a modified version of the lwIP web server demo. The original | ||
19 | * author is unknown because the file didn't contain any license information. | ||
20 | */ | ||
21 | |||
22 | /** | ||
23 | * @file web.c | ||
24 | * @brief HTTP server wrapper thread code. | ||
25 | * @addtogroup WEB_THREAD | ||
26 | * @{ | ||
27 | */ | ||
28 | |||
29 | #include "ch.h" | ||
30 | |||
31 | #include "lwip/opt.h" | ||
32 | #include "lwip/arch.h" | ||
33 | #include "lwip/api.h" | ||
34 | |||
35 | #include "web.h" | ||
36 | |||
37 | #if LWIP_NETCONN | ||
38 | |||
39 | static const char http_html_hdr[] = "HTTP/1.1 200 OK\r\nContent-type: text/html\r\n\r\n"; | ||
40 | static const char http_index_html[] = "<html><head><title>Congrats!</title></head><body><h1>Welcome to our lwIP HTTP server!</h1><p>This is a small test page.</body></html>"; | ||
41 | |||
42 | static void http_server_serve(struct netconn *conn) { | ||
43 | struct netbuf *inbuf; | ||
44 | char *buf; | ||
45 | u16_t buflen; | ||
46 | err_t err; | ||
47 | |||
48 | /* Read the data from the port, blocking if nothing yet there. | ||
49 | We assume the request (the part we care about) is in one netbuf */ | ||
50 | err = netconn_recv(conn, &inbuf); | ||
51 | |||
52 | if (err == ERR_OK) { | ||
53 | netbuf_data(inbuf, (void **)&buf, &buflen); | ||
54 | |||
55 | /* Is this an HTTP GET command? (only check the first 5 chars, since | ||
56 | there are other formats for GET, and we're keeping it very simple )*/ | ||
57 | if (buflen>=5 && | ||
58 | buf[0]=='G' && | ||
59 | buf[1]=='E' && | ||
60 | buf[2]=='T' && | ||
61 | buf[3]==' ' && | ||
62 | buf[4]=='/' ) { | ||
63 | |||
64 | /* Send the HTML header | ||
65 | * subtract 1 from the size, since we dont send the \0 in the string | ||
66 | * NETCONN_NOCOPY: our data is const static, so no need to copy it | ||
67 | */ | ||
68 | netconn_write(conn, http_html_hdr, sizeof(http_html_hdr)-1, NETCONN_NOCOPY); | ||
69 | |||
70 | /* Send our HTML page */ | ||
71 | netconn_write(conn, http_index_html, sizeof(http_index_html)-1, NETCONN_NOCOPY); | ||
72 | } | ||
73 | } | ||
74 | /* Close the connection (server closes in HTTP) */ | ||
75 | netconn_close(conn); | ||
76 | |||
77 | /* Delete the buffer (netconn_recv gives us ownership, | ||
78 | so we have to make sure to deallocate the buffer) */ | ||
79 | netbuf_delete(inbuf); | ||
80 | } | ||
81 | |||
82 | /** | ||
83 | * Stack area for the http thread. | ||
84 | */ | ||
85 | THD_WORKING_AREA(wa_http_server, WEB_THREAD_STACK_SIZE); | ||
86 | |||
87 | /** | ||
88 | * HTTP server thread. | ||
89 | */ | ||
90 | THD_FUNCTION(http_server, p) { | ||
91 | struct netconn *conn, *newconn; | ||
92 | err_t err; | ||
93 | |||
94 | (void)p; | ||
95 | chRegSetThreadName("http"); | ||
96 | |||
97 | /* Create a new TCP connection handle */ | ||
98 | conn = netconn_new(NETCONN_TCP); | ||
99 | LWIP_ERROR("http_server: invalid conn", (conn != NULL), chThdExit(MSG_RESET);); | ||
100 | |||
101 | /* Bind to port 80 (HTTP) with default IP address */ | ||
102 | netconn_bind(conn, NULL, WEB_THREAD_PORT); | ||
103 | |||
104 | /* Put the connection into LISTEN state */ | ||
105 | netconn_listen(conn); | ||
106 | |||
107 | /* Goes to the final priority after initialization.*/ | ||
108 | chThdSetPriority(WEB_THREAD_PRIORITY); | ||
109 | |||
110 | while (true) { | ||
111 | err = netconn_accept(conn, &newconn); | ||
112 | if (err != ERR_OK) | ||
113 | continue; | ||
114 | http_server_serve(newconn); | ||
115 | netconn_delete(newconn); | ||
116 | } | ||
117 | } | ||
118 | |||
119 | #endif /* LWIP_NETCONN */ | ||
120 | |||
121 | /** @} */ | ||
diff --git a/lib/chibios/demos/STM32/RT-STM32F107-OLIMEX_P107-LWIP/web/web.h b/lib/chibios/demos/STM32/RT-STM32F107-OLIMEX_P107-LWIP/web/web.h new file mode 100644 index 000000000..a627d39b5 --- /dev/null +++ b/lib/chibios/demos/STM32/RT-STM32F107-OLIMEX_P107-LWIP/web/web.h | |||
@@ -0,0 +1,51 @@ | |||
1 | /* | ||
2 | ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio | ||
3 | |||
4 | Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | you may not use this file except in compliance with the License. | ||
6 | You may obtain a copy of the License at | ||
7 | |||
8 | http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | |||
10 | Unless required by applicable law or agreed to in writing, software | ||
11 | distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | See the License for the specific language governing permissions and | ||
14 | limitations under the License. | ||
15 | */ | ||
16 | |||
17 | /** | ||
18 | * @file web.h | ||
19 | * @brief HTTP server wrapper thread macros and structures. | ||
20 | * @addtogroup WEB_THREAD | ||
21 | * @{ | ||
22 | */ | ||
23 | |||
24 | #ifndef WEB_H | ||
25 | #define WEB_H | ||
26 | |||
27 | #ifndef WEB_THREAD_STACK_SIZE | ||
28 | #define WEB_THREAD_STACK_SIZE 1024 | ||
29 | #endif | ||
30 | |||
31 | #ifndef WEB_THREAD_PORT | ||
32 | #define WEB_THREAD_PORT 80 | ||
33 | #endif | ||
34 | |||
35 | #ifndef WEB_THREAD_PRIORITY | ||
36 | #define WEB_THREAD_PRIORITY (LOWPRIO + 2) | ||
37 | #endif | ||
38 | |||
39 | extern THD_WORKING_AREA(wa_http_server, WEB_THREAD_STACK_SIZE); | ||
40 | |||
41 | #ifdef __cplusplus | ||
42 | extern "C" { | ||
43 | #endif | ||
44 | THD_FUNCTION(http_server, p); | ||
45 | #ifdef __cplusplus | ||
46 | } | ||
47 | #endif | ||
48 | |||
49 | #endif /* WEB_H */ | ||
50 | |||
51 | /** @} */ | ||