xilisf.h File Reference

#include "xparameters.h"

Data Structures

struct  XIsf
struct  XIsf_WriteParam
struct  XIsf_ReadParam
struct  XIsf_BufferWriteParam
struct  XIsf_BufferToFlashWriteParam
struct  XIsf_FlashToBufTransferParam
struct  XIsf_BufferReadParam

Defines

#define ATMEL   1
#define INTEL   2
#define STM   3
#define WINBOND   4
#define SPANSION   5
#define SST   6
#define XISF_MANUFACTURER_ID_ATMEL   0x1F
#define XISF_MANUFACTURER_ID_INTEL   0x89
#define XISF_MANUFACTURER_ID_STM   0x20
#define XISF_MANUFACTURER_ID_WINBOND   0xEF
#define XISF_MANUFACTURER_ID_SPANSION   0x01
#define XISF_MANUFACTURER_ID_SST   0xBF

Enumerations

enum  XIsf_WriteOperation {
  XISF_WRITE, XISF_AUTO_PAGE_WRITE, XISF_BUFFER_WRITE, XISF_BUF_TO_PAGE_WRITE_WITH_ERASE,
  XISF_BUF_TO_PAGE_WRITE_WITHOUT_ERASE, XISF_WRITE_STATUS_REG, XISF_OTP_WRITE, XISF_WRITE_STATUS_REG2
}
enum  XIsf_ReadOperation {
  XISF_READ, XISF_FAST_READ, XISF_PAGE_TO_BUF_TRANS, XISF_BUFFER_READ,
  XISF_FAST_BUFFER_READ, XISF_OTP_READ
}
enum  XIsf_EraseOperation { XISF_PAGE_ERASE, XISF_BLOCK_ERASE, XISF_SECTOR_ERASE, XISF_BULK_ERASE }
enum  XIsf_SpOperation {
  XISF_SPR_READ, XISF_SPR_WRITE, XISF_SPR_ERASE, XISF_SP_ENABLE,
  XISF_SP_DISABLE
}
enum  XIsf_IoctlOperation { XISF_IOCTL_RELEASE_DPD, XISF_IOCTL_ENTER_DPD, XISF_IOCTL_CLEAR_SR_FAIL_FLAGS, XISF_IOCTL_ENABLE_HI_PERF_MODE }

Functions

int XIsf_Initialize (XIsf *InstancePtr, XIsf_Iface *SpiInstPtr, u8 SlaveSelect, u8 *WritePtr)
int XIsf_GetStatus (XIsf *InstancePtr, u8 *ReadPtr)
int XIsf_GetDeviceInfo (XIsf *InstancePtr, u8 *ReadPtr)
int XIsf_Write (XIsf *InstancePtr, XIsf_WriteOperation Operation, void *OpParamPtr)
int XIsf_Read (XIsf *InstancePtr, XIsf_ReadOperation Operation, void *OpParamPtr)
int XIsf_Erase (XIsf *InstancePtr, XIsf_EraseOperation Operation, u32 Address)
int XIsf_SectorProtect (XIsf *InstancePtr, XIsf_SpOperation Operation, u8 *BufferPtr)
int XIsf_Ioctl (XIsf *InstancePtr, XIsf_IoctlOperation Operation)
int XIsf_WriteEnable (XIsf *InstancePtr, u8 WriteEnable)
int XIsf_SetSpiConfiguration (XIsf *InstancePtr, XIsf_Iface *SpiInstPtr, u32 Options, u8 PreScaler)

Detailed Description

The Xilinx In-system and Serial Flash (XilIsf) Library supports the Xilinx In-system Flash and, external Serial Flash Memories from Atmel (AT45XXXD), Intel (S33), ST Microelectronics (STM) (M25PXX), Winbond (W25QXX/W25XX), Numonyx (N25QXX) devices. Intel (S33) and STM (M25PXX) Serial Flash devices are now a part of Serial Flash devices provided by Numonyx.

This library also supports the Spansion (S25FLXX) devices, but this family hasn't been tested. The support for this family of devices is limited to the common commands supported by the other flash families

The following instructions are not supported in WinBond (W25QXX/W25XX) - Block Erase 32KB, Erase Suspend/Resume, Mode Bit Reset, Read Unique ID, and Read Manufacturer/Device ID.

The following instructions are not supported in Numonyx (N25QXX)- Erase Suspend/Resume, Read/Write Volatile/Non-volatile configuration register.

Library Description

The library enables higher layer software (e.g. an application) to communicate with the Serial Flash.

The library allows the user to Write, Read and Erase the Serial Flash. The user can also protect the data stored in the Serial Flash from unwarranted modification by enabling the Sector Protection feature. User can also perform different Control operations on Intel, STM (Numonyx), Winbond and Spansion Serial Flash devices.

The library supports interrupt driven mode and polled mode based on the mode in which the Spi driver is configured by the user.

This library can support multiple instances of Serial Flash at a time, provided they are of the same device family (either Atmel, Intel, STM or Spansion) as the device family is selected at compile time.

Device Operation

The Serial Flash operates as a slave device on the SPI bus, with Xilinx SPI core operating as the Master. The library uses XSpi driver for communicating with the Serial Flash.

Device Geometry

In Default Addressing mode the Atmel Serial Flash contains approximately 3% more Addressing memory than the Power-Of-2 addressing mode. The addressing mode of the Atmel Serial Flash can be known by reading the Device Status Register The ISF in the Xilinx devices is in Default-Addressing mode by default.

The following Atmel flash memories are supported by this library. AT45DB011D AT45DB021D AT45DB041D AT45DB081D AT45DB161D AT45DB321D AT45DB642D

The following Intel and STM flash memories are supported by this library. S3316MBIT S3332MBIT S3364MBIT

M25P05_A M25P10_A M25P20 M25P40 M25P80 M25P16 M25P32 M25P64 M25P128

The following Winbond flash memories are supported by this library. W25Q80 W25Q16 W25Q32 W25Q64 W25Q128 W25X10 W25X20 W25X40 W25X80 W25X16 W25X32 W25X64

The following Numonyx flash memories are supported by this library. N25Q32 N25Q64 N25Q128

The following Spansion flash memories are supported by this library. S25FL004 S25FL008 S25FL016 S25FL032 S25FL064 S25FL128/129

Support for new parts can be easily added, when they are available from vendors.

Library Initialization

The function call XIsf_Initialize() should be called by the application before using any other function in the library. This function will fetch the Manufacturer code and Device code and determine the geometry of the Serial Flash used.

Write Operations

The XIsf_Write() API is used to write data to the Serial Flash. A maximum of a Page of data can be written using this API. Once the user initiates a write operation, the Serial Flash takes time to complete the write operation internally. The user has to read the Status Register (XIsf_GetStatus) to know if the Serial Flash is still busy with a previously initiated operation before initiating a new one.

Using the XIsf_Write() API the user can perform several different types of write operations as mentioned below:

For Intel, STM (Numonyx), Winbond and Spansion Serial Flash devices, the user application must call the XIsf_WriteEnable() API by passing XISF_WRITE_ENABLE as an argument before calling the Isf_Write() API.

Read Operations

The XIsf_Read() API can be used to read a minimum of one byte and a maximum of an entire array of the Serial Flash depending on the type of read operation.

Using the XIsf_Read() API the user can perform several different types of read operations as mentioned below:

Erase Operations

The XIsf_Erase() API can be used to Erase the contents of the Serial Flash. Once the user initiates an Erase operation, the Serial Flash takes time to complete the Erase operation internally. The user has to read the Status Register to know if the Serial Flash is still busy with a previously initiated operation before initiating a new one.

Using the XIsf_Erase() API the user can perform four different types of Erase operations as mentioned below :

For Intel, STM, Winbond and Spansion Serial Flash the user application must call the XIsf_WriteEnable() API by passing XISF_WRITE_ENABLE as an argument before calling the XIsf_Erase() API.

Sector Protection Operations

The XIsf_SectorProtect() API can be used to perform Sector Protection related operations. The Serial Flash is divided into Sectors. Each Sector or number of Sectors can be protected from unwarranted writing/erasing.

Using the XIsf_SectorProtect() API the user can perform five different type of operations as given below:

For Intel, STM, Winbond and Spansion Serial Flash the user application must call the XIsf_WriteEnable() API by passing XISF_WRITE_ENABLE as an argument before calling the XIsf_SectorProtect() API for Sector Protect Register Write operation.

Device Control Operations

The XIsf_Ioctl() API can be used to perform control operations on the Intel, STM, Winbond and Spansion Serial Flash.

Using the XIsf_Ioctl() API the user can perform several different types of operations as given below:

Serial Flash Information Read

XIsf_GetDeviceInfo() API is used to read the Joint Electron Device Engineering Council (JEDEC) compatible device information. This JEDEC information consists of Manufacturer ID, Vendor-Specific Device family identifier, Vendor-Specific device identifier for the specified family, number of bits stored per memory cell, product version and number of additional Extended Device Information bytes.

Read the Spartan-3AN In-system Flash User Guide and the data sheets of Atmel-AT45XXXD/STM-M25PXX/Intel-S33/Winbond-W25QXX/W25XX/Spansion-S25FLXX for more information.

XIsf_GetStatus() API is used to read the Status Register of the Serial Flash. Winbond devices have a Status Register 2 which can be read using the XIsf_GetStatusReg2() API.

Write Enable/Disable Operations

For Intel, STM, Winbond and Spansion Serial Flash the user application must enable the Write to the Serial Flash by calling XIsf_WriteEnable (XISF_WRITE_ENABLE) API before doing any Write operations to the Serial Flash. Writing to the Serial Flash is disabled by calling XIsf_WriteEnable (XISF_WRITE_DISABLE) API.

Note:
This library is intended to be RTOS and processor independent. It works with physical addresses only. Any needs for dynamic memory management, threads, mutual exclusion, virtual memory or cache control must be satisfied by the layer above this driver.

This library supports the Spansion (S25FLXX) devices, but this family hasn't been tested. The support for this family of devices is limited to the common commands supported by the other flash families.

 MODIFICATION HISTORY:

 Ver   Who      Date     Changes
 ----- -------  -------- -----------------------------------------------
 1.00a ksu/sdm  03/03/08 First release
 2.00a ktn      11/27/09 Updated to use HAL processor APIs/definitions
 2.01a sdm      01/04/10 Added Support for Winbond W25Q80/16/32 devices
 2.01a sdm      06/17/10 Updated the Tcl to support axi_spi
 2.03a sdm      04/17/10 Updated to support Winbond memory W25Q128 and added
			  a list of supported flash memories
			  Updated the Tcl to support axi_quad_spi
 2.04a sdm      08/17/10 Updated to support Numonyx (N25QXX) and Spansion
			  flash memories
 3.00a srt	 06/20/12 Updated to support interfaces SPI PS and QSPI PS.
			  New API:
			  	XIsf_RegisterInterface()
				XIsf_SetSpiConfiguration()
				XIsf_SetOperatingMode()
			  Changed API:
			 	XIsf_Initialize()
				XIsf_Transfer()
			  Added support to SST flash.
 3.01a srt	 02/06/13 Updated for changes made in QSPIPS driver (CR 698107).
				      APIs changed:
					  XQspiPs_PolledTransfer()
					  XQspiPs_Transfer()
					  XQspiPs_SetSlaveSelect().
			  Modified the examples xilisf_spips_sst_intr_example.c
			  and xilisf_spips_sst_polled_example.c to correct
			  the flash write, erase and read logic. (CR 703816)
 3.02a srt	 04/25/13 - Added Bulk Erase command support for SST and 
			    Spansion flashes (CR 703816 & 711003).

 

Define Documentation

#define ATMEL   1
 

The following definitions specify the type of Serial Flash family. Based on the Serial Flash family selected, some part of the code is included or excluded in the In-system and Serial Flash Library. Atmel family device

#define INTEL   2
 

Intel family device

#define SPANSION   5
 

Spansion family device

#define SST   6
 

SST family device

#define STM   3
 

STM family device

#define WINBOND   4
 

Winbond family device

#define XISF_MANUFACTURER_ID_ATMEL   0x1F
 

The following definitions specify the Manufacturer Code for the different families of Serial Flash supported by this library. Atmel device

#define XISF_MANUFACTURER_ID_INTEL   0x89
 

Intel device

#define XISF_MANUFACTURER_ID_SPANSION   0x01
 

Spansion device

#define XISF_MANUFACTURER_ID_SST   0xBF
 

SST device

#define XISF_MANUFACTURER_ID_STM   0x20
 

STM device

#define XISF_MANUFACTURER_ID_WINBOND   0xEF
 

Winbond device


Enumeration Type Documentation

enum XIsf_EraseOperation
 

The following definitions determines the type of Erase operation to be performed on the Serial Flash.

Enumerator:
XISF_PAGE_ERASE  Page Erase operation
XISF_BLOCK_ERASE  Block Erase operation
XISF_SECTOR_ERASE  Sector Erase operation
XISF_BULK_ERASE  Erase an entire Flash

enum XIsf_IoctlOperation
 

The following definitions determines the type of control operations to be performed on the Serial Flash.

Enumerator:
XISF_IOCTL_RELEASE_DPD  Release from Deep Power-down
XISF_IOCTL_ENTER_DPD  Enter in to Deep Power-down mode
XISF_IOCTL_CLEAR_SR_FAIL_FLAGS  Clear Status Register Fail Flags
XISF_IOCTL_ENABLE_HI_PERF_MODE  Enable high performance mode (availabe in Winbond quad flash (W25Q))

enum XIsf_ReadOperation
 

The following definitions determines the type of Read operations to be performed on the Serial Flash.

Enumerator:
XISF_READ  Normal Read operation
XISF_FAST_READ  Fast Read operation
XISF_PAGE_TO_BUF_TRANS  Transfer data from Flash memory to internal SRAM buffer of Flash
XISF_BUFFER_READ  Read data from SRAM internal buffer of the Flash
XISF_FAST_BUFFER_READ  Fast SRAM buffer read operation on Flash
XISF_OTP_READ  Read One Time Programmable area

enum XIsf_SpOperation
 

The following definitions determines the type of Sector protection operations to be performed on the Serial Flash.

Enumerator:
XISF_SPR_READ  Sector protect register read
XISF_SPR_WRITE  Sector protect register write
XISF_SPR_ERASE  Sector protect register erase
XISF_SP_ENABLE  Sector protect enable
XISF_SP_DISABLE  Sector protect disable

enum XIsf_WriteOperation
 

The following definitions determines the type of Write operation to be performed on the Serial Flash.

Enumerator:
XISF_WRITE  Normal write operation
XISF_AUTO_PAGE_WRITE  Auto rewrite the contents of the page
XISF_BUFFER_WRITE  Write data to the internal SRAM buffer of the Flash
XISF_BUF_TO_PAGE_WRITE_WITH_ERASE  Erase the specified Page then Write data to Flash from the internal SRAM buffer
XISF_BUF_TO_PAGE_WRITE_WITHOUT_ERASE  Write data to the Flash from the internal SRAM buffer
XISF_WRITE_STATUS_REG  Write to the Status Register
XISF_OTP_WRITE  Write one byte of data in to the One Time Programmable area
XISF_WRITE_STATUS_REG2  Write to the 2 byte Status Register in W25QXX flash


Function Documentation

int XIsf_Erase XIsf InstancePtr,
XIsf_EraseOperation  Operation,
u32  Address
 

This API erases the contents of the specified memory in the Serial Flash.

Parameters:
InstancePtr is a pointer to the XIsf instance.
Operation is the type of Erase operation to be performed on the Serial Flash. The different operations are
  • XISF_PAGE_ERASE: Page Erase
  • XISF_BLOCK_ERASE: Block Erase
  • XISF_SECTOR_ERASE: Sector Erase
  • XISF_BULK_ERASE: Bulk Erase
Address is the address of the Page/Block/Sector to be erased. The address can be either Page address, Block address or Sector address based on the Erase operation to be performed.
Returns:
XST_SUCCESS if successful else XST_FAILURE.
Note:
  • The erased bytes will read as 0xFF.
  • For Intel, STM, Winbond or Spansion Serial Flash the user application must call XIsf_WriteEnable() API by passing XISF_WRITE_ENABLE as an argument before calling the XIsf_Erase() API.
  • Atmel Serial Flash support Page/Block/Sector Erase operations.
  • Intel, Winbond, Numonyx (N25QXX) and Spansion Serial Flash support Sector/Block/Bulk Erase operations.
  • STM (M25PXX) Serial Flash support Sector/Bulk Erase operations.

int XIsf_GetDeviceInfo XIsf InstancePtr,
u8 *  ReadPtr
 

This API reads the Joint Electron Device Engineering Council (JEDEC) information of the Serial Flash.

Parameters:
InstancePtr is a pointer to the XIsf instance.
ReadPtr is a pointer to the buffer where the Device information is copied.
Returns:
XST_SUCCESS if successful else XST_FAILURE.
Note:
The Device information is stored at the second byte pointed by the ReadPtr.

int XIsf_GetStatus XIsf InstancePtr,
u8 *  ReadPtr
 

This API reads the Serial Flash Status Register.

Parameters:
InstancePtr is a pointer to the XIsf instance.
ReadPtr is a pointer to the memory where the Status Register content is copied.
Returns:
XST_SUCCESS if successful else XST_FAILURE.
Note:
The contents of the Status Register is stored at the second byte pointed by the ReadPtr.

int XIsf_Initialize XIsf InstancePtr,
XIsf_Iface *  SpiInstPtr,
u8  SlaveSelect,
u8 *  WritePtr
 

The geometry of the underlying Serial Flash is determined by reading the Joint Electron Device Engineering Council (JEDEC) Device Information and the Status Register of the Serial Flash. This API when called initializes the SPI interface with default settings. With custom settings, user should call XIsf_SetSpiConfiguration() and then call this API.

Parameters:
InstancePtr is a pointer to the XIsf instance.
SpiInstPtr is a pointer to the XIsf_Iface instance to be worked on.
SlaveSelect is a 32-bit mask with a 1 in the bit position of the slave being selected. Only one slave can be selected at a time.
WritePtr is a pointer to the buffer allocated by the user to be used by the In-system and Serial Flash Library to perform any read/write operations on the Serial Flash device. User applications must pass the address of this buffer for the Library to work.
  • Write operations :
    • The size of this buffer should be equal to the Number of bytes to be written to the Serial Flash + XISF_CMD_MAX_EXTRA_BYTES.
    • The size of this buffer should be large enough for usage across all the applications that use a common instance of the Serial Flash.
    • A minimum of one byte and a maximum of ISF_PAGE_SIZE bytes can be written to the Serial Flash, through a single Write operation.
  • Read operations :
    • The size of this buffer should be equal to XISF_CMD_MAX_EXTRA_BYTES, if the application only reads from the Serial Flash (no write operations).
Returns:
- XST_SUCCESS if successful.
  • XST_DEVICE_IS_STOPPED if the device must be started before transferring data.
  • XST_FAILURE, otherwise.
Note:
- The XIsf_Initialize() API is a blocking call (for both polled and interrupt modes of the Spi driver). It reads the JEDEC information of the device and waits till the transfer is complete before checking if the information is valid.
  • This library can support multiple instances of Serial Flash at a time, provided they are of the same device family (either Atmel, Intel or STM, Winbond or Spansion) as the device family is selected at compile time.

int XIsf_Ioctl XIsf InstancePtr,
XIsf_IoctlOperation  Operation
 

This API configures and controls the Intel, STM, Winbond and Spansion Serial Flash.

Parameters:
InstancePtr is a pointer to the XIsf instance.
Operation is the type of Control operation to be performed on the Serial Flash. The different control operations are
  • XISF_RELEASE_DPD: Release from Deep Power Down (DPD) Mode
  • XISF_ENTER_DPD: Enter DPD Mode
  • XISF_CLEAR_SR_FAIL_FLAGS: Clear the Status Register Fail Flags
Returns:
XST_SUCCESS if successful else XST_FAILURE.
Note:
  • Atmel Serial Flash does not support any of these operations.
  • Intel Serial Flash support Enter/Release from DPD Mode and Clear Status Register Fail Flags.
  • STM, Winbond and Spansion Serial Flash support Enter/Release from DPD Mode.
  • Winbond (W25QXX) Serial Flash support Enable High Performance mode.

int XIsf_Read XIsf InstancePtr,
XIsf_ReadOperation  Operation,
void *  OpParamPtr
 

This API reads the data from the Serial Flash.

Parameters:
InstancePtr is a pointer to the XIsf instance.
Operation is the type of the read operation to be performed on the Serial Flash. The different operations are
  • XISF_READ: Normal Read
  • XISF_FAST_READ: Fast Read
  • XISF_PAGE_TO_BUF_TRANS: Page to Buffer Transfer
  • XISF_BUFFER_READ: Buffer Read
  • XISF_FAST_BUFFER_READ: Fast Buffer Read
  • XISF_OTP_READ: One Time Programmable Area (OTP) Read
  • XISF_DUAL_OP_FAST_READ: Dual Output Fast Read
  • XISF_DUAL_IO_FAST_READ: Dual Input/Output Fast Read
  • XISF_QUAD_OP_FAST_READ: Quad Output Fast Read
  • XISF_QUAD_IO_FAST_READ: Quad Input/Output Fast Read
OpParamPtr is the pointer to structure variable which contains operational parameter of specified Operation. This parameter type is dependant on the type of Operation to be performed.
  • Normal Read (XISF_READ), Fast Read (XISF_FAST_READ), One Time Programmable Area Read(XISF_OTP_READ), Dual Output Fast Read (XISF_CMD_DUAL_OP_FAST_READ), Dual Input/Output Fast Read (XISF_CMD_DUAL_IO_FAST_READ), Quad Output Fast Read (XISF_CMD_QUAD_OP_FAST_READ) and Quad Input/Output Fast Read (XISF_CMD_QUAD_IO_FAST_READ): The OpParamPtr must be of type struct XIsf_ReadParam. OpParamPtr->Address is start address in the Serial Flash. OpParamPtr->ReadPtr is a pointer to the memory where the data read from the Serial Flash is stored. OpParamPtr->NumBytes is number of bytes to read. OpParamPtr->NumDummyBytes is the number of dummy bytes to be transmitted for the Read command. This parameter is only used in case of Dual and Quad reads. Normal Read and Fast Read operations are supported for Atmel, Intel, STM, Winbond and Spansion Serial Flash. Dual and quad reads are supported for Winbond (W25QXX), Numonyx (N25QXX) and Spansion (S25FL129) quad flash. OTP Read operation is only supported in Intel Serial Flash.

  • Page To Buffer Transfer (XISF_PAGE_TO_BUF_TRANS): The OpParamPtr must be of type struct XIsf_FlashToBufTransferParam . OpParamPtr->BufferNum specifies the internal SRAM Buffer of the Serial Flash. The valid values are XISF_PAGE_BUFFER1 or XISF_PAGE_BUFFER2. XISF_PAGE_BUFFER2 is not valid in the case of AT45DB011D Flash as it contains a single buffer. OpParamPtr->Address is start address in the Serial Flash. This operation is only supported in Atmel Serial Flash.

  • Buffer Read (XISF_BUFFER_READ) and Fast Buffer Read (XISF_FAST_BUFFER_READ): The OpParamPtr must be of type struct XIsf_BufferReadParam. OpParamPtr->BufferNum specifies the internal SRAM Buffer of the Serial Flash. The valid values are XISF_PAGE_BUFFER1 or XISF_PAGE_BUFFER2. XISF_PAGE_BUFFER2 is not valid in case of AT45DB011D Flash as it contains a single buffer. OpParamPtr->ReadPtr is pointer to the memory where the data read from the SRAM buffer is to be stored. OpParamPtr->ByteOffset is byte offset in the SRAM buffer from where the first byte is read. OpParamPtr->NumBytes is the number of bytes to be read from the Buffer. These operations are supported only in Atmel Serial Flash.

Returns:
XST_SUCCESS if successful else XST_FAILURE.
Note:
  • Application must fill the structure elements of the third argument and pass its pointer by type casting it with void pointer.
  • The valid data is available from the fourth location pointed to by the ReadPtr for Normal Read and Buffer Read operations.
  • The valid data is available from the fifth location pointed to by the ReadPtr for Fast Read, Fast Buffer Read and OTP Read operations.
  • The valid data is available from the (4 + NumDummyBytes)th location pointed to by ReadPtr for Dual/Quad Read operations.

int XIsf_SectorProtect XIsf InstancePtr,
XIsf_SpOperation  Operation,
u8 *  BufferPtr
 

This API is used for performing Sector Protect related operations.

Parameters:
InstancePtr is a pointer to the XIsf instance.
Operation is the type of Sector Protect operation to be performed on the Serial Flash. The different operations are
  • XISF_SPR_READ: Read Sector Protection Register
  • XISF_SPR_WRITE: Write Sector Protection Register
  • XISF_SPR_ERASE: Erase Sector Protection Register
  • XISF_SP_ENABLE: Enable Sector Protection
  • XISF_SP_DISABLE: Disable Sector Protection
BufferPtr is a pointer to the memory where the SPR content is read to/written from. This argument can be NULL if the Operation is SprErase, SpEnable and SpDisable.
Returns:
XST_SUCCESS if successful else XST_FAILURE.
Note:
  • The SPR content is stored at the fourth location pointed by the BufferPtr when performing XISF_SPR_READ operation.
  • For Intel, STM, Winbond and Spansion Serial Flash, the user application must call the XIsf_WriteEnable() API by passing XISF_WRITE_ENABLE as an argument, before calling the XIsf_SectorProtect() API, for Sector Protect Register Write (XISF_SPR_WRITE) operation.
  • Atmel Flash supports all these Sector Protect operations.
  • Intel, STM, Winbond and Spansion Flash support only Sector Protect Read and Sector Protect Write operations.

int XIsf_SetSpiConfiguration XIsf InstancePtr,
XIsf_Iface *  SpiInstPtr,
u32  Options,
u8  PreScaler
 

This API sets the configuration of SPI. This will set the options and clock prescaler (if applicable).

Parameters:
InstancePtr is a pointer to the XIsf instance.
SpiInstPtr is a pointer to the XIsf_Iface instance to be worked on.
Options contains specified options to be set.
PreScaler is the value of the clock prescaler to set.
Returns:
XST_SUCCESS if successful else XST_FAILURE.
Note:
This API can be called before calling XIsf_Initialize() to initialize the SPI interface in other than default options mode. PreScaler is only applicable to PS SPI/QSPI.

int XIsf_Write XIsf InstancePtr,
XIsf_WriteOperation  Operation,
void *  OpParamPtr
 

This API writes the data to the Serial Flash.

Parameters:
InstancePtr is a pointer to the XIsf instance.
Operation is the type of write operation to be performed on the Serial Flash. The different operations are
  • XISF_WRITE: Normal Write
  • XISF_DUAL_IP_PAGE_WRITE: Dual Input Fast Program
  • XISF_DUAL_IP_EXT_PAGE_WRITE: Dual Input Extended Fast Program
  • XISF_QUAD_IP_PAGE_WRITE: Quad Input Fast Program
  • XISF_QUAD_IP_EXT_PAGE_WRITE: Quad Input Extended Fast Program
  • XISF_AUTO_PAGE_WRITE: Auto Page Write
  • XISF_BUFFER_WRITE: Buffer Write
  • XISF_BUF_TO_PAGE_WRITE_WITH_ERASE: Buffer to Page Transfer with Erase
  • XISF_BUF_TO_PAGE_WRITE_WITHOUT_ERASE: Buffer to Page Transfer without Erase
  • XISF_WRITE_STATUS_REG: Status Register Write
  • XISF_WRITE_STATUS_REG2: 2 byte Status Register Write
  • XISF_OTP_WRITE: OTP Write.
OpParamPtr is the pointer to a structure variable which contains operational parameters of the specified operation. This parameter type is dependant on value of first argument (Operation).
  • Normal Write (XISF_WRITE), Dual Input Fast Program (XISF_DUAL_IP_PAGE_WRITE), Dual Input Extended Fast Program (XISF_DUAL_IP_EXT_PAGE_WRITE), Quad Input Fast Program (XISF_QUAD_IP_PAGE_WRITE), Quad Input Extended Fast Program (XISF_QUAD_IP_EXT_PAGE_WRITE): The OpParamPtr must be of type struct XIsf_WriteParam. OpParamPtr->Address is the start address in the Serial Flash. OpParamPtr->WritePtr is a pointer to the data to be written to the Serial Flash. OpParamPtr->NumBytes is the number of bytes to be written to the Serial Flash. This operation is supported for Atmel, Intel, STM, Winbond and Spansion Serial Flash.

  • Auto Page Write (XISF_AUTO_PAGE_WRITE): The OpParamPtr must be of 32 bit unsigned integer variable. This is the address of page number in the Serial Flash which is to be refreshed. This operation is only supported for Atmel Serial Flash.

  • Buffer Write (XISF_BUFFER_WRITE): The OpParamPtr must be of type struct XIsf_BufferToFlashWriteParam. OpParamPtr->BufferNum specifies the internal SRAM Buffer of the Serial Flash. The valid values are XISF_PAGE_BUFFER1 or XISF_PAGE_BUFFER2. XISF_PAGE_BUFFER2 is not valid in the case of AT45DB011D Flash as it contains a single buffer. OpParamPtr->WritePtr is a pointer to the data to be written to the Serial Flash SRAM Buffer. OpParamPtr->ByteOffset is byte offset in the buffer from where the data is to be written. OpParamPtr->NumBytes is the number of bytes to be written to the Buffer. This operation is supported only for Atmel Serial Flash.

  • Buffer To Memory Write With Erase (XISF_BUF_TO_PAGE_WRITE_WITH_ERASE)/ Buffer To Memory Write Without Erase (XISF_BUF_TO_PAGE_WRITE_WITHOUT_ERASE): The OpParamPtr must be of type struct XIsf_BufferToFlashWriteParam. OpParamPtr->BufferNum specifies the internal SRAM Buffer of the Serial Flash. The valid values are XISF_PAGE_BUFFER1 or XISF_PAGE_BUFFER2. XISF_PAGE_BUFFER2 is not valid in the case of AT45DB011D Flash as it contains a single buffer. OpParamPtr->Address is starting address in the Serial Flash memory from where the data is to be written. These operations are only supported for Atmel Serial Flash.

  • Write Status Register (XISF_WRITE_STATUS_REG): The OpParamPtr must be of type of 8 bit unsigned integer variable. This is the value to be written to the Status Register. This operation is only supported for Intel, STM Winbond and Spansion Serial Flash.

  • Write Status Register2 (XISF_WRITE_STATUS_REG2): The OpParamPtr must be of type (u8 *) and should point to two 8 bit unsigned integer values. This is the value to be written to the 16 bit Status Register. This operation is only supported in Winbond (W25Q) Serial Flash.

  • One Time Programmable Area Write (XISF_OTP_WRITE): The OpParamPtr must be of type struct XIsf_WriteParam. OpParamPtr->Address is the address in the SRAM Buffer of the Serial Flash to which the data is to be written. OpParamPtr->WritePtr is a pointer to the data to be written to the Serial Flash. OpParamPtr->NumBytes should be set to 1 when performing OTPWrite operation. This operation is only supported for Intel Serial Flash.

Returns:
XST_SUCCESS if successful else XST_FAILURE.
Note:
  • Application must fill the structure elements of the third argument and pass its pointer by type casting it with void pointer.
  • For Intel, STM, Winbond and Spansion Serial Flash, the user application must call the XIsf_WriteEnable() API by passing XISF_WRITE_ENABLE as an argument, before calling the XIsf_Write() API.

int XIsf_WriteEnable XIsf InstancePtr,
u8  WriteEnable
 

This API Enables/Disables writes to the Intel, STM, Winbond and Spansion Serial Flash.

Parameters:
InstancePtr is a pointer to the XIsf instance.
WriteEnable specifies whether to Enable (XISF_CMD_ENABLE_WRITE) or Disable (XISF_CMD_DISABLE_WRITE) the writes to the Serial Flash.
Returns:
XST_SUCCESS if successful else XST_FAILURE.
Note:
This API works only for Intel, STM, Winbond and Spansion Serial Flash. If this API is called for Atmel Flash, XST_FAILURE is returned.


Generated on Thu Feb 13 14:38:18 2014 for 2014.1_doc by  doxygen 1.4.5