qspips
Vitis Drivers API Documentation
 All Data Structures Files Functions Variables Typedefs Groups Pages
xqspips.c File Reference

Overview

Implements the interface functions of the XQspiPs driver.

See xqspips.h for a detailed description of the device and driver.

MODIFICATION HISTORY:
Ver   Who Date     Changes


1.00 sdm 11/25/10 First release 2.00a kka 07/25/12 Removed XQspiPs_GetWriteData API. The XQspiPs_SetSlaveSelect has been modified to remove the argument of the slave select as the QSPI controller only supports one slave. XQspiPs_GetSlaveSelect API has been removed Added logic to XQspiPs_GetReadData to handle data shift for normal data reads and instruction/status reads differently based on the ShiftReadData flag. Removed the selection for the following options: Master mode (XQSPIPS_MASTER_OPTION) and Flash interface mode (XQSPIPS_FLASH_MODE_OPTION) option as the QSPI driver supports the Master mode and Flash Interface mode and doesn't support Slave mode or the legacy mode. Modified the XQspiPs_PolledTransfer and XQspiPs_Transfer APIs so that the last argument (IsInst) specifying whether it is instruction or data has been removed. The first byte in the SendBufPtr argument of these APIs specify the instruction to be sent to the Flash Device. The XQspiPs_PolledTransfer function has been updated to fill the data to fifo depth. This version of the driver fixes CRs 670197/663787. 2.01a sg 02/03/13 Added flash opcodes for DUAL_IO_READ,QUAD_IO_READ. Created macros XQspiPs_IsManualStart and XQspiPs_IsManualChipSelect. Changed QSPI transfer logic for polled and interrupt modes to be based on filled tx fifo count and receive based on it. RXNEMPTY interrupt is not used. Added assertions to XQspiPs_LqspiRead function.

2.02a hk  05/14/13 Added enable and disable to the XQspiPs_LqspiRead()
                 function
           Added instructions for bank selection, die erase and
           flag status register to the flash instruction table
           Handling for instructions not in flash instruction
                 table added. Checking for Tx FIFO empty when switching from
                 TXD1/2/3 to TXD0 added. If WRSR instruction is sent with
           byte count 3 (spansion), instruction size and TXD register
                 changed accordingly. CR# 712502 and 703869.
           Added ("#ifdef linear base address") in the Linear read function.
           Changed  XPAR_XQSPIPS_0_LINEAR_BASEADDR to
           XPAR_PS7_QSPI_LINEAR_0_S_AXI_BASEADDR in
           XQspiPs_LqspiRead function. Fix for CR#718141
2.03a hk  09/05/13 Modified polled and interrupt transfers to make use of
                   thresholds. This is to improve performance.
                   Added RX and TX threshold reset to one in XQspiPs_Abort.
                   Added RX threshold reset(1) after transfer in polled and
                   interrupt transfers. Made changes to make sure threshold
                   change is done only when no transfer is in progress.
3.1   hk  08/13/14 When writing to the configuration register, set/reset
                   required bits leaving reserved bits untouched. CR# 796813.
3.2     sk      02/05/15 Add SLCR reset in abort function as a workaround because
                                         controller does not update FIFO status flags as expected
                                         when thresholds are used.
3.3   sk  11/07/15 Modified the API prototypes according to MISRAC standards
                   to remove compilation warnings. CR# 868893.
3.5     tjs 13/08/18 Fixed compilation warnings for ARMCC.
3.6     akm 03/28/19 Fixed memory leak issue while reading from qspi.(CR#1016357)
3.6     akm 04/15/19 Modified the mask in XQspiPs_GetReadData() API to retrieve
             configuration register values of both the Flashes in dual
             parellel connection.
3.7     akm 11/19/19 Fixed Coverity unused value warning in XQspiPs_PolledTransfer()
                        and XQspiPs_Transfer() APIs.
3.7     akm 03/19/20 Modified XQspiPs_PolledTransfer(), XQspiPs_Transfer() and
                XQspiPs_InterruptHandler() APIs to fill TX FIFO with valid
                data when RX buffer is not NULL.
3.16 vn 08/26/26 Fix Doxygen warnings
3.16 tb 09/30/26 Align Doxygen comments with AMD documentation standards
 
#include "xqspips.h"

Macros

#define ARRAY_SIZE(Array)   (sizeof(Array) / sizeof((Array)[0]))
 Returns the number of elements in an array. More...
 
#define XPAR_PS7_QSPI_LINEAR_0_S_AXI_BASEADDR   0xFC000000
 Default LQSPI base address. More...
 

Functions

int XQspiPs_CfgInitialize (XQspiPs *InstancePtr, XQspiPs_Config *ConfigPtr, u32 EffectiveAddr)
 Initializes a specific XQspiPs instance such that the driver is ready to use. More...
 
void XQspiPs_Reset (XQspiPs *InstancePtr)
 Resets the QSPI device. More...
 
void XQspiPs_Abort (XQspiPs *InstancePtr)
 Aborts a transfer in progress by disabling the device and flushing the RxFIFO. More...
 
s32 XQspiPs_Transfer (XQspiPs *InstancePtr, u8 *SendBufPtr, u8 *RecvBufPtr, u32 ByteCount)
 Transfers specified data on the QSPI bus. More...
 
s32 XQspiPs_PolledTransfer (XQspiPs *InstancePtr, u8 *SendBufPtr, u8 *RecvBufPtr, u32 ByteCount)
 Transfers specified data on the QSPI bus in polled mode. More...
 
int XQspiPs_LqspiRead (XQspiPs *InstancePtr, u8 *RecvBufPtr, u32 Address, unsigned ByteCount)
 Reads the flash in Linear QSPI mode. More...
 
int XQspiPs_SetSlaveSelect (XQspiPs *InstancePtr)
 Selects the slave with which the master communicates. More...
 
void XQspiPs_SetStatusHandler (XQspiPs *InstancePtr, void *CallBackRef, XQspiPs_StatusHandler FuncPtr)
 Sets the status callback function, the status handler, which the driver calls when it encounters conditions that should be reported to upper layer software. More...
 
void XQspiPs_InterruptHandler (void *InstancePtr)
 Handles QSPI interrupts. More...