DRV_AT25_GeometryGet Function

C

bool DRV_AT25_GeometryGet(const DRV_HANDLE handle, DRV_AT25_GEOMETRY *geometry)

Summary

Returns the geometry of the device.

Description

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

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

Precondition

DRV_AT25_Open must have been called to obtain a valid opened device handle.

Parameters

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

Returns

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

false - if handle is invalid

Example

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

// myHandle is the handle returned from DRV_AT25_Open API.

DRV_AT25_GeometryGet(myHandle, &eepromGeometry);

readBlockSize = eepromGeometry.readBlockSize;
nReadBlocks = eepromGeometry.readNumBlocks;
nReadRegions = eepromGeometry.readNumRegions;

writeBlockSize = eepromGeometry.writeBlockSize;
eraseBlockSize = eepromGeometry.eraseBlockSize;

totalFlashSize = readBlockSize * nReadBlocks * nReadRegions;

Remarks

None.