fatfs v0.14b April 17, 2021:
- Made FatFs uses standard library <string.h> for copy, compare and search instead of built-in string functions. - Added support for long long integer and floating point to f_printf(). (FF_STRF_LLI and FF_STRF_FP) - Made path name parser ignore the terminating separator to allow "dir/". - Improved the compatibility in Unix style path name feature. - Fixed the file gets dead-locked when f_open() failed with some conditions. (appeared at R0.12a) - Fixed f_mkfs() can create wrong exFAT volume due to a timing dependent error. (appeared at R0.12) - Fixed code page 855 cannot be set by f_setcp(). - Fixed some compiler warnings.
This commit is contained in:
parent
ddc7b41474
commit
87c4907172
@ -5,8 +5,6 @@
|
|||||||
<meta http-equiv="Content-Style-Type" content="text/css">
|
<meta http-equiv="Content-Style-Type" content="text/css">
|
||||||
<meta http-equiv="cache-control" content="no-cache">
|
<meta http-equiv="cache-control" content="no-cache">
|
||||||
<meta name="description" content="Open source FAT filesystem for embedded projects">
|
<meta name="description" content="Open source FAT filesystem for embedded projects">
|
||||||
<link rel="start" title="Site Top" href="../../">
|
|
||||||
<link rel="up" title="Freewares" href="../../fsw_e.html">
|
|
||||||
<link rel="stylesheet" href="css_e.css" type="text/css" media="screen" title="ELM Default">
|
<link rel="stylesheet" href="css_e.css" type="text/css" media="screen" title="ELM Default">
|
||||||
<title>FatFs - Generic FAT Filesystem Module</title>
|
<title>FatFs - Generic FAT Filesystem Module</title>
|
||||||
</head>
|
</head>
|
||||||
@ -27,12 +25,12 @@
|
|||||||
<li>Various <a href="doc/config.html">configuration options</a> to support for:
|
<li>Various <a href="doc/config.html">configuration options</a> to support for:
|
||||||
<ul>
|
<ul>
|
||||||
<li>Long file name in ANSI/OEM or Unicode.</li>
|
<li>Long file name in ANSI/OEM or Unicode.</li>
|
||||||
<li>exFAT filesystem, 64-bit LBA and GPT for huge storeges.</li>
|
<li>exFAT filesystem, 64-bit LBA and GPT for huge storages.</li>
|
||||||
<li>Thread safe for RTOS.</li>
|
<li>Thread safe for RTOS.</li>
|
||||||
<li>Multiple volumes (physical drives and partitions).</li>
|
<li>Multiple volumes. (physical drives and partitions)</li>
|
||||||
<li>Variable sector size.</li>
|
<li>Variable sector size.</li>
|
||||||
<li>Multiple code pages including DBCS.</li>
|
<li>Multiple code pages including DBCS.</li>
|
||||||
<li>Read-only, optional API, I/O buffer and etc...</li>
|
<li>Read-only, optional APIs, I/O buffer and etc...</li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
@ -105,7 +103,7 @@
|
|||||||
<div class="para">
|
<div class="para">
|
||||||
<h3>Media Access Interface</h3>
|
<h3>Media Access Interface</h3>
|
||||||
<img src="res/layers2.png" class="rset" width="245" height="220" alt="layer">
|
<img src="res/layers2.png" class="rset" width="245" height="220" alt="layer">
|
||||||
<p>Since FatFs module is the <em>filesystem layer</em> independent of platforms and storage media, it is completely separated from the physical devices, such as memory card, harddisk and any type of storage device. The storage device control module is <em>not any part of FatFs module</em> and it needs to be provided by implementer. FatFs controls the storage devices via a simple media access interface shown below. Also sample implementations for some platforms are available in the downloads. A function checker for storage device control module is available <a href="res/app4.c">here</a>.</p>
|
<p>Since FatFs module is the <em>Filesystem Layer</em> independent of platforms and storage media, it is completely separated from the physical devices, such as memory card, harddisk and any type of storage device. The storage device control module is <em>not any part of FatFs module</em> and it needs to be provided by implementer. FatFs controls the storage devices via a simple media access interface shown below. Also sample implementations for some platforms are available in the downloads. A function checker for storage device control module is available <a href="res/app4.c">here</a>.</p>
|
||||||
<ul>
|
<ul>
|
||||||
<li>Storage Device Controls
|
<li>Storage Device Controls
|
||||||
<ul>
|
<ul>
|
||||||
@ -129,9 +127,9 @@
|
|||||||
<h3>Resources</h3>
|
<h3>Resources</h3>
|
||||||
<p>The FatFs module is a free software opened for education, research and development. You can use, modify and/or redistribute it for any purpose without any restriction under your responsibility. For further information, refer to the application note.</p>
|
<p>The FatFs module is a free software opened for education, research and development. You can use, modify and/or redistribute it for any purpose without any restriction under your responsibility. For further information, refer to the application note.</p>
|
||||||
<ul>
|
<ul>
|
||||||
<li><em>Read First: <a href="doc/appnote.html">FatFs module application note</a></em></li>
|
<li><em>Getting Started: <a href="doc/appnote.html">FatFs Application Node</a></em></li>
|
||||||
<li>Downloads: <a href="http://elm-chan.org/fsw/ff/archives.html">Previous Releases</a>↗ </li>
|
<li>Download: <a href="http://elm-chan.org/fsw/ff/archives.html">Previous Releases</a></li>
|
||||||
<li>Community: <a href="http://elm-chan.org/fsw/ff/bd/">FatFs User Forum</a>↗ </li>
|
<li>Community: <a href="http://elm-chan.org/fsw/ff/bd/">FatFs User Forum</a></li>
|
||||||
<li><a href="https://msdn.microsoft.com/en-us/windows/hardware/gg463080.aspx">FAT32 Specification by Microsoft</a>↗ (The authorized document on FAT filesystem)</li>
|
<li><a href="https://msdn.microsoft.com/en-us/windows/hardware/gg463080.aspx">FAT32 Specification by Microsoft</a>↗ (The authorized document on FAT filesystem)</li>
|
||||||
<li><a href="http://elm-chan.org/docs/fat_e.html">The basics of FAT filesystem</a></li>
|
<li><a href="http://elm-chan.org/docs/fat_e.html">The basics of FAT filesystem</a></li>
|
||||||
<li><a href="http://elm-chan.org/docs/exfat_e.html">The basics of exFAT filesystem</a></li>
|
<li><a href="http://elm-chan.org/docs/exfat_e.html">The basics of exFAT filesystem</a></li>
|
||||||
@ -141,8 +139,8 @@
|
|||||||
<li><a href="http://stm32f4-discovery.net/2014/07/library-21-read-sd-card-fatfs-stm32f4xx-devices/">Read SD card with FatFs on STM32F4xx devices by Tilen Majerle</a>↗ (Quick and easy implementation for STM32F4-Discovery)</li>
|
<li><a href="http://stm32f4-discovery.net/2014/07/library-21-read-sd-card-fatfs-stm32f4xx-devices/">Read SD card with FatFs on STM32F4xx devices by Tilen Majerle</a>↗ (Quick and easy implementation for STM32F4-Discovery)</li>
|
||||||
<li><a href="res/rwtest1.png">Benchmark 1</a> (ATmega1284/20MHz with MMC via USART in SPI, CFC via GPIO)</li>
|
<li><a href="res/rwtest1.png">Benchmark 1</a> (ATmega1284/20MHz with MMC via USART in SPI, CFC via GPIO)</li>
|
||||||
<li><a href="res/rwtest2.png">Benchmark 2</a> (LPC2368/72MHz with MMC via MCI)</li>
|
<li><a href="res/rwtest2.png">Benchmark 2</a> (LPC2368/72MHz with MMC via MCI)</li>
|
||||||
|
<li><a href="res/fd.mp4">Demo movie of an application</a> (this project is in ffsample.zip/lpc23xx)</li></ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@ -67,16 +67,16 @@ The FatFs module is a middleware written in ANSI C (C89). There is no platform d
|
|||||||
<p><img src="../res/funcs.png" width="750" height="420" alt="functional diagram"></p>
|
<p><img src="../res/funcs.png" width="750" height="420" alt="functional diagram"></p>
|
||||||
|
|
||||||
<h4>Required Functions</h4>
|
<h4>Required Functions</h4>
|
||||||
<p>You need to provide only MAI functions required by FatFs module and nothing else. If any working device control module for the target system is available, you need to write only glue functions to attach it to the FatFs module. If not, you need to port another device control module or write it from scratch. Most of MAI functions are not that always required. For instance, any write function is not required in read-only configuration. Following table shows which function is required depends on the configuration options.</p>
|
<p>You need to provide only MAI functions required by FatFs module and nothing else. If a working device control module for the target system is available, you need to write only glue functions to attach it to the FatFs module. If not, you need to port another device control module or write it from scratch. Most of MAI functions are not that always required. For instance, the write function is not required in read-only configuration. Following table shows which function is required depends on the configuration options.</p>
|
||||||
<table class="lst2">
|
<table class="lst2">
|
||||||
<tr><th>Function</th><th>Required when</th><th>Note</th></tr>
|
<tr><th>Function</th><th>Required when:</th><th>Note</th></tr>
|
||||||
<tr><td>disk_status<br>disk_initialize<br>disk_read</td><td>Always</td><td rowspan="5">Disk I/O functions.<br>Samples available in ffsample.zip.<br>There are many implementations on the web.</td></tr>
|
<tr><td>disk_status<br>disk_initialize<br>disk_read</td><td>Always</td><td rowspan="5">Disk I/O functions.<br>Samples available in ffsample.zip.<br>There are many implementations on the web.</td></tr>
|
||||||
<tr><td>disk_write<br>get_fattime<br>disk_ioctl (CTRL_SYNC)</td><td>FF_FS_READONLY == 0</td></tr>
|
<tr><td>disk_write<br>get_fattime<br>disk_ioctl (CTRL_SYNC)</td><td><a href="config.html#fs_readonly">FF_FS_READONLY == 0</a></td></tr>
|
||||||
<tr><td>disk_ioctl (GET_SECTOR_COUNT)<br>disk_ioctl (GET_BLOCK_SIZE)</td><td>FF_USE_MKFS == 1</td></tr>
|
<tr><td>disk_ioctl (GET_SECTOR_COUNT)<br>disk_ioctl (GET_BLOCK_SIZE)</td><td><a href="config.html#use_mkfs">FF_USE_MKFS == 1</a></td></tr>
|
||||||
<tr><td>disk_ioctl (GET_SECTOR_SIZE)</td><td>FF_MAX_SS != FF_MIN_SS</td></tr>
|
<tr><td>disk_ioctl (GET_SECTOR_SIZE)</td><td><a href="config.html#max_ss">FF_MAX_SS != FF_MIN_SS</a></td></tr>
|
||||||
<tr><td>disk_ioctl (CTRL_TRIM)</td><td>FF_USE_TRIM == 1</td></tr>
|
<tr><td>disk_ioctl (CTRL_TRIM)</td><td><a href="config.html#use_trim">FF_USE_TRIM == 1</a></td></tr>
|
||||||
<tr><td>ff_uni2oem<br>ff_oem2uni<br>ff_wtoupper</td><td>FF_USE_LFN != 0</td><td>Unicode support functions.<br>Add optional module ffunicode.c to the project.</td></tr>
|
<tr><td>ff_uni2oem<br>ff_oem2uni<br>ff_wtoupper</td><td><a href="config.html#use_lfn">FF_USE_LFN != 0</a></td><td>Unicode support functions.<br>Add optional module ffunicode.c to the project.</td></tr>
|
||||||
<tr><td>ff_cre_syncobj<br>ff_del_syncobj<br>ff_req_grant<br>ff_rel_grant</td><td>FF_FS_REENTRANT == 1</td><td rowspan="2">O/S dependent functions.<br>Sample code is available in ffsystem.c.</td></tr>
|
<tr><td>ff_cre_syncobj<br>ff_del_syncobj<br>ff_req_grant<br>ff_rel_grant</td><td><a href="config.html#fs_reentrant">FF_FS_REENTRANT == 1</a></td><td rowspan="2">O/S dependent functions.<br>Sample code is available in ffsystem.c.</td></tr>
|
||||||
<tr><td>ff_mem_alloc<br>ff_mem_free</td><td>FF_USE_LFN == 3</td></tr>
|
<tr><td>ff_mem_alloc<br>ff_mem_free</td><td>FF_USE_LFN == 3</td></tr>
|
||||||
</table>
|
</table>
|
||||||
<p>FatFs cares about neither what kind of storage device is used nor how it is implemented. Only a requirement is that it is a block device read/written in fixed-size blocks that accessible via the disk I/O functions defined above.</p>
|
<p>FatFs cares about neither what kind of storage device is used nor how it is implemented. Only a requirement is that it is a block device read/written in fixed-size blocks that accessible via the disk I/O functions defined above.</p>
|
||||||
@ -103,17 +103,17 @@ The FatFs module is a middleware written in ANSI C (C89). There is no platform d
|
|||||||
<tr><th></th><th>ARM7<small><br>32bit</small></th><th>ARM7<small><br>Thumb</small></th><th>CM3<small><br>Thumb-2</small></th><th>AVR</th><th>H8/300H</th><th>PIC24</th><th>RL78</th><th>V850ES</th><th>SH-2A</th><th>RX600</th><th>IA-32</th></tr>
|
<tr><th></th><th>ARM7<small><br>32bit</small></th><th>ARM7<small><br>Thumb</small></th><th>CM3<small><br>Thumb-2</small></th><th>AVR</th><th>H8/300H</th><th>PIC24</th><th>RL78</th><th>V850ES</th><th>SH-2A</th><th>RX600</th><th>IA-32</th></tr>
|
||||||
<tr class="cal"> <td>Compiler</td><td>GCC</td><td>GCC</td><td>GCC</td><td>GCC</td><td>CH38</td><td>C30</td><td>CC78K0R</td><td>CA850</td><td>SHC</td><td>RXC</td><td>MSC</td></tr>
|
<tr class="cal"> <td>Compiler</td><td>GCC</td><td>GCC</td><td>GCC</td><td>GCC</td><td>CH38</td><td>C30</td><td>CC78K0R</td><td>CA850</td><td>SHC</td><td>RXC</td><td>MSC</td></tr>
|
||||||
<!-- ARM Thumb CM3 AVR H8 PIC24 RL78 V850ES SH-2A RX600 IA-32 -->
|
<!-- ARM Thumb CM3 AVR H8 PIC24 RL78 V850ES SH-2A RX600 IA-32 -->
|
||||||
<tr class="ral"><td class="cal">text (Full, R/W)</td><td>10.6k</td><td>6.8k</td><td>6.4k</td><td>12.4k</td><td>10.1k</td><td>11.4k</td><td>13.1k</td><td>8.9k</td><td>9.1k</td><td>6.5k</td><td>9.0k</td></tr>
|
<tr class="ral"><td class="cal">.text (Full, R/W)</td><td>10.4k</td><td>6.7k</td><td>6.1k</td><td>12.5k</td><td>11.0k</td><td>11.6k</td><td>13.0k</td><td>8.9k</td><td>9.2k</td><td>6.5k</td><td>8.9k</td></tr>
|
||||||
<tr class="ral"><td class="cal">text (Min, R/W)</td> <td>7.2k</td><td>4.8k</td><td>4.6k</td> <td>8.5k</td> <td>7.1k</td> <td>8.0k</td> <td>9.6k</td><td>6.3k</td><td>6.3k</td><td>4.7k</td><td>6.4k</td></tr>
|
<tr class="ral"><td class="cal">.text (Min, R/W)</td> <td>7.0k</td><td>4.7k</td><td>4.2k</td> <td>8.5k</td> <td>7.6k</td> <td>8.1k</td> <td>9.5k</td><td>6.2k</td><td>6.4k</td><td>4.6k</td><td>6.4k</td></tr>
|
||||||
<tr class="ral"><td class="cal">text (Full, R/O)</td> <td>5.0k</td><td>3.2k</td><td>2.9k</td> <td>6.0k</td> <td>4.8k</td> <td>5.5k</td> <td>6.6k</td><td>4.4k</td><td>4.1k</td><td>3.2k</td><td>4.3k</td></tr>
|
<tr class="ral"><td class="cal">.text (Full, R/O)</td> <td>4.9k</td><td>3.2k</td><td>2.7k</td> <td>6.1k</td> <td>5.2k</td> <td>5.5k</td> <td>6.5k</td><td>4.3k</td><td>4.2k</td><td>3.2k</td><td>4.3k</td></tr>
|
||||||
<tr class="ral"><td class="cal">text (Min, R/O)</td> <td>3.8k</td><td>2.5k</td><td>2.3k</td> <td>4.4k</td> <td>3.8k</td> <td>4.2k</td> <td>5.2k</td><td>3.4k</td><td>3.3k</td><td>2.5k</td><td>3.5k</td></tr>
|
<tr class="ral"><td class="cal">.text (Min, R/O)</td> <td>3.7k</td><td>2.5k</td><td>2.1k</td> <td>4.4k</td> <td>4.0k</td> <td>4.3k</td> <td>5.1k</td><td>3.4k</td><td>3.3k</td><td>2.5k</td><td>3.5k</td></tr>
|
||||||
<tr class="ral"><td class="cal">bss</td><td>V*4 + 2</td><td>V*4 + 2</td><td>V*4 + 2</td><td>V*2 + 2</td><td>V*4 + 2</td><td>V*2 + 2</td><td>V*2 + 2</td><td>V*4 + 2</td><td>V*4 + 2</td><td>V*4 + 2</td><td>V*4 + 2</td></tr>
|
<tr class="ral"><td class="cal">.bss</td><td>V*4 + 2</td><td>V*4 + 2</td><td>V*4 + 2</td><td>V*2 + 2</td><td>V*4 + 2</td><td>V*2 + 2</td><td>V*2 + 2</td><td>V*4 + 2</td><td>V*4 + 2</td><td>V*4 + 2</td><td>V*4 + 2</td></tr>
|
||||||
<tr class="ral"><td class="cal">Work area<br><small>(FF_FS_TINY == 0)</small></td><td>V*564<br>+ F*552</td><td>V*564<br>+ F*552</td><td>V*564<br>+ F*552</td><td>V*560<br>+ F*546</td><td>V*560<br>+ F*546</td><td>V*560<br>+ F*546</td><td>V*560<br>+ F*546</td><td>V*564<br>+ F*552</td><td>V*564<br>+ F*552</td><td>V*564<br>+ F*552</td><td>V*564<br>+ F*552</td></tr>
|
<tr class="ral"><td class="cal">Work area<br><small>(FF_FS_TINY == 0)</small></td><td>V*564<br>+ F*552</td><td>V*564<br>+ F*552</td><td>V*564<br>+ F*552</td><td>V*560<br>+ F*546</td><td>V*560<br>+ F*546</td><td>V*560<br>+ F*546</td><td>V*560<br>+ F*546</td><td>V*564<br>+ F*552</td><td>V*564<br>+ F*552</td><td>V*564<br>+ F*552</td><td>V*564<br>+ F*552</td></tr>
|
||||||
<tr class="ral"><td class="cal">Work area<br><small>(FF_FS_TINY == 1)</small></td><td>V*564<br>+ F*40</td><td>V*564<br>+ F*40</td><td>V*564<br>+ F*40</td><td>V*560<br>+ F*34</td><td>V*560<br>+ F*34</td><td>V*560<br>+ F*34</td><td>V*560<br>+ F*34</td><td>V*564<br>+ F*40</td><td>V*564<br>+ F*40</td><td>V*564<br>+ F*40</td><td>V*564<br>+ F*40</td></tr>
|
<tr class="ral"><td class="cal">Work area<br><small>(FF_FS_TINY == 1)</small></td><td>V*564<br>+ F*40</td><td>V*564<br>+ F*40</td><td>V*564<br>+ F*40</td><td>V*560<br>+ F*34</td><td>V*560<br>+ F*34</td><td>V*560<br>+ F*34</td><td>V*560<br>+ F*34</td><td>V*564<br>+ F*40</td><td>V*564<br>+ F*40</td><td>V*564<br>+ F*40</td><td>V*564<br>+ F*40</td></tr>
|
||||||
</table>
|
</table>
|
||||||
<p>These are the memory usage of FatFs module without lower layer on some target systems in following condition. <em>V</em> denotes number of mounted volumes and <em>F</em> denotes number of open files. Every samples here are optimezed in code size.</p>
|
<p>These are the memory usage of FatFs module without lower layer on some target systems in following condition. <em>V</em> denotes number of mounted volumes and <em>F</em> denotes number of open files. Every samples here are optimezed in code size.</p>
|
||||||
<pre>
|
<pre>
|
||||||
FatFs R0.14a options:
|
FatFs R0.14b options:
|
||||||
FF_FS_READONLY 0 (Read/Write) or 1 (Read only)
|
FF_FS_READONLY 0 (Read/Write) or 1 (Read only)
|
||||||
FF_FS_MINIMIZE 0 (Full, with all basic functions) or 3 (Min, with fully minimized)
|
FF_FS_MINIMIZE 0 (Full, with all basic functions) or 3 (Min, with fully minimized)
|
||||||
FF_FS_TINY 0 (Default) or 1 (Tiny file object)
|
FF_FS_TINY 0 (Default) or 1 (Tiny file object)
|
||||||
@ -123,9 +123,9 @@ And any other options are left unchanged from original setting.
|
|||||||
|
|
||||||
<div class="para doc" id="reduce">
|
<div class="para doc" id="reduce">
|
||||||
<h3>Reducing Module Size</h3>
|
<h3>Reducing Module Size</h3>
|
||||||
<p>Follwing table shows which API function is removed by configuration options for the module size reduction. To use any API function, the row of the function must be clear.</p>
|
<p>Follwing table shows which API function is removed by configuration options to reduce the module size. To use an API function, the row of the function must be clear.</p>
|
||||||
<table class="lst2">
|
<table class="lst2">
|
||||||
<tr><td rowspan="2">Function</td><td colspan="4">FF_FS_<br>MINIMIZE</td><td colspan="2">FF_FS_<br>READONLY</td><td colspan="2">FF_USE_<br>STRFUNC</td><td colspan="3">FF_FS_<br>RPATH</td><td colspan="2">FF_USE_<br>FIND</td><td colspan="2">FF_USE_<br>CHMOD</td><td colspan="2">FF_USE_<br>EXPAND</td><td colspan="2">FF_USE_<br>LABEL</td><td colspan="2">FF_USE_<br>MKFS</td><td colspan="2">FF_USE_<br>FORWARD</td><td colspan="2">FF_MULTI_<br>PARTITION</td></tr>
|
<tr><td rowspan="2">Function</td><td colspan="4"><a href="config.html#fs_minimize">FF_FS_<br>MINIMIZE</a></td><td colspan="2"><a href="config.html#fs_readonly">FF_FS_<br>READONLY</a></td><td colspan="2"><a href="config.html#use_strfunc">FF_USE_<br>STRFUNC</a></td><td colspan="3"><a href="config.html#fs_rpath">FF_FS_<br>RPATH</a></td><td colspan="2"><a href="config.html#use_find">FF_USE_<br>FIND</a></td><td colspan="2"><a href="config.html#use_chmod">FF_USE_<br>CHMOD</a></td><td colspan="2"><a href="config.html#use_expand">FF_USE_<br>EXPAND</a></td><td colspan="2"><a href="config.html#use_label">FF_USE_<br>LABEL</a></td><td colspan="2"><a href="config.html#use_mkfs">FF_USE_<br>MKFS</a></td><td colspan="2"><a href="config.html#use_forward">FF_USE_<br>FORWARD</a></td><td colspan="2"><a href="config.html#multi_partition">FF_MULTI_<br>PARTITION</a></td></tr>
|
||||||
<tr> <td>0</td><td>1</td><td>2</td><td>3</td><td>0</td><td>1</td><td>0</td><td>1</td><td>0</td><td>1</td><td>2</td><td>0</td><td>1</td><td>0</td><td>1</td><td>0</td><td>1</td><td>0</td><td>1</td><td>0</td><td>1</td><td>0</td><td>1</td><td>0</td><td>1</td></tr>
|
<tr> <td>0</td><td>1</td><td>2</td><td>3</td><td>0</td><td>1</td><td>0</td><td>1</td><td>0</td><td>1</td><td>2</td><td>0</td><td>1</td><td>0</td><td>1</td><td>0</td><td>1</td><td>0</td><td>1</td><td>0</td><td>1</td><td>0</td><td>1</td><td>0</td><td>1</td></tr>
|
||||||
<tr class="lst3">
|
<tr class="lst3">
|
||||||
<td>f_mount</td> <td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td></tr>
|
<td>f_mount</td> <td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td></tr>
|
||||||
@ -166,7 +166,7 @@ And any other options are left unchanged from original setting.
|
|||||||
|
|
||||||
<div class="para doc" id="lfn">
|
<div class="para doc" id="lfn">
|
||||||
<h3>Long File Name</h3>
|
<h3>Long File Name</h3>
|
||||||
<p>FatFs module supports the long file name (LFN) extension of the FAT filesystem. The two different file names, short file name (SFN) and LFN, of a file is transparent on the API. The support for LFN feature is disabled by default. To enable the LFN, set <tt><a href="config.html#use_lfn">FF_USE_LFN</a></tt> to 1, 2 or 3, and add <tt>ffunicode.c</tt> to the project. The LFN feature requiers a certain working buffer. The buffer size can be configured by <tt><a href="config.html#max_lfn">FF_MAX_LFN</a></tt> according to the available memory. The length of an LFN can be up to 255 characters, so that the <tt>FF_MAX_LFN</tt> should be set to 255 for all existing file names. If the size of working buffer is insufficient for the input file name, the file function fails with <tt>FR_INVALID_NAME</tt>. When use any re-entry to the API with LFN feature, <tt>FF_USE_LFN</tt> must be set to 2 or 3. In this case, the file function allocates the working buffer on the stack or heap. The LFN working buffer occupies <tt>(FF_MAX_LFN + 1) * 2</tt> bytes and additional <tt>(FF_MAX_LFN + 44) / 15 * 32</tt> bytes when exFAT is enabled.</p>
|
<p>FatFs module supports the long file name (LFN) extension of the FAT filesystem. The two different file names, short file name (SFN) and LFN, of a file is transparent on the API. The support for LFN feature is disabled by default. To enable the LFN, set <tt><a href="config.html#use_lfn">FF_USE_LFN</a></tt> to 1, 2 or 3, and add <tt>ffunicode.c</tt> to the project. The LFN feature requiers a certain working buffer. The buffer size can be configured by <tt><a href="config.html#max_lfn">FF_MAX_LFN</a></tt> according to the available memory. The length of LFN can be up to 255 characters, so that the <tt>FF_MAX_LFN</tt> should be set to 255 for any existing file names. If the size of working buffer is insufficient for the input file name, the file function fails with <tt>FR_INVALID_NAME</tt>. When use any re-entry to the API with LFN feature in RTOS environment, <tt>FF_USE_LFN</tt> must be set to 2 or 3. In this case, the file function allocates the working buffer on the stack or heap. The LFN working buffer occupies <tt>(FF_MAX_LFN + 1) * 2</tt> bytes and additional <tt>(FF_MAX_LFN + 44) / 15 * 32</tt> bytes when exFAT is enabled.</p>
|
||||||
<h4>Impact upon Module Size</h4>
|
<h4>Impact upon Module Size</h4>
|
||||||
<table class="lst2 rset">
|
<table class="lst2 rset">
|
||||||
<caption>With LFN at CM3 + gcc</caption>
|
<caption>With LFN at CM3 + gcc</caption>
|
||||||
@ -179,14 +179,14 @@ And any other options are left unchanged from original setting.
|
|||||||
<tr><td>0 (All code pages)</td><td>+486k</td></tr>
|
<tr><td>0 (All code pages)</td><td>+486k</td></tr>
|
||||||
</table>
|
</table>
|
||||||
<p>When the LFN is enabled, the module size will be increased depends on the configured code page. Right table shows the increment of code size in some code pages. Especially, in the CJK region, tens of thousands of characters are being used. Unfortunately, it requires a huge OEM-Unicode bidirectional conversion table and the module size will be drastically increased as shown in the table.</p>
|
<p>When the LFN is enabled, the module size will be increased depends on the configured code page. Right table shows the increment of code size in some code pages. Especially, in the CJK region, tens of thousands of characters are being used. Unfortunately, it requires a huge OEM-Unicode bidirectional conversion table and the module size will be drastically increased as shown in the table.</p>
|
||||||
<p>As the result, the FatFs with LFN enabled with DBCS code pages will not able to be ported on the most 8-bit MCU systems. If the target system is in legacy-free, in only Unicode and any ANSI/OEM code is not used at all, the code page setting gets meaningless. You will able to reduce the code size by configureing FatFs for Unicode with any SBCS code page.</p>
|
<p>As the result, the FatFs with LFN enabled with DBCS code pages will not able to be ported on the most 8-bit MCU systems. If the target system is in legacy-free, in only Unicode and any ANSI/OEM code is not used at all, the code page setting gets meaningless. You will able to reduce the code size by configureing FatFs for Unicode API with any SBCS code page.</p>
|
||||||
<p>There ware some restrictions on using LFN for open source project, because the LFN extension on the FAT filesystem was a patent of Microsoft Corporation. However the related patents all have expired and using the LFN feature is free for any projects.</p>
|
<p>There ware some restrictions on using LFN for open source project, because the LFN extension on the FAT filesystem was a patent of Microsoft Corporation. However the related patents all have expired and using the LFN feature is free for any projects.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="para doc" id="unicode">
|
<div class="para doc" id="unicode">
|
||||||
<h3>Unicode API</h3>
|
<h3>Unicode API</h3>
|
||||||
<p>By default, FatFs uses ANSI/OEM code set on the API even in LFN configuration. FatFs can also switch the character encoding on the API to Unicode by configuration option <tt><a href="config.html#lfn_unicode">FF_LFN_UNICODE</a></tt>. This means that FatFs is compliant with the full featured LFN specification. The data type <tt>TCHAR</tt> specifies path name strings on the API is an alias of either <tt>char</tt>(ANSI/OEM or UTF-8), <tt>WCHAR</tt>(UTF-16) or <tt>DWORD</tt>(UTF-32) depends on that option. For more information, refer to the description in the <a href="filename.html#uni">file name</a>.</p>
|
<p>By default, FatFs uses ANSI/OEM code set on the API even in LFN configuration. FatFs can also switch the character encoding on the API to Unicode by configuration option <tt><a href="config.html#lfn_unicode">FF_LFN_UNICODE</a></tt>. This means that FatFs is compliant with the full featured LFN specification. The data type <tt>TCHAR</tt> specifies path name strings on the API is an alias of either <tt>char</tt>(ANSI/OEM or UTF-8), <tt>WCHAR</tt>(UTF-16) or <tt>DWORD</tt>(UTF-32) depends on that option. For more information, refer to the description in the <a href="filename.html#uni">file name</a>.</p>
|
||||||
<p>Note that setting of code page, <tt><a href="config.html#code_page">FF_CODE_PAGE</a></tt>, has actually no meaning when FatFs is configured for the Unicode API. It should be set 437 anyway. However it still affects code conversion of string I/O functions at <tt><a href="config.html#strf_encode">FF_STRF_ENCODE</a> == 0</tt> and backward compatibility with legacy systems, so that code page may need to be configured properly if it is considered a problem.</p>
|
<p>Note that setting of code page, <tt><a href="config.html#code_page">FF_CODE_PAGE</a></tt>, has actually no meaning when FatFs is configured for the Unicode API. It should be set 437 to reduce the module size. However it still affects code conversion of string I/O functions when <tt><a href="config.html#strf_encode">FF_STRF_ENCODE</a> == 0</tt>, and also backward compatibility with legacy systems. In this case, the code page may need to be configured properly if it is considered a problem.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="para doc" id="exfat">
|
<div class="para doc" id="exfat">
|
||||||
@ -198,8 +198,8 @@ And any other options are left unchanged from original setting.
|
|||||||
|
|
||||||
<div class="para doc" id="lba64">
|
<div class="para doc" id="lba64">
|
||||||
<h3>64-bit LBA</h3>
|
<h3>64-bit LBA</h3>
|
||||||
<p>LBA (Logical Block Addressing) is an addressing method to specify the location of data block, called sector, on the storage media. It is a simple linear address beginning from 0 as the first block of data. The host system does not need to consider how the data block is located and managed in the storage device. FatFs supports only LBA for the media access. 32-bit LBA is a common size at the interface of the most storage devices. It can address up to 2<sup>32</sup> blocks, 2 TB in 512 bytes/sector. When a storage device larger than 2 TB is used, larger sector size or 64-bit LBA will be needed to address the entire block of the storage device.</p>
|
<p>LBA (Logical Block Addressing) is an addressing method to specify the location of data block, called <em>sector</em>, on the storage media. It is a simple linear address beginning from 0 as the first sector, 1 as the second sector and so on. The host system does not need to consider how the data block is located and managed in the storage device. FatFs supports only LBA for the media access. 32-bit LBA is a common size in the most LBA scheme. It can address up to 2<sup>32</sup> sectors, 2 TB in 512 bytes/sector. When a storage device larger than 2 TB is used, larger sector size or 64-bit LBA will be needed to address the entire sectors of the storage device.</p>
|
||||||
<p>By default, FatFs works in 32-bit LBA for media access interface. FatFs can also switch it to 64-bit LBA by a configuration option <tt><a href="config.html#fs_lba64">FF_LBA64</a></tt>. It also enables GPT (GUID Partition Table) for partiotion management on the storage device. For further information about GPT, refer to <tt><a href="mkfs.html">f_mkfs</a></tt> and <tt><a href="fdisk.html">f_fdisk</a></tt> function.</p>
|
<p>By default, FatFs works in 32-bit LBA for media access. FatFs can also switch it to 64-bit LBA by a configuration option <tt><a href="config.html#fs_lba64">FF_LBA64</a></tt>. It also enables GPT (GUID Partition Table) for partiotion management on the storage device. For further information about GPT, refer to <tt><a href="mkfs.html">f_mkfs</a></tt> and <tt><a href="fdisk.html">f_fdisk</a></tt> function.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="para doc" id="reentrant">
|
<div class="para doc" id="reentrant">
|
||||||
@ -291,9 +291,9 @@ Figure 5. Minimized critical section<br>
|
|||||||
<h3>Various Usable Functions for FatFs Projects</h3>
|
<h3>Various Usable Functions for FatFs Projects</h3>
|
||||||
<p>These are examples of extended use of FatFs APIs. New item will be added when useful code example is found.</p>
|
<p>These are examples of extended use of FatFs APIs. New item will be added when useful code example is found.</p>
|
||||||
<ol>
|
<ol>
|
||||||
<li><a href="http://elm-chan.org/fsw/ff/res/app1.c">Open or Create File for Append</a> (superseded by FA_APPEND flag added in R0.12)</li>
|
<li><a href="http://elm-chan.org/fsw/ff/res/app1.c">Open or Create File for Append</a> (superseded by FA_OPEN_APPEND flag added at R0.12)</li>
|
||||||
<li><a href="http://elm-chan.org/fsw/ff/res/app2.c">Delete Non-empty Sub-directory</a> (for R0.12 and later)</li>
|
<li><a href="http://elm-chan.org/fsw/ff/res/app2.c">Delete Non-empty Sub-directory</a> (for R0.12 and later)</li>
|
||||||
<li><a href="http://elm-chan.org/fsw/ff/res/app3.c">Create Contiguous File</a> (superseded by f_expand function added in R0.12)</li>
|
<li><a href="http://elm-chan.org/fsw/ff/res/app3.c">Create Contiguous File</a> (superseded by f_expand function added at R0.12)</li>
|
||||||
<li><a href="http://elm-chan.org/fsw/ff/res/app5.c">Test if the File is Contiguous or Not</a></li>
|
<li><a href="http://elm-chan.org/fsw/ff/res/app5.c">Test if the File is Contiguous or Not</a></li>
|
||||||
<li><a href="http://elm-chan.org/fsw/ff/res/app4.c">Compatibility Checker for Storage Device Control Module</a></li>
|
<li><a href="http://elm-chan.org/fsw/ff/res/app4.c">Compatibility Checker for Storage Device Control Module</a></li>
|
||||||
<li><a href="http://elm-chan.org/fsw/ff/res/app6.c">Performance Checker for Storage Device Control Module</a></li>
|
<li><a href="http://elm-chan.org/fsw/ff/res/app6.c">Performance Checker for Storage Device Control Module</a></li>
|
||||||
@ -326,7 +326,7 @@ Figure 5. Minimized critical section<br>
|
|||||||
/ by use of this software.
|
/ by use of this software.
|
||||||
/----------------------------------------------------------------------------*/
|
/----------------------------------------------------------------------------*/
|
||||||
</pre>
|
</pre>
|
||||||
<p>Therefore FatFs license is one of the BSD-style licenses but there is a significant feature. FatFs is mainly intended for embedded systems. In order to extend the usability for commercial products, the redistributions of FatFs in binary form, such as embedded code, binary library and any forms without source code, does not need to include about FatFs in the documentations. This is equivalent to the 1-clause BSD license. Of course FatFs is compatible with the most of open source software licenses including GNU GPL. When you redistribute the FatFs source code with any changes or create a fork, the license can also be changed to GNU GPL, BSD-style license or any open source software license that compatible with FatFs license.</p>
|
<p>Therefore FatFs license is one of the BSD-style licenses but there is a significant feature. FatFs is mainly intended for embedded systems. In order to extend the usability for commercial products, the redistributions of FatFs in binary form, such as embedded code, binary library and any forms without source code, does not need to include about FatFs in the documentations. This is equivalent to the 1-clause BSD license. Of course FatFs is compatible with the most of open source software licenses includs GNU GPL. When you redistribute the FatFs source code with any changes or create a fork, the license can also be changed to GNU GPL, BSD-style license or any open source software license that compatible with FatFs license.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<p class="foot"><a href="../00index_e.html">Return Home</a></p>
|
<p class="foot"><a href="../00index_e.html">Return Home</a></p>
|
||||||
|
|||||||
@ -50,7 +50,7 @@ FRESULT f_chdir (
|
|||||||
|
|
||||||
<div class="para desc">
|
<div class="para desc">
|
||||||
<h4>Description</h4>
|
<h4>Description</h4>
|
||||||
<p>The <tt>f_chdir</tt> function changes the current directory of the logical drive. Also the current drive will be changed when Unix style volume ID, <tt><a href="config.html#str_volume_id">FF_STR_VOLUME_ID</a> == 2</tt>, is selected. The current directory of each logical drive is initialized to the root directory on mount.</p>
|
<p>The <tt>f_chdir</tt> function changes the current directory of the logical drive. Also the current drive will be changed when in Unix style drive prefix, <tt><a href="config.html#str_volume_id">FF_STR_VOLUME_ID</a> == 2</tt>. The current directory of each logical drive is initialized to the root directory on mount.</p>
|
||||||
<p>Note that the current directory is retained in the each file system object and the current drive is retained in a static variable, so that it also affects other tasks that use the file functions.</p>
|
<p>Note that the current directory is retained in the each file system object and the current drive is retained in a static variable, so that it also affects other tasks that use the file functions.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@ -41,7 +41,7 @@ FRESULT f_chdrive (
|
|||||||
|
|
||||||
<div class="para desc">
|
<div class="para desc">
|
||||||
<h4>Description</h4>
|
<h4>Description</h4>
|
||||||
<p>The <tt>f_chdrive</tt> function changes only the current drive. The initial value of the current drive number is 0. Note that the current drive is retained in a static variable, so that it also affects other tasks that using the file functions.</p>
|
<p>The <tt>f_chdrive</tt> function changes only the current drive. The initial value of the current drive number is 0. In Unix style drive prefix configuration, this function will not be needed because <tt>f_chdir</tt> function changes also the current drive. Note that the current drive is retained in a static variable, so that it also affects other tasks that using the file functions.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="para comp">
|
<div class="para comp">
|
||||||
@ -56,8 +56,6 @@ FRESULT f_chdrive (
|
|||||||
<em>f_chdrive</em>("2:"); <span class="c">/* Set drive 2 as current drive */</span>
|
<em>f_chdrive</em>("2:"); <span class="c">/* Set drive 2 as current drive */</span>
|
||||||
|
|
||||||
<em>f_chdrive</em>(""); <span class="c">/* No effect (set current drive as current drive) */</span>
|
<em>f_chdrive</em>(""); <span class="c">/* No effect (set current drive as current drive) */</span>
|
||||||
|
|
||||||
<em>f_chdrive</em>("/flash"); <span class="c">/* Set drive "flash" as current drive (at Unix style volume ID) */</span>
|
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@ -17,7 +17,6 @@
|
|||||||
<ul>
|
<ul>
|
||||||
<li><a href="#fs_readonly">FF_FS_READONLY</a></li>
|
<li><a href="#fs_readonly">FF_FS_READONLY</a></li>
|
||||||
<li><a href="#fs_minimize">FF_FS_MINIMIZE</a></li>
|
<li><a href="#fs_minimize">FF_FS_MINIMIZE</a></li>
|
||||||
<li><a href="#use_strfunc">FF_USE_STRFUNC</a></li>
|
|
||||||
<li><a href="#use_find">FF_USE_FIND</a></li>
|
<li><a href="#use_find">FF_USE_FIND</a></li>
|
||||||
<li><a href="#use_mkfs">FF_USE_MKFS</a></li>
|
<li><a href="#use_mkfs">FF_USE_MKFS</a></li>
|
||||||
<li><a href="#use_fastseek">FF_USE_FASTSEEK</a></li>
|
<li><a href="#use_fastseek">FF_USE_FASTSEEK</a></li>
|
||||||
@ -25,6 +24,10 @@
|
|||||||
<li><a href="#use_chmod">FF_USE_CHMOD</a></li>
|
<li><a href="#use_chmod">FF_USE_CHMOD</a></li>
|
||||||
<li><a href="#use_label">FF_USE_LABEL</a></li>
|
<li><a href="#use_label">FF_USE_LABEL</a></li>
|
||||||
<li><a href="#use_forward">FF_USE_FORWARD</a></li>
|
<li><a href="#use_forward">FF_USE_FORWARD</a></li>
|
||||||
|
<li><a href="#use_strfunc">FF_USE_STRFUNC</a></li>
|
||||||
|
<li><a href="#print_lli">FF_PRINT_LLI</a></li>
|
||||||
|
<li><a href="#print_fp">FF_PRINT_FLOAT</a></li>
|
||||||
|
<li><a href="#strf_encode">FF_STRF_ENCODE</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li>Namespace and Locale Configurations
|
<li>Namespace and Locale Configurations
|
||||||
@ -34,7 +37,6 @@
|
|||||||
<li><a href="#max_lfn">FF_MAX_LFN</a></li>
|
<li><a href="#max_lfn">FF_MAX_LFN</a></li>
|
||||||
<li><a href="#lfn_unicode">FF_LFN_UNICODE</a></li>
|
<li><a href="#lfn_unicode">FF_LFN_UNICODE</a></li>
|
||||||
<li><a href="#lfn_buf">FF_LFN_BUF, FF_SFN_BUF</a></li>
|
<li><a href="#lfn_buf">FF_LFN_BUF, FF_SFN_BUF</a></li>
|
||||||
<li><a href="#strf_encode">FF_STRF_ENCODE</a></li>
|
|
||||||
<li><a href="#fs_rpath">FF_FS_RPATH</a></li>
|
<li><a href="#fs_rpath">FF_FS_RPATH</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
@ -81,15 +83,6 @@
|
|||||||
<tr><td>3</td><td><tt>f_lseek</tt> function is removed in addition to 2.</td></tr>
|
<tr><td>3</td><td><tt>f_lseek</tt> function is removed in addition to 2.</td></tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<h4 id="use_strfunc">FF_USE_STRFUNC</h4>
|
|
||||||
<p>This option switches string functions, <tt>f_gets</tt>, <tt>f_putc</tt>, <tt>f_puts</tt> and <tt>f_printf</tt>.</p>
|
|
||||||
<table class="lst1">
|
|
||||||
<tr><th>Value</th><th>Description</th></tr>
|
|
||||||
<tr><td>0</td><td>Disable string functions.</td></tr>
|
|
||||||
<tr><td>1</td><td>Enable string functions without LF-CRLF conversion.</td></tr>
|
|
||||||
<tr><td>2</td><td>Enable string functions with LF-CRLF conversion.</td></tr>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<h4 id="use_find">FF_USE_FIND</h4>
|
<h4 id="use_find">FF_USE_FIND</h4>
|
||||||
<p>Disable (0) or Enable (1) filtered directory read functions, <tt>f_findfirst</tt> and <tt>f_findnext</tt>. Also <tt>FF_FS_MINIMIZE</tt> needs to be 0 or 1.</p>
|
<p>Disable (0) or Enable (1) filtered directory read functions, <tt>f_findfirst</tt> and <tt>f_findnext</tt>. Also <tt>FF_FS_MINIMIZE</tt> needs to be 0 or 1.</p>
|
||||||
|
|
||||||
@ -111,6 +104,38 @@
|
|||||||
<h4 id="use_forward">FF_USE_FORWARD</h4>
|
<h4 id="use_forward">FF_USE_FORWARD</h4>
|
||||||
<p>Disable (0) or Enable (1) <tt>f_forward</tt> function.</p>
|
<p>Disable (0) or Enable (1) <tt>f_forward</tt> function.</p>
|
||||||
|
|
||||||
|
<h4 id="use_strfunc">FF_USE_STRFUNC</h4>
|
||||||
|
<p>This option switches string functions, <tt>f_gets</tt>, <tt>f_putc</tt>, <tt>f_puts</tt> and <tt>f_printf</tt>. These functions are equivalents of regular string stream I/O functions in POSIX. If <tt>sprintf</tt> is available and code conversion is not needed, <tt>f_write</tt> with <tt>sprintf</tt> will be efficient in code size and performance rather than <tt>f_printf</tt>.</p>
|
||||||
|
<table class="lst1">
|
||||||
|
<tr><th>Value</th><th>Description</th></tr>
|
||||||
|
<tr><td>0</td><td>Disable string functions.</td></tr>
|
||||||
|
<tr><td>1</td><td>Enable string functions without LF-CRLF conversion.</td></tr>
|
||||||
|
<tr><td>2</td><td>Enable string functions with LF-CRLF conversion.</td></tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<h4 id="print_lli">FF_PRINT_LLI</h4>
|
||||||
|
<p>This option switches support for long long integer argument in <tt>f_printf</tt>.</p>
|
||||||
|
<p>Disable (0) or Enable (1). C standard needs to be C99 or later to enable this feature.</p>
|
||||||
|
|
||||||
|
<h4 id="print_fp">FF_PRINT_FLOAT</h4>
|
||||||
|
<p>This option switches support for floating point argument in <tt>f_printf</tt>. C standard needs to be C99 or later to enable this feature.</p>
|
||||||
|
<table class="lst1">
|
||||||
|
<tr><th>Value</th><th>Description</th></tr>
|
||||||
|
<tr><td>0</td><td>Disable floating point argument.</td></tr>
|
||||||
|
<tr><td>1</td><td>Enable floating point argument in type <tt>'f'</tt>, <tt>'e'</tt> and <tt>'E'</tt>.</td></tr>
|
||||||
|
<tr><td>2</td><td>Enable with decimal separator <tt>','</tt> instead of <tt>'.'</tt>.</td></tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<h4 id="strf_encode">FF_STRF_ENCODE</h4>
|
||||||
|
<p>When character encoding on the API is Unicode (<tt>FF_LFN_UNICODE >= 1</tt>), string I/O functions enabled by <tt>FF_USE_STRFUNC</tt> convert the character encoding in it. This option defines the assumption of character encoding <em>on the file</em> to be read/written via those functions. When LFN is not enabled or <tt>FF_LFN_UNICODE == 0</tt>, the string functions work without any code conversion and this option has no effect.</p>
|
||||||
|
<table class="lst2">
|
||||||
|
<tr><th>Value</th><th>Character encoding on the file</th></tr>
|
||||||
|
<tr><td>0</td><td>ANSI/OEM in current code page</td></tr>
|
||||||
|
<tr><td>1</td><td>Unicode in UTF-16LE</td></tr>
|
||||||
|
<tr><td>2</td><td>Unicode in UTF-16BE</td></tr>
|
||||||
|
<tr><td>3</td><td>Unicode in UTF-8</td></tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
@ -118,7 +143,7 @@
|
|||||||
<h3>Namespace and Locale Configurations</h3>
|
<h3>Namespace and Locale Configurations</h3>
|
||||||
|
|
||||||
<h4 id="code_page">FF_CODE_PAGE</h4>
|
<h4 id="code_page">FF_CODE_PAGE</h4>
|
||||||
<p>This option specifies the OEM code page used on the target system. Incorrect setting of the code page can cause a file open failure. If any non-ASCII character is not used for the path name or character encoding is in Unicode, there is no difference between any code page settings. Set it 437 anyway.</p>
|
<p>This option specifies the OEM code page used on the target system. Incorrect setting of the code page can cause a file open failure. If any non-ASCII character is not used for the path name or <tt>FF_LFN_UNICODE != 0</tt>, there is no difference between any code page settings. Set it 437 anyway.</p>
|
||||||
<table class="lst1">
|
<table class="lst1">
|
||||||
<tr><th>Value</th><th>Code page</th></tr>
|
<tr><th>Value</th><th>Code page</th></tr>
|
||||||
<tr><td>0</td><td>Includes all code pages below and set by <tt>f_setcp()</tt></td></tr>
|
<tr><td>0</td><td>Includes all code pages below and set by <tt>f_setcp()</tt></td></tr>
|
||||||
@ -181,16 +206,6 @@
|
|||||||
</table>
|
</table>
|
||||||
<p>If the size of name member is insufficient for the LFN, the item is treated as without LFN. When LFN is not enabled, these options have no effect.</p>
|
<p>If the size of name member is insufficient for the LFN, the item is treated as without LFN. When LFN is not enabled, these options have no effect.</p>
|
||||||
|
|
||||||
<h4 id="strf_encode">FF_STRF_ENCODE</h4>
|
|
||||||
<p>When character encoding on the API is Unicode (<tt>FF_LFN_UNICODE >= 1</tt>), string I/O functions, <tt>f_gets</tt>, <tt>f_putc</tt>, <tt>f_puts</tt> and <tt>f_printf</tt>, convert the character encoding in it. This option defines the assumption of character encoding <em>on the file</em> to be read/written via those functions. When LFN is not enabled or <tt>FF_LFN_UNICODE == 0</tt>, the string functions work without any encoding conversion and this option has no effect.</p>
|
|
||||||
<table class="lst2">
|
|
||||||
<tr><th>Value</th><th>Character encoding on the file</th></tr>
|
|
||||||
<tr><td>0</td><td>ANSI/OEM in current code page</td></tr>
|
|
||||||
<tr><td>1</td><td>Unicode in UTF-16LE</td></tr>
|
|
||||||
<tr><td>2</td><td>Unicode in UTF-16BE</td></tr>
|
|
||||||
<tr><td>3</td><td>Unicode in UTF-8</td></tr>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<h4 id="fs_rpath">FF_FS_RPATH</h4>
|
<h4 id="fs_rpath">FF_FS_RPATH</h4>
|
||||||
<p>This option configures relative path function. For more information, read <a href="filename.html#nam">here</a>.</p>
|
<p>This option configures relative path function. For more information, read <a href="filename.html#nam">here</a>.</p>
|
||||||
<table class="lst1">
|
<table class="lst1">
|
||||||
@ -213,7 +228,7 @@
|
|||||||
<p>This option switches the support for string volume ID. When arbitrary string for the volume ID is enabled for the drive prefix, also pre-defined strings by <tt>FF_VOLUME_STRS</tt> or user defined strings can be used as drive prefix in the path name. Numeric drive number is always valid regardless of this option, and also either format of drive prefix can be enabled by this option.</p>
|
<p>This option switches the support for string volume ID. When arbitrary string for the volume ID is enabled for the drive prefix, also pre-defined strings by <tt>FF_VOLUME_STRS</tt> or user defined strings can be used as drive prefix in the path name. Numeric drive number is always valid regardless of this option, and also either format of drive prefix can be enabled by this option.</p>
|
||||||
<table class="lst2">
|
<table class="lst2">
|
||||||
<tr><th>Value</th><th>Description</th><th>Example</th></tr>
|
<tr><th>Value</th><th>Description</th><th>Example</th></tr>
|
||||||
<tr><td>0</td><td>Only DOS/Windows style drive prefix in numeric ID can be used.</td><td>0:/filename</td></tr>
|
<tr><td>0</td><td>Only DOS/Windows style drive prefix in numeric ID can be used.</td><td>1:/filename</td></tr>
|
||||||
<tr><td>1</td><td>Also DOS/Windows style drive prefix in string ID can be used.</td><td>flash:/filename</td></tr>
|
<tr><td>1</td><td>Also DOS/Windows style drive prefix in string ID can be used.</td><td>flash:/filename</td></tr>
|
||||||
<tr><td>2</td><td>Also Unix style drive prefix in string ID can be used.</td><td>/flash/filename</td></tr>
|
<tr><td>2</td><td>Also Unix style drive prefix in string ID can be used.</td><td>/flash/filename</td></tr>
|
||||||
</table>
|
</table>
|
||||||
@ -221,8 +236,8 @@
|
|||||||
<h4 id="volume_strs">FF_VOLUME_STRS</h4>
|
<h4 id="volume_strs">FF_VOLUME_STRS</h4>
|
||||||
<p>This option defines the volume ID strings for each logical drives. Number of items must not be less than <tt>FF_VOLUMES</tt>. Valid characters for the volume ID string are A-Z, a-z and 0-9, however, they are compared in case-insensitive. If <tt>FF_STR_VOLUME_ID == 0</tt>, this option has no effect. If <tt>FF_STR_VOLUME_ID >= 1</tt> and this option is not defined, a user defined volume string table needs to be defined as shown below. The table should not be modified on the fly.</p>
|
<p>This option defines the volume ID strings for each logical drives. Number of items must not be less than <tt>FF_VOLUMES</tt>. Valid characters for the volume ID string are A-Z, a-z and 0-9, however, they are compared in case-insensitive. If <tt>FF_STR_VOLUME_ID == 0</tt>, this option has no effect. If <tt>FF_STR_VOLUME_ID >= 1</tt> and this option is not defined, a user defined volume string table needs to be defined as shown below. The table should not be modified on the fly.</p>
|
||||||
<pre>
|
<pre>
|
||||||
<span class="c">/* User defined volume ID strings for 0: 1: 2: 3: ... */</span>
|
<span class="c">/* User defined volume ID strings for 0: to 3: */</span>
|
||||||
const char* VolumeStr[FF_VOLUMES] = {"ram","flash","sdc","usb"};
|
const char* VolumeStr[FF_VOLUMES] = {"ram","flash","sd","usb"};
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
<h4 id="multi_partition">FF_MULTI_PARTITION</h4>
|
<h4 id="multi_partition">FF_MULTI_PARTITION</h4>
|
||||||
|
|||||||
@ -80,9 +80,9 @@ DRESULT disk_ioctl (
|
|||||||
<tr><td>MMC_GET_CID</td><td>Reads CID register and sets it into a 16-byte buffer pointed by <tt class="arg">buff</tt>. (MMC/SDC specific command)</td></tr>
|
<tr><td>MMC_GET_CID</td><td>Reads CID register and sets it into a 16-byte buffer pointed by <tt class="arg">buff</tt>. (MMC/SDC specific command)</td></tr>
|
||||||
<tr><td>MMC_GET_OCR</td><td>Reads OCR register and sets it into a 4-byte buffer pointed by <tt class="arg">buff</tt>. (MMC/SDC specific command)</td></tr>
|
<tr><td>MMC_GET_OCR</td><td>Reads OCR register and sets it into a 4-byte buffer pointed by <tt class="arg">buff</tt>. (MMC/SDC specific command)</td></tr>
|
||||||
<tr><td>MMC_GET_SDSTAT</td><td>Reads SDSTATUS register and sets it into a 64-byte buffer pointed by <tt class="arg">buff</tt>. (SDC specific command)</td></tr>
|
<tr><td>MMC_GET_SDSTAT</td><td>Reads SDSTATUS register and sets it into a 64-byte buffer pointed by <tt class="arg">buff</tt>. (SDC specific command)</td></tr>
|
||||||
<tr><td>ATA_GET_REV</td><td>Gets the revision string and sets it into a 16-byte buffer pointed by <tt class="arg">buff</tt>. (ATA/CFC specific command)</td></tr>
|
<tr><td>ATA_GET_REV</td><td>Reads the revision string and sets it into a 16-byte buffer pointed by <tt class="arg">buff</tt>. (ATA/CFC specific command)</td></tr>
|
||||||
<tr><td>ATA_GET_MODEL</td><td>Gets the model string and sets it into a 40-byte buffer pointed by <tt class="arg">buff</tt>. (ATA/CFC specific command)</td></tr>
|
<tr><td>ATA_GET_MODEL</td><td>Reads the model string and sets it into a 40-byte buffer pointed by <tt class="arg">buff</tt>. (ATA/CFC specific command)</td></tr>
|
||||||
<tr><td>ATA_GET_SN</td><td>Gets the serial number string and sets it into a 20-byte buffer pointed by <tt class="arg">buff</tt>. (ATA/CFC specific command)</td></tr>
|
<tr><td>ATA_GET_SN</td><td>Reads the serial number string and sets it into a 20-byte buffer pointed by <tt class="arg">buff</tt>. (ATA/CFC specific command)</td></tr>
|
||||||
<tr><td>ISDIO_READ</td><td>Reads a block of iSDIO registers specified by command structure pointed by <tt class="arg">buff</tt>. (FlashAir specific command)</td></tr>
|
<tr><td>ISDIO_READ</td><td>Reads a block of iSDIO registers specified by command structure pointed by <tt class="arg">buff</tt>. (FlashAir specific command)</td></tr>
|
||||||
<tr><td>ISDIO_WRITE</td><td>Writes a block of data to iSDIO registers specified by command structure pointed by <tt class="arg">buff</tt>. (FlashAir specific command)</td></tr>
|
<tr><td>ISDIO_WRITE</td><td>Writes a block of data to iSDIO registers specified by command structure pointed by <tt class="arg">buff</tt>. (FlashAir specific command)</td></tr>
|
||||||
<tr><td>ISDIO_MRITE</td><td>Changes bits in an iSDIO register specified by command structure pointed by <tt class="arg">buff</tt>. (FlashAir specific command)</td></tr>
|
<tr><td>ISDIO_MRITE</td><td>Changes bits in an iSDIO register specified by command structure pointed by <tt class="arg">buff</tt>. (FlashAir specific command)</td></tr>
|
||||||
|
|||||||
@ -32,7 +32,7 @@ DRESULT disk_read (
|
|||||||
<dt>buff</dt>
|
<dt>buff</dt>
|
||||||
<dd>Pointer to the first item of the <em>byte array</em> to store read data. Size of read data will be the sector size * <tt class="arg">count</tt> bytes.</dd>
|
<dd>Pointer to the first item of the <em>byte array</em> to store read data. Size of read data will be the sector size * <tt class="arg">count</tt> bytes.</dd>
|
||||||
<dt>sector</dt>
|
<dt>sector</dt>
|
||||||
<dd>Start sector number in 32-bit or 64-bit LBA. The data type <tt>LBA_t</tt> is an alias of <tt>DWORD</tt> or <tt>QWORD</tt> depends on the configuration option.</dd>
|
<dd>Start sector number in LBA. The data type <tt>LBA_t</tt> is an alias of <tt>DWORD</tt> or <tt>QWORD</tt> depends on the configuration option.</dd>
|
||||||
<dt>count</dt>
|
<dt>count</dt>
|
||||||
<dd>Number of sectors to read.</dd>
|
<dd>Number of sectors to read.</dd>
|
||||||
</dl>
|
</dl>
|
||||||
@ -57,7 +57,7 @@ DRESULT disk_read (
|
|||||||
<div class="para desc">
|
<div class="para desc">
|
||||||
<h4>Description</h4>
|
<h4>Description</h4>
|
||||||
<p>Read/write operation to the generic storage devices, such as memory card, hadddisk and optical disk, is done in unit of block of data bytes called <em>sector</em>. FatFs supports the sector size in range of 512 to 4096 bytes. When FatFs is configured for fixed sector size (<tt>FF_MIN_SS == FF_MAX_SS</tt>, this is the most case), the generic read/write function must work at the sector size only. When FatFs is configured for variable sector size (<tt>FF_MIN_SS < FF_MAX_SS</tt>), the sector size of medium is inquired with <tt>disk_ioctl</tt> function after <tt>disk_initialize</tt> function succeeded.</p>
|
<p>Read/write operation to the generic storage devices, such as memory card, hadddisk and optical disk, is done in unit of block of data bytes called <em>sector</em>. FatFs supports the sector size in range of 512 to 4096 bytes. When FatFs is configured for fixed sector size (<tt>FF_MIN_SS == FF_MAX_SS</tt>, this is the most case), the generic read/write function must work at the sector size only. When FatFs is configured for variable sector size (<tt>FF_MIN_SS < FF_MAX_SS</tt>), the sector size of medium is inquired with <tt>disk_ioctl</tt> function after <tt>disk_initialize</tt> function succeeded.</p>
|
||||||
<p>There are some considerations about the memory addres passed via <tt class="arg">buff</tt>. It is not that always aligned with the word boundary because the argument is defined as <tt>BYTE*</tt>. The unaligned transfer request can occure at <a href="appnote.html#fs1">direct transfer</a>. If the bus architecture, especially DMA controller, does not allow unaligned memory access, it should be solved in this function. If it is the case, there are some workarounds described below to avoid this issue.</p>
|
<p>There are some considerations about the memory addres passed via <tt class="arg">buff</tt>. It is not that always aligned with the word boundary, because the argument is defined as <tt>BYTE*</tt>. The unaligned transfer request can occure at <a href="appnote.html#fs1">direct transfer</a>. If the bus architecture, especially DMA controller, does not allow unaligned memory access, it should be solved in this function. If it is the case, there are some workarounds described below to avoid this issue.</p>
|
||||||
<ul>
|
<ul>
|
||||||
<li>Convert word transfer to byte transfer with some trick in this function. - Recommended.</li>
|
<li>Convert word transfer to byte transfer with some trick in this function. - Recommended.</li>
|
||||||
<li>On the <tt>f_read()</tt> calls, avoid long read request that includes a whole of sector. - Any direct transfer never occures.</li>
|
<li>On the <tt>f_read()</tt> calls, avoid long read request that includes a whole of sector. - Any direct transfer never occures.</li>
|
||||||
|
|||||||
@ -32,7 +32,7 @@ DRESULT disk_write (
|
|||||||
<dt>buff</dt>
|
<dt>buff</dt>
|
||||||
<dd>Pointer to the first item of the <em>byte array</em> to be written. The size of data to be written is sector size * <tt class="arg">count</tt> bytes.</dd>
|
<dd>Pointer to the first item of the <em>byte array</em> to be written. The size of data to be written is sector size * <tt class="arg">count</tt> bytes.</dd>
|
||||||
<dt>sector</dt>
|
<dt>sector</dt>
|
||||||
<dd>Start sector number in 32-bit or 64-bit LBA. The data type <tt>LBA_t</tt> is an alias of <tt>DWORD</tt> or <tt>QWORD</tt> depends on the configuration option.</dd>
|
<dd>Start sector number in LBA. The data type <tt>LBA_t</tt> is an alias of <tt>DWORD</tt> or <tt>QWORD</tt> depends on the configuration option.</dd>
|
||||||
<dt>count</dt>
|
<dt>count</dt>
|
||||||
<dd>Number of sectors to write.</dd>
|
<dd>Number of sectors to write.</dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
|||||||
@ -52,7 +52,7 @@ FRESULT f_expand (
|
|||||||
|
|
||||||
<div class="para desc">
|
<div class="para desc">
|
||||||
<h4>Description</h4>
|
<h4>Description</h4>
|
||||||
<p>The <tt>f_expand</tt> function prepares or allocates a contiguous data area to the file. When <tt class="arg">opt</tt> is 1, the data area is allocated to the file in this function. Unlike expansion of file size by <tt>f_lseek</tt> function, the file must be truncated prior to use this function and read/write pointer of the file stays at offset 0 after the function call. The file content allocated with this function is <em>undefined</em> because no data is written to the file in this process. The function can fail with <tt>FR_DENIED</tt> due to some reasons below.</p>
|
<p>The <tt>f_expand</tt> function prepares or allocates a contiguous data area to the file. When <tt class="arg">opt</tt> is 1, the data area is allocated to the file in this function. Unlike expansion of file size by <tt>f_lseek</tt> function, the file must be truncated prior to use this function and read/write pointer of the file stays at offset 0 after the function call. The file content allocated with this function is <em>undefined</em>, because no data is written to the file in this process. The function can fail with <tt>FR_DENIED</tt> due to some reasons below.</p>
|
||||||
<ul>
|
<ul>
|
||||||
<li>No free contiguous space was found.</li>
|
<li>No free contiguous space was found.</li>
|
||||||
<li>Size of the file was not zero.</li>
|
<li>Size of the file was not zero.</li>
|
||||||
|
|||||||
@ -16,10 +16,10 @@
|
|||||||
<h3>Format of the Path Names</h3>
|
<h3>Format of the Path Names</h3>
|
||||||
<p>The format of path name on the FatFs module is similer to the filename specs of DOS/Windos as follows:</p>
|
<p>The format of path name on the FatFs module is similer to the filename specs of DOS/Windos as follows:</p>
|
||||||
<pre>[<em>drive#</em>:][/]<em>directory</em>/<em>file</em></pre>
|
<pre>[<em>drive#</em>:][/]<em>directory</em>/<em>file</em></pre>
|
||||||
<p>The FatFs module supports long file name (LFN) and 8.3 format file name (SFN). The LFN can be used when <tt><a href="config.html#use_lfn">FF_USE_LFN</a> >= 1</tt>. The sub-directories are separated with a <tt>\</tt> or <tt>/</tt> as the same way as DOS/Windows API. Duplicated separators are skipped and ignored. Only a difference is that the heading drive prefix to specify the logical drive number is in a numeral (0-9) + a colon, while it is an alphabet (A-Z) + a colon in DOS/Windows. The logical drive number is identifier to specify the FAT volume to be accessed. When drive prefix is omitted, the logical drive number is assumed as <em>default drive</em>.</p>
|
<p>The FatFs module supports long file name (LFN) and 8.3 format file name (SFN). The LFN can be used when <tt><a href="config.html#use_lfn">FF_USE_LFN</a> >= 1</tt>. The sub-directories are separated with a <tt>\</tt> or <tt>/</tt> as the same way as DOS/Windows API. Duplicated separator and terminating separator, such as <tt>"/<em>/</em>animal/<em>//</em>cat<em>/</em>"</tt>, are ignored. Only a difference is that the heading drive prefix to specify the <a href="#vol">logical drive</a> is in a digit (0-9) + a colon, while it is in an alphabet (A-Z) + a colon in DOS/Windows. The logical drive number is the identifier to specify the FAT volume to be accessed. When drive prefix is omitted, the logical drive number is assumed as <em>default drive</em>.</p>
|
||||||
<p>Control characters (<tt>\0</tt> to <tt>\x1F</tt>) are recognized as end of the path name. Leading/embedded white spaces in the path name are valid as a part of the name in LFN configuration but the white space is recognized as end of the path name in non-LFN configuration. Trailing white spaces and dots are ignored in both configurations.</p>
|
<p>Control characters (<tt>\0</tt> to <tt>\x1F</tt>) are recognized as end of the path name. Leading/embedded white spaces in the path name are valid as a part of the name in LFN configuration, but the white space is recognized as end of the path name in non-LFN configuration.</p>
|
||||||
<p>In default configuration (<tt><a href="config.html#fs_rpath">FF_FS_RPATH</a> == 0</tt>), it does not have a concept of current directory like OS oriented filesystem. Every object on the volume is always specified in full path name that followed from the root directory. Dot directory names (<tt>".", ".."</tt>) are not allowed. Heading separator is ignored and it can be exist or omitted. The default drive is fixed to drive 0.</p>
|
<p>In default configuration (<tt><a href="config.html#fs_rpath">FF_FS_RPATH</a> == 0</tt>), it does not have a concept of current directory like OS oriented filesystem. Every object on the volume is always specified in full path name followed from the root directory. Dot directory names (<tt>".", ".."</tt>) are not allowed. Heading separator is ignored and it can be exist or omitted. The default drive is fixed to drive 0.</p>
|
||||||
<p>When relative path is enabled (<tt>FF_FS_RPATH >= 1</tt>), specified path is followed from the root directory if a heading separator is exist. If not, it is followed from the current directory of the drive set by <a href="chdir.html"><tt>f_chdir</tt></a> function. Dot names are also allowed for the path names. The default drive is the current drive set by <a href="chdrive.html"><tt>f_chdrive</tt></a> function.</p>
|
<p>When relative path feature is enabled (<tt>FF_FS_RPATH >= 1</tt>), specified path is followed from the root directory if a heading separator is exist. If not, it is followed from the current directory of the default drive. Dot directory name is also allowed for the path name. The current directory is set by <a href="chdir.html"><tt>f_chdir</tt></a> function and the default drive is the current drive set by <a href="chdrive.html"><tt>f_chdrive</tt></a> function.</p>
|
||||||
<table class="lst2">
|
<table class="lst2">
|
||||||
<tr><td>Path name</td><td>FF_FS_RPATH == 0</td><td>FF_FS_RPATH >= 1</td></tr>
|
<tr><td>Path name</td><td>FF_FS_RPATH == 0</td><td>FF_FS_RPATH >= 1</td></tr>
|
||||||
<tr class="lst3"><td>file.txt</td><td>A file in the root directory of the drive 0</td><td>A file in the current directory of the current drive</td></tr>
|
<tr class="lst3"><td>file.txt</td><td>A file in the root directory of the drive 0</td><td>A file in the current directory of the current drive</td></tr>
|
||||||
@ -35,21 +35,21 @@
|
|||||||
<tr><td>dir1/..</td><td>Invalid name</td><td>The current directory</td></tr>
|
<tr><td>dir1/..</td><td>Invalid name</td><td>The current directory</td></tr>
|
||||||
<tr><td>/..</td><td>Invalid name</td><td>The root directory (sticks the top level)</td></tr>
|
<tr><td>/..</td><td>Invalid name</td><td>The root directory (sticks the top level)</td></tr>
|
||||||
</table>
|
</table>
|
||||||
<p>Also the drive prefix can be in pre-defined arbitrary string. When the option <tt><a href="config.html#str_volume_id">FF_STR_VOLUME_ID</a> == 1</tt>, also arbitrary string volume ID can be used as drive prefix. e.g. <tt>"flash:file1.txt"</tt>, <tt>"ram:temp.dat"</tt> or <tt>"sd:"</tt>. When <tt>FF_STR_VOLUME_ID == 2</tt>, Unix style drive prefix can be used. e.g. <tt>"/flash/file1.txt"</tt>, <tt>"/ram/temp.dat"</tt> or <tt>"/usb"</tt>. However, it cannot traverse the drives such as <tt>"/flash/../ram/temp.dat"</tt>. The Unix style drive prefix may lead a confusion in identification between volume ID and file name. For instance, which does <tt>"/flash"</tt> mean, a file <tt>"flash"</tt> on the root directory without drive prefix or a drive prefix of <tt>"flash"</tt>? If the string following a heading slash matches with any volume ID, it is treated as a drive prefix.</p>
|
<p>Also the drive prefix can be in pre-defined arbitrary string. When the option <tt><a href="config.html#str_volume_id">FF_STR_VOLUME_ID</a> == 1</tt>, also arbitrary string volume ID can be used as drive prefix. e.g. <tt>"<em>flash:</em>file1.txt"</tt>, <tt>"<em>ram:</em>temp.dat"</tt> or <tt>"<em>sd:</em>"</tt>. If the srting does not match any volume ID, the function fails with <tt>FR_INVALID_DRIVE</tt>.</p>
|
||||||
|
<p>When <tt>FF_STR_VOLUME_ID == 2</tt>, Unix style drive prefix can be used. e.g. <tt>"<em>/flash</em>/file1.txt"</tt>, <tt>"<em>/ram</em>/temp.dat"</tt> or <tt>"<em>/sd</em>"</tt>. If a heading separator is exist, it is treated as start of drive prefix and in absolute path. Any form as "root directory in current drive" and "current directory in specified drive" cannot be used. Double dot entry cannot traverse the drives such as <tt>"<em>/flash</em>/..<em>/ram</em>/foo.dat"</tt>.</p>
|
||||||
<p><em>Remark: In this revision, double dot name <tt>".."</tt> cannot follow the parent directory on the exFAT volume. It will work as <tt>"."</tt> and stay there.</em></p>
|
<p><em>Remark: In this revision, double dot name <tt>".."</tt> cannot follow the parent directory on the exFAT volume. It will work as <tt>"."</tt> and stay there.</em></p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="para doc" id="case">
|
<div class="para doc" id="case">
|
||||||
<h3>Legal Characters and Case Sensitivity</h3>
|
<h3>Legal Characters and Case Sensitivity</h3>
|
||||||
<p>On the FAT filesystem, legal characters for object name (file/directory name) are, <tt>0-9 A-Z ! # $ % & ' ( ) - @ ^ _ ` { } ~</tt> and any extended character. The valid character codes of extended characters are depends on the configured code page. Under LFN supported system, also <tt>+ , ; = [ ]</tt> and white space are legal for the object name and the white spaces and dots can be placed anywhere in the path name except end of the name.</p>
|
<p>In the generic FAT filesystems, the legal characters for object name (file/directory name) are, <tt>0-9 A-Z ! # $ % & ' ( ) - @ ^ _ ` { } ~</tt> in ASCII and extended characters <tt>\x80</tt> to <tt>\xFF</tt>. In the FAT filesystems with LFN extention, also <tt>+ , ; = [ ]</tt>, white space and extended characters <tt>U+000080</tt> to <tt>U+10FFFF</tt> are legal for the object name. White spaces and dots can be placed anywhere in the path name except end of the name. Trailing white spaces and dots are ignored.</p>
|
||||||
<p>FAT filesystem is case-insensitive to the object names on the volume. Object name on the FAT volume is compared in case-insensitive. For instance, these three names, <tt>file.txt</tt>, <tt>File.Txt</tt> and <tt>FILE.TXT</tt>, are identical. This is applied to extended charactres as well. When an object is created on the FAT volume, up converted name is recorded to the SFN entry, and the raw name is recorded to the LFN entry when LFN function is enabled.</p>
|
<p>FAT filesystem is case-insensitive to the object names on the volume. Object name on the FAT volume is compared in case-insensitive. For instance, these three names, <tt>file.txt</tt>, <tt>File.Txt</tt> and <tt>FILE.TXT</tt>, are identical on the FAT filesystem. This is applied to extended charactres as well. When an object is created on the FAT volume, up converted name is recorded to the SFN entry, and the raw name is recorded to the LFN entry when LFN extension is exist.</p>
|
||||||
<p>As for the MS-DOS and PC DOS for CJK (DOS/DBCS), extended characters ware recorded to the SFN entry without up-case conversion and compared in case-sensitive. This causes a problem on compatibility with Windows system when any object with extended characters is created on the volume by DOS/DBCS system; therfore the object names with DBCS extended characters should not be used on the FAT volume shared by those systems. FatFs works with case-sensitive to the extended characters in only non-LFN with DBCS configuration (DOS/DBCS specs). But in LFN configuration, FatFs works with case-insensitive to the extended character (WindowsNT specs).</p>
|
<p>As for the MS-DOS and PC DOS for CJK (DOS/DBCS), extended characters ware recorded to the SFN entry without up-case conversion and compared in case-sensitive. This causes a problem on compatibility with Windows system when the object with extended characters is created on the volume by DOS/DBCS system; therfore the object names with DBCS extended characters should not be used on the FAT volume shared by those systems. FatFs works with case-sensitive to the extended characters in only non-LFN with DBCS configuration (DOS/DBCS specs). But in LFN configuration, FatFs works with case-insensitive to the extended character (WindowsNT specs).</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="para doc" id="uni">
|
<div class="para doc" id="uni">
|
||||||
<h3>Unicode API</h3>
|
<h3>Unicode API</h3>
|
||||||
<p>The path names are input/output in either ANSI/OEM code or Unicode depends on the configuration options. The type of arguments which specifies the path names is defined as <tt>TCHAR</tt>. It is an alias of <tt>char</tt> by default and the code set used for the path name string is ANSI/OEM specifid by <tt><a href="config.html#code_page">FF_CODE_PAGE</a></tt>. When <tt><a href="config.html#lfn_unicode">FF_LFN_UNICODE</a></tt> is set to 1 or larger, the type of the <tt>TCHAR</tt> is switched to proper type to support the Unicode string. When Unicode API is specified by this option, the full-featured LFN specification is supported and the Unicode specific characters, such as ✝☪✡☸☭, can also be used for the path name. It also affects data types and encoding of the string I/O functions. To define literal strings, <tt>_T(s)</tt> and <tt>_TEXT(s)</tt> macro are available to specify the string in proper type. The code shown below is an example to define the literal strings.</p>
|
<p>The path names are input/output in either ANSI/OEM code or Unicode depends on the configuration options. The type of arguments which specifies the path names is defined as <tt>TCHAR</tt>. It is an alias of <tt>char</tt> by default and the code set used for the path name string is ANSI/OEM specifid by <tt><a href="config.html#code_page">FF_CODE_PAGE</a></tt>. When <tt><a href="config.html#lfn_unicode">FF_LFN_UNICODE</a></tt> is set to 1 or larger, the type of the <tt>TCHAR</tt> is switched to proper type to support the Unicode string. When Unicode API is specified by this option, the full-featured LFN specification is supported and the Unicode specific characters, such as ✝☪✡☸☭ and any character not in BMP, can also be used for the path name. It also affects data types and encoding of the string I/O functions. To define literal strings, <tt>_T(s)</tt> and <tt>_TEXT(s)</tt> macro are available to specify the string in proper type. The code shown below is an example to define the literal strings.</p>
|
||||||
<pre>
|
<pre>
|
||||||
f_open(fp, <span class="e">"filename.txt"</span>, FA_READ); <span class="c">/* ANSI/OEM string (char) */</span>
|
f_open(fp, <span class="e">"filename.txt"</span>, FA_READ); <span class="c">/* ANSI/OEM string (char) */</span>
|
||||||
f_open(fp, <span class="e">L"filename.txt"</span>, FA_READ); <span class="c">/* UTF-16 string (WCHAR) */</span>
|
f_open(fp, <span class="e">L"filename.txt"</span>, FA_READ); <span class="c">/* UTF-16 string (WCHAR) */</span>
|
||||||
@ -61,27 +61,27 @@
|
|||||||
|
|
||||||
<div class="para doc" id="vol">
|
<div class="para doc" id="vol">
|
||||||
<h3>Volume Management</h3>
|
<h3>Volume Management</h3>
|
||||||
<p>By default, each logical drive is associated with the physical drive in same drive number. An FAT volume on the physical drive is serched by the volume mount process. It reads boot sectors and checks it if it is an FAT boot sector in order of LBA 0 as SFD format, 1st partition, 2nd partition, 3rd partition, ..., as MBR or GPT format.</p>
|
<p>By default, each logical drive is associated with the physical drive in same drive number. An FAT volume on the physical drive is serched in the volume mount process. It reads boot sectors and checks it if it is an FAT boot sector in order of LBA 0 as SFD format, 1st partition, 2nd partition, 3rd partition, ..., as MBR or GPT format.</p>
|
||||||
<p>When multiple partition feature is enabled, <tt><a href="config.html#multi_partition">FF_MULTI_PARTITION = 1</a></tt>, each individual logical drive is associated with arbitrary partition or drive specified by volume management table, <tt>VolToPart[]</tt>. The table needs to be defined by user to resolve the mappings of logical drives and partitions. Following code is an example of a volume management table.</p>
|
<p>When multiple partition feature is enabled, <tt><a href="config.html#multi_partition">FF_MULTI_PARTITION = 1</a></tt>, each individual logical drive is associated with arbitrary partition or physical drive specified by volume management table, <tt>VolToPart[]</tt>. The table needs to be defined by user to resolve mappings of the logical drive numbers and the target partitions. Following code is an example of a volume management table.</p>
|
||||||
<pre>
|
<pre>
|
||||||
Example: "0:", "1:" and "2:" are associated with three partitions on the physical drive 0 (fixed drive)
|
Example: "0:", "1:" and "2:" are associated with three partitions on the physical drive 0 (fixed drive)
|
||||||
"3:" is associated with physical drive 1 (removable drive)
|
"3:" is associated with physical drive 1 (removable drive)
|
||||||
|
|
||||||
PARTITION VolToPart[FF_VOLUMES] = {
|
PARTITION VolToPart[FF_VOLUMES] = {
|
||||||
{0, 1}, <span class="c">/* "0:" ==> 1st partition on physical drive 0 */</span>
|
{0, 1}, <span class="c">/* "0:" ==> 1st partition on the pd#0 */</span>
|
||||||
{0, 2}, <span class="c">/* "1:" ==> 2nd partition on physical drive 0 */</span>
|
{0, 2}, <span class="c">/* "1:" ==> 2nd partition on the pd#0 */</span>
|
||||||
{0, 3}, <span class="c">/* "2:" ==> 3rd partition on physical drive 0 */</span>
|
{0, 3}, <span class="c">/* "2:" ==> 3rd partition on the pd#0 */</span>
|
||||||
{1, 0} <span class="c">/* "3:" ==> Physical drive 1 */</span>
|
{1, 0} <span class="c">/* "3:" ==> A valie FAT volume on the pd#1 (.pt = 0 specifies auto-search) */</span>
|
||||||
};
|
};
|
||||||
</pre>
|
</pre>
|
||||||
<div><img src="../res/f7.png" width="900" height="288" alt="relationship between logical drive and physical drive"></div>
|
<div><img src="../res/f7.png" width="900" height="288" alt="relationship between logical drive and physical drive"></div>
|
||||||
<p>There are some considerations on using multi-partition configuration.</p>
|
<p>There are some considerations when enable the multi-partition configuration.</p>
|
||||||
<ul>
|
<ul>
|
||||||
<li>The physical drive that hosts two or more mounted partitions must be non-removable, or all volumes on the drive must be unmounted when remove the medium.</li>
|
<li>The physical drive that hosts two or more mounted partitions should be non-removable, or all volumes on the drive must be unmounted when remove the medium.</li>
|
||||||
<li>When make any change to the <tt>VolToPart[]</tt>, corresponding volume should be unmounted prior to make change the item.</li>
|
<li>When make any change to the <tt>VolToPart[]</tt>, corresponding volume should be unmounted prior to make change the item.</li>
|
||||||
<li>On the MBR format drive, up to four primary partitions (1-4) can be specified. The partition 1 specifies the first item in the partition table and the partition 2 specifies the second one, and so on. Logical patitions in the extended partition is not supported.</li>
|
<li>On the MBR format drive, up to four primary partitions (1-4) can be specified. The partition number 1 specifies the first item in the partition table and the partition number 2 specifies the second one, and so on. The logical patitions (5-) in the extended partition is not supported.</li>
|
||||||
<li>On the GPT format drive, there is no limitation. The partition 1 specifies the first Microsoft basic data partition found in the partition table and the partition 2 specifies the second one found, and so on.</li>
|
<li>On the GPT format drive, the partition number 1 specifies the first Microsoft Basic Data Partition found in the partition table and the partition number 2 specifies the second one found, and so on.</li>
|
||||||
<li>Windows does not support multiple volumes on the storage with removable class. Only the first parition found on the drive will be mounted.</li>
|
<li>Windows does not support multiple volumes on the physical drive with removable class. Only the first parition found on the drive will be mounted. Windows does not support SFD format on the physical drive with fixed disk class.</li>
|
||||||
<li>For further information, refer to <tt><a href="fdisk.html">f_fdisk</a></tt> and <tt><a href="mkfs.html">f_mkfs</a></tt>function.</li>
|
<li>For further information, refer to <tt><a href="fdisk.html">f_fdisk</a></tt> and <tt><a href="mkfs.html">f_mkfs</a></tt>function.</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -65,15 +65,15 @@ FRESULT f_findfirst (
|
|||||||
<p>The matching pattern string can contain wildcard terms. For example:</p>
|
<p>The matching pattern string can contain wildcard terms. For example:</p>
|
||||||
<ul>
|
<ul>
|
||||||
<li><tt>?</tt> - An any character.</li>
|
<li><tt>?</tt> - An any character.</li>
|
||||||
<li><tt>???</tt> - Any string in length of three characters.</li>
|
<li><tt>???</tt> - An any string in length of three characters.</li>
|
||||||
<li><tt>*</tt> - Any string in length of zero or longer.</li>
|
<li><tt>*</tt> - An any string in length of zero or longer.</li>
|
||||||
<li><tt>????*</tt> - Any string in length of four characters or longer.</li>
|
<li><tt>????*</tt> - An any string in length of four characters or longer.</li>
|
||||||
</ul>
|
</ul>
|
||||||
<p>Since the matching algorithm uses recursion, number of wildcard terms in the matching pattern is limited to four. Any pattern with too many wildcard terms does not match any name. In LFN configuration, only <tt>fname[]</tt> is tested when <tt>FF_USE_FIND == 1</tt> and also <tt>altname[]</tt> is tested when <tt>FF_USE_FIND == 2</tt>. There are some differences listed below between FatFs and standard systems in matching condition.</p>
|
<p>Since the matching algorithm uses recursion, number of wildcard terms in the matching pattern is limited to four to limit the stack usage. Any pattern with too many wildcard terms does not match any name. In LFN configuration, only <tt>fname[]</tt> is tested when <tt>FF_USE_FIND == 1</tt> and also <tt>altname[]</tt> is tested when <tt>FF_USE_FIND == 2</tt>. There are some differences listed below between FatFs and standard systems in matching condition.</p>
|
||||||
<ul>
|
<ul>
|
||||||
<li><tt>"*.*"</tt> never matches any name without extension while it matches any name with or without extension in standard systems.</li>
|
<li><tt>"*.*"</tt> never matches any name without extension while it matches any name with or without extension in standard systems.</li>
|
||||||
<li>Any pattern terminated with a period never matches any name while it matches the name without extensiton in standard systems.</li>
|
<li>Any pattern terminated with a dot never matches any name while it matches the name without extensiton in standard systems.</li>
|
||||||
<li><a href="filename.html#case">DBCS extended characters</a> are compared in case-sensitive when LFN is enabled with ANSI/OEM API.</li>
|
<li><a href="filename.html#case">DBCS extended characters</a> are compared in case-sensitive when LFN is enabled with ANSI/OEM code API.</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -95,7 +95,7 @@ void find_image_file (void)
|
|||||||
DIR dj; <span class="c">/* Directory object */</span>
|
DIR dj; <span class="c">/* Directory object */</span>
|
||||||
FILINFO fno; <span class="c">/* File information */</span>
|
FILINFO fno; <span class="c">/* File information */</span>
|
||||||
|
|
||||||
fr = <em>f_findfirst</em>(&dj, &fno, "", "dsc*.jp*"); <span class="c">/* Start to search for photo files */</span>
|
fr = <em>f_findfirst</em>(&dj, &fno, "", "????????.JPG"); <span class="c">/* Start to search for photo files */</span>
|
||||||
|
|
||||||
while (fr == FR_OK && fno.fname[0]) { <span class="c">/* Repeat while an item is found */</span>
|
while (fr == FR_OK && fno.fname[0]) { <span class="c">/* Repeat while an item is found */</span>
|
||||||
printf("%s\n", fno.fname); <span class="c">/* Print the object name */</span>
|
printf("%s\n", fno.fname); <span class="c">/* Print the object name */</span>
|
||||||
|
|||||||
@ -45,7 +45,7 @@ TCHAR* f_gets (
|
|||||||
<div class="para desc">
|
<div class="para desc">
|
||||||
<h4>Description</h4>
|
<h4>Description</h4>
|
||||||
<p>The read operation continues until a <tt>'\n'</tt> is stored, reached end of the file or the buffer is filled with <tt>len - 1</tt> characters. The read string is terminated with a <tt>'\0'</tt>. When no character to read or any error occured during read operation, it returns a null pointer. The status of EOF and error can be examined with <tt>f_eof</tt> and <tt>f_error</tt> function.</p>
|
<p>The read operation continues until a <tt>'\n'</tt> is stored, reached end of the file or the buffer is filled with <tt>len - 1</tt> characters. The read string is terminated with a <tt>'\0'</tt>. When no character to read or any error occured during read operation, it returns a null pointer. The status of EOF and error can be examined with <tt>f_eof</tt> and <tt>f_error</tt> function.</p>
|
||||||
<p>When FatFs is configured to Unicode API (<tt><a href="config.html#lfn_unicode">FF_LFN_UNICODE</a> >= 1</tt>), data types on the srting fuctions, <tt>f_putc</tt>, <tt>f_puts</tt>, <tt>f_printf</tt> and <tt>f_gets</tt>, is also switched to Unicode. The character encoding <em>on the file</em> to be read via this function is assumed as <a href="config.html#strf_encode"><tt>FF_STRF_ENCODE</tt></a>. If the character encoding on the file differs from that on the API, it is converted in this function. In this case, input characters with wrong encoding will be lost.<p>
|
<p>When FatFs is configured to Unicode API (<tt><a href="config.html#lfn_unicode">FF_LFN_UNICODE</a> >= 1</tt>), data types on the srting fuctions, <tt>f_putc</tt>, <tt>f_puts</tt>, <tt>f_printf</tt> and <tt>f_gets</tt>, is also switched to Unicode. The character encoding <em>on the file</em> to be read via this function is assumed as <a href="config.html#strf_encode"><tt>FF_STRF_ENCODE</tt></a>. If the character encoding on the file differs from that on the API, it is converted in this function. In this case, input characters with wrong encoding will be lost.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -18,12 +18,12 @@
|
|||||||
<pre>
|
<pre>
|
||||||
FRESULT f_lseek (
|
FRESULT f_lseek (
|
||||||
FIL* <span class="arg">fp</span>, <span class="c">/* [IN] File object */</span>
|
FIL* <span class="arg">fp</span>, <span class="c">/* [IN] File object */</span>
|
||||||
FSIZE_t <span class="arg">ofs</span> <span class="c">/* [IN] File read/write pointer */</span>
|
FSIZE_t <span class="arg">ofs</span> <span class="c">/* [IN] Offset of file read/write pointer to be set */</span>
|
||||||
);
|
);
|
||||||
</pre>
|
</pre>
|
||||||
<pre>
|
<pre>
|
||||||
FRESULT f_rewind (
|
FRESULT f_rewind (
|
||||||
FIL* <span class="arg">fp</span>, <span class="c">/* [IN] File object */</span>
|
FIL* <span class="arg">fp</span> <span class="c">/* [IN] File object */</span>
|
||||||
);
|
);
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
@ -57,9 +57,9 @@ FRESULT f_rewind (
|
|||||||
<pre>
|
<pre>
|
||||||
#define <em>f_rewind</em>(fp) f_lseek((fp), 0)
|
#define <em>f_rewind</em>(fp) f_lseek((fp), 0)
|
||||||
</pre>
|
</pre>
|
||||||
<p>If an offset beyond the file size is specified in write mode, the file size is expanded to the specified offset. The file data in the expanded part is <em>undefined</em> because no data is written to the file in this process. This is suitable to pre-allocate a data area to the file quickly for fast write operation. When a contiguous data area needs to be allocated to the file, use <tt>f_expand</tt> function instead. After the <tt>f_lseek</tt> function succeeded, the current read/write pointer should be checked in order to make sure the read/write pointer has been moved correctry. In case of the read/write pointer is not the expected value, either of followings has been occured.</p>
|
<p>If an offset beyond the file size is specified in write mode, the file size is expanded to the specified offset. The file data in the expanded part is <em>undefined</em>, because no data is written to the file in this process. This is suitable to pre-allocate a data area to the file quickly for fast write operation. When a contiguous data area needs to be allocated to the file, use <tt>f_expand</tt> function instead. After the <tt>f_lseek</tt> function succeeded, the current read/write pointer should be checked in order to make sure the read/write pointer has been moved correctry. In case of the read/write pointer is not pointing expected offset, either of followings has been occured.</p>
|
||||||
<ul>
|
<ul>
|
||||||
<li>End of file. The specified <tt class="arg">ofs</tt> was clipped at end of the file because the file has been opened in read-only mode.</li>
|
<li>End of file. The specified <tt class="arg">ofs</tt> was clipped at end of the file in read-only mode.</li>
|
||||||
<li>Disk full. There is no free space on the volume to expand the file.</li>
|
<li>Disk full. There is no free space on the volume to expand the file.</li>
|
||||||
</ul>
|
</ul>
|
||||||
<p>The fast seek feature enables fast backward/long seek operations without FAT access by using an on-memory CLMT (cluster link map table). It is applied to <tt>f_read</tt> and <tt>f_write</tt> function as well, however, the file size cannot be expanded by <tt>f_write</tt>, <tt>f_lseek</tt> function while the file is at fast seek mode.</p>
|
<p>The fast seek feature enables fast backward/long seek operations without FAT access by using an on-memory CLMT (cluster link map table). It is applied to <tt>f_read</tt> and <tt>f_write</tt> function as well, however, the file size cannot be expanded by <tt>f_write</tt>, <tt>f_lseek</tt> function while the file is at fast seek mode.</p>
|
||||||
@ -101,11 +101,11 @@ FRESULT f_rewind (
|
|||||||
res = <em>f_lseek</em>(fp, PRE_SIZE); <span class="c">/* Expand file size (cluster pre-allocation) */</span>
|
res = <em>f_lseek</em>(fp, PRE_SIZE); <span class="c">/* Expand file size (cluster pre-allocation) */</span>
|
||||||
if (res || f_tell(fp) != PRE_SIZE) ... <span class="c">/* Check if the file has been expanded successfly */</span>
|
if (res || f_tell(fp) != PRE_SIZE) ... <span class="c">/* Check if the file has been expanded successfly */</span>
|
||||||
|
|
||||||
res = <em>f_lseek</em>(fp, DATA_START); <span class="c">/* Record data stream WITHOUT cluster allocation delay */</span>
|
res = <em>f_lseek</em>(fp, OFS_DATA); <span class="c">/* Record data stream with free from cluster allocation delay */</span>
|
||||||
... <span class="c">/* Write operation should be aligned to sector boundary to optimize the write throughput */</span>
|
... <span class="c">/* Write operation should be aligned to sector boundary to optimize the write throughput */</span>
|
||||||
|
|
||||||
res = f_truncate(fp); <span class="c">/* Truncate unused area */</span>
|
res = f_truncate(fp); <span class="c">/* Truncate unused area */</span>
|
||||||
res = <em>f_lseek</em>(fp, 0); <span class="c">/* Set file header */</span>
|
res = <em>f_lseek</em>(fp, OFS_HEADER); <span class="c">/* Set file header */</span>
|
||||||
...
|
...
|
||||||
|
|
||||||
res = f_close(fp);
|
res = f_close(fp);
|
||||||
|
|||||||
@ -30,21 +30,21 @@ FRESULT f_mkfs (
|
|||||||
<dt>path</dt>
|
<dt>path</dt>
|
||||||
<dd>Pointer to the null-terminated string specifies the <a href="filename.html">logical drive</a> to be formatted. If it does not have a drive number in it, it means to specify the default drive. The logical drive may or may not have been mounted for the format process.</dd>
|
<dd>Pointer to the null-terminated string specifies the <a href="filename.html">logical drive</a> to be formatted. If it does not have a drive number in it, it means to specify the default drive. The logical drive may or may not have been mounted for the format process.</dd>
|
||||||
<dt>opt</dt>
|
<dt>opt</dt>
|
||||||
<dd>Specifies the structure that is holding format options. If a null pointer is given, it gives the function all options in default value. The format option structure has five members described below:<br>
|
<dd>Specifies the format option structure <tt>MKFS_PARM</tt> holding format options. If a null pointer is given, it gives the function all options in default value. The structure has five members described below:<br>
|
||||||
<dl class="par">
|
<dl class="par">
|
||||||
<dt>BYTE fmt</dt>
|
<dt>BYTE fmt</dt>
|
||||||
<dd>Specifies combination of FAT type flags, <tt>FM_FAT</tt>, <tt>FM_FAT32</tt>, <tt>FM_EXFAT</tt> and bitwise-or of these three, <tt>FM_ANY</tt>. <tt>FM_EXFAT</tt> is ignored when exFAT is not enabled. These flags specify which FAT type to be created on the volume. If two or more types are specified, one out of them will be selected depends on the volume size and <tt class="arg">au_size</tt>. The flag <tt>FM_SFD</tt> specifies to create the volume on the drive in SFD format. The default value is <tt>FM_ANY</tt>.</dd>
|
<dd>Specifies combination of FAT type flags, <tt>FM_FAT</tt>, <tt>FM_FAT32</tt>, <tt>FM_EXFAT</tt> and bitwise-or of these three, <tt>FM_ANY</tt>. <tt>FM_EXFAT</tt> is ignored when exFAT is not enabled. These flags specify which FAT type to be created on the volume. If two or more types are specified, one out of them will be selected depends on the volume size and <tt class="arg">au_size</tt>. The flag <tt>FM_SFD</tt> specifies to create the volume on the drive in SFD format. The default value is <tt>FM_ANY</tt>.</dd>
|
||||||
<dt>DWORD au_size</dt>
|
<dt>DWORD au_size</dt>
|
||||||
<dd>Specifies size of the allocation unit (cluter) in unit of byte. The valid value is power of 2 between sector size and 128 * sector size inclusive for FAT/FAT32 volume and up to 16 MB for exFAT volume. If a zero (the default value) or any invalid value is given, the default allocation unit size depends on the volume size is used.</dd>
|
<dd>Specifies size of the allocation unit (cluter) in unit of byte. The valid value is power of 2 between sector size and 128 * sector size inclusive for FAT/FAT32 volume, or up to 16 MB for exFAT volume. If a zero (default value) or any invalid value is given, the function uses default allocation unit size depends on the volume size.</dd>
|
||||||
<dt>UINT n_align</dt>
|
<dt>UINT n_align</dt>
|
||||||
<dd>Specifies alignment of the volume data area (file allocation pool, usually erase block boundary of flash media) in unit of sector. The valid value for this member is between 1 and 32768 inclusive in power of 2. If a zero (the default value) or any invalid value is given, the function obtains the block size from lower layer with <tt>disk_ioctl</tt> function.</dd>
|
<dd>Specifies alignment of the volume data area (file allocation pool, usually erase block boundary of flash memory media) in unit of sector. The valid value for this member is between 1 and 32768 inclusive in power of 2. If a zero (the default value) or any invalid value is given, the function obtains the block size from lower layer with <tt>disk_ioctl</tt> function.</dd>
|
||||||
<dt>BYTE n_fat</dt>
|
<dt>BYTE n_fat</dt>
|
||||||
<dd>Specifies number of FAT copies on the FAT/FAT32 volume. Valid value for this member is 1 or 2. The default value (0) and any invaid value gives 1. If the FAT type is exFAT, this member has no effect.</dd>
|
<dd>Specifies number of FAT copies on the FAT/FAT32 volume. Valid value for this member is 1 or 2. The default value (0) and any invaid value gives 1. If the FAT type is exFAT, this member has no effect.</dd>
|
||||||
<dt>UINT n_root</dt>
|
<dt>UINT n_root</dt>
|
||||||
<dd>Specifies number of root directory entries on the FAT volume. Valid value for this member is up to 32768 and aligned to sector size / 32. The default value (0) and any invaid value gives 512. If the FAT type is FAT32 or exFAT, this member has no effect.</dd>
|
<dd>Specifies number of root directory entries on the FAT volume. Valid value for this member is up to 32768 and aligned to sector size / 32. The default value (0) and any invaid value gives 512. If the FAT type is FAT32 or exFAT, this member has no effect.</dd>
|
||||||
</dl>
|
</dl>
|
||||||
<dt>work</dt>
|
<dt>work</dt>
|
||||||
<dd>Pointer to the working buffer used for the format process. When a null pointer is given with <tt><a href="config.html#use_lfn">FF_USE_LFN</a> == 3</tt>, the function obtains a memory block in this function for the working buffer.</dd>
|
<dd>Pointer to the working buffer used for the format process. If a null pointer is given with <tt><a href="config.html#use_lfn">FF_USE_LFN</a> == 3</tt>, the function obtains a memory block for the working buffer in this function.</dd>
|
||||||
<dt>len</dt>
|
<dt>len</dt>
|
||||||
<dd>Size of the working buffer in unit of byte. It needs to be <tt>FF_MAX_SS</tt> at least. Plenty of working buffer reduces number of write transactions to the drive and the format process will finish quickly.</dd>
|
<dd>Size of the working buffer in unit of byte. It needs to be <tt>FF_MAX_SS</tt> at least. Plenty of working buffer reduces number of write transactions to the drive and the format process will finish quickly.</dd>
|
||||||
</dl>
|
</dl>
|
||||||
@ -69,8 +69,8 @@ FRESULT f_mkfs (
|
|||||||
<p>The FAT sub-type, FAT12/FAT16/FAT32, of FAT volume except exFAT is determined by only number of clusters on the volume and nothing else, according to the FAT specification issued by Microsoft. Thus the FAT sub-type of created volume depends on the volume size and the cluster size. In case of the combination of FAT type and cluter size specified by argument is not valid for the volume size, the function will fail with <tt>FR_MKFS_ABORTED</tt>.</p>
|
<p>The FAT sub-type, FAT12/FAT16/FAT32, of FAT volume except exFAT is determined by only number of clusters on the volume and nothing else, according to the FAT specification issued by Microsoft. Thus the FAT sub-type of created volume depends on the volume size and the cluster size. In case of the combination of FAT type and cluter size specified by argument is not valid for the volume size, the function will fail with <tt>FR_MKFS_ABORTED</tt>.</p>
|
||||||
<p>The allocation unit, also known as <em>cluster</em>, is a unit of disk space allocation for files. When the size of allocation unit is 32768 bytes, a file with 100 bytes in size occupies 32768 bytes of disk space. The space efficiency of disk usage gets worse as increasing size of allocation unit, but, on the other hand, the read/write performance increases. Therefore the size of allocation unit is a trade-off between space efficiency and performance. For the large volumes in GB order, 32768 bytes or larger, automatically selected by default, is recommended for most case unless extremely many small files are created in the volume.</p>
|
<p>The allocation unit, also known as <em>cluster</em>, is a unit of disk space allocation for files. When the size of allocation unit is 32768 bytes, a file with 100 bytes in size occupies 32768 bytes of disk space. The space efficiency of disk usage gets worse as increasing size of allocation unit, but, on the other hand, the read/write performance increases. Therefore the size of allocation unit is a trade-off between space efficiency and performance. For the large volumes in GB order, 32768 bytes or larger, automatically selected by default, is recommended for most case unless extremely many small files are created in the volume.</p>
|
||||||
<p>When the logical drive to be formatted is associated with a physical drive (<tt><a href="config.html#multi_partition">FF_MULTI_PARTITION</a> = 0</tt>) and <tt>FM_SFD</tt> flag is not specified, a partition occupies entire disk space is created and then the FAT volume is created in the partition. When <tt>FM_SFD</tt> flag is specified, the FAT volume is created without any disk partitioning.</p>
|
<p>When the logical drive to be formatted is associated with a physical drive (<tt><a href="config.html#multi_partition">FF_MULTI_PARTITION</a> = 0</tt>) and <tt>FM_SFD</tt> flag is not specified, a partition occupies entire disk space is created and then the FAT volume is created in the partition. When <tt>FM_SFD</tt> flag is specified, the FAT volume is created without any disk partitioning.</p>
|
||||||
<p>When the logical drive to be formatted is associated with a specific partition by multiple partition feature (<tt>FF_MULTI_PARTITION = 1</tt>), the FAT volume is created in the partition of the drive specified by <a href="filename.html#vol">volume mapping table</a> and <tt>FM_SFD</tt> flag is ignored. The corresponding physical drive needs to be partitioned with <tt>f_fdisk</tt> function or any partitioning tool prior to create the FAT volume with this function.</p>
|
<p>When the logical drive to be formatted is associated with a specific partition by multiple partition feature (<tt>FF_MULTI_PARTITION = 1</tt>), the FAT volume is created in the partition of the drive specified by <a href="filename.html#vol">volume mapping table</a> and <tt>FM_SFD</tt> flag is ignored. The hosting physical drive needs to be partitioned with <tt>f_fdisk</tt> function or any partitioning tool prior to create the FAT volume with this function.</p>
|
||||||
<p>There are three standard disk partitioning formats, MBR, GPT and SFD. The MBR format, also known as FDISK format, is usually used for harddisk, memory card and U disk. It can divide a physical drive into one or more partitions with a partition table. The GPT (GUID Partition Table) is a newly defined patitioning format for large storage devices. FatFs suppors the GPT only when 64-bit LBA is enabled. SFD (Super-Floppy Disk) is non-partitioned disk format. The FAT volume occupies the entire physical drive without any disk partitioning. It is usually used for floppy disk, optical disk and most super-floppy media. Some combination of systems and media support only either partitioned format or non-partitioned format and the other is not supported.</p>
|
<p>There are three standard disk partitioning formats, MBR, GPT and SFD. The MBR format, also known as FDISK format, is usually used for harddisk, memory card and U disk. It can divide a physical drive into one or more partitions with a partition table. The GPT (GUID Partition Table) is a newly defined patitioning format for large storage devices. FatFs suppors the GPT only when 64-bit LBA is enabled. The SFD (Super-Floppy Disk) is non-partitioned disk format. The FAT volume starts at LBA 0 and occupies the entire physical drive without any disk partitioning. It is usually used for floppy disk, optical disk and most super-floppy media. Some combination of systems and media support only either partitioned format or non-partitioned format and the other is not supported.</p>
|
||||||
<p>Some systems manage the partitions in the on-board storage in non-standard format. The partitions are mapped as physical drives identified by <tt class="arg">pdrv</tt> in <tt>disk_*</tt> functions. For such systems, SFD format is suitable to create the FAT volume in the partition.</p>
|
<p>Some systems manage the partitions in the on-board storage in non-standard format. The partitions are mapped as physical drives identified by <tt class="arg">pdrv</tt> in <tt>disk_*</tt> functions. For such systems, SFD format is suitable to create the FAT volume in the partition.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@ -23,7 +23,7 @@ FRESULT f_mount (
|
|||||||
</pre>
|
</pre>
|
||||||
<pre>
|
<pre>
|
||||||
FRESULT f_unmount (
|
FRESULT f_unmount (
|
||||||
const TCHAR* <span class="arg">path</span>, <span class="c">/* [IN] Logical drive number */</span>
|
const TCHAR* <span class="arg">path</span> <span class="c">/* [IN] Logical drive number */</span>
|
||||||
);
|
);
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -34,9 +34,9 @@ FRESULT f_open (
|
|||||||
<dd>Mode flags that specifies the type of access and open method for the file. It is specified by a combination of following flags.<br>
|
<dd>Mode flags that specifies the type of access and open method for the file. It is specified by a combination of following flags.<br>
|
||||||
<table class="lst">
|
<table class="lst">
|
||||||
<tr><th>Flags</th><th>Meaning</th></tr>
|
<tr><th>Flags</th><th>Meaning</th></tr>
|
||||||
<tr><td>FA_READ</td><td>Specifies read access to the object. Data can be read from the file.</tr>
|
<tr><td>FA_READ</td><td>Specifies read access to the file. Data can be read from the file.</tr>
|
||||||
<tr><td>FA_WRITE</td><td>Specifies write access to the object. Data can be written to the file. Combine with <tt>FA_READ</tt> for read-write access.</td></tr>
|
<tr><td>FA_WRITE</td><td>Specifies write access to the file. Data can be written to the file. Combine with <tt>FA_READ</tt> for read-write access.</td></tr>
|
||||||
<tr><td>FA_OPEN_EXISTING</td><td>Opens the file. The function fails if the file is not existing. (Default)</td></tr>
|
<tr><td>FA_OPEN_EXISTING</td><td>Opens a file. The function fails if the file is not existing. (Default)</td></tr>
|
||||||
<tr><td>FA_CREATE_NEW</td><td>Creates a new file. The function fails with <tt>FR_EXIST</tt> if the file is existing.</td></tr>
|
<tr><td>FA_CREATE_NEW</td><td>Creates a new file. The function fails with <tt>FR_EXIST</tt> if the file is existing.</td></tr>
|
||||||
<tr><td>FA_CREATE_ALWAYS</td><td>Creates a new file. If the file is existing, it will be truncated and overwritten.</td></tr>
|
<tr><td>FA_CREATE_ALWAYS</td><td>Creates a new file. If the file is existing, it will be truncated and overwritten.</td></tr>
|
||||||
<tr><td>FA_OPEN_ALWAYS</td><td>Opens the file if it is existing. If not, a new file will be created.</td></tr>
|
<tr><td>FA_OPEN_ALWAYS</td><td>Opens the file if it is existing. If not, a new file will be created.</td></tr>
|
||||||
|
|||||||
@ -39,7 +39,7 @@ int f_printf (
|
|||||||
|
|
||||||
<div class="para ret">
|
<div class="para ret">
|
||||||
<h4>Return Values</h4>
|
<h4>Return Values</h4>
|
||||||
<p>When the string was written successfuly, it returns number of character encoding units written to the file. When the function failed due to disk full or any error, a negative value will be returned.</p>
|
<p>When the string was written successfuly, it returns number of character encoding units written to the file. When the function failed due to disk full or an error, a negative value will be returned.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
@ -47,13 +47,27 @@ int f_printf (
|
|||||||
<h4>Description</h4>
|
<h4>Description</h4>
|
||||||
<p>The format control directive is a sub-set of standard library shown as follows:</p>
|
<p>The format control directive is a sub-set of standard library shown as follows:</p>
|
||||||
<pre>
|
<pre>
|
||||||
%[flag][width][prefix][type]
|
%[flag][width][precision][size]type
|
||||||
</pre>
|
</pre>
|
||||||
<dl>
|
<dl>
|
||||||
<dt>flag</dt><dd>Padding options. A <tt>'0'</tt> specifies zero padded. A <tt>'-'</tt> specifies left justified.</dd>
|
<dt>flag</dt><dd>Padding options. A <tt>-</tt> specifies left-aligned. A <tt>0</tt> specifies zero padded. The default setting is in right-aligned and space padded.</dd>
|
||||||
<dt>width</dt><dd>Minimum width of the field, <tt>'1'-'99'</tt> or <tt>'*'</tt>. If the width of generated string is less than the specified value, rest field is padded with white spaces or zeros. An <tt>*</tt> specifies the value comes from an argument in int type. The default value is zero.</dd>
|
<dt>width</dt><dd>Minimum width of the field, <tt>1-99</tt> or <tt>*</tt>. If the width of generated string is less than the specified value, rest field is padded with spaces or zeros. An <tt>*</tt> specifies the value comes from an argument in int type.</dd>
|
||||||
<dt>prefix</dt><dd>Size prefix <tt>'l'</tt> for long integer argument. If <tt>sizeof (long) == sizeof (int)</tt> (this is typical of 32-bit systems), the size prefix can be omitted.</dd>
|
<dt>precision</dt><dd>Specifies number of fractional digits or maximum width of string, <tt>.0-.99</tt> or <tt>.*</tt>. If number is omitted, it will be same as <tt>.0</tt>. Default setting is 6 for number and no limit for string.</dd>
|
||||||
<dt>type</dt><dd><tt>'c','s','d','u','o','x','b'</tt>, specify type of the argument and output format, character, string, signed integer in decimal, unsigned integer in decimal, unsigned integer in octal, unsigned integer in hexdecimal and unsigned integer in binary respectively. These characters except <tt>'x'</tt> are case insensitive. An <tt>'X'</tt> generates a hexdecimal in up-case.</dd>
|
<dt>size</dt><dd>Specifies size of integer argument, <tt>l</tt>(long) and <tt>ll</tt>(long long). If <tt>sizeof (long) == sizeof (int)</tt> is true (this is typical of 32-bit systems), prefix <tt>l</tt> can be omitted for long integer argument. The default size is int for integer arrument and floating point argument is always assumed double.</dd>
|
||||||
|
<dt>type</dt><dd>Specifies type of the output format and the argument as shown below. The length of generated string is in assumtion of int is 32-bit.
|
||||||
|
<table class="lst1">
|
||||||
|
<tr><th>Type</th><th>Format</th><th>Argument</th><th>Length</th></tr>
|
||||||
|
<tr><td><tt>c</tt></td><td>Character</td><td rowspan="6"><tt>int</tt>,<br><tt>long</tt>,<br><tt>long long</tt></td><td>1 character.</td></tr>
|
||||||
|
<tr><td><tt>d</tt></td><td>Signed decimal</td><td>1 to 11 (20 for ll) characters.</td></tr>
|
||||||
|
<tr><td><tt>u</tt></td><td>Unsigned decimal</td><td>1 to 10 (20 for ll) characters.</td></tr>
|
||||||
|
<tr><td><tt>o</tt></td><td>Unsigned octal</td><td>1 to 11 (22 for ll) characters.</td></tr>
|
||||||
|
<tr><td><tt>x X</tt></td><td>Unsigned hexdecimal</td><td>1 to 8 (16 for ll) characters.</td></tr>
|
||||||
|
<tr><td><tt>b</tt></td><td>Unsigned binary</td><td>1 to 32 characters. Limited to lower 32 digits when ll is specified.</td></tr>
|
||||||
|
<tr><td><tt>s</tt></td><td>String</td><td><tt>TCHAR*</tt></td><td>As input string. Null pointer generates a null string.</td></tr>
|
||||||
|
<tr><td><tt>f</tt></td><td>Floating point<br>(decimal)</td><td rowspan="2"><tt>double</tt></td><td>1 to 31 characters. If the number of characters exceeds 31, it writes <tt>"±OV"</tt>. Not a number and infinite write <tt>"NaN"</tt> and <tt>"±INF"</tt>.</td></tr>
|
||||||
|
<tr><td><tt>e E</tt></td><td>Floating point<br>(e notation)</td><td>4 to 31 characters. If the number of characters exceeds 31 or exponent exceeds +99, it writes <tt>"±OV"</tt>.</td></tr>
|
||||||
|
</table>
|
||||||
|
</dd>
|
||||||
</dl>
|
</dl>
|
||||||
<p>When FatFs is configured for Unicode API (<tt><a href="config.html#lfn_unicode">FF_LFN_UNICODE</a> >= 1</tt>), character encoding on the string fuctions, <tt>f_putc</tt>, <tt>f_puts</tt>, <tt>f_printf</tt> and <tt>f_gets</tt> function, is also switched to Unicode. The Unicode characters in multiple encoding unit, such as surrogate pair and multi-byte sequence, should not be divided into two function calls, or the character will be lost. The character encoding <em>on the file</em> to be written via this function is selected by <tt><a href="config.html#strf_encode">FF_STRF_ENCODE</a></tt>. The characters with wrong encoding or invalid for the output encoding will be lost.</p>
|
<p>When FatFs is configured for Unicode API (<tt><a href="config.html#lfn_unicode">FF_LFN_UNICODE</a> >= 1</tt>), character encoding on the string fuctions, <tt>f_putc</tt>, <tt>f_puts</tt>, <tt>f_printf</tt> and <tt>f_gets</tt> function, is also switched to Unicode. The Unicode characters in multiple encoding unit, such as surrogate pair and multi-byte sequence, should not be divided into two function calls, or the character will be lost. The character encoding <em>on the file</em> to be written via this function is selected by <tt><a href="config.html#strf_encode">FF_STRF_ENCODE</a></tt>. The characters with wrong encoding or invalid for the output encoding will be lost.</p>
|
||||||
</div>
|
</div>
|
||||||
@ -68,23 +82,24 @@ int f_printf (
|
|||||||
<div class="para use">
|
<div class="para use">
|
||||||
<h4>Example</h4>
|
<h4>Example</h4>
|
||||||
<pre>
|
<pre>
|
||||||
<em>f_printf</em>(&fil, "%d", 1234); <span class="c">/* "1234" */</span>
|
<em>f_printf</em>("%d", 1234); <span class="c">/* "1234" */</span>
|
||||||
<em>f_printf</em>(&fil, "%6d,%3d%%", -200, 5); <span class="c">/* " -200, 5%" */</span>
|
<em>f_printf</em>("%6d,%3d%%", -200, 5); <span class="c">/* " -200, 5%" */</span>
|
||||||
<em>f_printf</em>(&fil, "%ld", 12345L); <span class="c">/* "12345" */</span>
|
<em>f_printf</em>("%-6u", 100); <span class="c">/* "100 " */</span>
|
||||||
<em>f_printf</em>(&fil, "%06d", 25); <span class="c">/* "000025" */</span>
|
<em>f_printf</em>("%ld", 12345678); <span class="c">/* "12345678" */</span>
|
||||||
<em>f_printf</em>(&fil, "%06d", -25); <span class="c">/* "000-25" */</span>
|
<em>f_printf</em>("%llu", 0x100000000); <span class="c">/* "4294967296" (<a href="config.html#print_lli">FF_PRINT_LLI</a>) */</span>
|
||||||
<em>f_printf</em>(&fil, "%*d", 5, 100); <span class="c">/* " 100" */</span>
|
<em>f_printf</em>("%lld", -1LL); <span class="c">/* "-1" (FF_PRINT_LLI) */</span>
|
||||||
<em>f_printf</em>(&fil, "%-6d", 25); <span class="c">/* "25 " */</span>
|
<em>f_printf</em>("%04x", 0xA3); <span class="c">/* "00a3" */</span>
|
||||||
<em>f_printf</em>(&fil, "%u", -1); <span class="c">/* "65535" or "4294967295" */</span>
|
<em>f_printf</em>("%08lX", 0x123ABC); <span class="c">/* "00123ABC" */</span>
|
||||||
<em>f_printf</em>(&fil, "%04x", 0xAB3); <span class="c">/* "0ab3" */</span>
|
<em>f_printf</em>("%016b", 0x550F); <span class="c">/* "0101010100001111" */</span>
|
||||||
<em>f_printf</em>(&fil, "%08lX", 0x123ABCL); <span class="c">/* "00123ABC" */</span>
|
<em>f_printf</em>("%*d", 6, 100); <span class="c">/* " 100" */</span>
|
||||||
<em>f_printf</em>(&fil, "%04o", 255); <span class="c">/* "0377" */</span>
|
<em>f_printf</em>("%s", "abcdefg"); <span class="c">/* "abcdefg" */</span>
|
||||||
<em>f_printf</em>(&fil, "%016b", 0x550F); <span class="c">/* "0101010100001111" */</span>
|
<em>f_printf</em>("%5s", "abc"); <span class="c">/* " abc" */</span>
|
||||||
<em>f_printf</em>(&fil, "%s", "String"); <span class="c">/* "String" */</span>
|
<em>f_printf</em>("%-5s", "abc"); <span class="c">/* "abc " */</span>
|
||||||
<em>f_printf</em>(&fil, "%8s", "abc"); <span class="c">/* " abc" */</span>
|
<em>f_printf</em>("%.5s", "abcdefg"); <span class="c">/* "abcde" */</span>
|
||||||
<em>f_printf</em>(&fil, "%-8s", "abc"); <span class="c">/* "abc " */</span>
|
<em>f_printf</em>("%-5.2s", "abcdefg"); <span class="c">/* "ab " */</span>
|
||||||
<em>f_printf</em>(&fil, "%c", 'a'); <span class="c">/* "a" */</span>
|
<em>f_printf</em>("%c", 'a'); <span class="c">/* "a" */</span>
|
||||||
<em>f_printf</em>(&fil, "%f", 10.0); <span class="c">/* f_printf lacks floating point support */</span>
|
<em>f_printf</em>("%12f", 10.0); <span class="c">/* " 10.000000" (<a href="config.html#print_fp">FF_PRINT_FLOAT</a>) */</span>
|
||||||
|
<em>f_printf</em>("%.4E", 123.45678); <span class="c">/* "1.2346E+02" (FF_PRINT_FLOAT) */</span>
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@ -22,14 +22,14 @@
|
|||||||
<dd>The lower layer, <tt>disk_read</tt>, <tt>disk_write</tt> or <tt>disk_ioctl</tt> function, reported that an unrecoverable hard error occured.<br>Note that if once this error occured at any operation to an open file, the file object is aborted and any operations to the file except for close will be rejected.</dd>
|
<dd>The lower layer, <tt>disk_read</tt>, <tt>disk_write</tt> or <tt>disk_ioctl</tt> function, reported that an unrecoverable hard error occured.<br>Note that if once this error occured at any operation to an open file, the file object is aborted and any operations to the file except for close will be rejected.</dd>
|
||||||
|
|
||||||
<dt id="ie">FR_INT_ERR</dt>
|
<dt id="ie">FR_INT_ERR</dt>
|
||||||
<dd>Assertion failed. An insanity is detected in the internal process. One of the following possibilities is suspected.
|
<dd>Assertion failed and an insanity is detected in the internal process. One of the following possibilities is suspected.
|
||||||
<ul>
|
<ul>
|
||||||
<li>Work area (file system object, file object or etc...) has been broken by stack overflow or any other tasks. This is the reason in most case.</li>
|
<li>Work area (file system object, file object or etc...) has been broken by stack overflow or something. This is the reason in most case.</li>
|
||||||
<li>There is an error of the FAT structure on the volume.</li>
|
<li>There is an error of the FAT structure on the volume.</li>
|
||||||
<li>There is a bug in the FatFs module itself.</li>
|
<li>There is a bug in the FatFs module itself.</li>
|
||||||
<li>Wrong lower layer implementation.</li>
|
<li>Wrong lower layer implementation.</li>
|
||||||
</ul>
|
</ul>
|
||||||
Note that if once this error occured at any operation to an open file, the file object is aborted and all operations to the file except for close will be rejected.
|
Note that if once this error occured in the operation to an open file, the file object is aborted and any operation to the file except for close will be rejected.
|
||||||
</dd>
|
</dd>
|
||||||
|
|
||||||
<dt id="nr">FR_NOT_READY</dt>
|
<dt id="nr">FR_NOT_READY</dt>
|
||||||
@ -54,20 +54,20 @@ Note that if once this error occured at any operation to an open file, the file
|
|||||||
<li>There is a character not allowed for the file name.</li>
|
<li>There is a character not allowed for the file name.</li>
|
||||||
<li>The file name is out of 8.3 format. (at non-LFN cfg.)</li>
|
<li>The file name is out of 8.3 format. (at non-LFN cfg.)</li>
|
||||||
<li><tt>FF_MAX_LFN</tt> is insufficient for the file name. (at LFN cfg.)</li>
|
<li><tt>FF_MAX_LFN</tt> is insufficient for the file name. (at LFN cfg.)</li>
|
||||||
<li>There is any character encoding error in the string.</li>
|
<li>There is a character encoding error in the string.</li>
|
||||||
</ul>
|
</ul>
|
||||||
</dd>
|
</dd>
|
||||||
|
|
||||||
<dt id="dn">FR_DENIED</dt>
|
<dt id="dn">FR_DENIED</dt>
|
||||||
<dd>The required access was denied due to one of the following reasons:
|
<dd>The required access was denied due to one of the following reasons:
|
||||||
<ul>
|
<ul>
|
||||||
<li>Write mode open against the read-only file.</li>
|
<li>Write mode open against the read-only file. (f_open)</li>
|
||||||
<li>Deleting the read-only file or directory.</li>
|
<li>Deleting the read-only file or directory. (f_unlink)</li>
|
||||||
<li>Deleting the non-empty directory or current directory.</li>
|
<li>Deleting the non-empty directory or current directory. (f_unlink)</li>
|
||||||
<li>Reading the file opened without <tt>FA_READ</tt> flag.</li>
|
<li>Reading the file opened without <tt>FA_READ</tt> flag. (f_read)</li>
|
||||||
<li>Any modification to the file opened without <tt>FA_WRITE</tt> flag.</li>
|
<li>Any modification to the file opened without <tt>FA_WRITE</tt> flag. (f_write, f_truncate, f_expand)</li>
|
||||||
<li>Could not create the object due to root directory full or disk full.</li>
|
<li>Could not create the object due to root directory full or disk full. (f_open, f_mkfs)</li>
|
||||||
<li>Could not allocate a contiguous area to the file.</li>
|
<li>Could not allocate a contiguous area to the file. (f_expand)</li>
|
||||||
</ul>
|
</ul>
|
||||||
</dd>
|
</dd>
|
||||||
|
|
||||||
@ -93,7 +93,11 @@ Note that if once this error occured at any operation to an open file, the file
|
|||||||
<dd>Work area for the logical drive has not been registered by <tt>f_mount</tt> function.</dd>
|
<dd>Work area for the logical drive has not been registered by <tt>f_mount</tt> function.</dd>
|
||||||
|
|
||||||
<dt id="ns">FR_NO_FILESYSTEM</dt>
|
<dt id="ns">FR_NO_FILESYSTEM</dt>
|
||||||
<dd>There is no valid FAT volume on the drive or wrong lower layer implementation.</dd>
|
<dd>No valid FAT volume could not be found in the drive. One of the following possibilities is suspected.
|
||||||
|
<ul>
|
||||||
|
<li>Wrong lower layer implementation.</li>
|
||||||
|
<li>Wrong <tt>VolToPart[]</tt> settings. (<tt>FF_MULTI_PARTITION = 1</tt>)</li>
|
||||||
|
</ul></dd>
|
||||||
|
|
||||||
<dt id="ma">FR_MKFS_ABORTED</dt>
|
<dt id="ma">FR_MKFS_ABORTED</dt>
|
||||||
<dd>The <tt>f_mkfs</tt> function aborted before start in format due to a reason as follows:
|
<dd>The <tt>f_mkfs</tt> function aborted before start in format due to a reason as follows:
|
||||||
|
|||||||
@ -22,7 +22,7 @@ FRESULT f_readdir (
|
|||||||
</pre>
|
</pre>
|
||||||
<pre>
|
<pre>
|
||||||
FRESULT f_rewinddir (
|
FRESULT f_rewinddir (
|
||||||
DIR* <span class="arg">dp</span>, <span class="c">/* [IN] Directory object */</span>
|
DIR* <span class="arg">dp</span> <span class="c">/* [IN] Directory object */</span>
|
||||||
);
|
);
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
@ -103,7 +103,7 @@ FRESULT scan_files (
|
|||||||
printf("%s/%s\n", path, fno.fname);
|
printf("%s/%s\n", path, fno.fname);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
f_closedir(&dir)
|
f_closedir(&dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
|
|||||||
@ -1,3 +1,14 @@
|
|||||||
|
R0.14b (April 17, 2021)
|
||||||
|
Made FatFs uses standard library <string.h> for copy, compare and search instead of built-in string functions.
|
||||||
|
Added support for long long integer and floating point to f_printf(). (FF_STRF_LLI and FF_STRF_FP)
|
||||||
|
Made path name parser ignore the terminating separator to allow "dir/".
|
||||||
|
Improved the compatibility in Unix style path name feature.
|
||||||
|
Fixed the file gets dead-locked when f_open() failed with some conditions. (appeared at R0.12a)
|
||||||
|
Fixed f_mkfs() can create wrong exFAT volume due to a timing dependent error. (appeared at R0.12)
|
||||||
|
Fixed code page 855 cannot be set by f_setcp().
|
||||||
|
Fixed some compiler warnings.
|
||||||
|
|
||||||
|
|
||||||
R0.14a (December 05, 2020)
|
R0.14a (December 05, 2020)
|
||||||
Limited number of recursive calls in f_findnext().
|
Limited number of recursive calls in f_findnext().
|
||||||
Fixed old floppy disks formatted with MS-DOS 2.x and 3.x cannot be mounted.
|
Fixed old floppy disks formatted with MS-DOS 2.x and 3.x cannot be mounted.
|
||||||
@ -5,7 +16,7 @@ R0.14a (December 05, 2020)
|
|||||||
|
|
||||||
|
|
||||||
R0.14 (October 14, 2019)
|
R0.14 (October 14, 2019)
|
||||||
Added support for 64-bit LBA and GUID partition table (FF_LBA64 = 1)
|
Added support for 64-bit LBA and GUID partition table (FF_LBA64)
|
||||||
Changed some API functions, f_mkfs() and f_fdisk().
|
Changed some API functions, f_mkfs() and f_fdisk().
|
||||||
Fixed f_open() function cannot find the file with file name in length of FF_MAX_LFN characters.
|
Fixed f_open() function cannot find the file with file name in length of FF_MAX_LFN characters.
|
||||||
Fixed f_readdir() function cannot retrieve long file names in length of FF_MAX_LFN - 1 characters.
|
Fixed f_readdir() function cannot retrieve long file names in length of FF_MAX_LFN - 1 characters.
|
||||||
|
|||||||
@ -344,3 +344,16 @@ R0.14a (December 5, 2020)
|
|||||||
Fixed old floppy disks formatted with MS-DOS 2.x and 3.x cannot be mounted.
|
Fixed old floppy disks formatted with MS-DOS 2.x and 3.x cannot be mounted.
|
||||||
Fixed some compiler warnings.
|
Fixed some compiler warnings.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
R0.14b (April 17, 2021)
|
||||||
|
Made FatFs uses standard library <string.h> for copy, compare and search instead of built-in string functions.
|
||||||
|
Added support for long long integer and floating point to f_printf(). (FF_STRF_LLI and FF_STRF_FP)
|
||||||
|
Made path name parser ignore the terminating separator to allow "dir/".
|
||||||
|
Improved the compatibility in Unix style path name feature.
|
||||||
|
Fixed the file gets dead-locked when f_open() failed with some conditions. (appeared at R0.12a)
|
||||||
|
Fixed f_mkfs() can create wrong exFAT volume due to a timing dependent error. (appeared at R0.12)
|
||||||
|
Fixed code page 855 cannot be set by f_setcp().
|
||||||
|
Fixed some compiler warnings.
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
FatFs Module Source Files R0.14a
|
FatFs Module Source Files R0.14b
|
||||||
|
|
||||||
|
|
||||||
FILES
|
FILES
|
||||||
|
|||||||
940
source/ff.c
940
source/ff.c
File diff suppressed because it is too large
Load Diff
72
source/ff.h
72
source/ff.h
@ -1,8 +1,8 @@
|
|||||||
/*----------------------------------------------------------------------------/
|
/*----------------------------------------------------------------------------/
|
||||||
/ FatFs - Generic FAT Filesystem module R0.14a /
|
/ FatFs - Generic FAT Filesystem module R0.14b /
|
||||||
/-----------------------------------------------------------------------------/
|
/-----------------------------------------------------------------------------/
|
||||||
/
|
/
|
||||||
/ Copyright (C) 2020, ChaN, all right reserved.
|
/ Copyright (C) 2021, ChaN, all right reserved.
|
||||||
/
|
/
|
||||||
/ FatFs module is an open source software. Redistribution and use of FatFs in
|
/ FatFs module is an open source software. Redistribution and use of FatFs in
|
||||||
/ source and binary forms, with or without modification, are permitted provided
|
/ source and binary forms, with or without modification, are permitted provided
|
||||||
@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
|
|
||||||
#ifndef FF_DEFINED
|
#ifndef FF_DEFINED
|
||||||
#define FF_DEFINED 80196 /* Revision ID */
|
#define FF_DEFINED 86631 /* Revision ID */
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@ -35,10 +35,14 @@ extern "C" {
|
|||||||
|
|
||||||
/* Integer types used for FatFs API */
|
/* Integer types used for FatFs API */
|
||||||
|
|
||||||
#if defined(_WIN32) /* Main development platform */
|
#if defined(_WIN32) /* Windows VC++ (for development only) */
|
||||||
#define FF_INTDEF 2
|
#define FF_INTDEF 2
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
typedef unsigned __int64 QWORD;
|
typedef unsigned __int64 QWORD;
|
||||||
|
#include <float.h>
|
||||||
|
#define isnan(v) _isnan(v)
|
||||||
|
#define isinf(v) (!_finite(v))
|
||||||
|
|
||||||
#elif (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__cplusplus) /* C99 or later */
|
#elif (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__cplusplus) /* C99 or later */
|
||||||
#define FF_INTDEF 2
|
#define FF_INTDEF 2
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
@ -48,6 +52,7 @@ typedef uint16_t WORD; /* 16-bit unsigned integer */
|
|||||||
typedef uint32_t DWORD; /* 32-bit unsigned integer */
|
typedef uint32_t DWORD; /* 32-bit unsigned integer */
|
||||||
typedef uint64_t QWORD; /* 64-bit unsigned integer */
|
typedef uint64_t QWORD; /* 64-bit unsigned integer */
|
||||||
typedef WORD WCHAR; /* UTF-16 character type */
|
typedef WORD WCHAR; /* UTF-16 character type */
|
||||||
|
|
||||||
#else /* Earlier than C99 */
|
#else /* Earlier than C99 */
|
||||||
#define FF_INTDEF 1
|
#define FF_INTDEF 1
|
||||||
typedef unsigned int UINT; /* int must be 16-bit or 32-bit */
|
typedef unsigned int UINT; /* int must be 16-bit or 32-bit */
|
||||||
@ -58,28 +63,29 @@ typedef WORD WCHAR; /* UTF-16 character type */
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* Definitions of volume management */
|
/* Type of file size and LBA variables */
|
||||||
|
|
||||||
#if FF_MULTI_PARTITION /* Multiple partition configuration */
|
#if FF_FS_EXFAT
|
||||||
typedef struct {
|
#if FF_INTDEF != 2
|
||||||
BYTE pd; /* Physical drive number */
|
#error exFAT feature wants C99 or later
|
||||||
BYTE pt; /* Partition: 0:Auto detect, 1-4:Forced partition) */
|
|
||||||
} PARTITION;
|
|
||||||
extern PARTITION VolToPart[]; /* Volume - Partition mapping table */
|
|
||||||
#endif
|
#endif
|
||||||
|
typedef QWORD FSIZE_t;
|
||||||
#if FF_STR_VOLUME_ID
|
#if FF_LBA64
|
||||||
#ifndef FF_VOLUME_STRS
|
typedef QWORD LBA_t;
|
||||||
extern const char* VolumeStr[FF_VOLUMES]; /* User defied volume ID */
|
#else
|
||||||
|
typedef DWORD LBA_t;
|
||||||
#endif
|
#endif
|
||||||
|
#else
|
||||||
|
#if FF_LBA64
|
||||||
|
#error exFAT needs to be enabled when enable 64-bit LBA
|
||||||
|
#endif
|
||||||
|
typedef DWORD FSIZE_t;
|
||||||
|
typedef DWORD LBA_t;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Type of path name strings on FatFs API */
|
/* Type of path name strings on FatFs API (TCHAR) */
|
||||||
|
|
||||||
#ifndef _INC_TCHAR
|
|
||||||
#define _INC_TCHAR
|
|
||||||
|
|
||||||
#if FF_USE_LFN && FF_LFN_UNICODE == 1 /* Unicode in UTF-16 encoding */
|
#if FF_USE_LFN && FF_LFN_UNICODE == 1 /* Unicode in UTF-16 encoding */
|
||||||
typedef WCHAR TCHAR;
|
typedef WCHAR TCHAR;
|
||||||
@ -101,28 +107,22 @@ typedef char TCHAR;
|
|||||||
#define _TEXT(x) x
|
#define _TEXT(x) x
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Definitions of volume management */
|
||||||
|
|
||||||
/* Type of file size and LBA variables */
|
#if FF_MULTI_PARTITION /* Multiple partition configuration */
|
||||||
|
typedef struct {
|
||||||
|
BYTE pd; /* Physical drive number */
|
||||||
|
BYTE pt; /* Partition: 0:Auto detect, 1-4:Forced partition) */
|
||||||
|
} PARTITION;
|
||||||
|
extern PARTITION VolToPart[]; /* Volume - Partition mapping table */
|
||||||
|
#endif
|
||||||
|
|
||||||
#if FF_FS_EXFAT
|
#if FF_STR_VOLUME_ID
|
||||||
#if FF_INTDEF != 2
|
#ifndef FF_VOLUME_STRS
|
||||||
#error exFAT feature wants C99 or later
|
extern const char* VolumeStr[FF_VOLUMES]; /* User defied volume ID */
|
||||||
#endif
|
#endif
|
||||||
typedef QWORD FSIZE_t;
|
|
||||||
#if FF_LBA64
|
|
||||||
typedef QWORD LBA_t;
|
|
||||||
#else
|
|
||||||
typedef DWORD LBA_t;
|
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
#if FF_LBA64
|
|
||||||
#error exFAT needs to be enabled when enable 64-bit LBA
|
|
||||||
#endif
|
|
||||||
typedef DWORD FSIZE_t;
|
|
||||||
typedef DWORD LBA_t;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
/ FatFs Functional Configurations
|
/ FatFs Functional Configurations
|
||||||
/---------------------------------------------------------------------------*/
|
/---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#define FFCONF_DEF 80196 /* Revision ID */
|
#define FFCONF_DEF 86631 /* Revision ID */
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------/
|
/*---------------------------------------------------------------------------/
|
||||||
/ Function Configurations
|
/ Function Configurations
|
||||||
@ -25,14 +25,6 @@
|
|||||||
/ 3: f_lseek() function is removed in addition to 2. */
|
/ 3: f_lseek() function is removed in addition to 2. */
|
||||||
|
|
||||||
|
|
||||||
#define FF_USE_STRFUNC 0
|
|
||||||
/* This option switches string functions, f_gets(), f_putc(), f_puts() and f_printf().
|
|
||||||
/
|
|
||||||
/ 0: Disable string functions.
|
|
||||||
/ 1: Enable without LF-CRLF conversion.
|
|
||||||
/ 2: Enable with LF-CRLF conversion. */
|
|
||||||
|
|
||||||
|
|
||||||
#define FF_USE_FIND 0
|
#define FF_USE_FIND 0
|
||||||
/* This option switches filtered directory read functions, f_findfirst() and
|
/* This option switches filtered directory read functions, f_findfirst() and
|
||||||
/ f_findnext(). (0:Disable, 1:Enable 2:Enable with matching altname[] too) */
|
/ f_findnext(). (0:Disable, 1:Enable 2:Enable with matching altname[] too) */
|
||||||
@ -64,6 +56,30 @@
|
|||||||
/* This option switches f_forward() function. (0:Disable or 1:Enable) */
|
/* This option switches f_forward() function. (0:Disable or 1:Enable) */
|
||||||
|
|
||||||
|
|
||||||
|
#define FF_USE_STRFUNC 0
|
||||||
|
#define FF_PRINT_LLI 0
|
||||||
|
#define FF_PRINT_FLOAT 0
|
||||||
|
#define FF_STRF_ENCODE 0
|
||||||
|
/* FF_USE_STRFUNC switches string functions, f_gets(), f_putc(), f_puts() and
|
||||||
|
/ f_printf().
|
||||||
|
/
|
||||||
|
/ 0: Disable. FF_PRINT_LLI, FF_PRINT_FLOAT and FF_STRF_ENCODE have no effect.
|
||||||
|
/ 1: Enable without LF-CRLF conversion.
|
||||||
|
/ 2: Enable with LF-CRLF conversion.
|
||||||
|
/
|
||||||
|
/ FF_PRINT_LLI = 1 makes f_printf() support long long argument and FF_PRINT_FLOAT = 1/2
|
||||||
|
makes f_printf() support floating point argument. These features want C99 or later.
|
||||||
|
/ When FF_LFN_UNICODE >= 1 with LFN enabled, string functions convert the character
|
||||||
|
/ encoding in it. FF_STRF_ENCODE selects assumption of character encoding ON THE FILE
|
||||||
|
/ to be read/written via those functions.
|
||||||
|
/
|
||||||
|
/ 0: ANSI/OEM in current CP
|
||||||
|
/ 1: Unicode in UTF-16LE
|
||||||
|
/ 2: Unicode in UTF-16BE
|
||||||
|
/ 3: Unicode in UTF-8
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------/
|
/*---------------------------------------------------------------------------/
|
||||||
/ Locale and Namespace Configurations
|
/ Locale and Namespace Configurations
|
||||||
/---------------------------------------------------------------------------*/
|
/---------------------------------------------------------------------------*/
|
||||||
@ -137,19 +153,6 @@
|
|||||||
/ on character encoding. When LFN is not enabled, these options have no effect. */
|
/ on character encoding. When LFN is not enabled, these options have no effect. */
|
||||||
|
|
||||||
|
|
||||||
#define FF_STRF_ENCODE 3
|
|
||||||
/* When FF_LFN_UNICODE >= 1 with LFN enabled, string I/O functions, f_gets(),
|
|
||||||
/ f_putc(), f_puts and f_printf() convert the character encoding in it.
|
|
||||||
/ This option selects assumption of character encoding ON THE FILE to be
|
|
||||||
/ read/written via those functions.
|
|
||||||
/
|
|
||||||
/ 0: ANSI/OEM in current CP
|
|
||||||
/ 1: Unicode in UTF-16LE
|
|
||||||
/ 2: Unicode in UTF-16BE
|
|
||||||
/ 3: Unicode in UTF-8
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#define FF_FS_RPATH 0
|
#define FF_FS_RPATH 0
|
||||||
/* This option configures support for relative path.
|
/* This option configures support for relative path.
|
||||||
/
|
/
|
||||||
@ -194,7 +197,7 @@
|
|||||||
#define FF_MAX_SS 512
|
#define FF_MAX_SS 512
|
||||||
/* This set of options configures the range of sector size to be supported. (512,
|
/* This set of options configures the range of sector size to be supported. (512,
|
||||||
/ 1024, 2048 or 4096) Always set both 512 for most systems, generic memory card and
|
/ 1024, 2048 or 4096) Always set both 512 for most systems, generic memory card and
|
||||||
/ harddisk. But a larger value may be required for on-board flash memory and some
|
/ harddisk, but a larger value may be required for on-board flash memory and some
|
||||||
/ type of optical media. When FF_MAX_SS is larger than FF_MIN_SS, FatFs is configured
|
/ type of optical media. When FF_MAX_SS is larger than FF_MIN_SS, FatFs is configured
|
||||||
/ for variable sector size mode and disk_ioctl() function needs to implement
|
/ for variable sector size mode and disk_ioctl() function needs to implement
|
||||||
/ GET_SECTOR_SIZE command. */
|
/ GET_SECTOR_SIZE command. */
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user