amiro-os / devices / DiWheelDrive / chconf.h @ 9090cc7e
History | View | Annotate | Download (15.748 KB)
1 |
/**
|
---|---|
2 |
* @file devices/DiWheelDrive/chconf.h
|
3 |
* @brief Configuration file.
|
4 |
*
|
5 |
* @addtogroup config
|
6 |
* @details Kernel related settings and hooks.
|
7 |
* @{
|
8 |
*/
|
9 |
|
10 |
#ifndef _CHCONF_H_
|
11 |
#define _CHCONF_H_
|
12 |
|
13 |
/*===========================================================================*/
|
14 |
/**
|
15 |
* @name Kernel parameters and options
|
16 |
* @{
|
17 |
*/
|
18 |
/*===========================================================================*/
|
19 |
|
20 |
/**
|
21 |
* @brief System tick frequency.
|
22 |
* @details Frequency of the system timer that drives the system ticks. This
|
23 |
* setting also defines the system tick time unit.
|
24 |
*/
|
25 |
#if !defined(CH_FREQUENCY) || defined(__DOXYGEN__)
|
26 |
#define CH_FREQUENCY 1000 |
27 |
#endif
|
28 |
|
29 |
/**
|
30 |
* @brief Round robin interval.
|
31 |
* @details This constant is the number of system ticks allowed for the
|
32 |
* threads before preemption occurs. Setting this value to zero
|
33 |
* disables the preemption for threads with equal priority and the
|
34 |
* round robin becomes cooperative. Note that higher priority
|
35 |
* threads can still preempt, the kernel is always preemptive.
|
36 |
*
|
37 |
* @note Disabling the round robin preemption makes the kernel more compact
|
38 |
* and generally faster.
|
39 |
*/
|
40 |
#if !defined(CH_TIME_QUANTUM) || defined(__DOXYGEN__)
|
41 |
#define CH_TIME_QUANTUM 20 |
42 |
#endif
|
43 |
|
44 |
/**
|
45 |
* @brief Managed RAM size.
|
46 |
* @details Size of the RAM area to be managed by the OS. If set to zero
|
47 |
* then the whole available RAM is used. The core memory is made
|
48 |
* available to the heap allocator and/or can be used directly through
|
49 |
* the simplified core memory allocator.
|
50 |
*
|
51 |
* @note In order to let the OS manage the whole RAM the linker script must
|
52 |
* provide the @p __heap_base__ and @p __heap_end__ symbols.
|
53 |
* @note Requires @p CH_USE_MEMCORE.
|
54 |
*/
|
55 |
#if !defined(CH_MEMCORE_SIZE) || defined(__DOXYGEN__)
|
56 |
#define CH_MEMCORE_SIZE 0 |
57 |
#endif
|
58 |
|
59 |
/**
|
60 |
* @brief Idle thread automatic spawn suppression.
|
61 |
* @details When this option is activated the function @p chSysInit()
|
62 |
* does not spawn the idle thread automatically. The application has
|
63 |
* then the responsibility to do one of the following:
|
64 |
* - Spawn a custom idle thread at priority @p IDLEPRIO.
|
65 |
* - Change the main() thread priority to @p IDLEPRIO then enter
|
66 |
* an endless loop. In this scenario the @p main() thread acts as
|
67 |
* the idle thread.
|
68 |
* .
|
69 |
* @note Unless an idle thread is spawned the @p main() thread must not
|
70 |
* enter a sleep state.
|
71 |
*/
|
72 |
#if !defined(CH_NO_IDLE_THREAD) || defined(__DOXYGEN__)
|
73 |
#define CH_NO_IDLE_THREAD FALSE
|
74 |
#endif
|
75 |
|
76 |
/** @} */
|
77 |
|
78 |
/*===========================================================================*/
|
79 |
/**
|
80 |
* @name Performance options
|
81 |
* @{
|
82 |
*/
|
83 |
/*===========================================================================*/
|
84 |
|
85 |
/**
|
86 |
* @brief OS optimization.
|
87 |
* @details If enabled then time efficient rather than space efficient code
|
88 |
* is used when two possible implementations exist.
|
89 |
*
|
90 |
* @note This is not related to the compiler optimization options.
|
91 |
* @note The default is @p TRUE.
|
92 |
*/
|
93 |
#if !defined(CH_OPTIMIZE_SPEED) || defined(__DOXYGEN__)
|
94 |
#define CH_OPTIMIZE_SPEED TRUE
|
95 |
#endif
|
96 |
|
97 |
/** @} */
|
98 |
|
99 |
/*===========================================================================*/
|
100 |
/**
|
101 |
* @name Subsystem options
|
102 |
* @{
|
103 |
*/
|
104 |
/*===========================================================================*/
|
105 |
|
106 |
/**
|
107 |
* @brief Threads registry APIs.
|
108 |
* @details If enabled then the registry APIs are included in the kernel.
|
109 |
*
|
110 |
* @note The default is @p TRUE.
|
111 |
*/
|
112 |
#if !defined(CH_USE_REGISTRY) || defined(__DOXYGEN__)
|
113 |
#define CH_USE_REGISTRY TRUE
|
114 |
#endif
|
115 |
|
116 |
/**
|
117 |
* @brief Threads synchronization APIs.
|
118 |
* @details If enabled then the @p chThdWait() function is included in
|
119 |
* the kernel.
|
120 |
*
|
121 |
* @note The default is @p TRUE.
|
122 |
*/
|
123 |
#if !defined(CH_USE_WAITEXIT) || defined(__DOXYGEN__)
|
124 |
#define CH_USE_WAITEXIT TRUE
|
125 |
#endif
|
126 |
|
127 |
/**
|
128 |
* @brief Semaphores APIs.
|
129 |
* @details If enabled then the Semaphores APIs are included in the kernel.
|
130 |
*
|
131 |
* @note The default is @p TRUE.
|
132 |
*/
|
133 |
#if !defined(CH_USE_SEMAPHORES) || defined(__DOXYGEN__)
|
134 |
#define CH_USE_SEMAPHORES TRUE
|
135 |
#endif
|
136 |
|
137 |
/**
|
138 |
* @brief Semaphores queuing mode.
|
139 |
* @details If enabled then the threads are enqueued on semaphores by
|
140 |
* priority rather than in FIFO order.
|
141 |
*
|
142 |
* @note The default is @p FALSE. Enable this if you have special requirements.
|
143 |
* @note Requires @p CH_USE_SEMAPHORES.
|
144 |
*/
|
145 |
#if !defined(CH_USE_SEMAPHORES_PRIORITY) || defined(__DOXYGEN__)
|
146 |
#define CH_USE_SEMAPHORES_PRIORITY FALSE
|
147 |
#endif
|
148 |
|
149 |
/**
|
150 |
* @brief Atomic semaphore API.
|
151 |
* @details If enabled then the semaphores the @p chSemSignalWait() API
|
152 |
* is included in the kernel.
|
153 |
*
|
154 |
* @note The default is @p TRUE.
|
155 |
* @note Requires @p CH_USE_SEMAPHORES.
|
156 |
*/
|
157 |
#if !defined(CH_USE_SEMSW) || defined(__DOXYGEN__)
|
158 |
#define CH_USE_SEMSW TRUE
|
159 |
#endif
|
160 |
|
161 |
/**
|
162 |
* @brief Mutexes APIs.
|
163 |
* @details If enabled then the mutexes APIs are included in the kernel.
|
164 |
*
|
165 |
* @note The default is @p TRUE.
|
166 |
*/
|
167 |
#if !defined(CH_USE_MUTEXES) || defined(__DOXYGEN__)
|
168 |
#define CH_USE_MUTEXES TRUE
|
169 |
#endif
|
170 |
|
171 |
/**
|
172 |
* @brief Conditional Variables APIs.
|
173 |
* @details If enabled then the conditional variables APIs are included
|
174 |
* in the kernel.
|
175 |
*
|
176 |
* @note The default is @p TRUE.
|
177 |
* @note Requires @p CH_USE_MUTEXES.
|
178 |
*/
|
179 |
#if !defined(CH_USE_CONDVARS) || defined(__DOXYGEN__)
|
180 |
#define CH_USE_CONDVARS TRUE
|
181 |
#endif
|
182 |
|
183 |
/**
|
184 |
* @brief Conditional Variables APIs with timeout.
|
185 |
* @details If enabled then the conditional variables APIs with timeout
|
186 |
* specification are included in the kernel.
|
187 |
*
|
188 |
* @note The default is @p TRUE.
|
189 |
* @note Requires @p CH_USE_CONDVARS.
|
190 |
*/
|
191 |
#if !defined(CH_USE_CONDVARS_TIMEOUT) || defined(__DOXYGEN__)
|
192 |
#define CH_USE_CONDVARS_TIMEOUT TRUE
|
193 |
#endif
|
194 |
|
195 |
/**
|
196 |
* @brief Events Flags APIs.
|
197 |
* @details If enabled then the event flags APIs are included in the kernel.
|
198 |
*
|
199 |
* @note The default is @p TRUE.
|
200 |
*/
|
201 |
#if !defined(CH_USE_EVENTS) || defined(__DOXYGEN__)
|
202 |
#define CH_USE_EVENTS TRUE
|
203 |
#endif
|
204 |
|
205 |
/**
|
206 |
* @brief Events Flags APIs with timeout.
|
207 |
* @details If enabled then the events APIs with timeout specification
|
208 |
* are included in the kernel.
|
209 |
*
|
210 |
* @note The default is @p TRUE.
|
211 |
* @note Requires @p CH_USE_EVENTS.
|
212 |
*/
|
213 |
#if !defined(CH_USE_EVENTS_TIMEOUT) || defined(__DOXYGEN__)
|
214 |
#define CH_USE_EVENTS_TIMEOUT TRUE
|
215 |
#endif
|
216 |
|
217 |
/**
|
218 |
* @brief Synchronous Messages APIs.
|
219 |
* @details If enabled then the synchronous messages APIs are included
|
220 |
* in the kernel.
|
221 |
*
|
222 |
* @note The default is @p TRUE.
|
223 |
*/
|
224 |
#if !defined(CH_USE_MESSAGES) || defined(__DOXYGEN__)
|
225 |
#define CH_USE_MESSAGES TRUE
|
226 |
#endif
|
227 |
|
228 |
/**
|
229 |
* @brief Synchronous Messages queuing mode.
|
230 |
* @details If enabled then messages are served by priority rather than in
|
231 |
* FIFO order.
|
232 |
*
|
233 |
* @note The default is @p FALSE. Enable this if you have special requirements.
|
234 |
* @note Requires @p CH_USE_MESSAGES.
|
235 |
*/
|
236 |
#if !defined(CH_USE_MESSAGES_PRIORITY) || defined(__DOXYGEN__)
|
237 |
#define CH_USE_MESSAGES_PRIORITY FALSE
|
238 |
#endif
|
239 |
|
240 |
/**
|
241 |
* @brief Mailboxes APIs.
|
242 |
* @details If enabled then the asynchronous messages (mailboxes) APIs are
|
243 |
* included in the kernel.
|
244 |
*
|
245 |
* @note The default is @p TRUE.
|
246 |
* @note Requires @p CH_USE_SEMAPHORES.
|
247 |
*/
|
248 |
#if !defined(CH_USE_MAILBOXES) || defined(__DOXYGEN__)
|
249 |
#define CH_USE_MAILBOXES TRUE
|
250 |
#endif
|
251 |
|
252 |
/**
|
253 |
* @brief I/O Queues APIs.
|
254 |
* @details If enabled then the I/O queues APIs are included in the kernel.
|
255 |
*
|
256 |
* @note The default is @p TRUE.
|
257 |
*/
|
258 |
#if !defined(CH_USE_QUEUES) || defined(__DOXYGEN__)
|
259 |
#define CH_USE_QUEUES TRUE
|
260 |
#endif
|
261 |
|
262 |
/**
|
263 |
* @brief Core Memory Manager APIs.
|
264 |
* @details If enabled then the core memory manager APIs are included
|
265 |
* in the kernel.
|
266 |
*
|
267 |
* @note The default is @p TRUE.
|
268 |
*/
|
269 |
#if !defined(CH_USE_MEMCORE) || defined(__DOXYGEN__)
|
270 |
#define CH_USE_MEMCORE TRUE
|
271 |
#endif
|
272 |
|
273 |
/**
|
274 |
* @brief Heap Allocator APIs.
|
275 |
* @details If enabled then the memory heap allocator APIs are included
|
276 |
* in the kernel.
|
277 |
*
|
278 |
* @note The default is @p TRUE.
|
279 |
* @note Requires @p CH_USE_MEMCORE and either @p CH_USE_MUTEXES or
|
280 |
* @p CH_USE_SEMAPHORES.
|
281 |
* @note Mutexes are recommended.
|
282 |
*/
|
283 |
#if !defined(CH_USE_HEAP) || defined(__DOXYGEN__)
|
284 |
#define CH_USE_HEAP TRUE
|
285 |
#endif
|
286 |
|
287 |
/**
|
288 |
* @brief C-runtime allocator.
|
289 |
* @details If enabled the the heap allocator APIs just wrap the C-runtime
|
290 |
* @p malloc() and @p free() functions.
|
291 |
*
|
292 |
* @note The default is @p FALSE.
|
293 |
* @note Requires @p CH_USE_HEAP.
|
294 |
* @note The C-runtime may or may not require @p CH_USE_MEMCORE, see the
|
295 |
* appropriate documentation.
|
296 |
*/
|
297 |
#if !defined(CH_USE_MALLOC_HEAP) || defined(__DOXYGEN__)
|
298 |
#define CH_USE_MALLOC_HEAP FALSE
|
299 |
#endif
|
300 |
|
301 |
/**
|
302 |
* @brief Memory Pools Allocator APIs.
|
303 |
* @details If enabled then the memory pools allocator APIs are included
|
304 |
* in the kernel.
|
305 |
*
|
306 |
* @note The default is @p TRUE.
|
307 |
*/
|
308 |
#if !defined(CH_USE_MEMPOOLS) || defined(__DOXYGEN__)
|
309 |
#define CH_USE_MEMPOOLS TRUE
|
310 |
#endif
|
311 |
|
312 |
/**
|
313 |
* @brief Dynamic Threads APIs.
|
314 |
* @details If enabled then the dynamic threads creation APIs are included
|
315 |
* in the kernel.
|
316 |
*
|
317 |
* @note The default is @p TRUE.
|
318 |
* @note Requires @p CH_USE_WAITEXIT.
|
319 |
* @note Requires @p CH_USE_HEAP and/or @p CH_USE_MEMPOOLS.
|
320 |
*/
|
321 |
#if !defined(CH_USE_DYNAMIC) || defined(__DOXYGEN__)
|
322 |
#define CH_USE_DYNAMIC TRUE
|
323 |
#endif
|
324 |
|
325 |
/** @} */
|
326 |
|
327 |
/*===========================================================================*/
|
328 |
/**
|
329 |
* @name Debug options
|
330 |
* @{
|
331 |
*/
|
332 |
/*===========================================================================*/
|
333 |
|
334 |
/**
|
335 |
* @brief Debug option, system state check.
|
336 |
* @details If enabled the correct call protocol for system APIs is checked
|
337 |
* at runtime.
|
338 |
*
|
339 |
* @note The default is @p FALSE.
|
340 |
*/
|
341 |
#if !defined(CH_DBG_SYSTEM_STATE_CHECK) || defined(__DOXYGEN__)
|
342 |
#define CH_DBG_SYSTEM_STATE_CHECK TRUE
|
343 |
#endif
|
344 |
|
345 |
/**
|
346 |
* @brief Debug option, parameters checks.
|
347 |
* @details If enabled then the checks on the API functions input
|
348 |
* parameters are activated.
|
349 |
*
|
350 |
* @note The default is @p FALSE.
|
351 |
*/
|
352 |
#if !defined(CH_DBG_ENABLE_CHECKS) || defined(__DOXYGEN__)
|
353 |
#define CH_DBG_ENABLE_CHECKS TRUE
|
354 |
#endif
|
355 |
|
356 |
/**
|
357 |
* @brief Debug option, consistency checks.
|
358 |
* @details If enabled then all the assertions in the kernel code are
|
359 |
* activated. This includes consistency checks inside the kernel,
|
360 |
* runtime anomalies and port-defined checks.
|
361 |
*
|
362 |
* @note The default is @p FALSE.
|
363 |
*/
|
364 |
#if !defined(CH_DBG_ENABLE_ASSERTS) || defined(__DOXYGEN__)
|
365 |
#define CH_DBG_ENABLE_ASSERTS TRUE
|
366 |
#endif
|
367 |
|
368 |
/**
|
369 |
* @brief Debug option, trace buffer.
|
370 |
* @details If enabled then the context switch circular trace buffer is
|
371 |
* activated.
|
372 |
*
|
373 |
* @note The default is @p FALSE.
|
374 |
*/
|
375 |
#if !defined(CH_DBG_ENABLE_TRACE) || defined(__DOXYGEN__)
|
376 |
#define CH_DBG_ENABLE_TRACE TRUE
|
377 |
#endif
|
378 |
|
379 |
/**
|
380 |
* @brief Debug option, stack checks.
|
381 |
* @details If enabled then a runtime stack check is performed.
|
382 |
*
|
383 |
* @note The default is @p FALSE.
|
384 |
* @note The stack check is performed in a architecture/port dependent way.
|
385 |
* It may not be implemented or some ports.
|
386 |
* @note The default failure mode is to halt the system with the global
|
387 |
* @p panic_msg variable set to @p NULL.
|
388 |
*/
|
389 |
#if !defined(CH_DBG_ENABLE_STACK_CHECK) || defined(__DOXYGEN__)
|
390 |
#define CH_DBG_ENABLE_STACK_CHECK TRUE
|
391 |
#endif
|
392 |
|
393 |
/**
|
394 |
* @brief Debug option, stacks initialization.
|
395 |
* @details If enabled then the threads working area is filled with a byte
|
396 |
* value when a thread is created. This can be useful for the
|
397 |
* runtime measurement of the used stack.
|
398 |
*
|
399 |
* @note The default is @p FALSE.
|
400 |
*/
|
401 |
#if !defined(CH_DBG_FILL_THREADS) || defined(__DOXYGEN__)
|
402 |
#define CH_DBG_FILL_THREADS FALSE
|
403 |
#endif
|
404 |
|
405 |
/**
|
406 |
* @brief Debug option, threads profiling.
|
407 |
* @details If enabled then a field is added to the @p Thread structure that
|
408 |
* counts the system ticks occurred while executing the thread.
|
409 |
*
|
410 |
* @note The default is @p TRUE.
|
411 |
* @note This debug option is defaulted to TRUE because it is required by
|
412 |
* some test cases into the test suite.
|
413 |
*/
|
414 |
#if !defined(CH_DBG_THREADS_PROFILING) || defined(__DOXYGEN__)
|
415 |
#define CH_DBG_THREADS_PROFILING TRUE
|
416 |
#endif
|
417 |
|
418 |
/** @} */
|
419 |
|
420 |
/*===========================================================================*/
|
421 |
/**
|
422 |
* @name Kernel hooks
|
423 |
* @{
|
424 |
*/
|
425 |
/*===========================================================================*/
|
426 |
|
427 |
/**
|
428 |
* @brief Threads descriptor structure extension.
|
429 |
* @details User fields added to the end of the @p Thread structure.
|
430 |
*/
|
431 |
#if !defined(THREAD_EXT_FIELDS) || defined(__DOXYGEN__)
|
432 |
#define THREAD_EXT_FIELDS \
|
433 |
/* Add threads custom fields here.*/
|
434 |
#endif
|
435 |
|
436 |
/**
|
437 |
* @brief Threads initialization hook.
|
438 |
* @details User initialization code added to the @p chThdInit() API.
|
439 |
*
|
440 |
* @note It is invoked from within @p chThdInit() and implicitly from all
|
441 |
* the threads creation APIs.
|
442 |
*/
|
443 |
#if !defined(THREAD_EXT_INIT_HOOK) || defined(__DOXYGEN__)
|
444 |
#define THREAD_EXT_INIT_HOOK(tp) { \
|
445 |
/* Add threads initialization code here.*/ \
|
446 |
} |
447 |
#endif
|
448 |
|
449 |
/**
|
450 |
* @brief Threads finalization hook.
|
451 |
* @details User finalization code added to the @p chThdExit() API.
|
452 |
*
|
453 |
* @note It is inserted into lock zone.
|
454 |
* @note It is also invoked when the threads simply return in order to
|
455 |
* terminate.
|
456 |
*/
|
457 |
#if !defined(THREAD_EXT_EXIT_HOOK) || defined(__DOXYGEN__)
|
458 |
#define THREAD_EXT_EXIT_HOOK(tp) { \
|
459 |
/* Add threads finalization code here.*/ \
|
460 |
} |
461 |
#endif
|
462 |
|
463 |
/**
|
464 |
* @brief Context switch hook.
|
465 |
* @details This hook is invoked just before switching between threads.
|
466 |
*/
|
467 |
#if !defined(THREAD_CONTEXT_SWITCH_HOOK) || defined(__DOXYGEN__)
|
468 |
#define THREAD_CONTEXT_SWITCH_HOOK(ntp, otp) { \
|
469 |
/* Context switch code here.*/ \
|
470 |
} |
471 |
#endif
|
472 |
|
473 |
/**
|
474 |
* @brief Idle Loop hook.
|
475 |
* @details This hook is continuously invoked by the idle thread loop.
|
476 |
*/
|
477 |
#if !defined(IDLE_LOOP_HOOK) || defined(__DOXYGEN__)
|
478 |
#define IDLE_LOOP_HOOK() { \
|
479 |
/* Idle loop code here.*/ \
|
480 |
} |
481 |
#endif
|
482 |
|
483 |
/**
|
484 |
* @brief System tick event hook.
|
485 |
* @details This hook is invoked in the system tick handler immediately
|
486 |
* after processing the virtual timers queue.
|
487 |
*/
|
488 |
#if !defined(SYSTEM_TICK_EVENT_HOOK) || defined(__DOXYGEN__)
|
489 |
#define SYSTEM_TICK_EVENT_HOOK() { \
|
490 |
/* System tick event code here.*/ \
|
491 |
} |
492 |
#endif
|
493 |
|
494 |
/**
|
495 |
* @brief System halt hook.
|
496 |
* @details This hook is invoked in case to a system halting error before
|
497 |
* the system is halted.
|
498 |
*/
|
499 |
#if !defined(SYSTEM_HALT_HOOK) || defined(__DOXYGEN__)
|
500 |
void haltErrorCode(void); |
501 |
#define SYSTEM_HALT_HOOK() { \
|
502 |
/* System halt code here.*/ \
|
503 |
haltErrorCode(); \ |
504 |
} |
505 |
#endif
|
506 |
|
507 |
/** @} */
|
508 |
|
509 |
/*===========================================================================*/
|
510 |
/* Port-specific settings (override port settings defaulted in chcore.h). */
|
511 |
/*===========================================================================*/
|
512 |
|
513 |
/* NVIC VTOR initialization (only offset!) */
|
514 |
#define CORTEX_VTOR_INIT 0x00006000 |
515 |
|
516 |
#endif /* _CHCONF_H_ */ |
517 |
|
518 |
/** @} */
|