xilsfl
Vitis Drivers API Documentation
overview

Data Structures

struct  XSfl_Msg
 This typedef contains configuration information for a flash message. More...
 
struct  XSfl_FlashInfo
 This typedef contains configuration information for the flash device. More...
 
struct  XSfl_CntrlInfo
 This typedef contains configuration information for the device. More...
 
struct  XSfl_Interface
 This typedef contains interface information for a sfl library. More...
 
struct  XSfl
 This typedef contains information of the sfl library. More...
 
union  XSfl_UserConfig
 This typedef contains configuration information for a flash/controller device. More...
 
struct  XFlashInfo
 This typedef contains configuration information for a flash Device. More...
 

Macros

#define XSFL_RXADDR_OVER_32BIT   0x100000000U
 Rx address over 32 bit. More...
 
#define XSFL_CONFIG_REG2_VOLATILE_ADDR_MX   0x00000300
 Controller Type. More...
 
#define XSFL_OSPI_CNTRL   0x01
 Flag to use DMA or not. More...
 
#define XSFL_BROKEN_DMA   0x01
 Max Byte count in Stig Mode. More...
 
#define XILSFL_CONTROL_H
 < prevent circular inclusions More...
 

Functions

u32 XSfl_FlashIdRead (XSfl_Interface *SflInstancePtr, u8 ChipSelNum, u8 *SflReadBuffer)
 Reads the flash ID and identifies the flash in FCT table. More...
 
u32 XSfl_CalculateFCTIndex (u32 ReadId, u32 *FCTIndex)
 This function used to Identifies the flash in FCT table. More...
 
u32 XSfl_FlashSetSDRDDRMode (XSfl_Interface *SflInstancePtr, int Mode, u8 *SflReadBuffer)
 This API enters the flash device into Octal DDR mode or exit from octal DDR mode (switches to Extended SPI mode). More...
 
u32 XSfl_FlashEnterExit4BAddMode (XSfl_Interface *SflInstancePtr, int Enable, u8 ChipSelNum)
 This API enters the flash device into 4 bytes addressing mode. More...
 
u32 XSfl_GetRealAddr (XSfl_Interface *SflInstancePtr, u32 Address)
 This functions translates the address based on the type of interconnection. More...
 
u32 XSfl_SectorErase (XSfl_Interface *SflInstancePtr, u32 Address)
 This function used to erase the sectors of the serial nor flash connected to the specific interface. More...
 
u32 XSfl_FlashPageWrite (XSfl_Interface *SflInstancePtr, u32 Address, u32 ByteCount, u8 *WriteBfrPtr)
 This function writes to the serial nor flash connected to the specific interface. More...
 
u32 XSfl_FlashReadProcess (XSfl_Interface *SflInstancePtr, u32 Address, u32 ByteCount, u8 *ReadBfrPtr, u64 RxAddr64bit)
 This function performs read from the serial nor flash connected to specific interface. More...
 
u32 XSfl_FlashTransferDone (XSfl_Interface *SflInstancePtr)
 This function used to check read completion status the serial Flash connected to the Specific interface. More...
 
u32 XSfl_WaitforStatusDone (XSfl_Interface *SflInstancePtr)
 This API can be used to read status of the flash status register. More...
 
u32 XSfl_FlashRegisterReadWrite (XSfl_Interface *SflInstancePtr, u8 *RxBfrPtr, u8 *TxBfrPtr, u32 *CmdBufferPtr, u8 Addrvalid)
 This API can be used to Read/write to a flash register. More...
 
u32 XSfl_FlashCmdTransfer (XSfl_Interface *SflInstancePtr, u8 Cmd)
 This API can be used to transfer the command to the flash. More...
 
u32 XSfl_FlashNonBlockingReadProcess (XSfl_Interface *SflInstancePtr, u32 Address, u32 ByteCount, u8 *ReadBfrPtr, u64 RxAddr64bit)
 This function performs non-blocking read from the serial nor flash connected to specific interface. More...
 

Variables

u64 XSfl_Msg::RxAddr64bit
 Provide 64-bit read address for 32-bit platform. More...
 
u32 XSfl_Msg::ByteCount
 Number of bytes to read or write. More...
 
u32 XSfl_Msg::Addr
 Device Address. More...
 
u8 * XSfl_Msg::TxBfrPtr
 Write buffer pointer. More...
 
u8 * XSfl_Msg::RxBfrPtr
 Read buffer pointer. More...
 
u8 XSfl_Msg::Opcode
 Opcode/Command. More...
 
u8 XSfl_Msg::Dummy
 Number of dummy cycles for opcode. More...
 
u8 XSfl_Msg::Xfer64bit
 Set to 1 when reading from 64-bit addr otherwise 0. More...
 
u8 XSfl_Msg::DualByteOpCode
 Extended opcode in dual-byte opcode mode. More...
 
u8 XSfl_Msg::Addrsize
 Size of address in bytes. More...
 
u8 XSfl_Msg::Addrvalid
 1 if Address is required for opcode, 0 otherwise More...
 
u8 XSfl_Msg::Proto
 Indicate number of Cmd-Addr-Data lines. More...
 
u32 XSfl_FlashInfo::FlashIndex
 Index in the flash_info structure. More...
 
u8 XSfl_FlashInfo::ConnectionMode
 Type of connection (single/stacked/parallel) More...
 
u8 XSfl_FlashInfo::FlashMake
 vendor info More...
 
u8 XSfl_FlashInfo::AddrSize
 Size of address in bytes. More...
 
u32 * XSfl_CntrlInfo::DeviceIdData
 Contains Device Id Data information. More...
 
u32 XSfl_CntrlInfo::OpMode
 Operating Mode DAC or INDAC. More...
 
u32 XSfl_CntrlInfo::RefClockHz
 Input clock frequency. More...
 
u8 XSfl_CntrlInfo::DeviceId
 ID of controller device. More...
 
u8 XSfl_CntrlInfo::ChipSelectNum
 Chip select information. More...
 
u8 XSfl_CntrlInfo::SdrDdrMode
 Edge mode can be SDR or DDR. More...
 
u8 XSfl_CntrlInfo::CntrlType
 Type of the interface controller. More...
 
u8 XSfl_CntrlInfo::BusWidth
 Bus width available on board. More...
 
u32(* XSfl_CntrlInfo::RxTunning )()
 Callback reference for Rx tuning. More...
 
u32(* XSfl_CntrlInfo::SelectFlash )(u8 ChipSelNum)
 Callback reference for chip select. More...
 
u32(* XSfl_CntrlInfo::Transfer )(u8 Index, XSfl_Msg *SflMsg)
 Callback reference for interface transfer function. More...
 
u32(* XSfl_CntrlInfo::NonBlockingTransfer )(u8 Index, XSfl_Msg *SflMsg)
 Callback reference for interface non blocking transfer function. More...
 
u32(* XSfl_CntrlInfo::SetSdrDdr )(u8 Mode, u8 DualByteOpCode)
 Callback reference for controller configs. More...
 
u32(* XSfl_CntrlInfo::TransferDone )(u8 Index)
 Callback reference for flash read status. More...
 
u32(* XSfl_CntrlInfo::DeviceReset )(u8 Type)
 Callback reference for Device reset. More...
 
XSfl_CntrlInfo XSfl_Interface::CntrlInfo
 Controller specific information. More...
 
XSfl_FlashInfo XSfl_Interface::SflFlashInfo
 Flash Specific information. More...
 
u32 XSfl_Interface::Quirks
 Quirks to handle specific use cases. More...
 
u32 XSfl_UserConfig::Ospi_Conig::BaseAddress
 Base address of the device. More...
 
u8 XSfl_UserConfig::Ospi_Conig::ReadMode
 Operating Mode DAC or INDAC. More...
 
u8 XSfl_UserConfig::Ospi_Conig::ChipSelect
 Chip select information. More...
 
u32 XSfl_UserConfig::Ospi_Conig::Quirks
 Quirks to handle specific use cases. More...
 
u32 XFlashInfo::Proto
 Indicate number of Cmd-Addr-Data lines. More...
 
u32 XFlashInfo::SdrMaxFreq
 Max support frequency of flash in SDR mode. More...
 
u8 XFlashInfo::FSRFlag
 Indicates Flag Status Register. More...
 
u8 XFlashInfo::ExtOpCodeType
 Extended opcode in dual-byte opcode mode. More...
 
u8 XFlashInfo::FlashType
 Indicates the type of the flash device. More...
 

Dual Byte opcode selection

#define XSFL_DUAL_BYTE_OP_DISABLE   0x00
 Macros to enable/disable Dual Byte opcode. More...
 
#define XSFL_DUAL_BYTE_OP_INVERT   0x01
 
#define XSFL_DUAL_BYTE_OP_SAME   0x02
 

Edge mode selection

#define XSFL_EDGE_MODE_SDR_PHY   0x0U
 Macros to select different edge modes like SDR+NON-PHY, SDR+PHY and DDR+PHY. More...
 
#define XSFL_EDGE_MODE_SDR_NON_PHY   0x1U
 
#define XSFL_EDGE_MODE_DDR_PHY   0x2U
 

Chip Select selection

#define XSFL_SELECT_FLASH_CS0   0
 Macros to select CS0 and CS1. More...
 
#define XSFL_SELECT_FLASH_CS1   1
 

Connection mode selection

#define XSFL_CONNECTION_MODE_SINGLE   0x0U
 Macros to select SINGLE, STACKED and PARALLEL connection modes. More...
 
#define XSFL_CONNECTION_MODE_STACKED   0x1U
 

Prototype(Bus width: Cmd_Addr_Data) selection

typedef union XSfl_UserConfig XSfl_UserConfig
 This typedef contains configuration information for a flash/controller device. More...
 
u32 XSfl_FlashInit (u8 *SflHandler, XSfl_UserConfig SflUserOptions, u8 ControllerInfo)
 This function initializes controller interface and serial nor flash connected. More...
 
u32 XSfl_FlashErase (u8 SflHandler, u32 Address, u32 ByteCount)
 This function erases the serial nor flash connected to the specific interface. More...
 
u32 XSfl_FlashWrite (u8 SflHandler, u32 Address, u32 ByteCount, u8 *WriteBfrPtr)
 This function writes to the serial nor flash connected to the interface driver. More...
 
u32 XSfl_FlashReadStart (u8 SflHandler, u32 Address, u32 ByteCount, u8 *ReadBfrPtr, u64 RxAddr64bit)
 This function reads from the flash connected to the specific interface. More...
 
u32 XSfl_FlashReadDone (u8 SflHandler)
 This function used to check read completion status of serial Flash connected to the Specific interface. More...
 
u32 XSfl_FlashGetInfo (u8 SflHandler, u8 Option, u32 *DataPtr)
 This function used to get details serial Flash connected to the Specific interface. More...
 
u32 XSfl_FlashRead (u8 SflHandler, u32 Address, u32 ByteCount, u8 *ReadBfrPtr, u64 RxAddr64bit)
 This function performs read from the flash. More...
 
#define XSFL_FLASH_PROTO_1_1_1   0U
 Macros to select Read and Write prototype. More...
 
#define XSFL_FLASH_PROTO_1_0_1   1U
 
#define XSFL_FLASH_PROTO_1_1_2   2U
 
#define XSFL_FLASH_PROTO_1_1_8   3U
 
#define XSFL_FLASH_PROTO_1_8_8   4U
 
#define XSFL_FLASH_PROTO_8_8_8   5U
 
#define XSFL_FLASH_PROTO_8_0_0   6U
 
#define XSFL_FLASH_PROTO_8_8_0   7U
 
#define XSFL_FLASH_PROTO_8_0_8   8U
 
#define XSFL_FLASH_PROTO_1_1_4   9U
 
#define XSFL_FLASH_PROTO_4_4_4   10U
 
#define XSFL_FLASH_ID   0U /* Flash Device jdec_id */
 
#define XSFL_DEVICE_SIZE
 
#define XSFL_SECT_SIZE
 
#define XSFL_PAGE_SIZE
 
#define XSFL_FLASH_TYPE   4U /* Flash Type (QSPI/OSPI) */
 
#define XSFL_X1_BUS_WIDTH   0x01
 
#define XSFL_X2_BUS_WIDTH   0x02
 
#define XSFL_X4_BUS_WIDTH   0x04
 
#define XSFL_X8_BUS_WIDTH   0x08
 

Macro Definition Documentation

#define XILSFL_CONTROL_H

< prevent circular inclusions

by using protection macros

#define XSFL_BROKEN_DMA   0x01

Max Byte count in Stig Mode.

Referenced by SflReadWriteExample(), XSfl_FlashNonBlockingReadProcess(), and XSfl_FlashReadProcess().

#define XSFL_CONFIG_REG2_VOLATILE_ADDR_MX   0x00000300

Controller Type.

#define XSFL_CONNECTION_MODE_SINGLE   0x0U

Macros to select SINGLE, STACKED and PARALLEL connection modes.

#define XSFL_DUAL_BYTE_OP_DISABLE   0x00

Macros to enable/disable Dual Byte opcode.

Referenced by XSfl_FlashSetSDRDDRMode().

#define XSFL_EDGE_MODE_SDR_PHY   0x0U

Macros to select different edge modes like SDR+NON-PHY, SDR+PHY and DDR+PHY.

Referenced by XSfl_FlashInit().

#define XSFL_FLASH_PROTO_1_1_1   0U

Macros to select Read and Write prototype.

Referenced by XSfl_FlashIdRead().

#define XSFL_OSPI_CNTRL   0x01

Flag to use DMA or not.

Referenced by SflReadWriteExample(), and XSfl_FlashInit().

#define XSFL_RXADDR_OVER_32BIT   0x100000000U

Rx address over 32 bit.

Referenced by XSfl_FlashNonBlockingReadProcess(), and XSfl_FlashReadProcess().

#define XSFL_SELECT_FLASH_CS0   0

Macros to select CS0 and CS1.

Referenced by SflReadWriteExample(), XSfl_FlashSetSDRDDRMode(), and XSfl_GetRealAddr().

Typedef Documentation

This typedef contains configuration information for a flash/controller device.

The user is required to allocate a variable of this type. A variable of this type is then passed to the library API functions.

Function Documentation

u32 XSfl_CalculateFCTIndex ( u32  ReadId,
u32 *  FCTIndex 
)

This function used to Identifies the flash in FCT table.

Returns
XST_SUCCESS if successful, otherwise XST_FAILURE.

Referenced by XSfl_FlashIdRead().

u32 XSfl_FlashCmdTransfer ( XSfl_Interface SflInstancePtr,
u8  Cmd 
)

This API can be used to transfer the command to the flash.

Parameters
SflInstancePtris a pointer to the interface driver component to use.
Cmdis the command to be transfered to the flash.
Returns
XST_SUCCESS if successful, else error code.
Note
This API can only be used for one flash at a time.

References XSfl_Msg::Addr, XSfl_Msg::Addrsize, XSfl_Msg::Addrvalid, XSfl_Msg::ByteCount, XSfl_Interface::CntrlInfo, XSfl_CntrlInfo::DeviceId, XSfl_Msg::DualByteOpCode, XSfl_Msg::Dummy, XSfl_FlashInfo::FlashIndex, XSfl_Msg::Opcode, XSfl_Msg::Proto, XSfl_Msg::RxBfrPtr, XSfl_CntrlInfo::SdrDdrMode, XSfl_Interface::SflFlashInfo, XSfl_CntrlInfo::Transfer, and XSfl_Msg::TxBfrPtr.

Referenced by XSfl_FlashEnterExit4BAddMode(), XSfl_FlashPageWrite(), XSfl_FlashSetSDRDDRMode(), and XSfl_SectorErase().

u32 XSfl_FlashEnterExit4BAddMode ( XSfl_Interface SflInstancePtr,
int  Enable,
u8  ChipSelNum 
)

This API enters the flash device into 4 bytes addressing mode.

As per the Micron spec, before issuing the command to enter into 4 byte addr mode, a write enable command is issued.

Parameters
SflInstancePtris a pointer to the XSfl_Interface driver component to use.
Enableis a either 1 or 0 if 1 then enters 4 byte if 0 exits.
ChipSelNumis the chip select number.
Returns
- XST_SUCCESS if successful.
  • error code if it fails.

References XSfl_Interface::CntrlInfo, XSfl_FlashInfo::ConnectionMode, XSfl_FlashInfo::FlashIndex, XSfl_FlashInfo::FlashMake, XFlashInfo::FlashType, XSfl_CntrlInfo::SelectFlash, XSfl_Interface::SflFlashInfo, XSfl_FlashCmdTransfer(), and XSfl_WaitforStatusDone().

Referenced by XSfl_FlashInit().

u32 XSfl_FlashErase ( u8  SflHandler,
u32  Address,
u32  ByteCount 
)

This function erases the serial nor flash connected to the specific interface.

Parameters
SflHandleris a pointer to the Sfl interface component to use.
Addressis the sector offset address of the flash at which data to be erased.
ByteCountcontains the total size to be erased.
Returns
XST_SUCCESS if successful, else error code.

References XSfl_Interface::SflFlashInfo, and XSfl_SectorErase().

Referenced by SflReadWriteExample().

u32 XSfl_FlashGetInfo ( u8  SflHandler,
u8  Option,
u32 *  DataPtr 
)

This function used to get details serial Flash connected to the Specific interface.

Parameters
SflHandleris a pointer to the Sfl interface driver component to use.
Optionis to get specific details of the flash.
DataPtris the pointer to the flash info to be copied.
Returns
XST_SUCCESS if successful, else error code.

References XSfl_FlashInfo::FlashIndex, XFlashInfo::FlashType, and XSfl_Interface::SflFlashInfo.

Referenced by SflReadWriteExample().

u32 XSfl_FlashIdRead ( XSfl_Interface SflInstancePtr,
u8  ChipSelNum,
u8 *  SflReadBuffer 
)

Reads the flash ID and identifies the flash in FCT table.

Parameters
SflInstancePtris a pointer to the XSfl_Interface driver component to use.
ChipSelNumis the chip select number.
SflReadBufferis pointer to the read buffer to store flash id.
Returns
XST_SUCCESS if successful, otherwise error code.

References XSfl_Msg::Addrsize, XSfl_Msg::Addrvalid, XSfl_Msg::ByteCount, XSfl_Interface::CntrlInfo, XSfl_CntrlInfo::DeviceId, XSfl_CntrlInfo::DeviceIdData, XSfl_Msg::Dummy, XSfl_FlashInfo::FlashIndex, XSfl_FlashInfo::FlashMake, XFlashInfo::FlashType, XSfl_Msg::Opcode, XSfl_Msg::Proto, XSfl_Msg::RxBfrPtr, XSfl_CntrlInfo::SelectFlash, XSfl_Interface::SflFlashInfo, XSfl_CntrlInfo::Transfer, XSfl_Msg::TxBfrPtr, XSfl_CalculateFCTIndex(), and XSFL_FLASH_PROTO_1_1_1.

Referenced by XSfl_FlashInit().

u32 XSfl_FlashInit ( u8 *  SflHandler,
XSfl_UserConfig  SflUserOptions,
u8  ControllerInfo 
)

This function initializes controller interface and serial nor flash connected.

Parameters
SflUserOptionscontains the controller and flash configuration info.
ControllerInfocontains the type of controller.
Returns
SFL index on successful initialization, else Error codes.

References XSfl_FlashInfo::AddrSize, XSfl_CntrlInfo::BusWidth, XSfl_CntrlInfo::ChipSelectNum, XSfl_Interface::CntrlInfo, XSfl_CntrlInfo::CntrlType, XSfl_FlashInfo::ConnectionMode, XSfl_CntrlInfo::DeviceReset, XSfl_FlashInfo::FlashIndex, XFlashInfo::FlashType, XSfl_CntrlInfo::RefClockHz, XSfl_CntrlInfo::SdrDdrMode, XFlashInfo::SdrMaxFreq, XSfl_Interface::SflFlashInfo, XSFL_EDGE_MODE_SDR_PHY, XSfl_FlashEnterExit4BAddMode(), XSfl_FlashIdRead(), XSfl_FlashSetSDRDDRMode(), and XSFL_OSPI_CNTRL.

Referenced by SflReadWriteExample().

u32 XSfl_FlashNonBlockingReadProcess ( XSfl_Interface SflInstancePtr,
u32  Address,
u32  ByteCount,
u8 *  ReadBfrPtr,
u64  RxAddr64bit 
)

This function performs non-blocking read from the serial nor flash connected to specific interface.

Parameters
Sfl_Handleris a index to the XSfl interface component to use.
Addresscontains the address of the flash that needs to be read.
ByteCountcontains the total size to be erased.
ReadBfrPtris the pointer to the read buffer to which valid received data should be written
RxAddr64bitis of the 64bit address of destination read buffer to which valid received data should be written.
Returns
XST_SUCCESS if successful, else Error code.

References XSfl_Msg::Addr, XSfl_Msg::Addrsize, XSfl_FlashInfo::AddrSize, XSfl_Msg::Addrvalid, XSfl_CntrlInfo::BusWidth, XSfl_Msg::ByteCount, XSfl_Interface::CntrlInfo, XSfl_FlashInfo::ConnectionMode, XSfl_CntrlInfo::DeviceId, XSfl_Msg::DualByteOpCode, XSfl_Msg::Dummy, XSfl_FlashInfo::FlashIndex, XSfl_FlashInfo::FlashMake, XSfl_CntrlInfo::NonBlockingTransfer, XSfl_Msg::Opcode, XSfl_CntrlInfo::OpMode, XFlashInfo::Proto, XSfl_Msg::Proto, XSfl_Interface::Quirks, XSfl_Msg::RxAddr64bit, XSfl_Msg::RxBfrPtr, XSfl_CntrlInfo::SdrDdrMode, XSfl_Interface::SflFlashInfo, XSfl_CntrlInfo::TransferDone, XSfl_Msg::TxBfrPtr, XSfl_Msg::Xfer64bit, XSFL_BROKEN_DMA, XSfl_GetRealAddr(), and XSFL_RXADDR_OVER_32BIT.

Referenced by XSfl_FlashReadStart().

u32 XSfl_FlashPageWrite ( XSfl_Interface SflInstancePtr,
u32  Address,
u32  ByteCount,
u8 *  WriteBfrPtr 
)

This function writes to the serial nor flash connected to the specific interface.

Parameters
Sfl_Handleris a index to the Sfl interface component to use.
Addresscontains the address of the first page which needs to be written.
ByteCountcontains the number of bytes to write.
WriteBfrPtris Pointer to the write buffer (which is to be transmitted)
Returns
XST_SUCCESS if successful, else Error code.

References XSfl_Msg::Addr, XSfl_Msg::Addrsize, XSfl_FlashInfo::AddrSize, XSfl_Msg::Addrvalid, XSfl_Msg::ByteCount, XSfl_Interface::CntrlInfo, XSfl_CntrlInfo::DeviceId, XSfl_Msg::DualByteOpCode, XSfl_Msg::Dummy, XSfl_FlashInfo::FlashIndex, XSfl_Msg::Opcode, XSfl_Msg::Proto, XSfl_Msg::RxBfrPtr, XSfl_CntrlInfo::SdrDdrMode, XSfl_Interface::SflFlashInfo, XSfl_CntrlInfo::Transfer, XSfl_Msg::TxBfrPtr, XSfl_FlashCmdTransfer(), XSfl_GetRealAddr(), and XSfl_WaitforStatusDone().

Referenced by XSfl_FlashWrite().

u32 XSfl_FlashRead ( u8  SflHandler,
u32  Address,
u32  ByteCount,
u8 *  ReadBfrPtr,
u64  RxAddr64bit 
)

This function performs read from the flash.

Parameters
SflHandleris a index to the Sfl interface component to use.
Addresscontains the address of the flash that needs to be read.
ByteCountcontains the total size to be erased.
ReadBfrPtris the pointer to the read buffer to which valid received data should be written
RxAddr64bitis of the 64bit address of destination read buffer to which valid received data should be written.
Returns
XST_SUCCESS if successful, else error code.

References XSfl_FlashReadProcess().

Referenced by SflReadWriteExample().

u32 XSfl_FlashReadDone ( u8  SflHandler)

This function used to check read completion status of serial Flash connected to the Specific interface.

Parameters
SflHandleris a pointer to the Sfl interface driver component to use.
Returns
XST_SUCCESS if successful, else error code.

References XSfl_FlashTransferDone().

Referenced by SflReadWriteExample().

u32 XSfl_FlashReadProcess ( XSfl_Interface SflInstancePtr,
u32  Address,
u32  ByteCount,
u8 *  ReadBfrPtr,
u64  RxAddr64bit 
)

This function performs read from the serial nor flash connected to specific interface.

Parameters
Sfl_Handleris a index to the XSfl interface component to use.
Addresscontains the address of the flash that needs to be read.
ByteCountcontains the total size to be erased.
ReadBfrPtris the pointer to the read buffer to which valid received data should be written
RxAddr64bitis of the 64bit address of destination read buffer to which valid received data should be written.
Returns
XST_SUCCESS if successful, else Error code.

References XSfl_Msg::Addr, XSfl_Msg::Addrsize, XSfl_FlashInfo::AddrSize, XSfl_Msg::Addrvalid, XSfl_CntrlInfo::BusWidth, XSfl_Msg::ByteCount, XSfl_Interface::CntrlInfo, XSfl_FlashInfo::ConnectionMode, XSfl_CntrlInfo::DeviceId, XSfl_Msg::DualByteOpCode, XSfl_Msg::Dummy, XSfl_FlashInfo::FlashIndex, XSfl_FlashInfo::FlashMake, XSfl_Msg::Opcode, XSfl_CntrlInfo::OpMode, XFlashInfo::Proto, XSfl_Msg::Proto, XSfl_Interface::Quirks, XSfl_Msg::RxAddr64bit, XSfl_Msg::RxBfrPtr, XSfl_CntrlInfo::SdrDdrMode, XSfl_Interface::SflFlashInfo, XSfl_CntrlInfo::Transfer, XSfl_Msg::TxBfrPtr, XSfl_Msg::Xfer64bit, XSFL_BROKEN_DMA, XSfl_GetRealAddr(), and XSFL_RXADDR_OVER_32BIT.

Referenced by XSfl_FlashRead().

u32 XSfl_FlashReadStart ( u8  SflHandler,
u32  Address,
u32  ByteCount,
u8 *  ReadBfrPtr,
u64  RxAddr64bit 
)

This function reads from the flash connected to the specific interface.

Parameters
SflHandleris a index to the Sfl interface component to use.
Addresscontains the address of the flash that needs to be read.
ByteCountcontains the total size to be erased.
ReadBfrPtris the pointer to the read buffer to which valid received data should be written
RxAddr64bitis of the 64bit address of destination read buffer to which valid received data should be written.
Returns
XST_SUCCESS if successful, else error code.

References XSfl_FlashNonBlockingReadProcess().

Referenced by SflReadWriteExample().

u32 XSfl_FlashRegisterReadWrite ( XSfl_Interface SflInstancePtr,
u8 *  RxBfrPtr,
u8 *  TxBfrPtr,
u32 *  CmdBufferPtr,
u8  Addrvalid 
)

This API can be used to Read/write to a flash register.

Parameters
SflInstancePtris a pointer to the interface driver component to use.
RxBfrPtris the pointer to store the read value from flash.
TxBfrPtris the pointer to value to be written into flash.
CmdBufferPtris the pointer that holds command, address and dummy.
Addrvaliddefines the specific read/write requires address or not.
Returns
XST_SUCCESS if successful, else error code.
Note
This API can only be used for one flash at a time.

References XSfl_Msg::Addr, XSfl_Msg::Addrsize, XSfl_Msg::Addrvalid, XSfl_Msg::ByteCount, XSfl_Interface::CntrlInfo, XSfl_CntrlInfo::DeviceId, XSfl_Msg::DualByteOpCode, XSfl_Msg::Dummy, XSfl_FlashInfo::FlashIndex, XSfl_Msg::Opcode, XSfl_Msg::Proto, XSfl_Msg::RxBfrPtr, XSfl_CntrlInfo::SdrDdrMode, XSfl_Interface::SflFlashInfo, XSfl_CntrlInfo::Transfer, and XSfl_Msg::TxBfrPtr.

Referenced by XSfl_FlashSetSDRDDRMode().

u32 XSfl_FlashSetSDRDDRMode ( XSfl_Interface SflInstancePtr,
int  Mode,
u8 *  SflReadBuffer 
)

This API enters the flash device into Octal DDR mode or exit from octal DDR mode (switches to Extended SPI mode).

Parameters
SflInstancePtris a pointer to the XSfl_Interface driver component to use.
Modeis either 1 or 0 if 1 then enter octal DDR mode if 0 exits.
Returns
- XST_SUCCESS if successful.
  • error code if it fails.

References XSfl_Interface::CntrlInfo, XSfl_FlashInfo::ConnectionMode, XFlashInfo::ExtOpCodeType, XSfl_FlashInfo::FlashIndex, XFlashInfo::FlashType, XSfl_CntrlInfo::SdrDdrMode, XSfl_CntrlInfo::SelectFlash, XSfl_CntrlInfo::SetSdrDdr, XSfl_Interface::SflFlashInfo, XSFL_DUAL_BYTE_OP_DISABLE, XSfl_FlashCmdTransfer(), XSfl_FlashRegisterReadWrite(), and XSFL_SELECT_FLASH_CS0.

Referenced by XSfl_FlashInit().

u32 XSfl_FlashTransferDone ( XSfl_Interface SflInstancePtr)

This function used to check read completion status the serial Flash connected to the Specific interface.

Parameters
Sfl_Handleris a pointer to the XSfl interface driver component to use.
Returns
XST_SUCCESS if successful, else error code.

References XSfl_Interface::CntrlInfo, and XSfl_CntrlInfo::TransferDone.

Referenced by XSfl_FlashReadDone().

u32 XSfl_FlashWrite ( u8  SflHandler,
u32  Address,
u32  ByteCount,
u8 *  WriteBfrPtr 
)

This function writes to the serial nor flash connected to the interface driver.

Parameters
SflHandleris a index to the Sfl interface component to use.
Addresscontains the address to write data to in the Flash.
ByteCountcontains the number of bytes to be write.
WriteBfrPtris Pointer to the write buffer (which is to be transmitted)
Returns
XST_SUCCESS if successful, else error code.

References XSfl_Interface::SflFlashInfo, and XSfl_FlashPageWrite().

Referenced by SflReadWriteExample().

u32 XSfl_GetRealAddr ( XSfl_Interface SflInstancePtr,
u32  Address 
)

This functions translates the address based on the type of interconnection.

In case of stacked, this function asserts the corresponding slave select.

Parameters
SflInstancePtris a pointer to the interface driver component to use.
Addresswhich is to be accessed (for erase, write or read)
Returns
RealAddr is the translated address - for single it is unchanged; for stacked, the lower flash size is subtracted;
Note
In addition to get the actual address to work on flash this function also selects the CS based on the configuration detected.

References XSfl_Interface::CntrlInfo, XSfl_FlashInfo::ConnectionMode, XSfl_FlashInfo::FlashIndex, XSfl_CntrlInfo::SelectFlash, XSfl_Interface::SflFlashInfo, and XSFL_SELECT_FLASH_CS0.

Referenced by XSfl_FlashNonBlockingReadProcess(), XSfl_FlashPageWrite(), XSfl_FlashReadProcess(), and XSfl_SectorErase().

u32 XSfl_SectorErase ( XSfl_Interface SflInstancePtr,
u32  Address 
)

This function used to erase the sectors of the serial nor flash connected to the specific interface.

Parameters
Sfl_Handleris a pointer to the XSfl interface component to use.
Addresscontains the address of the first sector which needs to be erased.
Returns
XST_SUCCESS if successful, else error code.

References XSfl_Msg::Addr, XSfl_Msg::Addrsize, XSfl_FlashInfo::AddrSize, XSfl_Msg::Addrvalid, XSfl_Msg::ByteCount, XSfl_Interface::CntrlInfo, XSfl_CntrlInfo::DeviceId, XSfl_Msg::DualByteOpCode, XSfl_Msg::Dummy, XSfl_FlashInfo::FlashIndex, XSfl_Msg::Opcode, XSfl_Msg::Proto, XSfl_Msg::RxBfrPtr, XSfl_CntrlInfo::SdrDdrMode, XSfl_Interface::SflFlashInfo, XSfl_CntrlInfo::Transfer, XSfl_Msg::TxBfrPtr, XSfl_FlashCmdTransfer(), XSfl_GetRealAddr(), and XSfl_WaitforStatusDone().

Referenced by XSfl_FlashErase().

u32 XSfl_WaitforStatusDone ( XSfl_Interface SflInstancePtr)

This API can be used to read status of the flash status register.

Parameters
SflInstancePtris a pointer to the interface driver component to use.
Returns
XST_SUCCESS if successful, else error code.
Note
This API can only be used for one flash at a time.

References XSfl_Msg::Addr, XSfl_Msg::Addrsize, XSfl_Msg::Addrvalid, XSfl_Msg::ByteCount, XSfl_Interface::CntrlInfo, XSfl_CntrlInfo::DeviceId, XSfl_Msg::DualByteOpCode, XSfl_Msg::Dummy, XSfl_FlashInfo::FlashIndex, XSfl_Msg::Opcode, XSfl_Msg::Proto, XSfl_Msg::RxBfrPtr, XSfl_CntrlInfo::SdrDdrMode, XSfl_Interface::SflFlashInfo, XSfl_CntrlInfo::Transfer, and XSfl_Msg::TxBfrPtr.

Referenced by XSfl_FlashEnterExit4BAddMode(), XSfl_FlashPageWrite(), and XSfl_SectorErase().

Variable Documentation

u8 XSfl_FlashInfo::AddrSize
u32 XSfl_UserConfig::Ospi_Conig::BaseAddress

Base address of the device.

u8 XSfl_CntrlInfo::BusWidth

Bus width available on board.

Referenced by XSfl_FlashInit(), XSfl_FlashNonBlockingReadProcess(), and XSfl_FlashReadProcess().

u8 XSfl_UserConfig::Ospi_Conig::ChipSelect

Chip select information.

u8 XSfl_CntrlInfo::ChipSelectNum

Chip select information.

Referenced by XSfl_FlashInit().

u8 XSfl_CntrlInfo::CntrlType

Type of the interface controller.

Referenced by XSfl_FlashInit().

u8 XSfl_FlashInfo::ConnectionMode
u32* XSfl_CntrlInfo::DeviceIdData

Contains Device Id Data information.

  • Is used for configuring SDR/DDR mode

Referenced by XSfl_FlashIdRead().

u32(* XSfl_CntrlInfo::DeviceReset)(u8 Type)

Callback reference for Device reset.

Referenced by XSfl_FlashInit().

u8 XFlashInfo::ExtOpCodeType

Extended opcode in dual-byte opcode mode.

Referenced by XSfl_FlashSetSDRDDRMode().

u8 XFlashInfo::FlashType
u8 XFlashInfo::FSRFlag

Indicates Flag Status Register.

u32(* XSfl_CntrlInfo::NonBlockingTransfer)(u8 Index, XSfl_Msg *SflMsg)

Callback reference for interface non blocking transfer function.

Referenced by XSfl_FlashNonBlockingReadProcess().

u32 XSfl_CntrlInfo::OpMode

Operating Mode DAC or INDAC.

Referenced by XSfl_FlashNonBlockingReadProcess(), and XSfl_FlashReadProcess().

u32 XFlashInfo::Proto

Indicate number of Cmd-Addr-Data lines.

Referenced by XSfl_FlashNonBlockingReadProcess(), and XSfl_FlashReadProcess().

u32 XSfl_Interface::Quirks

Quirks to handle specific use cases.

Referenced by XSfl_FlashNonBlockingReadProcess(), and XSfl_FlashReadProcess().

u32 XSfl_UserConfig::Ospi_Conig::Quirks

Quirks to handle specific use cases.

u8 XSfl_UserConfig::Ospi_Conig::ReadMode

Operating Mode DAC or INDAC.

u32 XSfl_CntrlInfo::RefClockHz

Input clock frequency.

Referenced by XSfl_FlashInit().

u64 XSfl_Msg::RxAddr64bit

Provide 64-bit read address for 32-bit platform.

Referenced by XSfl_FlashNonBlockingReadProcess(), and XSfl_FlashReadProcess().

u32(* XSfl_CntrlInfo::RxTunning)()

Callback reference for Rx tuning.

u32 XFlashInfo::SdrMaxFreq

Max support frequency of flash in SDR mode.

Referenced by XSfl_FlashInit().

u32(* XSfl_CntrlInfo::SelectFlash)(u8 ChipSelNum)

Callback reference for chip select.

Referenced by XSfl_FlashEnterExit4BAddMode(), XSfl_FlashIdRead(), XSfl_FlashSetSDRDDRMode(), and XSfl_GetRealAddr().

u32(* XSfl_CntrlInfo::SetSdrDdr)(u8 Mode, u8 DualByteOpCode)

Callback reference for controller configs.

Referenced by XSfl_FlashSetSDRDDRMode().

u32(* XSfl_CntrlInfo::Transfer)(u8 Index, XSfl_Msg *SflMsg)
u32(* XSfl_CntrlInfo::TransferDone)(u8 Index)

Callback reference for flash read status.

Referenced by XSfl_FlashNonBlockingReadProcess(), and XSfl_FlashTransferDone().

u8 XSfl_Msg::Xfer64bit

Set to 1 when reading from 64-bit addr otherwise 0.

Referenced by XSfl_FlashNonBlockingReadProcess(), and XSfl_FlashReadProcess().