FreeRTOS-Plus-FAT needs to be aware of the components used by the media driver,
including the driver's read and write functions, and the drivers IO manager. The
FF_RegisterBlockDevice() function is used for this purpose.
As an example, below is the outline of the prvRegisterDisk() function
used by FreeRTOS-Plus-FAT's RAM disk driver. prvRegisterDisk() is called by
the RAM disk driver's initialisation function, and demonstrates how
FF_RegisterBlockDevice() is used. See the file
ff_ramdisk.c in the
FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT/portable/common directory
for the full version.
static BaseType_t prvRegisterDisk( FF_Disk_t *pxDisk )
{
FF_Error_t xError;
BaseType_t xReturn;
xError = FF_RegisterBlockDevice( pxDisk->pxIOManager,
ramSECTOR_SIZE,
prvWriteRAM,
prvReadRAM,
( void * ) pxDisk );
if( FF_isERR( xError ) != pdFALSE )
{
xReturn = pdFAIL;
}
else
{
pxDisk->xStatus.bIsRegistered = pdTRUE;
xReturn = pdPASS;
}
return xReturn;
}
Registering the components used by the media driver with the FreeRTOS-Plus-FAT embedded file system
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.