Move 3rd Party source to a new directory.

Rationalise Fatfs code and fix a couple of configuration issues.
ugfx_release_2.6
inmarket 2014-08-13 15:48:16 +10:00
parent 10902154ae
commit efa13a879d
142 changed files with 45379 additions and 44913 deletions

View File

@ -5,8 +5,6 @@
<meta http-equiv="Content-Style-Type" content="text/css">
<meta http-equiv="cache-control" content="no-cache">
<meta name="description" content="Open source FAT file system module for embedded projects">
<link rel="start" title="Site Top" href="../../">
<link rel="up" title="Freewares" href="../../fsw_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>
@ -18,7 +16,7 @@
<div class="abst">
<img src="img/layers.png" class="rset" width="245" height="255" alt="layer">
<p>FatFs is a generic FAT file system module for small embedded systems. The FatFs is written in compliance with ANSI C and completely separated from the disk I/O layer. Therefore it is independent of hardware architecture. It can be incorporated into small microcontrollers with limited resource, such as AVR, 8051, PIC, ARM, Z80, 68k and etc... Petit FatFs module is also available <a href="http://elm-chan.org/fsw/ff/00index_p.html">here</a>↗ for tiny microcontrollers.</p>
<p>FatFs is a generic FAT file system module for small embedded systems. The FatFs is written in compliance with ANSI C and completely separated from the disk I/O layer. Therefore it is independent of hardware architecture. It can be incorporated into small microcontrollers with limited resource, such as AVR, 8051, PIC, ARM, Z80, 68k and etc. Also Petit FatFs module for tiny microcontrollers is available <a href="http://elm-chan.org/fsw/ff/00index_p.html">here</a>.</p>
<h4>Features</h4>
<ul>
@ -82,8 +80,8 @@
<div class="para">
<h3>Disk I/O Interface</h3>
<p>Since the FatFs module is completely separated from disk I/O layer, it requires following functions to access the storage device. When O/S related feature is enabled, it will require process/memory functions in addition. However the low level disk I/O module is not a part of FatFs module, so that it must be provided by user. The sample implementations are also available in the downloads.</p>
<h3>Device Control Interface</h3>
<p>Since the FatFs module is a file system driver, it is completely separated from physical devices, such as memory card, harddisk and any type of storage devices. The low level device control module is not a part of FatFs module. FatFs accesses the storage device via a simple interface described below. These functions are provided by implementer. Sample implementations for some platforms are also 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>

View File

@ -67,10 +67,10 @@ The FatFs module assumes that size of char/short/long are 8/16/32 bit and int is
<li>FAT sub-types: FAT12, FAT16 and FAT32.</li>
<li>Number of open files: Unlimited, depends on available memory.</li>
<li>Number of volumes: Upto 10.</li>
<li>File size: Depends on FAT specs. (upto 4G-1 bytes)</li>
<li>Volume size: Depends on FAT specs. (upto 2T bytes at 512 bytes/sector)</li>
<li>Cluster size: Depends on FAT specs. (upto 64K bytes at 512 bytes/sector)</li>
<li>Sector size: Depends on FAT specs. (512..4096 bytes)</li>
<li>File size: Depends on the FAT specs. (upto 4G-1 bytes)</li>
<li>Volume size: Depends on the FAT specs. (upto 2T bytes at 512 bytes/sector)</li>
<li>Cluster size: Depends on the FAT specs. (upto 64K bytes at 512 bytes/sector)</li>
<li>Sector size: Depends on the FAT specs. (512, 1024, 2048 and 4096 bytes)</li>
</ul>
</div>
@ -151,7 +151,7 @@ _FS_LOCK 0 (Disable file lock control)
<div class="para" id="lfn">
<h3>Long File Name</h3>
<p>FatFs module supports long file name (LFN). The two different file names, SFN and LFN, of a file is transparent in the file functions except for <tt>f_readdir()</tt> function. The LFN feature is disabled by default. To enable it, set <tt>_USE_LFN</tt> to 1, 2 or 3, and add <tt>option/unicode.c</tt> to the project. The LFN feature requiers a certain working buffer in addition. The buffer size can be configured by <tt>_MAX_LFN</tt> according to the available memory size. The size of long file name will reach up to 255 characters, so that the <tt>_MAX_LFN</tt> should be set to 255 for full featured LFN operation. If the size of working buffer is insufficient for the given file name, the file function fails with <tt>FR_INVALID_NAME</tt>. When enable the LFN feature with re-entrant configuration, <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.</p>
<p>FatFs module supports LFN (long file name). The two different file names, SFN (short file name) and LFN, of a file is transparent on the API except for <tt>f_readdir()</tt> function. The LFN feature is disabled by default. To enable it, set <tt>_USE_LFN</tt> to 1, 2 or 3, and add <tt>option/unicode.c</tt> to the project. The LFN feature requiers a certain working buffer in addition. The buffer size can be configured by <tt>_MAX_LFN</tt> according to the available memory. The length of an LFN will reach up to 255 characters, so that the <tt>_MAX_LFN</tt> should be set to 255 for full featured LFN operation. If the size of working buffer is insufficient for the input file name, the file function fails with <tt>FR_INVALID_NAME</tt>. When enable the LFN feature with re-entrant configuration, <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.</p>
<table class="lst2 rset">
<caption>LFN cfg on ARM7TDMI</caption>
<tr><th>Code page</th><th>Program size</th></tr>
@ -167,13 +167,13 @@ _FS_LOCK 0 (Disable file lock control)
<div class="para" id="unicode">
<h3>Unicode API</h3>
<p>By default, FatFs uses ANSI/OEM code set on the API under LFN configuration. FatFs can also switch the character encoding to Unicode on the API (<tt>_LFN_UNICODE</tt>). This means the FatFs supports the True-LFN feature. For more information, refer to the description in the <a href="filename.html">file name</a>.</p>
<p>By default, FatFs uses ANSI/OEM code set on the API under LFN configuration. FatFs can also switch the character encoding to Unicode on the API by <tt>_LFN_UNICODE</tt> option. This means that the FatFs supports the True-LFN feature. For more information, refer to the description in the <a href="filename.html">file name</a>.</p>
</div>
<div class="para" id="reentrant">
<h3>Re-entrancy</h3>
<p>The file operations to the different volume is always re-entrant and can work simultaneously. The file operations to the same volume is not re-entrant but it can also be configured to thread-safe with <tt>_FS_REENTRANT</tt> option. In this case, also the OS dependent synchronization object control functions, <tt>ff_cre_syncobj(), ff_del_syncobj(), ff_req_grant() and ff_rel_grant()</tt> must be added to the project.</p>
<p>When a file function is called while the volume is in use by any other task, the file function is suspended until that task leaves file function. If wait time exceeded a period defined by <tt>_TIMEOUT</tt>, the file function will abort with <tt>FR_TIMEOUT</tt>. The timeout feature might not be supported by some RTOS.</p>
<p>The file operations to the different volume is always re-entrant and can work simultaneously. The file operations to the same volume is not re-entrant but it can also be configured to thread-safe by <tt>_FS_REENTRANT</tt> option. In this case, also the OS dependent synchronization object control functions, <tt>ff_cre_syncobj(), ff_del_syncobj(), ff_req_grant() and ff_rel_grant()</tt> must 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 in use by any other task, the file function is suspended until that task leaves the file function. If wait time exceeded a period defined by <tt>_TIMEOUT</tt>, the file function will abort with <tt>FR_TIMEOUT</tt>. The timeout feature might not be supported by some RTOS.</p>
<p>There is an exception for <tt>f_mount(), f_mkfs(), f_fdisk()</tt> function. These functions are not re-entrant to the same volume or corresponding physical drive. When use these functions, all other tasks must unmount the volume and avoid to access the volume.</p>
<p>Note that this section describes on the re-entrancy of the FatFs module itself but also the low level disk I/O layer will need to be re-entrant.</p>
</div>
@ -181,7 +181,7 @@ _FS_LOCK 0 (Disable file lock control)
<div class="para" id="dup">
<h3>Duplicated File Access</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 and deleted. A violation of these rules can cause data colluption.</p>
<p>The file lock control can also be available by <tt>_FS_LOCK</tt> option. The value 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 fail with <tt>FR_LOCKED</tt>. If number of open files and sub-directories gets larger than <tt>_FS_LOCK</tt>, the open function will fail with <tt>FR_TOO_MANY_OPEN_FILES</tt>.</p>
<p>The file lock control can also be available by <tt>_FS_LOCK</tt> option. The value 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 fail with <tt>FR_LOCKED</tt>. If number of open objects, files and sub-directories, gets larger than <tt>_FS_LOCK</tt>, the <tt>f_open(), f_optndir()</tt> function will fail with <tt>FR_TOO_MANY_OPEN_FILES</tt>.</p>
</div>
<div class="para" id="fs1">
@ -245,6 +245,7 @@ Figure 5. Minimized critical section<br>
<li><a href="../img/app2.c">Empty a directory</a></li>
<li><a href="../img/app3.c">Allocate contiguous area to the file</a></li>
<li><a href="../img/app4.c">Function/Compatible checker for low level disk I/O module</a></li>
<li><a href="../img/mkfatimg.zip">FAT image creator</a></li>
</ol>
</div>
@ -266,7 +267,7 @@ Figure 5. Minimized critical section<br>
/ * Redistributions of source code must retain the above copyright notice.
/
/-----------------------------------------------------------------------------/</pre>
<p>Therefore FatFs license is one of the BSD-style licenses but there is a significant feature. Because FatFs is for embedded projects, the conditions of redistributions in binary form, such as embedded code, hex file, binary library and any form without source code, are not specified in order to extend usability to commercial use. The documentation of the distributions need not include about FatFs and its license document, and it may also. This is equivalent to the BSD 1-Clause License. Of course FatFs is compatible with the projects under GNU GPL. When redistribute the FatFs with any modification, the license can also be changed to GNU GPL or BSD-style license.</p>
<p>Therefore FatFs license is one of the BSD-style licenses but there is a significant feature. Because FatFs is for embedded projects, the conditions of redistributions in binary form, such as embedded code, hex file, binary library or any forms without source code, are not specified in order to extend usability for commercial products. The documentation of the distributions need not include about FatFs and its license document, and it may also. This is equivalent to the BSD 1-Clause License. Of course FatFs is compatible with the projects under GNU GPL. When redistribute the FatFs with any modification or branch it as a folk, the license can also be changed to GNU GPL or BSD-style license.</p>
</div>
<p class="foot"><a href="../00index_e.html">Return</a></p>

View File

@ -58,7 +58,7 @@ DRESULT disk_write (
<div class="para desc">
<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>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 feature of the disk functions. The write operation to the media need not to be completed due to write operation is in progress or only stored it into the cache buffer when return from this function. But 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 delayed write feature is implemented, the write throughput may be improved.</p>
<p><em>Application program MUST NOT call this function, or FAT structure on the volume can be collapsed.</em></p>

View File

@ -49,7 +49,7 @@ 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 in write mode, the file size is expanded to the specified offset. The file data in the expanded area is undefined because no data is written to the file. This is suitable to pre-allocate a cluster chain quickly, for fast write operation. 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 current read/write pointer is not the expected value, either of followings has been occured.</p>
<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 undefined because no data is written to the file. This is suitable to pre-allocate a cluster chain quickly, for fast write operation. 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 current 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 insufficient free space on the volume to expand the file.</li>

View File

@ -16,7 +16,7 @@
<p>The f_mount fucntion registers/unregisters file system object to the FatFs module.</p>
<pre>
FRESULT f_mount (
FATFS* <span class="arg">fatfs</span>, <span class="c">/* [IN] File system object */</span>
FATFS* <span class="arg">fs</span>, <span class="c">/* [IN] File system object */</span>
const TCHAR* <span class="arg">path</span>, <span class="c">/* [IN] Logical drive number */</span>
BYTE <span class="arg">opt</span> <span class="c">/* [IN] Initialization option */</span>
);
@ -26,7 +26,7 @@ FRESULT f_mount (
<div class="para arg">
<h4>Parameters</h4>
<dl class="par">
<dt>fatfs</dt>
<dt>fs</dt>
<dd>Pointer to the new file system object to be registered. Null pointer unregisters the registered file system object.</dd>
<dt>path</dt>
<dd>Pointer to the null-terminated string that specifies the <a href="filename.html">logical drive</a>. The string with no drive number means the default drive.</dd>
@ -53,10 +53,10 @@ FRESULT f_mount (
<ol>
<li>Determines the logical drive which specified by <tt class="arg">path</tt>.</li>
<li>Clears and unregisters the regsitered work area of the drive.</li>
<li>Clears and registers the new work area to the drive if <tt class="arg">fatfs</tt> is not NULL.</li>
<li>Clears and registers the new work area to the drive if <tt class="arg">fs</tt> is not NULL.</li>
<li>Performs volume mount process to the drive if forced mount is specified.</li>
</ol>
<p>The file system object is the work area needed for each logical drive. It must be given to the logical drive with this function prior to use any other file functions except for <tt>f_fdisk()</tt> function. To unregister a work area, specify a NULL to the <tt class="arg">fatfs</tt>, and then the work area can be discarded.</p>
<p>The file system object is the work area needed for each logical drive. It must be given to the logical drive with this function prior to use any other file functions except for <tt>f_fdisk()</tt> function. To unregister a work area, specify a NULL to the <tt class="arg">fs</tt>, and then the work area can be discarded.</p>
<p>If forced mount is not specified, this function always succeeds regardless of the physical drive status due to delayed mount feature. It only clears (de-initializes) the given work area and registers its address to the internal table. No activity of the physical drive in this function. It can also be used to force de-initialized the registered work area of a logical drive. The volume mount processes, initialize the corresponding physical drive, find the FAT volume in it and initialize the work area, is performed in the subsequent file access functions when either or both of following condition is true.</p>
<ul>
<li>File system object is not initialized. It is cleared by <tt>f_mount()</tt>.</li>

View File

@ -19,10 +19,10 @@
<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>
<dt id="ie">FR_INT_ERR</dt>
<dd>Assertion failed. An insanity is detected in the internal process. One of the following possibilities are suspected.
<dd>Assertion failed. An insanity is detected in the internal process. One of the following possibilities is suspected.
<ul>
<li>There is any error of the FAT structure on the volume.</li>
<li>Work area (file system object, file object or etc...) is broken by stack overflow or any other application. This is the reason in most case.</li>
<li>There is any error of the FAT structure on the volume.</li>
</ul>
Note that if once this error occured at any operation to an open file, the file object is aborted and all operations to the file except for close will be rejected.
</dd>

View File

@ -54,7 +54,7 @@ FRESULT f_read (
<div class="para desc">
<h4>Description</h4>
<p>The file read/write pointer of the file object advances number of bytes read. After the function succeeded, <tt class="arg">*br</tt> should be checked to detect the end of file. In case of <tt class="arg">*br</tt> is less than <tt class="arg">btr</tt>, it means the read/write pointer reached end of the file during read operation.</p>
<p>The file read/write pointer of the file object advances number of bytes read. After the function succeeded, <tt class="arg">*br</tt> should be checked to detect end of the file. In case of <tt class="arg">*br</tt> is less than <tt class="arg">btr</tt>, it means the read/write pointer reached end of the file during read operation.</p>
</div>

View File

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

View File

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View File

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

Before

Width:  |  Height:  |  Size: 7.7 KiB

After

Width:  |  Height:  |  Size: 7.7 KiB

View File

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

View File

Before

Width:  |  Height:  |  Size: 8.0 KiB

After

Width:  |  Height:  |  Size: 8.0 KiB

View File

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

@ -216,7 +216,7 @@ _FS_LOCK 0 (Disable file lock control)
図6. マルチ/シングル・セクタ・ライトの比較<br>
<img src="../img/f6.png" width="630" height="148" alt="fig.6">
</div>
<p>フラッシュ・メモリ・メディアの書き込み速度はシングル・セクタ書き込みの時に最も低いものになり、一回のトランザクションで転送されるセクタ数が大きくなるほど書き込み速度は向上します。この効果はバス速度が高速になるほど顕著で、10倍以上の差が現れることも珍しくありません。<a href="../img/rwtest2.png">テスト結果</a>は、マルチ・セクタ書き込み(W:16K, 32 sectors)がシングル・セクタ書き込み(W:100, 1 sector)どの程度速いかを明確に示しています。大容量メディアほどシングル・セクタ書き込みが遅くなる点もまた重要です。書き込みトランザクションの回数はまた、メディアの寿命にも影響してきます。このため、アプリケーションはなるべく大きなブロック(クラスタ・サイズまたは2の累乗セクタ境界にアライメントした)で読み書きを行う必要があります。もちろん、アプリケーションからメディアに至る全てのレイヤがマルチ・セクタ転送に対応していないと意味がありません。残念ながら、既存のオープン・ソースのドライバの多くはマルチ・セクタ転送に未対応です。なお、FatFsモジュールおよびサンプル・ドライバはマルチ・セクタ転送に対応しています。</p>
<p>フラッシュ・メモリ・メディアの書き込み速度はシングル・セクタ書き込みの時に最も低いものになり、一回のトランザクションで転送されるセクタ数が大きくなるほど書き込み速度は向上します。この効果はバス速度が高速になるほど顕著で、10倍以上の差が現れることも珍しくありません。<a href="../img/rwtest2.png">テスト結果</a>は、マルチ・セクタ書き込み(W:16K, 32 sectors)がシングル・セクタ書き込み(W:100, 1 sector)よりどの程度速いかを明確に示しています。大容量メディアほどシングル・セクタ書き込みが遅くなる点もまた重要です。書き込みトランザクションの回数はまた、メディアの寿命にも影響してきます。このため、アプリケーションはなるべく大きなブロック(クラスタ・サイズまたは2の累乗セクタ境界にアライメントした)で読み書きを行う必要があります。もちろん、アプリケーションからメディアに至る全てのレイヤがマルチ・セクタ転送に対応していないと意味がありません。残念ながら、既存のオープン・ソースのドライバの多くはマルチ・セクタ転送に未対応です。なお、FatFsモジュールおよびサンプル・ドライバはマルチ・セクタ転送に対応しています。</p>
<h4>明示的なメモリ消去</h4>
<p>通常のファイル消去では、記録されたデータに対して何らかの制御が行われるわけではなく、単にFAT上に未使用クラスタとして記録されているだけです。このため、ファイルが消去されたあともそれらは有効なメモリ・ブロックとしてフラッシュ・メモリ上に残ります。そこで、ファイルを消去するとき、占有していたデータ・セクタを明示的に消去(つまり未使用ブロックにする)することにより、メディア内の空きブロックを増やすことができます。これにより、次にそのブロックに書き込むときの消去動作が無くなり、書き込み性能が向上する可能性があります。また、ウェアレベリングに使えるブロックが増え、メディアの耐久性も向上するかも知れません。この機能を有効にするには、構成オプションの<tt>_USE_ERASE</tt>に1を設定します。これはフラッシュ・メモリ・メディアの内部動作に期待した制御なので、効果があるとは限りません。また、ファイル消去の時間が延びることも考慮に入れるべきです。</p>
</div>
@ -252,6 +252,7 @@ _FS_LOCK 0 (Disable file lock control)
<li><a href="../img/app2.c">ディレクトリを空にする</a></li>
<li><a href="../img/app3.c">ファイルに連続領域を割り当てる</a></li>
<li><a href="../img/app4.c">ディスクI/Oモジュールの機能/互換性チェッカー</a></li>
<li><a href="../img/mkfatimg.zip">FATイメージ作成ツール</a></li>
</ol>
</div>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -22,7 +22,7 @@ DWORD get_fattime (void);
<div class="para ret">
<h4>戻り値</h4>
<p>現在のローカル・タイムを<tt>DWORD</tt>値にパックして返しす。ビット・フィールドは次に示すようになります。</p>
<p>現在のローカル・タイムを<tt>DWORD</tt>値にパックして返しす。ビット・フィールドは次に示すようになります。</p>
<dl>
<dt>bit31:25</dt>
<dd>1980年を起点とした年を 0..127 でセット。</dd>

View File

@ -13,7 +13,7 @@
<div class="para func">
<h2>f_getcwd</h2>
<p>カレント・ディレクトリを得ます</p>
<p>カレント・ディレクトリを得ます</p>
<pre>
FRESULT f_getcwd (
TCHAR* <span class="arg">buff</span>, <span class="c">/* [OUT] バッファ */</span>
@ -28,7 +28,7 @@ FRESULT f_getcwd (
<dt>buff</dt>
<dd>カレント・ディレクトリのパス名文字列を格納するバッファ</dd>
<dt>len</dt>
<dd>TCHAR単位のバッファ・サイズ</dd>
<dd><tt>TCHAR</tt>単位のバッファ・サイズ</dd>
</dl>
</div>

View File

@ -13,7 +13,7 @@
<div class="para func">
<h2>f_getfree</h2>
<p>ボリューム上の未使用クラスタ数を取得します。</p>
<p>ボリューム上の空き領域のサイズを取得します。</p>
<pre>
FRESULT f_getfree (
const TCHAR* <span class="arg">path</span>, <span class="c">/* [IN] 対象ドライブを指定します */</span>
@ -53,7 +53,7 @@ FRESULT f_getfree (
<div class="para desc">
<h4>解説</h4>
<p>論理ドライブ上の空きクラスタ数を取得します。返されたファイル・システム・オブジェクトの<tt>csize</tt>メンバがクラスタあたりのセクタ数を示しているので、これを元にセクタ単位の空きサイズが計算できます。FAT32ボリュームにおいては、FSINFOの情報が実際の空きクラスタ数と同期していない場合、不正確な値を返す可能性があります。この問題を避けるため、<tt>_FS_NOFSINFO</tt>オプションでFSINFOを無視して初回はフルFATスキャンをするように構成することもできます。</p>
<p>論理ドライブ上の空き領域のサイズをクラスタ単位で取得します。返されたファイル・システム・オブジェクトの<tt>csize</tt>メンバがクラスタあたりのセクタ数を示しているので、これを元にセクタ単位の空きサイズが計算できます。FAT32ボリュームにおいては、FSINFOの情報が実際の空きクラスタ数と同期していない場合、不正確な値を返す可能性があります。この問題を避けるため、<tt>_FS_NOFSINFO</tt>オプションでマウント後の初回は必ずフルFATスキャンをするように構成することもできます。</p>
</div>

View File

@ -44,7 +44,7 @@ TCHAR* f_gets (
<div class="para desc">
<h4>解説</h4>
<p>この関数は<a href="read.html"><tt>f_read()</tt></a>のラッパー関数です。読み出し動作は、最初の<tt>'\n'</tt>を読み込むか、ファイル終端に達するか、<tt>len - 1</tt>文字を読み出すまで続きます。読み込まれた文字列の終端には<tt>'\0'</tt>が付加されます。既にファイル終端で1文字も読み込まれなかったとき、または何らかのエラーが発生したときは関数は失敗しヌル・ポインタを返します。ファイル終端かエラーかは<tt>f_eof()</tt>,<tt>f_error()</tt>マクロで調べられます。</p>
<p>この関数は<a href="read.html"><tt>f_read()</tt></a>のラッパー関数です。読み出し動作は、最初の<tt>'\n'</tt>を読み込むか、ファイル終端に達するか、<tt class="arg">len</tt> - 1文字を読み出すまで続きます。読み込まれた文字列の終端には<tt>'\0'</tt>が付加されます。既にファイル終端で1文字も読み込まれなかったとき、または何らかのエラーが発生したときは関数は失敗しヌル・ポインタを返します。ファイル終端かエラーかは<tt>f_eof()</tt>,<tt>f_error()</tt>マクロで調べられます。</p>
<p>Unicode API構成(<tt>_LFN_UNICODE == 1</tt>)が選択されているときは、<tt class="arg">buff</tt>はUTF-16文字列になりますが、ファイル上のエンコードは、<tt>_STRF_ENCODE</tt>オプションで選択できます。それ以外の時は無変換(1バイト/1文字)で読み出します。</p>
</div>

View File

@ -31,7 +31,7 @@ FRESULT f_mkfs (
<dt>sfd</dt>
<dd>パーテーション形式。(0(FDISK) または 1(SFD))</dd>
<dt>au</dt>
<dd>クラスタ・サイズをバイト単位で指定します。対象ドライブのセクタ・サイズのn倍(n = 1128で、2の累乗)でなければなりません。0を指定した場合、ボリュームのサイズに応じたデフォルトのクラスタ・サイズが選択されます。</dd>
<dd>クラスタ・サイズをバイト単位で指定します。値は対象ドライブのセクタ・サイズのn倍(n = 1128で、2の累乗)でなければなりません。0などの無効値を指定した場合、ボリュームのサイズに応じたデフォルトのクラスタ・サイズが選択されます。</dd>
</dl>
</div>

View File

@ -16,7 +16,7 @@
<p>論理ドライブにファイル・システム・オブジェクトを登録・抹消します。</p>
<pre>
FRESULT f_mount (
FATFS* <span class="arg">fatfs</span>, <span class="c">/* [IN] ファイル・システム・オブジェクト */</span>
FATFS* <span class="arg">fs</span>, <span class="c">/* [IN] ファイル・システム・オブジェクト */</span>
const TCHAR* <span class="arg">path</span>, <span class="c">/* [IN] 論理ドライブ番号 */</span>
BYTE <span class="arg">opt</span> <span class="c">/* [IN] オプション */</span>
);
@ -26,7 +26,7 @@ FRESULT f_mount (
<div class="para arg">
<h4>引数</h4>
<dl class="par">
<dt>fatfs</dt>
<dt>fs</dt>
<dd>登録するファイル・システム・オブジェクトへのポインタ。</dd>
<dt>path</dt>
<dd>対象となる論理ドライブの<a href="filename.html">パス名</a>を示すヌル文字'\0'終端の文字列へのポインタを指定します。ドライブ番号を含まない場合は、デフォルト・ドライブを指定したことになります。</dd>
@ -49,11 +49,11 @@ FRESULT f_mount (
<div class="para desc">
<h4>解説</h4>
<p>FatFsモジュールでは、それぞれの論理ドライブに<em>ファイル・システム・オブジェクト</em>というワーク・エリアが必要です。この関数は論理ドライブにファイル・システム・オブジェクトを登録したり抹消したりします。何らかのファイル関数を使用する前に、この関数でその論理ドライブのファイル・システム・オブジェクトを与えておかなければなりません。<tt class="arg">fatfs</tt>にヌル・ポインタを指定すると、その論理ドライブのファイル・システム・オブジェクトの登録は抹消されるだけです。登録抹消されたファイル・システム・オブジェクトのメモリは解放できます。操作対象の論理ドライブ上に開かれているファイルやディレクトリがあった場合、それらは全て無効になります。この関数の内部処理は次のような順に行われます。</p>
<p>FatFsモジュールでは、それぞれの論理ドライブに<em>ファイル・システム・オブジェクト</em>というワーク・エリアが必要です。この関数は論理ドライブにファイル・システム・オブジェクトを登録したり抹消したりします。何らかのファイル関数を使用する前に、この関数でその論理ドライブのファイル・システム・オブジェクトを与えておかなければなりません。<tt class="arg">fs</tt>にヌル・ポインタを指定すると、その論理ドライブのファイル・システム・オブジェクトの登録は抹消されるだけです。登録抹消されたファイル・システム・オブジェクトのメモリは解放できます。操作対象の論理ドライブ上に開かれているファイルやディレクトリがあった場合、それらは全て無効になります。この関数の内部処理は次のような順に行われます。</p>
<ol>
<li>対象の論理ドライブを<tt class="arg">path</tt>から得る。</li>
<li>既に登録されているファイル・システム・オブジェクトはクリアし、登録を解除する。</li>
<li><tt class="arg">fatfs</tt>が有効なポインタのときは、そのファイル・システム・オブジェクトをクリアし登録する。</li>
<li><tt class="arg">fs</tt>が有効なポインタのときは、そのファイル・システム・オブジェクトをクリアし登録する。</li>
<li>マウント動作が指定されているときは、それを実行する。</li>
</ol>
<p><tt class="arg">opt</tt>に0を指定すると、マウント動作(物理ドライブの初期化、FATボリュームの検索、BPBを解析しファイル・システム・オブジェクトを初期化)は行われず、関数は物理ドライブの状態に関わらず常に成功します。関数内では下位レイヤへのアクセスは発生せず、指定されたファイル・システム・オブジェクトをクリア(無効化)し、そのアドレスを内部配列に登録するだけです。単に登録済みのファイル・システム・オブジェクトをクリアする目的にも使えます。そして、続いてボリュームへのアクセスが行われたとき次のうちいずれかでも真の場合は、実際のマウント動作が行われます。</p>

View File

@ -57,7 +57,7 @@ int f_printf (
<div class="para comp">
<h4>対応情報</h4>
<p><tt>_FS_READONLY == 0</tt>で、且つ<tt>_USE_STRFUNC</tt>が1または2のとき使用可能になります。2の時は、出力に含まれる<tt>'\n'</tt><tt>'\r'+'\n'</tt>に展開されてファイルに書き込まれます。</p>
<p>APIにUnicodeが選択(<tt>_LFN_UNICODE</tt>が1)されているときは、<span class="arg">fmt</span>はUnicode文字列になりますが、ファイル上のエンコードは、<tt>_STRF_ENCODE</tt>オプションで選択できます。それ以外の時は無変換(1バイト/1文字)で書き込みます。</p>
<p>APIにUnicodeが選択(<tt>_LFN_UNICODE</tt>が1)されているときは、<tt class="arg">fmt</tt>はUnicode文字列になりますが、ファイル上のエンコードは、<tt>_STRF_ENCODE</tt>オプションで選択できます。それ以外の時は無変換(1バイト/1文字)で書き込みます。</p>
</div>

View File

@ -36,7 +36,7 @@ int f_puts (
<div class="para ret">
<h4>戻り値</h4>
<p>文字列が正常に書き込まれると、書き込まれた文字数が返されます。ディスクが満杯またはエラーにより書き込みが中断されたときは<tt>EOF (-1)</tt>が返されます。</p>
<p>APIにUnicodeが選択(<tt>_LFN_UNICODE</tt>が1)されているときは、<span class="arg">str</span>はUTF-16文字列になりますが、ファイル上のエンコードは、<tt>_STRF_ENCODE</tt>オプションで選択できます。それ以外の時は無変換(1バイト/1文字)で書き込みます。</p>
<p>APIにUnicodeが選択(<tt>_LFN_UNICODE</tt>が1)されているときは、<tt class="arg">str</tt>はUTF-16文字列になりますが、ファイル上のエンコードは、<tt>_STRF_ENCODE</tt>オプションで選択できます。それ以外の時は無変換(1バイト/1文字)で書き込みます。</p>
</div>

Some files were not shown because too many files have changed in this diff Show More