XIsf_Write - 2020.2 English

OS and Libraries Document Collection (UG643)

Document ID
UG643
Release Date
2020-11-24
Version
2020.2 English

This API writes the data to the Serial Flash.

Operations

  • 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 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 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 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 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.
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.

Prototype

int XIsf_Write(XIsf *InstancePtr, XIsf_WriteOperation Operation, void *OpParamPtr);

Parameters

The following table lists the XIsf_Write function arguments.

Table 1. XIsf_Write Arguments
Type Name Description
XIsf * InstancePtr Pointer to the XIsf instance.
XIsf_WriteOperation Operation 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.
void * OpParamPtr Pointer to a structure variable which contains operational parameters of the specified operation. This parameter type is dependant on value of first argument(Operation). For more details, refer Operations .

Returns

XST_SUCCESS if successful else XST_FAILURE.