DRV_MX25L_GeometryGet Function

C

bool DRV_MX25L_GeometryGet( const DRV_HANDLE handle, MX25L_GEOMETRY *geometry );

Summary

Returns the geometry of the device.

Description

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

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

  • Flash block start address.

Precondition

The DRV_MX25L_Open() routine must have been called for the specified MX25L 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_MX25L_Open
DRV_MX25L_GEOMETRY mx25lFlashGeometry;

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

DRV_MX25L_GeometryGet(handle, &mx25lFlashGeometry);

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

writeBlockSize = mx25lFlashGeometry.write_blockSize;
eraseBlockSize = mx25lFlashGeometry.erase_blockSize;

totalFlashSize = readBlockSize * nReadBlocks * nReadRegions;

Remarks

This API is more useful when used to interface with block driver like memory driver.