/* * write8_reg * Send byte to the TIS register according to the ST33ZP24 I2C protocol. * @param: tpm_register, the tpm tis register where the data should be written * @param: tpm_data, the tpm_data to write inside the tpm_register * @param: tpm_size, The length of the data * @return: Returns negative errno, or else the number of bytes written.
*/ staticint write8_reg(void *phy_id, u8 tpm_register, u8 *tpm_data, int tpm_size)
{ struct st33zp24_i2c_phy *phy = phy_id;
/* * read8_reg * Recv byte from the TIS register according to the ST33ZP24 I2C protocol. * @param: tpm_register, the tpm tis register where the data should be read * @param: tpm_data, the TPM response * @param: tpm_size, tpm TPM response size to read. * @return: number of byte read successfully: should be one if success.
*/ staticint read8_reg(void *phy_id, u8 tpm_register, u8 *tpm_data, int tpm_size)
{ struct st33zp24_i2c_phy *phy = phy_id;
u8 status = 0;
u8 data;
data = TPM_DUMMY_BYTE;
status = write8_reg(phy, tpm_register, &data, 1); if (status == 2)
status = i2c_master_recv(phy->client, tpm_data, tpm_size); return status;
} /* read8_reg() */
/* * st33zp24_i2c_send * Send byte to the TIS register according to the ST33ZP24 I2C protocol. * @param: phy_id, the phy description * @param: tpm_register, the tpm tis register where the data should be written * @param: tpm_data, the tpm_data to write inside the tpm_register * @param: tpm_size, the length of the data * @return: number of byte written successfully: should be one if success.
*/ staticint st33zp24_i2c_send(void *phy_id, u8 tpm_register, u8 *tpm_data, int tpm_size)
{ return write8_reg(phy_id, tpm_register | TPM_WRITE_DIRECTION, tpm_data,
tpm_size);
}
/* * st33zp24_i2c_recv * Recv byte from the TIS register according to the ST33ZP24 I2C protocol. * @param: phy_id, the phy description * @param: tpm_register, the tpm tis register where the data should be read * @param: tpm_data, the TPM response * @param: tpm_size, tpm TPM response size to read. * @return: number of byte read successfully: should be one if success.
*/ staticint st33zp24_i2c_recv(void *phy_id, u8 tpm_register, u8 *tpm_data, int tpm_size)
{ return read8_reg(phy_id, tpm_register, tpm_data, tpm_size);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.