Function QTMC_WaitAndCheckExpanderWorking

Source
pub unsafe extern "C" fn QTMC_WaitAndCheckExpanderWorking(
    outWorking: *mut bool,
) -> Result
Expand description

Waits for the expander management thread to (re)initalize the TI TCA6416A I2C->Parallel expander, then checks if that expander is behaving as expected (responds with the port direction config it has been configured with): it checks whether all ports have been configured as outputs.

On N2DSXL, this function waits forever and never returns.

In detail, the hardware init procedure for the expander is as follows (as done by the expander mgmt. thread):

  • configure enable expander pin on SoC: set GPIO3.bit11 to OUTPUT, then set to 1
  • on the expander (I2C1 deviceId 0x40), set all ports to OUTPUT (regId 0x06, 0x07)
  • on the expander, write 0 (all-transparent mask/2D) to the data registers (regId 0x02, 0x03)

§Arguments

  • outWorking (direction out) - Where to write the working status to. If true, expander is present working. If false, the expander is present but is misbehaving. If the function does not return, then expander is missing (e.g. on N2DSXL).

§Returns

0xD82183F8 if API not started, otherwise 0 (success).