- Main Page
- Data Structures
- Files
- Directories

- File List
- Globals

# xilisf_write.c File Reference

`#include "include/xilisf.h"`

## Functions
int | XIsf_Write (XIsf *InstancePtr, XIsf_WriteOperation Operation, void *OpParamPtr)

## Detailed Description

This file contains the library functions to write to the Serial Flash devices. Refer xilisf.h for detailed description.

     MODIFICATION HISTORY:

     Ver   Who      Date     Changes
     ----- -------  -------- -----------------------------------------------
     1.00a ksu/sdm  03/03/08 First release
     2.01a sdm      01/04/10 Added Support for Winbond W25QXX/W25XX devices
     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.
    			  Added support to SST flash on SPI PS interface.

## Function Documentation

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.