xilflash
Vitis Drivers API Documentation
xilflash_readwrite_example.c File Reference

Overview

This file contains a design example using the Flash Library.

This example tests the Erase, Read and Write features. The Page is erased and data is written to the page. The data is read back and compared with the data written for correctness.

Note
The Erase operation on a CFI compliant Flash device will result in an error if the block is locked. This example performs an Unlock operation before Erase operation only on the Intel CFI compliant Flash device. The AMD CFI compliant Flash devices require the user to apply a 12V DC voltage on the RP pin while performing the Lock and Unlock operations. This example will not work with the AMD compliant Flash devices if the block is locked and the user doesn't perform an Unlock operation. Change the value of XFL_TO_ASYNCMODE to 1, inorder to operate the Micron Flash in async mode,if it was set to sync mode.
  MODIFICATION HISTORY:
  Ver   Who  Date     Changes


1.00a mta 10/09/07 First release 1.01a ksu 04/10/08 Added support for AMD CFI Interface 1.01a sdm 02/24/09 a) Added code to perform an Unlock operation before the Erase operation for Intel CFI compliant Flash devices b) Updated the notes with information about using the example with AMD CFI compliant Flash devices 2.00a ktn 12/04/09 Updated to use the HAL processor APIs/macros 3.00a sdm 03/03/11 Updated to pass BaseAddress and Flash Width to _Initialize API, as required by the new version of the library 4.2 nsk 01/07/16 Added Support to change Flash to Async Mode, if it was set to sync mode. Modified FLASH_BASE_ADDRESS to canonical name. 4.2 nsk 01/27/16 Added check to unlock the Micron G18 Flash. 4.7 akm 07/23/19 Initialized Status variable to XST_FAILURE. 4.10 akm 07/14/23 Added support for system device-tree flow.

*

Functions

int FlashReadWriteExample (void)
 This function writes, reads, and verifies the data to the Flash device. More...
 
int main (void)
 Main function to execute the Flash read write example. More...
 

Function Documentation

int FlashReadWriteExample ( void  )

This function writes, reads, and verifies the data to the Flash device.

Parameters
None
Returns
XST_SUCCESS if successful else XST_FAILURE.
Note
None.

References XFlash_Erase(), XFlash_Initialize(), XFlash_Read(), XFlash_Reset(), XFlash_Unlock(), and XFlash_Write().

Referenced by main().

int main ( void  )

Main function to execute the Flash read write example.

Parameters
None
Returns
XST_SUCCESS if successful else XST_FAILURE.
Note
None.

References FlashReadWriteExample().