The media must be divided into one or more partitions before it can be
formatted with the necessary embedded FAT file system structures. The
FF_Partition() function is used for this purpose.
As an example, below is the outline of the prvPartitionDisk() function
used by FreeRTOS-Plus-FAT's RAM disk driver. prvPartitionDisk() is called by
the RAM disk's initialisation function and demonstrates how to call FF_Partition().
See the file ff_ramdisk.c in the
FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT/portable/common directory
for the full version.
#define ramHIDDEN_SECTOR_COUNT 8
#define ramPRIMARY_PARTITIONS 1
static BaseType_t prvPartitionDisk( FF_Disk_t *pxDisk )
{
FF_FormatParameters xPartition;
FF_Error_t xError;
BaseType_t xReturn;
memset( &xPartition, '�', sizeof( xPartition ) );
xPartition.ulSectorCount = pxDisk->ulSectorCount;
xPartition.ulHiddenSectors = ramHIDDEN_SECTOR_COUNT;
xPartition.xPrimaryCount = ramPRIMARY_PARTITIONS;
xError = FF_Partition( pxDisk->pxIOManager, &xPartition );
if( FF_isERR( xError ) != pdFALSE )
{
xReturn = pdFAIL;
}
else
{
xReturn = pdPASS;
}
return xReturn;
}
Partitioning the Media, Ready for Formatting
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.