1.1.8.4.14 DRV_SFDP_GeometryGet Function

1.1.8.4.14 C

bool DRV_SFDP_GeometryGet( const DRV_HANDLE handle, DRV_SFDP_GEOMETRY *geometry );

1.1.8.4.14 Summary

Returns the geometry of the device.

1.1.8.4.14 Description

This API gives the following geometrical details of the SFDP Flash discovered at runtime using SFDP:

  • Number of Read/Write/Erase Blocks and their size in each region of the device
  • Flash block start address.

1.1.8.4.14 Precondition

The DRV_SFDP_Open() routine must have been called for the specified SFDP driver instance.

1.1.8.4.14 Parameters

ParametersDescription
handleA valid open-instance handle, returned from the driver's open routine
*geometryPointer to Flash device geometry table instance

1.1.8.4.14 Returns

True - If able to get the geometry details of the Flash.

False - If SFDP discovery fails or read device id fails.

1.1.8.4.14 Example

DRV_HANDLE handle; // Returned from DRV_SFDP_Open

DRV_SFDP_GEOMETRY sfdpFlashGeometry;

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

DRV_SFDP_GeometryGet(handle, &sfdpFlashGeometry);

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

writeBlockSize = sfdpFlashGeometry.write_blockSize;
eraseBlockSize = sfdpFlashGeometry.erase_blockSize;

totalFlashSize = readBlockSize * nReadBlocks * nReadRegions;

1.1.8.4.14 Remarks

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