ChibiOS  21.6.0
rt/templates/chconf.h
Go to the documentation of this file.
1 /*
2  ChibiOS - Copyright (C) 2006..2020 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_7_0_
33 
34 /*===========================================================================*/
35 /**
36  * @name System settings
37  * @{
38  */
39 /*===========================================================================*/
40 
41 /**
42  * @brief Handling of instances.
43  * @note If enabled then threads assigned to various instances can
44  * interact each other using the same synchronization objects.
45  * If disabled then each OS instance is a separate world, no
46  * direct interactions are handled by the OS.
47  */
48 #if !defined(CH_CFG_SMP_MODE)
49 #define CH_CFG_SMP_MODE FALSE
50 #endif
51 
52 /** @} */
53 
54 /*===========================================================================*/
55 /**
56  * @name System timers settings
57  * @{
58  */
59 /*===========================================================================*/
60 
61 /**
62  * @brief System time counter resolution.
63  * @note Allowed values are 16, 32 or 64 bits.
64  */
65 #if !defined(CH_CFG_ST_RESOLUTION)
66 #define CH_CFG_ST_RESOLUTION 32
67 #endif
68 
69 /**
70  * @brief System tick frequency.
71  * @details Frequency of the system timer that drives the system ticks. This
72  * setting also defines the system tick time unit.
73  */
74 #if !defined(CH_CFG_ST_FREQUENCY)
75 #define CH_CFG_ST_FREQUENCY 10000
76 #endif
77 
78 /**
79  * @brief Time intervals data size.
80  * @note Allowed values are 16, 32 or 64 bits.
81  */
82 #if !defined(CH_CFG_INTERVALS_SIZE)
83 #define CH_CFG_INTERVALS_SIZE 32
84 #endif
85 
86 /**
87  * @brief Time types data size.
88  * @note Allowed values are 16 or 32 bits.
89  */
90 #if !defined(CH_CFG_TIME_TYPES_SIZE)
91 #define CH_CFG_TIME_TYPES_SIZE 32
92 #endif
93 
94 /**
95  * @brief Time delta constant for the tick-less mode.
96  * @note If this value is zero then the system uses the classic
97  * periodic tick. This value represents the minimum number
98  * of ticks that is safe to specify in a timeout directive.
99  * The value one is not valid, timeouts are rounded up to
100  * this value.
101  */
102 #if !defined(CH_CFG_ST_TIMEDELTA)
103 #define CH_CFG_ST_TIMEDELTA 2
104 #endif
105 
106 /** @} */
107 
108 /*===========================================================================*/
109 /**
110  * @name Kernel parameters and options
111  * @{
112  */
113 /*===========================================================================*/
114 
115 /**
116  * @brief Round robin interval.
117  * @details This constant is the number of system ticks allowed for the
118  * threads before preemption occurs. Setting this value to zero
119  * disables the preemption for threads with equal priority and the
120  * round robin becomes cooperative. Note that higher priority
121  * threads can still preempt, the kernel is always preemptive.
122  * @note Disabling the round robin preemption makes the kernel more compact
123  * and generally faster.
124  * @note The round robin preemption is not supported in tickless mode and
125  * must be set to zero in that case.
126  */
127 #if !defined(CH_CFG_TIME_QUANTUM)
128 #define CH_CFG_TIME_QUANTUM 0
129 #endif
130 
131 /**
132  * @brief Idle thread automatic spawn suppression.
133  * @details When this option is activated the function @p chSysInit()
134  * does not spawn the idle thread. The application @p main()
135  * function becomes the idle thread and must implement an
136  * infinite loop.
137  */
138 #if !defined(CH_CFG_NO_IDLE_THREAD)
139 #define CH_CFG_NO_IDLE_THREAD FALSE
140 #endif
141 
142 /** @} */
143 
144 /*===========================================================================*/
145 /**
146  * @name Performance options
147  * @{
148  */
149 /*===========================================================================*/
150 
151 /**
152  * @brief OS optimization.
153  * @details If enabled then time efficient rather than space efficient code
154  * is used when two possible implementations exist.
155  *
156  * @note This is not related to the compiler optimization options.
157  * @note The default is @p TRUE.
158  */
159 #if !defined(CH_CFG_OPTIMIZE_SPEED)
160 #define CH_CFG_OPTIMIZE_SPEED TRUE
161 #endif
162 
163 /** @} */
164 
165 /*===========================================================================*/
166 /**
167  * @name Subsystem options
168  * @{
169  */
170 /*===========================================================================*/
171 
172 /**
173  * @brief Time Measurement APIs.
174  * @details If enabled then the time measurement APIs are included in
175  * the kernel.
176  *
177  * @note The default is @p TRUE.
178  */
179 #if !defined(CH_CFG_USE_TM)
180 #define CH_CFG_USE_TM TRUE
181 #endif
182 
183 /**
184  * @brief Time Stamps APIs.
185  * @details If enabled then the time time stamps APIs are included in
186  * the kernel.
187  *
188  * @note The default is @p TRUE.
189  */
190 #if !defined(CH_CFG_USE_TIMESTAMP)
191 #define CH_CFG_USE_TIMESTAMP TRUE
192 #endif
193 
194 /**
195  * @brief Threads registry APIs.
196  * @details If enabled then the registry APIs are included in the kernel.
197  *
198  * @note The default is @p TRUE.
199  */
200 #if !defined(CH_CFG_USE_REGISTRY)
201 #define CH_CFG_USE_REGISTRY TRUE
202 #endif
203 
204 /**
205  * @brief Threads synchronization APIs.
206  * @details If enabled then the @p chThdWait() function is included in
207  * the kernel.
208  *
209  * @note The default is @p TRUE.
210  */
211 #if !defined(CH_CFG_USE_WAITEXIT)
212 #define CH_CFG_USE_WAITEXIT TRUE
213 #endif
214 
215 /**
216  * @brief Semaphores APIs.
217  * @details If enabled then the Semaphores APIs are included in the kernel.
218  *
219  * @note The default is @p TRUE.
220  */
221 #if !defined(CH_CFG_USE_SEMAPHORES)
222 #define CH_CFG_USE_SEMAPHORES TRUE
223 #endif
224 
225 /**
226  * @brief Semaphores queuing mode.
227  * @details If enabled then the threads are enqueued on semaphores by
228  * priority rather than in 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_SEMAPHORES.
233  */
234 #if !defined(CH_CFG_USE_SEMAPHORES_PRIORITY)
235 #define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE
236 #endif
237 
238 /**
239  * @brief Mutexes APIs.
240  * @details If enabled then the mutexes APIs are included in the kernel.
241  *
242  * @note The default is @p TRUE.
243  */
244 #if !defined(CH_CFG_USE_MUTEXES)
245 #define CH_CFG_USE_MUTEXES TRUE
246 #endif
247 
248 /**
249  * @brief Enables recursive behavior on mutexes.
250  * @note Recursive mutexes are heavier and have an increased
251  * memory footprint.
252  *
253  * @note The default is @p FALSE.
254  * @note Requires @p CH_CFG_USE_MUTEXES.
255  */
256 #if !defined(CH_CFG_USE_MUTEXES_RECURSIVE)
257 #define CH_CFG_USE_MUTEXES_RECURSIVE FALSE
258 #endif
259 
260 /**
261  * @brief Conditional Variables APIs.
262  * @details If enabled then the conditional variables APIs are included
263  * in the kernel.
264  *
265  * @note The default is @p TRUE.
266  * @note Requires @p CH_CFG_USE_MUTEXES.
267  */
268 #if !defined(CH_CFG_USE_CONDVARS)
269 #define CH_CFG_USE_CONDVARS TRUE
270 #endif
271 
272 /**
273  * @brief Conditional Variables APIs with timeout.
274  * @details If enabled then the conditional variables APIs with timeout
275  * specification are included in the kernel.
276  *
277  * @note The default is @p TRUE.
278  * @note Requires @p CH_CFG_USE_CONDVARS.
279  */
280 #if !defined(CH_CFG_USE_CONDVARS_TIMEOUT)
281 #define CH_CFG_USE_CONDVARS_TIMEOUT TRUE
282 #endif
283 
284 /**
285  * @brief Events Flags APIs.
286  * @details If enabled then the event flags APIs are included in the kernel.
287  *
288  * @note The default is @p TRUE.
289  */
290 #if !defined(CH_CFG_USE_EVENTS)
291 #define CH_CFG_USE_EVENTS TRUE
292 #endif
293 
294 /**
295  * @brief Events Flags APIs with timeout.
296  * @details If enabled then the events APIs with timeout specification
297  * are included in the kernel.
298  *
299  * @note The default is @p TRUE.
300  * @note Requires @p CH_CFG_USE_EVENTS.
301  */
302 #if !defined(CH_CFG_USE_EVENTS_TIMEOUT)
303 #define CH_CFG_USE_EVENTS_TIMEOUT TRUE
304 #endif
305 
306 /**
307  * @brief Synchronous Messages APIs.
308  * @details If enabled then the synchronous messages APIs are included
309  * in the kernel.
310  *
311  * @note The default is @p TRUE.
312  */
313 #if !defined(CH_CFG_USE_MESSAGES)
314 #define CH_CFG_USE_MESSAGES TRUE
315 #endif
316 
317 /**
318  * @brief Synchronous Messages queuing mode.
319  * @details If enabled then messages are served by priority rather than in
320  * FIFO order.
321  *
322  * @note The default is @p FALSE. Enable this if you have special
323  * requirements.
324  * @note Requires @p CH_CFG_USE_MESSAGES.
325  */
326 #if !defined(CH_CFG_USE_MESSAGES_PRIORITY)
327 #define CH_CFG_USE_MESSAGES_PRIORITY FALSE
328 #endif
329 
330 /**
331  * @brief Dynamic Threads APIs.
332  * @details If enabled then the dynamic threads creation APIs are included
333  * in the kernel.
334  *
335  * @note The default is @p TRUE.
336  * @note Requires @p CH_CFG_USE_WAITEXIT.
337  * @note Requires @p CH_CFG_USE_HEAP and/or @p CH_CFG_USE_MEMPOOLS.
338  */
339 #if !defined(CH_CFG_USE_DYNAMIC)
340 #define CH_CFG_USE_DYNAMIC TRUE
341 #endif
342 
343 /** @} */
344 
345 /*===========================================================================*/
346 /**
347  * @name OSLIB options
348  * @{
349  */
350 /*===========================================================================*/
351 
352 /**
353  * @brief Mailboxes APIs.
354  * @details If enabled then the asynchronous messages (mailboxes) APIs are
355  * included in the kernel.
356  *
357  * @note The default is @p TRUE.
358  * @note Requires @p CH_CFG_USE_SEMAPHORES.
359  */
360 #if !defined(CH_CFG_USE_MAILBOXES)
361 #define CH_CFG_USE_MAILBOXES TRUE
362 #endif
363 
364 /**
365  * @brief Core Memory Manager APIs.
366  * @details If enabled then the core memory manager APIs are included
367  * in the kernel.
368  *
369  * @note The default is @p TRUE.
370  */
371 #if !defined(CH_CFG_USE_MEMCORE)
372 #define CH_CFG_USE_MEMCORE TRUE
373 #endif
374 
375 /**
376  * @brief Managed RAM size.
377  * @details Size of the RAM area to be managed by the OS. If set to zero
378  * then the whole available RAM is used. The core memory is made
379  * available to the heap allocator and/or can be used directly through
380  * the simplified core memory allocator.
381  *
382  * @note In order to let the OS manage the whole RAM the linker script must
383  * provide the @p __heap_base__ and @p __heap_end__ symbols.
384  * @note Requires @p CH_CFG_USE_MEMCORE.
385  */
386 #if !defined(CH_CFG_MEMCORE_SIZE)
387 #define CH_CFG_MEMCORE_SIZE 0
388 #endif
389 
390 /**
391  * @brief Heap Allocator APIs.
392  * @details If enabled then the memory heap allocator APIs are included
393  * in the kernel.
394  *
395  * @note The default is @p TRUE.
396  * @note Requires @p CH_CFG_USE_MEMCORE and either @p CH_CFG_USE_MUTEXES or
397  * @p CH_CFG_USE_SEMAPHORES.
398  * @note Mutexes are recommended.
399  */
400 #if !defined(CH_CFG_USE_HEAP)
401 #define CH_CFG_USE_HEAP TRUE
402 #endif
403 
404 /**
405  * @brief Memory Pools Allocator APIs.
406  * @details If enabled then the memory pools allocator APIs are included
407  * in the kernel.
408  *
409  * @note The default is @p TRUE.
410  */
411 #if !defined(CH_CFG_USE_MEMPOOLS)
412 #define CH_CFG_USE_MEMPOOLS TRUE
413 #endif
414 
415 /**
416  * @brief Objects FIFOs APIs.
417  * @details If enabled then the objects FIFOs APIs are included
418  * in the kernel.
419  *
420  * @note The default is @p TRUE.
421  */
422 #if !defined(CH_CFG_USE_OBJ_FIFOS)
423 #define CH_CFG_USE_OBJ_FIFOS TRUE
424 #endif
425 
426 /**
427  * @brief Pipes APIs.
428  * @details If enabled then the pipes APIs are included
429  * in the kernel.
430  *
431  * @note The default is @p TRUE.
432  */
433 #if !defined(CH_CFG_USE_PIPES)
434 #define CH_CFG_USE_PIPES TRUE
435 #endif
436 
437 /**
438  * @brief Objects Caches APIs.
439  * @details If enabled then the objects caches APIs are included
440  * in the kernel.
441  *
442  * @note The default is @p TRUE.
443  */
444 #if !defined(CH_CFG_USE_OBJ_CACHES)
445 #define CH_CFG_USE_OBJ_CACHES TRUE
446 #endif
447 
448 /**
449  * @brief Delegate threads APIs.
450  * @details If enabled then the delegate threads APIs are included
451  * in the kernel.
452  *
453  * @note The default is @p TRUE.
454  */
455 #if !defined(CH_CFG_USE_DELEGATES)
456 #define CH_CFG_USE_DELEGATES TRUE
457 #endif
458 
459 /**
460  * @brief Jobs Queues APIs.
461  * @details If enabled then the jobs queues APIs are included
462  * in the kernel.
463  *
464  * @note The default is @p TRUE.
465  */
466 #if !defined(CH_CFG_USE_JOBS)
467 #define CH_CFG_USE_JOBS TRUE
468 #endif
469 
470 /** @} */
471 
472 /*===========================================================================*/
473 /**
474  * @name Objects factory options
475  * @{
476  */
477 /*===========================================================================*/
478 
479 /**
480  * @brief Objects Factory APIs.
481  * @details If enabled then the objects factory APIs are included in the
482  * kernel.
483  *
484  * @note The default is @p FALSE.
485  */
486 #if !defined(CH_CFG_USE_FACTORY)
487 #define CH_CFG_USE_FACTORY TRUE
488 #endif
489 
490 /**
491  * @brief Maximum length for object names.
492  * @details If the specified length is zero then the name is stored by
493  * pointer but this could have unintended side effects.
494  */
495 #if !defined(CH_CFG_FACTORY_MAX_NAMES_LENGTH)
496 #define CH_CFG_FACTORY_MAX_NAMES_LENGTH 8
497 #endif
498 
499 /**
500  * @brief Enables the registry of generic objects.
501  */
502 #if !defined(CH_CFG_FACTORY_OBJECTS_REGISTRY)
503 #define CH_CFG_FACTORY_OBJECTS_REGISTRY TRUE
504 #endif
505 
506 /**
507  * @brief Enables factory for generic buffers.
508  */
509 #if !defined(CH_CFG_FACTORY_GENERIC_BUFFERS)
510 #define CH_CFG_FACTORY_GENERIC_BUFFERS TRUE
511 #endif
512 
513 /**
514  * @brief Enables factory for semaphores.
515  */
516 #if !defined(CH_CFG_FACTORY_SEMAPHORES)
517 #define CH_CFG_FACTORY_SEMAPHORES TRUE
518 #endif
519 
520 /**
521  * @brief Enables factory for mailboxes.
522  */
523 #if !defined(CH_CFG_FACTORY_MAILBOXES)
524 #define CH_CFG_FACTORY_MAILBOXES TRUE
525 #endif
526 
527 /**
528  * @brief Enables factory for objects FIFOs.
529  */
530 #if !defined(CH_CFG_FACTORY_OBJ_FIFOS)
531 #define CH_CFG_FACTORY_OBJ_FIFOS TRUE
532 #endif
533 
534 /**
535  * @brief Enables factory for Pipes.
536  */
537 #if !defined(CH_CFG_FACTORY_PIPES) || defined(__DOXYGEN__)
538 #define CH_CFG_FACTORY_PIPES TRUE
539 #endif
540 
541 /** @} */
542 
543 /*===========================================================================*/
544 /**
545  * @name Debug options
546  * @{
547  */
548 /*===========================================================================*/
549 
550 /**
551  * @brief Debug option, kernel statistics.
552  *
553  * @note The default is @p FALSE.
554  */
555 #if !defined(CH_DBG_STATISTICS)
556 #define CH_DBG_STATISTICS FALSE
557 #endif
558 
559 /**
560  * @brief Debug option, system state check.
561  * @details If enabled the correct call protocol for system APIs is checked
562  * at runtime.
563  *
564  * @note The default is @p FALSE.
565  */
566 #if !defined(CH_DBG_SYSTEM_STATE_CHECK)
567 #define CH_DBG_SYSTEM_STATE_CHECK TRUE
568 #endif
569 
570 /**
571  * @brief Debug option, parameters checks.
572  * @details If enabled then the checks on the API functions input
573  * parameters are activated.
574  *
575  * @note The default is @p FALSE.
576  */
577 #if !defined(CH_DBG_ENABLE_CHECKS)
578 #define CH_DBG_ENABLE_CHECKS TRUE
579 #endif
580 
581 /**
582  * @brief Debug option, consistency checks.
583  * @details If enabled then all the assertions in the kernel code are
584  * activated. This includes consistency checks inside the kernel,
585  * runtime anomalies and port-defined checks.
586  *
587  * @note The default is @p FALSE.
588  */
589 #if !defined(CH_DBG_ENABLE_ASSERTS)
590 #define CH_DBG_ENABLE_ASSERTS TRUE
591 #endif
592 
593 /**
594  * @brief Debug option, trace buffer.
595  * @details If enabled then the trace buffer is activated.
596  *
597  * @note The default is @p CH_DBG_TRACE_MASK_DISABLED.
598  */
599 #if !defined(CH_DBG_TRACE_MASK)
600 #define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_ALL
601 #endif
602 
603 /**
604  * @brief Trace buffer entries.
605  * @note The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is
606  * different from @p CH_DBG_TRACE_MASK_DISABLED.
607  */
608 #if !defined(CH_DBG_TRACE_BUFFER_SIZE)
609 #define CH_DBG_TRACE_BUFFER_SIZE 128
610 #endif
611 
612 /**
613  * @brief Debug option, stack checks.
614  * @details If enabled then a runtime stack check is performed.
615  *
616  * @note The default is @p FALSE.
617  * @note The stack check is performed in a architecture/port dependent way.
618  * It may not be implemented or some ports.
619  * @note The default failure mode is to halt the system with the global
620  * @p panic_msg variable set to @p NULL.
621  */
622 #if !defined(CH_DBG_ENABLE_STACK_CHECK)
623 #define CH_DBG_ENABLE_STACK_CHECK TRUE
624 #endif
625 
626 /**
627  * @brief Debug option, stacks initialization.
628  * @details If enabled then the threads working area is filled with a byte
629  * value when a thread is created. This can be useful for the
630  * runtime measurement of the used stack.
631  *
632  * @note The default is @p FALSE.
633  */
634 #if !defined(CH_DBG_FILL_THREADS)
635 #define CH_DBG_FILL_THREADS TRUE
636 #endif
637 
638 /**
639  * @brief Debug option, threads profiling.
640  * @details If enabled then a field is added to the @p thread_t structure that
641  * counts the system ticks occurred while executing the thread.
642  *
643  * @note The default is @p FALSE.
644  * @note This debug option is not currently compatible with the
645  * tickless mode.
646  */
647 #if !defined(CH_DBG_THREADS_PROFILING)
648 #define CH_DBG_THREADS_PROFILING FALSE
649 #endif
650 
651 /** @} */
652 
653 /*===========================================================================*/
654 /**
655  * @name Kernel hooks
656  * @{
657  */
658 /*===========================================================================*/
659 
660 /**
661  * @brief System structure extension.
662  * @details User fields added to the end of the @p ch_system_t structure.
663  */
664 #define CH_CFG_SYSTEM_EXTRA_FIELDS \
665  /* Add system custom fields here.*/
666 
667 /**
668  * @brief System initialization hook.
669  * @details User initialization code added to the @p chSysInit() function
670  * just before interrupts are enabled globally.
671  */
672 #define CH_CFG_SYSTEM_INIT_HOOK() { \
673  /* Add system initialization code here.*/ \
674 }
675 
676 /**
677  * @brief OS instance structure extension.
678  * @details User fields added to the end of the @p os_instance_t structure.
679  */
680 #define CH_CFG_OS_INSTANCE_EXTRA_FIELDS \
681  /* Add OS instance custom fields here.*/
682 
683 /**
684  * @brief OS instance initialization hook.
685  *
686  * @param[in] oip pointer to the @p os_instance_t structure
687  */
688 #define CH_CFG_OS_INSTANCE_INIT_HOOK(oip) { \
689  /* Add OS instance initialization code here.*/ \
690 }
691 
692 /**
693  * @brief Threads descriptor structure extension.
694  * @details User fields added to the end of the @p thread_t structure.
695  */
696 #define CH_CFG_THREAD_EXTRA_FIELDS \
697  /* Add threads custom fields here.*/
698 
699 /**
700  * @brief Threads initialization hook.
701  * @details User initialization code added to the @p _thread_init() function.
702  *
703  * @note It is invoked from within @p _thread_init() and implicitly from all
704  * the threads creation APIs.
705  *
706  * @param[in] tp pointer to the @p thread_t structure
707  */
708 #define CH_CFG_THREAD_INIT_HOOK(tp) { \
709  /* Add threads initialization code here.*/ \
710 }
711 
712 /**
713  * @brief Threads finalization hook.
714  * @details User finalization code added to the @p chThdExit() API.
715  *
716  * @param[in] tp pointer to the @p thread_t structure
717  */
718 #define CH_CFG_THREAD_EXIT_HOOK(tp) { \
719  /* Add threads finalization code here.*/ \
720 }
721 
722 /**
723  * @brief Context switch hook.
724  * @details This hook is invoked just before switching between threads.
725  *
726  * @param[in] ntp thread being switched in
727  * @param[in] otp thread being switched out
728  */
729 #define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) { \
730  /* Context switch code here.*/ \
731 }
732 
733 /**
734  * @brief ISR enter hook.
735  */
736 #define CH_CFG_IRQ_PROLOGUE_HOOK() { \
737  /* IRQ prologue code here.*/ \
738 }
739 
740 /**
741  * @brief ISR exit hook.
742  */
743 #define CH_CFG_IRQ_EPILOGUE_HOOK() { \
744  /* IRQ epilogue code here.*/ \
745 }
746 
747 /**
748  * @brief Idle thread enter hook.
749  * @note This hook is invoked within a critical zone, no OS functions
750  * should be invoked from here.
751  * @note This macro can be used to activate a power saving mode.
752  */
753 #define CH_CFG_IDLE_ENTER_HOOK() { \
754  /* Idle-enter code here.*/ \
755 }
756 
757 /**
758  * @brief Idle thread leave hook.
759  * @note This hook is invoked within a critical zone, no OS functions
760  * should be invoked from here.
761  * @note This macro can be used to deactivate a power saving mode.
762  */
763 #define CH_CFG_IDLE_LEAVE_HOOK() { \
764  /* Idle-leave code here.*/ \
765 }
766 
767 /**
768  * @brief Idle Loop hook.
769  * @details This hook is continuously invoked by the idle thread loop.
770  */
771 #define CH_CFG_IDLE_LOOP_HOOK() { \
772  /* Idle loop code here.*/ \
773 }
774 
775 /**
776  * @brief System tick event hook.
777  * @details This hook is invoked in the system tick handler immediately
778  * after processing the virtual timers queue.
779  */
780 #define CH_CFG_SYSTEM_TICK_HOOK() { \
781  /* System tick event code here.*/ \
782 }
783 
784 /**
785  * @brief System halt hook.
786  * @details This hook is invoked in case to a system halting error before
787  * the system is halted.
788  */
789 #define CH_CFG_SYSTEM_HALT_HOOK(reason) { \
790  /* System halt code here.*/ \
791 }
792 
793 /**
794  * @brief Trace hook.
795  * @details This hook is invoked each time a new record is written in the
796  * trace buffer.
797  */
798 #define CH_CFG_TRACE_HOOK(tep) { \
799  /* Trace code here.*/ \
800 }
801 
802 /**
803  * @brief Runtime Faults Collection Unit hook.
804  * @details This hook is invoked each time new faults are collected and stored.
805  */
806 #define CH_CFG_RUNTIME_FAULTS_HOOK(mask) { \
807  /* Faults handling code here.*/ \
808 }
809 
810 /** @} */
811 
812 /*===========================================================================*/
813 /* Port-specific settings (override port settings defaulted in chcore.h). */
814 /*===========================================================================*/
815 
816 #endif /* CHCONF_H */
817 
818 /** @} */