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