spips
Vitis Drivers API Documentation
xspips_tpm_polled_example.c File Reference

Overview

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.

Note

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...
 

Function Documentation

int main ( void  )

Main function to call the Spi TPM example.

Parameters
None
Returns
XST_SUCCESS if successful, otherwise XST_FAILURE.
Note
None

References SpiPsTpmPolledExample().

int SpiPsReadID ( XSpiPs SpiPtr)

This function reads vendor identification information.

Parameters
SpiPtris a pointer to the SPIPS driver component to use.
Returns
XST_SUCCESS if successful, else XST_FAILURE.
Note
None.

References SpiPsTpmTransfer().

Referenced by SpiPsTpmPolledExample().

int SpiPsTpmAccessGet ( XSpiPs SpiPtr,
u8 *  AccessPtr 
)

This function gets TPM access configuration.

Parameters
SpiPtris a pointer to the SPIPS driver component to use.
AccessPtris pointer to get access configuration
Returns
XST_SUCCESS if successful, else XST_FAILURE.
Note
None.

References SpiPsTpmTransfer().

Referenced by SpiPsTpmPolledExample().

int SpiPsTpmAccessSet ( XSpiPs SpiPtr,
u8  Access 
)

This function sets TPM access configuration.

Parameters
SpiPtris a pointer to the SPIPS driver component to use.
Accessis set access configuration value
Returns
XST_SUCCESS if successful, else XST_FAILURE.
Note
None.

References SpiPsTpmTransfer().

Referenced by SpiPsTpmPolledExample().

int SpiPsTpmDataTransfer ( XSpiPs SpiPtr,
u8 *  TxBuf,
u8 *  RxBuf,
u16  Txlen 
)

This function sets TPM access configuration.

Parameters
SpiPtris a pointer to the SPIPS driver component to use.
TxBufis pointer to transmit buffer
RxBufis pointer to receive buffer
Txlenis data transfer length
Returns
XST_SUCCESS if successful, else XST_FAILURE.
Note
None.

References SpiPsTpmFifoRead(), SpiPsTpmFifoWrite(), SpiPsTpmStatusGet(), and SpiPsTpmStatusSet().

Referenced by SpiPsTpmPolledExample().

int SpiPsTpmFifoRead ( XSpiPs SpiPtr,
u8 *  DataPtr,
u8  ByteCount 
)

This function reads data from TPM FIFO.

Parameters
SpiPtris a pointer to the SPIPS driver component to use.
Datais to be read to data FIFO
ByteCountis the number of bytes to read.
Returns
XST_SUCCESS if successful, else XST_FAILURE.
Note
None.

References SpiPsTpmTransfer().

Referenced by SpiPsTpmDataTransfer().

int SpiPsTpmFifoWrite ( XSpiPs SpiPtr,
u8 *  DataPtr,
u8  ByteCount 
)

This function write the data TPM FIFO.

Parameters
SpiPtris a pointer to the SPIPS driver component to use.
DataPtris data pointer to be written to FIFO.
ByteCountis the number of bytes to read.
Returns
XST_SUCCESS if successful, else XST_FAILURE.
Note
None.

References SpiPsTpmTransfer().

Referenced by SpiPsTpmDataTransfer().

int SpiPsTpmPolledExample ( XSpiPs SpiInstancePtr,
u16  SpiDeviceId 
)
int SpiPsTpmStatusGet ( XSpiPs SpiPtr,
u8 *  StatusPtr 
)

This function gets TPM status.

Parameters
SpiPtris a pointer to the SPIPS driver component to use.
StatusPtris pointer to read status
Returns
XST_SUCCESS if successful, else XST_FAILURE.
Note
None.

References SpiPsTpmTransfer().

Referenced by SpiPsTpmDataTransfer().

int SpiPsTpmStatusSet ( XSpiPs SpiPtr,
u8  StatusVal 
)

This function sets the TPM status.

Parameters
SpiPtris a pointer to the SPIPS driver component to use.
StatusValis to be written to status register
Returns
XST_SUCCESS if successful, else XST_FAILURE.
Note
None.

References SpiPsTpmTransfer().

Referenced by SpiPsTpmDataTransfer().

int SpiPsTpmTransfer ( XSpiPs SpiPtr,
u32  Address,
u8 *  TxBuf,
u8 *  RxBuf,
u16  Length 
)

This function sets TPM access configuration.

Parameters
SpiPtris a pointer to the SPIPS driver component to use.
Addressregister address
TxBufis pointer to transmit buffer
RxBufis pointer to receive buffer
Lengthis transfer length
Returns
XST_SUCCESS if successful, else XST_FAILURE.
Note
None.

References XSpiPs_PolledTransfer().

Referenced by SpiPsReadID(), SpiPsTpmAccessGet(), SpiPsTpmAccessSet(), SpiPsTpmFifoRead(), SpiPsTpmFifoWrite(), SpiPsTpmStatusGet(), and SpiPsTpmStatusSet().