amiro-os / modules / aos_chconf.h @ 933df08e
History | View | Annotate | Download (16.951 KB)
1 |
/*
|
---|---|
2 |
AMiRo-OS is an operating system designed for the Autonomous Mini Robot (AMiRo) platform.
|
3 |
Copyright (C) 2016..2018 Thomas Schöpping et al.
|
4 |
|
5 |
This program is free software: you can redistribute it and/or modify
|
6 |
it under the terms of the GNU General Public License as published by
|
7 |
the Free Software Foundation, either version 3 of the License, or
|
8 |
(at your option) any later version.
|
9 |
|
10 |
This program is distributed in the hope that it will be useful,
|
11 |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
GNU General Public License for more details.
|
14 |
|
15 |
You should have received a copy of the GNU General Public License
|
16 |
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17 |
*/
|
18 |
|
19 |
/**
|
20 |
* @file os/modules/common/chconf.h
|
21 |
* @brief Common ChibiOS Configuration file for the all modules.
|
22 |
* @details Contains the application specific kernel settings.
|
23 |
*
|
24 |
* @addtogroup config
|
25 |
* @details Kernel related settings and hooks.
|
26 |
* @{
|
27 |
*/
|
28 |
|
29 |
#ifndef _AOS_CHCONF_H_
|
30 |
#define _AOS_CHCONF_H_
|
31 |
|
32 |
#define _CHIBIOS_RT_CONF_
|
33 |
|
34 |
#include <aosconf.h> |
35 |
|
36 |
/*===========================================================================*/
|
37 |
/**
|
38 |
* @name System timers settings
|
39 |
*/
|
40 |
/*===========================================================================*/
|
41 |
|
42 |
// These settings are specific to each module.
|
43 |
|
44 |
/*===========================================================================*/
|
45 |
/**
|
46 |
* @name Kernel parameters and options
|
47 |
* @{
|
48 |
*/
|
49 |
/*===========================================================================*/
|
50 |
|
51 |
/**
|
52 |
* @brief Round robin interval.
|
53 |
* @details This constant is the number of system ticks allowed for the
|
54 |
* threads before preemption occurs. Setting this value to zero
|
55 |
* disables the preemption for threads with equal priority and the
|
56 |
* round robin becomes cooperative. Note that higher priority
|
57 |
* threads can still preempt, the kernel is always preemptive.
|
58 |
* @note Disabling the round robin preemption makes the kernel more compact
|
59 |
* and generally faster.
|
60 |
* @note The round robin preemption is not supported in tickless mode and
|
61 |
* must be set to zero in that case.
|
62 |
*/
|
63 |
#define CH_CFG_TIME_QUANTUM 0 |
64 |
|
65 |
/**
|
66 |
* @brief Managed RAM size.
|
67 |
* @details Size of the RAM area to be managed by the OS. If set to zero
|
68 |
* then the whole available RAM is used. The core memory is made
|
69 |
* available to the heap allocator and/or can be used directly through
|
70 |
* the simplified core memory allocator.
|
71 |
*
|
72 |
* @note In order to let the OS manage the whole RAM the linker script must
|
73 |
* provide the @p __heap_base__ and @p __heap_end__ symbols.
|
74 |
* @note Requires @p CH_CFG_USE_MEMCORE.
|
75 |
*/
|
76 |
#define CH_CFG_MEMCORE_SIZE 0 |
77 |
|
78 |
/**
|
79 |
* @brief Idle thread automatic spawn suppression.
|
80 |
* @details When this option is activated the function @p chSysInit()
|
81 |
* does not spawn the idle thread. The application @p main()
|
82 |
* function becomes the idle thread and must implement an
|
83 |
* infinite loop.
|
84 |
*/
|
85 |
#define CH_CFG_NO_IDLE_THREAD FALSE
|
86 |
|
87 |
/** @} */
|
88 |
|
89 |
/*===========================================================================*/
|
90 |
/**
|
91 |
* @name Performance options
|
92 |
* @{
|
93 |
*/
|
94 |
/*===========================================================================*/
|
95 |
|
96 |
/**
|
97 |
* @brief OS optimization.
|
98 |
* @details If enabled then time efficient rather than space efficient code
|
99 |
* is used when two possible implementations exist.
|
100 |
*
|
101 |
* @note This is not related to the compiler optimization options.
|
102 |
* @note The default is @p TRUE.
|
103 |
*/
|
104 |
#define CH_CFG_OPTIMIZE_SPEED TRUE
|
105 |
|
106 |
/** @} */
|
107 |
|
108 |
/*===========================================================================*/
|
109 |
/**
|
110 |
* @name Subsystem options
|
111 |
* @{
|
112 |
*/
|
113 |
/*===========================================================================*/
|
114 |
|
115 |
/**
|
116 |
* @brief Time Measurement APIs.
|
117 |
* @details If enabled then the time measurement APIs are included in
|
118 |
* the kernel.
|
119 |
*
|
120 |
* @note The default is @p TRUE.
|
121 |
*/
|
122 |
#define CH_CFG_USE_TM TRUE
|
123 |
|
124 |
/**
|
125 |
* @brief Threads registry APIs.
|
126 |
* @details If enabled then the registry APIs are included in the kernel.
|
127 |
*
|
128 |
* @note The default is @p TRUE.
|
129 |
*/
|
130 |
#define CH_CFG_USE_REGISTRY FALSE
|
131 |
|
132 |
/**
|
133 |
* @brief Threads synchronization APIs.
|
134 |
* @details If enabled then the @p chThdWait() function is included in
|
135 |
* the kernel.
|
136 |
*
|
137 |
* @note The default is @p TRUE.
|
138 |
*/
|
139 |
#define CH_CFG_USE_WAITEXIT TRUE
|
140 |
|
141 |
/**
|
142 |
* @brief Semaphores APIs.
|
143 |
* @details If enabled then the Semaphores APIs are included in the kernel.
|
144 |
*
|
145 |
* @note The default is @p TRUE.
|
146 |
*/
|
147 |
#define CH_CFG_USE_SEMAPHORES TRUE
|
148 |
|
149 |
/**
|
150 |
* @brief Semaphores queuing mode.
|
151 |
* @details If enabled then the threads are enqueued on semaphores by
|
152 |
* priority rather than in FIFO order.
|
153 |
*
|
154 |
* @note The default is @p FALSE. Enable this if you have special
|
155 |
* requirements.
|
156 |
* @note Requires @p CH_CFG_USE_SEMAPHORES.
|
157 |
*/
|
158 |
#define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE
|
159 |
|
160 |
/**
|
161 |
* @brief Mutexes APIs.
|
162 |
* @details If enabled then the mutexes APIs are included in the kernel.
|
163 |
*
|
164 |
* @note The default is @p TRUE.
|
165 |
*/
|
166 |
#define CH_CFG_USE_MUTEXES TRUE
|
167 |
|
168 |
/**
|
169 |
* @brief Enables recursive behavior on mutexes.
|
170 |
* @note Recursive mutexes are heavier and have an increased
|
171 |
* memory footprint.
|
172 |
*
|
173 |
* @note The default is @p FALSE.
|
174 |
* @note Requires @p CH_CFG_USE_MUTEXES.
|
175 |
*/
|
176 |
#define CH_CFG_USE_MUTEXES_RECURSIVE FALSE
|
177 |
|
178 |
/**
|
179 |
* @brief Conditional Variables APIs.
|
180 |
* @details If enabled then the conditional variables APIs are included
|
181 |
* in the kernel.
|
182 |
*
|
183 |
* @note The default is @p TRUE.
|
184 |
* @note Requires @p CH_CFG_USE_MUTEXES.
|
185 |
*/
|
186 |
#define CH_CFG_USE_CONDVARS TRUE
|
187 |
|
188 |
/**
|
189 |
* @brief Conditional Variables APIs with timeout.
|
190 |
* @details If enabled then the conditional variables APIs with timeout
|
191 |
* specification are included in the kernel.
|
192 |
*
|
193 |
* @note The default is @p TRUE.
|
194 |
* @note Requires @p CH_CFG_USE_CONDVARS.
|
195 |
*/
|
196 |
#define CH_CFG_USE_CONDVARS_TIMEOUT TRUE
|
197 |
|
198 |
/**
|
199 |
* @brief Events Flags APIs.
|
200 |
* @details If enabled then the event flags APIs are included in the kernel.
|
201 |
*
|
202 |
* @note The default is @p TRUE.
|
203 |
*/
|
204 |
#define CH_CFG_USE_EVENTS TRUE
|
205 |
|
206 |
/**
|
207 |
* @brief Events Flags APIs with timeout.
|
208 |
* @details If enabled then the events APIs with timeout specification
|
209 |
* are included in the kernel.
|
210 |
*
|
211 |
* @note The default is @p TRUE.
|
212 |
* @note Requires @p CH_CFG_USE_EVENTS.
|
213 |
*/
|
214 |
#define CH_CFG_USE_EVENTS_TIMEOUT TRUE
|
215 |
|
216 |
/**
|
217 |
* @brief Synchronous Messages APIs.
|
218 |
* @details If enabled then the synchronous messages APIs are included
|
219 |
* in the kernel.
|
220 |
*
|
221 |
* @note The default is @p TRUE.
|
222 |
*/
|
223 |
#define CH_CFG_USE_MESSAGES FALSE
|
224 |
|
225 |
/**
|
226 |
* @brief Synchronous Messages queuing mode.
|
227 |
* @details If enabled then messages are served by priority rather than in
|
228 |
* FIFO order.
|
229 |
*
|
230 |
* @note The default is @p FALSE. Enable this if you have special
|
231 |
* requirements.
|
232 |
* @note Requires @p CH_CFG_USE_MESSAGES.
|
233 |
*/
|
234 |
#define CH_CFG_USE_MESSAGES_PRIORITY FALSE
|
235 |
|
236 |
/**
|
237 |
* @brief Mailboxes APIs.
|
238 |
* @details If enabled then the asynchronous messages (mailboxes) APIs are
|
239 |
* included in the kernel.
|
240 |
*
|
241 |
* @note The default is @p TRUE.
|
242 |
* @note Requires @p CH_CFG_USE_SEMAPHORES.
|
243 |
*/
|
244 |
#define CH_CFG_USE_MAILBOXES FALSE
|
245 |
|
246 |
/**
|
247 |
* @brief I/O Queues APIs.
|
248 |
* @details If enabled then the I/O queues APIs are included in the kernel.
|
249 |
*
|
250 |
* @note The default is @p TRUE.
|
251 |
*/
|
252 |
#define CH_CFG_USE_QUEUES FALSE
|
253 |
|
254 |
/**
|
255 |
* @brief Core Memory Manager APIs.
|
256 |
* @details If enabled then the core memory manager APIs are included
|
257 |
* in the kernel.
|
258 |
*
|
259 |
* @note The default is @p TRUE.
|
260 |
*/
|
261 |
#define CH_CFG_USE_MEMCORE FALSE
|
262 |
|
263 |
/**
|
264 |
* @brief Heap Allocator APIs.
|
265 |
* @details If enabled then the memory heap allocator APIs are included
|
266 |
* in the kernel.
|
267 |
*
|
268 |
* @note The default is @p TRUE.
|
269 |
* @note Requires @p CH_CFG_USE_MEMCORE and either @p CH_CFG_USE_MUTEXES or
|
270 |
* @p CH_CFG_USE_SEMAPHORES.
|
271 |
* @note Mutexes are recommended.
|
272 |
*/
|
273 |
#define CH_CFG_USE_HEAP FALSE
|
274 |
|
275 |
/**
|
276 |
* @brief Memory Pools Allocator APIs.
|
277 |
* @details If enabled then the memory pools allocator APIs are included
|
278 |
* in the kernel.
|
279 |
*
|
280 |
* @note The default is @p TRUE.
|
281 |
*/
|
282 |
#define CH_CFG_USE_MEMPOOLS FALSE
|
283 |
|
284 |
/**
|
285 |
* @brief Dynamic Threads APIs.
|
286 |
* @details If enabled then the dynamic threads creation APIs are included
|
287 |
* in the kernel.
|
288 |
*
|
289 |
* @note The default is @p TRUE.
|
290 |
* @note Requires @p CH_CFG_USE_WAITEXIT.
|
291 |
* @note Requires @p CH_CFG_USE_HEAP and/or @p CH_CFG_USE_MEMPOOLS.
|
292 |
*/
|
293 |
#define CH_CFG_USE_DYNAMIC FALSE
|
294 |
|
295 |
/** @} */
|
296 |
|
297 |
/*===========================================================================*/
|
298 |
/**
|
299 |
* @name Debug options
|
300 |
* @{
|
301 |
*/
|
302 |
/*===========================================================================*/
|
303 |
|
304 |
/**
|
305 |
* @brief Debug option, kernel statistics.
|
306 |
*
|
307 |
* @note The default is @p FALSE.
|
308 |
*/
|
309 |
#if ((CH_CFG_USE_TM == TRUE) && (AMIROOS_CFG_DBG == true)) || defined(__DOXYGEN__) |
310 |
#define CH_DBG_STATISTICS TRUE
|
311 |
#else
|
312 |
#define CH_DBG_STATISTICS FALSE
|
313 |
#endif
|
314 |
|
315 |
/**
|
316 |
* @brief Debug option, system state check.
|
317 |
* @details If enabled the correct call protocol for system APIs is checked
|
318 |
* at runtime.
|
319 |
*
|
320 |
* @note The default is @p FALSE.
|
321 |
*/
|
322 |
#if (AMIROOS_CFG_DBG == true) || defined(__DOXYGEN__) |
323 |
#define CH_DBG_SYSTEM_STATE_CHECK TRUE
|
324 |
#else
|
325 |
#define CH_DBG_SYSTEM_STATE_CHECK FALSE
|
326 |
#endif
|
327 |
|
328 |
/**
|
329 |
* @brief Debug option, parameters checks.
|
330 |
* @details If enabled then the checks on the API functions input
|
331 |
* parameters are activated.
|
332 |
*
|
333 |
* @note The default is @p FALSE.
|
334 |
*/
|
335 |
#if (AMIROOS_CFG_DBG == true) || defined(__DOXYGEN__) |
336 |
#define CH_DBG_ENABLE_CHECKS TRUE
|
337 |
#else
|
338 |
#define CH_DBG_ENABLE_CHECKS FALSE
|
339 |
#endif
|
340 |
|
341 |
/**
|
342 |
* @brief Debug option, consistency checks.
|
343 |
* @details If enabled then all the assertions in the kernel code are
|
344 |
* activated. This includes consistency checks inside the kernel,
|
345 |
* runtime anomalies and port-defined checks.
|
346 |
*
|
347 |
* @note The default is @p FALSE.
|
348 |
*/
|
349 |
#if (AMIROOS_CFG_DBG == true) || defined(__DOXYGEN__) |
350 |
#define CH_DBG_ENABLE_ASSERTS TRUE
|
351 |
#else
|
352 |
#define CH_DBG_ENABLE_ASSERTS FALSE
|
353 |
#endif
|
354 |
|
355 |
/**
|
356 |
* @brief Debug option, trace buffer.
|
357 |
* @details If enabled then the trace buffer is activated.
|
358 |
*
|
359 |
* @note The default is @p CH_DBG_TRACE_MASK_DISABLED.
|
360 |
*/
|
361 |
#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED
|
362 |
|
363 |
/**
|
364 |
* @brief Trace buffer entries.
|
365 |
* @note The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is
|
366 |
* different from @p CH_DBG_TRACE_MASK_DISABLED.
|
367 |
*/
|
368 |
#define CH_DBG_TRACE_BUFFER_SIZE 128 |
369 |
|
370 |
/**
|
371 |
* @brief Debug option, stack checks.
|
372 |
* @details If enabled then a runtime stack check is performed.
|
373 |
*
|
374 |
* @note The default is @p FALSE.
|
375 |
* @note The stack check is performed in a architecture/port dependent way.
|
376 |
* It may not be implemented or some ports.
|
377 |
* @note The default failure mode is to halt the system with the global
|
378 |
* @p panic_msg variable set to @p NULL.
|
379 |
*/
|
380 |
#if (AMIROOS_CFG_DBG == true) || defined(__DOXYGEN__) |
381 |
#define CH_DBG_ENABLE_STACK_CHECK TRUE
|
382 |
#else
|
383 |
#define CH_DBG_ENABLE_STACK_CHECK FALSE
|
384 |
#endif
|
385 |
|
386 |
/**
|
387 |
* @brief Debug option, stacks initialization.
|
388 |
* @details If enabled then the threads working area is filled with a byte
|
389 |
* value when a thread is created. This can be useful for the
|
390 |
* runtime measurement of the used stack.
|
391 |
*
|
392 |
* @note The default is @p FALSE.
|
393 |
*/
|
394 |
#if (AMIROOS_CFG_PROFILE == true) || defined(__DOXYGEN__) |
395 |
#define CH_DBG_FILL_THREADS TRUE
|
396 |
#else
|
397 |
#define CH_DBG_FILL_THREADS FALSE
|
398 |
#endif
|
399 |
|
400 |
/**
|
401 |
* @brief Debug option, threads profiling.
|
402 |
* @details If enabled then a field is added to the @p thread_t structure that
|
403 |
* counts the system ticks occurred while executing the thread.
|
404 |
*
|
405 |
* @note The default is @p FALSE.
|
406 |
* @note This debug option is not currently compatible with the
|
407 |
* tickless mode.
|
408 |
*/
|
409 |
#if ((CH_CFG_ST_TIMEDELTA == 0) && (AMIROOS_CFG_PROFILE == true)) || defined(__DOXYGEN__) |
410 |
#define CH_DBG_THREADS_PROFILING TRUE
|
411 |
#else
|
412 |
#define CH_DBG_THREADS_PROFILING FALSE
|
413 |
#endif
|
414 |
|
415 |
/** @} */
|
416 |
|
417 |
/*===========================================================================*/
|
418 |
/**
|
419 |
* @name Kernel hooks
|
420 |
* @{
|
421 |
*/
|
422 |
/*===========================================================================*/
|
423 |
|
424 |
/**
|
425 |
* @brief Threads descriptor structure extension.
|
426 |
* @details User fields added to the end of the @p thread_t structure.
|
427 |
*/
|
428 |
#define CH_CFG_THREAD_EXTRA_FIELDS \
|
429 |
/* Add threads custom fields here.*/
|
430 |
|
431 |
/**
|
432 |
* @brief Threads initialization hook.
|
433 |
* @details User initialization code added to the @p chThdInit() API.
|
434 |
*
|
435 |
* @note It is invoked from within @p chThdInit() and implicitly from all
|
436 |
* the threads creation APIs.
|
437 |
*/
|
438 |
#define CH_CFG_THREAD_INIT_HOOK(tp) { \
|
439 |
/* Add threads initialization code here.*/ \
|
440 |
} |
441 |
|
442 |
/**
|
443 |
* @brief Threads finalization hook.
|
444 |
* @details User finalization code added to the @p chThdExit() API.
|
445 |
*
|
446 |
* @note It is inserted into lock zone.
|
447 |
* @note It is also invoked when the threads simply return in order to
|
448 |
* terminate.
|
449 |
*/
|
450 |
#define CH_CFG_THREAD_EXIT_HOOK(tp) { \
|
451 |
/* Add threads finalization code here.*/ \
|
452 |
} |
453 |
|
454 |
/**
|
455 |
* @brief Context switch hook.
|
456 |
* @details This hook is invoked just before switching between threads.
|
457 |
*/
|
458 |
#define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) { \
|
459 |
/* Context switch code here.*/ \
|
460 |
} |
461 |
|
462 |
/**
|
463 |
* @brief ISR enter hook.
|
464 |
*/
|
465 |
#define CH_CFG_IRQ_PROLOGUE_HOOK() { \
|
466 |
/* IRQ prologue code here.*/ \
|
467 |
} |
468 |
|
469 |
/**
|
470 |
* @brief ISR exit hook.
|
471 |
*/
|
472 |
#define CH_CFG_IRQ_EPILOGUE_HOOK() { \
|
473 |
/* IRQ epilogue code here.*/ \
|
474 |
} |
475 |
|
476 |
/**
|
477 |
* @brief Idle thread enter hook.
|
478 |
* @note This hook is invoked within a critical zone, no OS functions
|
479 |
* should be invoked from here.
|
480 |
* @note This macro can be used to activate a power saving mode.
|
481 |
*/
|
482 |
#define CH_CFG_IDLE_ENTER_HOOK() { \
|
483 |
/* Idle-enter code here.*/ \
|
484 |
} |
485 |
|
486 |
/**
|
487 |
* @brief Idle thread leave hook.
|
488 |
* @note This hook is invoked within a critical zone, no OS functions
|
489 |
* should be invoked from here.
|
490 |
* @note This macro can be used to deactivate a power saving mode.
|
491 |
*/
|
492 |
#define CH_CFG_IDLE_LEAVE_HOOK() { \
|
493 |
/* Idle-leave code here.*/ \
|
494 |
} |
495 |
|
496 |
/**
|
497 |
* @brief Idle Loop hook.
|
498 |
* @details This hook is continuously invoked by the idle thread loop.
|
499 |
*/
|
500 |
#define CH_CFG_IDLE_LOOP_HOOK() { \
|
501 |
/* Idle loop code here.*/ \
|
502 |
} |
503 |
|
504 |
/**
|
505 |
* @brief System tick event hook.
|
506 |
* @details This hook is invoked in the system tick handler immediately
|
507 |
* after processing the virtual timers queue.
|
508 |
*/
|
509 |
#define CH_CFG_SYSTEM_TICK_HOOK() { \
|
510 |
/* System tick event code here.*/ \
|
511 |
} |
512 |
|
513 |
/**
|
514 |
* @brief System halt hook.
|
515 |
* @details This hook is invoked in case to a system halting error before
|
516 |
* the system is halted.
|
517 |
*/
|
518 |
#define CH_CFG_SYSTEM_HALT_HOOK(reason) { \
|
519 |
extern void aosPrintHaltErrorCode(const char* reason); \ |
520 |
aosPrintHaltErrorCode(reason); \ |
521 |
} |
522 |
|
523 |
/**
|
524 |
* @brief Trace hook.
|
525 |
* @details This hook is invoked each time a new record is written in the
|
526 |
* trace buffer.
|
527 |
*/
|
528 |
#define CH_CFG_TRACE_HOOK(tep) { \
|
529 |
/* Trace code here.*/ \
|
530 |
} |
531 |
|
532 |
/** @} */
|
533 |
|
534 |
/*===========================================================================*/
|
535 |
/**
|
536 |
* @name Port specific settings
|
537 |
*/
|
538 |
/*===========================================================================*/
|
539 |
|
540 |
// These settings are specific to each module.
|
541 |
|
542 |
/*===========================================================================*/
|
543 |
/**
|
544 |
* @name other
|
545 |
* @{
|
546 |
*/
|
547 |
/*===========================================================================*/
|
548 |
|
549 |
/**
|
550 |
* @brief Flag to enable/disable floating point support in chprinf()
|
551 |
*/
|
552 |
#define CHPRINTF_USE_FLOAT TRUE
|
553 |
|
554 |
/** @} */
|
555 |
|
556 |
#endif /* _AOS_CHCONF_H_ */ |
557 |
|
558 |
/** @} */
|