Quality RTOS & Embedded Software

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


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 ]    [ Privacy ]    [ Sitemap ]    [ ]


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

Latest News

NXP tweet showing LPC5500 (ARMv8-M Cortex-M33) running FreeRTOS.

Meet Richard Barry and learn about running FreeRTOS on RISC-V at FOSDEM 2019

Version 10.1.1 of the FreeRTOS kernel is available for immediate download. MIT licensed.

View a recording of the "OTA Update Security and Reliability" webinar, presented by TI and AWS.


Careers

FreeRTOS and other embedded software careers at AWS.



FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Espressif ESP32

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Renesas

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

Xilinx Microblaze and Zynq partner