spi
Vitis Drivers API Documentation
 All Data Structures Files Functions Variables Typedefs Macros Groups Pages
xspi_selftest_example.c File Reference

Overview

This file contains a example for using the SPI Hardware and driver.

Note

None

MODIFICATION HISTORY:
Ver   Who  Date     Changes


1.00a sv 05/16/05 Initial release for TestApp integration. 1.11a sdm 03/03/08 Minor changes to comply to coding guidelines 3.00a ktn 10/28/09 Converted all register accesses to 32 bit access. Updated to use the HAL APIs/macros. Replaced call to XSpi_Initialize API with XSpi_LookupConfig and XSpi_CfgInitialize. 4.2 ms 01/23/17 Added xil_printf statement in main function to ensure that "Successfully ran" and "Failed" strings are available in all examples. This is a fix for CR-965028. 4.11 sb 07/11/23 Added support for system device-tree flow. 4.16 vlt 12/18/25 Update Doxygen comments to include SDT flow details.

#include "xparameters.h"
#include "xspi.h"
#include "xspi_l.h"
#include "xil_printf.h"

Functions

int SpiSelfTestExample (UINTPTR BaseAddress)
 This function does a selftest and loopback test on the SPI device and XSpi driver as an example. More...
 
int main (void)
 Main function to call the example. More...
 

Function Documentation

int main ( void  )

Main function to call the example.

This function is not included if the example is generated from the TestAppGen test tool.

Returns
XST_SUCCESS if successful, XST_FAILURE if unsuccessful
Note
None

References SpiSelfTestExample().

int SpiSelfTestExample ( UINTPTR  BaseAddress)

This function does a selftest and loopback test on the SPI device and XSpi driver as an example.

The purpose of this function is to illustrate how to use the XSpi component.

Parameters
BaseAddresscontains the base address of the device
Returns
XST_SUCCESS if successful, XST_FAILURE if unsuccessful
Note
In XSCT/classic flow, DeviceId is used to look up the device configuration.

References XSpi_Config::BaseAddress, XSpi_CfgInitialize(), XSpi_LookupConfig(), and XSpi_SelfTest().

Referenced by main().