rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
Data Structures | Functions
mc33810.h File Reference

Data Structures

struct  mc33810_config
 

Functions

int mc33810_add (brain_pin_e base, unsigned int index, const mc33810_config *cfg)
 MC33810 driver add.
 
const mc33810_state_smc33810getLiveData (size_t idx)
 
void mc33810_req_init ()
 
int getMc33810maxDwellTimer (mc33810maxDwellTimer_e value)
 

Function Documentation

◆ getMc33810maxDwellTimer()

int getMc33810maxDwellTimer ( mc33810maxDwellTimer_e  value)

Definition at line 1009 of file mc33810.cpp.

1009 {
1010switch(value) {
1011case DWELL_16MS:
1012 return 16;
1013case DWELL_2MS:
1014 return 2;
1015case DWELL_32MS:
1016 return 32;
1017case DWELL_4MS:
1018 return 4;
1019case DWELL_64MS:
1020 return 64;
1021case DWELL_8MS:
1022 return 8;
1023 }
1024 return 0;
1025}

Referenced by validateConfigOnStartUpOrBurn().

Here is the caller graph for this function:

◆ mc33810_add()

int mc33810_add ( brain_pin_e  base,
unsigned int  index,
const mc33810_config cfg 
)

MC33810 driver add.

Checks for valid config

Definition at line 949 of file mc33810.cpp.

949 {
950
951 /* no config or no such chip */
952 if ((!cfg) || (!cfg->spi_bus) || (index >= BOARD_MC33810_COUNT))
953 return -16;
954
955 /* check for valid cs.
956 * TODO: remove this check? CS can be driven by SPI */
957 //if (cfg->spi_config.ssport == NULL)
958 // return -1;
959
960 Mc33810& chip = chips[index];
961
962 /* already initted? */
963 if (chip.cfg != NULL)
964 return -13;
965
966 chip.cfg = cfg;
967 chip.o_state = 0;
968 chip.o_state_cached = 0;
969 chip.o_direct_mask = 0;
970 for (int i = 0; i < MC33810_DIRECT_OUTPUTS; i++) {
971 if (cfg->direct_io[i].port != 0)
972 chip.o_direct_mask |= BIT(i);
973 }
974
975#if 0
976 // Some Ignition channels may be unused, so skip this check for now
977 /* GPGD mode is not supported yet, ignition mode does not support spi on/off commands
978 * so ignition signals should be directly driven */
979 if ((chip.o_direct_mask & 0xf0) != 0xf0)
980 return -4;
981#endif
982
983 /* register, return gpio chip base */
984 int ret = gpiochip_register(base, DRIVER_NAME, chip, MC33810_OUTPUTS);
985 if (ret < 0)
986 return ret;
987
988 /* set default pin names, board init code can rewrite */
990
991 chip.drv_state = MC33810_WAIT_INIT;
992
993 return ret;
994}
int gpiochip_register(brain_pin_e base, const char *name, GpioChip &gpioChip, size_t size)
Register gpiochip.
Definition core.cpp:186
int gpiochips_setPinNames(brain_pin_e base, const char **names)
Set pins names for registered gpiochip.
Definition core.cpp:266
static Mc33810 chips[BOARD_MC33810_COUNT]
Definition mc33810.cpp:203
static const char * mc33810_pin_names[MC33810_OUTPUTS]
Definition mc33810.cpp:205
@ MC33810_WAIT_INIT
Definition mc33810.cpp:46
ioportid_t port
Definition mc33810.h:35
struct mc33810_config::@36 direct_io[MC33810_DIRECT_OUTPUTS]
SPIDriver * spi_bus
Definition mc33810.h:30

Referenced by board_init_ext_gpios(), f407_discovery_boardInitHardware(), and hellen154hyundai_f7_boardInitHardware().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mc33810_req_init()

void mc33810_req_init ( )

Definition at line 999 of file mc33810.cpp.

999 {
1000 size_t i;
1001
1002 for (i = 0; i < BOARD_MC33810_COUNT; i++) {
1003 auto& chip = chips[i];
1004
1005 chip.need_init = true;
1006 }
1007}

Referenced by handleCommandX14().

Here is the caller graph for this function:

◆ mc33810getLiveData()

const mc33810_state_s * mc33810getLiveData ( size_t  idx)

Definition at line 1027 of file mc33810.cpp.

1027 {
1028 if (idx >= BOARD_MC33810_COUNT)
1029 return nullptr;
1030 return &chips[idx];
1031}

Referenced by getLiveData().

Here is the caller graph for this function:

Go to the source code of this file.