8e623e1457ac6c23afe179bfd799859dd5dd86c8
[bertos.git] / bertos / fs / fatfs / doc / en / mkfs.html
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">\r
2 <html lang="en">\r
3 <head>\r
4 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">\r
5 <meta http-equiv="Content-Style-Type" content="text/css">\r
6 <link rel="up" title="FatFs" href="../00index_e.html">\r
7 <link rel="stylesheet" href="../css_e.css" type="text/css" media="screen" title="ELM Default">\r
8 <title>FatFs - f_mkfs</title>\r
9 </head>\r
10 \r
11 <body>\r
12 \r
13 <div class="para">\r
14 <h2>f_mkfs</h2>\r
15 <p>The f_mkfs fucntion creates a file system on the drive.</p>\r
16 <pre>\r
17 FRESULT f_mkfs (\r
18   BYTE  <em>Drive</em>,            /* Logical drive number */\r
19   BYTE  <em>PartitioningRule</em>, /* Partitioning rule */\r
20   WORD  <em>AllocSize</em>         /* Allocation unit size */\r
21 );\r
22 </pre>\r
23 </div>\r
24 \r
25 <div class="para">\r
26 <h4>Parameters</h4>\r
27 <dl class="par">\r
28 <dt>Drive</dt>\r
29 <dd>Logical drive number (0-9) to be formatted.</dd>\r
30 <dt>PartitioningRule</dt>\r
31 <dd>When 0 is given, a partition table is created into first sector on the drive and then the file system is created on the partition. This is called FDISK format. When 1 is given, the file system starts from the first sector without partition table. This is often called super floppy (SFD) format.</dd>\r
32 <dt>AllocSize</dt>\r
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 by the drive size. FAT64 (64KB/cluster on FAT16) cannot be created by this function.</dd>\r
34 </dl>\r
35 </div>\r
36 \r
37 <div class="para">\r
38 <h4>Return Values</h4>\r
39 <dl class="ret">\r
40 <dt>FR_OK (0)</dt>\r
41 <dd>The function succeeded.</dd>\r
42 <dt>FR_INVALID_DRIVE</dt>\r
43 <dd>The drive number is invalid.</dd>\r
44 <dt>FR_NOT_READY</dt>\r
45 <dd>The drive cannot work due to any reason.</dd>\r
46 <dt>FR_WRITE_PROTECTED</dt>\r
47 <dd>The drive is write protected.</dd>\r
48 <dt>FR_NOT_ENABLED</dt>\r
49 <dd>The logical drive has no work area.</dd>\r
50 <dt>FR_DISK_ERR</dt>\r
51 <dd>The function failed due to an error in the disk function.</dd>\r
52 <dt>FR_MKFS_ABORTED</dt>\r
53 <dd>The function aborted before start in format due to a reason as follows.\r
54 <ul>\r
55 <li>The disk size is too small.</li>\r
56 <li>Invalid parameter was given to any parameter.</li>\r
57 <li>Not allowable cluster size for this drive. This can occure when number of clusters becomes around 0xFF7 and 0xFFF7.</li>\r
58 </ul>\r
59 </dd>\r
60 </dl>\r
61 </div>\r
62 \r
63 <div class="para">\r
64 <h4>Description</h4>\r
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>\r
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 partition size and the specified cluster size. The cluster size affects performance of the file system and large cluster increases the performance.</p>\r
67 <p>This function is supported on only _USE_MKFS option is selected.</p>\r
68 </div>\r
69 \r
70 \r
71 <p class="foot"><a href="../00index_e.html">Return</a></p>\r
72 </body>\r
73 </html>\r