|Hint: Use the tree menu to navigate groups of related pages|
Creating a Media Driver: The Driver’s Initialisation Function
[Creating a FreeRTOS+FAT Media Driver]
Actions performed within a media driver’s initialisation
function (* optional steps)
The FF_Disk_t structure contains a pointer to an FF_IOManager_t structure. The FF_IOManager_t structure is created by calling FF_CreateIOManager().
For convenience, the media driver can optionally also mount a partition on the media, and add the mounted partition to FreeRTOS+FAT’s virtual file system. Performing these two optional steps within the initialisation function removes the need for the application writer to perform them explicitly. The image on the right shows the media driver’s initialisation function performing these optional steps.
Worked ExampleAs an example, below is the outline of the media driver initialisation function used by the FreeRTOS+FAT RAM disk driver. The full version, which includes additional error checking, can be found in /FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT/portable/common/ff_ramdisk.c.