xilflash
Vitis Drivers API Documentation
xilflash.c File Reference

Overview

This file contains the library functions to Initialize, Read, Write, Erase, Lock and Unlock the Parallel Flash Device.

The family specific functionalities are implemented in DeviceControl API. Refer xilflash.h for detailed description.

Note
None
MODIFICATION HISTORY:
Ver   Who  Date     Changes


1.00a rmm 10/20/07 First release 1.00a mta 10/25/07 Updated to flash library 1.01a ksu 04/10/08 Added support for AMD CFI Interface 1.02a ksu 06/16/09 Added support for multiple banks in Intel flash. Added support for Xilinx Platform Flash XL. If the user selects to use the Xilinx Platform Flash XL then it is set to Async mode during the initialization. If the user wants to use it in Sync mode then it can be done using the XFlash_DeviceControl API. 2.00a ktn 12/04/09 Updated to use the HAL processor APIs/macros. 3.00a sdm 03/03/11 Removed static parameters in mld and updated code to determine these parameters from the CFI data. 3.01a srt 03/02/12 Added support for Micron G18 Flash device to fix CRs 648372, 648282. 3.02a srt 05/30/12 Changed Implementation for Micron G18 Flash, which fixes the CR 662317. CR 662317 Description - Xilinx Platform Flash on ML605 fails to work. 4.4 ms 08/03/17 Added tags and modified comment lines style for doxygen. 4.10 akm 07/14/23 Added support for system device-tree flow.

Functions

int XFlash_Initialize (XFlash *InstancePtr, u32 BaseAddress, u8 BusWidth, int IsPlatformFlash)
 This function initializes a specific XFlash instance. More...
 
int XFlash_Read (XFlash *InstancePtr, u32 Offset, u32 Bytes, void *DestPtr)
 This function reads the data from the Flash device and copies it into the specified user buffer. More...
 
int XFlash_Write (XFlash *InstancePtr, u32 Offset, u32 Bytes, void *SrcPtr)
 This function programs the flash device(s) with data specified in the user buffer. More...
 
int XFlash_Erase (XFlash *InstancePtr, u32 Offset, u32 Bytes)
 This function erases the specified address range in the flash device. More...
 
int XFlash_Lock (XFlash *InstancePtr, u32 Offset, u32 Bytes)
 This function Locks the blocks in the specified range of the flash device(s). More...
 
int XFlash_Unlock (XFlash *InstancePtr, u32 Offset, u32 Bytes)
 This function Unlocks the blocks in the specified range of the flash device(s). More...
 
int XFlash_Reset (XFlash *InstancePtr)
 This function resets the flash device and places it in read mode. More...
 
int XFlash_DeviceControl (XFlash *InstancePtr, u32 Command, DeviceCtrlParam *Parameters)
 This function is used to execute device specific commands. More...
 
int XFlash_IsReady (XFlash *InstancePtr)
 This function checks the readiness of the device, which means it has been successfully initialized. More...
 
int XFlashGeometry_ToAbsolute (XFlashGeometry *InstancePtr, u16 Region, u16 Block, u32 BlockOffset, u32 *AbsoluteOffsetPtr)
 Converts block coordinates to a part offset. More...
 
int XFlashGeometry_ToBlock (XFlashGeometry *InstancePtr, u32 AbsoluteOffset, u16 *RegionPtr, u16 *BlockPtr, u32 *BlockOffsetPtr)
 Converts part offset block coordinates. More...
 

Function Documentation

int XFlashGeometry_ToAbsolute ( XFlashGeometry *  InstancePtr,
u16  Region,
u16  Block,
u32  BlockOffset,
u32 *  AbsoluteOffsetPtr 
)

Converts block coordinates to a part offset.

Region, Block, & BlockOffset are converted to PartOffset

Parameters
InstancePtris the pointer to the XFlash instance.
Regionis the erase region the physical address appears in.
Blockis the block within Region the physical address appears in.
BlockOffsetis the offset within Block where the physical address appears.
AbsoluteOffsetPtris the returned offset value.
Returns
  • XST_SUCCESS if successful.
  • XFLASH_ADDRESS_ERROR if the block coordinates are invalid.
Note
None.
int XFlashGeometry_ToBlock ( XFlashGeometry *  InstancePtr,
u32  AbsoluteOffset,
u16 *  RegionPtr,
u16 *  BlockPtr,
u32 *  BlockOffsetPtr 
)

Converts part offset block coordinates.

PartOffset is converted to Region, Block & BlockOffset

Parameters
InstancePtris the pointer to the XFlashGeometry.
AbsoluteOffsetis the offset within part to find block coordinates for.
RegionPtris the region that corresponds to AbsoluteOffset. This is a return parameter.
BlockPtris the block within Region that corresponds to AbsoluteOffset. This is a return parameter.
BlockOffsetPtris the offset within Block that corresponds to AbsoluteOffset. This is a return parameter.
Returns
  • XST_SUCCESS if successful.
  • XFLASH_ADDRESS_ERROR if the block coordinates are invalid.
Note
None.