FSformat Function

Microchip MDD File System Interface

MDDFS Interface Library Help
FSformat Function
C
int FSformat(
    char mode, 
    long int serialNumber, 
    char * volumeID
);
Description

The FSformat function can be used to create a new boot sector on a device, based on the information in the master boot record. This function will first initialize the I/O pins and the device, and then attempts to read the master boot record. If the MBR cannot be loaded successfully, the function will fail. Next, if the 'mode' argument is specified as '0' the existing boot sector information will be loaded. If the 'mode' argument is '1' an entirely new boot sector will be constructed using the disk values from the master boot record. Once the boot sector has been successfully loaded/created, the locations of the FAT and root will be loaded from it, and they will be completely erased. If the user has specified a volumeID parameter, a VOLUME attribute entry will be created in the root directory to name the device.

Preconditions

The device must possess a valid master boot record.

Parameters
Parameters 
Description 
mode 
  • 0 - Just erase the FAT and root
  • 1 - Create a new boot sector

 

serialNumber 
Serial number to write to the card 
volumeID 
Name of the card 
Return Values
Return Values 
Description 
Format was successful 
EOF 
Format was unsuccessful 
Side Effects

The FSerrno variable will be changed.

Remarks

FAT12 and FAT16 formatting is supported.

Microchip MDD File System Interface 1.2.0 - [Aug 18, 2008]
Copyright © 2008 Microchip Technology, Inc.  All rights reserved.