[ ]
Real time embedded FreeRTOS mailing list 
Homepage FreeRTOS Labs FreeRTOS+TCP FreeRTOS+FAT Contact / Enquiries


FreeRTOS+FAT is still in the lab
FreeRTOS+FAT is already in use in commercial products and we encourage you to try it yourself. Be aware however that FreeRTOS+FAT was acquired by Real Time Engineers Ltd., and is still being documented and updated to ensure it meets our strict quality standards. Please use the forum for support, or contact us directly if you have a specific business interest.

Creating a FreeRTOS+FAT Media Driver

The Structure of a Media Driver


The Structure of a Media Driver
The media is the physical device on which files are stored. Examples of media suitable for use in an embedded file system include SD cards, solid state disks, NOR flash memory chips, NAND flash chips, and RAM chips. The media driver is the software responsible for writing to the media, and reading from the media.

FreeRTOS+FAT stores information that is common to all media types in a structure of type FF_Disk_t. The FF_Disk_t structure can be extended by the developer of the media driver so it includes additional information that is specific to the media in use.

The FF_Disk_t structure references an object called an input/output manager (IO Manager, or simply IOMAN). The IO manager is responsible for, amongst other things, buffering and caching both file and directory information.

The mechanism for actually reading data from and writing data to the media is dependent on the media type. Therefore the developer of the media driver must provide suitable read and write functions.

Many media drivers will themselves make use of a peripheral driver in order to perform the actual read and write operations. For example, if the media is an SD card then it might be necessary to access the card through an SPI peripheral. A peripheral driver is not necessary when implementing a RAM disk, as RAM can be read from and written to using the standard C library memcpy() function.

Some media types also require higher level management logic to perform actions such as bad block management, or wear levelling.


Creating a New Media Driver

A media driver requires [at least] three functions.

  1. A function that reads sectors from the media
  2. A function that writes sectors to the media
  3. An initialisation function

Click each item above for more information, and to see a worked example.


Preparing Media For First Use

Just like a disk in a desktop computer, before the media can be used in an embedded system it must first be partitioned, then a partition must be formatted and mounted.

FreeRTOS+FAT implements a virtual file system in which the mounted partition must be registered, after which it will appear as a directory in the embedded file system's root directory.








[ Back to the top ]    [ About FreeRTOS ]    [ FreeRTOS Labs Sitemap ]    [ Main FreeRTOS Sitemap ]    [ ]




Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.