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