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