Creating a Media Driver: Writing Sectors
Each FreeRTOS+FAT media driver requires a function that writes sectors
to the media on which the embedded file system is stored. How the write
functions actually work is dependent on the media type. For example, if
the media is a RAM disk then data can be written to the RAM using memcpy(),
but if the media is an SD card then the card’s command interface will
have to be used via an MMC or SPI peripheral driver.
[Creating a FreeRTOS+FAT Media Driver]
The Write FunctionThe write function can take any name, but must have the following prototype:
As an example, below is the outline of the write function used by the FreeRTOS+FAT RAM disk driver. The full version contains input parameter checking, and can be found in /FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT/portable/common/ff_ramdisk.c.