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 doesnot 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.
#include "xqspips.h"
Classes | |
struct | XQspiPsInstFormat |
Functions | |
int | XQspiPs_CfgInitialize (XQspiPs *InstancePtr, XQspiPs_Config *ConfigPtr, u32 EffectiveAddr) |
void | XQspiPs_Reset (XQspiPs *InstancePtr) |
void | XQspiPs_Abort (XQspiPs *InstancePtr) |
int | XQspiPs_Transfer (XQspiPs *InstancePtr, u8 *SendBufPtr, u8 *RecvBufPtr, unsigned ByteCount) |
int | XQspiPs_PolledTransfer (XQspiPs *InstancePtr, u8 *SendBufPtr, u8 *RecvBufPtr, unsigned ByteCount) |
int | XQspiPs_LqspiRead (XQspiPs *InstancePtr, u8 *RecvBufPtr, u32 Address, unsigned ByteCount) |
int | XQspiPs_SetSlaveSelect (XQspiPs *InstancePtr) |
void | XQspiPs_SetStatusHandler (XQspiPs *InstancePtr, void *CallBackRef, XQspiPs_StatusHandler FuncPtr) |
void | XQspiPs_InterruptHandler (void *InstancePtr) |
|
Aborts a transfer in progress by disabling the device and flush the RxFIFO. The byte counts are cleared, the busy flag is cleared.
|
|
Initializes a specific XQspiPs instance such that the driver is ready to use. The state of the device after initialization is:
|
|
The interrupt handler for QSPI interrupts. This function must be connected by the user to an interrupt controller. The interrupts that are handled are:
|
|
Read the flash in Linear QSPI mode.
|
|
Transfers specified data on the QSPI bus in polled mode. The caller has the option of providing two different buffers for send and receive, or one buffer for both send and receive, or no buffer for receive. The receive buffer must be at least as big as the send buffer to prevent unwanted memory writes. This implies that the byte count passed in as an argument must be the smaller of the two buffers if they differ in size. Here are some sample usages: XQspiPs_PolledTransfer(InstancePtr, SendBuf, RecvBuf, ByteCount) The caller wishes to send and receive, and provides two different buffers for send and receive.
XQspiPs_PolledTransfer(InstancePtr, SendBuf, NULL, ByteCount) The caller wishes only to send and does not care about the received data. The driver ignores the received data in this case.
XQspiPs_PolledTransfer(InstancePtr, SendBuf, SendBuf, ByteCount) The caller wishes to send and receive, but provides the same buffer for doing both. The driver sends the data and overwrites the send buffer with received data as it transfers the data.
XQspiPs_PolledTransfer(InstancePtr, RecvBuf, RecvBuf, ByteCount) The caller wishes to only receive and does not care about sending data. In this case, the caller must still provide a send buffer, but it can be the same as the receive buffer if the caller does not care what it sends. The device must send N bytes of data if it wishes to receive N bytes of data.
|
|
Resets the QSPI device. Reset must only be called after the driver has been initialized. Any data transfer that is in progress is aborted. The upper layer software is responsible for re-configuring (if necessary) and restarting the QSPI device after the reset.
|
|
Selects the slave with which the master communicates. The user is not allowed to select the slave while a transfer is in progress.
|
|
Sets the status callback function, the status handler, which the driver calls when it encounters conditions that should be reported to upper layer software. The handler executes in an interrupt context, so it must minimize the amount of processing performed. One of the following status events is passed to the status handler.
XST_SPI_TRANSFER_DONE The requested data transfer is done
XST_SPI_TRANSMIT_UNDERRUN As a slave device, the master clocked data but there were none available in the transmit register/FIFO. This typically means the slave application did not issue a transfer request fast enough, or the processor/driver could not fill the transmit register/FIFO fast enough.
XST_SPI_RECEIVE_OVERRUN The QSPI device lost data. Data was received but the receive data register/FIFO was full.
|
|
Transfers specified data on the QSPI bus. Initiates bus communication and sends/receives data to/from the selected QSPI slave. For every byte sent, a byte is received. The caller has the option of providing two different buffers for send and receive, or one buffer for both send and receive, or no buffer for receive. The receive buffer must be at least as big as the send buffer to prevent unwanted memory writes. This implies that the byte count passed in as an argument must be the smaller of the two buffers if they differ in size. Here are some sample usages: XQspiPs_Transfer(InstancePtr, SendBuf, RecvBuf, ByteCount) The caller wishes to send and receive, and provides two different buffers for send and receive.
XQspiPs_Transfer(InstancePtr, SendBuf, NULL, ByteCount) The caller wishes only to send and does not care about the received data. The driver ignores the received data in this case.
XQspiPs_Transfer(InstancePtr, SendBuf, SendBuf, ByteCount) The caller wishes to send and receive, but provides the same buffer for doing both. The driver sends the data and overwrites the send buffer with received data as it transfers the data.
XQspiPs_Transfer(InstancePtr, RecvBuf, RecvBuf, ByteCount) The caller wishes to only receive and does not care about sending data. In this case, the caller must still provide a send buffer, but it can be the same as the receive buffer if the caller does not care what it sends. The device must send N bytes of data if it wishes to receive N bytes of data.Although this function takes entire buffers as arguments, the driver can only transfer a limited number of bytes at a time, limited by the size of the FIFO. A call to this function only starts the transfer, then subsequent transfers of the data is performed by the interrupt service routine until the entire buffer has been transferred. The status callback function is called when the entire buffer has been sent/received. This function is non-blocking. The SetSlaveSelect function must be called prior to this function.
|