ChibiOS  21.6.0
nil/templates/chconf.h
Go to the documentation of this file.
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 nil/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 NIL_CONFIG
24  * @details Kernel related settings and hooks.
25  * @{
26  */
27 
28 #ifndef CHCONF_H
29 #define CHCONF_H
30 
31 #define _CHIBIOS_NIL_CONF_
32 #define _CHIBIOS_NIL_CONF_VER_4_0_
33 
34 /*===========================================================================*/
35 /**
36  * @name Kernel parameters and options
37  * @{
38  */
39 /*===========================================================================*/
40 
41 /**
42  * @brief Maximum number of user threads in the application.
43  * @note This number is not inclusive of the idle thread which is
44  * implicitly handled.
45  * @note Set this value to be exactly equal to the number of threads you
46  * will use or you would be wasting RAM and cycles.
47  * @note This values also defines the number of available priorities
48  * (0..CH_CFG_MAX_THREADS-1).
49  */
50 #if !defined(CH_CFG_MAX_THREADS)
51 #define CH_CFG_MAX_THREADS 4
52 #endif
53 
54 /**
55  * @brief Auto starts threads when @p chSysInit() is invoked.
56  */
57 #if !defined(CH_CFG_AUTOSTART_THREADS)
58 #define CH_CFG_AUTOSTART_THREADS TRUE
59 #endif
60 
61 /** @} */
62 
63 /*===========================================================================*/
64 /**
65  * @name System timer settings
66  * @{
67  */
68 /*===========================================================================*/
69 
70 /**
71  * @brief System time counter resolution.
72  * @note Allowed values are 16 or 32 bits.
73  */
74 #if !defined(CH_CFG_ST_RESOLUTION)
75 #define CH_CFG_ST_RESOLUTION 32
76 #endif
77 
78 /**
79  * @brief System tick frequency.
80  * @note This value together with the @p CH_CFG_ST_RESOLUTION
81  * option defines the maximum amount of time allowed for
82  * timeouts.
83  */
84 #if !defined(CH_CFG_ST_FREQUENCY)
85 #define CH_CFG_ST_FREQUENCY 1000
86 #endif
87 
88 /**
89  * @brief Time delta constant for the tick-less mode.
90  * @note If this value is zero then the system uses the classic
91  * periodic tick. This value represents the minimum number
92  * of ticks that is safe to specify in a timeout directive.
93  * The value one is not valid, timeouts are rounded up to
94  * this value.
95  */
96 #if !defined(CH_CFG_ST_TIMEDELTA)
97 #define CH_CFG_ST_TIMEDELTA 0
98 #endif
99 
100 /** @} */
101 
102 /*===========================================================================*/
103 /**
104  * @name Subsystem options
105  * @{
106  */
107 /*===========================================================================*/
108 
109 /**
110  * @brief Threads synchronization APIs.
111  * @details If enabled then the @p chThdWait() function is included in
112  * the kernel.
113  *
114  * @note The default is @p TRUE.
115  */
116 #if !defined(CH_CFG_USE_WAITEXIT)
117 #define CH_CFG_USE_WAITEXIT TRUE
118 #endif
119 
120 /**
121  * @brief Semaphores APIs.
122  * @details If enabled then the Semaphores APIs are included in the kernel.
123  *
124  * @note The default is @p TRUE.
125  */
126 #if !defined(CH_CFG_USE_SEMAPHORES)
127 #define CH_CFG_USE_SEMAPHORES TRUE
128 #endif
129 
130 /**
131  * @brief Mutexes APIs.
132  * @details If enabled then the mutexes APIs are included in the kernel.
133  *
134  * @note Feature not currently implemented.
135  * @note The default is @p FALSE.
136  */
137 #if !defined(CH_CFG_USE_MUTEXES)
138 #define CH_CFG_USE_MUTEXES FALSE
139 #endif
140 
141 /**
142  * @brief Events Flags APIs.
143  * @details If enabled then the event flags APIs are included in the kernel.
144  *
145  * @note The default is @p TRUE.
146  */
147 #if !defined(CH_CFG_USE_EVENTS)
148 #define CH_CFG_USE_EVENTS TRUE
149 #endif
150 
151 /**
152  * @brief Synchronous Messages APIs.
153  * @details If enabled then the synchronous messages APIs are included
154  * in the kernel.
155  *
156  * @note The default is @p TRUE.
157  */
158 #if !defined(CH_CFG_USE_MESSAGES)
159 #define CH_CFG_USE_MESSAGES TRUE
160 #endif
161 
162 /** @} */
163 
164 /*===========================================================================*/
165 /**
166  * @name OSLIB options
167  * @{
168  */
169 /*===========================================================================*/
170 
171 /**
172  * @brief Mailboxes APIs.
173  * @details If enabled then the asynchronous messages (mailboxes) APIs are
174  * included in the kernel.
175  *
176  * @note The default is @p TRUE.
177  * @note Requires @p CH_CFG_USE_SEMAPHORES.
178  */
179 #if !defined(CH_CFG_USE_MAILBOXES)
180 #define CH_CFG_USE_MAILBOXES TRUE
181 #endif
182 
183 /**
184  * @brief Core Memory Manager APIs.
185  * @details If enabled then the core memory manager APIs are included
186  * in the kernel.
187  *
188  * @note The default is @p TRUE.
189  */
190 #if !defined(CH_CFG_USE_MEMCORE)
191 #define CH_CFG_USE_MEMCORE TRUE
192 #endif
193 
194 /**
195  * @brief Managed RAM size.
196  * @details Size of the RAM area to be managed by the OS. If set to zero
197  * then the whole available RAM is used. The core memory is made
198  * available to the heap allocator and/or can be used directly through
199  * the simplified core memory allocator.
200  *
201  * @note In order to let the OS manage the whole RAM the linker script must
202  * provide the @p __heap_base__ and @p __heap_end__ symbols.
203  * @note Requires @p CH_CFG_USE_MEMCORE.
204  */
205 #if !defined(CH_CFG_MEMCORE_SIZE)
206 #define CH_CFG_MEMCORE_SIZE 0
207 #endif
208 
209 /**
210  * @brief Heap Allocator APIs.
211  * @details If enabled then the memory heap allocator APIs are included
212  * in the kernel.
213  *
214  * @note The default is @p TRUE.
215  */
216 #if !defined(CH_CFG_USE_HEAP)
217 #define CH_CFG_USE_HEAP TRUE
218 #endif
219 
220 /**
221  * @brief Memory Pools Allocator APIs.
222  * @details If enabled then the memory pools allocator APIs are included
223  * in the kernel.
224  *
225  * @note The default is @p TRUE.
226  */
227 #if !defined(CH_CFG_USE_MEMPOOLS)
228 #define CH_CFG_USE_MEMPOOLS TRUE
229 #endif
230 
231 /**
232  * @brief Objects FIFOs APIs.
233  * @details If enabled then the objects FIFOs APIs are included
234  * in the kernel.
235  *
236  * @note The default is @p TRUE.
237  */
238 #if !defined(CH_CFG_USE_OBJ_FIFOS)
239 #define CH_CFG_USE_OBJ_FIFOS TRUE
240 #endif
241 
242 /**
243  * @brief Pipes APIs.
244  * @details If enabled then the pipes APIs are included
245  * in the kernel.
246  *
247  * @note The default is @p TRUE.
248  */
249 #if !defined(CH_CFG_USE_PIPES)
250 #define CH_CFG_USE_PIPES TRUE
251 #endif
252 
253 /**
254  * @brief Objects Caches APIs.
255  * @details If enabled then the objects caches APIs are included
256  * in the kernel.
257  *
258  * @note The default is @p TRUE.
259  */
260 #if !defined(CH_CFG_USE_OBJ_CACHES)
261 #define CH_CFG_USE_OBJ_CACHES TRUE
262 #endif
263 
264 /**
265  * @brief Delegate threads APIs.
266  * @details If enabled then the delegate threads APIs are included
267  * in the kernel.
268  *
269  * @note The default is @p TRUE.
270  */
271 #if !defined(CH_CFG_USE_DELEGATES)
272 #define CH_CFG_USE_DELEGATES TRUE
273 #endif
274 
275 /**
276  * @brief Jobs Queues APIs.
277  * @details If enabled then the jobs queues APIs are included
278  * in the kernel.
279  *
280  * @note The default is @p TRUE.
281  */
282 #if !defined(CH_CFG_USE_JOBS)
283 #define CH_CFG_USE_JOBS TRUE
284 #endif
285 
286 /** @} */
287 
288 /*===========================================================================*/
289 /**
290  * @name Objects factory options
291  * @{
292  */
293 /*===========================================================================*/
294 
295 /**
296  * @brief Objects Factory APIs.
297  * @details If enabled then the objects factory APIs are included in the
298  * kernel.
299  *
300  * @note The default is @p FALSE.
301  */
302 #if !defined(CH_CFG_USE_FACTORY)
303 #define CH_CFG_USE_FACTORY TRUE
304 #endif
305 
306 /**
307  * @brief Maximum length for object names.
308  * @details If the specified length is zero then the name is stored by
309  * pointer but this could have unintended side effects.
310  */
311 #if !defined(CH_CFG_FACTORY_MAX_NAMES_LENGTH)
312 #define CH_CFG_FACTORY_MAX_NAMES_LENGTH 8
313 #endif
314 
315 /**
316  * @brief Enables the registry of generic objects.
317  */
318 #if !defined(CH_CFG_FACTORY_OBJECTS_REGISTRY)
319 #define CH_CFG_FACTORY_OBJECTS_REGISTRY TRUE
320 #endif
321 
322 /**
323  * @brief Enables factory for generic buffers.
324  */
325 #if !defined(CH_CFG_FACTORY_GENERIC_BUFFERS)
326 #define CH_CFG_FACTORY_GENERIC_BUFFERS TRUE
327 #endif
328 
329 /**
330  * @brief Enables factory for semaphores.
331  */
332 #if !defined(CH_CFG_FACTORY_SEMAPHORES)
333 #define CH_CFG_FACTORY_SEMAPHORES TRUE
334 #endif
335 
336 /**
337  * @brief Enables factory for mailboxes.
338  */
339 #if !defined(CH_CFG_FACTORY_MAILBOXES)
340 #define CH_CFG_FACTORY_MAILBOXES TRUE
341 #endif
342 
343 /**
344  * @brief Enables factory for objects FIFOs.
345  */
346 #if !defined(CH_CFG_FACTORY_OBJ_FIFOS)
347 #define CH_CFG_FACTORY_OBJ_FIFOS TRUE
348 #endif
349 
350 /**
351  * @brief Enables factory for Pipes.
352  */
353 #if !defined(CH_CFG_FACTORY_PIPES)
354 #define CH_CFG_FACTORY_PIPES TRUE
355 #endif
356 
357 /** @} */
358 
359 /*===========================================================================*/
360 /**
361  * @name Debug options
362  * @{
363  */
364 /*===========================================================================*/
365 
366 /**
367  * @brief Debug option, kernel statistics.
368  *
369  * @note Feature not currently implemented.
370  * @note The default is @p FALSE.
371  */
372 #if !defined(CH_DBG_STATISTICS)
373 #define CH_DBG_STATISTICS FALSE
374 #endif
375 
376 /**
377  * @brief Debug option, system state check.
378  *
379  * @note The default is @p FALSE.
380  */
381 #if !defined(CH_DBG_SYSTEM_STATE_CHECK)
382 #define CH_DBG_SYSTEM_STATE_CHECK TRUE
383 #endif
384 
385 /**
386  * @brief Debug option, parameters checks.
387  *
388  * @note The default is @p FALSE.
389  */
390 #if !defined(CH_DBG_ENABLE_CHECKS)
391 #define CH_DBG_ENABLE_CHECKS TRUE
392 #endif
393 
394 /**
395  * @brief System assertions.
396  *
397  * @note The default is @p FALSE.
398  */
399 #if !defined(CH_DBG_ENABLE_ASSERTS)
400 #define CH_DBG_ENABLE_ASSERTS TRUE
401 #endif
402 
403 /**
404  * @brief Stack check.
405  *
406  * @note The default is @p FALSE.
407  */
408 #if !defined(CH_DBG_ENABLE_STACK_CHECK)
409 #define CH_DBG_ENABLE_STACK_CHECK TRUE
410 #endif
411 
412 /** @} */
413 
414 /*===========================================================================*/
415 /**
416  * @name Kernel hooks
417  * @{
418  */
419 /*===========================================================================*/
420 
421 /**
422  * @brief System initialization hook.
423  */
424 #define CH_CFG_SYSTEM_INIT_HOOK() { \
425 }
426 
427 /**
428  * @brief Threads descriptor structure extension.
429  * @details User fields added to the end of the @p thread_t structure.
430  */
431 #define CH_CFG_THREAD_EXT_FIELDS \
432  /* Add threads custom fields here.*/
433 
434 /**
435  * @brief Threads initialization hook.
436  */
437 #define CH_CFG_THREAD_EXT_INIT_HOOK(tr) { \
438  /* Add custom threads initialization code here.*/ \
439 }
440 
441 /**
442  * @brief Threads finalization hook.
443  * @details User finalization code added to the @p chThdExit() API.
444  */
445 #define CH_CFG_THREAD_EXIT_HOOK(tp) {}
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 System halt hook.
467  */
468 #define CH_CFG_SYSTEM_HALT_HOOK(reason) { \
469 }
470 
471 /** @} */
472 
473 /*===========================================================================*/
474 /* Port-specific settings (override port settings defaulted in nilcore.h). */
475 /*===========================================================================*/
476 
477 #endif /* CHCONF_H */
478 
479 /** @} */