Subversion Repositories chibiosIgnition

Rev

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

Rev Author Line No. Line
2 mjames 1
/*
7 mjames 2
    ChibiOS - Copyright (C) 2006..2017 Giovanni Di Sirio
2 mjames 3
 
7 mjames 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
2 mjames 7
 
7 mjames 8
        http://www.apache.org/licenses/LICENSE-2.0
2 mjames 9
 
7 mjames 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.
2 mjames 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
 
7 mjames 28
#ifndef CHCONF_H
29
#define CHCONF_H
2 mjames 30
 
7 mjames 31
#define _CHIBIOS_RT_CONF_
32
#define _CHIBIOS_RT_CONF_VER_5_0_
33
 
2 mjames 34
/*===========================================================================*/
35
/**
7 mjames 36
 * @name System timers settings
2 mjames 37
 * @{
38
 */
39
/*===========================================================================*/
40
 
41
/**
7 mjames 42
 * @brief   System time counter resolution.
43
 * @note    Allowed values are 16 or 32 bits.
44
 */
45
#define CH_CFG_ST_RESOLUTION                16
46
 
47
/**
2 mjames 48
 * @brief   System tick frequency.
49
 * @details Frequency of the system timer that drives the system ticks. This
50
 *          setting also defines the system tick time unit.
51
 */
7 mjames 52
#define CH_CFG_ST_FREQUENCY                 10000
2 mjames 53
 
54
/**
7 mjames 55
 * @brief   Time intervals data size.
56
 * @note    Allowed values are 16, 32 or 64 bits.
57
 */
58
#define CH_CFG_INTERVALS_SIZE               32
59
 
60
/**
61
 * @brief   Time types data size.
62
 * @note    Allowed values are 16 or 32 bits.
63
 */
64
#define CH_CFG_TIME_TYPES_SIZE              32
65
 
66
/**
67
 * @brief   Time delta constant for the tick-less mode.
68
 * @note    If this value is zero then the system uses the classic
69
 *          periodic tick. This value represents the minimum number
70
 *          of ticks that is safe to specify in a timeout directive.
71
 *          The value one is not valid, timeouts are rounded up to
72
 *          this value.
73
 */
74
#define CH_CFG_ST_TIMEDELTA                 2
75
 
76
/** @} */
77
 
78
/*===========================================================================*/
79
/**
80
 * @name Kernel parameters and options
81
 * @{
82
 */
83
/*===========================================================================*/
84
 
85
/**
2 mjames 86
 * @brief   Round robin interval.
87
 * @details This constant is the number of system ticks allowed for the
88
 *          threads before preemption occurs. Setting this value to zero
89
 *          disables the preemption for threads with equal priority and the
90
 *          round robin becomes cooperative. Note that higher priority
91
 *          threads can still preempt, the kernel is always preemptive.
92
 * @note    Disabling the round robin preemption makes the kernel more compact
93
 *          and generally faster.
7 mjames 94
 * @note    The round robin preemption is not supported in tickless mode and
95
 *          must be set to zero in that case.
2 mjames 96
 */
7 mjames 97
#define CH_CFG_TIME_QUANTUM                 0
2 mjames 98
 
99
/**
100
 * @brief   Managed RAM size.
101
 * @details Size of the RAM area to be managed by the OS. If set to zero
102
 *          then the whole available RAM is used. The core memory is made
103
 *          available to the heap allocator and/or can be used directly through
104
 *          the simplified core memory allocator.
105
 *
106
 * @note    In order to let the OS manage the whole RAM the linker script must
107
 *          provide the @p __heap_base__ and @p __heap_end__ symbols.
7 mjames 108
 * @note    Requires @p CH_CFG_USE_MEMCORE.
2 mjames 109
 */
7 mjames 110
#define CH_CFG_MEMCORE_SIZE                 0
2 mjames 111
 
112
/**
113
 * @brief   Idle thread automatic spawn suppression.
114
 * @details When this option is activated the function @p chSysInit()
7 mjames 115
 *          does not spawn the idle thread. The application @p main()
116
 *          function becomes the idle thread and must implement an
117
 *          infinite loop.
2 mjames 118
 */
7 mjames 119
#define CH_CFG_NO_IDLE_THREAD               FALSE
2 mjames 120
 
121
/** @} */
122
 
123
/*===========================================================================*/
124
/**
125
 * @name Performance options
126
 * @{
127
 */
128
/*===========================================================================*/
129
 
130
/**
131
 * @brief   OS optimization.
132
 * @details If enabled then time efficient rather than space efficient code
133
 *          is used when two possible implementations exist.
134
 *
135
 * @note    This is not related to the compiler optimization options.
136
 * @note    The default is @p TRUE.
137
 */
7 mjames 138
#define CH_CFG_OPTIMIZE_SPEED               TRUE
2 mjames 139
 
140
/** @} */
141
 
142
/*===========================================================================*/
143
/**
144
 * @name Subsystem options
145
 * @{
146
 */
147
/*===========================================================================*/
148
 
149
/**
7 mjames 150
 * @brief   Time Measurement APIs.
151
 * @details If enabled then the time measurement APIs are included in
152
 *          the kernel.
153
 *
154
 * @note    The default is @p TRUE.
155
 */
156
#define CH_CFG_USE_TM                       TRUE
157
 
158
/**
2 mjames 159
 * @brief   Threads registry APIs.
160
 * @details If enabled then the registry APIs are included in the kernel.
161
 *
162
 * @note    The default is @p TRUE.
163
 */
7 mjames 164
#define CH_CFG_USE_REGISTRY                 TRUE
2 mjames 165
 
166
/**
167
 * @brief   Threads synchronization APIs.
168
 * @details If enabled then the @p chThdWait() function is included in
169
 *          the kernel.
170
 *
171
 * @note    The default is @p TRUE.
172
 */
7 mjames 173
#define CH_CFG_USE_WAITEXIT                 TRUE
2 mjames 174
 
175
/**
176
 * @brief   Semaphores APIs.
177
 * @details If enabled then the Semaphores APIs are included in the kernel.
178
 *
179
 * @note    The default is @p TRUE.
180
 */
7 mjames 181
#define CH_CFG_USE_SEMAPHORES               TRUE
2 mjames 182
 
183
/**
184
 * @brief   Semaphores queuing mode.
185
 * @details If enabled then the threads are enqueued on semaphores by
186
 *          priority rather than in FIFO order.
187
 *
7 mjames 188
 * @note    The default is @p FALSE. Enable this if you have special
189
 *          requirements.
190
 * @note    Requires @p CH_CFG_USE_SEMAPHORES.
2 mjames 191
 */
7 mjames 192
#define CH_CFG_USE_SEMAPHORES_PRIORITY      FALSE
2 mjames 193
 
194
/**
7 mjames 195
 * @brief   Mutexes APIs.
196
 * @details If enabled then the mutexes APIs are included in the kernel.
2 mjames 197
 *
198
 * @note    The default is @p TRUE.
199
 */
7 mjames 200
#define CH_CFG_USE_MUTEXES                  TRUE
2 mjames 201
 
202
/**
7 mjames 203
 * @brief   Enables recursive behavior on mutexes.
204
 * @note    Recursive mutexes are heavier and have an increased
205
 *          memory footprint.
2 mjames 206
 *
7 mjames 207
 * @note    The default is @p FALSE.
208
 * @note    Requires @p CH_CFG_USE_MUTEXES.
2 mjames 209
 */
7 mjames 210
#define CH_CFG_USE_MUTEXES_RECURSIVE        FALSE
2 mjames 211
 
212
/**
213
 * @brief   Conditional Variables APIs.
214
 * @details If enabled then the conditional variables APIs are included
215
 *          in the kernel.
216
 *
217
 * @note    The default is @p TRUE.
7 mjames 218
 * @note    Requires @p CH_CFG_USE_MUTEXES.
2 mjames 219
 */
7 mjames 220
#define CH_CFG_USE_CONDVARS                 TRUE
2 mjames 221
 
222
/**
223
 * @brief   Conditional Variables APIs with timeout.
224
 * @details If enabled then the conditional variables APIs with timeout
225
 *          specification are included in the kernel.
226
 *
227
 * @note    The default is @p TRUE.
7 mjames 228
 * @note    Requires @p CH_CFG_USE_CONDVARS.
2 mjames 229
 */
7 mjames 230
#define CH_CFG_USE_CONDVARS_TIMEOUT         TRUE
2 mjames 231
 
232
/**
233
 * @brief   Events Flags APIs.
234
 * @details If enabled then the event flags APIs are included in the kernel.
235
 *
236
 * @note    The default is @p TRUE.
237
 */
7 mjames 238
#define CH_CFG_USE_EVENTS                   TRUE
2 mjames 239
 
240
/**
241
 * @brief   Events Flags APIs with timeout.
242
 * @details If enabled then the events APIs with timeout specification
243
 *          are included in the kernel.
244
 *
245
 * @note    The default is @p TRUE.
7 mjames 246
 * @note    Requires @p CH_CFG_USE_EVENTS.
2 mjames 247
 */
7 mjames 248
#define CH_CFG_USE_EVENTS_TIMEOUT           TRUE
2 mjames 249
 
250
/**
251
 * @brief   Synchronous Messages APIs.
252
 * @details If enabled then the synchronous messages APIs are included
253
 *          in the kernel.
254
 *
255
 * @note    The default is @p TRUE.
256
 */
7 mjames 257
#define CH_CFG_USE_MESSAGES                 TRUE
2 mjames 258
 
259
/**
260
 * @brief   Synchronous Messages queuing mode.
261
 * @details If enabled then messages are served by priority rather than in
262
 *          FIFO order.
263
 *
7 mjames 264
 * @note    The default is @p FALSE. Enable this if you have special
265
 *          requirements.
266
 * @note    Requires @p CH_CFG_USE_MESSAGES.
2 mjames 267
 */
7 mjames 268
#define CH_CFG_USE_MESSAGES_PRIORITY        FALSE
2 mjames 269
 
270
/**
271
 * @brief   Mailboxes APIs.
272
 * @details If enabled then the asynchronous messages (mailboxes) APIs are
273
 *          included in the kernel.
274
 *
275
 * @note    The default is @p TRUE.
7 mjames 276
 * @note    Requires @p CH_CFG_USE_SEMAPHORES.
2 mjames 277
 */
7 mjames 278
#define CH_CFG_USE_MAILBOXES                TRUE
2 mjames 279
 
280
/**
281
 * @brief   Core Memory Manager APIs.
282
 * @details If enabled then the core memory manager APIs are included
283
 *          in the kernel.
284
 *
285
 * @note    The default is @p TRUE.
286
 */
7 mjames 287
#define CH_CFG_USE_MEMCORE                  TRUE
2 mjames 288
 
289
/**
290
 * @brief   Heap Allocator APIs.
291
 * @details If enabled then the memory heap allocator APIs are included
292
 *          in the kernel.
293
 *
294
 * @note    The default is @p TRUE.
7 mjames 295
 * @note    Requires @p CH_CFG_USE_MEMCORE and either @p CH_CFG_USE_MUTEXES or
296
 *          @p CH_CFG_USE_SEMAPHORES.
2 mjames 297
 * @note    Mutexes are recommended.
298
 */
7 mjames 299
#define CH_CFG_USE_HEAP                     TRUE
2 mjames 300
 
301
/**
7 mjames 302
 * @brief   Memory Pools Allocator APIs.
303
 * @details If enabled then the memory pools allocator APIs are included
304
 *          in the kernel.
2 mjames 305
 *
7 mjames 306
 * @note    The default is @p TRUE.
2 mjames 307
 */
7 mjames 308
#define CH_CFG_USE_MEMPOOLS                 TRUE
2 mjames 309
 
310
/**
7 mjames 311
 * @brief  Objects FIFOs APIs.
312
 * @details If enabled then the objects FIFOs APIs are included
2 mjames 313
 *          in the kernel.
314
 *
315
 * @note    The default is @p TRUE.
316
 */
7 mjames 317
#define CH_CFG_USE_OBJ_FIFOS                TRUE
2 mjames 318
 
319
/**
320
 * @brief   Dynamic Threads APIs.
321
 * @details If enabled then the dynamic threads creation APIs are included
322
 *          in the kernel.
323
 *
324
 * @note    The default is @p TRUE.
7 mjames 325
 * @note    Requires @p CH_CFG_USE_WAITEXIT.
326
 * @note    Requires @p CH_CFG_USE_HEAP and/or @p CH_CFG_USE_MEMPOOLS.
2 mjames 327
 */
7 mjames 328
#define CH_CFG_USE_DYNAMIC                  TRUE
2 mjames 329
 
330
/** @} */
331
 
332
/*===========================================================================*/
333
/**
7 mjames 334
 * @name Objects factory options
335
 * @{
336
 */
337
/*===========================================================================*/
338
 
339
/**
340
 * @brief   Objects Factory APIs.
341
 * @details If enabled then the objects factory APIs are included in the
342
 *          kernel.
343
 *
344
 * @note    The default is @p FALSE.
345
 */
346
#define CH_CFG_USE_FACTORY                  TRUE
347
 
348
/**
349
 * @brief   Maximum length for object names.
350
 * @details If the specified length is zero then the name is stored by
351
 *          pointer but this could have unintended side effects.
352
 */
353
#define CH_CFG_FACTORY_MAX_NAMES_LENGTH     8
354
 
355
/**
356
 * @brief   Enables the registry of generic objects.
357
 */
358
#define CH_CFG_FACTORY_OBJECTS_REGISTRY     TRUE
359
 
360
/**
361
 * @brief   Enables factory for generic buffers.
362
 */
363
#define CH_CFG_FACTORY_GENERIC_BUFFERS      TRUE
364
 
365
/**
366
 * @brief   Enables factory for semaphores.
367
 */
368
#define CH_CFG_FACTORY_SEMAPHORES           TRUE
369
 
370
/**
371
 * @brief   Enables factory for mailboxes.
372
 */
373
#define CH_CFG_FACTORY_MAILBOXES            TRUE
374
 
375
/**
376
 * @brief   Enables factory for objects FIFOs.
377
 */
378
#define CH_CFG_FACTORY_OBJ_FIFOS            TRUE
379
 
380
/** @} */
381
 
382
/*===========================================================================*/
383
/**
2 mjames 384
 * @name Debug options
385
 * @{
386
 */
387
/*===========================================================================*/
388
 
389
/**
7 mjames 390
 * @brief   Debug option, kernel statistics.
391
 *
392
 * @note    The default is @p FALSE.
393
 */
394
#define CH_DBG_STATISTICS                   FALSE
395
 
396
/**
2 mjames 397
 * @brief   Debug option, system state check.
398
 * @details If enabled the correct call protocol for system APIs is checked
399
 *          at runtime.
400
 *
401
 * @note    The default is @p FALSE.
402
 */
7 mjames 403
#define CH_DBG_SYSTEM_STATE_CHECK           FALSE
2 mjames 404
 
405
/**
406
 * @brief   Debug option, parameters checks.
407
 * @details If enabled then the checks on the API functions input
408
 *          parameters are activated.
409
 *
410
 * @note    The default is @p FALSE.
411
 */
7 mjames 412
#define CH_DBG_ENABLE_CHECKS                FALSE
2 mjames 413
 
414
/**
415
 * @brief   Debug option, consistency checks.
416
 * @details If enabled then all the assertions in the kernel code are
417
 *          activated. This includes consistency checks inside the kernel,
418
 *          runtime anomalies and port-defined checks.
419
 *
420
 * @note    The default is @p FALSE.
421
 */
7 mjames 422
#define CH_DBG_ENABLE_ASSERTS               FALSE
2 mjames 423
 
424
/**
425
 * @brief   Debug option, trace buffer.
7 mjames 426
 * @details If enabled then the trace buffer is activated.
2 mjames 427
 *
7 mjames 428
 * @note    The default is @p CH_DBG_TRACE_MASK_DISABLED.
2 mjames 429
 */
7 mjames 430
#define CH_DBG_TRACE_MASK                   CH_DBG_TRACE_MASK_DISABLED
2 mjames 431
 
432
/**
7 mjames 433
 * @brief   Trace buffer entries.
434
 * @note    The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is
435
 *          different from @p CH_DBG_TRACE_MASK_DISABLED.
436
 */
437
#define CH_DBG_TRACE_BUFFER_SIZE            128
438
 
439
/**
2 mjames 440
 * @brief   Debug option, stack checks.
441
 * @details If enabled then a runtime stack check is performed.
442
 *
443
 * @note    The default is @p FALSE.
444
 * @note    The stack check is performed in a architecture/port dependent way.
445
 *          It may not be implemented or some ports.
446
 * @note    The default failure mode is to halt the system with the global
447
 *          @p panic_msg variable set to @p NULL.
448
 */
7 mjames 449
#define CH_DBG_ENABLE_STACK_CHECK           FALSE
2 mjames 450
 
451
/**
452
 * @brief   Debug option, stacks initialization.
453
 * @details If enabled then the threads working area is filled with a byte
454
 *          value when a thread is created. This can be useful for the
455
 *          runtime measurement of the used stack.
456
 *
457
 * @note    The default is @p FALSE.
458
 */
7 mjames 459
#define CH_DBG_FILL_THREADS                 FALSE
2 mjames 460
 
461
/**
462
 * @brief   Debug option, threads profiling.
7 mjames 463
 * @details If enabled then a field is added to the @p thread_t structure that
2 mjames 464
 *          counts the system ticks occurred while executing the thread.
465
 *
7 mjames 466
 * @note    The default is @p FALSE.
467
 * @note    This debug option is not currently compatible with the
468
 *          tickless mode.
2 mjames 469
 */
7 mjames 470
#define CH_DBG_THREADS_PROFILING            FALSE
2 mjames 471
 
472
/** @} */
473
 
474
/*===========================================================================*/
475
/**
476
 * @name Kernel hooks
477
 * @{
478
 */
479
/*===========================================================================*/
480
 
481
/**
7 mjames 482
 * @brief   System structure extension.
483
 * @details User fields added to the end of the @p ch_system_t structure.
484
 */
485
#define CH_CFG_SYSTEM_EXTRA_FIELDS                                          \
486
  /* Add threads custom fields here.*/
487
 
488
/**
489
 * @brief   System initialization hook.
490
 * @details User initialization code added to the @p chSysInit() function
491
 *          just before interrupts are enabled globally.
492
 */
493
#define CH_CFG_SYSTEM_INIT_HOOK(tp) {                                       \
494
  /* Add threads initialization code here.*/                                \
495
}
496
 
497
/**
2 mjames 498
 * @brief   Threads descriptor structure extension.
7 mjames 499
 * @details User fields added to the end of the @p thread_t structure.
2 mjames 500
 */
7 mjames 501
#define CH_CFG_THREAD_EXTRA_FIELDS                                          \
2 mjames 502
  /* Add threads custom fields here.*/
503
 
504
/**
505
 * @brief   Threads initialization hook.
7 mjames 506
 * @details User initialization code added to the @p _thread_init() function.
2 mjames 507
 *
7 mjames 508
 * @note    It is invoked from within @p _thread_init() and implicitly from all
2 mjames 509
 *          the threads creation APIs.
510
 */
7 mjames 511
#define CH_CFG_THREAD_INIT_HOOK(tp) {                                       \
2 mjames 512
  /* Add threads initialization code here.*/                                \
513
}
514
 
515
/**
516
 * @brief   Threads finalization hook.
517
 * @details User finalization code added to the @p chThdExit() API.
518
 */
7 mjames 519
#define CH_CFG_THREAD_EXIT_HOOK(tp) {                                       \
2 mjames 520
  /* Add threads finalization code here.*/                                  \
521
}
522
 
523
/**
524
 * @brief   Context switch hook.
525
 * @details This hook is invoked just before switching between threads.
526
 */
7 mjames 527
#define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) {                              \
528
  /* Context switch code here.*/                                            \
2 mjames 529
}
530
 
531
/**
7 mjames 532
 * @brief   ISR enter hook.
533
 */
534
#define CH_CFG_IRQ_PROLOGUE_HOOK() {                                        \
535
  /* IRQ prologue code here.*/                                              \
536
}
537
 
538
/**
539
 * @brief   ISR exit hook.
540
 */
541
#define CH_CFG_IRQ_EPILOGUE_HOOK() {                                        \
542
  /* IRQ epilogue code here.*/                                              \
543
}
544
 
545
/**
546
 * @brief   Idle thread enter hook.
547
 * @note    This hook is invoked within a critical zone, no OS functions
548
 *          should be invoked from here.
549
 * @note    This macro can be used to activate a power saving mode.
550
 */
551
#define CH_CFG_IDLE_ENTER_HOOK() {                                          \
552
  /* Idle-enter code here.*/                                                \
553
}
554
 
555
/**
556
 * @brief   Idle thread leave hook.
557
 * @note    This hook is invoked within a critical zone, no OS functions
558
 *          should be invoked from here.
559
 * @note    This macro can be used to deactivate a power saving mode.
560
 */
561
#define CH_CFG_IDLE_LEAVE_HOOK() {                                          \
562
  /* Idle-leave code here.*/                                                \
563
}
564
 
565
/**
2 mjames 566
 * @brief   Idle Loop hook.
567
 * @details This hook is continuously invoked by the idle thread loop.
568
 */
7 mjames 569
#define CH_CFG_IDLE_LOOP_HOOK() {                                           \
2 mjames 570
  /* Idle loop code here.*/                                                 \
571
}
572
 
573
/**
574
 * @brief   System tick event hook.
575
 * @details This hook is invoked in the system tick handler immediately
576
 *          after processing the virtual timers queue.
577
 */
7 mjames 578
#define CH_CFG_SYSTEM_TICK_HOOK() {                                         \
2 mjames 579
  /* System tick event code here.*/                                         \
580
}
581
 
582
/**
583
 * @brief   System halt hook.
584
 * @details This hook is invoked in case to a system halting error before
585
 *          the system is halted.
586
 */
7 mjames 587
#define CH_CFG_SYSTEM_HALT_HOOK(reason) {                                   \
2 mjames 588
  /* System halt code here.*/                                               \
589
}
590
 
7 mjames 591
/**
592
 * @brief   Trace hook.
593
 * @details This hook is invoked each time a new record is written in the
594
 *          trace buffer.
595
 */
596
#define CH_CFG_TRACE_HOOK(tep) {                                            \
597
  /* Trace code here.*/                                                     \
598
}
599
 
2 mjames 600
/** @} */
601
 
602
/*===========================================================================*/
603
/* Port-specific settings (override port settings defaulted in chcore.h).    */
604
/*===========================================================================*/
7 mjames 605
#define SHELL_CMD_TEST_ENABLED FALSE
606
#endif  /* CHCONF_H */
2 mjames 607
 
608
/** @} */