![]() |
spips
Vitis Drivers API Documentation
|
This file contains a design example using the SPI driver (XSpiPs) in polled mode and hardware device with a Trusted Platform Module device.
This example sends TPM commands to device based on user inputs and displays the response.
None.
MODIFICATION HISTORY:
Ver Who Date Changes
1.00 sg 04/02/21 Initial release 3.9 sb 07/05/23 Added support for system device-tree flow.
Functions | |
| int | SpiPsReadID (XSpiPs *SpiPtr) |
| This function reads vendor identification information. More... | |
| int | SpiPsTpmStatusGet (XSpiPs *SpiPtr, u8 *StatusPtr) |
| This function gets TPM status. More... | |
| int | SpiPsTpmStatusSet (XSpiPs *SpiPtr, u8 StatusVal) |
| This function sets the TPM status. More... | |
| int | SpiPsTpmAccessGet (XSpiPs *SpiPtr, u8 *AccessPtr) |
| This function gets TPM access configuration. More... | |
| int | SpiPsTpmAccessSet (XSpiPs *SpiPtr, u8 Access) |
| This function sets TPM access configuration. More... | |
| int | SpiPsTpmFifoRead (XSpiPs *SpiPtr, u8 *DataPtr, u8 ByteCount) |
| This function reads data from TPM FIFO. More... | |
| int | SpiPsTpmFifoWrite (XSpiPs *SpiPtr, u8 *DataPtr, u8 ByteCount) |
| This function write the data TPM FIFO. More... | |
| int | SpiPsTpmTransfer (XSpiPs *SpiPtr, u32 Address, u8 *TxBuf, u8 *RxBuf, u16 Length) |
| This function sets TPM access configuration. More... | |
| int | SpiPsTpmDataTransfer (XSpiPs *SpiPtr, u8 *TxBuf, u8 *RxBuf, u16 Txlen) |
| This function sets TPM access configuration. More... | |
| int | SpiPsTpmPolledExample (XSpiPs *SpiInstancePtr, u16 SpiDeviceId) |
| int | main (void) |
| Main function to call the Spi TPM example. More... | |
| int main | ( | void | ) |
Main function to call the Spi TPM example.
| None |
References SpiPsTpmPolledExample().
| int SpiPsReadID | ( | XSpiPs * | SpiPtr | ) |
This function reads vendor identification information.
| SpiPtr | is a pointer to the SPIPS driver component to use. |
References SpiPsTpmTransfer().
Referenced by SpiPsTpmPolledExample().
| int SpiPsTpmAccessGet | ( | XSpiPs * | SpiPtr, |
| u8 * | AccessPtr | ||
| ) |
This function gets TPM access configuration.
| SpiPtr | is a pointer to the SPIPS driver component to use. |
| AccessPtr | is pointer to get access configuration |
References SpiPsTpmTransfer().
Referenced by SpiPsTpmPolledExample().
| int SpiPsTpmAccessSet | ( | XSpiPs * | SpiPtr, |
| u8 | Access | ||
| ) |
This function sets TPM access configuration.
| SpiPtr | is a pointer to the SPIPS driver component to use. |
| Access | is set access configuration value |
References SpiPsTpmTransfer().
Referenced by SpiPsTpmPolledExample().
| int SpiPsTpmDataTransfer | ( | XSpiPs * | SpiPtr, |
| u8 * | TxBuf, | ||
| u8 * | RxBuf, | ||
| u16 | Txlen | ||
| ) |
This function sets TPM access configuration.
| SpiPtr | is a pointer to the SPIPS driver component to use. |
| TxBuf | is pointer to transmit buffer |
| RxBuf | is pointer to receive buffer |
| Txlen | is data transfer length |
References SpiPsTpmFifoRead(), SpiPsTpmFifoWrite(), SpiPsTpmStatusGet(), and SpiPsTpmStatusSet().
Referenced by SpiPsTpmPolledExample().
| int SpiPsTpmFifoRead | ( | XSpiPs * | SpiPtr, |
| u8 * | DataPtr, | ||
| u8 | ByteCount | ||
| ) |
This function reads data from TPM FIFO.
| SpiPtr | is a pointer to the SPIPS driver component to use. |
| Data | is to be read to data FIFO |
| ByteCount | is the number of bytes to read. |
References SpiPsTpmTransfer().
Referenced by SpiPsTpmDataTransfer().
| int SpiPsTpmFifoWrite | ( | XSpiPs * | SpiPtr, |
| u8 * | DataPtr, | ||
| u8 | ByteCount | ||
| ) |
This function write the data TPM FIFO.
| SpiPtr | is a pointer to the SPIPS driver component to use. |
| DataPtr | is data pointer to be written to FIFO. |
| ByteCount | is the number of bytes to read. |
References SpiPsTpmTransfer().
Referenced by SpiPsTpmDataTransfer().
| int SpiPsTpmPolledExample | ( | XSpiPs * | SpiInstancePtr, |
| u16 | SpiDeviceId | ||
| ) |
| SpiInstancePtr | is a pointer to the Spi Instance. |
| SpiDeviceId | is the Device Id of Spi. |
References XSpiPs_Config::BaseAddress, SpiPsReadID(), SpiPsTpmAccessGet(), SpiPsTpmAccessSet(), SpiPsTpmDataTransfer(), XSpiPs_CfgInitialize(), XSPIPS_CLK_PRESCALE_16, XSPIPS_FORCE_SSELECT_OPTION, XSpiPs_LookupConfig(), XSPIPS_MANUAL_START_OPTION, XSPIPS_MASTER_OPTION, XSpiPs_SelfTest(), XSpiPs_SetClkPrescaler(), XSpiPs_SetOptions(), and XSpiPs_SetSlaveSelect().
Referenced by main().
| int SpiPsTpmStatusGet | ( | XSpiPs * | SpiPtr, |
| u8 * | StatusPtr | ||
| ) |
This function gets TPM status.
| SpiPtr | is a pointer to the SPIPS driver component to use. |
| StatusPtr | is pointer to read status |
References SpiPsTpmTransfer().
Referenced by SpiPsTpmDataTransfer().
| int SpiPsTpmStatusSet | ( | XSpiPs * | SpiPtr, |
| u8 | StatusVal | ||
| ) |
This function sets the TPM status.
| SpiPtr | is a pointer to the SPIPS driver component to use. |
| StatusVal | is to be written to status register |
References SpiPsTpmTransfer().
Referenced by SpiPsTpmDataTransfer().
| int SpiPsTpmTransfer | ( | XSpiPs * | SpiPtr, |
| u32 | Address, | ||
| u8 * | TxBuf, | ||
| u8 * | RxBuf, | ||
| u16 | Length | ||
| ) |
This function sets TPM access configuration.
| SpiPtr | is a pointer to the SPIPS driver component to use. |
| Address | register address |
| TxBuf | is pointer to transmit buffer |
| RxBuf | is pointer to receive buffer |
| Length | is transfer length |
References XSpiPs_PolledTransfer().
Referenced by SpiPsReadID(), SpiPsTpmAccessGet(), SpiPsTpmAccessSet(), SpiPsTpmFifoRead(), SpiPsTpmFifoWrite(), SpiPsTpmStatusGet(), and SpiPsTpmStatusSet().