1.1.6.4.9 DRV_SDMMC_GeometryGet Function

C

SYS_MEDIA_GEOMETRY* DRV_SDMMC_GeometryGet ( const DRV_HANDLE handle );

Summary

Returns the geometry of the device.

Description

This API gives the following geometrical details of the SD Card.

  • Media Property

  • Number of Read/Write/Erase regions in the SD Card

  • Number of Blocks and their size in each region of the device

Precondition

The DRV_SDMMC_Initialize routine must have been called for the specified SDMMC driver instance.

The DRV_SDMMC_Open routine must have been called to obtain a valid opened device handle.

Parameters

ParamDescription
handleA valid open-instance handle, returned from the driver's open function

Returns

SYS_MEDIA_GEOMETRY - Pointer to structure which holds the media geometry information.

Example

SYS_MEDIA_GEOMETRY* SDMMCGeometry;
uint32_t readBlockSize, writeBlockSize, eraseBlockSize;
uint32_t nReadBlocks, nReadRegions, totalSize;

SDMMCGeometry = DRV_SDMMC_GeometryGet(SDMMCOpenHandle1);

readBlockSize = SDMMCGeometry->geometryTable->blockSize;
nReadBlocks = SDMMCGeometry->geometryTable->numBlocks;
nReadRegions = SDMMCGeometry->numReadRegions;

writeBlockSize = (SDMMCGeometry->geometryTable +1)->blockSize;
eraseBlockSize = (SDMMCGeometry->geometryTable +2)->blockSize;

totalSize = readBlockSize * nReadBlocks * nReadRegions;

Remarks

Refer sys_media.h for definition of SYS_MEDIA_GEOMETRY.