Creating a Media Driver: Reading Sectors
Each FreeRTOS+FAT media driver requires a function that reads sectors
from the media on which the embedded file system is stored. How the read
functions actually work is dependent on the media type. For example, if
the media is a RAM disk then data can be read from 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 Read FunctionThe read function can have any name, but must have the following prototype:
As an example, below is the outline of the read 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.