]> git.donarmstrong.com Git - qmk_firmware.git/blob - keyboards/vinta/chconf.h
Usbasploader bootloader option addition (#6304)
[qmk_firmware.git] / keyboards / vinta / chconf.h
1 /*
2     ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio
3     Licensed under the Apache License, Version 2.0 (the "License");
4     you may not use this file except in compliance with the License.
5     You may obtain a copy of the License at
6         http://www.apache.org/licenses/LICENSE-2.0
7     Unless required by applicable law or agreed to in writing, software
8     distributed under the License is distributed on an "AS IS" BASIS,
9     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10     See the License for the specific language governing permissions and
11     limitations under the License.
12 */
13
14 /**
15  * @file    templates/chconf.h
16  * @brief   Configuration file template.
17  * @details A copy of this file must be placed in each project directory, it
18  *          contains the application specific kernel settings.
19  *
20  * @addtogroup config
21  * @details Kernel related settings and hooks.
22  * @{
23  */
24
25 #ifndef CHCONF_H
26 #define CHCONF_H
27
28 #define _CHIBIOS_RT_CONF_
29
30 /*===========================================================================*/
31 /**
32  * @name System timers settings
33  * @{
34  */
35 /*===========================================================================*/
36
37 /**
38  * @brief   System time counter resolution.
39  * @note    Allowed values are 16 or 32 bits.
40  */
41 #define CH_CFG_ST_RESOLUTION                32
42
43 /**
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 #define CH_CFG_ST_FREQUENCY                 10000
49
50 /**
51  * @brief   Time delta constant for the tick-less mode.
52  * @note    If this value is zero then the system uses the classic
53  *          periodic tick. This value represents the minimum number
54  *          of ticks that is safe to specify in a timeout directive.
55  *          The value one is not valid, timeouts are rounded up to
56  *          this value.
57  */
58 #define CH_CFG_ST_TIMEDELTA                 2
59
60 /** @} */
61
62 /*===========================================================================*/
63 /**
64  * @name Kernel parameters and options
65  * @{
66  */
67 /*===========================================================================*/
68
69 /**
70  * @brief   Round robin interval.
71  * @details This constant is the number of system ticks allowed for the
72  *          threads before preemption occurs. Setting this value to zero
73  *          disables the preemption for threads with equal priority and the
74  *          round robin becomes cooperative. Note that higher priority
75  *          threads can still preempt, the kernel is always preemptive.
76  * @note    Disabling the round robin preemption makes the kernel more compact
77  *          and generally faster.
78  * @note    The round robin preemption is not supported in tickless mode and
79  *          must be set to zero in that case.
80  */
81 #define CH_CFG_TIME_QUANTUM                 0
82
83 /**
84  * @brief   Managed RAM size.
85  * @details Size of the RAM area to be managed by the OS. If set to zero
86  *          then the whole available RAM is used. The core memory is made
87  *          available to the heap allocator and/or can be used directly through
88  *          the simplified core memory allocator.
89  *
90  * @note    In order to let the OS manage the whole RAM the linker script must
91  *          provide the @p __heap_base__ and @p __heap_end__ symbols.
92  * @note    Requires @p CH_CFG_USE_MEMCORE.
93  */
94 #define CH_CFG_MEMCORE_SIZE                 0
95
96 /**
97  * @brief   Idle thread automatic spawn suppression.
98  * @details When this option is activated the function @p chSysInit()
99  *          does not spawn the idle thread. The application @p main()
100  *          function becomes the idle thread and must implement an
101  *          infinite loop.
102  */
103 #define CH_CFG_NO_IDLE_THREAD               FALSE
104
105 /* Use __WFI in the idle thread for waiting. Does lower the power
106  * consumption. */
107 #define CORTEX_ENABLE_WFI_IDLE              TRUE
108
109 /** @} */
110
111 /*===========================================================================*/
112 /**
113  * @name Performance options
114  * @{
115  */
116 /*===========================================================================*/
117
118 /**
119  * @brief   OS optimization.
120  * @details If enabled then time efficient rather than space efficient code
121  *          is used when two possible implementations exist.
122  *
123  * @note    This is not related to the compiler optimization options.
124  * @note    The default is @p TRUE.
125  */
126 #define CH_CFG_OPTIMIZE_SPEED               TRUE
127
128 /** @} */
129
130 /*===========================================================================*/
131 /**
132  * @name Subsystem options
133  * @{
134  */
135 /*===========================================================================*/
136
137 /**
138  * @brief   Time Measurement APIs.
139  * @details If enabled then the time measurement APIs are included in
140  *          the kernel.
141  *
142  * @note    The default is @p TRUE.
143  */
144 #define CH_CFG_USE_TM                       FALSE
145
146 /**
147  * @brief   Threads registry APIs.
148  * @details If enabled then the registry APIs are included in the kernel.
149  *
150  * @note    The default is @p TRUE.
151  */
152 #define CH_CFG_USE_REGISTRY                 TRUE
153
154 /**
155  * @brief   Threads synchronization APIs.
156  * @details If enabled then the @p chThdWait() function is included in
157  *          the kernel.
158  *
159  * @note    The default is @p TRUE.
160  */
161 #define CH_CFG_USE_WAITEXIT                 TRUE
162
163 /**
164  * @brief   Semaphores APIs.
165  * @details If enabled then the Semaphores APIs are included in the kernel.
166  *
167  * @note    The default is @p TRUE.
168  */
169 #define CH_CFG_USE_SEMAPHORES               TRUE
170
171 /**
172  * @brief   Semaphores queuing mode.
173  * @details If enabled then the threads are enqueued on semaphores by
174  *          priority rather than in FIFO order.
175  *
176  * @note    The default is @p FALSE. Enable this if you have special
177  *          requirements.
178  * @note    Requires @p CH_CFG_USE_SEMAPHORES.
179  */
180 #define CH_CFG_USE_SEMAPHORES_PRIORITY      FALSE
181
182 /**
183  * @brief   Mutexes APIs.
184  * @details If enabled then the mutexes APIs are included in the kernel.
185  *
186  * @note    The default is @p TRUE.
187  */
188 #define CH_CFG_USE_MUTEXES                  TRUE
189
190 /**
191  * @brief   Enables recursive behavior on mutexes.
192  * @note    Recursive mutexes are heavier and have an increased
193  *          memory footprint.
194  *
195  * @note    The default is @p FALSE.
196  * @note    Requires @p CH_CFG_USE_MUTEXES.
197  */
198 #define CH_CFG_USE_MUTEXES_RECURSIVE        FALSE
199
200 /**
201  * @brief   Conditional Variables APIs.
202  * @details If enabled then the conditional variables APIs are included
203  *          in the kernel.
204  *
205  * @note    The default is @p TRUE.
206  * @note    Requires @p CH_CFG_USE_MUTEXES.
207  */
208 #define CH_CFG_USE_CONDVARS                 TRUE
209
210 /**
211  * @brief   Conditional Variables APIs with timeout.
212  * @details If enabled then the conditional variables APIs with timeout
213  *          specification are included in the kernel.
214  *
215  * @note    The default is @p TRUE.
216  * @note    Requires @p CH_CFG_USE_CONDVARS.
217  */
218 #define CH_CFG_USE_CONDVARS_TIMEOUT         TRUE
219
220 /**
221  * @brief   Events Flags APIs.
222  * @details If enabled then the event flags APIs are included in the kernel.
223  *
224  * @note    The default is @p TRUE.
225  */
226 #define CH_CFG_USE_EVENTS                   TRUE
227
228 /**
229  * @brief   Events Flags APIs with timeout.
230  * @details If enabled then the events APIs with timeout specification
231  *          are included in the kernel.
232  *
233  * @note    The default is @p TRUE.
234  * @note    Requires @p CH_CFG_USE_EVENTS.
235  */
236 #define CH_CFG_USE_EVENTS_TIMEOUT           TRUE
237
238 /**
239  * @brief   Synchronous Messages APIs.
240  * @details If enabled then the synchronous messages APIs are included
241  *          in the kernel.
242  *
243  * @note    The default is @p TRUE.
244  */
245 #define CH_CFG_USE_MESSAGES                 TRUE
246
247 /**
248  * @brief   Synchronous Messages queuing mode.
249  * @details If enabled then messages are served by priority rather than in
250  *          FIFO order.
251  *
252  * @note    The default is @p FALSE. Enable this if you have special
253  *          requirements.
254  * @note    Requires @p CH_CFG_USE_MESSAGES.
255  */
256 #define CH_CFG_USE_MESSAGES_PRIORITY        FALSE
257
258 /**
259  * @brief   Mailboxes APIs.
260  * @details If enabled then the asynchronous messages (mailboxes) APIs are
261  *          included in the kernel.
262  *
263  * @note    The default is @p TRUE.
264  * @note    Requires @p CH_CFG_USE_SEMAPHORES.
265  */
266 #define CH_CFG_USE_MAILBOXES                TRUE
267
268 /**
269  * @brief   Core Memory Manager APIs.
270  * @details If enabled then the core memory manager APIs are included
271  *          in the kernel.
272  *
273  * @note    The default is @p TRUE.
274  */
275 #define CH_CFG_USE_MEMCORE                  TRUE
276
277 /**
278  * @brief   Heap Allocator APIs.
279  * @details If enabled then the memory heap allocator APIs are included
280  *          in the kernel.
281  *
282  * @note    The default is @p TRUE.
283  * @note    Requires @p CH_CFG_USE_MEMCORE and either @p CH_CFG_USE_MUTEXES or
284  *          @p CH_CFG_USE_SEMAPHORES.
285  * @note    Mutexes are recommended.
286  */
287 #define CH_CFG_USE_HEAP                     TRUE
288
289 /**
290  * @brief   Memory Pools Allocator APIs.
291  * @details If enabled then the memory pools allocator APIs are included
292  *          in the kernel.
293  *
294  * @note    The default is @p TRUE.
295  */
296 #define CH_CFG_USE_MEMPOOLS                 TRUE
297
298 /**
299  * @brief   Dynamic Threads APIs.
300  * @details If enabled then the dynamic threads creation APIs are included
301  *          in the kernel.
302  *
303  * @note    The default is @p TRUE.
304  * @note    Requires @p CH_CFG_USE_WAITEXIT.
305  * @note    Requires @p CH_CFG_USE_HEAP and/or @p CH_CFG_USE_MEMPOOLS.
306  */
307 #define CH_CFG_USE_DYNAMIC                  TRUE
308
309 /** @} */
310
311 /*===========================================================================*/
312 /**
313  * @name Debug options
314  * @{
315  */
316 /*===========================================================================*/
317
318 /**
319  * @brief   Debug option, kernel statistics.
320  *
321  * @note    The default is @p FALSE.
322  */
323 #define CH_DBG_STATISTICS                   FALSE
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 #define CH_DBG_SYSTEM_STATE_CHECK           FALSE
333
334 /**
335  * @brief   Debug option, parameters checks.
336  * @details If enabled then the checks on the API functions input
337  *          parameters are activated.
338  *
339  * @note    The default is @p FALSE.
340  */
341 #define CH_DBG_ENABLE_CHECKS                FALSE
342
343 /**
344  * @brief   Debug option, consistency checks.
345  * @details If enabled then all the assertions in the kernel code are
346  *          activated. This includes consistency checks inside the kernel,
347  *          runtime anomalies and port-defined checks.
348  *
349  * @note    The default is @p FALSE.
350  */
351 #define CH_DBG_ENABLE_ASSERTS               FALSE
352
353 /**
354  * @brief   Debug option, trace buffer.
355  * @details If enabled then the trace buffer is activated.
356  *
357  * @note    The default is @p CH_DBG_TRACE_MASK_DISABLED.
358  */
359 #define CH_DBG_TRACE_MASK                   CH_DBG_TRACE_MASK_DISABLED
360
361 /**
362  * @brief   Trace buffer entries.
363  * @note    The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is
364  *          different from @p CH_DBG_TRACE_MASK_DISABLED.
365  */
366 #define CH_DBG_TRACE_BUFFER_SIZE            128
367
368 /**
369  * @brief   Debug option, stack checks.
370  * @details If enabled then a runtime stack check is performed.
371  *
372  * @note    The default is @p FALSE.
373  * @note    The stack check is performed in a architecture/port dependent way.
374  *          It may not be implemented or some ports.
375  * @note    The default failure mode is to halt the system with the global
376  *          @p panic_msg variable set to @p NULL.
377  */
378 #define CH_DBG_ENABLE_STACK_CHECK           FALSE
379
380 /**
381  * @brief   Debug option, stacks initialization.
382  * @details If enabled then the threads working area is filled with a byte
383  *          value when a thread is created. This can be useful for the
384  *          runtime measurement of the used stack.
385  *
386  * @note    The default is @p FALSE.
387  */
388 #define CH_DBG_FILL_THREADS                 FALSE
389
390 /**
391  * @brief   Debug option, threads profiling.
392  * @details If enabled then a field is added to the @p thread_t structure that
393  *          counts the system ticks occurred while executing the thread.
394  *
395  * @note    The default is @p FALSE.
396  * @note    This debug option is not currently compatible with the
397  *          tickless mode.
398  */
399 #define CH_DBG_THREADS_PROFILING            FALSE
400
401 /** @} */
402
403 /*===========================================================================*/
404 /**
405  * @name Kernel hooks
406  * @{
407  */
408 /*===========================================================================*/
409
410 /**
411  * @brief   Threads descriptor structure extension.
412  * @details User fields added to the end of the @p thread_t structure.
413  */
414 #define CH_CFG_THREAD_EXTRA_FIELDS                                          \
415   /* Add threads custom fields here.*/
416
417 /**
418  * @brief   Threads initialization hook.
419  * @details User initialization code added to the @p chThdInit() API.
420  *
421  * @note    It is invoked from within @p chThdInit() and implicitly from all
422  *          the threads creation APIs.
423  */
424 #define CH_CFG_THREAD_INIT_HOOK(tp) {                                       \
425   /* Add threads initialization code here.*/                                \
426 }
427
428 /**
429  * @brief   Threads finalization hook.
430  * @details User finalization code added to the @p chThdExit() API.
431  */
432 #define CH_CFG_THREAD_EXIT_HOOK(tp) {                                       \
433   /* Add threads finalization code here.*/                                  \
434 }
435
436 /**
437  * @brief   Context switch hook.
438  * @details This hook is invoked just before switching between threads.
439  */
440 #define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) {                              \
441   /* Context switch code here.*/                                            \
442 }
443
444 /**
445  * @brief   ISR enter hook.
446  */
447 #define CH_CFG_IRQ_PROLOGUE_HOOK() {                                        \
448   /* IRQ prologue code here.*/                                              \
449 }
450
451 /**
452  * @brief   ISR exit hook.
453  */
454 #define CH_CFG_IRQ_EPILOGUE_HOOK() {                                        \
455   /* IRQ epilogue code here.*/                                              \
456 }
457
458 /**
459  * @brief   Idle thread enter hook.
460  * @note    This hook is invoked within a critical zone, no OS functions
461  *          should be invoked from here.
462  * @note    This macro can be used to activate a power saving mode.
463  */
464 #define CH_CFG_IDLE_ENTER_HOOK() {                                          \
465   /* Idle-enter code here.*/                                                \
466 }
467
468 /**
469  * @brief   Idle thread leave hook.
470  * @note    This hook is invoked within a critical zone, no OS functions
471  *          should be invoked from here.
472  * @note    This macro can be used to deactivate a power saving mode.
473  */
474 #define CH_CFG_IDLE_LEAVE_HOOK() {                                          \
475   /* Idle-leave code here.*/                                                \
476 }
477
478 /**
479  * @brief   Idle Loop hook.
480  * @details This hook is continuously invoked by the idle thread loop.
481  */
482 #define CH_CFG_IDLE_LOOP_HOOK() {                                           \
483   /* Idle loop code here.*/                                                 \
484 }
485
486 /**
487  * @brief   System tick event hook.
488  * @details This hook is invoked in the system tick handler immediately
489  *          after processing the virtual timers queue.
490  */
491 #define CH_CFG_SYSTEM_TICK_HOOK() {                                         \
492   /* System tick event code here.*/                                         \
493 }
494
495 /**
496  * @brief   System halt hook.
497  * @details This hook is invoked in case to a system halting error before
498  *          the system is halted.
499  */
500 #define CH_CFG_SYSTEM_HALT_HOOK(reason) {                                   \
501   /* System halt code here.*/                                               \
502 }
503
504 /**
505  * @brief   Trace hook.
506  * @details This hook is invoked each time a new record is written in the
507  *          trace buffer.
508  */
509 #define CH_CFG_TRACE_HOOK(tep) {                                            \
510   /* Trace code here.*/                                                     \
511 }
512
513 /** @} */
514
515 /*===========================================================================*/
516 /* Port-specific settings (override port settings defaulted in chcore.h).    */
517 /*===========================================================================*/
518
519 #endif  /* CHCONF_H */
520
521 /** @} */