![]() |
spips
Vitis Drivers API Documentation
|
This file contains a design example using the SPI driver (XSpiPs) in interrupt mode with a serial flash device.
This examples performs transfers in Manual start mode using interrupts. The hardware which this example runs on, must have a serial flash for it to run. This example has been tested with SST25W080.
None.
MODIFICATION HISTORY:
Ver Who Date Changes
1.00 sg 1/30/13 First release ms 04/05/17 Modified Comment lines in functions to recognize it as documentation block for doxygen generation. 3.2 nsk 03/26/19 Add support for versal 3.9 sb 07/05/23 Added support for system device-tree flow.
Functions | |
void | SpiPsHandler (void *CallBackRef, u32 StatusEvent, unsigned int ByteCount) |
This function is the handler which performs processing for the SPI driver. More... | |
int | SpiPsFlashIntrExample (XScuGic *IntcInstancePtr, XSpiPs *SpiInstancePtr, u16 SpiDeviceId, u16 SpiIntrId) |
The purpose of this function is to illustrate how to use the XSpiPs device driver in interrupt mode. More... | |
int | main (void) |
Main function to call the SPI Flash example. More... | |
int main | ( | void | ) |
Main function to call the SPI Flash example.
References SpiPsFlashIntrExample().
int SpiPsFlashIntrExample | ( | XScuGic * | IntcInstancePtr, |
XSpiPs * | SpiInstancePtr, | ||
u16 | SpiDeviceId, | ||
u16 | SpiIntrId | ||
) |
The purpose of this function is to illustrate how to use the XSpiPs device driver in interrupt mode.
This function writes and reads data from a serial flash.
IntcInstancePtr | is a pointer to Interrupt Controller instance. |
SpiInstancePtr | is a pointer to the SPI driver instance to use. |
SpiDeviceId | is the Instance Id of SPI in the system. |
SpiIntrId | is the Interrupt Id for SPI in the system. |
This function calls other functions which contain loops that may be infinite if interrupts are not working such that it may not return. If the device slave select is not correct and the device is not responding on bus it will read a status of 0xFF for the status register as the bus is pulled up.
References XSpiPs_Config::BaseAddress, XSpiPs_Config::IntrId, XSpiPs_Config::IntrParent, SpiPsHandler(), XSpiPs_CfgInitialize(), XSPIPS_CLK_PRESCALE_8, XSPIPS_FORCE_SSELECT_OPTION, XSpiPs_InterruptHandler(), XSpiPs_LookupConfig(), XSPIPS_MANUAL_START_OPTION, XSPIPS_MASTER_OPTION, XSpiPs_SelfTest(), XSpiPs_SetClkPrescaler(), XSpiPs_SetOptions(), XSpiPs_SetSlaveSelect(), and XSpiPs_SetStatusHandler().
Referenced by main().
void SpiPsHandler | ( | void * | CallBackRef, |
u32 | StatusEvent, | ||
unsigned int | ByteCount | ||
) |
This function is the handler which performs processing for the SPI driver.
It is called from an interrupt context such that the amount of processing performed should be minimized. It is called when a transfer of SPI data completes or an error occurs.
This handler provides an example of how to handle SPI interrupts but is application specific.
CallBackRef | is a reference passed to the handler. |
StatusEvent | is the status of the SPI . |
ByteCount | is the number of bytes transferred. |
Referenced by SpiPsFlashIntrExample().