|
| fformat| Summary | |
#include <rtl.h>
int fformat (
const char *drive); /* drive to format */
| | Description | | The fformat function formats the Flash File System storage media on the specified drive. If the drive string is empty (""), fformat uses the default drive specified in the FILE_CONFIG.C configuration file. The following values are supported for the drive: | Drive | Description |
|---|
| "F:" | Embedded Flash drive. | | "S:" | SPI Flash drive. | | "R:" | Ram drive. | | "M:" | Memory Card drive. |
All Flash File System drives must be formatted before any files are created on the devices. - Flash devices must be formatted once when the system is started the first time. They are erased sector by sector as specified in the FS_FLASHDEV.C configuration file.
- RAM devices must be formatted every time when the system starts. They are cleared sector by sector to an erased value (0x00 by default).
- Non-volatile and zero-power RAM devices must be formatted once when the system is started the first time. Since these devices are battery backed up and do not lose their contents when power is removed. They do not require reformatting each time the system starts. Non-volatile and zero-power RAM devices are cleared sector by sector to an erased value (0x00 by default).
- The Memory Card must be formatted before its first use. If a Memory Card has been formatted once, there is no need to format it again. The function formats the Memory Card optimized for 12-bit or 16-bit FAT type. Cluster size and Cluster 2 alignment are optimized for the best Card performance. The Flash File System supports SD and MMC Flash Memory Cards with a maximum capacity of 4 GBytes.
The fformat function is in the RL-FlashFS library. The prototype is defined in rtl.h. Note | | Return Value | | The fformat function returns a value of 0 when formatting is successful. A non-zero return value indicates an error was encountered. | | See Also | | fcheck, fdelete | | Example | |
#include <rtl.h>
void tst_fformat (void) {
/* Format a Flash Drive. */
if (fformat ("F:") != 0) {
printf ("Flash File System format failed.\n");
}
else {
printf ("Flash File System initialized.\n");
}
/* Format an SD Memory Card with Volume Label. */
if (fformat ("M:SD_CARD") != 0) {
printf ("SD Memory Card format failed.\n");
}
else {
printf ("SD Memory Card formatted.\n");
}
}
|
|
|