nandpsu
Xilinx SDK Drivers API Documentation
xnandpsu_example.c File Reference

Overview

This file contains a design example using the NAND driver (XNandPsu).

This example tests the erase, read and write features of the controller. The flash is erased and written. The data is read back and compared with the data written for correctness.

Note

None.

 MODIFICATION HISTORY:
 Ver   Who  Date        Changes


1.0 nm 05/06/2014 First release. ms 04/10/17 Modified Comment lines to follow doxygen rules. 1.4 nsk 10/04/2018 Added support for ICCARM Compiler.

Functions

s32 NandReadWriteExample (u16 NandDeviceId)
 This function runs a test on the NAND flash device using the basic driver functions in polled mode. More...
 
u8 ReadBuffer[TEST_BUF_SIZE] __attribute__ ((aligned(64)))
 Block sized Read buffer. More...
 
s32 main (void)
 Main function to execute the Nand Flash read write example. More...
 

Function Documentation

u8 ReadBuffer [TEST_BUF_SIZE] __attribute__ ( (aligned(64))  )

Block sized Read buffer.

Block sized write buffer.

s32 main ( void  )

Main function to execute the Nand Flash read write example.

Parameters
None.
Returns
  • XST_SUCCESS if the example has completed successfully.
  • XST_FAILURE if the example has failed.
Note
None.

References NandReadWriteExample().

s32 NandReadWriteExample ( u16  NandDeviceId)

This function runs a test on the NAND flash device using the basic driver functions in polled mode.

The function does the following tasks:

  • Initialize the driver.
  • Erase the flash.
  • Write data to the flash.
  • Read back the data from the flash.
  • Compare the data read against the data Written.
Parameters
NandDeviceIdis is the XPAR_<NAND_instance>_DEVICE_ID value from xparameters.h.
Returns
  • XST_SUCCESS if successful.
  • XST_FAILURE if failed.
Note
None

References XNandPsu_Config::BaseAddress, XNandPsu_Geometry::BytesPerPage, XNandPsu::Geometry, XNandPsu_CfgInitialize(), XNandPsu_EnableDmaMode(), XNandPsu_Erase(), XNandPsu_LookupConfig(), XNandPsu_Read(), and XNandPsu_Write().

Referenced by main().