FreeRTOS
[armadillo_firmware.git] / FreeRTOS / Common / FileSystem / FatFs-0.7e / doc / en / mkfs.html
blobdd860bb63610ec22a6138c1c30cee49130908ad4
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2 <html lang="en">
3 <head>
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>
9 </head>
11 <body>
13 <div class="para">
14 <h2>f_mkfs</h2>
15 <p>The f_mkfs fucntion creates a file system on the drive.</p>
16 <pre>
17 FRESULT f_mkfs (
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 */
22 </pre>
23 </div>
25 <div class="para">
26 <h4>Parameters</h4>
27 <dl class="par">
28 <dt>Drive</dt>
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>
32 <dt>AllocSize</dt>
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>
34 </dl>
35 </div>
37 <div class="para">
38 <h4>Return Values</h4>
39 <dl class="ret">
40 <dt>FR_OK (0)</dt>
41 <dd>The function succeeded.</dd>
42 <dt>FR_INVALID_DRIVE</dt>
43 <dd>The drive number is invalid.</dd>
44 <dt>FR_NOT_READY</dt>
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>
50 <dt>FR_DISK_ERR</dt>
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.
54 <ul>
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>
58 </ul>
59 </dd>
60 </dl>
61 </div>
63 <div class="para">
64 <h4>Description</h4>
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>
67 </div>
70 <div class="para">
71 <h4>QuickInfo</h4>
72 <p>Available when <tt>_FS_READOLNY == 0</tt> and <tt>_USE_MKFS == 1</tt>.</p>
73 </div>
76 <p class="foot"><a href="../00index_e.html">Return</a></p>
77 </body>
78 </html>