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