![]() |
nandps
Vitis Drivers API Documentation
|
This file contains a design example using the NAND driver (XNandPs).
This example tests the skip block method of erase/read/write operations. The skip block method is useful while reading/writing images on to the flash. The flash is erased and programming by considering the bad blocks. The data is read back and compared with the data written for correctness.
None.
MODIFICATION HISTORY:
Ver Who Date Changes
1.00 nm 12/10/2010 First release 1.01a nm 28/02/2012 Modified the test offsets. ms 04/10/17 Modified Comment lines to follow doxygen rules 2.8 akm 07/06/23 Add support for system device-tree flow.
Macros | |
#define | NAND_TEST_OFFSET 0x01000000 |
Flash Test Offset. More... | |
#define | NAND_TEST_LENGTH 0x00080000 |
Test Length. More... | |
Functions | |
int | NandSkipBlockExample (u32 NandDeviceId) |
This function runs a test on the NAND flash device using the basic driver functions. More... | |
int | XNandPs_SkipRead (XNandPs *InstancePtr, u64 Offset, u32 Length, void *DestPtr) |
This function reads the data from the Flash device and copies it into the specified user buffer. More... | |
int | XNandPs_SkipWrite (XNandPs *InstancePtr, u64 Offset, u32 Length, void *SrcPtr) |
This function programs the flash device(s) with data specified in the user buffer. More... | |
int | XNandPs_SkipErase (XNandPs *InstancePtr, u64 Offset, u32 Length) |
This function erases length bytes in the flash device from a given offset. More... | |
int | main (void) |
Main function to execute the Skip Block based Nand read/write example. More... | |
u32 | XNandPs_CalculateLength (XNandPs *InstancePtr, u64 Offset, u32 Length) |
This function returns the length including bad blocks from a given offset and length. More... | |
#define NAND_TEST_LENGTH 0x00080000 |
Test Length.
Referenced by NandSkipBlockExample().
#define NAND_TEST_OFFSET 0x01000000 |
Flash Test Offset.
Referenced by NandSkipBlockExample().
int main | ( | void | ) |
Main function to execute the Skip Block based Nand read/write example.
References NandSkipBlockExample().
int NandSkipBlockExample | ( | u32 | NandDeviceId | ) |
This function runs a test on the NAND flash device using the basic driver functions.
The function does the following tasks:
NandDeviceId | is the XPAR_<NAND_instance>_DEVICE_ID value from xparameters.h. |
References XNandPs_Config::FlashBase, NAND_TEST_LENGTH, NAND_TEST_OFFSET, ReadBuffer, XNandPs_Config::SmcBase, WriteBuffer, XNandPs_CfgInitialize(), XNandPs_LookupConfig(), XNandPs_SkipErase(), XNandPs_SkipRead(), and XNandPs_SkipWrite().
Referenced by main().
u32 XNandPs_CalculateLength | ( | XNandPs * | InstancePtr, |
u64 | Offset, | ||
u32 | Length | ||
) |
This function returns the length including bad blocks from a given offset and length.
InstancePtr | is the pointer to the XNandPs instance. |
Offset | is the flash data address to read from. |
Length | is number of bytes to read. |
References XNandPs_Geometry::BlockSize, XNandPs_Geometry::DeviceSize, XNandPsTag::Geometry, and XNandPs_IsBlockBad().
Referenced by XNandPs_SkipRead(), and XNandPs_SkipWrite().
int XNandPs_SkipErase | ( | XNandPs * | InstancePtr, |
u64 | Offset, | ||
u32 | Length | ||
) |
This function erases length bytes in the flash device from a given offset.
The Offset and Length must be block aligned. This functions skips bad blocks.
InstancePtr | is the pointer to the XNand instance. |
Offset | is the flash address to start erasing from. |
Length | is number of bytes to erase. |
References XNandPs_Geometry::BlockSize, XNandPsTag::Geometry, XNandPs_Geometry::NumBlocks, XNandPs_EraseBlock(), and XNandPs_IsBlockBad().
Referenced by NandSkipBlockExample().
int XNandPs_SkipRead | ( | XNandPs * | InstancePtr, |
u64 | Offset, | ||
u32 | Length, | ||
void * | DestPtr | ||
) |
This function reads the data from the Flash device and copies it into the specified user buffer.
This function considers bad blocks and skips them to read next blocks.
InstancePtr | is the pointer to the XNandPs instance. |
Offset | is the flash data address to read from. |
Length | is number of bytes to read. |
DestPtr | is the destination address to copy data to. |
References XNandPs_Geometry::BlockSize, XNandPs_Geometry::DeviceSize, XNandPsTag::Geometry, XNandPs_CalculateLength(), XNandPs_IsBlockBad(), and XNandPs_Read().
Referenced by NandSkipBlockExample().
int XNandPs_SkipWrite | ( | XNandPs * | InstancePtr, |
u64 | Offset, | ||
u32 | Length, | ||
void * | SrcPtr | ||
) |
This function programs the flash device(s) with data specified in the user buffer.
This function considers bad blocks and skips them.
InstancePtr | is the pointer to the XNandPs instance. |
Offset | is the flash data address to write to. |
Length | is number of bytes to write. |
SrcPtr | is the source address to write the data from. |
References XNandPs_Geometry::BlockSize, XNandPs_Geometry::DeviceSize, XNandPsTag::Geometry, XNandPs_CalculateLength(), XNandPs_IsBlockBad(), and XNandPs_Write().
Referenced by NandSkipBlockExample().