STATUS tffsDevFormat ( int tffsDriveNo, /* TrueFFS drive number (0 - DRIVES-1) */ int arg /* pointer to tffsDevFormatParams structure */ )
This routine formats a flash device for use with TrueFFS. It takes two parameters, a drive number and a pointer to a device format structure. This structure describes how the volume should be formatted. The structure is defined in dosformat.h. The drive number is assigned in the order that the socket component for the device was registered.
The format process marks each erase unit with an Erase Unit Header (EUH) and creates the physical and virtual Block Allocation Maps (BAM) for the device. The erase units reserved for the "boot-image" are skipped and the first EUH is placed at number (boot-image length - 1). To write to the boot-image region, call tffsBootImagePut( ).
If any of the erase units in the boot-image region contains an erase unit header from a previous format call (this can happen if you reformat a flash device specifying a larger boot region) TrueFFS fails to mount the device. To fix this problem, use tffsRawio( ) to erase the problem erase units (thus removing the outdated EUH).
The macro TFFS_STD_FORMAT_PARAMS defines the default values used for formatting a flask disk device. If the second argument to this routine is zero, tffsDevFormat( ) uses these default values.