1 <!DOCTYPE HTML PUBLIC
"-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
4 <meta http-equiv=
"Content-Type" content=
"text/html; charset=iso-8859-1">
5 <meta http-equiv=
"Content-Style-Type" content=
"text/css">
6 <link rel=
"up" title=
"FatFs" href=
"../00index_e.html">
7 <link rel=
"stylesheet" href=
"../css_e.css" type=
"text/css" media=
"screen" title=
"ELM Default">
8 <title>FatFs - f_mkfs
</title>
15 <p>The f_mkfs fucntion creates a file system on the drive.
</p>
18 BYTE
<em>Drive
</em>, /* Logical drive number */
19 BYTE
<em>PartitioningRule
</em>, /* Partitioning rule */
20 WORD
<em>AllocSize
</em> /* Size of the allocation unit */
29 <dd>Logical drive number (
0-
9) to be formatted.
</dd>
30 <dt>PartitioningRule
</dt>
31 <dd>When
0 is given, a partition table is created into the first sector on the drive and then the file system is created on the partition. This is called FDISK format and used for harddisk and memory card. When
1 is given, the file system starts from the first sector without partition table. This is often called super floppy disk (SFD) format and used for floppy disk and removable disk.
</dd>
33 <dd>Specifies allocation unit size in number of bytes per cluster. The value must be
0 or power of
2 in range of from
512 to
32768. When
0 is specified, the cluster size is determined depends on the volume size. FAT64 (
64KB/cluster on FAT16) cannot be created by this function.
</dd>
38 <h4>Return Values
</h4>
41 <dd>The function succeeded.
</dd>
42 <dt>FR_INVALID_DRIVE
</dt>
43 <dd>The drive number is invalid.
</dd>
45 <dd>The drive cannot work due to any reason.
</dd>
46 <dt>FR_WRITE_PROTECTED
</dt>
47 <dd>The drive is write protected.
</dd>
48 <dt>FR_NOT_ENABLED
</dt>
49 <dd>The logical drive has no work area.
</dd>
51 <dd>The function failed due to an error in the disk function.
</dd>
52 <dt>FR_MKFS_ABORTED
</dt>
53 <dd>The function aborted before start in format due to a reason as follows.
55 <li>The disk size is too small.
</li>
56 <li>Invalid parameter was given to any parameter.
</li>
57 <li>Not allowable cluster size for this drive. This can occure when number of clusters becomes around
0xFF7 and
0xFFF7.
</li>
65 <p>The f_mkfs function creates a FAT file system on the drive. There are two partitioning rules, FDISK and SFD, for removable media. It can be selected with an argument. The FDISK format is recommended for the most case. This function currently
<em>does not support multiple partition
</em>, so that existing partitions on the physical dirve will be deleted and re-created a new partition occupies entire disk space.
</p>
66 <p>The FAT sub-type, FAT12/FAT16/FAT32, is determined by number of clusters on the drive and nothing else, according to the FAT specification issued by Microsoft. Thus which FAT sub-type is selected, is depends on the volume size and the specified cluster size. The cluster size affects performance of the file system and large cluster increases the performance.
</p>
72 <p>Available when
<tt>_FS_READOLNY ==
0</tt> and
<tt>_USE_MKFS ==
1</tt>.
</p>
76 <p class=
"foot"><a href=
"../00index_e.html">Return
</a></p>