[ ]
 Real time embedded FreeRTOS RSS feed 
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.

FF_CreateIOManager()

[Creating a FreeRTOS+FAT Media Driver]

ff_ioman.h
FF_IOManager_t *FF_CreateIOManger( FF_CreationParameters_t *pxParameters, FF_Error_t *pxError );
		

FreeRTOS+FAT media drivers store information that is common to all media types in a structure of type FF_Disk_t. The pxIOManager member of 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.

FF_CreateIOManager() creates an IO Manager object.

Parameters are passed into FF_CreateIOManager() in an FF_CreationParameters_t structure.

The pvSemaphore member of the FF_CreationParameters_t structure must be created by a call to the xSemaphoreCreateRecursiveMutex() FreeRTOS API function.


typedef struct xFF_CREATION_PARAMETERS
{
    /* If the memory to use as the IO manager's cache is provided by the application
    writer then pass a pointer to the memory in pucCacheMemory.  If the memory to
    use as the IO manager's cache is to be allocated by the IO manager then pass
    NULL in pucCacheMemory. */
    uint8_t *pucCacheMemory;

    /* The size of the cache memory.  ulMemorySize is specified in bytes and must
    be a multiple of ulSectorSize. */
    uint32_t ulMemorySize;

    /* Sector size, which is the unit for reading from and writing to the disk.
    A sector size of 512 bytes is normal. */
    BaseType_t ulSectorSize;

    /* The function used to write a sector to the disk. */
    FF_WriteBlock_t fnWriteBlocks;

    /* The function used to read a sector from the disk. */
    FF_ReadBlock_t fnReadBlocks;

    /* The parameter to pass into the read sector and write sector functions -
    basically a pointer back to the FF_Disk_t structure that contains the IO
    manager. */
    FF_Disk_t *pxDisk;

    /* The semaphore used to protect the data structures on the media must be
    created using the xSemaphoreCreateRecursiveMutex() API function. */
    void *pvSemaphore;
    
    /* If the media driver is not re-entant then set xBlockDeviceIsReentrant to
    pdFALSE - in which case the semaphore will also be used to protect access to
    the media driver's read and write functions. */
    BaseType_t xBlockDeviceIsReentrant;
    
} FF_CreationParameters_t;
						
The FF_CreationParameters_t structure

Parameters:

pxParameters   A structure of type FF_CreationParameters_t, which defines the IO manager being created.

pxError   Used to pass out an error code.

Returns:

If the IO manager was created successfully then a pointer to the created IO manager is returned and *pxError is set to FF_ERR_NONE. If the IO manager was not created successfully then NULL is returned and *pxError is set to an error code. FF_GetErrMessage() converts error codes into error descriptions.

Example usage:

The page that documents how to create a FreeRTOS+FAT media driver also demonstrates how to use the FF_CreateIOManger() function.


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




Copyright (C) 2004-2010 Richard Barry. Copyright (C) 2010-2016 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.