XIsf_Initialize - 2020.2 English

OS and Libraries Document Collection (UG643)

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

This API when called initializes the SPI interface with default settings.

With custom settings, user should call XIsf_SetSpiConfiguration() and then call this API. 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.

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.

Prototype

int XIsf_Initialize(XIsf *InstancePtr, XIsf_Iface *SpiInstPtr, u8 SlaveSelect, u8 *WritePtr);

Parameters

The following table lists the XIsf_Initialize function arguments.

Table 1. XIsf_Initialize Arguments
Type Name Description
XIsf * InstancePtr Pointer to the XIsf instance.
XIsf_Iface * SpiInstPtr Pointer to XIsf_Iface instance to be worked on.
u8 SlaveSelect It is a 32-bit mask with a 1 in the bit position of slave being selected. Only one slave can be selected at a time.
u8 * WritePtr 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.