ChibiOS/NIL  3.1.0
chconf.h
Go to the documentation of this file.
1 /*
2  ChibiOS - Copyright (C) 2006..2017 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 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_3_0_
33 
34 /*===========================================================================*/
35 /**
36  * @name Kernel parameters and options
37  * @{
38  */
39 /*===========================================================================*/
40 
41 /**
42  * @brief Number of user threads in the application.
43  * @note This number is not inclusive of the idle thread which is
44  * Implicitly handled.
45  */
46 #define CH_CFG_NUM_THREADS 3
47 
48 /** @} */
49 
50 /*===========================================================================*/
51 /**
52  * @name System timer settings
53  * @{
54  */
55 /*===========================================================================*/
56 
57 /**
58  * @brief System time counter resolution.
59  * @note Allowed values are 16 or 32 bits.
60  */
61 #define CH_CFG_ST_RESOLUTION 32
62 
63 /**
64  * @brief System tick frequency.
65  * @note This value together with the @p CH_CFG_ST_RESOLUTION
66  * option defines the maximum amount of time allowed for
67  * timeouts.
68  */
69 #define CH_CFG_ST_FREQUENCY 1000
70 
71 /**
72  * @brief Time delta constant for the tick-less mode.
73  * @note If this value is zero then the system uses the classic
74  * periodic tick. This value represents the minimum number
75  * of ticks that is safe to specify in a timeout directive.
76  * The value one is not valid, timeouts are rounded up to
77  * this value.
78  */
79 #define CH_CFG_ST_TIMEDELTA 0
80 
81 /** @} */
82 
83 /*===========================================================================*/
84 /**
85  * @name Subsystem options
86  * @{
87  */
88 /*===========================================================================*/
89 
90 /**
91  * @brief Semaphores APIs.
92  * @details If enabled then the Semaphores APIs are included in the kernel.
93  *
94  * @note The default is @p TRUE.
95  */
96 #define CH_CFG_USE_SEMAPHORES TRUE
97 
98 /**
99  * @brief Mutexes APIs.
100  * @details If enabled then the mutexes APIs are included in the kernel.
101  *
102  * @note Feature not currently implemented.
103  * @note The default is @p FALSE.
104  */
105 #define CH_CFG_USE_MUTEXES FALSE
106 
107 /**
108  * @brief Events Flags APIs.
109  * @details If enabled then the event flags APIs are included in the kernel.
110  *
111  * @note The default is @p TRUE.
112  */
113 #define CH_CFG_USE_EVENTS TRUE
114 
115 /**
116  * @brief Mailboxes APIs.
117  * @details If enabled then the asynchronous messages (mailboxes) APIs are
118  * included in the kernel.
119  *
120  * @note The default is @p TRUE.
121  * @note Requires @p CH_CFG_USE_SEMAPHORES.
122  */
123 #define CH_CFG_USE_MAILBOXES TRUE
124 
125 /**
126  * @brief Core Memory Manager APIs.
127  * @details If enabled then the core memory manager APIs are included
128  * in the kernel.
129  *
130  * @note The default is @p TRUE.
131  */
132 #define CH_CFG_USE_MEMCORE TRUE
133 
134 /**
135  * @brief Heap Allocator APIs.
136  * @details If enabled then the memory heap allocator APIs are included
137  * in the kernel.
138  *
139  * @note The default is @p TRUE.
140  */
141 #define CH_CFG_USE_HEAP TRUE
142 
143 /**
144  * @brief Memory Pools Allocator APIs.
145  * @details If enabled then the memory pools allocator APIs are included
146  * in the kernel.
147  *
148  * @note The default is @p TRUE.
149  */
150 #define CH_CFG_USE_MEMPOOLS TRUE
151 
152 /**
153  * @brief Objects FIFOs APIs.
154  * @details If enabled then the objects FIFOs APIs are included
155  * in the kernel.
156  *
157  * @note The default is @p TRUE.
158  */
159 #define CH_CFG_USE_OBJ_FIFOS TRUE
160 
161 /**
162  * @brief Managed RAM size.
163  * @details Size of the RAM area to be managed by the OS. If set to zero
164  * then the whole available RAM is used. The core memory is made
165  * available to the heap allocator and/or can be used directly through
166  * the simplified core memory allocator.
167  *
168  * @note In order to let the OS manage the whole RAM the linker script must
169  * provide the @p __heap_base__ and @p __heap_end__ symbols.
170  * @note Requires @p CH_CFG_USE_MEMCORE.
171  */
172 #define CH_CFG_MEMCORE_SIZE 0
173 
174 /** @} */
175 
176 /*===========================================================================*/
177 /**
178  * @name Objects factory options
179  * @{
180  */
181 /*===========================================================================*/
182 
183 /**
184  * @brief Objects Factory APIs.
185  * @details If enabled then the objects factory APIs are included in the
186  * kernel.
187  *
188  * @note The default is @p FALSE.
189  */
190 #define CH_CFG_USE_FACTORY TRUE
191 
192 /**
193  * @brief Maximum length for object names.
194  * @details If the specified length is zero then the name is stored by
195  * pointer but this could have unintended side effects.
196  */
197 #define CH_CFG_FACTORY_MAX_NAMES_LENGTH 8
198 
199 /**
200  * @brief Enables the registry of generic objects.
201  */
202 #define CH_CFG_FACTORY_OBJECTS_REGISTRY TRUE
203 
204 /**
205  * @brief Enables factory for generic buffers.
206  */
207 #define CH_CFG_FACTORY_GENERIC_BUFFERS TRUE
208 
209 /**
210  * @brief Enables factory for semaphores.
211  */
212 #define CH_CFG_FACTORY_SEMAPHORES TRUE
213 
214 /**
215  * @brief Enables factory for mailboxes.
216  */
217 #define CH_CFG_FACTORY_MAILBOXES TRUE
218 
219 /**
220  * @brief Enables factory for objects FIFOs.
221  */
222 #define CH_CFG_FACTORY_OBJ_FIFOS TRUE
223 
224 /** @} */
225 
226 /*===========================================================================*/
227 /**
228  * @name Debug options
229  * @{
230  */
231 /*===========================================================================*/
232 
233 /**
234  * @brief Debug option, kernel statistics.
235  *
236  * @note Feature not currently implemented.
237  * @note The default is @p FALSE.
238  */
239 #define CH_DBG_STATISTICS FALSE
240 
241 /**
242  * @brief Debug option, system state check.
243  *
244  * @note The default is @p FALSE.
245  */
246 #define CH_DBG_SYSTEM_STATE_CHECK TRUE
247 
248 /**
249  * @brief Debug option, parameters checks.
250  *
251  * @note The default is @p FALSE.
252  */
253 #define CH_DBG_ENABLE_CHECKS TRUE
254 
255 /**
256  * @brief System assertions.
257  *
258  * @note The default is @p FALSE.
259  */
260 #define CH_DBG_ENABLE_ASSERTS TRUE
261 
262 /**
263  * @brief Stack check.
264  *
265  * @note The default is @p FALSE.
266  */
267 #define CH_DBG_ENABLE_STACK_CHECK TRUE
268 
269 /** @} */
270 
271 /*===========================================================================*/
272 /**
273  * @name Kernel hooks
274  * @{
275  */
276 /*===========================================================================*/
277 
278 /**
279  * @brief System initialization hook.
280  */
281 #if !defined(CH_CFG_SYSTEM_INIT_HOOK) || defined(__DOXYGEN__)
282 #define CH_CFG_SYSTEM_INIT_HOOK() { \
283 }
284 #endif
285 
286 /**
287  * @brief Threads descriptor structure extension.
288  * @details User fields added to the end of the @p thread_t structure.
289  */
290 #define CH_CFG_THREAD_EXT_FIELDS \
291  /* Add threads custom fields here.*/
292 
293 /**
294  * @brief Threads initialization hook.
295  */
296 #define CH_CFG_THREAD_EXT_INIT_HOOK(tr) { \
297  /* Add custom threads initialization code here.*/ \
298 }
299 
300 /**
301  * @brief Idle thread enter hook.
302  * @note This hook is invoked within a critical zone, no OS functions
303  * should be invoked from here.
304  * @note This macro can be used to activate a power saving mode.
305  */
306 #define CH_CFG_IDLE_ENTER_HOOK() { \
307 }
308 
309 /**
310  * @brief Idle thread leave hook.
311  * @note This hook is invoked within a critical zone, no OS functions
312  * should be invoked from here.
313  * @note This macro can be used to deactivate a power saving mode.
314  */
315 #define CH_CFG_IDLE_LEAVE_HOOK() { \
316 }
317 
318 /**
319  * @brief System halt hook.
320  */
321 #if !defined(CH_CFG_SYSTEM_HALT_HOOK) || defined(__DOXYGEN__)
322 #define CH_CFG_SYSTEM_HALT_HOOK(reason) { \
323 }
324 #endif
325 
326 /** @} */
327 
328 /*===========================================================================*/
329 /* Port-specific settings (override port settings defaulted in nilcore.h). */
330 /*===========================================================================*/
331 
332 #endif /* CHCONF_H */
333 
334 /** @} */