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