![]() |
File System Component
Version 5.0
MDK-Professional Middleware for Devices with Flash File System
|
Utility Routines provide analytical operations on drives. More...
Functions | |
int64_t | ffree (const char *drive) |
Find free space on drive. | |
fsStatus | fformat (const char *drive, const char *options) |
Format drive. | |
int32_t | fanalyse (const char *drive) |
Analyse volume and check for file fragmentation. | |
fsStatus | fcheck (const char *drive) |
Analyse volume and check for allocation errors. | |
fsStatus | fdefrag (const char *drive) |
Defragment Embedded Flash drive. | |
fsStatus | fmedia (const char *drive) |
Check if media present on removable drive. | |
fsStatus | finfo (const char *drive, fsDriveInfo *info) |
Read drive information. | |
fsStatus | fvol (const char *drive, char *label, uint32_t *serial) |
Read volume label and serial number. | |
You can analyse, format, and defragment drives. Also, reading drive and volume information data is supported.
int32_t fanalyse | ( | const char * | drive | ) |
[in] | drive | a string specifying the memory or storage device. |
The function fanalyse examines the Embedded File System and checks for file fragmentation.
The argument drive may only use NOR and SPI drives, as well as "" (Default System Drive).
Code Example
fsStatus fcheck | ( | const char * | drive | ) |
[in] | drive | a string specifying the memory or storage device. |
The function fcheck analyses the consistency of the Embedded File System and determines if it has been initialized.
The argument drive may only use NOR and SPI drives, as well as "" (Default System Drive).
Code Example
fsStatus fdefrag | ( | const char * | drive | ) |
[in] | drive | a string specifying the memory or storage device. |
The function fdefrag defragments the Embedded File System.
The argument drive may only use NOR and SPI drives, as well as "" (Default System Drive).
Code Example
fsStatus fformat | ( | const char * | drive, |
const char * | options | ||
) |
[in] | drive | a string specifying the memory or storage device. |
[in] | options | string specifying formatting options. |
The function fformat formats an EFS or FAT storage media for using a file system. The function closes all open files on the specified drive. Existing file handles become invalid.
The argument drive is specifying the drive. In addition, you may also use "" (Default System Drive).
The argument options can be NULL when formatting options are not used or a pointer to a string specifying following options:
Option | Description |
---|---|
/L label | Specifies volume label for a FAT drive. If /L option is not specified or if label is not given, then volume label will not be written. |
/FAT32 | Formats the media for using the FAT32 file system. |
/W | Clears all data. Erases all available data sectors. |
/LL | Clears all data. Performs low-level formatting first. |
/LLEB | Clears all data. Performs low-level formatting and erases bad blocks first. |
Code Example
int64_t ffree | ( | const char * | drive | ) |
[in] | drive | a string specifying the memory or storage device. |
The function ffree calculates the free space on a device.
The argument drive is specifying a drive.
Code Example
fsStatus finfo | ( | const char * | drive, |
fsDriveInfo * | info | ||
) |
[in] | drive | a string specifying the memory or storage device. |
[out] | info | drive information structure. |
The function finfo reads general drive informations from the volume and puts them into the info structure.
The argument drive is specifying a FAT volume drive. The Default System Drive is used, if an empty string "" is provided.
fsStatus fmedia | ( | const char * | drive | ) |
[in] | drive | a string specifying the memory or storage device. |
The function fmedia checks the presence of a removable drive in the system (such as SD/MMC cards or USB Flash drives). If a media device interface driver is not able to detect the presence of the associated media this function always returns fsOK.
The argument drive may only use Memory Card and USB Flash drives, as well as "" (for using the Default System Drive).
fsStatus fvol | ( | const char * | drive, |
char * | label, | ||
uint32_t * | serial | ||
) |
[in] | drive | a string specifying the memory or storage device. |
[out] | label | buffer for storing label as a null terminated string. When volume has no label an empty string is returned. This parameter can be NULL meaning label will not be read. |
[out] | serial | pointer to variable where serial number will be stored. This parameter can be NULL meaning serial number will not be read. |
The function fvol reads the volume label.
The argument drive is specifying a FAT volume drive. The Default System Drive is used, if an empty string "" is provided.
The argument label specifies a buffer where the volume label will be stored as a null terminated string. Its size must be at least 12 bytes to prevent buffer overflow. If volume has no label an empty string is returned.
The argument serial specifies a pointer to a 32-bit variable where the volume serial number will be stored. The serial number is usually written when the volume is formatted and can be used to distinguish between volumes on removable devices.
Code Example