Trait opentitanlib::tpm::Driver
source · pub trait Driver {
// Required methods
fn read_register(&self, register: Register, data: &mut [u8]) -> Result<()>;
fn write_register(&self, register: Register, data: &[u8]) -> Result<()>;
// Provided methods
fn init(&self) -> Result<()> { ... }
fn execute_command(&self, cmd: &[u8]) -> Result<Vec<u8>> { ... }
fn read_status(&self) -> Result<TpmStatus> { ... }
fn poll_for_data_available(&self) -> Result<TpmStatus> { ... }
fn poll_for_ready(&self) -> Result<TpmStatus> { ... }
}
Expand description
Low level interface for accessing TPM. Separate implementations exist for SPI and I2C.
Required Methods§
Provided Methods§
sourcefn execute_command(&self, cmd: &[u8]) -> Result<Vec<u8>>
fn execute_command(&self, cmd: &[u8]) -> Result<Vec<u8>>
Execute a TPM command and return the result as a Vec<u8>
or time out.
sourcefn read_status(&self) -> Result<TpmStatus>
fn read_status(&self) -> Result<TpmStatus>
Fetches the current status.
sourcefn poll_for_data_available(&self) -> Result<TpmStatus>
fn poll_for_data_available(&self) -> Result<TpmStatus>
Poll the status register until the status is valid and data is available or time out.
sourcefn poll_for_ready(&self) -> Result<TpmStatus>
fn poll_for_ready(&self) -> Result<TpmStatus>
Poll the status register until the status is valid and the tpm is ready or time out.