You are currently viewing the documentation for:
m_fnGetDriveProperty
m_fnGetDriveProperty returns properties about the block driver to EcFAT. m_fnGetVolumeInformation serves the same purpose but m_fnGetDriveProperty can return more properties.
ECF_ErrorCode m_fnGetDriveProperty(
   struct ECF_BlockDriver *pBlockDriver,
   uint8_t informationType,
   uint32_t *pValue
);
Parameters
pBlockDriver
This is a pointer to the struct ECF_BlockDriver that the function is a member of. It can be used by the block driver to access the m_BlockDriverData member or to call the other functions.
informationType
One of the values below depending on which type of property EcFAT wants to obtain.
ECF_DRIVEPROPERTY_SECTORSIZE:
Set *pValue to the sector size and return ECFERR_SUCCESS. Will only be called if m_fnGetVolumeInformation is NULL.
ECF_DRIVEPROPERTY_NUMBEROFSECTORS:
Set *pValue to the number of sectors and return ECFERR_SUCCESS. Will only be called if m_fnGetVolumeInformation is NULL.
ECF_DRIVEPROPERTY_SECTORSPERBLOCK:
If the block device have blocks where one block does not equal one sector, set *pValue to the number of sectors per block and return ECFERR_SUCCESS.
pValue
This is a pointer to a uint32_t that should be set to requested value.
Return value
Return ECFERR_SUCCESS if the read was successful. If the write fails, return one of the EcFAT error code defined in EcFAT.h. You can also define your own error codes, error no 64 to 127 are reserved for custom block driver errors.
Remarks
The m_fnGetDriveProperties function is part of struct ECF_BlockDriver. You need to supply it when writing a block driver. EcFAT will call this function to determine the sector size and how many sectors are there are on a block device. On both single- and multithreaded systems, EcFAT will make certain that it will not call any of the other block driver functions until this call has been completed so you do not need to implement any locking in the block driver unless it is needed for other purposes.
Example Code


ECF_ErrorCode RAM_GetDriveProperty(
   struct ECF_BlockDriver *pBlockDriver, 
   uint8_t propertyType, 
   uint32_t* pValue)
{
if(propertyType == ECF_DRIVEPROPERTY_SECTORSIZE)
*pValue = 1024;
else if(propertyType == ECF_DRIVEPROPERTY_NUMBEROFSECTORS)
*pValue = 64;
else
return ECFERR_PARAMETERERROR;
   
   return ECFERR_SUCCESS;
}