DRV_W25_GeometryGet Function

C

bool DRV_W25_GeometryGet( const DRV_HANDLE handle, W25_GEOMETRY *geometry );

Summary

Returns the geometry of the device.

Description

This API gives the following geometrical details of the W25 Flash:

  • Number of Read/Write/Erase Blocks and their size in each region of the device

  • Flash block start address.

Precondition

The DRV_W25_Open() routine must have been called for the specified W25 driver instance.

Parameters

ParamDescription
handleA valid open-instance handle, returned from the driver's open routine
*geometry_tablepointer to flash device geometry table instance

Returns

true - if able to get the geometry details of the flash

false - if read device id fails

Example

DRV_HANDLE handle; // Returned from DRV_W25_Open
DRV_W25_GEOMETRY w25FlashGeometry;

uint32_t readBlockSize, writeBlockSize, eraseBlockSize;
uint32_t nReadBlocks, nReadRegions, totalFlashSize;

DRV_W25_GeometryGet(handle, &w25FlashGeometry);

readBlockSize = w25FlashGeometry.read_blockSize;
nReadBlocks = w25FlashGeometry.read_numBlocks;
nReadRegions = w25FlashGeometry.numReadRegions;

writeBlockSize = w25FlashGeometry.write_blockSize;
eraseBlockSize = w25FlashGeometry.erase_blockSize;

totalFlashSize = readBlockSize * nReadBlocks * nReadRegions;

Remarks

This API is more useful when used to interface with Memory driver.