Manuals
General operations
Block device operations
File system operations
File operations
Directory operations
Direct Block access
Block driver (mandatory)
Block driver (optional)
ECF_ReadSector
ECF_ReadSector reads a single sector from a block device.
ECF_ErrorCode ECF_ReadSector(
struct ECF_BlockDriver *pBlockDriver,
uint32_t sector,
uint8_t *pData,
uint8_t flags
);
struct ECF_BlockDriver *pBlockDriver,
uint32_t sector,
uint8_t *pData,
uint8_t flags
);
Parameters
pBlockDriver
This is a pointer to the struct ECF_BlockDriver where you want to read a sector.
sector
This specifies which sector to read.
pData
This points to a uint8_t array that the block driver needs to fill with the read data.
flags
These are flags for the read.
ECF_READSECTOR_BYPASS_WEARLEVELING:
If this flag is set, the block driver will bypass the wear leveling layer and read a physical sector. There are very few reasons, if any, to do this.
Return value
Returns one of the EcFAT error codes (ECFERR_SUCCESS on success)
Remarks
The difference between calling ECF_ReadSector and calling the block driver's m_fnReadSector directly is that ECF_ReadSector will properly handle wear leveling and locking of the block driver.
ECF_ReadSector will automatically handle wear leveling and read sectors even when they have been moved because of wear leveling.
The normal use case for ECF_ReadSector is for reading sectors from a RAW partition without file system.
See also