Creating a Media Driver: The FF_Disk_t Structure
FreeRTOS+FAT stores information that is common to all media types in a
structure of type FF_Disk_t. Media drivers can extended the FF_Disk_t structure
to include additional information that is specific to the media in use.
For example, the initialisation
function used by FreeRTOS+FAT’s RAM disk driver extends the FF_Disk_t
structure to include a pointer to the RAM buffer used as the disk.
Creating a FreeRTOS+FAT Media Driver
The pxIOManager member of the FF_Disk_t structure is created by calling FF_CreateIOManager().
It is advisable to clear the entire structure to zero after it has been allocated – that way the media driver will be compatible with future FreeRTOS+FAT versions, in which the FF_Disk_t structure may include additional members.
/* Structure that contains fields common to all media drivers, and can be
extended to contain additional fields to tailor it for use with a specific media
/* Flags that can optionally be used by the media driver to ensure the
disk has been initialised, registered and mounted before it is accessed. */
uint32_t bIsInitialised : 1;
uint32_t bIsRegistered : 1;
uint32_t bIsMounted : 1;
uint32_t spare0 : 5;
/* The partition number on the media described by this structure. */
uint32_t bPartitionNumber : 8;
uint32_t spare1 : 16;
/* Provided to allow this structure to be extended to include additional
attributes that are specific to a media type. */
/* Points to input and output manager used by the disk described by this
/* The number of sectors on the disk. */
/* Field that can optionally be set to a signature that is unique to the
media. Read and write functions can check the ulSignature field to validate
the media type before they attempt to access the pvTag field, or perform any
read and write operations. */
typedef struct xFFDisk FF_Disk_t;
The FF_Disk_t structure