Statistics
| Branch: | Tag: | Revision:

amiro-os / os / modules / LightRing_1-0 / chconf.h @ bdf72fa0

History | View | Annotate | Download (17.938 KB)

1
/*
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/LightRing/chconf.h
21
 * @brief   ChibiOS Configuration file for the LightRing 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

    
34
#include <aosconf.h>
35

    
36
/*===========================================================================*/
37
/**
38
 * @name System timers settings
39
 * @{
40
 */
41
/*===========================================================================*/
42

    
43
/**
44
 * @brief   System time counter resolution.
45
 * @note    Allowed values are 16 or 32 bits.
46
 */
47
#define CH_CFG_ST_RESOLUTION                16
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 (AMIROOS_CFG_TESTS_ENABLE != true) || defined(__DOXYGEN__)
55
#define CH_CFG_ST_FREQUENCY                 1000000UL
56
#else
57
#define CH_CFG_ST_FREQUENCY                 100000UL
58
#endif
59

    
60
/**
61
 * @brief   Time delta constant for the tick-less mode.
62
 * @note    If this value is zero then the system uses the classic
63
 *          periodic tick. This value represents the minimum number
64
 *          of ticks that is safe to specify in a timeout directive.
65
 *          The value one is not valid, timeouts are rounded up to
66
 *          this value.
67
 */
68
#if (AMIROOS_CFG_TESTS_ENABLE != true) || defined(__DOXYGEN__)
69
#define CH_CFG_ST_TIMEDELTA                 10
70
#else
71
#define CH_CFG_ST_TIMEDELTA                 2
72
#endif
73

    
74
/** @} */
75

    
76
/*===========================================================================*/
77
/**
78
 * @name Kernel parameters and options
79
 * @{
80
 */
81
/*===========================================================================*/
82

    
83
/**
84
 * @brief   Round robin interval.
85
 * @details This constant is the number of system ticks allowed for the
86
 *          threads before preemption occurs. Setting this value to zero
87
 *          disables the preemption for threads with equal priority and the
88
 *          round robin becomes cooperative. Note that higher priority
89
 *          threads can still preempt, the kernel is always preemptive.
90
 * @note    Disabling the round robin preemption makes the kernel more compact
91
 *          and generally faster.
92
 * @note    The round robin preemption is not supported in tickless mode and
93
 *          must be set to zero in that case.
94
 */
95
#define CH_CFG_TIME_QUANTUM                 0
96

    
97
/**
98
 * @brief   Managed RAM size.
99
 * @details Size of the RAM area to be managed by the OS. If set to zero
100
 *          then the whole available RAM is used. The core memory is made
101
 *          available to the heap allocator and/or can be used directly through
102
 *          the simplified core memory allocator.
103
 *
104
 * @note    In order to let the OS manage the whole RAM the linker script must
105
 *          provide the @p __heap_base__ and @p __heap_end__ symbols.
106
 * @note    Requires @p CH_CFG_USE_MEMCORE.
107
 */
108
#define CH_CFG_MEMCORE_SIZE                 0
109

    
110
/**
111
 * @brief   Idle thread automatic spawn suppression.
112
 * @details When this option is activated the function @p chSysInit()
113
 *          does not spawn the idle thread. The application @p main()
114
 *          function becomes the idle thread and must implement an
115
 *          infinite loop.
116
 */
117
#define CH_CFG_NO_IDLE_THREAD               FALSE
118

    
119
/** @} */
120

    
121
/*===========================================================================*/
122
/**
123
 * @name Performance options
124
 * @{
125
 */
126
/*===========================================================================*/
127

    
128
/**
129
 * @brief   OS optimization.
130
 * @details If enabled then time efficient rather than space efficient code
131
 *          is used when two possible implementations exist.
132
 *
133
 * @note    This is not related to the compiler optimization options.
134
 * @note    The default is @p TRUE.
135
 */
136
#define CH_CFG_OPTIMIZE_SPEED               TRUE
137

    
138
/** @} */
139

    
140
/*===========================================================================*/
141
/**
142
 * @name Subsystem options
143
 * @{
144
 */
145
/*===========================================================================*/
146

    
147
/**
148
 * @brief   Time Measurement APIs.
149
 * @details If enabled then the time measurement APIs are included in
150
 *          the kernel.
151
 *
152
 * @note    The default is @p TRUE.
153
 */
154
#define CH_CFG_USE_TM                       FALSE
155

    
156
/**
157
 * @brief   Threads registry APIs.
158
 * @details If enabled then the registry APIs are included in the kernel.
159
 *
160
 * @note    The default is @p TRUE.
161
 */
162
#define CH_CFG_USE_REGISTRY                 FALSE
163

    
164
/**
165
 * @brief   Threads synchronization APIs.
166
 * @details If enabled then the @p chThdWait() function is included in
167
 *          the kernel.
168
 *
169
 * @note    The default is @p TRUE.
170
 */
171
#define CH_CFG_USE_WAITEXIT                 TRUE
172

    
173
/**
174
 * @brief   Semaphores APIs.
175
 * @details If enabled then the Semaphores APIs are included in the kernel.
176
 *
177
 * @note    The default is @p TRUE.
178
 */
179
#define CH_CFG_USE_SEMAPHORES               FALSE
180

    
181
/**
182
 * @brief   Semaphores queuing mode.
183
 * @details If enabled then the threads are enqueued on semaphores by
184
 *          priority rather than in FIFO order.
185
 *
186
 * @note    The default is @p FALSE. Enable this if you have special
187
 *          requirements.
188
 * @note    Requires @p CH_CFG_USE_SEMAPHORES.
189
 */
190
#define CH_CFG_USE_SEMAPHORES_PRIORITY      FALSE
191

    
192
/**
193
 * @brief   Mutexes APIs.
194
 * @details If enabled then the mutexes APIs are included in the kernel.
195
 *
196
 * @note    The default is @p TRUE.
197
 */
198
#define CH_CFG_USE_MUTEXES                  TRUE
199

    
200
/**
201
 * @brief   Enables recursive behavior on mutexes.
202
 * @note    Recursive mutexes are heavier and have an increased
203
 *          memory footprint.
204
 *
205
 * @note    The default is @p FALSE.
206
 * @note    Requires @p CH_CFG_USE_MUTEXES.
207
 */
208
#define CH_CFG_USE_MUTEXES_RECURSIVE        FALSE
209

    
210
/**
211
 * @brief   Conditional Variables APIs.
212
 * @details If enabled then the conditional variables APIs are included
213
 *          in the kernel.
214
 *
215
 * @note    The default is @p TRUE.
216
 * @note    Requires @p CH_CFG_USE_MUTEXES.
217
 */
218
#define CH_CFG_USE_CONDVARS                 FALSE
219

    
220
/**
221
 * @brief   Conditional Variables APIs with timeout.
222
 * @details If enabled then the conditional variables APIs with timeout
223
 *          specification are included in the kernel.
224
 *
225
 * @note    The default is @p TRUE.
226
 * @note    Requires @p CH_CFG_USE_CONDVARS.
227
 */
228
#define CH_CFG_USE_CONDVARS_TIMEOUT         FALSE
229

    
230
/**
231
 * @brief   Events Flags APIs.
232
 * @details If enabled then the event flags APIs are included in the kernel.
233
 *
234
 * @note    The default is @p TRUE.
235
 */
236
#define CH_CFG_USE_EVENTS                   TRUE
237

    
238
/**
239
 * @brief   Events Flags APIs with timeout.
240
 * @details If enabled then the events APIs with timeout specification
241
 *          are included in the kernel.
242
 *
243
 * @note    The default is @p TRUE.
244
 * @note    Requires @p CH_CFG_USE_EVENTS.
245
 */
246
#define CH_CFG_USE_EVENTS_TIMEOUT           TRUE
247

    
248
/**
249
 * @brief   Synchronous Messages APIs.
250
 * @details If enabled then the synchronous messages APIs are included
251
 *          in the kernel.
252
 *
253
 * @note    The default is @p TRUE.
254
 */
255
#define CH_CFG_USE_MESSAGES                 FALSE
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
263
 *          requirements.
264
 * @note    Requires @p CH_CFG_USE_MESSAGES.
265
 */
266
#define CH_CFG_USE_MESSAGES_PRIORITY        FALSE
267

    
268
/**
269
 * @brief   Mailboxes APIs.
270
 * @details If enabled then the asynchronous messages (mailboxes) APIs are
271
 *          included in the kernel.
272
 *
273
 * @note    The default is @p TRUE.
274
 * @note    Requires @p CH_CFG_USE_SEMAPHORES.
275
 */
276
#define CH_CFG_USE_MAILBOXES                FALSE
277

    
278
/**
279
 * @brief   I/O Queues APIs.
280
 * @details If enabled then the I/O queues APIs are included in the kernel.
281
 *
282
 * @note    The default is @p TRUE.
283
 */
284
#define CH_CFG_USE_QUEUES                   FALSE
285

    
286
/**
287
 * @brief   Core Memory Manager APIs.
288
 * @details If enabled then the core memory manager APIs are included
289
 *          in the kernel.
290
 *
291
 * @note    The default is @p TRUE.
292
 */
293
#define CH_CFG_USE_MEMCORE                  FALSE
294

    
295
/**
296
 * @brief   Heap Allocator APIs.
297
 * @details If enabled then the memory heap allocator APIs are included
298
 *          in the kernel.
299
 *
300
 * @note    The default is @p TRUE.
301
 * @note    Requires @p CH_CFG_USE_MEMCORE and either @p CH_CFG_USE_MUTEXES or
302
 *          @p CH_CFG_USE_SEMAPHORES.
303
 * @note    Mutexes are recommended.
304
 */
305
#define CH_CFG_USE_HEAP                     FALSE
306

    
307
/**
308
 * @brief   Memory Pools Allocator APIs.
309
 * @details If enabled then the memory pools allocator APIs are included
310
 *          in the kernel.
311
 *
312
 * @note    The default is @p TRUE.
313
 */
314
#define CH_CFG_USE_MEMPOOLS                 FALSE
315

    
316
/**
317
 * @brief   Dynamic Threads APIs.
318
 * @details If enabled then the dynamic threads creation APIs are included
319
 *          in the kernel.
320
 *
321
 * @note    The default is @p TRUE.
322
 * @note    Requires @p CH_CFG_USE_WAITEXIT.
323
 * @note    Requires @p CH_CFG_USE_HEAP and/or @p CH_CFG_USE_MEMPOOLS.
324
 */
325
#define CH_CFG_USE_DYNAMIC                  FALSE
326

    
327
/** @} */
328

    
329
/*===========================================================================*/
330
/**
331
 * @name Debug options
332
 * @{
333
 */
334
/*===========================================================================*/
335

    
336
/**
337
 * @brief   Debug option, kernel statistics.
338
 *
339
 * @note    The default is @p FALSE.
340
 */
341
#define CH_DBG_STATISTICS                   FALSE
342

    
343
/**
344
 * @brief   Debug option, system state check.
345
 * @details If enabled the correct call protocol for system APIs is checked
346
 *          at runtime.
347
 *
348
 * @note    The default is @p FALSE.
349
 */
350
#if (AMIROOS_CFG_DBG == true) || defined(__DOXYGEN__)
351
#define CH_DBG_SYSTEM_STATE_CHECK           TRUE
352
#else
353
#define CH_DBG_SYSTEM_STATE_CHECK           FALSE
354
#endif
355

    
356
/**
357
 * @brief   Debug option, parameters checks.
358
 * @details If enabled then the checks on the API functions input
359
 *          parameters are activated.
360
 *
361
 * @note    The default is @p FALSE.
362
 */
363
#if (AMIROOS_CFG_DBG == true) || defined(__DOXYGEN__)
364
#define CH_DBG_ENABLE_CHECKS                TRUE
365
#else
366
#define CH_DBG_ENABLE_CHECKS                FALSE
367
#endif
368

    
369
/**
370
 * @brief   Debug option, consistency checks.
371
 * @details If enabled then all the assertions in the kernel code are
372
 *          activated. This includes consistency checks inside the kernel,
373
 *          runtime anomalies and port-defined checks.
374
 *
375
 * @note    The default is @p FALSE.
376
 */
377
#if (AMIROOS_CFG_DBG == true) || defined(__DOXYGEN__)
378
#define CH_DBG_ENABLE_ASSERTS               TRUE
379
#else
380
#define CH_DBG_ENABLE_ASSERTS               FALSE
381
#endif
382

    
383
/**
384
 * @brief   Debug option, trace buffer.
385
 * @details If enabled then the trace buffer is activated.
386
 *
387
 * @note    The default is @p CH_DBG_TRACE_MASK_DISABLED.
388
 */
389
#define CH_DBG_TRACE_MASK                   CH_DBG_TRACE_MASK_DISABLED
390

    
391
/**
392
 * @brief   Trace buffer entries.
393
 * @note    The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is
394
 *          different from @p CH_DBG_TRACE_MASK_DISABLED.
395
 */
396
#define CH_DBG_TRACE_BUFFER_SIZE            128
397

    
398
/**
399
 * @brief   Debug option, stack checks.
400
 * @details If enabled then a runtime stack check is performed.
401
 *
402
 * @note    The default is @p FALSE.
403
 * @note    The stack check is performed in a architecture/port dependent way.
404
 *          It may not be implemented or some ports.
405
 * @note    The default failure mode is to halt the system with the global
406
 *          @p panic_msg variable set to @p NULL.
407
 */
408
#if (AMIROOS_CFG_DBG == true) || defined(__DOXYGEN__)
409
#define CH_DBG_ENABLE_STACK_CHECK           TRUE
410
#else
411
#define CH_DBG_ENABLE_STACK_CHECK           FALSE
412
#endif
413

    
414
/**
415
 * @brief   Debug option, stacks initialization.
416
 * @details If enabled then the threads working area is filled with a byte
417
 *          value when a thread is created. This can be useful for the
418
 *          runtime measurement of the used stack.
419
 *
420
 * @note    The default is @p FALSE.
421
 */
422
#if (AMIROOS_CFG_PROFILE == true) || defined(__DOXYGEN__)
423
#define CH_DBG_FILL_THREADS                 TRUE
424
#else
425
#define CH_DBG_FILL_THREADS                 FALSE
426
#endif
427

    
428
/**
429
 * @brief   Debug option, threads profiling.
430
 * @details If enabled then a field is added to the @p thread_t structure that
431
 *          counts the system ticks occurred while executing the thread.
432
 *
433
 * @note    The default is @p FALSE.
434
 * @note    This debug option is not currently compatible with the
435
 *          tickless mode.
436
 */
437
#if ((CH_CFG_ST_TIMEDELTA == 0) && (AMIROOS_CFG_PROFILE == true)) || defined(__DOXYGEN__)
438
  #define CH_DBG_THREADS_PROFILING          TRUE
439
#else
440
  #define CH_DBG_THREADS_PROFILING          FALSE
441
#endif
442

    
443
/** @} */
444

    
445
/*===========================================================================*/
446
/**
447
 * @name Kernel hooks
448
 * @{
449
 */
450
/*===========================================================================*/
451

    
452
/**
453
 * @brief   Threads descriptor structure extension.
454
 * @details User fields added to the end of the @p thread_t structure.
455
 */
456
#define CH_CFG_THREAD_EXTRA_FIELDS                                          \
457
  /* Add threads custom fields here.*/
458

    
459
/**
460
 * @brief   Threads initialization hook.
461
 * @details User initialization code added to the @p chThdInit() API.
462
 *
463
 * @note    It is invoked from within @p chThdInit() and implicitly from all
464
 *          the threads creation APIs.
465
 */
466
#define CH_CFG_THREAD_INIT_HOOK(tp) {                                       \
467
  /* Add threads initialization code here.*/                                \
468
}
469

    
470
/**
471
 * @brief   Threads finalization hook.
472
 * @details User finalization code added to the @p chThdExit() API.
473
 *
474
 * @note    It is inserted into lock zone.
475
 * @note    It is also invoked when the threads simply return in order to
476
 *          terminate.
477
 */
478
#define CH_CFG_THREAD_EXIT_HOOK(tp) {                                       \
479
  /* Add threads finalization code here.*/                                  \
480
}
481

    
482
/**
483
 * @brief   Context switch hook.
484
 * @details This hook is invoked just before switching between threads.
485
 */
486
#define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) {                              \
487
  /* Context switch code here.*/                                            \
488
}
489

    
490
/**
491
 * @brief   ISR enter hook.
492
 */
493
#define CH_CFG_IRQ_PROLOGUE_HOOK() {                                        \
494
  /* IRQ prologue code here.*/                                              \
495
}
496

    
497
/**
498
 * @brief   ISR exit hook.
499
 */
500
#define CH_CFG_IRQ_EPILOGUE_HOOK() {                                        \
501
  /* IRQ epilogue code here.*/                                              \
502
}
503

    
504
/**
505
 * @brief   Idle thread enter hook.
506
 * @note    This hook is invoked within a critical zone, no OS functions
507
 *          should be invoked from here.
508
 * @note    This macro can be used to activate a power saving mode.
509
 */
510
#define CH_CFG_IDLE_ENTER_HOOK() {                                          \
511
  /* Idle-enter code here.*/                                                \
512
}
513

    
514
/**
515
 * @brief   Idle thread leave hook.
516
 * @note    This hook is invoked within a critical zone, no OS functions
517
 *          should be invoked from here.
518
 * @note    This macro can be used to deactivate a power saving mode.
519
 */
520
#define CH_CFG_IDLE_LEAVE_HOOK() {                                          \
521
  /* Idle-leave code here.*/                                                \
522
}
523

    
524
/**
525
 * @brief   Idle Loop hook.
526
 * @details This hook is continuously invoked by the idle thread loop.
527
 */
528
#define CH_CFG_IDLE_LOOP_HOOK() {                                           \
529
  /* Idle loop code here.*/                                                 \
530
}
531

    
532
/**
533
 * @brief   System tick event hook.
534
 * @details This hook is invoked in the system tick handler immediately
535
 *          after processing the virtual timers queue.
536
 */
537
#define CH_CFG_SYSTEM_TICK_HOOK() {                                         \
538
  /* System tick event code here.*/                                         \
539
}
540

    
541
/**
542
 * @brief   System halt hook.
543
 * @details This hook is invoked in case to a system halting error before
544
 *          the system is halted.
545
 */
546
#define CH_CFG_SYSTEM_HALT_HOOK(reason) {                                   \
547
  extern void aosPrintHaltErrorCode(const char* reason);                       \
548
  aosPrintHaltErrorCode(reason);                                               \
549
}
550

    
551
/**
552
 * @brief   Trace hook.
553
 * @details This hook is invoked each time a new record is written in the
554
 *          trace buffer.
555
 */
556
#define CH_CFG_TRACE_HOOK(tep) {                                            \
557
  /* Trace code here.*/                                                     \
558
}
559

    
560
/** @} */
561

    
562
/*===========================================================================*/
563
/**
564
 * @name Port specific settings
565
 * @{
566
 */
567
/*===========================================================================*/
568

    
569
/**
570
 * @brief   NVIC VTOR initialization offset.
571
 * @details On initialization, the code at this address in the flash memory will be executed.
572
 */
573
#define CORTEX_VTOR_INIT 0x00006000U
574

    
575
/** @} */
576

    
577
/*===========================================================================*/
578
/**
579
 * @name other
580
 * @{
581
 */
582
/*===========================================================================*/
583

    
584
/**
585
 * @brief   Flag to enable/disable floating point support in chprinf()
586
 */
587
#define CHPRINTF_USE_FLOAT                  TRUE
588

    
589
/** @} */
590

    
591
#endif  /* _CHCONF_H_ */
592

    
593
/** @} */