24#if (BOARD_TLE6240_COUNT > 0)
26#ifndef TLE6240_RESET_PORT
27#define TLE6240_RESET_PORT GPIOG
29#ifndef TLE6240_RESET_PAD
30#define TLE6240_RESET_PAD 3U
32#ifndef TLE6240_DIRECT_IO
33#define TLE6240_DIRECT_IO \
35 [0] = {.port = GPIOG, .pad = 2}, \
37 [1] = {.port = NULL, .pad = 0}, \
38 [2] = {.port = NULL, .pad = 0}, \
39 [3] = {.port = NULL, .pad = 0}, \
41 [4] = {.port = GPIOD, .pad = 15}, \
43 [5] = {.port = GPIOD, .pad = 14}, \
45 [6] = {.port = GPIOC, .pad = 6}, \
47 [7] = {.port = GPIOC, .pad = 7},
55#ifdef _CHIBIOS_RT_CONF_VER_6_1_
69 ((3 << SPI_CR1_BR_Pos) & SPI_CR1_BR) |
74 .cr2 = SPI_CR2_16BIT_MODE
79 .reset = {.port = TLE6240_RESET_PORT, .pad = TLE6240_RESET_PAD}
83#if (BOARD_MC33972_COUNT > 0)
89#ifdef _CHIBIOS_RT_CONF_VER_6_1_
103 ((3 << SPI_CR1_BR_Pos) & SPI_CR1_BR) |
108 .cr2 = SPI_CR2_8BIT_MODE
113#if (BOARD_L9779_COUNT > 0)
119#ifdef _CHIBIOS_RT_CONF_VER_6_1_
133 ((3 << SPI_CR1_BR_Pos) & SPI_CR1_BR) |
137 .cr2 = SPI_CR2_16BIT_MODE
141 [0] = {.port = NULL, .pad = 0},
142 [1] = {.port = NULL, .pad = 0},
143 [2] = {.port = NULL, .pad = 0},
144 [3] = {.port = NULL, .pad = 0},
146 [4] = {.port = NULL, .pad = 0},
147 [5] = {.port = NULL, .pad = 0},
148 [6] = {.port = NULL, .pad = 0},
149 [7] = {.port = NULL, .pad = 0},
150 [8] = {.port = NULL, .pad = 0},
151 [9] = {.port = NULL, .pad = 0},
152 [10] = {.port = NULL, .pad = 0},
155 .pwm_gpio = {.port = NULL, .pad = 0},
159#if (BOARD_TLE8888_COUNT > 0)
165#ifdef _CHIBIOS_RT_CONF_VER_6_1_
179 ((3 << SPI_CR1_BR_Pos) & SPI_CR1_BR) |
183 .cr2 = SPI_CR2_16BIT_MODE
185 .reset = {.port = NULL, .pad = 0},
188 [0] = {.port = GPIOE, .pad = 14},
189 [1] = {.port = GPIOE, .pad = 13},
190 [2] = {.port = GPIOE, .pad = 12},
191 [3] = {.port = GPIOE, .pad = 11},
194 [4] = {.port = NULL, .pad = 0},
195 [5] = {.port = NULL, .pad = 0},
196 [6] = {.port = NULL, .pad = 0},
197 [7] = {.port = NULL, .pad = 0},
199 [8] = {.port = GPIOE, .pad = 10},
200 [9] = {.port = GPIOE, .pad = 9},
201 [10] = {.port = GPIOE, .pad = 8},
202 [11] = {.port = GPIOE, .pad = 7},
207 [2] = {.output = 21},
208 [3] = {.output = 22},
210 .ign_en = {.port = GPIOD, .pad = 10},
211 .inj_en = {.port = GPIOD, .pad = 11},
217#if (BOARD_MC33810_COUNT > 0)
221#if (BOARD_DRV8860_COUNT > 0)
227#ifdef _CHIBIOS_RT_CONF_VER_6_1_
240 ((7 << SPI_CR1_BR_Pos) & SPI_CR1_BR) |
244 .cr2 = SPI_CR2_16BIT_MODE
246 .reset = {.port = DRV8860_RESET_PORT, .pad = DRV8860_RESET_PAD}
255#if (BOARD_TLE6240_COUNT > 0)
266#if (BOARD_MC33972_COUNT > 0)
279#if (BOARD_L9779_COUNT > 0)
292#if (BOARD_TLE8888_COUNT > 0)
309#if EFI_PROD_CODE && (BOARD_DRV8860_COUNT > 0)
324#if (BOARD_MC33810_COUNT > 0)
328#if (BOARD_TLE9104_COUNT > 0)
339#if EFI_PROD_CODE && (BOARD_TLE8888_COUNT > 0)
341 static efitick_t tle8888CrankingResetTime = 0;
345 if (nowNt - tle8888CrankingResetTime > MS2NT(300)) {
349 tle8888CrankingResetTime = nowNt;
357#if (BOARD_TLE8888_COUNT > 0)
360#if (BOARD_TLE6240_COUNT > 0)
363#if (BOARD_MC33972_COUNT > 0)
366#if (BOARD_DRV8860_COUNT > 0)
369#if (BOARD_MC33810_COUNT > 0)
370 for (
size_t i = 0;i<C_MC33810_COUNT;i++) {
374#if (BOARD_TLE9104_COUNT > 0)
382#if (BOARD_TLE8888_COUNT > 0)
387#if (BOARD_TLE6240_COUNT > 0)
393#if (BOARD_MC33972_COUNT > 0)
399#if (BOARD_DRV8860_COUNT > 0)
405#if (BOARD_MC33810_COUNT > 0)
406 for (
size_t i = 0;i<C_MC33810_COUNT;i++) {
413#if (BOARD_TLE9104_COUNT > 0)
416#if (BOARD_L9779_COUNT > 0)
void initCanGpioMsiobox()
RpmCalculator rpmCalculator
Single output pin reference and state.
void initPin(const char *msg, brain_pin_e brainPin, pin_output_mode_e outputMode, bool forceInitWithFatalError=false)
void setValue(const char *msg, int logicValue, bool isForce=false)
bool isCranking() const override
int gpiochips_init(void)
Init all registered gpiochips.
int drv8860_add(brain_pin_e base, unsigned int index, const drv8860_config *cfg)
DRV8860 driver add.
ioportid_t getHwPort(const char *msg, brain_pin_e brainPin)
ioportmask_t getHwPin(const char *msg, brain_pin_e brainPin)
static EngineAccessor engine
engine_configuration_s & activeConfiguration
static constexpr engine_configuration_s * engineConfiguration
SPIDriver * getSpiDevice(spi_device_e spiDevice)
void efiSetPadUnused(brain_pin_e brainPin)
int l9779_add(brain_pin_e base, unsigned int index, const l9779_config *cfg)
L9779 driver add.
int mc33972_add(brain_pin_e base, unsigned int index, const struct mc33972_config *cfg)
MC33972 driver add.
bool isBrainPinValid(brain_pin_e brainPin)
static OutputPin mc33972Cs
struct drv8860_config drv8860
struct tle6240_config tle6240
struct tle8888_config tle8888_cfg
static OutputPin tle8888Cs
static OutputPin mc33810Cs[C_MC33810_COUNT]
struct mc33972_config mc33972
static OutputPin drv8860Cs
static OutputPin tle6240Cs
struct l9779_config l9779_cfg
Gpio mc33810_cs[C_MC33810_COUNT]
pin_output_mode_e mc33810_csPinMode
pin_output_mode_e mc33972_csPinMode
pin_output_mode_e tle6240_csPinMode
pin_output_mode_e drv8860_csPinMode
bool useTLE8888_cranking_hack
spi_device_e tle6240spiDevice
spi_device_e l9779spiDevice
spi_device_e drv8860spiDevice
spi_device_e mc33972spiDevice
spi_device_e tle8888spiDevice
pin_output_mode_e tle8888_csPinMode
tle8888_mode_e tle8888mode
int tle6240_add(brain_pin_e base, unsigned int index, const tle6240_config *cfg)
TLE6240 driver add.
int tle8888_add(brain_pin_e base, unsigned int index, const tle8888_config *cfg)
TLE8888 driver add.