]> git.gir.st - tmk_keyboard.git/blob - keyboard/infinity_chibios/chconf.h
b7a340d6ffe65b240012d41982c085ed46a28eac
[tmk_keyboard.git] / keyboard / infinity_chibios / 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 /** @} */
107
108 /*===========================================================================*/
109 /**
110 * @name Performance options
111 * @{
112 */
113 /*===========================================================================*/
114
115 /**
116 * @brief OS optimization.
117 * @details If enabled then time efficient rather than space efficient code
118 * is used when two possible implementations exist.
119 *
120 * @note This is not related to the compiler optimization options.
121 * @note The default is @p TRUE.
122 */
123 #define CH_CFG_OPTIMIZE_SPEED TRUE
124
125 /** @} */
126
127 /*===========================================================================*/
128 /**
129 * @name Subsystem options
130 * @{
131 */
132 /*===========================================================================*/
133
134 /**
135 * @brief Time Measurement APIs.
136 * @details If enabled then the time measurement APIs are included in
137 * the kernel.
138 *
139 * @note The default is @p TRUE.
140 */
141 #define CH_CFG_USE_TM FALSE
142
143 /**
144 * @brief Threads registry APIs.
145 * @details If enabled then the registry APIs are included in the kernel.
146 *
147 * @note The default is @p TRUE.
148 */
149 #define CH_CFG_USE_REGISTRY TRUE
150
151 /**
152 * @brief Threads synchronization APIs.
153 * @details If enabled then the @p chThdWait() function is included in
154 * the kernel.
155 *
156 * @note The default is @p TRUE.
157 */
158 #define CH_CFG_USE_WAITEXIT TRUE
159
160 /**
161 * @brief Semaphores APIs.
162 * @details If enabled then the Semaphores APIs are included in the kernel.
163 *
164 * @note The default is @p TRUE.
165 */
166 #define CH_CFG_USE_SEMAPHORES TRUE
167
168 /**
169 * @brief Semaphores queuing mode.
170 * @details If enabled then the threads are enqueued on semaphores by
171 * priority rather than in FIFO order.
172 *
173 * @note The default is @p FALSE. Enable this if you have special
174 * requirements.
175 * @note Requires @p CH_CFG_USE_SEMAPHORES.
176 */
177 #define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE
178
179 /**
180 * @brief Mutexes APIs.
181 * @details If enabled then the mutexes APIs are included in the kernel.
182 *
183 * @note The default is @p TRUE.
184 */
185 #define CH_CFG_USE_MUTEXES TRUE
186
187 /**
188 * @brief Enables recursive behavior on mutexes.
189 * @note Recursive mutexes are heavier and have an increased
190 * memory footprint.
191 *
192 * @note The default is @p FALSE.
193 * @note Requires @p CH_CFG_USE_MUTEXES.
194 */
195 #define CH_CFG_USE_MUTEXES_RECURSIVE FALSE
196
197 /**
198 * @brief Conditional Variables APIs.
199 * @details If enabled then the conditional variables APIs are included
200 * in the kernel.
201 *
202 * @note The default is @p TRUE.
203 * @note Requires @p CH_CFG_USE_MUTEXES.
204 */
205 #define CH_CFG_USE_CONDVARS TRUE
206
207 /**
208 * @brief Conditional Variables APIs with timeout.
209 * @details If enabled then the conditional variables APIs with timeout
210 * specification are included in the kernel.
211 *
212 * @note The default is @p TRUE.
213 * @note Requires @p CH_CFG_USE_CONDVARS.
214 */
215 #define CH_CFG_USE_CONDVARS_TIMEOUT TRUE
216
217 /**
218 * @brief Events Flags APIs.
219 * @details If enabled then the event flags APIs are included in the kernel.
220 *
221 * @note The default is @p TRUE.
222 */
223 #define CH_CFG_USE_EVENTS TRUE
224
225 /**
226 * @brief Events Flags APIs with timeout.
227 * @details If enabled then the events APIs with timeout specification
228 * are included in the kernel.
229 *
230 * @note The default is @p TRUE.
231 * @note Requires @p CH_CFG_USE_EVENTS.
232 */
233 #define CH_CFG_USE_EVENTS_TIMEOUT TRUE
234
235 /**
236 * @brief Synchronous Messages APIs.
237 * @details If enabled then the synchronous messages APIs are included
238 * in the kernel.
239 *
240 * @note The default is @p TRUE.
241 */
242 #define CH_CFG_USE_MESSAGES TRUE
243
244 /**
245 * @brief Synchronous Messages queuing mode.
246 * @details If enabled then messages are served by priority rather than in
247 * FIFO order.
248 *
249 * @note The default is @p FALSE. Enable this if you have special
250 * requirements.
251 * @note Requires @p CH_CFG_USE_MESSAGES.
252 */
253 #define CH_CFG_USE_MESSAGES_PRIORITY FALSE
254
255 /**
256 * @brief Mailboxes APIs.
257 * @details If enabled then the asynchronous messages (mailboxes) APIs are
258 * included in the kernel.
259 *
260 * @note The default is @p TRUE.
261 * @note Requires @p CH_CFG_USE_SEMAPHORES.
262 */
263 #define CH_CFG_USE_MAILBOXES TRUE
264
265 /**
266 * @brief I/O Queues APIs.
267 * @details If enabled then the I/O queues APIs are included in the kernel.
268 *
269 * @note The default is @p TRUE.
270 */
271 #define CH_CFG_USE_QUEUES TRUE
272
273 /**
274 * @brief Core Memory Manager APIs.
275 * @details If enabled then the core memory manager APIs are included
276 * in the kernel.
277 *
278 * @note The default is @p TRUE.
279 */
280 #define CH_CFG_USE_MEMCORE TRUE
281
282 /**
283 * @brief Heap Allocator APIs.
284 * @details If enabled then the memory heap allocator APIs are included
285 * in the kernel.
286 *
287 * @note The default is @p TRUE.
288 * @note Requires @p CH_CFG_USE_MEMCORE and either @p CH_CFG_USE_MUTEXES or
289 * @p CH_CFG_USE_SEMAPHORES.
290 * @note Mutexes are recommended.
291 */
292 #define CH_CFG_USE_HEAP TRUE
293
294 /**
295 * @brief Memory Pools Allocator APIs.
296 * @details If enabled then the memory pools allocator APIs are included
297 * in the kernel.
298 *
299 * @note The default is @p TRUE.
300 */
301 #define CH_CFG_USE_MEMPOOLS TRUE
302
303 /**
304 * @brief Dynamic Threads APIs.
305 * @details If enabled then the dynamic threads creation APIs are included
306 * in the kernel.
307 *
308 * @note The default is @p TRUE.
309 * @note Requires @p CH_CFG_USE_WAITEXIT.
310 * @note Requires @p CH_CFG_USE_HEAP and/or @p CH_CFG_USE_MEMPOOLS.
311 */
312 #define CH_CFG_USE_DYNAMIC TRUE
313
314 /** @} */
315
316 /*===========================================================================*/
317 /**
318 * @name Debug options
319 * @{
320 */
321 /*===========================================================================*/
322
323 /**
324 * @brief Debug option, kernel statistics.
325 *
326 * @note The default is @p FALSE.
327 */
328 #define CH_DBG_STATISTICS FALSE
329
330 /**
331 * @brief Debug option, system state check.
332 * @details If enabled the correct call protocol for system APIs is checked
333 * at runtime.
334 *
335 * @note The default is @p FALSE.
336 */
337 #define CH_DBG_SYSTEM_STATE_CHECK FALSE
338
339 /**
340 * @brief Debug option, parameters checks.
341 * @details If enabled then the checks on the API functions input
342 * parameters are activated.
343 *
344 * @note The default is @p FALSE.
345 */
346 #define CH_DBG_ENABLE_CHECKS FALSE
347
348 /**
349 * @brief Debug option, consistency checks.
350 * @details If enabled then all the assertions in the kernel code are
351 * activated. This includes consistency checks inside the kernel,
352 * runtime anomalies and port-defined checks.
353 *
354 * @note The default is @p FALSE.
355 */
356 #define CH_DBG_ENABLE_ASSERTS FALSE
357
358 /**
359 * @brief Debug option, trace buffer.
360 * @details If enabled then the context switch circular trace buffer is
361 * activated.
362 *
363 * @note The default is @p FALSE.
364 */
365 #define CH_DBG_ENABLE_TRACE FALSE
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 FALSE
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 * @note It is inserted into lock zone.
432 * @note It is also invoked when the threads simply return in order to
433 * terminate.
434 */
435 #define CH_CFG_THREAD_EXIT_HOOK(tp) { \
436 /* Add threads finalization code here.*/ \
437 }
438
439 /**
440 * @brief Context switch hook.
441 * @details This hook is invoked just before switching between threads.
442 */
443 #define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) { \
444 /* Context switch code here.*/ \
445 }
446
447 /**
448 * @brief Idle thread enter hook.
449 * @note This hook is invoked within a critical zone, no OS functions
450 * should be invoked from here.
451 * @note This macro can be used to activate a power saving mode.
452 */
453 #define CH_CFG_IDLE_ENTER_HOOK() { \
454 }
455
456 /**
457 * @brief Idle thread leave hook.
458 * @note This hook is invoked within a critical zone, no OS functions
459 * should be invoked from here.
460 * @note This macro can be used to deactivate a power saving mode.
461 */
462 #define CH_CFG_IDLE_LEAVE_HOOK() { \
463 }
464
465 /**
466 * @brief Idle Loop hook.
467 * @details This hook is continuously invoked by the idle thread loop.
468 */
469 #define CH_CFG_IDLE_LOOP_HOOK() { \
470 /* Idle loop code here.*/ \
471 }
472
473 /**
474 * @brief System tick event hook.
475 * @details This hook is invoked in the system tick handler immediately
476 * after processing the virtual timers queue.
477 */
478 #define CH_CFG_SYSTEM_TICK_HOOK() { \
479 /* System tick event code here.*/ \
480 }
481
482 /**
483 * @brief System halt hook.
484 * @details This hook is invoked in case to a system halting error before
485 * the system is halted.
486 */
487 #define CH_CFG_SYSTEM_HALT_HOOK(reason) { \
488 /* System halt code here.*/ \
489 }
490
491 /** @} */
492
493 /*===========================================================================*/
494 /* Port-specific settings (override port settings defaulted in chcore.h). */
495 /*===========================================================================*/
496
497 #endif /* _CHCONF_H_ */
498
499 /** @} */
Imprint / Impressum