fatfs v0.12c March 04, 2017:
- Improved write throughput at the fragmented file on the exFAT volume. - Made memory usage for exFAT be able to be reduced as decreasing _MAX_LFN. - Fixed successive f_getfree() can return wrong count on the FAT12/16 volume. (appeared at R0.12) - Fixed configuration option _VOLUMES cannot be set 10. (appeared at R0.10c)
This commit is contained in:
		
							parent
							
								
									e749807f86
								
							
						
					
					
						commit
						fca959be37
					
				| @ -10,11 +10,11 @@ | ||||
| <link rel="alternate" hreflang="en" title="Original" href="http://elm-chan.org/fsw/ff/00index_e.html"> | ||||
| <link rel="alternate" hreflang="ja" title="Japanese version" href="00index_j.html"> | ||||
| <link rel="stylesheet" href="css_e.css" type="text/css" media="screen" title="ELM Default"> | ||||
| <title>FatFs - Generic FAT File System Module</title> | ||||
| <title>FatFs - Generic FAT File System Module (R0.12c)</title> | ||||
| </head> | ||||
| 
 | ||||
| <body> | ||||
| <h1>FatFs - Generic FAT File System Module</h1> | ||||
| <h1>FatFs - Generic FAT File System Module (R0.12c)</h1> | ||||
| <hr> | ||||
| 
 | ||||
| <div class="abst"> | ||||
| @ -23,7 +23,7 @@ | ||||
| 
 | ||||
| <h4>Features</h4> | ||||
| <ul> | ||||
|  <li>Windows compatible FAT/exFAT file system.</li> | ||||
|  <li>DOS/Windows compatible FAT/exFAT file system.</li> | ||||
|  <li>Platform independent. Easy to port.</li> | ||||
|  <li>Very small footprint for program code and work area.</li> | ||||
|  <li>Various <a href="en/config.html">configuration options</a> to support for: | ||||
| @ -44,6 +44,7 @@ | ||||
| <div class="para"> | ||||
| <h3>Application Interface</h3> | ||||
| <img src="res/layers1.png" class="rset" width="245" height="220" alt="layer"> | ||||
| <p>FatFs provides various file control functions for the applications as shown below.</p> | ||||
| <ul> | ||||
|  <li>File Access | ||||
|  <ul> | ||||
| @ -103,9 +104,9 @@ | ||||
| 
 | ||||
| 
 | ||||
| <div class="para"> | ||||
| <h3>Device Control Interface</h3> | ||||
| <h3>Media Access Interface</h3> | ||||
| <img src="res/layers2.png" class="rset" width="245" height="220" alt="layer"> | ||||
| <p>Since the FatFs module is a file system layer, it is completely separated from the physical devices, such as memory card, harddisk and any type of storage device. FatFs accesses the storage devices via a simple interface shown below. The low level device control module is <em>not a part of FatFs module</em>. It is provided by implementer. Also sample implementations for some platforms are available in the downloads.</p> | ||||
| <p>Since the FatFs module is just a file system layer independent of platform and storage device. It is completely separated from the physical devices, such as memory card, harddisk and any type of storage device. The low level device control module is <em>not a part of FatFs module</em> and it needs to be provided by implementer. FatFs accesses the storage devices via a simple media access interface shown below. Also sample implementations for some platforms are available in the downloads.</p> | ||||
| <ul> | ||||
|  <li><a href="en/dstat.html">disk_status</a> - Get device status</li> | ||||
|  <li><a href="en/dinit.html">disk_initialize</a> - Initialize device</li> | ||||
| @ -121,7 +122,7 @@ | ||||
| <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 personal projects or commercial products without any restriction under your responsibility. For further information, refer to the application note.</p> | ||||
| <ul> | ||||
|  <li>Read first: <a href="en/appnote.html">FatFs module application note</a> <span class="mfd">July 10, 2016</span></li> | ||||
|  <li>Read first: <a href="en/appnote.html">FatFs module application note</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 file system)</li> | ||||
|  <li><a href="http://elm-chan.org/docs/fat.html">The basics of FAT file system [ja]</a></li> | ||||
| @ -136,6 +137,6 @@ | ||||
| 
 | ||||
| 
 | ||||
| <hr> | ||||
| <p class="foot"><a href="http://elm-chan.org/fsw/ff/00index_e.html">FatFs home page</a></p> | ||||
| <p class="foot"><a href="http://elm-chan.org/fsw/ff/00index_e.html">FatFs Homepage</a></p> | ||||
| </body> | ||||
| </html> | ||||
|  | ||||
| @ -10,11 +10,11 @@ | ||||
| <link rel="alternate" hreflang="ja" title="オリジナル版" href="http://elm-chan.org/fsw/ff/00index_j.html"> | ||||
| <link rel="alternate" hreflang="en" title="英文版" href="00index_e.html"> | ||||
| <link rel="stylesheet" href="css_j.css" type="text/css" media="screen" title="ELM Default"> | ||||
| <title>FatFs 汎用FATファイルシステム モジュール</title> | ||||
| <title>FatFs 汎用FATファイルシステム モジュール (R0.12c)</title> | ||||
| </head> | ||||
| 
 | ||||
| <body> | ||||
| <h1>FatFs 汎用FATファイルシステム モジュール</h1> | ||||
| <h1>FatFs 汎用FATファイルシステム モジュール (R0.12c)</h1> | ||||
| <hr> | ||||
| 
 | ||||
| <div class="abst"> | ||||
| @ -22,7 +22,7 @@ | ||||
| <p>FatFsは小規模な組み込みシステム向けの汎用FAT/exFATファイルシステム モジュールです。ANSI C(C89)準拠でハードウェア アーキテクチャには依存しないので、必要なワーク エリアが確保できれば、8051, PIC, AVR, SH, Z80, 68k, H8, ARMなど安価なマイコンでも使用可能です。このほか、FatFsを極小マイコン向けにシュリンクした<a href="http://elm-chan.org/fsw/ff/00index_p.html">ぷちFatFs</a>もあります。</p> | ||||
| <h4>FatFsモジュールの特徴</h4> | ||||
| <ul> | ||||
|  <li>Windows互換 FAT/exFATファイルシステム</li> | ||||
|  <li>DOS/Windows互換 FAT/exFATファイルシステム</li> | ||||
|  <li>プラットフォーム非依存</li> | ||||
|  <li>コンパクトなコードとRAM使用量</li> | ||||
|  <li>多くの<a href="ja/config.html">構成オプション</a>: | ||||
| @ -41,8 +41,9 @@ | ||||
| 
 | ||||
| 
 | ||||
| <div class="para"> | ||||
| <h3>上位レイヤ インターフェース</h3> | ||||
| <h3>アプリケーション インターフェース</h3> | ||||
| <img src="res/layers1.png" class="rset" width="245" height="220" alt="layer"> | ||||
| <p>FatFsモジュールは、上位レイヤに対して次に示すファイルAPIを提供します。</p> | ||||
| <ul> | ||||
|  <li>ファイル アクセス | ||||
|  <ul> | ||||
| @ -102,9 +103,9 @@ | ||||
| 
 | ||||
| 
 | ||||
| <div class="para"> | ||||
| <h3>下位レイヤ インターフェース</h3> | ||||
| <h3>デバイス制御インターフェース</h3> | ||||
| <img src="res/layers2.png" class="rset" width="245" height="220" alt="layer"> | ||||
| <p>FatFsモジュールは、単なるファイルシステム レイヤなので、その下位のストレージ デバイス制御レイヤはそれに含まれません。それぞれのプラットフォームやストレージ デバイスに対応した制御レイヤは、インプリメンタによって提供される必要があります。FatFsモジュールは、下位レイヤに対し標準的には次のインターフェースを要求します。一部の拡張機能、たとえばOS関連機能を有効にしたときは、加えてプロセス/メモリ操作関数なども必要になります。サンプル プロジェクトに下位レイヤの実装例を示します。</p> | ||||
| <p>FatFsモジュールは、プラットフォームから独立した単なるファイルシステム レイヤです。ストレージ デバイス(例えばメモリ カード)の制御機能はFatFsの構成部分ではないので、インプリメンタによって提供される必要があります。FatFsモジュールは、下位レイヤに対し標準的には次のインターフェースを要求します。一部の拡張機能(たとえばOS関連機能)を利用するときは、これらに加えてプロセス/メモリ操作関数なども必要になります。サンプル プロジェクトに下位レイヤの実装例を示します。</p> | ||||
| <ul> | ||||
|  <li><a href="ja/dstat.html">disk_status</a> - デバイスの状態取得</li> | ||||
|  <li><a href="ja/dinit.html">disk_initialize</a> - デバイスの初期化</li> | ||||
| @ -120,7 +121,7 @@ | ||||
| <h3>資料</h3> | ||||
| <p>FatFsモジュールはフリー ソフトウェアとして教育・研究・開発用に公開しています。どのような利用目的(個人利用から商用まで)でも使用・改変・配布について一切の制限はありませんが、全て利用者の責任の下での利用とします。詳しくはアプリケーション ノートを参照してください。</p> | ||||
| <ul> | ||||
|  <li>最初に読め: <a href="ja/appnote.html">FatFsモジュール アプリケーション ノート</a> <span class="mfd">2016. 9. 4</span></li> | ||||
|  <li>最初に読め: <a href="ja/appnote.html">FatFsモジュール アプリケーション ノート</a></li> | ||||
|  <li>コミュニティ: <a href="http://elm-chan.org/fsw/ff/bd/">FatFsユーザ フォーラム</a></li> | ||||
|  <li><a href="https://msdn.microsoft.com/en-us/windows/hardware/gg463080.aspx">FATファイルシステム仕様 by Microsoft</a>↗ (The reference document on FAT file system)</li> | ||||
|  <li><a href="http://elm-chan.org/docs/fat.html">FATファイルシステム概要</a> (↑を読むためのガイド)</li> | ||||
|  | ||||
| @ -14,6 +14,7 @@ strong {} | ||||
| pre {border: 1px dashed gray; margin: 0.5em 1em; padding: 0.5em; line-height: 1.2em; font-size: 85%; font-family: "Consolas", "Courier New", monospace; background-color: white;} | ||||
| pre span.c {color: green;} | ||||
| pre span.k {color: blue;} | ||||
| pre span.b {font-weight: bold;} | ||||
| pre span.arg {font-style: italic;} | ||||
| tt {margin: 0 0.2em; font-size: 0.85em; font-family: "Consolas", "Courier New", monospace; } | ||||
| tt.arg {font-style: italic;} | ||||
| @ -24,7 +25,7 @@ dl {margin: 0.5em 1em;} | ||||
| dd {margin: 0 2em;} | ||||
| dt {font-size: 0.85em; font-family: "Consolas", "Courier New", monospace;} | ||||
| dl.par dt {margin: 0.5em 0 0 0 ; font-style: italic; } | ||||
| dl.ret dt {margin: 0.5em 0 0 0 ; font-size: 0.85em; font-family: "Consolas", "Courier New", monospace;} | ||||
| dl.ret dt {margin: 0.5em 0 0 0 ; font-size: 0.85em; font-family: "Consolas", "Courier New", monospace; font-weight: bold; } | ||||
| hr {border-width: 1px; margin: 1em;} | ||||
| div.abst {font-family: sans-serif;} | ||||
| div.para {clear: both; font-family: serif;} | ||||
|  | ||||
| @ -17,6 +17,7 @@ strong {} | ||||
| pre {border: 1px dashed gray; margin: 0.5em 1em; padding: 0.5em; line-height: 1.2em; letter-spacing: 0; font-size: 0.85em; font-family: "Consolas", "Courier New", "MS ゴシック", monospace; background-color: white;} | ||||
| pre span.c {color: green;} | ||||
| pre span.k {color: blue;} | ||||
| pre span.b {font-weight: bold;} | ||||
| pre span.arg {font-style: italic;} | ||||
| tt {margin: 0 0.2em; letter-spacing: 0; font-size: 0.85em; font-family: "Consolas", "Courier New", "MS ゴシック", monospace;} | ||||
| tt.arg {font-style: italic;} | ||||
| @ -27,7 +28,7 @@ dl {margin: 0.5em 1em;} | ||||
| dd {margin: 0em   2em;} | ||||
| dt {font-size: 0.85em; font-family: "Consolas", "Courier New", "MS ゴシック", monospace;} | ||||
| dl.par dt {margin: 0.5em 0 0 0 ; font-style: italic; letter-spacing: 0;} | ||||
| dl.ret dt {margin: 0.5em 0 0 0 ; font-size: 0.85em; font-family: "Consolas", "Courier New", "MS ゴシック", monospace; letter-spacing: 0; } | ||||
| dl.ret dt {margin: 0.5em 0 0 0 ; font-size: 0.85em; font-family: "Consolas", "Courier New", "MS ゴシック", monospace; letter-spacing: 0; font-weight: bold; } | ||||
| hr {border-width: 1px; margin: 1em;} | ||||
| div.abst {font-family: "MS Pゴシック",sans-serif;} | ||||
| div.para {clear: both; font-family: "MS P明朝",serif;} | ||||
|  | ||||
| @ -46,8 +46,8 @@ The FatFs module assumes that size of <tt>char</tt>/<tt>short</tt>/<tt>long</tt> | ||||
| <p>(a) If a working disk module with FatFs disk interface is provided, nothing else will be needed. (b) To attach existing disk drivers with different interface, glue functions are needed to translate the interfaces between FatFs and the drivers.</p> | ||||
| <p><img src="../res/funcs.png" width="750" height="420" alt="functional diagram"></p> | ||||
| 
 | ||||
| <h4>The functions required</h4> | ||||
| <p>You need to provide only low level disk I/O functions required by FatFs module and nothing else. If a working disk module for the target system is already existing, you need to write only glue functions to attach it to the FatFs module. If not, you need to port any other disk module or write it from scratch. Most of defined functions are not that always required. For example, disk write function is not required at read-only configuration. Following table shows which function is required depends on the configuration options.</p> | ||||
| <h4>Required functions</h4> | ||||
| <p>You need to provide only low level disk I/O functions required by FatFs module and nothing else. If a working disk module for the target system is already existing, you need to write only glue functions to attach it to the FatFs module. If not, you need to port another disk module or write it from scratch. Most of defined functions are not that always required. For example, disk write function is not required at read-only configuration. Following table shows which function is required depends on the configuration options.</p> | ||||
| <table class="lst2"> | ||||
| <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> | ||||
| @ -64,7 +64,7 @@ The FatFs module assumes that size of <tt>char</tt>/<tt>short</tt>/<tt>long</tt> | ||||
| <div class="para doc" id="limits"> | ||||
| <h3>Limits</h3> | ||||
| <ul> | ||||
| <li>File system type: FAT12, FAT16, FAT32(r0.0) and exFAT(r1.0).</li> | ||||
| <li>File system type: FAT, FAT32(r0.0) and exFAT(r1.0).</li> | ||||
| <li>Number of open files: Unlimited. (depends on available memory)</li> | ||||
| <li>Number of volumes: Upto 10.</li> | ||||
| <li>Volume size: Upto 2 TiB at 512 bytes/sector.</li> | ||||
| @ -144,7 +144,7 @@ And other options are left unchanged from original setting. | ||||
| 
 | ||||
| <div class="para doc" id="lfn"> | ||||
| <h3>Long File Name</h3> | ||||
| <p>FatFs module supports long file name (LFN). The two different file names, short file name (SFN) and LFN, of a file is transparent on the API except for <tt>f_readdir</tt> function. The support for LFN is disabled by default. To enable the LFN, set <tt><a href="config.html#use_lfn">_USE_LFN</a></tt> to 1, 2 or 3, and add <tt>option/unicode.c</tt> to the project. The LFN requiers a certain working buffer in addition. The buffer size can be configured by <tt><a href="config.html#max_lfn">_MAX_LFN</a></tt> according to the available memory. The length of an LFN will be up to 255 characters, so that the <tt>_MAX_LFN</tt> should be set to 255 for all 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 is enabled, <tt>_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 working buffer occupies <tt>(_MAX_LFN + 1) * 2</tt> bytes and additional 608 bytes when exFAT enabled.</p> | ||||
| <p>FatFs module supports long file name (LFN). The two different file names, short file name (SFN) and LFN, of a file is transparent on the API except for <tt>f_readdir</tt> function. The support for LFN is disabled by default. To enable the LFN, set <tt><a href="config.html#use_lfn">_USE_LFN</a></tt> to 1, 2 or 3, and add <tt>option/unicode.c</tt> to the project. The LFN requiers a certain working buffer in addition. The buffer size can be configured by <tt><a href="config.html#max_lfn">_MAX_LFN</a></tt> according to the available memory. The length of an LFN will be up to 255 characters, so that the <tt>_MAX_LFN</tt> should be set to 255 for all 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 is enabled, <tt>_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 working buffer occupies <tt>(_MAX_LFN + 1) * 2</tt> bytes and additional <tt>(_MAX_LFN + 44) / 15 * 32</tt> bytes when exFAT is enabled.</p> | ||||
| <table class="lst2 rset"> | ||||
| <caption>With LFN at CM3+gcc</caption> | ||||
| <tr><th><tt>_CODE_PAGE</tt></th><th>Code size</th></tr> | ||||
| @ -165,22 +165,22 @@ And other options are left unchanged from original setting. | ||||
| 
 | ||||
| <div class="para doc" id="exfat"> | ||||
| <h3>exFAT File System</h3> | ||||
| <p>The exFAT (Microsoft's Extended File Allocation Table) file system is a replacement of the FAT file system which has been widely used in the embedded systems and consumer devices. It is adopted by SDA (SD Association) as a recommended file system for high capacity SD cards (>32GB) and they are being shipped with this format, so that the exFAT will soon become one of the standard file systems for removable media.</p> | ||||
| <p>The exFAT file system allows the file size larger than 4 GiB limit what FAT file system allows upto and some file system overhead, especially file allocation delay, are reduced as well. This feature improves the write throughput to the file. However a problem on the current implementation of FatFs is that write throughput at writing to the growing edge of the fragmented file gets less than the throughput on the FAT volume. Pre-allocating a contiguous block with <tt>f_expand</tt> function may be a workaround of this problem.</p> | ||||
| <p>Note that the exFAT is a patent of Microsoft Corporation. The exFAT function of FatFs is an implementation based on US. Pat. App. Pub. No. 2009/0164440 A1. FatFs module can swich the exFAT on/off by configuration option. When enable the exFAT on the commercial products, you will need to be licensed by Microsoft depends on the final destination of the products.</p></div> | ||||
| <p><em>Remark: Enabling exFAT discards C89 compatibility because of need for 64-bit integer type.</em></p> | ||||
| <p>The exFAT (Microsoft's Extended File Allocation Table) file system is a replacement of the FAT file system which has been widely used in the embedded systems and consumer devices. It is adopted by SDA (SD Association) as a recommended file system for high capacity SD cards (>32GB) and they are being shipped with this format, so that the exFAT become one of the standard file systems for removable media as well as FAT. The exFAT file system allows the file size larger than 4 GiB limit what FAT file system allows upto and some file system overhead, especially cluster allocation delay, are reduced as well. This feature improves the write throughput to the file.</p> | ||||
| <p>Note that the exFAT is a patent of Microsoft Corporation. The exFAT function of FatFs is an implementation based on <cite>US. Pat. App. Pub. No. 2009/0164440 A1</cite>. FatFs module can swich the exFAT on/off by configuration option. When enable the exFAT on the commercial products, you will need to be licensed by Microsoft depends on the final destination of the products.</p> | ||||
| <p><em>Remark: Enabling exFAT discards ANSI C (C89) compatibility because of need for 64-bit integer type.</em></p> | ||||
| </div> | ||||
| 
 | ||||
| <div class="para doc" id="reentrant"> | ||||
| <h3>Re-entrancy</h3> | ||||
| <p>The file operations to the different volume is always re-entrant regardless of configurations except when LFN enabled with static working buffer. It can work simultaneously without any mutual exclusion.</p> | ||||
| <p>The file operations to the same volume is not re-entrant but it can also be configured thread-safe by option <tt><a href="config.html#fs_reentrant">_FS_REENTRANT</a></tt>. It enables to control exclusive use of each file system object. In this case, also the OS dependent synchronization object control functions, <tt>ff_cre_syncobj/ff_del_syncobj/ff_req_grant/ff_rel_grant</tt>, needed to be added to the project. There are some examples in the <tt>option/syscall.c</tt>.</p> | ||||
| <p>The file operations to the <em>different volume</em> each other is always re-entrant regardless of configurations except when LFN enabled with static working buffer. It can work simultaneously without any mutual exclusion.</p> | ||||
| <p>The file operations to the <em>same volume</em> is not re-entrant. It can also be configured thread-safe by option <tt><a href="config.html#fs_reentrant">_FS_REENTRANT</a></tt>. It enables to control exclusive use of each file system object. In this case, also the OS dependent synchronization object control functions, <tt>ff_cre_syncobj/ff_del_syncobj/ff_req_grant/ff_rel_grant</tt>, needed to be added to the project. There are some examples in the <tt>option/syscall.c</tt>.</p> | ||||
| <p>When a file function is called while the volume is being accessed by other task, the file function to the volume will be suspended until that task leaves the file function. If the wait time exceeded a period defined by <tt>_TIMEOUT</tt>, the file function will abort with <tt>FR_TIMEOUT</tt>. The timeout function might not be supported on the some RTOSs.</p> | ||||
| <p>There is an exception on the re-entrancy for <tt>f_mount/f_mkfs/f_fdisk</tt> function. These volume management functions are not re-entrant to the same volume and corresponding physical drive. When use these functions, other tasks need to avoid to access the volume.</p> | ||||
| <p>Note that this section describes on the re-entrancy of the FatFs module itself. The <tt>_FS_REENTRANT</tt> controls only exclusive use of each file system object and it does not that prevent to re-enter the low level disk functions. For example, only <tt>disk_status</tt> function can be re-entered at single volume system and any disk function can be re-entered at multiple volume system. Thus the low level disk I/O layer must be always thread-safe when any FatFs API is re-entered by two or more tasks.</p> | ||||
| <p>There is an exception on the re-entrancy for <tt>f_mount/f_mkfs/f_fdisk</tt> function. These volume management functions are not re-entrant on the same volume and corresponding physical drive. When use these functions, other tasks need to avoid to access the volume.</p> | ||||
| <p>Note that this section describes on the re-entrancy of the FatFs module itself. The <tt>_FS_REENTRANT</tt> controls only exclusive use of each file system object and it does not that prevent re-entering the low level disk functions. For example, only <tt>disk_status</tt> function is re-entered at single volume system and every disk function is re-entered at multiple volume system. Thus the low level disk I/O layer must be always thread-safe when FatFs API is re-entered by two or more tasks.</p> | ||||
| </div> | ||||
| 
 | ||||
| <div class="para doc" id="dup"> | ||||
| <h3>Duplicated File Access</h3> | ||||
| <h3>Duplicated File Open</h3> | ||||
| <p>FatFs module does not support the read/write collision control of duplicated open to a file. The duplicated open is permitted only when each of open method to a file is read mode. The duplicated open with one or more write mode to a file is always prohibited, and also open file must not be renamed or deleted. A violation of these rules can cause data colluption.</p> | ||||
| <p>The file lock control can be enabled by <tt><a href="config.html#fs_lock">_FS_LOCK</a></tt> option. The value of option defines the number of open objects to manage simultaneously. In this case, if any open, rename or remove that violating the file shareing rule that described above is attempted, the file function will rejected with <tt>FR_LOCKED</tt>. If number of open objects, files and sub-directories, is equal to <tt>_FS_LOCK</tt>, an extra <tt>f_open/f_opendir</tt> function will fail with <tt>FR_TOO_MANY_OPEN_FILES</tt>.</p> | ||||
| </div> | ||||
| @ -236,7 +236,7 @@ Figure 5. Minimized critical section<br> | ||||
| <li>The file created as new or overwritten remains but no content.</li> | ||||
| <li>Efficiency of disk use gets worse due to lost clusters.</li> | ||||
| </ul> | ||||
| <p>Each case does not affect the files that not opened in write mode. To minimize risk of data loss, the critical section can be minimized by minimizing the time that file is opened in write mode or using <tt>f_sync</tt> function as shown in Figure 5.</p> | ||||
| <p>Each case does not affect any file not opened in write mode. To minimize risk of data loss, the critical section can be minimized by minimizing the time that file is opened in write mode or using <tt>f_sync</tt> function as shown in Figure 5.</p> | ||||
| </div> | ||||
| 
 | ||||
| <div class="para doc" id="fs3"> | ||||
| @ -256,15 +256,15 @@ Figure 5. Minimized critical section<br> | ||||
| <p>FatFs has being developped as a personal project of the author, ChaN. It is free from the code anyone else wrote at current release. Following code block shows a copy of the FatFs license document that included in the source files.</p> | ||||
| <pre> | ||||
| /*----------------------------------------------------------------------------/ | ||||
| /  FatFs - Generic FAT file system module  R0.12a                             / | ||||
| /  FatFs - Generic FAT file system module  Rx.xx                              / | ||||
| /-----------------------------------------------------------------------------/ | ||||
| / | ||||
| / Copyright (C) 2016, ChaN, all right reserved. | ||||
| / Copyright (C) 20xx, ChaN, all right reserved. | ||||
| / | ||||
| / FatFs module is an open source software. Redistribution and use of FatFs in | ||||
| / source and binary forms, with or without modification, are permitted provided | ||||
| / that the following condition is met: | ||||
| 
 | ||||
| / | ||||
| / 1. Redistributions of source code must retain the above copyright notice, | ||||
| /    this condition and the following disclaimer. | ||||
| / | ||||
| @ -274,7 +274,7 @@ Figure 5. Minimized critical section<br> | ||||
| / by use of this software. | ||||
| /----------------------------------------------------------------------------*/ | ||||
| </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 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 licenses that not conflict 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 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 not conflict with FatFs license.</p> | ||||
| </div> | ||||
| 
 | ||||
| <p class="foot"><a href="../00index_e.html">Return Home</a></p> | ||||
|  | ||||
| @ -147,7 +147,7 @@ | ||||
| <p>Disable (0) or Enable (1). This option switches multi-partition function. By default (0), each logical drive number is bound to the same physical drive number and only an FAT volume in the physical drive is mounted. When enabled, each logical drive is bound to the partition on the physical drive listed in the user defined partition resolution table <tt>VolToPart[]</tt>. Also <tt>f_fdisk</tt> funciton will be available. For more information, read <a href="filename.html#vol">here</a>.</p> | ||||
| 
 | ||||
| <h4 id="max_ss">_MIN_SS, _MAX_SS</h4> | ||||
| <p>This set of options defines the size of sector on low level disk I/O interface, <tt>disk_read</tt> and <tt>disk_write</tt> function. Valid values are 512, 1024, 2048 and 4096. <tt>_MIN_SS</tt> defines minimum sector size and <tt>_MAX_SS</tt> defines the maximum sector size. Always set both 512 for any type of memory card and harddisk. But a larger value may be required for on-board flash memory and some type of optical media. When <tt>_MAX_SS > _MIN_SS</tt>, FatFs is configured to variable sector size and <tt>GET_SECTOR_SIZE</tt> command must be implemented to the <tt>disk_ioctl</tt> function.</p> | ||||
| <p>This set of options defines the size of sector on low level disk I/O interface, <tt>disk_read</tt> and <tt>disk_write</tt> function. Valid values are 512, 1024, 2048 and 4096. <tt>_MIN_SS</tt> defines minimum sector size and <tt>_MAX_SS</tt> defines the maximum sector size. Always set both 512 for memory card and harddisk. But a larger value may be required for on-board flash memory and some type of optical media. When <tt>_MAX_SS > _MIN_SS</tt>, support of variable sector size is enabled and <tt>GET_SECTOR_SIZE</tt> command needs to be implemented to the <tt>disk_ioctl</tt> function.</p> | ||||
| 
 | ||||
| <h4 id="use_trim">_USE_TRIM</h4> | ||||
| <p>Disable (0) or Enable (1). This option switches ATA-TRIM function. To enable Trim function, also <tt>CTRL_TRIM</tt> command should be implemented to the <tt>disk_ioctl</tt> function.</p> | ||||
|  | ||||
| @ -13,7 +13,7 @@ | ||||
| 
 | ||||
| <div class="para func"> | ||||
| <h2>disk_initialize</h2> | ||||
| <p>The disk_initialize function initializes the storage device.</p> | ||||
| <p>The disk_initialize function is called to initializes the storage device.</p> | ||||
| <pre> | ||||
| DSTATUS disk_initialize ( | ||||
|   BYTE <span class="arg">pdrv</span>           <span class="c">/* [IN] Physical drive number */</span> | ||||
|  | ||||
| @ -13,7 +13,7 @@ | ||||
| 
 | ||||
| <div class="para func"> | ||||
| <h2>disk_ioctl</h2> | ||||
| <p>The disk_ioctl function controls device specific features and miscellaneous functions other than generic read/write.</p> | ||||
| <p>The disk_ioctl function is called to control device specific features and miscellaneous functions other than generic read/write.</p> | ||||
| <pre> | ||||
| DRESULT disk_ioctl ( | ||||
|   BYTE <span class="arg">pdrv</span>,     <span class="c">/* [IN] Drive number */</span> | ||||
| @ -59,9 +59,9 @@ DRESULT disk_ioctl ( | ||||
| <tr><th>Command</th><th>Description</th></tr> | ||||
| <tr><td>CTRL_SYNC</td><td>Make sure that the device has finished pending write process. If the disk I/O module has a write back cache, the dirty buffers must be written back to the media immediately. Nothing to do for this command if each write operation to the media is completed within the <tt>disk_write</tt> function.</td></tr> | ||||
| <tr><td>GET_SECTOR_COUNT</td><td>Returns number of available sectors on the drive into the <tt>DWORD</tt> variable pointed by <tt class="arg">buff</tt>. This command is used by only <tt>f_mkfs</tt> and <tt>f_fdisk</tt> function to determine the volume/partition size to be created. Required at <tt>_USE_MKFS == 1</tt> or <tt>_MULTI_PARTITION == 1</tt>.</td></tr> | ||||
| <tr><td>GET_SECTOR_SIZE</td><td>Returns sector size of the media into the <tt>WORD</tt> variable pointed by <tt class="arg">buff</tt>. Valid return values of this command are 512, 1024, 2048 and 4096. This command is required only at variable sector size configuration, <tt>_MAX_SS > _MIN_SS</tt>. At fixed sector size configuration, <tt>_MAX_SS == _MIN_SS</tt>, this command is not used and the device must work at that sector size.</td></tr> | ||||
| <tr><td>GET_BLOCK_SIZE</td><td>Returns erase block size of the flash memory media in unit of sector into the <tt>DWORD</tt> variable pointed by <tt class="arg">buff</tt>. The allowable value is from 1 to 32768 in power of 2. Return 1 if the erase block size is unknown or non flash memory media. This command is used by only <tt>f_mkfs</tt> function and it attempts to align data area to the erase block boundary. Required at <tt>_USE_MKFS == 1</tt>.</td></tr> | ||||
| <tr><td>CTRL_TRIM</td><td>Informs the device the data on the block of sectors that specified by <tt>DWORD</tt> array {<start sector>, <end sector>} pointed by <tt class="arg">buff</tt> is no longer needed and it may be erased. This is an identical command to Trim of ATA device. Nothing to do for this command if this funcion is not supported or not a flash memory device. The FatFs does not check the result code and the file function is not affected even if the sector block was not erased well. This command is called on remove a cluster chain and in the <tt>f_mkfs</tt> function. Required at <tt>_USE_TRIM == 1</tt>.</td></tr> | ||||
| <tr><td>GET_SECTOR_SIZE</td><td>Returns sector size of the device into the <tt>WORD</tt> variable pointed by <tt class="arg">buff</tt>. Valid return values of this command are 512, 1024, 2048 and 4096. This command is required only at variable sector size configuration, <tt>_MAX_SS > _MIN_SS</tt>. At the fixed sector size configuration, <tt>_MAX_SS == _MIN_SS</tt>, this command is not used and the device must work at that sector size.</td></tr> | ||||
| <tr><td>GET_BLOCK_SIZE</td><td>Returns erase block size of the flash memory media in unit of sector into the <tt>DWORD</tt> variable pointed by <tt class="arg">buff</tt>. The allowable value is from 1 to 32768 in power of 2. Return 1 if the erase block size is unknown or non flash memory media. This command is used by only <tt>f_mkfs</tt> function and it attempts to align data area on the erase block boundary. Required at <tt>_USE_MKFS == 1</tt>.</td></tr> | ||||
| <tr><td>CTRL_TRIM</td><td>Informs the device the data on the block of sectors is no longer needed and it can be erased. The sector block is specified by <tt>DWORD</tt> array {<start sector>, <end sector>} pointed by <tt class="arg">buff</tt>. This is an identical command to Trim of ATA device. Nothing to do for this command if this funcion is not supported or not a flash memory device. The FatFs does not check the result code and the file function is not affected even if the sector block was not erased well. This command is called on remove a cluster chain and in the <tt>f_mkfs</tt> function. Required at <tt>_USE_TRIM == 1</tt>.</td></tr> | ||||
| </table> | ||||
| 
 | ||||
| <p>FatFs never uses any device dependent command nor user defined command. Following table shows an example of non-standard commands usable for some applications.</p> | ||||
| @ -69,8 +69,8 @@ DRESULT disk_ioctl ( | ||||
| <caption>Example of optional ioctl command</caption> | ||||
| <tr><th>Command</th><th>Description</th></tr> | ||||
| <tr><td>CTRL_FORMAT</td><td>Create a physical format on the media. If <tt class="arg">buff</tt> is not null, it is pointer to the call-back function for progress notification.</td></tr> | ||||
| <tr><td>CTRL_POWER_IDLE</td><td>Put the device idle state. <tt>STA_NOINIT</tt> in status flag may not be set if the device goes active state by generic read/write function.</td></tr> | ||||
| <tr><td>CTRL_POWER_OFF</td><td>Put the device off state. Shut-down the power to the device and deinitialize the device interface if needed. <tt>STA_NOINIT</tt> in status flag must be set. The device goes active state by <tt>disk_initialize</tt> function.</td></tr> | ||||
| <tr><td>CTRL_POWER_IDLE</td><td>Put the device idle state. <tt>STA_NOINIT</tt> in the current status flags may not be set if the device goes active state by generic read/write function.</td></tr> | ||||
| <tr><td>CTRL_POWER_OFF</td><td>Put the device off state. Shut-down the power to the device and deinitialize the device interface if needed. <tt>STA_NOINIT</tt> in the current status flags must be set. The device goes active state by <tt>disk_initialize</tt> function.</td></tr> | ||||
| <tr><td>CTRL_LOCK</td><td>Lock media eject mechanism.</td></tr> | ||||
| <tr><td>CTRL_UNLOCK</td><td>Unlock media eject mechanism.</td></tr> | ||||
| <tr><td>CTRL_EJECT</td><td>Eject media cartridge. <tt>STA_NOINIT</tt> and <tt>STA_NODISK</tt> in status flag are set after the function succeeded.</td></tr> | ||||
|  | ||||
| @ -13,7 +13,7 @@ | ||||
| 
 | ||||
| <div class="para func"> | ||||
| <h2>disk_read</h2> | ||||
| <p>The disk_read function reads sector(s) from the storage device.</p> | ||||
| <p>The disk_read function is called to read data from the sector(s) of storage device.</p> | ||||
| <pre> | ||||
| DRESULT disk_read ( | ||||
|   BYTE <span class="arg">pdrv</span>,     <span class="c">/* [IN] Physical drive number */</span> | ||||
| @ -45,7 +45,7 @@ DRESULT disk_read ( | ||||
| <dt>RES_OK (0)</dt> | ||||
| <dd>The function succeeded.</dd> | ||||
| <dt>RES_ERROR</dt> | ||||
| <dd>Any hard error occured during the read operation and could not recover it.</dd> | ||||
| <dd>A hard error occured during the read operation and could not recover it.</dd> | ||||
| <dt>RES_PARERR</dt> | ||||
| <dd>Invalid parameter.</dd> | ||||
| <dt>RES_NOTRDY</dt> | ||||
| @ -60,8 +60,8 @@ DRESULT disk_read ( | ||||
| <p>The memory address specified by <tt class="arg">buff</tt> is not that always aligned to word boundary because the argument is defined as <tt>BYTE*</tt>. The unaligned read/write 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. There are some workarounds described below to avoid this issue.</p> | ||||
| <ul> | ||||
| <li>Convert word transfer to byte transfer in this function if needed. - 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, make sure that <tt>(((UINT)data & 3) == (f_tell(fp) & 3))</tt> is true. - Word alignment of <tt>buff</tt> is guaranteed.</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(fp, data, btw, bw)</tt> calls, make sure that <tt>(((UINT)data & 3) == (f_tell(fp) & 3))</tt> is true. - Word alignment of <tt class="arg">buff</tt> is guaranteed.</li> | ||||
| </ul> | ||||
| <p>Generally, a multiple sector transfer request must not be split into single sector transactions to the storage device, or you will not get good read throughput.</p> | ||||
| </div> | ||||
|  | ||||
| @ -13,7 +13,7 @@ | ||||
| 
 | ||||
| <div class="para func"> | ||||
| <h2>disk_status</h2> | ||||
| <p>The disk_status function returns the current drive status.</p> | ||||
| <p>The disk_status function is called to inquire the current drive status.</p> | ||||
| <pre> | ||||
| DSTATUS disk_status ( | ||||
|   BYTE <span class="arg">pdrv</span>     <span class="c">/* [IN] Physical drive number */</span> | ||||
| @ -35,7 +35,7 @@ DSTATUS disk_status ( | ||||
| <p>The current drive status is returned in combination of status flags described below. FatFs refers only <tt>STA_NOINIT</tt> and <tt>STA_PROTECT</tt>.</p> | ||||
| <dl class="ret"> | ||||
| <dt>STA_NOINIT</dt> | ||||
| <dd>Indicates that the device is not initialized and not ready to work. This flag is set on system reset, media removal or failure of <tt>disk_initialize</tt> function. It is cleared on <tt>disk_initialize</tt> function succeeded. Any media change that occurs asynchronously must be captured and reflect it to the status flags, or auto-mount function will not work correctly. If the system does not support media change detection, application program needs to force de-initialize the file system object and re-mount the volume with <tt>f_mount</tt> function after each media change.</dd> | ||||
| <dd>Indicates that the device is not initialized and not ready to work. This flag is set on system reset, media removal or failure of <tt>disk_initialize</tt> function. It is cleared on <tt>disk_initialize</tt> function succeeded. Any media change that occurs asynchronously must be captured and reflect it to the status flags, or auto-mount function will not work correctly. If the system does not support media change detection, application program needs to explicitly re-mount the volume with <tt>f_mount</tt> function after each media change.</dd> | ||||
| <dt>STA_NODISK</dt> | ||||
| <dd>Indicates that no medium in the drive. This is always cleared at fixed disk drive. Note that FatFs does not refer this flag.</dd> | ||||
| <dt>STA_PROTECT</dt> | ||||
|  | ||||
| @ -13,7 +13,7 @@ | ||||
| 
 | ||||
| <div class="para func"> | ||||
| <h2>disk_write</h2> | ||||
| <p>The disk_write writes sector(s) to the storage device.</p> | ||||
| <p>The disk_write function is called to write data to the sector(s) of storage device.</p> | ||||
| <pre> | ||||
| DRESULT disk_write ( | ||||
|   BYTE <span class="arg">drv</span>,         <span class="c">/* [IN] Physical drive number */</span> | ||||
| @ -45,7 +45,7 @@ DRESULT disk_write ( | ||||
| <dt>RES_OK (0)</dt> | ||||
| <dd>The function succeeded.</dd> | ||||
| <dt>RES_ERROR</dt> | ||||
| <dd>Any hard error occured during the write operation and could not recover it.</dd> | ||||
| <dd>A hard error occured during the write operation and could not recover it.</dd> | ||||
| <dt>RES_WRPRT</dt> | ||||
| <dd>The medium is write protected.</dd> | ||||
| <dt>RES_PARERR</dt> | ||||
| @ -60,7 +60,7 @@ DRESULT disk_write ( | ||||
| <h4>Description</h4> | ||||
| <p>The specified memory address is not that always aligned to word boundary because the type of pointer is defined as <tt>BYTE*</tt>. For more information, refer to the description of <a href="dread.html"><tt>disk_read</tt></a> function.</p> | ||||
| <p>Generally, a multiple sector transfer request must not be split into single sector transactions to the storage device, or you will never get good write throughput.</p> | ||||
| <p>FatFs expects delayed write function of the disk control layer. The write operation to the media does not need to be completed when return from this function by what write operation is in progress or data is only stored into the write-back cache. But write data on the <tt class="arg">buff</tt> is invalid after return from this function. The write completion request is done by <tt>CTRL_SYNC</tt> command of <tt><a href="dioctl.html">disk_ioctl</a></tt> function. Therefore, if a delayed write function is implemented, the write throughput will be improved.</p> | ||||
| <p>FatFs expects delayed write function of the disk control layer. The write operation to the media does not need to be completed when return from this function by what write operation is in progress or data is only stored into the write-back cache. But write data on the <tt class="arg">buff</tt> is invalid after return from this function. The write completion request is done by <tt>CTRL_SYNC</tt> command of <tt><a href="dioctl.html">disk_ioctl</a></tt> function. Therefore, if a delayed write function is implemented, the write throughput of the file system will be improved.</p> | ||||
| <p><em>Remarks: Application program MUST NOT call this function, or FAT structure on the volume can be collapsed.</em></p> | ||||
| </div> | ||||
| 
 | ||||
|  | ||||
| @ -60,8 +60,8 @@ FRESULT f_expand ( | ||||
| <li>Not allowable file size. (>= 4GiB on FAT volume)</li> | ||||
| </ul> | ||||
| <p>When <tt class="arg">opt</tt> is 0, the function finds a contiguous data area and set it as suggested point for next allocation instead of allocating it to the file. The next cluster allocation is started at top of the contiguous area found by this function. Thus the write file is guaranteed be contiguous and no allocation delay until the size reaches that size at least unless any other changes to the volume is performed.</p> | ||||
| <p>The contiguous file would have an advantage at time-critical read/write operations. It reduces some overheads in the file system and the storage media caused by random access due to fragmented file data. Especially, at the exFAT volume, any FAT access for the contiguous file is completely eliminated and storage media will be accessed sequentially.</p> | ||||
| <p>Also the contiguous file data can be easily accessed directly via low-level disk functions but it is not recommended in consideration for future compatibility.</p> | ||||
| <p>The contiguous file would have an advantage at time-critical read/write operations. It eliminates some overheads in the file system and the storage media caused by random access due to fragmented file data. Especially FAT access for the contiguous file on the exFAT volume is completely eliminated and storage media will be accessed sequentially.</p> | ||||
| <p>Also the contiguous file can be easily accessed directly via low-level disk functions. But this is not recommended in consideration for future compatibility.</p> | ||||
| </div> | ||||
| 
 | ||||
| <div class="para comp"> | ||||
| @ -79,28 +79,29 @@ FRESULT f_expand ( | ||||
|     res = f_open(fp = malloc(sizeof (FIL)), "file.dat", FA_WRITE|FA_CREATE_ALWAYS); | ||||
|     if (res) { <span class="c">/* Check if the file has been opened */</span> | ||||
|         free(fp); | ||||
|         ... | ||||
|         die("Failed to open the file."); | ||||
|     } | ||||
| 
 | ||||
|     <span class="c">/* Alloacte a 100 MiB of contiguous area to the file */</span> | ||||
|     res = f_expand(fp, 104857600, 1); | ||||
|     if (res) { <span class="c">/* Check if the file has been expanded */</span> | ||||
|         ... | ||||
|         f_close(fp); | ||||
|         free(fp); | ||||
|         ... | ||||
|         die("Failed to allocate contiguous area."); | ||||
|     } | ||||
| 
 | ||||
|     <span class="c">/* Now you have a contiguous file accessible with fp */</span> | ||||
| 
 | ||||
| </pre> | ||||
| <pre> | ||||
|     <span class="c">/* Accessing the file data directly via low-level disk functions */</span> | ||||
|     <span class="c">/* Accessing the contiguous file via low-level disk functions */</span> | ||||
| 
 | ||||
|     <span class="c">/* Get physical location of the file data */</span> | ||||
|     drv = fp->obj.fs->drv; | ||||
|     sect = fp->obj.fs->database + fp->obj.fs->csize * (fp->obj.sclust - 2); | ||||
|     lba = fp->obj.fs->database + fp->obj.fs->csize * (fp->obj.sclust - 2); | ||||
| 
 | ||||
|     <span class="c">/* Write 2048 sectors from top of the file at a time */</span> | ||||
|     res = disk_write(drv, buffer, sect, 2048); | ||||
|     res = disk_write(drv, buffer, lba, 2048); | ||||
| 
 | ||||
| </pre> | ||||
| </div> | ||||
|  | ||||
| @ -13,7 +13,7 @@ | ||||
| 
 | ||||
| <div class="para func"> | ||||
| <h2>get_fattime</h2> | ||||
| <p>The get_fattime function gets the current time.</p> | ||||
| <p>The get_fattime function is called to get the current time.</p> | ||||
| <pre> | ||||
| DWORD get_fattime (void); | ||||
| </pre> | ||||
| @ -22,7 +22,7 @@ DWORD get_fattime (void); | ||||
| 
 | ||||
| <div class="para ret"> | ||||
| <h4>Return Value</h4> | ||||
| <p>Currnet local time is returned in bit-fields packed into a <tt>DWORD</tt> value. The bit field is as follows:</p> | ||||
| <p>Currnet local time shall be returned as bit-fields packed into a <tt>DWORD</tt> value. The bit fields are as follows:</p> | ||||
| <dl class="ret"> | ||||
| <dt>bit31:25</dt> | ||||
| <dd>Year origin from the 1980 (0..127)</dd> | ||||
|  | ||||
| @ -62,22 +62,21 @@ FRESULT f_fdisk ( | ||||
|     <span class="c">/* Volume management table defined by user (required when _MULTI_PARTITION == 1) */</span> | ||||
| 
 | ||||
|     PARTITION VolToPart[] = { | ||||
|         {0, 1},    <span class="c">/* Logical drive 0 ==> Physical drive 0, 1st partition */</span> | ||||
|         {0, 2},    <span class="c">/* Logical drive 1 ==> Physical drive 0, 2nd partition */</span> | ||||
|         {1, 0}     <span class="c">/* Logical drive 2 ==> Physical drive 1, auto detection */</span> | ||||
|         {0, 1},    <span class="c">/* "0:" ==> Physical drive 0, 1st partition */</span> | ||||
|         {0, 2},    <span class="c">/* "1:" ==> Physical drive 0, 2nd partition */</span> | ||||
|         {1, 0}     <span class="c">/* "2:" ==> Physical drive 1, auto detection */</span> | ||||
|     }; | ||||
| </pre> | ||||
| <pre> | ||||
|     <span class="c">/* Initialize a brand-new disk drive mapped to physical drive 0 */</span> | ||||
| 
 | ||||
|     FATFS fs; | ||||
|     DWORD plist[] = {50, 50, 0, 0};  <span class="c">/* Divide drive into two partitions */</span> | ||||
|     BYTE work[_MAX_SS]; | ||||
| 
 | ||||
|     f_fdisk(0, plist, work);                     <span class="c">/* Divide physical drive 0 */</span> | ||||
|     f_fdisk(0, plist, work);                    <span class="c">/* Divide physical drive 0 */</span> | ||||
| 
 | ||||
|     f_mkfs("0:", FMT_ANY, work, sizeof work);    <span class="c">/* Create FAT volume on the logical drive 0 */</span> | ||||
|     f_mkfs("1:", FMT_ANY, work, sizeof work);    <span class="c">/* Create FAT volume on the logical drive 1 */</span> | ||||
|     f_mkfs("0:", FM_ANY, work, sizeof work);    <span class="c">/* Create FAT volume on the logical drive 0 */</span> | ||||
|     f_mkfs("1:", FM_ANY, work, sizeof work);    <span class="c">/* Create FAT volume on the logical drive 1 */</span> | ||||
| 
 | ||||
| </pre> | ||||
| </div> | ||||
|  | ||||
| @ -10,7 +10,7 @@ | ||||
| </head> | ||||
| 
 | ||||
| <body> | ||||
| <h1>Path Names</h1> | ||||
| <h1>Path Names on the FatFs</h1> | ||||
| 
 | ||||
| <div class="para doc" id="nam"> | ||||
| <h3>Format of the path names</h3> | ||||
| @ -19,7 +19,7 @@ | ||||
| <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">_USE_LFN</a> != 0</tt>). The sub directories are separated with a \ or / in the same way as DOS/Windows API. Duplicated separators are skipped and ignored. Only a difference is that the logical drive is specified in a numeral with a colon. When drive number is omitted, the drive number is assumed as <em>default drive</em> (drive 0 or current drive).</p> | ||||
| <p>Control characters (<tt>'\0'</tt> to <tt>'\x1F'</tt>) are recognized as end of the path name. Leading/embedded spaces in the path name are valid as a part of the name at LFN configuration but the space is recognized as end of the path name at non-LFN configuration. Trailing spaces and dots are ignored at both configurations.</p> | ||||
| <p>In default configuration (<tt><a href="config.html#fs_rpath">_FS_RPATH</a> == 0</tt>), it does not have a concept of current directory like OS oriented file system. All objects on the volume are always specified in full path name that follows 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>_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">f_chdir</a> function. Dot names are also allowed for the path names. The default drive is the current drive set by <a href="chdrive.html">f_chdrive</a> function.</p> | ||||
| <p>When relative path is enabled (<tt>_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> | ||||
| <table class="lst2"> | ||||
| <tr><td>Path name</td><td>_FS_RPATH == 0</td><td>_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> | ||||
| @ -41,7 +41,7 @@ | ||||
| 
 | ||||
| <div class="para doc" id="case"> | ||||
| <h3>Legal Characters and Case Sensitivity</h3> | ||||
| <p>On the FAT file system, legal characters for file name are, <tt>0-9 A-Z ! # $ % & ' ( ) - @ ^ _ ` { } ~</tt> and extended characters (<tt>\x80</tt>-<tt>\xFF</tt>). Under LFN supported system, also white space and <tt>+ , ; = [ ]</tt> are legal for the file name and the white spaces and periods can be placed anywhere in the name except for end of the name string.</p> | ||||
| <p>On the FAT file system, legal characters for object name (file/directory name) are, <tt>0-9 A-Z ! # $ % & ' ( ) - @ ^ _ ` { } ~</tt> and extended characters (<tt>\x80</tt>-<tt>\xFF</tt>). Under LFN supported system, also <tt>+ , ; = [ ]</tt> and space are legal for the object name and the white spaces and periods can be placed anywhere in the path name except for end of the object name.</p> | ||||
| <p>FAT file system is case-insensitive to the object names on the volume. All object names are compared in case-insensitive. For example, these three names, <tt>file.txt</tt>, <tt>File.Txt</tt> and <tt>FILE.TXT</tt>, are identical. This is applied to also extended charactres. When an object is created on the FAT volume, upper converted name is recorded to the SFN entry, and the raw name is recorded to the LFN entry.</p> | ||||
| <p>As for the DBCS language MS-DOS, it was case-sensitive to the extended characters. To follow this specification, FatFs works with case-sensitive to the extended characters at only non-LFN with DBCS configuration (DOS/DBCS specs). But at LFN configuration, FatFs works with case-insensitive to all characters (WindowsNT specs). This can cause a problem on compatibility with Windows system when an object with extended characters is created on the volume at non-LFN and DBCS configuration; therfore the object names with DBCS extended characters should not be used on the FAT volume shared by those systems.</p> | ||||
| </div> | ||||
|  | ||||
| @ -65,7 +65,7 @@ FRESULT f_findfirst ( | ||||
| <p>The matching pattern can contain wildcard characters (<tt>?</tt> and <tt>*</tt>). A <tt>?</tt> matches an any character and an <tt>*</tt> matches an any string in length of zero or longer. When support of long file name is enabled, only <tt>fname[]</tt> is tested at <tt>_USE_FIND == 1</tt> and also <tt>altname[]</tt> is tested at <tt>_USE_FIND == 2</tt>. In this revision, there are some differences listed below between FatFs and standard systems in matching condition.</p> | ||||
| <ul> | ||||
| <li><tt>"*.*"</tt> never matches any name without extension while it matches any name with or without extension at the standard systems.</li> | ||||
| <li>Any patterns terminated with a period never matches any name while it matches any name without extensiton at the standard systems.</li> | ||||
| <li>Any pattern terminated with a period never matches any name while it matches any name without extensiton at the standard systems.</li> | ||||
| <li><a href="filename.html#case">DBCS extended characters</a> are compared in case-sensitive at LFN with non-Unicode configuration.</li> | ||||
| </ul> | ||||
| </div> | ||||
| @ -82,7 +82,7 @@ FRESULT f_findfirst ( | ||||
| <pre> | ||||
| <span class="c">/* Search a directory for objects and display it */</span> | ||||
| 
 | ||||
| void find_image (void) | ||||
| void find_image_file (void) | ||||
| { | ||||
|     FRESULT fr;     <span class="c">/* Return value */</span> | ||||
|     DIR dj;         <span class="c">/* Directory search object */</span> | ||||
| @ -94,6 +94,7 @@ void find_image (void) | ||||
|         printf("%s\n", fno.fname);                <span class="c">/* Display the object name */</span> | ||||
|         fr = f_findnext(&dj, &fno);               <span class="c">/* Search for next item */</span> | ||||
|     } | ||||
| 
 | ||||
|     f_closedir(&dj); | ||||
| } | ||||
| </pre> | ||||
|  | ||||
| @ -46,6 +46,7 @@ FRESULT f_forward ( | ||||
| <a href="rc.html#de">FR_DISK_ERR</a>, | ||||
| <a href="rc.html#ie">FR_INT_ERR</a>, | ||||
| <a href="rc.html#io">FR_INVALID_OBJECT</a>, | ||||
| <a href="rc.html#dn">FR_DENIED</a>, | ||||
| <a href="rc.html#tm">FR_TIMEOUT</a> | ||||
| </p> | ||||
| </div> | ||||
| @ -114,7 +115,7 @@ FRESULT play_file ( | ||||
|     <span class="c">/* Repeat until the file pointer reaches end of the file */</span> | ||||
|     while (rc == FR_OK && !f_eof(&fil)) { | ||||
| 
 | ||||
|         <span class="c">/* any other processes... */</span> | ||||
|         <span class="c">/* some processes... */</span> | ||||
| 
 | ||||
|         <span class="c">/* Fill output stream periodicaly or on-demand */</span> | ||||
|         rc = f_forward(&fil, out_stream, 1000, &dmy); | ||||
|  | ||||
| @ -29,7 +29,7 @@ FRESULT f_lseek ( | ||||
| <dt>fp</dt> | ||||
| <dd>Pointer to the open file object.</dd> | ||||
| <dt>ofs</dt> | ||||
| <dd>Byte offset from top of the file. The data type <tt>FSIZE_t</tt> is an alias of either <tt>DWORD</tt>(32-bit) or <tt>QWORD</tt>(64-bit) depends on the configuration option <tt>_FS_EXFAT</tt>.</dd> | ||||
| <dd>Byte offset from top of the file to set read/write pointer. The data type <tt>FSIZE_t</tt> is an alias of either <tt>DWORD</tt>(32-bit) or <tt>QWORD</tt>(64-bit) depends on the configuration option <tt>_FS_EXFAT</tt>.</dd> | ||||
| </dl> | ||||
| </div> | ||||
| 
 | ||||
| @ -48,7 +48,8 @@ FRESULT f_lseek ( | ||||
| 
 | ||||
| <div class="para desc"> | ||||
| <h4>Description</h4> | ||||
| <p>The <tt>f_lseek</tt> function moves the file read/write pointer of an open file. The offset can be specified in only origin from top of the file. When an offset beyond the file size is specified at write mode, the file size is expanded to the specified offset. The file data in the expanded area is <em>undefined</em> because no data is written to the file in this process. This is suitable to pre-allocate a cluster chain 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>File read/write ponter in the open file object points the data byte to be read/written at next read/write operation. It advances as the number of bytes read/written. The <tt>f_lseek</tt> function moves the file read/write pointer without any read/write operation to the file.</p> | ||||
| <p>When an offset beyond the file size is specified at write mode, the file size is expanded to the specified offset. The file data in the expanded area 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> | ||||
| <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>Disk full. There is no free space on the volume to expand the file.</li> | ||||
|  | ||||
| @ -39,7 +39,7 @@ FRESULT f_mkdir ( | ||||
| <a href="rc.html#nr">FR_NOT_READY</a>, | ||||
| <a href="rc.html#np">FR_NO_PATH</a>, | ||||
| <a href="rc.html#in">FR_INVALID_NAME</a>, | ||||
| <a href="rc.html#de">FR_DENIED</a>, | ||||
| <a href="rc.html#dn">FR_DENIED</a>, | ||||
| <a href="rc.html#ex">FR_EXIST</a>, | ||||
| <a href="rc.html#wp">FR_WRITE_PROTECTED</a>, | ||||
| <a href="rc.html#id">FR_INVALID_DRIVE</a>, | ||||
|  | ||||
| @ -29,15 +29,15 @@ FRESULT f_mkfs ( | ||||
| <h4>Parameters</h4> | ||||
| <dl class="par"> | ||||
| <dt>path</dt> | ||||
| <dd>Pointer to the null-terminated string specifies the <a href="filename.html">logical drive</a> to be formatted. If there is no drive number in it, it means the default drive. The logical drive may or may not be 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 has no drive number in it, it means the default drive. The logical drive may or may not be mounted for the format process.</dd> | ||||
| <dt>opt</dt> | ||||
| <dd>Specifies the format option in combination of <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. The flag <tt>FM_SFD</tt> specifies to place the volume on the drive in SFD format.</dd> | ||||
| <dt>au</dt> | ||||
| <dd>Specifies size of the allocation unit (cluter) in unit of byte. The valid value is N times the sector size. N is power of 2 from 1 to 128 for FAT volume and upto 16MiB for exFAT volume. If zero is given, the default allocation unit size is selected depends on the volume size.</dd> | ||||
| <dd>Specifies size of the allocation unit (cluter) in unit of byte. The valid value is <tt>n</tt> times the sector size. The <tt>n</tt> is power of 2 from 1 to 128 for FAT volume and upto 16MiB for exFAT volume. If zero is given, the default allocation unit size is selected depends on the volume size.</dd> | ||||
| <dt>work</dt> | ||||
| <dd>Pointer to the working buffer used for the format process.</dd> | ||||
| <dt>len</dt> | ||||
| <dd>Size of the working buffer in unit of byte. It needs to be the sector size at least. Plenty of working buffer reduces number of write transaction to the device and the format process will be finished quickly.</dd> | ||||
| <dd>Size of the working buffer in unit of byte. It needs to be the sector size at least. Plenty of working buffer reduces number of write transactions to the drive and the format process will be finished quickly.</dd> | ||||
| </dl> | ||||
| </div> | ||||
| 
 | ||||
| @ -57,9 +57,9 @@ FRESULT f_mkfs ( | ||||
| <div class="para desc"> | ||||
| <h4>Description</h4> | ||||
| <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 which FAT sub-type is selected, is depends on the volume size and the specified cluster size. In case of the combination of FAT type and cluter size specified by argument cannot be valid on the volume, the function will fail with <tt>FR_MKFS_ABORTED</tt>.</p> | ||||
| <p>The allocation unit, also called 'cluster', 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 as the size of allocation unit. Therefore the allocation unit is a trade-off between space efficiency and performance. For the large storages in GB order, 32768 bytes or larger cluster (this is automatically selected by default) is recommended for most case unless extremely many files are created on a volume.</p> | ||||
| <p>The allocation unit, also called 'cluster', 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 as the size of allocation unit. Therefore the size of allocation unit is a trade-off between space efficiency and performance. For the large storages in GB order, 32768 bytes or larger cluster (this is automatically selected by default) is recommended for most case unless extremely many small files are created on a volume.</p> | ||||
| <p>There are two disk formats, FDISK and SFD. The FDISK format is usually used for harddisk, MMC, SDC, CFC and U Disk. It can divide a physical drive into one or more partitions with a partition table on the MBR (maser boot record, the first sector of the physical drive). The SFD (super-floppy disk) is non-partitioned disk format. The FAT volume starts at the first sector of the physical drive without any disk partitioning. It is usually used for floppy disk, Microdrive, optical disk and most type of super-floppy media. Some systems support only either one of two formats and other is not supported.</p> | ||||
| <p>When <tt>FM_SFD</tt> is not specified, a primary partition occupies whole drive space is created and then the FAT volume is created in it. When <tt>FM_SFD</tt> is specified, the FAT volume occupies from the first sector of the drive is created.</p> | ||||
| <p>When <tt>FM_SFD</tt> is not specified (the volume is bound to a physical drive), a primary partition occupies whole drive space is created and then the FAT volume is created in it. When <tt>FM_SFD</tt> is specified, the FAT volume occupies from the first sector of the drive is created.</p> | ||||
| <p>If the logical drive to be formatted is bound to the specific partition (1-4) by support of multiple partition, <tt><a href="config.html#multi_partition">_MULTI_PARTITION</a></tt>, the FAT volume is created into the partition and <tt>FM_SFD</tt> flag is ignored. The physical drive needs to be partitioned with <tt>f_fdisk</tt> function or any other partitioning tools prior to create the FAT volume with this function.</p> | ||||
| </div> | ||||
| 
 | ||||
| @ -78,7 +78,7 @@ int main (void) | ||||
|     FIL fil;            <span class="c">/* File object */</span> | ||||
|     FRESULT res;        <span class="c">/* API result code */</span> | ||||
|     UINT bw;            <span class="c">/* Bytes written */</span> | ||||
|     BYTE work[_MAX_SS]; <span class="c">/* Work area (larger is better for process time) */</span> | ||||
|     BYTE work[_MAX_SS]; <span class="c">/* Work area (larger is better for processing time) */</span> | ||||
| 
 | ||||
| 
 | ||||
|     <span class="c">/* Create FAT volume */</span> | ||||
|  | ||||
| @ -40,7 +40,7 @@ FRESULT f_open ( | ||||
| <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_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_APPEND</td><td>Same as <tt>FA_OPEN_ALWAYS</tt> except read/write pointer is set end of the file.</td></tr> | ||||
| <tr><td>FA_OPEN_APPEND</td><td>Same as <tt>FA_OPEN_ALWAYS</tt> except the read/write pointer is set end of the file.</td></tr> | ||||
| </table> | ||||
| </dd> | ||||
| </dl> | ||||
| @ -57,7 +57,7 @@ FRESULT f_open ( | ||||
| <a href="rc.html#ok">FR_NO_FILE</a>, | ||||
| <a href="rc.html#np">FR_NO_PATH</a>, | ||||
| <a href="rc.html#in">FR_INVALID_NAME</a>, | ||||
| <a href="rc.html#de">FR_DENIED</a>, | ||||
| <a href="rc.html#dn">FR_DENIED</a>, | ||||
| <a href="rc.html#ex">FR_EXIST</a>, | ||||
| <a href="rc.html#io">FR_INVALID_OBJECT</a>, | ||||
| <a href="rc.html#wp">FR_WRITE_PROTECTED</a>, | ||||
|  | ||||
| @ -19,7 +19,7 @@ | ||||
| <dd>The function succeeded.</dd> | ||||
| 
 | ||||
| <dt id="de">FR_DISK_ERR</dt> | ||||
| <dd>An unrecoverable hard error occured in the lower layer, <tt>disk_read</tt>, <tt>disk_write</tt> or <tt>disk_ioctl</tt> function.<br>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.</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 all operations to the file except for close will be rejected.</dd> | ||||
| 
 | ||||
| <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. | ||||
| @ -32,7 +32,14 @@ Note that if once this error occured at any operation to an open file, the file | ||||
| </dd> | ||||
| 
 | ||||
| <dt id="nr">FR_NOT_READY</dt> | ||||
| <dd>The storage device cannot work due to a failure of <a href="dinit.html"><tt>disk_initialize</tt></a> function due to no medium or any other reason.</dd> | ||||
| <dd>The lower layer, <a href="dinit.html"><tt>disk_initialize</tt></a> function, reported that the storage device could not be got ready to work. One of the following possibilities is suspected. | ||||
| <ul> | ||||
| <li>No medium in the drive.</li> | ||||
| <li>Wrong lower layer implementation for the storage device.</li> | ||||
| <li>Wrong hardware configuration.</li> | ||||
| <li>The storage device is broken.</li> | ||||
| </ul> | ||||
| </dd> | ||||
| 
 | ||||
| <dt id="nf">FR_NO_FILE</dt> | ||||
| <dd>Could not find the file.</dd> | ||||
|  | ||||
| @ -45,6 +45,7 @@ FRESULT f_read ( | ||||
| <a href="rc.html#ok">FR_OK</a>, | ||||
| <a href="rc.html#de">FR_DISK_ERR</a>, | ||||
| <a href="rc.html#ie">FR_INT_ERR</a>, | ||||
| <a href="rc.html#dn">FR_DENIED</a>, | ||||
| <a href="rc.html#io">FR_INVALID_OBJECT</a>, | ||||
| <a href="rc.html#tm">FR_TIMEOUT</a> | ||||
| </p> | ||||
|  | ||||
| @ -55,7 +55,7 @@ FRESULT f_readdir ( | ||||
| <li>Setting of <tt>_MAX_LFN</tt> is insufficient for the long file name. (Not the case at <tt>_MAX_LFN == 255</tt>)</li> | ||||
| <li>The long file name contains any character not allowed in ANSI/OEM code. (Not the case at <tt>_LFN_UNICODE == 1</tt>)</li> | ||||
| </ul> | ||||
| <p>There is a problem on reading a directory of exFAT volume. The exFAT does not support short file name. This means no name can be returned on the condition above. If it is the case, a "?" is returned as file name to indicate that the object is not accessible. To avoid this problem, configure FatFs <tt>_LFN_UNICODE = 1</tt> and <tt>_MAX_LFN = 255</tt> to support the full feature of LFN specification.</p> | ||||
| <p>There is a problem on reading a directory of exFAT volume. The exFAT does not support short file name. This means no name can be returned on the condition above. If it is the case, "?" is returned into the <tt>fname[]</tt> to indicate that the object is not accessible. To avoid this problem, configure FatFs <tt>_LFN_UNICODE = 1</tt> and <tt>_MAX_LFN = 255</tt> to support the full feature of LFN specification.</p> | ||||
| </div> | ||||
| 
 | ||||
| 
 | ||||
|  | ||||
| @ -43,7 +43,6 @@ FRESULT f_rename ( | ||||
| <a href="rc.html#ok">FR_NO_FILE</a>, | ||||
| <a href="rc.html#np">FR_NO_PATH</a>, | ||||
| <a href="rc.html#in">FR_INVALID_NAME</a>, | ||||
| <a href="rc.html#de">FR_DENIED</a>, | ||||
| <a href="rc.html#ex">FR_EXIST</a>, | ||||
| <a href="rc.html#wp">FR_WRITE_PROTECTED</a>, | ||||
| <a href="rc.html#id">FR_INVALID_DRIVE</a>, | ||||
|  | ||||
| @ -13,7 +13,7 @@ | ||||
| 
 | ||||
| <div class="para"> | ||||
| <h2>DIR</h2> | ||||
| <p>The <tt>DIR</tt> structure is used for the work area to read a directory by <tt>f_oepndir</tt>, <tt>f_readdir</tt>, <tt>f_findfirst</tt> and <tt>f_findnext</tt> function. Application program must not modify any member in this structure, or any data on the FAT volume can be collapsed.</p> | ||||
| <p>The <tt>DIR</tt> structure is used for the work area to read a directory by <tt>f_oepndir</tt>, <tt>f_readdir</tt>, <tt>f_findfirst</tt> and <tt>f_findnext</tt> function. Application program must not modify any member in this structure, or any file on the volume can be collapsed.</p> | ||||
| <pre> | ||||
| <span class="k">typedef</span> <span class="k">struct</span> { | ||||
|     _FDID   obj;        <span class="c">/* Owner file sytem object and object identifier */</span> | ||||
|  | ||||
| @ -13,7 +13,7 @@ | ||||
| 
 | ||||
| <div class="para"> | ||||
| <h2>FATFS</h2> | ||||
| <p>The <tt>FATFS</tt> structure (file system object) holds dynamic work area of individual logical drives. It is given by application program and registerd/unregisterd to the FatFs module with <tt>f_mount</tt> function. Initialization is done on first API call after <tt>f_mount</tt> function or media change. Application program must not modify any member in this structure, or any data on the FAT volume can be collapsed.</p> | ||||
| <p>The <tt>FATFS</tt> structure (file system object) holds dynamic work area of individual logical drives. It is given by application program and registerd/unregisterd to the FatFs module with <tt>f_mount</tt> function. Initialization of the structure is done by volume mount process whenever necessary. Application program must not modify any member in this structure, or the FAT volume can be collapsed.</p> | ||||
| <pre> | ||||
| <span class="k">typedef</span> <span class="k">struct</span> { | ||||
|     BYTE    fs_type;      <span class="c">/* File system type (0, FS_FAT12, FS_FAT16, FS_FAT32 or FS_EXFAT) */</span> | ||||
|  | ||||
| @ -13,7 +13,7 @@ | ||||
| 
 | ||||
| <div class="para"> | ||||
| <h2>FILINFO</h2> | ||||
| <p>The <tt>FILINFO</tt> structure holds information about the object returned by <tt>f_readdir</tt>, <tt>f_findfirst</tt>, <tt>f_findnext</tt> and <tt>f_stat</tt> function.</p> | ||||
| <p>The <tt>FILINFO</tt> structure holds information about the object returned by <tt>f_readdir</tt>, <tt>f_findfirst</tt>, <tt>f_findnext</tt> and <tt>f_stat</tt> function. Be careful in the size of structure when LFN is enabled.</p> | ||||
| <pre> | ||||
| <span class="k">typedef struct</span> { | ||||
|     FSIZE_t fsize;               <span class="c">/* File size */</span> | ||||
|  | ||||
| @ -40,7 +40,7 @@ FRESULT f_unlink ( | ||||
| <a href="rc.html#ok">FR_NO_FILE</a>, | ||||
| <a href="rc.html#np">FR_NO_PATH</a>, | ||||
| <a href="rc.html#in">FR_INVALID_NAME</a>, | ||||
| <a href="rc.html#de">FR_DENIED</a>, | ||||
| <a href="rc.html#dn">FR_DENIED</a>, | ||||
| <a href="rc.html#ex">FR_EXIST</a>, | ||||
| <a href="rc.html#wp">FR_WRITE_PROTECTED</a>, | ||||
| <a href="rc.html#id">FR_INVALID_DRIVE</a>, | ||||
|  | ||||
| @ -45,6 +45,7 @@ FRESULT f_write ( | ||||
| <a href="rc.html#ok">FR_OK</a>, | ||||
| <a href="rc.html#de">FR_DISK_ERR</a>, | ||||
| <a href="rc.html#ie">FR_INT_ERR</a>, | ||||
| <a href="rc.html#dn">FR_DENIED</a>, | ||||
| <a href="rc.html#io">FR_INVALID_OBJECT</a>, | ||||
| <a href="rc.html#tm">FR_TIMEOUT</a> | ||||
| </p> | ||||
|  | ||||
| @ -64,7 +64,7 @@ FatFsモジュールはANSI C(C89)準拠で記述されているので、普通 | ||||
| <div class="para doc" id="limits"> | ||||
| <h3>限界値</h3> | ||||
| <ul> | ||||
| <li>ファイルシステム: FAT12, FAT16, FAT32(r0.0) および exFAT(r1.0)。</li> | ||||
| <li>ファイルシステム: FAT, FAT32(r0.0) および exFAT(r1.0)。</li> | ||||
| <li>同時オープン ファイル数: 無制限。(利用可能メモリによる)</li> | ||||
| <li>同時マウント ボリューム数: 最大 10。</li> | ||||
| <li>ファイル サイズ: 最大 4GiB - 1 (FATボリューム) および、事実上無制限(exFATボリューム)。</li> | ||||
| @ -144,7 +144,7 @@ And any other options are left not changed from default setting. | ||||
| <div class="para doc" id="lfn"> | ||||
| <h3>長いファイル名</h3> | ||||
| <p>FatFsモジュールは、長いファイル名(LFN)をサポートします。ファイルに付けられた2つの異なる名前(短いファル名と長いファイル名)は、<tt>f_readdir</tt>関数を除くファイル操作関数において透過です。デフォルト構成では、LFN機能はOFFになっています。LFN機能を有効にするには、<tt><a href="config.html#use_lfn">_USE_LFN</a></tt>を1,2または3に設定し、<tt>option/unicode.c</tt>をプロジェクトに追加します。LFN機能は、加えてある程度のワーク エリア(LFN操作バッファ)を必要とします。バッファ長は使用できるメモリに応じて<tt><a href="config.html#max_lfn">_MAX_LFN</a></tt>で構成されることができます。LFNの長さは最大255文字に達するので、LFN完全対応のためには<tt>_MAX_LFN</tt>は255に設定されるべきです。与えられたファイル名に対してバッファ長が不足した場合、ファイル関数は<tt>FR_INVALID_NAME</tt>で失敗します。</p> | ||||
| <p>ファイル関数に再入を行う条件の下でLFN機能を使用する場合は、<tt>_USE_LFN</tt>は2または3に設定されなければなりません。この場合、ファイル関数はワーク エリアを動的に確保(スタックまたはヒープ)します。ワーク エリアのサイズは、<tt>(_MAX_LFN + 1) * 2</tt>バイト(exFAT利用時はさらに+608バイト)になるので、スタック等のサイズはそれを考慮した十分な余裕がなければなりません。</p> | ||||
| <p>ファイル関数に再入を行う条件の下でLFN機能を使用する場合は、<tt>_USE_LFN</tt>は2または3に設定されなければなりません。この場合、ファイル関数はワーク エリアを動的に確保(スタックまたはヒープ)します。ワーク エリアのサイズは、<tt>(_MAX_LFN + 1) * 2</tt>バイト(exFAT利用時は加えて<tt>((_MAX_LFN + 44) / 15 * 32</tt>バイト)になるので、これらのメモリ消費量に注意を払う必要があります。</p> | ||||
| <table class="lst2 rset"> | ||||
| <caption>LFN構成 at CM3</caption> | ||||
| <tr><th><tt>_CODE_PAGE</tt></th><th>追加コード</th></tr> | ||||
| @ -165,10 +165,9 @@ And any other options are left not changed from default setting. | ||||
| 
 | ||||
| <div class="para doc" id="exfat"> | ||||
| <h3>exFATファイルシステム</h3> | ||||
| <p>exFAT(Microsoft's Extended File Allocation Table)ファイルシステムは、既に組み込みシステムや情報家電で広く使われているFATファイルシステムを置き換える目的で開発されました。exFATは、64GiB以上のSDメモリ カードで標準ファイルシステムに採用されるなど、FATに並びリムーバブル メディアの標準ファイルシステムの一つとなりつつあります。</p> | ||||
| <p>exFATボリュームでは、FATボリュームで制約となっていた4GiB以上のサイズのファイルを扱え、ファイルシステムのオーバーヘッド(特にファイル アロケーション ディレイ)も大幅に低減され、書き込みスループットがFATより向上しています。しかし、現リビジョンのFatFsでは、実装上の理由から不連続ファイルへのサイズ拡大を伴う書き込み時のとき、スループットがFATより低下します。<tt>f_expand</tt>関数による連続領域の割り当て機能は、この問題の回避に有効かもしれません。</p> | ||||
| <p>exFATはマイクロソフト社が開発したものなので、マイクロソフト社はexFATについていくつかの特許を保有しています。FatFsのexFAT機能は、それの US. Pat. App. Pub. No. 2009/0164440 A1 に基づいた実装です。このため、商用製品でexFAT機能を利用する場合、製品の最終仕向地によってはライセンスが必要になります。最近のFATドライバの多くはexFAT機能を含んでいるため、それらの使用に当たってライセンスが必要になりますが、FatFsは構成オプションでexFAT機能を任意にON/OFFできるため、無効にしてライセンス問題を回避することもできます。</p> | ||||
| <p><em>exFATを有効にすると、FatFsモジュールのC89互換は失われます(64ビット整数型が必要なため)。</em></p> | ||||
| <p>exFAT(Microsoft's Extended File Allocation Table)ファイルシステムは、既に組み込みシステムや情報家電で広く使われているFATファイルシステムを置き換える目的で開発されました。exFATは、64GiB以上のSDメモリ カードで標準ファイルシステムに採用されるなど、FATに並びリムーバブル メディアの標準ファイルシステムの一つとなっています。exFATボリュームでは、FATボリュームで制約となっていた4GiB以上のサイズのファイルを扱え、ファイルシステムのオーバーヘッド(特にファイル アロケーション ディレイ)も大幅に低減され、書き込みスループットがFATより向上しています。</p> | ||||
| <p>exFATはマイクロソフト社が開発したものなので、マイクロソフト社はexFATについていくつかの特許を保有しています。FatFsのexFAT機能は、それの<cite>US. Pat. App. Pub. No. 2009/0164440 A1</cite>に基づいた実装です。このため、商用製品でexFAT機能を利用する場合、製品の最終仕向地によってはライセンスが必要になります。最近のFATドライバの多くはexFAT機能を含んでいるため、それらの使用に当たってライセンスが必要になりますが、FatFsは構成オプションでexFAT機能を任意にON/OFFできるため、無効にしてライセンス問題を回避することもできます。</p> | ||||
| <p><em>exFATを有効にすると、FatFsモジュールのANSI C(C89)互換は失われます(64ビット整数型が必要なため)。</em></p> | ||||
| </div> | ||||
| 
 | ||||
| <div class="para doc" id="reentrant"> | ||||
| @ -257,10 +256,10 @@ And any other options are left not changed from default setting. | ||||
| <p>FatFsは、作者(ChaN)の個人プロジェクトとして開発されています。現在までのリビジョンにおいてコントリビューターはいないため、作者以外の書いたソース コードは含まれません。ソース ファイルにライセンス条件が記述されているので、利用の際はそれに従うこと。原文は英語ですが、参考までに以下に日本語訳を示しておきます。</p> | ||||
| <pre> | ||||
| /*----------------------------------------------------------------------------/ | ||||
| /  FatFs - Generic FAT file system module  R0.12a                             / | ||||
| /  FatFs - Generic FAT file system module  Rx.xx                              / | ||||
| /-----------------------------------------------------------------------------/ | ||||
| / | ||||
| / Copyright (C) 2016, ChaN, all right reserved. | ||||
| / Copyright (C) 20xx, ChaN, all right reserved. | ||||
| / | ||||
| / FatFsモジュールはオープンソースソフトウェアです。FatFsの再配布および使用は、 | ||||
| / ソースコードかバイナリ形式か、また変更の有無にかかわらず、次の条件が満たされ | ||||
|  | ||||
| @ -13,7 +13,7 @@ | ||||
| 
 | ||||
| <div class="para func"> | ||||
| <h2>disk_initialize</h2> | ||||
| <p>ストレージ デバイスを初期化します。</p> | ||||
| <p>ストレージ デバイスの初期化の際に呼ばれます。</p> | ||||
| <pre> | ||||
| DSTATUS disk_initialize ( | ||||
|   BYTE <span class="arg">pdrv</span>      <span class="c">/* [IN] 物理ドライブ番号 */</span> | ||||
|  | ||||
| @ -13,7 +13,7 @@ | ||||
| 
 | ||||
| <div class="para func"> | ||||
| <h2>disk_ioctl</h2> | ||||
| <p>一般的なデータ読み書き以外のストレージ デバイス自体に対する様々な制御を行います。</p> | ||||
| <p>一般的なデータ読み書き以外のストレージ デバイス自体に対する様々な制御を行うときに呼ばれます。</p> | ||||
| <pre> | ||||
| DRESULT disk_ioctl ( | ||||
|   BYTE <span class="arg">pdrv</span>,    <span class="c">/* [IN] 物理ドライブ番号 */</span> | ||||
|  | ||||
| @ -13,7 +13,7 @@ | ||||
| 
 | ||||
| <div class="para func"> | ||||
| <h2>disk_read</h2> | ||||
| <p>ストレージ デバイスからデータを読み出します。</p> | ||||
| <p>ストレージ デバイスからデータを読み出すときに呼ばれます。</p> | ||||
| <pre> | ||||
| DRESULT disk_read ( | ||||
|   BYTE <span class="arg">pdrv</span>,     <span class="c">/* [IN] 物理ドライブ番号 */</span> | ||||
|  | ||||
| @ -13,7 +13,7 @@ | ||||
| 
 | ||||
| <div class="para func"> | ||||
| <h2>disk_status</h2> | ||||
| <p>ストレージ デバイスの状態を取得します。</p> | ||||
| <p>ストレージ デバイスの状態を取得するために呼ばれます。</p> | ||||
| <pre> | ||||
| DSTATUS disk_status ( | ||||
|   BYTE <span class="arg">pdrv</span>           <span class="c">/* [IN] 物理ドライブ番号 */</span> | ||||
|  | ||||
| @ -13,7 +13,7 @@ | ||||
| 
 | ||||
| <div class="para func"> | ||||
| <h2>disk_write</h2> | ||||
| <p>ストレージ デバイスにデータを書き込みます。</p> | ||||
| <p>ストレージ デバイスにデータを書き込むときに呼ばれます。</p> | ||||
| <pre> | ||||
| DRESULT disk_write ( | ||||
|   BYTE <span class="arg">pdrv</span>,        <span class="c">/* [IN] 物理ドライブ番号 */</span> | ||||
|  | ||||
| @ -30,7 +30,7 @@ FRESULT f_expand ( | ||||
| <dt>fp</dt> | ||||
| <dd>対象となるファイル オブジェクト構造体へのポインタを指定します。</dd> | ||||
| <dt>fsz</dt> | ||||
| <dd>ファイルに割り当てるバイト単位のサイズ。データ型<tt>FSIZE_t</tt>は、<tt>DWORD</tt>(32-bit)または<tt>QWORD</tt>(64-bit)のエリアスで、exFATサポートの有無により切り替わります。</dd> | ||||
| <dd>ファイルに割り当てるバイト単位のサイズ。データ型<tt>FSIZE_t</tt>は、<tt>DWORD</tt>(32ビット)または<tt>QWORD</tt>(64ビット)のエリアスで、exFATサポートの有無により切り替わります。</dd> | ||||
| <dt>opt</dt> | ||||
| <dd>実際に割り当てを行うかどうか指定するフラグ。</dd> | ||||
| </dl> | ||||
| @ -43,8 +43,8 @@ FRESULT f_expand ( | ||||
| <a href="rc.html#ok">FR_OK</a>, | ||||
| <a href="rc.html#de">FR_DISK_ERR</a>, | ||||
| <a href="rc.html#ie">FR_INT_ERR</a>, | ||||
| <a href="rc.html#io">FR_INVALID_OBJECT</a>, | ||||
| <a href="rc.html#dn">FR_DENIED</a>, | ||||
| <a href="rc.html#io">FR_INVALID_OBJECT</a>, | ||||
| <a href="rc.html#tm">FR_TIMEOUT</a> | ||||
| </p> | ||||
| </div> | ||||
| @ -79,15 +79,15 @@ FRESULT f_expand ( | ||||
|     res = f_open(fp = malloc(sizeof (FIL)), "file.dat", FA_WRITE|FA_CREATE_ALWAYS); | ||||
|     if (res) { <span class="c">/* ファイルが開かれたかチェック */</span> | ||||
|         free(fp); | ||||
|         ... | ||||
|         die("Failed to open the file."); | ||||
|     } | ||||
| 
 | ||||
|     <span class="c">/* 100 MiB の連続領域を割り当てる */</span> | ||||
|     res = f_expand(fp, 104857600, 1); | ||||
|     if (res) { <span class="c">/* 割り当てられたかチェック */</span> | ||||
|         ... | ||||
|         f_close(fp); | ||||
|         free(fp); | ||||
|         ... | ||||
|         die("Failed to allocate contiguous area."); | ||||
|     } | ||||
|     <span class="c">/* 連続ファイル作成成功 fp でアクセス可能 */</span> | ||||
| 
 | ||||
|  | ||||
| @ -13,7 +13,7 @@ | ||||
| 
 | ||||
| <div class="para func"> | ||||
| <h2>get_fattime</h2> | ||||
| <p>現在時刻を取得します。</p> | ||||
| <p>現在時刻を取得する際に呼ばれます。</p> | ||||
| <pre> | ||||
| DWORD get_fattime (void); | ||||
| </pre> | ||||
|  | ||||
| @ -62,22 +62,21 @@ FRESULT f_fdisk ( | ||||
|     <span class="c">/* ユーザ定義のボリューム管理テーブル (_MULTI_PARTITION == 1 のとき必要) */</span> | ||||
| 
 | ||||
|     PARTITION VolToPart[] = { | ||||
|         {0, 1},    <span class="c">/* 論理ドライブ 0 ==> 物理ドライブ 0, 第1区画 */</span> | ||||
|         {0, 2},    <span class="c">/* 論理ドライブ 1 ==> 物理ドライブ 0, 第2区画 */</span> | ||||
|         {1, 0}     <span class="c">/* 論理ドライブ 2 ==> 物理ドライブ 1, 自動検出 */</span> | ||||
|         {0, 1},    <span class="c">/* "0:" ==> 物理ドライブ 0, 第1区画 */</span> | ||||
|         {0, 2},    <span class="c">/* "1:" ==> 物理ドライブ 0, 第2区画 */</span> | ||||
|         {1, 0}     <span class="c">/* "2:" ==> 物理ドライブ 1, 自動検出 */</span> | ||||
|     }; | ||||
| </pre> | ||||
| <pre> | ||||
|     <span class="c">/* 新しい物理ドライブ(0)の初期化 */</span> | ||||
| 
 | ||||
|     FATFS fs; | ||||
|     DWORD plist[] = {50, 50, 0, 0};  <span class="c">/* 第1区画,第2区画それぞれに50%ずつ割り当て */</span> | ||||
|     BYTE work[_MAX_SS]; | ||||
| 
 | ||||
|     f_fdisk(0, plist, work);                    <span class="c">/* 物理ドライブ 0 の分割 */</span> | ||||
|     f_fdisk(0, plist, work);                   <span class="c">/* 物理ドライブ 0 の分割 */</span> | ||||
| 
 | ||||
|     f_mkfs("0:", FMT_ANY, work, sizeof work);   <span class="c">/* 論理ドライブ 0: のフォーマット */</span> | ||||
|     f_mkfs("1:", FMT_ANY, work, sizeof work);   <span class="c">/* 論理ドライブ 1: のフォーマット */</span> | ||||
|     f_mkfs("0:", FM_ANY, work, sizeof work);   <span class="c">/* 論理ドライブ 0: のフォーマット */</span> | ||||
|     f_mkfs("1:", FM_ANY, work, sizeof work);   <span class="c">/* 論理ドライブ 1: のフォーマット */</span> | ||||
| 
 | ||||
| </pre> | ||||
| </div> | ||||
|  | ||||
| @ -80,9 +80,9 @@ FRESULT f_findfirst ( | ||||
| <div class="para use"> | ||||
| <h4>使用例</h4> | ||||
| <pre> | ||||
| <span class="c">/* ディレクトリ内のオブジェクトの検索と表示 */</span> | ||||
| <span class="c">/* ディレクトリ内のjpegファイルの検索 */</span> | ||||
| 
 | ||||
| void find_image (void) | ||||
| void find_image_file (void) | ||||
| { | ||||
|     FRESULT fr;     <span class="c">/* API戻り値 */</span> | ||||
|     DIR dj;         <span class="c">/* ディレクトリ オブジェクト */</span> | ||||
| @ -94,6 +94,7 @@ void find_image (void) | ||||
|         printf("%s\n", fno.fname);                <span class="c">/* 見つけた項目の名前を表示 */</span> | ||||
|         fr = f_findnext(&dj, &fno);               <span class="c">/* 次を検索 */</span> | ||||
|     } | ||||
| 
 | ||||
|     f_closedir(&dj); | ||||
| } | ||||
| </pre> | ||||
|  | ||||
| @ -45,7 +45,7 @@ FRESULT f_forward ( | ||||
| <a href="rc.html#ok">FR_OK</a>, | ||||
| <a href="rc.html#de">FR_DISK_ERR</a>, | ||||
| <a href="rc.html#ie">FR_INT_ERR</a>, | ||||
| <a href="rc.html#de">FR_DENIED</a>, | ||||
| <a href="rc.html#dn">FR_DENIED</a>, | ||||
| <a href="rc.html#io">FR_INVALID_OBJECT</a>, | ||||
| <a href="rc.html#tm">FR_TIMEOUT</a> | ||||
| </p> | ||||
|  | ||||
| @ -28,7 +28,7 @@ FRESULT f_lseek ( | ||||
| <dt>fp</dt> | ||||
| <dd>対象となるファイル オブジェクト構造体へのポインタを指定します。</dd> | ||||
| <dt>ofs</dt> | ||||
| <dd>移動先のオフセット(リード/ライト ポインタ)値。ファイル先頭からのオフセットをバイト単位で指定します。データ型<tt>FSIZE_t</tt>は、<tt>DWORD</tt>(32-bit)または<tt>QWORD</tt>(64-bit)のエリアスで、exFATサポートの有無により切り替わります。</dd> | ||||
| <dd>移動先のオフセット(リード/ライト ポインタ)値。ファイル先頭からのオフセットをバイト単位で指定します。データ型<tt>FSIZE_t</tt>は、<tt>DWORD</tt>(32ビット)または<tt>QWORD</tt>(64ビット)のエリアスで、exFATサポートの有無により切り替わります。</dd> | ||||
| </dl> | ||||
| </div> | ||||
| 
 | ||||
| @ -48,7 +48,8 @@ FRESULT f_lseek ( | ||||
| 
 | ||||
| <div class="para desc"> | ||||
| <h4>解説</h4> | ||||
| <p>ファイルのリード/ライト ポインタ(次に読み出し・書き込みされるバイトのオフセット)を移動します。オフセットの原点はファイル先頭です。書き込みモードでファイル サイズより大きな値を指定すると、そこまでファイル サイズが拡張され、拡張された部分のデータは未定義となります。データを遅延無く高速に書き込みたいときは、予めこの関数で必要なサイズまでファイル サイズを拡張しておくと良いでしょう。ファイルに連続したデータ領域を割り当てる必要があるときは、<tt>f_expand</tt>関数を使用してください。<tt>f_lseek</tt>関数が正常終了したあとは、リード/ライト ポインタが正しく移動したかチェックするべきです。リード/ライト ポインタが指定より小さいときは、次の原因が考えられます。</p> | ||||
| <p>各ファイル オブジェクトが持つリード/ライト ポインタは、次に読み出し・書き込みされるバイトのオフセットを保持し、読み書きされただけ進みます。この関数は、ファイルへの読み書きを行わずにリード/ライト ポインタのみ移動します。</p> | ||||
| <p>書き込みモードでファイル サイズより大きな値を指定すると、そこまでファイル サイズが拡張されますが、拡張された部分のデータは未定義となります。データを遅延無く高速に書き込みたいときは、予めこの関数で必要なサイズまでファイル サイズを拡張しておくと良いでしょう。ファイルに連続したデータ領域を割り当てる必要があるときは、<tt>f_expand</tt>関数を使用してください。<tt>f_lseek</tt>関数が正常終了したあとは、リード/ライト ポインタが正しく移動したかチェックするべきです。リード/ライト ポインタが指定より小さいときは、次の原因が考えられます。</p> | ||||
| <ul> | ||||
| <li>非書き込みモードまたは高速シーク モードのため、ファイル サイズでクリップされた。</li> | ||||
| <li>ファイル拡張中にディスクが満杯になった。</li> | ||||
|  | ||||
| @ -39,7 +39,7 @@ FRESULT f_mkdir ( | ||||
| <a href="rc.html#nr">FR_NOT_READY</a>, | ||||
| <a href="rc.html#np">FR_NO_PATH</a>, | ||||
| <a href="rc.html#in">FR_INVALID_NAME</a>, | ||||
| <a href="rc.html#de">FR_DENIED</a>, | ||||
| <a href="rc.html#dn">FR_DENIED</a>, | ||||
| <a href="rc.html#ex">FR_EXIST</a>, | ||||
| <a href="rc.html#wp">FR_WRITE_PROTECTED</a>, | ||||
| <a href="rc.html#id">FR_INVALID_DRIVE</a>, | ||||
|  | ||||
| @ -57,7 +57,7 @@ FRESULT f_open ( | ||||
| <a href="rc.html#ok">FR_NO_FILE</a>, | ||||
| <a href="rc.html#np">FR_NO_PATH</a>, | ||||
| <a href="rc.html#in">FR_INVALID_NAME</a>, | ||||
| <a href="rc.html#de">FR_DENIED</a>, | ||||
| <a href="rc.html#dn">FR_DENIED</a>, | ||||
| <a href="rc.html#ex">FR_EXIST</a>, | ||||
| <a href="rc.html#io">FR_INVALID_OBJECT</a>, | ||||
| <a href="rc.html#wp">FR_WRITE_PROTECTED</a>, | ||||
|  | ||||
| @ -27,7 +27,14 @@ | ||||
| </ul> | ||||
| ※開かれたファイルの操作においてこのエラーが発生すると、そのファイル オブジェクトはアボート状態となり、クローズ以外の操作ができなくなります。</dd> | ||||
| <dt id="nr">FR_NOT_READY</dt> | ||||
| <dd>下位レイヤ(<tt>disk_initialize</tt>関数)の失敗。つまり、物理ドライブが動作可能な状態にない。</dd> | ||||
| <dd>下位レイヤ(<tt>disk_initialize</tt>関数)の失敗。次のような理由が考えられる。 | ||||
| <ul> | ||||
| <li>ドライブにメディアがセットされていない。</li> | ||||
| <li>下位レイヤの実装が不完全。</li> | ||||
| <li>間違ったハードウェア構成。</li> | ||||
| <li>ストレージ デバイスの故障。</li> | ||||
| </ul> | ||||
| </dd> | ||||
| <dt id="nf">FR_NO_FILE</dt> | ||||
| <dd>指定されたファイルが見つからなかった。</dd> | ||||
| <dt id="np">FR_NO_PATH</dt> | ||||
| @ -51,9 +58,9 @@ | ||||
| <dt id="io">FR_INVALID_OBJECT</dt> | ||||
| <dd>指定されたファイル オブジェクトやディレクトリ オブジェクトが無効、またはヌル ポインタが渡された。無効になる理由は次のことが考えられます。 | ||||
| <ul> | ||||
| <li>オープンされていない、既に閉じられた、破損しているなど。</li> | ||||
| <li>オープンされていない、既に閉じられている、破損しているなど。</li> | ||||
| <li>そのボリュームでマウント動作があり、ボリューム上の開かれたオブジェクトが全て無効化された。</li> | ||||
| <li>物理ドライブがメディアの取り外しで動作不可能になっている。</li> | ||||
| <li>物理ドライブがメディアの取り外し等で動作不可能になっている。</li> | ||||
| </ul> | ||||
| </dd> | ||||
| <dt id="wp">FR_WRITE_PROTECTED</dt> | ||||
|  | ||||
| @ -45,7 +45,7 @@ FRESULT f_read ( | ||||
| <a href="rc.html#ok">FR_OK</a>, | ||||
| <a href="rc.html#de">FR_DISK_ERR</a>, | ||||
| <a href="rc.html#ie">FR_INT_ERR</a>, | ||||
| <a href="rc.html#de">FR_DENIED</a>, | ||||
| <a href="rc.html#dn">FR_DENIED</a>, | ||||
| <a href="rc.html#io">FR_INVALID_OBJECT</a>, | ||||
| <a href="rc.html#tm">FR_TIMEOUT</a> | ||||
| </p> | ||||
|  | ||||
| @ -13,7 +13,7 @@ | ||||
| 
 | ||||
| <div class="para"> | ||||
| <h2>FATFS</h2> | ||||
| <p><tt>FATFS</tt>構造体(ファイル システム オブジェクト)は、個々の論理ドライブのダイナミック ワーク エリアを保持し、<tt>f_mount</tt>関数でFatFsモジュールに登録されます。初期化が行われるタイミングは、<tt>f_mount</tt>関数(強制マウント指定)の実行またはメディア交換の後の最初のファイル アクセスの時です。アプリケーションは、この構造体のメンバを書き換えてはなりません。</p> | ||||
| <p><tt>FATFS</tt>構造体(ファイル システム オブジェクト)は、個々の論理ドライブのダイナミック ワーク エリアを保持し、<tt>f_mount</tt>関数でFatFsモジュールに登録されます。構造体の作成は、随時ボリューム マウント プロセスにより行われます。アプリケーションは、この構造体のメンバを書き換えてはなりません。</p> | ||||
| 
 | ||||
| <pre> | ||||
| <span class="k">typedef</span> <span class="k">struct</span> { | ||||
|  | ||||
| @ -13,7 +13,7 @@ | ||||
| 
 | ||||
| <div class="para"> | ||||
| <h2>FILINFO</h2> | ||||
| <p><tt>FILINFO</tt>構造体は、<tt>f_stat/f_readdir/f_findfirst/f_findnext</tt>関数で返されるオブジェクトに関する情報を保持します。</p> | ||||
| <p><tt>FILINFO</tt>構造体は、<tt>f_stat/f_readdir/f_findfirst/f_findnext</tt>関数で返されるオブジェクトに関する情報を保持します。LFN使用時はサイズが大きく増加するので注意が必要です。</p> | ||||
| <pre> | ||||
| <span class="k">typedef</span> <span class="k">struct</span> { | ||||
|     FSIZE_t fsize;               <span class="c">/* ファイル サイズ */</span> | ||||
|  | ||||
| @ -36,7 +36,7 @@ FRESULT f_truncate ( | ||||
| <a href="rc.html#ok">FR_OK</a>, | ||||
| <a href="rc.html#de">FR_DISK_ERR</a>, | ||||
| <a href="rc.html#ie">FR_INT_ERR</a>, | ||||
| <a href="rc.html#de">FR_DENIED</a>, | ||||
| <a href="rc.html#dn">FR_DENIED</a>, | ||||
| <a href="rc.html#io">FR_INVALID_OBJECT</a>, | ||||
| <a href="rc.html#tm">FR_TIMEOUT</a> | ||||
| </p> | ||||
|  | ||||
| @ -40,7 +40,7 @@ FRESULT f_unlink ( | ||||
| <a href="rc.html#ok">FR_NO_FILE</a>, | ||||
| <a href="rc.html#np">FR_NO_PATH</a>, | ||||
| <a href="rc.html#in">FR_INVALID_NAME</a>, | ||||
| <a href="rc.html#de">FR_DENIED</a>, | ||||
| <a href="rc.html#dn">FR_DENIED</a>, | ||||
| <a href="rc.html#wp">FR_WRITE_PROTECTED</a>, | ||||
| <a href="rc.html#id">FR_INVALID_DRIVE</a>, | ||||
| <a href="rc.html#ne">FR_NOT_ENABLED</a>, | ||||
|  | ||||
| @ -45,7 +45,7 @@ FRESULT f_write ( | ||||
| <a href="rc.html#ok">FR_OK</a>, | ||||
| <a href="rc.html#de">FR_DISK_ERR</a>, | ||||
| <a href="rc.html#ie">FR_INT_ERR</a>, | ||||
| <a href="rc.html#de">FR_DENIED</a>, | ||||
| <a href="rc.html#dn">FR_DENIED</a>, | ||||
| <a href="rc.html#io">FR_INVALID_OBJECT</a>, | ||||
| <a href="rc.html#tm">FR_TIMEOUT</a> | ||||
| </p> | ||||
|  | ||||
| @ -1,5 +1,5 @@ | ||||
| /*----------------------------------------------------------------------/
 | ||||
| / Low level disk I/O module function checker | ||||
| / Low level disk I/O module function checker                            / | ||||
| /-----------------------------------------------------------------------/ | ||||
| / WARNING: The data on the target drive will be lost! | ||||
| */ | ||||
| @ -41,8 +41,8 @@ int test_diskio ( | ||||
| ) | ||||
| { | ||||
|     UINT n, cc, ns; | ||||
|     DWORD sz_drv, lba, lba2, pns = 1; | ||||
|     WORD sz_sect, sz_eblk; | ||||
|     DWORD sz_drv, lba, lba2, sz_eblk, pns = 1; | ||||
|     WORD sz_sect; | ||||
|     BYTE *pbuff = (BYTE*)buff; | ||||
|     DSTATUS ds; | ||||
|     DRESULT dr; | ||||
| @ -113,7 +113,7 @@ int test_diskio ( | ||||
|             printf(" - failed.\n"); | ||||
|         } | ||||
|         if (dr == RES_OK || sz_eblk >= 2) { | ||||
|             printf(" Size of the erase block is %u sectors.\n", sz_eblk); | ||||
|             printf(" Size of the erase block is %lu sectors.\n", sz_eblk); | ||||
|         } else { | ||||
|             printf(" Size of the erase block is unknown.\n"); | ||||
|         } | ||||
| @ -196,7 +196,7 @@ int test_diskio ( | ||||
|         pns++; | ||||
| 
 | ||||
|         /* Single sector write test (misaligned memory address) */ | ||||
|         printf("**** Single sector write test 2 ****\n"); | ||||
|         printf("**** Single sector write test (misaligned address) ****\n"); | ||||
|         lba = 5; | ||||
|         for (n = 0, pn(pns); n < sz_sect; n++) pbuff[n+3] = (BYTE)pn(0); | ||||
|         printf(" disk_write(%u, 0x%X, %lu, 1)", pdrv, (UINT)(pbuff+3), lba); | ||||
|  | ||||
							
								
								
									
										
											BIN
										
									
								
								doc/res/fd.mp4
									
									
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								doc/res/fd.mp4
									
									
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							| Before Width: | Height: | Size: 2.3 KiB | 
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								doc/res/mkfs.xls
									
									
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								doc/res/mkfs.xls
									
									
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							| @ -1,5 +1,11 @@ | ||||
| R0.12c (March 04, 2017) | ||||
|   Improved write throughput at the fragmented file on the exFAT volume. | ||||
|   Made memory usage for exFAT be able to be reduced as decreasing _MAX_LFN. | ||||
|   Fixed successive f_getfree() can return wrong count on the FAT12/16 volume. (appeared at R0.12) | ||||
|   Fixed configuration option _VOLUMES cannot be set 10. (appeared at R0.10c) | ||||
| 
 | ||||
| R0.12b (September 4, 2016) | ||||
|   Improved f_rename() to be able to rename objects with the same name but case. | ||||
|   Make f_rename() be able to rename objects with the same name but case. | ||||
|   Fixed an error in the case conversion teble of code page 866. (ff.c) | ||||
|   Fixed writing data is truncated at the file offset 4GiB on the exFAT volume. (appeared at R0.12) | ||||
|   Fixed creating a file in the root directory of exFAT volume can fail. (appeared at R0.12) | ||||
|  | ||||
| @ -212,7 +212,7 @@ R0.10a (January 15, 2014) | ||||
| R0.10b (May 19, 2014) | ||||
| 
 | ||||
|   Fixed a hard error in the disk I/O layer can collapse the directory entry. | ||||
|   Fixed LFN entry is not deleted on delete/rename an object with lossy converted SFN. (appeared at R0.07) | ||||
|   Fixed LFN entry is not deleted when delete/rename an object with lossy converted SFN. (appeared at R0.07) | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| @ -268,7 +268,7 @@ R0.12a (July 10, 2016) | ||||
| 
 | ||||
| R0.12b (September 04, 2016) | ||||
| 
 | ||||
|   Improved f_rename() to be able to rename objects with the same name but case. | ||||
|   Made f_rename() be able to rename objects with the same name but case. | ||||
|   Fixed an error in the case conversion teble of code page 866. (ff.c) | ||||
|   Fixed writing data is truncated at the file offset 4GiB on the exFAT volume. (appeared at R0.12) | ||||
|   Fixed creating a file in the root directory of exFAT volume can fail. (appeared at R0.12) | ||||
| @ -277,3 +277,12 @@ R0.12b (September 04, 2016) | ||||
|   Fixed large file allocation/removing on the exFAT volume collapses allocation bitmap. (appeared at R0.12) | ||||
|   Fixed some internal errors in f_expand() and f_lseek(). (appeared at R0.12) | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| R0.12c (March 04, 2017) | ||||
| 
 | ||||
|   Improved write throughput at the fragmented file on the exFAT volume. | ||||
|   Made memory usage for exFAT be able to be reduced as decreasing _MAX_LFN. | ||||
|   Fixed successive f_getfree() can return wrong count on the FAT12/16 volume. (appeared at R0.12) | ||||
|   Fixed configuration option _VOLUMES cannot be set 10. (appeared at R0.10c) | ||||
| 
 | ||||
|  | ||||
| @ -1,21 +1,21 @@ | ||||
| FatFs Module Source Files R0.12a | ||||
| FatFs Module Source Files R0.12c | ||||
| 
 | ||||
| 
 | ||||
| FILES | ||||
| 
 | ||||
|   00readme.txt This file. | ||||
|   history.txt  Revision history. | ||||
|   ffconf.h     Configuration file for FatFs module. | ||||
|   ff.h         Common include file for FatFs and application module. | ||||
|   ff.c         FatFs module. | ||||
|   diskio.h     Common include file for FatFs and disk I/O module. | ||||
|   diskio.c     An example of glue function to attach existing disk I/O module to FatFs. | ||||
|   integer.h    Integer type definitions for FatFs. | ||||
|   option       Optional external functions. | ||||
|   00readme.txt   This file. | ||||
|   00history.txt  Revision history. | ||||
|   ff.c           FatFs module. | ||||
|   ffconf.h       Configuration file of FatFs module. | ||||
|   ff.h           Common include file for FatFs and application module. | ||||
|   diskio.h       Common include file for FatFs and disk I/O module. | ||||
|   diskio.c       An example of glue function to attach existing disk I/O module to FatFs. | ||||
|   integer.h      Integer type definitions for FatFs. | ||||
|   option         Optional external modules. | ||||
| 
 | ||||
| 
 | ||||
|   Low level disk I/O module is not included in this archive because the FatFs | ||||
|   module is only a generic file system layer and not depend on any specific | ||||
|   storage device. You have to provide a low level disk I/O module that written | ||||
|   to control the target storage device. | ||||
|   module is only a generic file system layer and it does not depend on any specific | ||||
|   storage device. You have to provide a low level disk I/O module written to | ||||
|   control the storage device that attached to the target system. | ||||
| 
 | ||||
|  | ||||
							
								
								
									
										25
									
								
								src/ff.h
									
									
									
									
									
								
							
							
						
						
									
										25
									
								
								src/ff.h
									
									
									
									
									
								
							| @ -1,8 +1,8 @@ | ||||
| /*----------------------------------------------------------------------------/
 | ||||
| /  FatFs - Generic FAT file system module  R0.12b                             / | ||||
| /  FatFs - Generic FAT file system module  R0.12c                             / | ||||
| /-----------------------------------------------------------------------------/ | ||||
| / | ||||
| / Copyright (C) 2016, ChaN, all right reserved. | ||||
| / Copyright (C) 2017, ChaN, all right reserved. | ||||
| / | ||||
| / FatFs module is an open source software. Redistribution and use of FatFs in | ||||
| / source and binary forms, with or without modification, are permitted provided | ||||
| @ -19,7 +19,7 @@ | ||||
| 
 | ||||
| 
 | ||||
| #ifndef _FATFS | ||||
| #define _FATFS	68020	/* Revision ID */ | ||||
| #define _FATFS	68300	/* Revision ID */ | ||||
| 
 | ||||
| #ifdef __cplusplus | ||||
| extern "C" { | ||||
| @ -42,13 +42,6 @@ typedef struct { | ||||
| 	BYTE pt;	/* Partition: 0:Auto detect, 1-4:Forced partition) */ | ||||
| } PARTITION; | ||||
| extern PARTITION VolToPart[];	/* Volume - Partition resolution table */ | ||||
| #define LD2PD(vol) (VolToPart[vol].pd)	/* Get physical drive number */ | ||||
| #define LD2PT(vol) (VolToPart[vol].pt)	/* Get partition index */ | ||||
| 
 | ||||
| #else							/* Single partition configuration */ | ||||
| #define LD2PD(vol) (BYTE)(vol)	/* Each logical drive is bound to the same physical drive number */ | ||||
| #define LD2PT(vol) 0			/* Find first valid partition or in SFD */ | ||||
| 
 | ||||
| #endif | ||||
| 
 | ||||
| 
 | ||||
| @ -140,14 +133,15 @@ typedef struct { | ||||
| 	FATFS*	fs;			/* Pointer to the owner file system object */ | ||||
| 	WORD	id;			/* Owner file system mount ID */ | ||||
| 	BYTE	attr;		/* Object attribute */ | ||||
| 	BYTE	stat;		/* Object chain status (b1-0: =0:not contiguous, =2:contiguous (no data on FAT), =3:got flagmented, b2:sub-directory stretched) */ | ||||
| 	BYTE	stat;		/* Object chain status (b1-0: =0:not contiguous, =2:contiguous (no data on FAT), =3:flagmented in this session, b2:sub-directory stretched) */ | ||||
| 	DWORD	sclust;		/* Object start cluster (0:no cluster or root directory) */ | ||||
| 	FSIZE_t	objsize;	/* Object size (valid when sclust != 0) */ | ||||
| #if _FS_EXFAT | ||||
| 	DWORD	n_cont;		/* Size of coutiguous part, clusters - 1 (valid when stat == 3) */ | ||||
| 	DWORD	n_cont;		/* Size of first fragment, clusters - 1 (valid when stat == 3) */ | ||||
| 	DWORD	n_frag;		/* Size of last fragment needs to be written (valid when not zero) */ | ||||
| 	DWORD	c_scl;		/* Containing directory start cluster (valid when sclust != 0) */ | ||||
| 	DWORD	c_size;		/* b31-b8:Size of containing directory, b7-b0: Chain status (valid when c_scl != 0) */ | ||||
| 	DWORD	c_ofs;		/* Offset in the containing directory (valid when sclust != 0) */ | ||||
| 	DWORD	c_ofs;		/* Offset in the containing directory (valid when sclust != 0 and non-directory object) */ | ||||
| #endif | ||||
| #if _FS_LOCK != 0 | ||||
| 	UINT	lockid;		/* File lock ID origin from 1 (index of file semaphore table Files[]) */ | ||||
| @ -163,7 +157,7 @@ typedef struct { | ||||
| 	BYTE	flag;			/* File status flags */ | ||||
| 	BYTE	err;			/* Abort flag (error code) */ | ||||
| 	FSIZE_t	fptr;			/* File read/write pointer (Zeroed on file open) */ | ||||
| 	DWORD	clust;			/* Current cluster of fpter (invalid when fprt is 0) */ | ||||
| 	DWORD	clust;			/* Current cluster of fpter (invalid when fptr is 0) */ | ||||
| 	DWORD	sect;			/* Sector number appearing in buf[] (0:invalid) */ | ||||
| #if !_FS_READONLY | ||||
| 	DWORD	dir_sect;		/* Sector number containing the directory entry */ | ||||
| @ -185,7 +179,7 @@ typedef struct { | ||||
| 	_FDID	obj;			/* Object identifier */ | ||||
| 	DWORD	dptr;			/* Current read/write offset */ | ||||
| 	DWORD	clust;			/* Current cluster */ | ||||
| 	DWORD	sect;			/* Current sector */ | ||||
| 	DWORD	sect;			/* Current sector (0:Read operation has terminated) */ | ||||
| 	BYTE*	dir;			/* Pointer to the directory item in the win[] */ | ||||
| 	BYTE	fn[12];			/* SFN (in/out) {body[8],ext[3],status[1]} */ | ||||
| #if _USE_LFN != 0 | ||||
| @ -285,6 +279,7 @@ TCHAR* f_gets (TCHAR* buff, int len, FIL* fp);						/* Get a string from the fil | ||||
| #define f_size(fp) ((fp)->obj.objsize) | ||||
| #define f_rewind(fp) f_lseek((fp), 0) | ||||
| #define f_rewinddir(dp) f_readdir((dp), 0) | ||||
| #define f_rmdir(path) f_unlink(path) | ||||
| 
 | ||||
| #ifndef EOF | ||||
| #define EOF (-1) | ||||
|  | ||||
							
								
								
									
										21
									
								
								src/ffconf.h
									
									
									
									
									
								
							
							
						
						
									
										21
									
								
								src/ffconf.h
									
									
									
									
									
								
							| @ -2,7 +2,7 @@ | ||||
| /  FatFs - FAT file system module configuration file | ||||
| /---------------------------------------------------------------------------*/ | ||||
| 
 | ||||
| #define _FFCONF 68020	/* Revision ID */ | ||||
| #define _FFCONF 68300	/* Revision ID */ | ||||
| 
 | ||||
| /*---------------------------------------------------------------------------/
 | ||||
| / Function Configurations | ||||
| @ -73,7 +73,7 @@ | ||||
| /* This option specifies the OEM code page to be used on the target system.
 | ||||
| /  Incorrect setting of the code page can cause a file open failure. | ||||
| / | ||||
| /   1   - ASCII (No extended character. Non-LFN cfg. only) | ||||
| /   1   - ASCII (No support of extended character. Non-LFN cfg. only) | ||||
| /   437 - U.S. | ||||
| /   720 - Arabic | ||||
| /   737 - Greek | ||||
| @ -148,7 +148,7 @@ | ||||
| /---------------------------------------------------------------------------*/ | ||||
| 
 | ||||
| #define _VOLUMES	1 | ||||
| /* Number of volumes (logical drives) to be used. */ | ||||
| /* Number of volumes (logical drives) to be used. (1-10) */ | ||||
| 
 | ||||
| 
 | ||||
| #define _STR_VOLUME_ID	0 | ||||
| @ -172,11 +172,11 @@ | ||||
| #define	_MIN_SS		512 | ||||
| #define	_MAX_SS		512 | ||||
| /* These options configure the range of sector size to be supported. (512, 1024,
 | ||||
| /  2048 or 4096) Always set both 512 for most systems, all type of memory cards and | ||||
| /  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 | ||||
| /  type of optical media. When _MAX_SS is larger than _MIN_SS, FatFs is configured | ||||
| /  to variable sector size and GET_SECTOR_SIZE command must be implemented to the | ||||
| /  disk_ioctl() function. */ | ||||
| /  to variable sector size and GET_SECTOR_SIZE command needs to be implemented to | ||||
| /  the disk_ioctl() function. */ | ||||
| 
 | ||||
| 
 | ||||
| #define	_USE_TRIM	0 | ||||
| @ -204,7 +204,7 @@ | ||||
| 
 | ||||
| #define	_FS_TINY	0 | ||||
| /* This option switches tiny buffer configuration. (0:Normal or 1:Tiny)
 | ||||
| /  At the tiny configuration, size of file object (FIL) is reduced _MAX_SS bytes. | ||||
| /  At the tiny configuration, size of file object (FIL) is shrinked _MAX_SS bytes. | ||||
| /  Instead of private sector buffer eliminated from the file object, common sector | ||||
| /  buffer in the file system object (FATFS) is used for the file data transfer. */ | ||||
| 
 | ||||
| @ -212,7 +212,7 @@ | ||||
| #define _FS_EXFAT	0 | ||||
| /* This option switches support of exFAT file system. (0:Disable or 1:Enable)
 | ||||
| /  When enable exFAT, also LFN needs to be enabled. (_USE_LFN >= 1) | ||||
| /  Note that enabling exFAT discards C89 compatibility. */ | ||||
| /  Note that enabling exFAT discards ANSI C (C89) compatibility. */ | ||||
| 
 | ||||
| 
 | ||||
| #define _FS_NORTC	0 | ||||
| @ -225,7 +225,7 @@ | ||||
| /  defined by _NORTC_MON, _NORTC_MDAY and _NORTC_YEAR in local time. | ||||
| /  To enable timestamp function (_FS_NORTC = 0), get_fattime() function need to be | ||||
| /  added to the project to get current time form real-time clock. _NORTC_MON, | ||||
| /  _NORTC_MDAY and _NORTC_YEAR have no effect.  | ||||
| /  _NORTC_MDAY and _NORTC_YEAR have no effect. | ||||
| /  These options have no effect at read-only configuration (_FS_READONLY = 1). */ | ||||
| 
 | ||||
| 
 | ||||
| @ -258,10 +258,11 @@ | ||||
| / | ||||
| /  The _FS_TIMEOUT defines timeout period in unit of time tick. | ||||
| /  The _SYNC_t defines O/S dependent sync object type. e.g. HANDLE, ID, OS_EVENT*, | ||||
| /  SemaphoreHandle_t and etc.. A header file for O/S definitions needs to be | ||||
| /  SemaphoreHandle_t and etc. A header file for O/S definitions needs to be | ||||
| /  included somewhere in the scope of ff.h. */ | ||||
| 
 | ||||
| /* #include <windows.h>	// O/S definitions  */ | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| /*--- End of configuration options ---*/ | ||||
|  | ||||
| @ -30,7 +30,7 @@ typedef unsigned short	WCHAR; | ||||
| typedef long			LONG; | ||||
| typedef unsigned long	DWORD; | ||||
| 
 | ||||
| /* This type MUST be 64-bit (Remove this for C89 compatibility) */ | ||||
| /* This type MUST be 64-bit (Remove this for ANSI C (C89) compatibility) */ | ||||
| typedef unsigned long long QWORD; | ||||
| 
 | ||||
| #endif | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user