You are currently viewing the documentation for:
ECF_WriteSector
ECF_WriteSector writes a single sector to the block device.
ECF_ErrorCode ECF_WriteSector(
   struct ECF_BlockDriver *pBlockDriver,
   uint32_t sector,
   uint8_t *pData,
   uint8_t flags
);
Parameters
pBlockDriver
This is a pointer to the struct ECF_BlockDriver to write sectors in.
sector
This specifies which sector to write.
pData
This points to a uint8_t array with the data for the block driver to write.
flags
These are flags for the write.
ECF_WRITESECTOR_BYPASS_WEARLEVELING:
If this flag is set, the block driver will bypass the wear leveling layer and write a physical sector. There are very few reasons, if any, to do this.
ECF_WRITESECTOR_ALLOW_BUFFER_OVERWRITE:
Set this flag if you allow EcFAT to overwrite the buffer passed in pData. Useful if you will not reuse that data you just wrote since it will speed up EcFAT slightly.
Return value
Returns one of the EcFAT error codes (ECFERR_SUCCESS on success). Will return ECFERR_BUFFEROVERWRITTEN if ECF_WRITESECTOR_ALLOW_BUFFER_OVERWRITE was set and the buffer was actually overwritten.
Remarks
The difference between calling ECF_WriteSector and calling the block driver's m_fnWriteSector directly is that ECF_WriteSector will properly handle wear leveling and locking of the block driver. ECF_WriteSector will automatically handle wear leveling and move blocks that are written frequently. The normal use case for ECF_WriteSector is for writing sectors to a RAW partition without file system.
See also