Subversion Repositories chibiosIgnition

Rev

Rev 2 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 mjames 1
/*
2
    ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010,
3
                 2011,2012 Giovanni Di Sirio.
4
 
5
    This file is part of ChibiOS/RT.
6
 
7
    ChibiOS/RT is free software; you can redistribute it and/or modify
8
    it under the terms of the GNU General Public License as published by
9
    the Free Software Foundation; either version 3 of the License, or
10
    (at your option) any later version.
11
 
12
    ChibiOS/RT is distributed in the hope that it will be useful,
13
    but WITHOUT ANY WARRANTY; without even the implied warranty of
14
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
    GNU General Public License for more details.
16
 
17
    You should have received a copy of the GNU General Public License
18
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
 
20
                                      ---
21
 
22
    A special exception to the GPL can be applied should you wish to distribute
23
    a combined work that includes ChibiOS/RT, without being obliged to provide
24
    the source code for any proprietary components. See the file exception.txt
25
    for full details of how and when the exception can be applied.
26
*/
27
 
28
/**
29
 * @file    templates/chconf.h
30
 * @brief   Configuration file template.
31
 * @details A copy of this file must be placed in each project directory, it
32
 *          contains the application specific kernel settings.
33
 *
34
 * @addtogroup config
35
 * @details Kernel related settings and hooks.
36
 * @{
37
 */
38
 
39
#ifndef _CHCONF_H_
40
#define _CHCONF_H_
41
 
42
/*===========================================================================*/
43
/**
44
 * @name Kernel parameters and options
45
 * @{
46
 */
47
/*===========================================================================*/
48
 
49
/**
50
 * @brief   System tick frequency.
51
 * @details Frequency of the system timer that drives the system ticks. This
52
 *          setting also defines the system tick time unit.
53
 */
54
#if !defined(CH_FREQUENCY) || defined(__DOXYGEN__)
55
#define CH_FREQUENCY                    1000
56
#endif
57
 
58
/**
59
 * @brief   Round robin interval.
60
 * @details This constant is the number of system ticks allowed for the
61
 *          threads before preemption occurs. Setting this value to zero
62
 *          disables the preemption for threads with equal priority and the
63
 *          round robin becomes cooperative. Note that higher priority
64
 *          threads can still preempt, the kernel is always preemptive.
65
 *
66
 * @note    Disabling the round robin preemption makes the kernel more compact
67
 *          and generally faster.
68
 */
69
#if !defined(CH_TIME_QUANTUM) || defined(__DOXYGEN__)
70
#define CH_TIME_QUANTUM                 20
71
#endif
72
 
73
/**
74
 * @brief   Managed RAM size.
75
 * @details Size of the RAM area to be managed by the OS. If set to zero
76
 *          then the whole available RAM is used. The core memory is made
77
 *          available to the heap allocator and/or can be used directly through
78
 *          the simplified core memory allocator.
79
 *
80
 * @note    In order to let the OS manage the whole RAM the linker script must
81
 *          provide the @p __heap_base__ and @p __heap_end__ symbols.
82
 * @note    Requires @p CH_USE_MEMCORE.
83
 */
84
#if !defined(CH_MEMCORE_SIZE) || defined(__DOXYGEN__)
85
#define CH_MEMCORE_SIZE                 0
86
#endif
87
 
88
/**
89
 * @brief   Idle thread automatic spawn suppression.
90
 * @details When this option is activated the function @p chSysInit()
91
 *          does not spawn the idle thread automatically. The application has
92
 *          then the responsibility to do one of the following:
93
 *          - Spawn a custom idle thread at priority @p IDLEPRIO.
94
 *          - Change the main() thread priority to @p IDLEPRIO then enter
95
 *            an endless loop. In this scenario the @p main() thread acts as
96
 *            the idle thread.
97
 *          .
98
 * @note    Unless an idle thread is spawned the @p main() thread must not
99
 *          enter a sleep state.
100
 */
101
#if !defined(CH_NO_IDLE_THREAD) || defined(__DOXYGEN__)
102
#define CH_NO_IDLE_THREAD               FALSE
103
#endif
104
 
105
/** @} */
106
 
107
/*===========================================================================*/
108
/**
109
 * @name Performance options
110
 * @{
111
 */
112
/*===========================================================================*/
113
 
114
/**
115
 * @brief   OS optimization.
116
 * @details If enabled then time efficient rather than space efficient code
117
 *          is used when two possible implementations exist.
118
 *
119
 * @note    This is not related to the compiler optimization options.
120
 * @note    The default is @p TRUE.
121
 */
122
#if !defined(CH_OPTIMIZE_SPEED) || defined(__DOXYGEN__)
123
#define CH_OPTIMIZE_SPEED               TRUE
124
#endif
125
 
126
/** @} */
127
 
128
/*===========================================================================*/
129
/**
130
 * @name Subsystem options
131
 * @{
132
 */
133
/*===========================================================================*/
134
 
135
/**
136
 * @brief   Threads registry APIs.
137
 * @details If enabled then the registry APIs are included in the kernel.
138
 *
139
 * @note    The default is @p TRUE.
140
 */
141
#if !defined(CH_USE_REGISTRY) || defined(__DOXYGEN__)
142
#define CH_USE_REGISTRY                 TRUE
143
#endif
144
 
145
/**
146
 * @brief   Threads synchronization APIs.
147
 * @details If enabled then the @p chThdWait() function is included in
148
 *          the kernel.
149
 *
150
 * @note    The default is @p TRUE.
151
 */
152
#if !defined(CH_USE_WAITEXIT) || defined(__DOXYGEN__)
153
#define CH_USE_WAITEXIT                 TRUE
154
#endif
155
 
156
/**
157
 * @brief   Semaphores APIs.
158
 * @details If enabled then the Semaphores APIs are included in the kernel.
159
 *
160
 * @note    The default is @p TRUE.
161
 */
162
#if !defined(CH_USE_SEMAPHORES) || defined(__DOXYGEN__)
163
#define CH_USE_SEMAPHORES               TRUE
164
#endif
165
 
166
/**
167
 * @brief   Semaphores queuing mode.
168
 * @details If enabled then the threads are enqueued on semaphores by
169
 *          priority rather than in FIFO order.
170
 *
171
 * @note    The default is @p FALSE. Enable this if you have special requirements.
172
 * @note    Requires @p CH_USE_SEMAPHORES.
173
 */
174
#if !defined(CH_USE_SEMAPHORES_PRIORITY) || defined(__DOXYGEN__)
175
#define CH_USE_SEMAPHORES_PRIORITY      FALSE
176
#endif
177
 
178
/**
179
 * @brief   Atomic semaphore API.
180
 * @details If enabled then the semaphores the @p chSemSignalWait() API
181
 *          is included in the kernel.
182
 *
183
 * @note    The default is @p TRUE.
184
 * @note    Requires @p CH_USE_SEMAPHORES.
185
 */
186
#if !defined(CH_USE_SEMSW) || defined(__DOXYGEN__)
187
#define CH_USE_SEMSW                    TRUE
188
#endif
189
 
190
/**
191
 * @brief   Mutexes APIs.
192
 * @details If enabled then the mutexes APIs are included in the kernel.
193
 *
194
 * @note    The default is @p TRUE.
195
 */
196
#if !defined(CH_USE_MUTEXES) || defined(__DOXYGEN__)
197
#define CH_USE_MUTEXES                  TRUE
198
#endif
199
 
200
/**
201
 * @brief   Conditional Variables APIs.
202
 * @details If enabled then the conditional variables APIs are included
203
 *          in the kernel.
204
 *
205
 * @note    The default is @p TRUE.
206
 * @note    Requires @p CH_USE_MUTEXES.
207
 */
208
#if !defined(CH_USE_CONDVARS) || defined(__DOXYGEN__)
209
#define CH_USE_CONDVARS                 TRUE
210
#endif
211
 
212
/**
213
 * @brief   Conditional Variables APIs with timeout.
214
 * @details If enabled then the conditional variables APIs with timeout
215
 *          specification are included in the kernel.
216
 *
217
 * @note    The default is @p TRUE.
218
 * @note    Requires @p CH_USE_CONDVARS.
219
 */
220
#if !defined(CH_USE_CONDVARS_TIMEOUT) || defined(__DOXYGEN__)
221
#define CH_USE_CONDVARS_TIMEOUT         TRUE
222
#endif
223
 
224
/**
225
 * @brief   Events Flags APIs.
226
 * @details If enabled then the event flags APIs are included in the kernel.
227
 *
228
 * @note    The default is @p TRUE.
229
 */
230
#if !defined(CH_USE_EVENTS) || defined(__DOXYGEN__)
231
#define CH_USE_EVENTS                   TRUE
232
#endif
233
 
234
/**
235
 * @brief   Events Flags APIs with timeout.
236
 * @details If enabled then the events APIs with timeout specification
237
 *          are included in the kernel.
238
 *
239
 * @note    The default is @p TRUE.
240
 * @note    Requires @p CH_USE_EVENTS.
241
 */
242
#if !defined(CH_USE_EVENTS_TIMEOUT) || defined(__DOXYGEN__)
243
#define CH_USE_EVENTS_TIMEOUT           TRUE
244
#endif
245
 
246
/**
247
 * @brief   Synchronous Messages APIs.
248
 * @details If enabled then the synchronous messages APIs are included
249
 *          in the kernel.
250
 *
251
 * @note    The default is @p TRUE.
252
 */
253
#if !defined(CH_USE_MESSAGES) || defined(__DOXYGEN__)
254
#define CH_USE_MESSAGES                 TRUE
255
#endif
256
 
257
/**
258
 * @brief   Synchronous Messages queuing mode.
259
 * @details If enabled then messages are served by priority rather than in
260
 *          FIFO order.
261
 *
262
 * @note    The default is @p FALSE. Enable this if you have special requirements.
263
 * @note    Requires @p CH_USE_MESSAGES.
264
 */
265
#if !defined(CH_USE_MESSAGES_PRIORITY) || defined(__DOXYGEN__)
266
#define CH_USE_MESSAGES_PRIORITY        FALSE
267
#endif
268
 
269
/**
270
 * @brief   Mailboxes APIs.
271
 * @details If enabled then the asynchronous messages (mailboxes) APIs are
272
 *          included in the kernel.
273
 *
274
 * @note    The default is @p TRUE.
275
 * @note    Requires @p CH_USE_SEMAPHORES.
276
 */
277
#if !defined(CH_USE_MAILBOXES) || defined(__DOXYGEN__)
278
#define CH_USE_MAILBOXES                TRUE
279
#endif
280
 
281
/**
282
 * @brief   I/O Queues APIs.
283
 * @details If enabled then the I/O queues APIs are included in the kernel.
284
 *
285
 * @note    The default is @p TRUE.
286
 */
287
#if !defined(CH_USE_QUEUES) || defined(__DOXYGEN__)
288
#define CH_USE_QUEUES                   TRUE
289
#endif
290
 
291
/**
292
 * @brief   Core Memory Manager APIs.
293
 * @details If enabled then the core memory manager APIs are included
294
 *          in the kernel.
295
 *
296
 * @note    The default is @p TRUE.
297
 */
298
#if !defined(CH_USE_MEMCORE) || defined(__DOXYGEN__)
299
#define CH_USE_MEMCORE                  TRUE
300
#endif
301
 
302
/**
303
 * @brief   Heap Allocator APIs.
304
 * @details If enabled then the memory heap allocator APIs are included
305
 *          in the kernel.
306
 *
307
 * @note    The default is @p TRUE.
308
 * @note    Requires @p CH_USE_MEMCORE and either @p CH_USE_MUTEXES or
309
 *          @p CH_USE_SEMAPHORES.
310
 * @note    Mutexes are recommended.
311
 */
312
#if !defined(CH_USE_HEAP) || defined(__DOXYGEN__)
313
#define CH_USE_HEAP                     TRUE
314
#endif
315
 
316
/**
317
 * @brief   C-runtime allocator.
318
 * @details If enabled the the heap allocator APIs just wrap the C-runtime
319
 *          @p malloc() and @p free() functions.
320
 *
321
 * @note    The default is @p FALSE.
322
 * @note    Requires @p CH_USE_HEAP.
323
 * @note    The C-runtime may or may not require @p CH_USE_MEMCORE, see the
324
 *          appropriate documentation.
325
 */
326
#if !defined(CH_USE_MALLOC_HEAP) || defined(__DOXYGEN__)
327
#define CH_USE_MALLOC_HEAP              FALSE
328
#endif
329
 
330
/**
331
 * @brief   Memory Pools Allocator APIs.
332
 * @details If enabled then the memory pools allocator APIs are included
333
 *          in the kernel.
334
 *
335
 * @note    The default is @p TRUE.
336
 */
337
#if !defined(CH_USE_MEMPOOLS) || defined(__DOXYGEN__)
338
#define CH_USE_MEMPOOLS                 TRUE
339
#endif
340
 
341
/**
342
 * @brief   Dynamic Threads APIs.
343
 * @details If enabled then the dynamic threads creation APIs are included
344
 *          in the kernel.
345
 *
346
 * @note    The default is @p TRUE.
347
 * @note    Requires @p CH_USE_WAITEXIT.
348
 * @note    Requires @p CH_USE_HEAP and/or @p CH_USE_MEMPOOLS.
349
 */
350
#if !defined(CH_USE_DYNAMIC) || defined(__DOXYGEN__)
351
#define CH_USE_DYNAMIC                  TRUE
352
#endif
353
 
354
/** @} */
355
 
356
/*===========================================================================*/
357
/**
358
 * @name Debug options
359
 * @{
360
 */
361
/*===========================================================================*/
362
 
363
/**
364
 * @brief   Debug option, system state check.
365
 * @details If enabled the correct call protocol for system APIs is checked
366
 *          at runtime.
367
 *
368
 * @note    The default is @p FALSE.
369
 */
370
#if !defined(CH_DBG_SYSTEM_STATE_CHECK) || defined(__DOXYGEN__)
371
#define CH_DBG_SYSTEM_STATE_CHECK       FALSE
372
#endif
373
 
374
/**
375
 * @brief   Debug option, parameters checks.
376
 * @details If enabled then the checks on the API functions input
377
 *          parameters are activated.
378
 *
379
 * @note    The default is @p FALSE.
380
 */
381
#if !defined(CH_DBG_ENABLE_CHECKS) || defined(__DOXYGEN__)
382
#define CH_DBG_ENABLE_CHECKS            FALSE
383
#endif
384
 
385
/**
386
 * @brief   Debug option, consistency checks.
387
 * @details If enabled then all the assertions in the kernel code are
388
 *          activated. This includes consistency checks inside the kernel,
389
 *          runtime anomalies and port-defined checks.
390
 *
391
 * @note    The default is @p FALSE.
392
 */
393
#if !defined(CH_DBG_ENABLE_ASSERTS) || defined(__DOXYGEN__)
394
#define CH_DBG_ENABLE_ASSERTS           FALSE
395
#endif
396
 
397
/**
398
 * @brief   Debug option, trace buffer.
399
 * @details If enabled then the context switch circular trace buffer is
400
 *          activated.
401
 *
402
 * @note    The default is @p FALSE.
403
 */
404
#if !defined(CH_DBG_ENABLE_TRACE) || defined(__DOXYGEN__)
405
#define CH_DBG_ENABLE_TRACE             FALSE
406
#endif
407
 
408
/**
409
 * @brief   Debug option, stack checks.
410
 * @details If enabled then a runtime stack check is performed.
411
 *
412
 * @note    The default is @p FALSE.
413
 * @note    The stack check is performed in a architecture/port dependent way.
414
 *          It may not be implemented or some ports.
415
 * @note    The default failure mode is to halt the system with the global
416
 *          @p panic_msg variable set to @p NULL.
417
 */
418
#if !defined(CH_DBG_ENABLE_STACK_CHECK) || defined(__DOXYGEN__)
419
#define CH_DBG_ENABLE_STACK_CHECK       FALSE
420
#endif
421
 
422
/**
423
 * @brief   Debug option, stacks initialization.
424
 * @details If enabled then the threads working area is filled with a byte
425
 *          value when a thread is created. This can be useful for the
426
 *          runtime measurement of the used stack.
427
 *
428
 * @note    The default is @p FALSE.
429
 */
430
#if !defined(CH_DBG_FILL_THREADS) || defined(__DOXYGEN__)
431
#define CH_DBG_FILL_THREADS             FALSE
432
#endif
433
 
434
/**
435
 * @brief   Debug option, threads profiling.
436
 * @details If enabled then a field is added to the @p Thread structure that
437
 *          counts the system ticks occurred while executing the thread.
438
 *
439
 * @note    The default is @p TRUE.
440
 * @note    This debug option is defaulted to TRUE because it is required by
441
 *          some test cases into the test suite.
442
 */
443
#if !defined(CH_DBG_THREADS_PROFILING) || defined(__DOXYGEN__)
444
#define CH_DBG_THREADS_PROFILING        TRUE
445
#endif
446
 
447
/** @} */
448
 
449
/*===========================================================================*/
450
/**
451
 * @name Kernel hooks
452
 * @{
453
 */
454
/*===========================================================================*/
455
 
456
/**
457
 * @brief   Threads descriptor structure extension.
458
 * @details User fields added to the end of the @p Thread structure.
459
 */
460
#if !defined(THREAD_EXT_FIELDS) || defined(__DOXYGEN__)
461
#define THREAD_EXT_FIELDS                                                   \
462
  /* Add threads custom fields here.*/
463
#endif
464
 
465
/**
466
 * @brief   Threads initialization hook.
467
 * @details User initialization code added to the @p chThdInit() API.
468
 *
469
 * @note    It is invoked from within @p chThdInit() and implicitly from all
470
 *          the threads creation APIs.
471
 */
472
#if !defined(THREAD_EXT_INIT_HOOK) || defined(__DOXYGEN__)
473
#define THREAD_EXT_INIT_HOOK(tp) {                                          \
474
  /* Add threads initialization code here.*/                                \
475
}
476
#endif
477
 
478
/**
479
 * @brief   Threads finalization hook.
480
 * @details User finalization code added to the @p chThdExit() API.
481
 *
482
 * @note    It is inserted into lock zone.
483
 * @note    It is also invoked when the threads simply return in order to
484
 *          terminate.
485
 */
486
#if !defined(THREAD_EXT_EXIT_HOOK) || defined(__DOXYGEN__)
487
#define THREAD_EXT_EXIT_HOOK(tp) {                                          \
488
  /* Add threads finalization code here.*/                                  \
489
}
490
#endif
491
 
492
/**
493
 * @brief   Context switch hook.
494
 * @details This hook is invoked just before switching between threads.
495
 */
496
#if !defined(THREAD_CONTEXT_SWITCH_HOOK) || defined(__DOXYGEN__)
497
#define THREAD_CONTEXT_SWITCH_HOOK(ntp, otp) {                              \
498
  /* System halt code here.*/                                               \
499
}
500
#endif
501
 
502
/**
503
 * @brief   Idle Loop hook.
504
 * @details This hook is continuously invoked by the idle thread loop.
505
 */
506
#if !defined(IDLE_LOOP_HOOK) || defined(__DOXYGEN__)
507
#define IDLE_LOOP_HOOK() {                                                  \
508
  /* Idle loop code here.*/                                                 \
509
}
510
#endif
511
 
512
/**
513
 * @brief   System tick event hook.
514
 * @details This hook is invoked in the system tick handler immediately
515
 *          after processing the virtual timers queue.
516
 */
517
#if !defined(SYSTEM_TICK_EVENT_HOOK) || defined(__DOXYGEN__)
518
#define SYSTEM_TICK_EVENT_HOOK() {                                          \
519
  /* System tick event code here.*/                                         \
520
}
521
#endif
522
 
523
/**
524
 * @brief   System halt hook.
525
 * @details This hook is invoked in case to a system halting error before
526
 *          the system is halted.
527
 */
528
#if !defined(SYSTEM_HALT_HOOK) || defined(__DOXYGEN__)
529
#define SYSTEM_HALT_HOOK() {                                                \
530
  /* System halt code here.*/                                               \
531
}
532
#endif
533
 
534
/** @} */
535
 
536
/*===========================================================================*/
537
/* Port-specific settings (override port settings defaulted in chcore.h).    */
538
/*===========================================================================*/
539
 
540
#endif  /* _CHCONF_H_ */
541
 
542
/** @} */