![]() |
spips
Vitis Drivers API Documentation
|
Macros | |
| #define | TPM_SPI_SELECT 0x00 |
| TPM slave select. More... | |
| #define | XSPIPS_TPM_ACCESS 0x0000 |
| TPM access register. More... | |
| #define | XSPIPS_TPM_STS 0x0018 |
| TPM status register. More... | |
| #define | XSPIPS_TPM_DATA_FIFO 0x0024 |
| TPM data FIFO register. More... | |
| #define | XSPIPS_TPM_DID_VID 0x0F00 |
| TPM DID/VID register. More... | |
| #define | XSPIPS_TPM_RID 0x0F04 |
| TPM revision ID register. More... | |
| #define | XSPIPS_TPM_ACCESS_VALID 0x80 |
| Access valid bit. More... | |
| #define | XSPIPS_TPM_ACCESS_ACT_LOCAL 0x20 |
| Active locality bit. More... | |
| #define | XSPIPS_TPM_ACCESS_REQ_PEND 0x04 |
| Pending request bit. More... | |
| #define | XSPIPS_TPM_ACCESS_REQ_USE 0x02 |
| Request use bit. More... | |
| #define | XSPIPS_TPM_STS_VALID 0x80 |
| Status valid bit. More... | |
| #define | XSPIPS_TPM_STS_CMD_READY 0x40 |
| Command ready bit. More... | |
| #define | XSPIPS_TPM_STS_GO 0x20 |
| TPM go bit. More... | |
| #define | XSPIPS_TPM_STS_DATA_AVAIL 0x10 |
| Data available bit. More... | |
| #define | XSPIPS_TPM_STS_DATA_EXPECT 0x08 |
| Data expected bit. More... | |
| #define | XSPIPS_TPM_TX_HEAD_SIZE 4 |
| SPI request header size. More... | |
| #define | XSPIPS_TPM_RX_HEAD_SIZE 10 |
| TPM response header size. More... | |
| #define | XSPIPS_TPM_SPI_MAX_SIZE 64 |
| Max bytes per SPI transfer. More... | |
| #define | XSPIPS_TPM2_CMD_SELFTEST 0x01 |
| Selftest menu option. More... | |
| #define | XSPIPS_TPM2_CMD_STARTUP 0x02 |
| Startup menu option. More... | |
| #define | XSPIPS_TPM2_CMD_PCR_READ 0x03 |
| PCR read menu option. More... | |
| #define | XSPIPS_TPM2_CMD_PCR_RESET 0x04 |
| PCR reset menu option. More... | |
| #define | XSPIPS_TPM2_CMD_PCR_EXTEND 0x05 |
| PCR extend menu option. More... | |
| #define | XSPIPS_EXIT_CMD_LOOP 0x06 |
| Exit menu option. More... | |
| #define | XSPIPS_TPM_PCR_EXT_CMD_SIZE 33 |
| Size of the PCR extend command without the digest. More... | |
| #define | XSPIPS_TPM_SHA1_DIGEST_SIZE 20 |
| SHA1 digest size. More... | |
| #define | XSPIPS_TPM_SHA256_DIGEST_SIZE 32 |
| SHA256 digest size. More... | |
| #define | XSPIPS_TPM_RESP_MAX_SIZE 4096 |
| Maximum possible TPM response size in bytes. More... | |
| #define | XSPIPS_TPM_REQ_MAX_SIZE 1024 |
| Maximum possible TPM request size in bytes. More... | |
Functions | |
| int | SpiPsReadID (XSpiPs *SpiPtr) |
| Reads vendor identification information. More... | |
| int | SpiPsTpmStatusGet (XSpiPs *SpiPtr, u8 *StatusPtr) |
| Gets TPM status. More... | |
| int | SpiPsTpmStatusSet (XSpiPs *SpiPtr, u8 StatusVal) |
| Sets the TPM status. More... | |
| int | SpiPsTpmAccessGet (XSpiPs *SpiPtr, u8 *AccessPtr) |
| Gets TPM access configuration. More... | |
| int | SpiPsTpmAccessSet (XSpiPs *SpiPtr, u8 Access) |
| Sets TPM access configuration. More... | |
| int | SpiPsTpmFifoRead (XSpiPs *SpiPtr, u8 *DataPtr, u8 ByteCount) |
| Reads data from TPM FIFO. More... | |
| int | SpiPsTpmFifoWrite (XSpiPs *SpiPtr, u8 *DataPtr, u8 ByteCount) |
| Writes the data to the TPM FIFO. More... | |
| int | SpiPsTpmTransfer (XSpiPs *SpiPtr, u32 Address, u8 *TxBuf, u8 *RxBuf, u16 Length) |
| Transfers data to or from a TPM register. More... | |
| int | SpiPsTpmDataTransfer (XSpiPs *SpiPtr, u8 *TxBuf, u8 *RxBuf, u16 Txlen) |
| Sends a TPM command and reads the TPM response. More... | |
| int | SpiPsTpmPolledExample (XSpiPs *SpiInstancePtr, UINTPTR BaseAddress) |
| Illustrates how to use the XSpiPs device driver in polled mode with a TPM device. More... | |
| int | main (void) |
| Calls the SPI TPM example. More... | |
Variables | |
| u8 | TpmTxBuffer [XSPIPS_TPM_REQ_MAX_SIZE+XSPIPS_TPM_TX_HEAD_SIZE] |
| Buffer for the data sent on the SPI bus. More... | |
| u8 | TpmRxBuffer [XSPIPS_TPM_RESP_MAX_SIZE+XSPIPS_TPM_TX_HEAD_SIZE] |
| Buffer for the data received on the SPI bus. More... | |
| u8 | TpmRespBuffer [XSPIPS_TPM_RESP_MAX_SIZE] |
| Buffer for the TPM command response. More... | |
| #define TPM_SPI_SELECT 0x00 |
TPM slave select.
Referenced by SpiPsTpmPolledExample().
| #define XSPIPS_EXIT_CMD_LOOP 0x06 |
Exit menu option.
Referenced by SpiPsTpmPolledExample().
| #define XSPIPS_TPM2_CMD_PCR_EXTEND 0x05 |
PCR extend menu option.
Referenced by SpiPsTpmPolledExample().
| #define XSPIPS_TPM2_CMD_PCR_READ 0x03 |
PCR read menu option.
Referenced by SpiPsTpmPolledExample().
| #define XSPIPS_TPM2_CMD_PCR_RESET 0x04 |
PCR reset menu option.
Referenced by SpiPsTpmPolledExample().
| #define XSPIPS_TPM2_CMD_SELFTEST 0x01 |
Selftest menu option.
Referenced by SpiPsTpmPolledExample().
| #define XSPIPS_TPM2_CMD_STARTUP 0x02 |
Startup menu option.
Referenced by SpiPsTpmPolledExample().
| #define XSPIPS_TPM_ACCESS 0x0000 |
TPM access register.
Referenced by SpiPsTpmAccessGet(), and SpiPsTpmAccessSet().
| #define XSPIPS_TPM_ACCESS_ACT_LOCAL 0x20 |
Active locality bit.
Referenced by SpiPsTpmPolledExample().
| #define XSPIPS_TPM_ACCESS_REQ_PEND 0x04 |
Pending request bit.
| #define XSPIPS_TPM_ACCESS_REQ_USE 0x02 |
Request use bit.
Referenced by SpiPsTpmPolledExample().
| #define XSPIPS_TPM_ACCESS_VALID 0x80 |
Access valid bit.
Referenced by SpiPsTpmPolledExample().
| #define XSPIPS_TPM_DATA_FIFO 0x0024 |
TPM data FIFO register.
Referenced by SpiPsTpmFifoRead(), and SpiPsTpmFifoWrite().
| #define XSPIPS_TPM_DID_VID 0x0F00 |
TPM DID/VID register.
Referenced by SpiPsReadID().
| #define XSPIPS_TPM_PCR_EXT_CMD_SIZE 33 |
Size of the PCR extend command without the digest.
Referenced by SpiPsTpmPolledExample().
| #define XSPIPS_TPM_REQ_MAX_SIZE 1024 |
Maximum possible TPM request size in bytes.
| #define XSPIPS_TPM_RESP_MAX_SIZE 4096 |
Maximum possible TPM response size in bytes.
Referenced by SpiPsTpmDataTransfer().
| #define XSPIPS_TPM_RID 0x0F04 |
TPM revision ID register.
Referenced by SpiPsReadID().
| #define XSPIPS_TPM_RX_HEAD_SIZE 10 |
TPM response header size.
Referenced by SpiPsTpmDataTransfer().
| #define XSPIPS_TPM_SHA1_DIGEST_SIZE 20 |
SHA1 digest size.
Referenced by SpiPsTpmPolledExample().
| #define XSPIPS_TPM_SHA256_DIGEST_SIZE 32 |
SHA256 digest size.
Referenced by SpiPsTpmPolledExample().
| #define XSPIPS_TPM_SPI_MAX_SIZE 64 |
Max bytes per SPI transfer.
Referenced by SpiPsTpmTransfer().
| #define XSPIPS_TPM_STS 0x0018 |
TPM status register.
Referenced by SpiPsTpmStatusGet(), and SpiPsTpmStatusSet().
| #define XSPIPS_TPM_STS_CMD_READY 0x40 |
Command ready bit.
Referenced by SpiPsTpmDataTransfer().
| #define XSPIPS_TPM_STS_DATA_AVAIL 0x10 |
Data available bit.
Referenced by SpiPsTpmDataTransfer().
| #define XSPIPS_TPM_STS_DATA_EXPECT 0x08 |
Data expected bit.
| #define XSPIPS_TPM_STS_GO 0x20 |
TPM go bit.
Referenced by SpiPsTpmDataTransfer().
| #define XSPIPS_TPM_STS_VALID 0x80 |
Status valid bit.
Referenced by SpiPsTpmDataTransfer().
| #define XSPIPS_TPM_TX_HEAD_SIZE 4 |
SPI request header size.
Referenced by SpiPsTpmTransfer().
| int main | ( | void | ) |
Calls the SPI TPM example.
References SpiPsTpmPolledExample().
| int SpiPsReadID | ( | XSpiPs * | SpiPtr | ) |
Reads vendor identification information.
| [in,out] | SpiPtr | Pointer to the SPIPS driver component to use. |
References SpiPsTpmTransfer(), XSPIPS_TPM_DID_VID, and XSPIPS_TPM_RID.
Referenced by SpiPsTpmPolledExample().
| int SpiPsTpmAccessGet | ( | XSpiPs * | SpiPtr, |
| u8 * | AccessPtr | ||
| ) |
Gets TPM access configuration.
| [in,out] | SpiPtr | Pointer to the SPIPS driver component to use. |
| [out] | AccessPtr | Pointer to get access configuration. |
References SpiPsTpmTransfer(), and XSPIPS_TPM_ACCESS.
Referenced by SpiPsTpmPolledExample().
| int SpiPsTpmAccessSet | ( | XSpiPs * | SpiPtr, |
| u8 | Access | ||
| ) |
Sets TPM access configuration.
| [in,out] | SpiPtr | Pointer to the SPIPS driver component to use. |
| [in] | Access | Access configuration value to set. |
References SpiPsTpmTransfer(), and XSPIPS_TPM_ACCESS.
Referenced by SpiPsTpmPolledExample().
| int SpiPsTpmDataTransfer | ( | XSpiPs * | SpiPtr, |
| u8 * | TxBuf, | ||
| u8 * | RxBuf, | ||
| u16 | Txlen | ||
| ) |
Sends a TPM command and reads the TPM response.
The command is written to the TPM data FIFO and the response is read back once the TPM reports that data is available.
| [in,out] | SpiPtr | Pointer to the SPIPS driver component to use. |
| [in] | TxBuf | Pointer to transmit buffer. |
| [in,out] | RxBuf | Pointer to receive buffer. |
| [in] | Txlen | Data transfer length. |
References SpiPsTpmFifoRead(), SpiPsTpmFifoWrite(), SpiPsTpmStatusGet(), SpiPsTpmStatusSet(), XSPIPS_TPM_RESP_MAX_SIZE, XSPIPS_TPM_RX_HEAD_SIZE, XSPIPS_TPM_STS_CMD_READY, XSPIPS_TPM_STS_DATA_AVAIL, XSPIPS_TPM_STS_GO, and XSPIPS_TPM_STS_VALID.
Referenced by SpiPsTpmPolledExample().
| int SpiPsTpmFifoRead | ( | XSpiPs * | SpiPtr, |
| u8 * | DataPtr, | ||
| u8 | ByteCount | ||
| ) |
Reads data from TPM FIFO.
| [in,out] | SpiPtr | Pointer to the SPIPS driver component to use. |
| [out] | DataPtr | Pointer to the buffer for the data read from the FIFO. |
| [in] | ByteCount | The number of bytes to read. |
References SpiPsTpmTransfer(), and XSPIPS_TPM_DATA_FIFO.
Referenced by SpiPsTpmDataTransfer().
| int SpiPsTpmFifoWrite | ( | XSpiPs * | SpiPtr, |
| u8 * | DataPtr, | ||
| u8 | ByteCount | ||
| ) |
Writes the data to the TPM FIFO.
| [in,out] | SpiPtr | Pointer to the SPIPS driver component to use. |
| [in] | DataPtr | Data pointer to be written to FIFO. |
| [in] | ByteCount | The number of bytes to write. |
References SpiPsTpmTransfer(), and XSPIPS_TPM_DATA_FIFO.
Referenced by SpiPsTpmDataTransfer().
| int SpiPsTpmPolledExample | ( | XSpiPs * | SpiInstancePtr, |
| UINTPTR | BaseAddress | ||
| ) |
Illustrates how to use the XSpiPs device driver in polled mode with a TPM device.
The function sends TPM commands to the device based on user inputs and displays the response.
| [in] | SpiInstancePtr | Pointer to the Spi Instance. |
| [in] | BaseAddress | The base address of the device. |
References XSpiPs_Config::BaseAddress, SpiPsReadID(), SpiPsTpmAccessGet(), SpiPsTpmAccessSet(), SpiPsTpmDataTransfer(), TPM_SPI_SELECT, TpmRespBuffer, XSpiPs_CfgInitialize(), XSPIPS_CLK_PRESCALE_16, XSPIPS_EXIT_CMD_LOOP, XSPIPS_FORCE_SSELECT_OPTION, XSpiPs_LookupConfig(), XSPIPS_MANUAL_START_OPTION, XSPIPS_MASTER_OPTION, XSpiPs_SelfTest(), XSpiPs_SetClkPrescaler(), XSpiPs_SetOptions(), XSpiPs_SetSlaveSelect(), XSPIPS_TPM2_CMD_PCR_EXTEND, XSPIPS_TPM2_CMD_PCR_READ, XSPIPS_TPM2_CMD_PCR_RESET, XSPIPS_TPM2_CMD_SELFTEST, XSPIPS_TPM2_CMD_STARTUP, XSPIPS_TPM_ACCESS_ACT_LOCAL, XSPIPS_TPM_ACCESS_REQ_USE, XSPIPS_TPM_ACCESS_VALID, XSPIPS_TPM_PCR_EXT_CMD_SIZE, XSPIPS_TPM_SHA1_DIGEST_SIZE, and XSPIPS_TPM_SHA256_DIGEST_SIZE.
Referenced by main().
| int SpiPsTpmStatusGet | ( | XSpiPs * | SpiPtr, |
| u8 * | StatusPtr | ||
| ) |
Gets TPM status.
| [in,out] | SpiPtr | Pointer to the SPIPS driver component to use. |
| [out] | StatusPtr | Pointer to read status. |
References SpiPsTpmTransfer(), and XSPIPS_TPM_STS.
Referenced by SpiPsTpmDataTransfer().
| int SpiPsTpmStatusSet | ( | XSpiPs * | SpiPtr, |
| u8 | StatusVal | ||
| ) |
Sets the TPM status.
| [in,out] | SpiPtr | Pointer to the SPIPS driver component to use. |
| [in] | StatusVal | Value to be written to status register. |
References SpiPsTpmTransfer(), and XSPIPS_TPM_STS.
Referenced by SpiPsTpmDataTransfer().
| int SpiPsTpmTransfer | ( | XSpiPs * | SpiPtr, |
| u32 | Address, | ||
| u8 * | TxBuf, | ||
| u8 * | RxBuf, | ||
| u16 | Length | ||
| ) |
Transfers data to or from a TPM register.
The transfer is split into SPI transfers of up to XSPIPS_TPM_SPI_MAX_SIZE bytes.
| [in,out] | SpiPtr | Pointer to the SPIPS driver component to use. |
| [in] | Address | Register address. |
| [in] | TxBuf | Pointer to transmit buffer. |
| [in,out] | RxBuf | Pointer to receive buffer. |
| [in] | Length | Transfer length. |
References TpmRxBuffer, TpmTxBuffer, XSpiPs_PolledTransfer(), XSPIPS_TPM_SPI_MAX_SIZE, and XSPIPS_TPM_TX_HEAD_SIZE.
Referenced by SpiPsReadID(), SpiPsTpmAccessGet(), SpiPsTpmAccessSet(), SpiPsTpmFifoRead(), SpiPsTpmFifoWrite(), SpiPsTpmStatusGet(), and SpiPsTpmStatusSet().
| u8 TpmRespBuffer[XSPIPS_TPM_RESP_MAX_SIZE] |
Buffer for the TPM command response.
Referenced by SpiPsTpmPolledExample().
| u8 TpmRxBuffer[XSPIPS_TPM_RESP_MAX_SIZE+XSPIPS_TPM_TX_HEAD_SIZE] |
Buffer for the data received on the SPI bus.
Referenced by SpiPsTpmTransfer().
| u8 TpmTxBuffer[XSPIPS_TPM_REQ_MAX_SIZE+XSPIPS_TPM_TX_HEAD_SIZE] |
Buffer for the data sent on the SPI bus.
Referenced by SpiPsTpmTransfer().