amiro-os / modules / aos_chconf.h @ 959f302e
History | View | Annotate | Download (20.4 KB)
1 | 043cdf33 | Thomas Schöpping | /*
|
---|---|---|---|
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 | 1e5f7648 | Thomas Schöpping | * @{
|
40 | 043cdf33 | Thomas Schöpping | */
|
41 | /*===========================================================================*/
|
||
42 | |||
43 | 1e5f7648 | Thomas Schöpping | /**
|
44 | * @brief System tick frequency.
|
||
45 | * @details Frequency of the system timer that drives the system ticks. This
|
||
46 | * setting also defines the system tick time unit.
|
||
47 | */
|
||
48 | #if !defined(CH_CFG_ST_FREQUENCY)
|
||
49 | #define CH_CFG_ST_FREQUENCY 1000000UL |
||
50 | #endif
|
||
51 | |||
52 | /**
|
||
53 | * @brief Time intervals data size.
|
||
54 | * @note Allowed values are 16, 32 or 64 bits.
|
||
55 | */
|
||
56 | #if !defined(CH_CFG_INTERVALS_SIZE)
|
||
57 | #define CH_CFG_INTERVALS_SIZE 32 |
||
58 | #endif
|
||
59 | |||
60 | /**
|
||
61 | * @brief Time types data size.
|
||
62 | * @note Allowed values are 16 or 32 bits.
|
||
63 | */
|
||
64 | #if !defined(CH_CFG_TIME_TYPES_SIZE)
|
||
65 | #define CH_CFG_TIME_TYPES_SIZE 32 |
||
66 | #endif
|
||
67 | |||
68 | /**
|
||
69 | * @brief Time delta constant for the tick-less mode.
|
||
70 | * @note If this value is zero then the system uses the classic
|
||
71 | * periodic tick. This value represents the minimum number
|
||
72 | * of ticks that is safe to specify in a timeout directive.
|
||
73 | * The value one is not valid, timeouts are rounded up to
|
||
74 | * this value.
|
||
75 | */
|
||
76 | #if !defined(CH_CFG_ST_TIMEDELTA)
|
||
77 | 9f224ade | Thomas Schöpping | #define CH_CFG_ST_TIMEDELTA 50 |
78 | 1e5f7648 | Thomas Schöpping | #endif
|
79 | |||
80 | /** @} */
|
||
81 | 043cdf33 | Thomas Schöpping | |
82 | /*===========================================================================*/
|
||
83 | /**
|
||
84 | * @name Kernel parameters and options
|
||
85 | * @{
|
||
86 | */
|
||
87 | /*===========================================================================*/
|
||
88 | |||
89 | /**
|
||
90 | * @brief Round robin interval.
|
||
91 | * @details This constant is the number of system ticks allowed for the
|
||
92 | * threads before preemption occurs. Setting this value to zero
|
||
93 | * disables the preemption for threads with equal priority and the
|
||
94 | * round robin becomes cooperative. Note that higher priority
|
||
95 | * threads can still preempt, the kernel is always preemptive.
|
||
96 | * @note Disabling the round robin preemption makes the kernel more compact
|
||
97 | * and generally faster.
|
||
98 | * @note The round robin preemption is not supported in tickless mode and
|
||
99 | * must be set to zero in that case.
|
||
100 | */
|
||
101 | #define CH_CFG_TIME_QUANTUM 0 |
||
102 | |||
103 | /**
|
||
104 | * @brief Managed RAM size.
|
||
105 | * @details Size of the RAM area to be managed by the OS. If set to zero
|
||
106 | * then the whole available RAM is used. The core memory is made
|
||
107 | * available to the heap allocator and/or can be used directly through
|
||
108 | * the simplified core memory allocator.
|
||
109 | *
|
||
110 | * @note In order to let the OS manage the whole RAM the linker script must
|
||
111 | * provide the @p __heap_base__ and @p __heap_end__ symbols.
|
||
112 | * @note Requires @p CH_CFG_USE_MEMCORE.
|
||
113 | */
|
||
114 | #define CH_CFG_MEMCORE_SIZE 0 |
||
115 | |||
116 | /**
|
||
117 | * @brief Idle thread automatic spawn suppression.
|
||
118 | * @details When this option is activated the function @p chSysInit()
|
||
119 | * does not spawn the idle thread. The application @p main()
|
||
120 | * function becomes the idle thread and must implement an
|
||
121 | * infinite loop.
|
||
122 | */
|
||
123 | #define CH_CFG_NO_IDLE_THREAD FALSE
|
||
124 | |||
125 | /** @} */
|
||
126 | |||
127 | /*===========================================================================*/
|
||
128 | /**
|
||
129 | * @name Performance options
|
||
130 | * @{
|
||
131 | */
|
||
132 | /*===========================================================================*/
|
||
133 | |||
134 | /**
|
||
135 | * @brief OS optimization.
|
||
136 | * @details If enabled then time efficient rather than space efficient code
|
||
137 | * is used when two possible implementations exist.
|
||
138 | *
|
||
139 | * @note This is not related to the compiler optimization options.
|
||
140 | * @note The default is @p TRUE.
|
||
141 | */
|
||
142 | #define CH_CFG_OPTIMIZE_SPEED TRUE
|
||
143 | |||
144 | /** @} */
|
||
145 | |||
146 | /*===========================================================================*/
|
||
147 | /**
|
||
148 | * @name Subsystem options
|
||
149 | * @{
|
||
150 | */
|
||
151 | /*===========================================================================*/
|
||
152 | |||
153 | /**
|
||
154 | * @brief Time Measurement APIs.
|
||
155 | * @details If enabled then the time measurement APIs are included in
|
||
156 | * the kernel.
|
||
157 | *
|
||
158 | * @note The default is @p TRUE.
|
||
159 | */
|
||
160 | #define CH_CFG_USE_TM TRUE
|
||
161 | |||
162 | /**
|
||
163 | * @brief Threads registry APIs.
|
||
164 | * @details If enabled then the registry APIs are included in the kernel.
|
||
165 | *
|
||
166 | * @note The default is @p TRUE.
|
||
167 | */
|
||
168 | #define CH_CFG_USE_REGISTRY FALSE
|
||
169 | |||
170 | /**
|
||
171 | 0a89baf2 | Thomas Schöpping | * @brief Thread hierarchy APIs.
|
172 | * @details Id enabled then the thread hierarchy APIs are included in the kernel.
|
||
173 | *
|
||
174 | * @note The default is @p FALSE.
|
||
175 | */
|
||
176 | #define CH_CFG_USE_THREADHIERARCHY TRUE
|
||
177 | |||
178 | /**
|
||
179 | * @brief Enable ordering of child lists.
|
||
180 | * @details Children will be ordered by their priority (descending).
|
||
181 | * If sibliblings have identical priority, they are ordered by age (descending).
|
||
182 | */
|
||
183 | #define CH_CFG_THREADHIERARCHY_ORDERED TRUE
|
||
184 | |||
185 | /**
|
||
186 | 043cdf33 | Thomas Schöpping | * @brief Threads synchronization APIs.
|
187 | * @details If enabled then the @p chThdWait() function is included in
|
||
188 | * the kernel.
|
||
189 | *
|
||
190 | * @note The default is @p TRUE.
|
||
191 | */
|
||
192 | #define CH_CFG_USE_WAITEXIT TRUE
|
||
193 | |||
194 | /**
|
||
195 | * @brief Semaphores APIs.
|
||
196 | * @details If enabled then the Semaphores APIs are included in the kernel.
|
||
197 | *
|
||
198 | * @note The default is @p TRUE.
|
||
199 | */
|
||
200 | #define CH_CFG_USE_SEMAPHORES TRUE
|
||
201 | |||
202 | /**
|
||
203 | * @brief Semaphores queuing mode.
|
||
204 | * @details If enabled then the threads are enqueued on semaphores by
|
||
205 | * priority rather than in FIFO order.
|
||
206 | *
|
||
207 | * @note The default is @p FALSE. Enable this if you have special
|
||
208 | * requirements.
|
||
209 | * @note Requires @p CH_CFG_USE_SEMAPHORES.
|
||
210 | */
|
||
211 | #define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE
|
||
212 | |||
213 | /**
|
||
214 | * @brief Mutexes APIs.
|
||
215 | * @details If enabled then the mutexes APIs are included in the kernel.
|
||
216 | *
|
||
217 | * @note The default is @p TRUE.
|
||
218 | */
|
||
219 | #define CH_CFG_USE_MUTEXES TRUE
|
||
220 | |||
221 | /**
|
||
222 | * @brief Enables recursive behavior on mutexes.
|
||
223 | * @note Recursive mutexes are heavier and have an increased
|
||
224 | * memory footprint.
|
||
225 | *
|
||
226 | * @note The default is @p FALSE.
|
||
227 | * @note Requires @p CH_CFG_USE_MUTEXES.
|
||
228 | */
|
||
229 | #define CH_CFG_USE_MUTEXES_RECURSIVE FALSE
|
||
230 | |||
231 | /**
|
||
232 | * @brief Conditional Variables APIs.
|
||
233 | * @details If enabled then the conditional variables APIs are included
|
||
234 | * in the kernel.
|
||
235 | *
|
||
236 | * @note The default is @p TRUE.
|
||
237 | * @note Requires @p CH_CFG_USE_MUTEXES.
|
||
238 | */
|
||
239 | #define CH_CFG_USE_CONDVARS TRUE
|
||
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 | #define CH_CFG_USE_CONDVARS_TIMEOUT TRUE
|
||
250 | |||
251 | /**
|
||
252 | * @brief Events Flags APIs.
|
||
253 | * @details If enabled then the event flags APIs are included in the kernel.
|
||
254 | *
|
||
255 | * @note The default is @p TRUE.
|
||
256 | */
|
||
257 | #define CH_CFG_USE_EVENTS TRUE
|
||
258 | |||
259 | /**
|
||
260 | * @brief Events Flags APIs with timeout.
|
||
261 | * @details If enabled then the events APIs with timeout specification
|
||
262 | * are included in the kernel.
|
||
263 | *
|
||
264 | * @note The default is @p TRUE.
|
||
265 | * @note Requires @p CH_CFG_USE_EVENTS.
|
||
266 | */
|
||
267 | #define CH_CFG_USE_EVENTS_TIMEOUT TRUE
|
||
268 | |||
269 | /**
|
||
270 | * @brief Synchronous Messages APIs.
|
||
271 | * @details If enabled then the synchronous messages APIs are included
|
||
272 | * in the kernel.
|
||
273 | *
|
||
274 | * @note The default is @p TRUE.
|
||
275 | */
|
||
276 | #define CH_CFG_USE_MESSAGES FALSE
|
||
277 | |||
278 | /**
|
||
279 | * @brief Synchronous Messages queuing mode.
|
||
280 | * @details If enabled then messages are served by priority rather than in
|
||
281 | * FIFO order.
|
||
282 | *
|
||
283 | * @note The default is @p FALSE. Enable this if you have special
|
||
284 | * requirements.
|
||
285 | * @note Requires @p CH_CFG_USE_MESSAGES.
|
||
286 | */
|
||
287 | #define CH_CFG_USE_MESSAGES_PRIORITY FALSE
|
||
288 | |||
289 | /**
|
||
290 | * @brief Mailboxes APIs.
|
||
291 | * @details If enabled then the asynchronous messages (mailboxes) APIs are
|
||
292 | * included in the kernel.
|
||
293 | *
|
||
294 | * @note The default is @p TRUE.
|
||
295 | * @note Requires @p CH_CFG_USE_SEMAPHORES.
|
||
296 | */
|
||
297 | #define CH_CFG_USE_MAILBOXES FALSE
|
||
298 | |||
299 | /**
|
||
300 | * @brief Core Memory Manager APIs.
|
||
301 | * @details If enabled then the core memory manager APIs are included
|
||
302 | * in the kernel.
|
||
303 | *
|
||
304 | * @note The default is @p TRUE.
|
||
305 | */
|
||
306 | #define CH_CFG_USE_MEMCORE FALSE
|
||
307 | |||
308 | /**
|
||
309 | * @brief Heap Allocator APIs.
|
||
310 | * @details If enabled then the memory heap allocator APIs are included
|
||
311 | * in the kernel.
|
||
312 | *
|
||
313 | * @note The default is @p TRUE.
|
||
314 | * @note Requires @p CH_CFG_USE_MEMCORE and either @p CH_CFG_USE_MUTEXES or
|
||
315 | * @p CH_CFG_USE_SEMAPHORES.
|
||
316 | * @note Mutexes are recommended.
|
||
317 | */
|
||
318 | #define CH_CFG_USE_HEAP FALSE
|
||
319 | |||
320 | /**
|
||
321 | * @brief Memory Pools Allocator APIs.
|
||
322 | * @details If enabled then the memory pools allocator APIs are included
|
||
323 | * in the kernel.
|
||
324 | *
|
||
325 | * @note The default is @p TRUE.
|
||
326 | */
|
||
327 | #define CH_CFG_USE_MEMPOOLS FALSE
|
||
328 | |||
329 | /**
|
||
330 | 1e5f7648 | Thomas Schöpping | * @brief Objects FIFOs APIs.
|
331 | * @details If enabled then the objects FIFOs APIs are included
|
||
332 | * in the kernel.
|
||
333 | *
|
||
334 | * @note The default is @p TRUE.
|
||
335 | */
|
||
336 | #define CH_CFG_USE_OBJ_FIFOS FALSE
|
||
337 | |||
338 | /**
|
||
339 | 043cdf33 | Thomas Schöpping | * @brief Dynamic Threads APIs.
|
340 | * @details If enabled then the dynamic threads creation APIs are included
|
||
341 | * in the kernel.
|
||
342 | *
|
||
343 | * @note The default is @p TRUE.
|
||
344 | * @note Requires @p CH_CFG_USE_WAITEXIT.
|
||
345 | * @note Requires @p CH_CFG_USE_HEAP and/or @p CH_CFG_USE_MEMPOOLS.
|
||
346 | */
|
||
347 | #define CH_CFG_USE_DYNAMIC FALSE
|
||
348 | |||
349 | /** @} */
|
||
350 | |||
351 | /*===========================================================================*/
|
||
352 | /**
|
||
353 | 1e5f7648 | Thomas Schöpping | * @name Objects factory options
|
354 | * @{
|
||
355 | */
|
||
356 | /*===========================================================================*/
|
||
357 | |||
358 | /**
|
||
359 | * @brief Objects Factory APIs.
|
||
360 | * @details If enabled then the objects factory APIs are included in the
|
||
361 | * kernel.
|
||
362 | *
|
||
363 | * @note The default is @p FALSE.
|
||
364 | */
|
||
365 | #if !defined(CH_CFG_USE_FACTORY)
|
||
366 | #define CH_CFG_USE_FACTORY FALSE
|
||
367 | #endif
|
||
368 | |||
369 | /**
|
||
370 | * @brief Maximum length for object names.
|
||
371 | * @details If the specified length is zero then the name is stored by
|
||
372 | * pointer but this could have unintended side effects.
|
||
373 | */
|
||
374 | #if !defined(CH_CFG_FACTORY_MAX_NAMES_LENGTH)
|
||
375 | #define CH_CFG_FACTORY_MAX_NAMES_LENGTH 8 |
||
376 | #endif
|
||
377 | |||
378 | /**
|
||
379 | * @brief Enables the registry of generic objects.
|
||
380 | */
|
||
381 | #if !defined(CH_CFG_FACTORY_OBJECTS_REGISTRY)
|
||
382 | #define CH_CFG_FACTORY_OBJECTS_REGISTRY TRUE
|
||
383 | #endif
|
||
384 | |||
385 | /**
|
||
386 | * @brief Enables factory for generic buffers.
|
||
387 | */
|
||
388 | #if !defined(CH_CFG_FACTORY_GENERIC_BUFFERS)
|
||
389 | #define CH_CFG_FACTORY_GENERIC_BUFFERS TRUE
|
||
390 | #endif
|
||
391 | |||
392 | /**
|
||
393 | * @brief Enables factory for semaphores.
|
||
394 | */
|
||
395 | #if !defined(CH_CFG_FACTORY_SEMAPHORES)
|
||
396 | #define CH_CFG_FACTORY_SEMAPHORES TRUE
|
||
397 | #endif
|
||
398 | |||
399 | /**
|
||
400 | * @brief Enables factory for mailboxes.
|
||
401 | */
|
||
402 | #if !defined(CH_CFG_FACTORY_MAILBOXES)
|
||
403 | #define CH_CFG_FACTORY_MAILBOXES TRUE
|
||
404 | #endif
|
||
405 | |||
406 | /**
|
||
407 | * @brief Enables factory for objects FIFOs.
|
||
408 | */
|
||
409 | #if !defined(CH_CFG_FACTORY_OBJ_FIFOS)
|
||
410 | #define CH_CFG_FACTORY_OBJ_FIFOS TRUE
|
||
411 | #endif
|
||
412 | |||
413 | /** @} */
|
||
414 | |||
415 | /*===========================================================================*/
|
||
416 | /**
|
||
417 | 043cdf33 | Thomas Schöpping | * @name Debug options
|
418 | * @{
|
||
419 | */
|
||
420 | /*===========================================================================*/
|
||
421 | |||
422 | /**
|
||
423 | * @brief Debug option, kernel statistics.
|
||
424 | *
|
||
425 | * @note The default is @p FALSE.
|
||
426 | */
|
||
427 | #if ((CH_CFG_USE_TM == TRUE) && (AMIROOS_CFG_DBG == true)) || defined(__DOXYGEN__) |
||
428 | #define CH_DBG_STATISTICS TRUE
|
||
429 | #else
|
||
430 | #define CH_DBG_STATISTICS FALSE
|
||
431 | #endif
|
||
432 | |||
433 | /**
|
||
434 | * @brief Debug option, system state check.
|
||
435 | * @details If enabled the correct call protocol for system APIs is checked
|
||
436 | * at runtime.
|
||
437 | *
|
||
438 | * @note The default is @p FALSE.
|
||
439 | */
|
||
440 | #if (AMIROOS_CFG_DBG == true) || defined(__DOXYGEN__) |
||
441 | #define CH_DBG_SYSTEM_STATE_CHECK TRUE
|
||
442 | #else
|
||
443 | #define CH_DBG_SYSTEM_STATE_CHECK FALSE
|
||
444 | #endif
|
||
445 | |||
446 | /**
|
||
447 | * @brief Debug option, parameters checks.
|
||
448 | * @details If enabled then the checks on the API functions input
|
||
449 | * parameters are activated.
|
||
450 | *
|
||
451 | * @note The default is @p FALSE.
|
||
452 | */
|
||
453 | #if (AMIROOS_CFG_DBG == true) || defined(__DOXYGEN__) |
||
454 | #define CH_DBG_ENABLE_CHECKS TRUE
|
||
455 | #else
|
||
456 | #define CH_DBG_ENABLE_CHECKS FALSE
|
||
457 | #endif
|
||
458 | |||
459 | /**
|
||
460 | * @brief Debug option, consistency checks.
|
||
461 | * @details If enabled then all the assertions in the kernel code are
|
||
462 | * activated. This includes consistency checks inside the kernel,
|
||
463 | * runtime anomalies and port-defined checks.
|
||
464 | *
|
||
465 | * @note The default is @p FALSE.
|
||
466 | */
|
||
467 | #if (AMIROOS_CFG_DBG == true) || defined(__DOXYGEN__) |
||
468 | #define CH_DBG_ENABLE_ASSERTS TRUE
|
||
469 | #else
|
||
470 | #define CH_DBG_ENABLE_ASSERTS FALSE
|
||
471 | #endif
|
||
472 | |||
473 | /**
|
||
474 | * @brief Debug option, trace buffer.
|
||
475 | * @details If enabled then the trace buffer is activated.
|
||
476 | *
|
||
477 | * @note The default is @p CH_DBG_TRACE_MASK_DISABLED.
|
||
478 | */
|
||
479 | #define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED
|
||
480 | |||
481 | /**
|
||
482 | * @brief Trace buffer entries.
|
||
483 | * @note The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is
|
||
484 | * different from @p CH_DBG_TRACE_MASK_DISABLED.
|
||
485 | */
|
||
486 | #define CH_DBG_TRACE_BUFFER_SIZE 128 |
||
487 | |||
488 | /**
|
||
489 | * @brief Debug option, stack checks.
|
||
490 | * @details If enabled then a runtime stack check is performed.
|
||
491 | *
|
||
492 | * @note The default is @p FALSE.
|
||
493 | * @note The stack check is performed in a architecture/port dependent way.
|
||
494 | * It may not be implemented or some ports.
|
||
495 | * @note The default failure mode is to halt the system with the global
|
||
496 | * @p panic_msg variable set to @p NULL.
|
||
497 | */
|
||
498 | #if (AMIROOS_CFG_DBG == true) || defined(__DOXYGEN__) |
||
499 | #define CH_DBG_ENABLE_STACK_CHECK TRUE
|
||
500 | #else
|
||
501 | #define CH_DBG_ENABLE_STACK_CHECK FALSE
|
||
502 | #endif
|
||
503 | |||
504 | /**
|
||
505 | * @brief Debug option, stacks initialization.
|
||
506 | * @details If enabled then the threads working area is filled with a byte
|
||
507 | * value when a thread is created. This can be useful for the
|
||
508 | * runtime measurement of the used stack.
|
||
509 | *
|
||
510 | * @note The default is @p FALSE.
|
||
511 | */
|
||
512 | #if (AMIROOS_CFG_PROFILE == true) || defined(__DOXYGEN__) |
||
513 | #define CH_DBG_FILL_THREADS TRUE
|
||
514 | #else
|
||
515 | #define CH_DBG_FILL_THREADS FALSE
|
||
516 | #endif
|
||
517 | |||
518 | /**
|
||
519 | * @brief Debug option, threads profiling.
|
||
520 | * @details If enabled then a field is added to the @p thread_t structure that
|
||
521 | * counts the system ticks occurred while executing the thread.
|
||
522 | *
|
||
523 | * @note The default is @p FALSE.
|
||
524 | * @note This debug option is not currently compatible with the
|
||
525 | * tickless mode.
|
||
526 | */
|
||
527 | #if ((CH_CFG_ST_TIMEDELTA == 0) && (AMIROOS_CFG_PROFILE == true)) || defined(__DOXYGEN__) |
||
528 | #define CH_DBG_THREADS_PROFILING TRUE
|
||
529 | #else
|
||
530 | #define CH_DBG_THREADS_PROFILING FALSE
|
||
531 | #endif
|
||
532 | |||
533 | /** @} */
|
||
534 | |||
535 | /*===========================================================================*/
|
||
536 | /**
|
||
537 | * @name Kernel hooks
|
||
538 | * @{
|
||
539 | */
|
||
540 | /*===========================================================================*/
|
||
541 | |||
542 | /**
|
||
543 | 1e5f7648 | Thomas Schöpping | * @brief System structure extension.
|
544 | * @details User fields added to the end of the @p ch_system_t structure.
|
||
545 | */
|
||
546 | #define CH_CFG_SYSTEM_EXTRA_FIELDS \
|
||
547 | /* Add threads custom fields here.*/
|
||
548 | |||
549 | /**
|
||
550 | * @brief System initialization hook.
|
||
551 | * @details User initialization code added to the @p chSysInit() function
|
||
552 | * just before interrupts are enabled globally.
|
||
553 | */
|
||
554 | #define CH_CFG_SYSTEM_INIT_HOOK() { \
|
||
555 | /* Add threads initialization code here.*/ \
|
||
556 | } |
||
557 | |||
558 | /**
|
||
559 | 043cdf33 | Thomas Schöpping | * @brief Threads descriptor structure extension.
|
560 | * @details User fields added to the end of the @p thread_t structure.
|
||
561 | */
|
||
562 | #define CH_CFG_THREAD_EXTRA_FIELDS \
|
||
563 | /* Add threads custom fields here.*/
|
||
564 | |||
565 | /**
|
||
566 | * @brief Threads initialization hook.
|
||
567 | 1e5f7648 | Thomas Schöpping | * @details User initialization code added to the @p _thread_init() function.
|
568 | 043cdf33 | Thomas Schöpping | *
|
569 | 1e5f7648 | Thomas Schöpping | * @note It is invoked from within @p _thread_init() and implicitly from all
|
570 | 043cdf33 | Thomas Schöpping | * the threads creation APIs.
|
571 | */
|
||
572 | #define CH_CFG_THREAD_INIT_HOOK(tp) { \
|
||
573 | /* Add threads initialization code here.*/ \
|
||
574 | } |
||
575 | |||
576 | /**
|
||
577 | * @brief Threads finalization hook.
|
||
578 | * @details User finalization code added to the @p chThdExit() API.
|
||
579 | */
|
||
580 | #define CH_CFG_THREAD_EXIT_HOOK(tp) { \
|
||
581 | /* Add threads finalization code here.*/ \
|
||
582 | } |
||
583 | |||
584 | /**
|
||
585 | * @brief Context switch hook.
|
||
586 | * @details This hook is invoked just before switching between threads.
|
||
587 | */
|
||
588 | #define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) { \
|
||
589 | /* Context switch code here.*/ \
|
||
590 | } |
||
591 | |||
592 | /**
|
||
593 | * @brief ISR enter hook.
|
||
594 | */
|
||
595 | #define CH_CFG_IRQ_PROLOGUE_HOOK() { \
|
||
596 | /* IRQ prologue code here.*/ \
|
||
597 | } |
||
598 | |||
599 | /**
|
||
600 | * @brief ISR exit hook.
|
||
601 | */
|
||
602 | #define CH_CFG_IRQ_EPILOGUE_HOOK() { \
|
||
603 | /* IRQ epilogue code here.*/ \
|
||
604 | } |
||
605 | |||
606 | /**
|
||
607 | * @brief Idle thread enter hook.
|
||
608 | * @note This hook is invoked within a critical zone, no OS functions
|
||
609 | * should be invoked from here.
|
||
610 | * @note This macro can be used to activate a power saving mode.
|
||
611 | */
|
||
612 | #define CH_CFG_IDLE_ENTER_HOOK() { \
|
||
613 | /* Idle-enter code here.*/ \
|
||
614 | } |
||
615 | |||
616 | /**
|
||
617 | * @brief Idle thread leave hook.
|
||
618 | * @note This hook is invoked within a critical zone, no OS functions
|
||
619 | * should be invoked from here.
|
||
620 | * @note This macro can be used to deactivate a power saving mode.
|
||
621 | */
|
||
622 | #define CH_CFG_IDLE_LEAVE_HOOK() { \
|
||
623 | /* Idle-leave code here.*/ \
|
||
624 | } |
||
625 | |||
626 | /**
|
||
627 | * @brief Idle Loop hook.
|
||
628 | * @details This hook is continuously invoked by the idle thread loop.
|
||
629 | */
|
||
630 | #define CH_CFG_IDLE_LOOP_HOOK() { \
|
||
631 | /* Idle loop code here.*/ \
|
||
632 | } |
||
633 | |||
634 | /**
|
||
635 | * @brief System tick event hook.
|
||
636 | * @details This hook is invoked in the system tick handler immediately
|
||
637 | * after processing the virtual timers queue.
|
||
638 | */
|
||
639 | #define CH_CFG_SYSTEM_TICK_HOOK() { \
|
||
640 | /* System tick event code here.*/ \
|
||
641 | } |
||
642 | |||
643 | /**
|
||
644 | * @brief System halt hook.
|
||
645 | * @details This hook is invoked in case to a system halting error before
|
||
646 | * the system is halted.
|
||
647 | */
|
||
648 | #define CH_CFG_SYSTEM_HALT_HOOK(reason) { \
|
||
649 | 1e5f7648 | Thomas Schöpping | extern void aosPrintHaltErrorCode(const char* reason); \ |
650 | aosPrintHaltErrorCode(reason); \ |
||
651 | 043cdf33 | Thomas Schöpping | } |
652 | |||
653 | /**
|
||
654 | * @brief Trace hook.
|
||
655 | * @details This hook is invoked each time a new record is written in the
|
||
656 | * trace buffer.
|
||
657 | */
|
||
658 | #define CH_CFG_TRACE_HOOK(tep) { \
|
||
659 | /* Trace code here.*/ \
|
||
660 | } |
||
661 | |||
662 | /** @} */
|
||
663 | |||
664 | /*===========================================================================*/
|
||
665 | /**
|
||
666 | * @name Port specific settings
|
||
667 | */
|
||
668 | /*===========================================================================*/
|
||
669 | |||
670 | // These settings are specific to each module.
|
||
671 | |||
672 | /*===========================================================================*/
|
||
673 | /**
|
||
674 | * @name other
|
||
675 | * @{
|
||
676 | */
|
||
677 | /*===========================================================================*/
|
||
678 | |||
679 | /**
|
||
680 | 1e5f7648 | Thomas Schöpping | * @brief Flag to enable/disable floating point support in chprintf() and all deriviates.
|
681 | 043cdf33 | Thomas Schöpping | */
|
682 | #define CHPRINTF_USE_FLOAT TRUE
|
||
683 | |||
684 | /** @} */
|
||
685 | |||
686 | #endif /* _AOS_CHCONF_H_ */ |
||
687 | |||
688 | /** @} */ |