| nandpsu Vitis Drivers API Documentation

- Overview
- Data Structures
- APIs
- File List
- Examples

Functions
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.
     1.6  sd   31/03/2020  Fixed a gcc warning.
     1.9  akm  07/15/2021  Switch to best supported Data interface and Timing mode.
     1.12 akm  06/27/2023  Add support for system device-tree flow for example.

## 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...
int | 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.

int main | ( | void |  | ) |

Main function to execute the Nand Flash read write example.

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

  NandDeviceId | is 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_ChangeTimingMode(), XNandPsu_EnableDmaMode(), XNandPsu_Erase(), XNandPsu_LookupConfig(), XNandPsu_Read(), and XNandPsu_Write().

Referenced by main().