rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
efifeatures.h
Go to the documentation of this file.
1/**
2 * @file efifeatures.h
3 *
4 * @brief In this header we can configure which firmware modules are used.
5 *
6 * @date Jan 27, 2020
7 * @author Andrey Belomutskiy, (c) 2012-2020
8 * @author andreika <prometheus.pcb@gmail.com>
9 */
10
11#pragma once
12
13#define EFI_GPIO_HARDWARE TRUE
14
15#define EFI_CDM_INTEGRATION FALSE
16
17#define EFI_TOOTH_LOGGER FALSE
18
19#define EFI_PWM_TESTER FALSE
20
21/**
22 * if you have a 60-2 trigger, or if you just want better performance, you
23 * probably want EFI_ENABLE_ASSERTS to be FALSE. Also you would probably want to FALSE
24 * CH_DBG_ENABLE_CHECKS
25 * CH_DBG_ENABLE_ASSERTS
26 * in chconf.h
27 *
28 */
29#if !defined(EFI_ENABLE_ASSERTS) || defined(__DOXYGEN__)
30 #define EFI_ENABLE_ASSERTS FALSE
31#endif /* EFI_ENABLE_ASSERTS */
32
33#define EFI_TEXT_LOGGING TRUE
34
35//#define EFI_UART_ECHO_TEST_MODE FALSE
36
37/**
38 * Build-in logic analyzer support. Logic analyzer viewer is one of the java console panes.
39 */
40#ifndef EFI_LOGIC_ANALYZER
41#define EFI_LOGIC_ANALYZER FALSE
42#endif
43
44#ifndef EFI_ICU_INPUTS
45#define EFI_ICU_INPUTS FALSE
46#endif
47
48/**
49 * TunerStudio support.
50 */
51#define EFI_TUNER_STUDIO TRUE
52
53/**
54 * Bluetooth UART setup support.
55 */
56#define EFI_BLUETOOTH_SETUP FALSE
57
58/**
59 * TunerStudio debug output
60 */
61#define EFI_TUNER_STUDIO_VERBOSE FALSE
62
63#define EFI_DETAILED_LOGGING FALSE
64
65/**
66 * Dev console support.
67 */
68#define EFI_CLI_SUPPORT FALSE
69
70#define EFI_RTC FALSE
71
72#define EFI_ALTERNATOR_CONTROL FALSE
73
74#define EFI_VVT_PID FALSE
75
76#define EFI_SIGNAL_EXECUTOR_SLEEP FALSE
77#define EFI_SIGNAL_EXECUTOR_ONE_TIMER TRUE
78
79#define FUEL_MATH_EXTREME_LOGGING FALSE
80
81#define SPARK_EXTREME_LOGGING FALSE
82
83#define TRIGGER_EXTREME_LOGGING FALSE
84
85#define EFI_STORAGE_INT_FLASH TRUE
86
87/**
88 * Flex Non Volatile Memory is faster than flash
89 * It also has smaller pages so it takes less time to erase
90 *
91 * There is no remote access to FlexNVM meaning that we cannot erase settings externally
92 */
93
94// Dual-Flash version:
95//#define FLASH_ADDR 0x200F8000
96// todo: find other location for 1Mb Flash chip versions?
97//#define FLASH_ADDR_SECOND_COPY 0x20100000
98
99// Main-Flash version:
100#define FLASH_ADDR 0x000E0000
101#define FLASH_ADDR_SECOND_COPY 0x000C0000
102
103#define BACKUP_FLASH_ADDR 0x00406000
104#define BACKUP_FLASH_SIZE 0x2000 // 8k
105
106/**
107 * Usually you need shaft position input, but maybe you do not need it?
108 */
109#ifndef EFI_SHAFT_POSITION_INPUT
110#define EFI_SHAFT_POSITION_INPUT TRUE
111#endif
112
113/**
114 * Maybe we are just sniffing what's going on?
115 */
116#define EFI_ENGINE_CONTROL TRUE
117
118#define EFI_SPEED_DENSITY TRUE
119
120/**
121 * MCP42010 digital potentiometer support. This could be useful if you are stimulating some
122 * stock ECU
123 */
124//#define EFI_POTENTIOMETER FALSE
125#define EFI_POTENTIOMETER FALSE
126
127#define EFI_ANALOG_SENSORS TRUE
128
129#ifndef EFI_MAX_31855
130#define EFI_MAX_31855 FALSE
131#endif
132
133#define EFI_MCP_3208 FALSE
134
135#if !defined(EFI_ONBOARD_MEMS) || defined(__DOXYGEN__)
136 #define EFI_ONBOARD_MEMS FALSE
137#endif
138
139#define EFI_INTERNAL_ADC TRUE
140#define EFI_USE_FAST_ADC TRUE
141
142#define EFI_NARROW_EGO_AVERAGING FALSE
143
144#ifndef EFI_CAN_SUPPORT
145#define EFI_CAN_SUPPORT FALSE
146#endif
147
148#define EFI_IDLE_CONTROL TRUE
149
150#define EFI_IDLE_PID_CIC FALSE
151
152/**
153 * Control the main power relay based on measured ignition voltage (Vbatt)
154 */
155#define EFI_MAIN_RELAY_CONTROL TRUE
156
157#define EFI_VEHICLE_SPEED FALSE
158
159#define EFI_TCU FALSE
160
161#define EFI_ENGINE_EMULATOR TRUE
162
163#define EFI_EMULATE_POSITION_SENSORS TRUE
164
165/**
166 * Do we need file logging (like SD card) logic?
167 */
168#ifndef EFI_FILE_LOGGING
169#define EFI_FILE_LOGGING FALSE
170#endif
171
172#define EFI_ENGINE_SNIFFER TRUE
173
174#define EFI_HISTOGRAMS FALSE
175
176#define EFI_PERF_METRICS FALSE
177
178/**
179 * Do we need GPS logic?
180 */
181#define EFI_UART_GPS FALSE
182
183#define EFI_ELECTRONIC_THROTTLE_BODY FALSE
184//#define EFI_ELECTRONIC_THROTTLE_BODY FALSE
185
186#define EFI_HAS_RESET FALSE
187
188/**
189 * Do we need Malfunction Indicator blinking logic?
190 */
191#define EFI_MALFUNCTION_INDICATOR FALSE
192//#define EFI_MALFUNCTION_INDICATOR FALSE
193
194#define CONSOLE_MAX_ACTIONS 180
195//#define EFI_DISABLE_CONSOLE_ACTIONS TRUE
196
197#define EFI_MAP_AVERAGING TRUE
198
199#define EFI_INTERNAL_FAST_ADC_GPT &GPTD2
200#define ADC_MAX_CHANNELS_COUNT 32
201#define SLOW_ADC_CHANNEL_COUNT 32
202
203#define EFI_FASTER_UNIFORM_ADC TRUE
204#define ADC_BUF_NUM_AVG 4
205#define ADC_BUF_DEPTH_FAST 1
206
207//ADC freq = ~40kHz
208#define GPT_FREQ_FAST 400000 /* PWM clock frequency. */
209#define GPT_PERIOD_FAST 10 /* PWM period (in PWM ticks). */
210
211#define EFI_SPI1_AF PAL_MODE_ALTERNATIVE_SPI
212
213#define EFI_SPI2_AF PAL_MODE_ALTERNATIVE_SPI
214
215/**
216 * This section is for right-side center SPI
217 */
218
219#define EFI_SPI3_AF PAL_MODE_ALTERNATIVE_SPI
220
221/**
222 * Patched version of ChibiOS/RT support extra details in the system error messages
223 */
224#define EFI_CUSTOM_PANIC_METHOD FALSE
225
226#define ADC_CHANNEL_VREF ADC_CHANNEL_IN14
227
228/**
229 * Use 'HAL_USE_UART' DMA-mode driver instead of 'HAL_USE_SERIAL'
230 *
231 * See also
232 * STM32_SERIAL_USE_USARTx
233 * STM32_UART_USE_USARTx
234 * in mcuconf.h
235 */
236#define EFI_USE_UART_DMA FALSE
237
238// todo: add CAN support
239//#define TS_CAN_DEVICE CAND1
240#define TS_CAN_AF PAL_MODE_ALTERNATIVE_CAN
241#define TS_CAN_DEVICE_SHORT_PACKETS_IN_ONE_FRAME
242
243#define EFI_USB_SERIAL TRUE
244#define EFI_CONSOLE_USB_DEVICE SDU1
245// Cypress uses a fake USB device that's just a plain channel
246#define SerialUSBDriver BaseChannel
247
248#define EFI_CONSOLE_AF 3
249
250#define TS_SERIAL_AF 2
251
252#undef SERIAL_SPEED
253#define SERIAL_SPEED 115200
254
255//#define SR5_WRITE_TIMEOUT TIME_MS2I(3000)
256//#define SR5_READ_TIMEOUT TIME_MS2I(3000)
257
258#define HAL_TRIGGER_USE_PAL FALSE
259#define HAL_TRIGGER_USE_ADC TRUE
260
261//#define EFI_COMP_PRIMARY_DEVICE (&COMPD3)
262//#define EFI_COMP_TRIGGER_CHANNEL 6 // =E7
263//#define EFI_TRIGGER_DEBUG_BLINK TRUE
264//#define EFI_TRIGGER_COMP_ADAPTIVE_HYSTERESIS TRUE
265
266// LED1 = GPIOJ_15
267// LED2 = GPIOJ_0
268// LED3 = GPIOJ_12
269// LED4 = Gpio::A0
270
271#define LED_WARNING_BRAIN_PIN Gpio::A0
272
273#define LED_CRITICAL_ERROR_BRAIN_PIN Gpio::J15
274#define LED_ERROR_BRAIN_PIN_MODE INVERTED_OUTPUT
275
276#define EFI_WARNING_LED FALSE
277
278/**
279 * This is the size of the MemoryStream used by chvprintf
280 */
281#define DL_OUTPUT_BUFFER 6500
282
283//#define UTILITY_THREAD_STACK_SIZE 270 /*400*/
284
285//#define CONSOLE_THREAD_STACK_SIZE UTILITY_THREAD_STACK_SIZE
286
287#define BOARD_TLE6240_COUNT 0
288#define BOARD_MC33972_COUNT 0
289#define BOARD_TLE8888_COUNT 0
290#define BOARD_DRV8860_COUNT 1
291#define BOARD_MC33810_COUNT 0
292#define BOARD_L9779_COUNT 0
293#define BOARD_TLE9104_COUNT 0
294
295#define DRV8860_SS_PORT GPIOH
296#define DRV8860_SS_PAD 11U
297#define DRV8860_RESET_PORT NULL
298#define DRV8860_RESET_PAD 0
299#define DRV8860_DIRECT_IO \
300 /* IN1..4 grounded */ \
301 [0] = {.port = NULL, .pad = 0}, \
302 [1] = {.port = NULL, .pad = 0}, \
303 [2] = {.port = NULL, .pad = 0}, \
304 [3] = {.port = NULL, .pad = 0}, \
305 /* IN9..12 */ \
306 [4] = {.port = NULL, .pad = 0}, \
307 [5] = {.port = NULL, .pad = 0}, \
308 [6] = {.port = NULL, .pad = 0}, \
309 [7] = {.port = NULL, .pad = 0},
310
311#define EFI_BOSCH_YAW FALSE
312
313#define EFI_BOARD_TEST FALSE
314#define EFI_JOYSTICK FALSE
315#define EFI_ENGINE_AUDI_AAN FALSE
316#define EFI_ENGINE_SNOW_BLOWER FALSE
317#define DEBUG_FUEL FALSE
318#define EFI_UART_ECHO_TEST_MODE FALSE
319#define EXTREME_TERM_LOGGING FALSE
320#define EFI_PRINTF_FUEL_DETAILS FALSE
321#define ENABLE_PERF_TRACE FALSE
322
323#define EFI_BACKUP_SRAM FALSE
324
325//!!!!!!!!!!!!!!!!!!!!!!
326#define debugLog(fmt,...) { \
327 extern int __debugEnabled; \
328 if (__debugEnabled) { \
329 extern SerialUSBDriver EFI_CONSOLE_USB_DEVICE; \
330 extern char __debugBuffer[200]; \
331 chsnprintf(__debugBuffer, sizeof(__debugBuffer), fmt, ##__VA_ARGS__); \
332 chnWriteTimeout(&EFI_CONSOLE_USB_DEVICE, (const uint8_t *)__debugBuffer, strlen(__debugBuffer), TIME_MS2I(1000)); \
333 chThdSleepMilliseconds(20); \
334 } \
335}