![]() |
qspipsu
Xilinx SDK Drivers API Documentation
|
This file contains a design example using the QSPIPSU driver (XQspiPsu) with a serial Flash device greater than or equal to 128Mb.
The example writes to flash and reads it back in DMA mode. This examples runs with GENFIFO Manual start. It runs in polled mode. This example illustrates single, parallel and stacked modes. Both the flash devices have to be of the same make and size. The hardware which this example runs on, must have a serial Flash (Micron N25Q or Spansion S25FL) for it to run. In order to test in single, parallel or stacked flash configurations the necessary HW must be present and QSPI_MODE (also reflected in ConnectionMode in the instance) has to be in sync with HW flash configuration being tested.
This example has been tested with the Micron Serial Flash (N25Q512) in single and parallel modes using A53 and R5 processors.
None.
MODIFICATION HISTORY:
Ver Who Date Changes
1.0 hk 08/21/14 First release sk 06/17/15 Used Tx/Rx flags for Transmitting/Receiving. sk 11/23/15 Added Support for Macronix 1Gb part. ms 04/05/17 Modified Comment lines in functions to recognize it as documentation block for doxygen generation. 1.1 tjs 06/16/17 Added support for IS25LP256D flash part (PR-4650) 1.5 tjs 09/15/17 Replaced #ifdef COMMENTS to #if USE_FOUR_BYTE (CR-984966) 1.6 tjs 10/16/17 #ifdef COMMENT replaced with the flow similar to u-boot and linux for accessing flash parts with size more then 16MB (CR-984966) *
Functions | |
int | QspiPsuPolledFlashExample (XQspiPsu *QspiPsuInstancePtr, u16 QspiPsuDeviceId) |
The purpose of this function is to illustrate how to use the XQspiPsu device driver in single, parallel and stacked modes using flash devices greater than or equal to 128Mb. More... | |
int | FlashReadID (XQspiPsu *QspiPsuPtr) |
Reads the flash ID and identifies the flash in FCT table. More... | |
int | FlashErase (XQspiPsu *QspiPsuPtr, u32 Address, u32 ByteCount, u8 *WriteBfrPtr) |
This function erases the sectors in the serial Flash connected to the QSPIPSU interface. More... | |
int | FlashWrite (XQspiPsu *QspiPsuPtr, u32 Address, u32 ByteCount, u8 Command, u8 *WriteBfrPtr) |
This function writes to the serial Flash connected to the QSPIPSU interface. More... | |
int | FlashRead (XQspiPsu *QspiPsuPtr, u32 Address, u32 ByteCount, u8 Command, u8 *WriteBfrPtr, u8 *ReadBfrPtr) |
This function performs read. More... | |
u32 | GetRealAddr (XQspiPsu *QspiPsuPtr, u32 Address) |
This functions translates the address based on the type of interconnection. More... | |
int | BulkErase (XQspiPsu *QspiPsuPtr, u8 *WriteBfrPtr) |
This functions performs a bulk erase operation when the flash device has a single die. More... | |
int | DieErase (XQspiPsu *QspiPsuPtr, u8 *WriteBfrPtr) |
This functions performs a die erase operation on all the die in the flash device. More... | |
int | FlashRegisterRead (XQspiPsu *QspiPsuPtr, u32 ByteCount, u8 Command, u8 *ReadBfrPtr) |
This API can be used to write to a flash register. More... | |
int | FlashRegisterWrite (XQspiPsu *QspiPsuPtr, u32 ByteCount, u8 Command, u8 *WriteBfrPtr, u8 WrEn) |
This API can be used to write to a flash register. More... | |
int | FlashEnterExit4BAddMode (XQspiPsu *QspiPsuPtr, unsigned int Enable) |
This API enters the flash device into 4 bytes addressing mode. More... | |
int | main (void) |
Main function to call the QSPIPSU Flash Polled example. More... | |
int BulkErase | ( | XQspiPsu * | QspiPsuPtr, |
u8 * | WriteBfrPtr | ||
) |
This functions performs a bulk erase operation when the flash device has a single die.
Works for both Spansion and Micron
QspiPsuPtr | is a pointer to the QSPIPSU driver component to use. |
WritBfrPtr | is the pointer to command+address to be sent |
int DieErase | ( | XQspiPsu * | QspiPsuPtr, |
u8 * | WriteBfrPtr | ||
) |
This functions performs a die erase operation on all the die in the flash device.
This function uses the die erase command for Micron 512Mbit and 1Gbit
QspiPsuPtr | is a pointer to the QSPIPSU driver component to use. |
WritBfrPtr | is the pointer to command+address to be sent |
int FlashEnterExit4BAddMode | ( | XQspiPsu * | QspiPsuPtr, |
unsigned int | Enable | ||
) |
This API enters the flash device into 4 bytes addressing mode.
As per the Micron and ISSI spec, before issuing the command to enter into 4 byte addr mode, a write enable command is issued. For Macronix and Winbond flash parts write enable is not required.
QspiPtr | is a pointer to the QSPIPSU driver component to use. |
Enable | is a either 1 or 0 if 1 then enters 4 byte if 0 exits. |
int FlashErase | ( | XQspiPsu * | QspiPsuPtr, |
u32 | Address, | ||
u32 | ByteCount, | ||
u8 * | WriteBfrPtr | ||
) |
This function erases the sectors in the serial Flash connected to the QSPIPSU interface.
QspiPtr | is a pointer to the QSPIPSU driver component to use. |
Address | contains the address of the first sector which needs to be erased. |
ByteCount | contains the total size to be erased. |
Pointer | to the write buffer (which is to be transmitted) |
int FlashRead | ( | XQspiPsu * | QspiPsuPtr, |
u32 | Address, | ||
u32 | ByteCount, | ||
u8 | Command, | ||
u8 * | WriteBfrPtr, | ||
u8 * | ReadBfrPtr | ||
) |
This function performs read.
DMA is the default setting.
QspiPtr | is a pointer to the QSPIPSU driver component to use. |
Address | contains the address of the first sector which needs to be erased. |
ByteCount | contains the total size to be erased. |
Command | is the command used to read data from the flash. Supports normal, fast, dual and quad read commands. |
Pointer | to the write buffer which contains data to be transmitted |
Pointer | to the read buffer to which valid received data should be written |
int FlashReadID | ( | XQspiPsu * | QspiPsuPtr | ) |
Reads the flash ID and identifies the flash in FCT table.
None. |
int FlashRegisterRead | ( | XQspiPsu * | QspiPsuPtr, |
u32 | ByteCount, | ||
u8 | Command, | ||
u8 * | ReadBfrPtr | ||
) |
This API can be used to write to a flash register.
QspiPsuPtr | is a pointer to the QSPIPSU driver component to use. |
ByteCount | is the number of bytes to write. |
Command | is specific register write command. |
WriteBfrPtr | is the pointer to value to be written. |
WrEn | is a flag to mention if WREN has to be sent before write. |
int FlashRegisterWrite | ( | XQspiPsu * | QspiPsuPtr, |
u32 | ByteCount, | ||
u8 | Command, | ||
u8 * | WriteBfrPtr, | ||
u8 | WrEn | ||
) |
This API can be used to write to a flash register.
QspiPsuPtr | is a pointer to the QSPIPSU driver component to use. |
ByteCount | is the number of bytes to write. |
Command | is specific register write command. |
WriteBfrPtr | is the pointer to value to be written. |
WrEn | is a flag to mention if WREN has to be sent before write. |
int FlashWrite | ( | XQspiPsu * | QspiPsuPtr, |
u32 | Address, | ||
u32 | ByteCount, | ||
u8 | Command, | ||
u8 * | WriteBfrPtr | ||
) |
This function writes to the serial Flash connected to the QSPIPSU interface.
All the data put into the buffer must be in the same page of the device with page boundaries being on 256 byte boundaries.
QspiPsuPtr | is a pointer to the QSPIPSU driver component to use. |
Address | contains the address to write data to in the Flash. |
ByteCount | contains the number of bytes to write. |
Command | is the command used to write data to the flash. QSPIPSU device supports only Page Program command to write data to the flash. |
Pointer | to the write buffer (which is to be transmitted) |
u32 GetRealAddr | ( | XQspiPsu * | QspiPsuPtr, |
u32 | Address | ||
) |
This functions translates the address based on the type of interconnection.
In case of stacked, this function asserts the corresponding slave select.
QspiPsuPtr | is a pointer to the QSPIPSU driver component to use. |
Address | which is to be accessed (for erase, write or read) |
References XQspiPsu::Config, and XQspiPsu_Config::ConnectionMode.
int main | ( | void | ) |
Main function to call the QSPIPSU Flash Polled example.
None |
References QspiPsuPolledFlashExample().
int QspiPsuPolledFlashExample | ( | XQspiPsu * | QspiPsuInstancePtr, |
u16 | QspiPsuDeviceId | ||
) |
The purpose of this function is to illustrate how to use the XQspiPsu device driver in single, parallel and stacked modes using flash devices greater than or equal to 128Mb.
This function reads data in DMA mode.
None. |
Referenced by main().