Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT




Loading

FreeRTOS+FAT: disk name? disk available space?

Posted by dnadler on October 5, 2016

I had a quick look at FreeRTOS+FAT and didn't see a couple things we always need:

How much space is available on disk? To avoid nasty accidents our applications must check for adequate disk space prior trying to create files.

What is the disk name? We usually show the disk name (for inserted USB memory sticks and uSD cards especially).

Sorry if I missed the APIs for these functions? Thanks, Best Regards, Dave


FreeRTOS+FAT: disk name? disk available space?

Posted by heinbali01 on October 5, 2016

Hi Dave,

Both the free diskspace and the volume label are available, although there is not an API for this. I don't think that stdio has standard functions for this?

Here is how you can retrieve all information:

~~~~ pxSDDisk = FFSDDiskInit( mainSDCARDDISKNAME ); if( pxSDDisk != NULL ) { FFIOManagert *pxIOManager = sddiskioman( pxSDDisk ); uint64t ullFreeBytes = ( uint64t ) pxIOManager->xPartition.ulFreeClusterCount * pxIOManager->xPartition.ulSectorsPerCluster * 512ull; FreeRTOSprintf( ( "Volume %-12.12s: Free clusters %lu total clusters %lu Free space %lu KBn", pxIOManager->xPartition.pcVolumeLabel, pxIOManager->xPartition.ulFreeClusterCount, pxIOManager->xPartition.ulNumClusters, ( uint32_t ) ( ullFreeBytes / 1024ull ) ) ); } ~~~~

Is that enough?

Regards.


FreeRTOS+FAT: disk name? disk available space?

Posted by dnadler on October 6, 2016

Thanks Hein - That's adequate, glad its accessible. IMOH, Nice APIs would be better for such common requirements... Thanks again, Best Regards, Dave


FreeRTOS+FAT: disk name? disk available space?

Posted by heinbali01 on October 6, 2016

Nice APIs would be better for such common requirements...

I Agree. Will you write a proposal?

When using ff_stdio.h, it should also be possible to retrieve information for a virtual drive, such as "/ram", a RAM-disk.


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




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

Latest News

FreeRTOS kernel V10 is available for immediate download. Now MIT licensed.


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

OpenRTOS and SafeRTOS