| spi Vitis Drivers API Documentation

- Overview
- Data Structures
- APIs
- File List
- Examples

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

## Functions
int | SpiSelfTestExample (u16 DeviceId)
| 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 | ( | u16 | DeviceId | ) |

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

  DeviceId | is the XPAR_<SPI_instance>_DEVICE_ID value from xparameters.h

Returns
  XST_SUCCESS if successful, XST_FAILURE if unsuccessful

Note
  None

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

Referenced by main().