Statistics
| Branch: | Tag: | Revision:

amiro-os / modules / DiWheelDrive_1-1 / chconf.h @ 57d411d6

History | View | Annotate | Download (20.924 KB)

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