fatfs v0.02a Jun 10, 2006:
- Added a configuration option _FS_MINIMUM.
This commit is contained in:
parent
238747ef97
commit
86d6ced87e
@ -3,6 +3,8 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||||
<meta http-equiv="Content-Style-Type" content="text/css">
|
<meta http-equiv="Content-Style-Type" content="text/css">
|
||||||
|
<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="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">
|
<link rel="stylesheet" href="css_e.css" type="text/css" media="screen" title="ELM Default">
|
||||||
<title>ELM - Generic FAT Files System Module</title>
|
<title>ELM - Generic FAT Files System Module</title>
|
||||||
@ -14,18 +16,12 @@
|
|||||||
|
|
||||||
<div class="abst">
|
<div class="abst">
|
||||||
<img src="layers.png" class="rset" width="245" height="255">
|
<img src="layers.png" class="rset" width="245" height="255">
|
||||||
<p>FatFs module is an experimental project to implement FAT file system to small embdded systems. The FatFs module is written in compliance with ANSI C, therefore it is independent of hardware architecture. It can be implemented to most 8/16 small microcontrollers, such as PIC, AVR, H8, Z80 and etc..., without any changes. I created two modules in different configurations in consideration of various use. For read only applications, writing codes can also be eliminated to reduce the module size. To use the FatFs module, low level disk I/O functions for each media must be provided by user.</p>
|
<p>FatFs module is an experimental project to implement FAT file system to small embdded systems. The FatFs module is written in compliance with ANSI C, therefore it is independent of hardware architecture. It can be incorporated into most small microcontrollers, such as PIC, AVR, H8, Z80 and etc..., without any change. I created two modules in different configurations in consideration of various use. To use the FatFs module, low level disk I/O functions for each media must be provided by user.</p>
|
||||||
|
|
||||||
<h4>Features of FatFs Module</h4>
|
<h4>Features of FatFs Module</h4>
|
||||||
<ul>
|
<ul>
|
||||||
<li>Separated buffer for FAT and each file. Suitable for fast multiple file accsess.</li>
|
<li>Separated buffer for FAT and each file. Suitable for fast multiple file accsess.</li>
|
||||||
<li>Low memory consumption (ex. avr-gcc)
|
<li>Low memory consumption</li>
|
||||||
<ul>
|
|
||||||
<li>Module Size: 8282 bytes (R/W cfg.), 4482 bytes (R/O cfg.)</li>
|
|
||||||
<li>Static Work Area: 2 bytes</li>
|
|
||||||
<li>Dynamic Work Area: 544 + 540 * <files> bytes</li>
|
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
<li>Supports FAT12, FAT16(+FAT64) and FAT32 <small>(FAT64: FAT16 in 64KB/cluster)</small></li>
|
<li>Supports FAT12, FAT16(+FAT64) and FAT32 <small>(FAT64: FAT16 in 64KB/cluster)</small></li>
|
||||||
<li>Supports 8.3 format file name and NT lower capital flags</li>
|
<li>Supports 8.3 format file name and NT lower capital flags</li>
|
||||||
<li>Supports two partitioning formats: FDISK (only 1st primariy partition) and SFD (only 512B/sector)</li>
|
<li>Supports two partitioning formats: FDISK (only 1st primariy partition) and SFD (only 512B/sector)</li>
|
||||||
@ -33,13 +29,7 @@
|
|||||||
<h4>Features of Tiny-FatFs Module</h4>
|
<h4>Features of Tiny-FatFs Module</h4>
|
||||||
<ul>
|
<ul>
|
||||||
<li>Only a common buffer for FAT and each file to reduce memory consumption.</li>
|
<li>Only a common buffer for FAT and each file to reduce memory consumption.</li>
|
||||||
<li>Low memory consumption (ex. avr-gcc), suitable for small memory system (1KB)
|
<li>Low memory consumption , suitable for small memory system (1KB)</li>
|
||||||
<ul>
|
|
||||||
<li>Module Size: 6868 bytes (R/W cfg.), 3804 bytes (R/O cfg.)</li>
|
|
||||||
<li>Static Work Area: 2 bytes</li>
|
|
||||||
<li>Dynamic Work Area: 538 + 24 * <files> bytes</li>
|
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
<li>Supports FAT12 and FAT16(+FAT64)</li>
|
<li>Supports FAT12 and FAT16(+FAT64)</li>
|
||||||
<li>Supports 8.3 format file name and NT lower capital flags</li>
|
<li>Supports 8.3 format file name and NT lower capital flags</li>
|
||||||
<li>Supports two partitioning formats: FDISK (only 1st primariy partition) and SFD (only 512B/sector)</li>
|
<li>Supports two partitioning formats: FDISK (only 1st primariy partition) and SFD (only 512B/sector)</li>
|
||||||
@ -47,9 +37,34 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="para">
|
||||||
|
<h3>Memory Usage</h3>
|
||||||
|
<p>There are some configuration options to eliminate unused functions to reduce module size. Following tables are memory consumption in unit of byte on avr-gcc.</p>
|
||||||
|
|
||||||
|
<div class="lset">
|
||||||
|
<table class="lst2">
|
||||||
|
<caption>FatFs</caption>
|
||||||
|
<tr><th>Section</th><th>Std cfg.</th><th>Min cfg.</th></tr>
|
||||||
|
<tr><td>Program (R/W cfg.)</td><td>8282</td><td>6294</td></tr>
|
||||||
|
<tr><td>Program (R/O cfg.)</td><td>4482</td><td>3704</td></tr>
|
||||||
|
<tr><td>Work Area (static)</td><td colspan="2">2</td>
|
||||||
|
<tr><td>Work Area (dynamic)</td><td colspan="2">544 + 540 * <files></td>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<table class="lst2">
|
||||||
|
<caption>Tiny-FatFs</caption>
|
||||||
|
<tr><th>Section</th><th>Std cfg.</th><th>Min cfg.</th></tr>
|
||||||
|
<tr><td>Program (R/W cfg.)</td><td>6868</td><td>5208</td></tr>
|
||||||
|
<tr><td>Program (R/O cfg.)</td><td>3804</td><td>3136</td></tr>
|
||||||
|
<tr><td>Work Area (static)</td><td colspan="2">2</td></tr>
|
||||||
|
<tr><td>Work Area (dynamic)</td><td colspan="2">538 + 24 * <files></td></tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para">
|
||||||
<h3>Application Interface</h3>
|
<h3>Application Interface</h3>
|
||||||
<p>FatFs module and Tiny-FatFs module provide following functions.</p>
|
<p>FatFs/Tiny-FatFs module provides following functions.</p>
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="en/open.html">f_open</a> - Open/Create a File</li>
|
<li><a href="en/open.html">f_open</a> - Open/Create a File</li>
|
||||||
<li><a href="en/close.html">f_close</a> - Close a File</li>
|
<li><a href="en/close.html">f_close</a> - Close a File</li>
|
||||||
@ -71,7 +86,7 @@
|
|||||||
|
|
||||||
<div class="para">
|
<div class="para">
|
||||||
<h3>Disk I/O Interface</h3>
|
<h3>Disk I/O Interface</h3>
|
||||||
<p>FatFs module and Tiny-FatFs module require following functions to lower layer to read/write physical disk and to get current time.</p>
|
<p>FatFs/Tiny-FatFs module requires following functions to lower layer to read/write physical disk and to get current time.</p>
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="en/dinit.html">disk_initialize</a> - Initialize disk drive</li>
|
<li><a href="en/dinit.html">disk_initialize</a> - Initialize disk drive</li>
|
||||||
<li><a href="en/dstat.html">disk_status</a> - Get disk status</li>
|
<li><a href="en/dstat.html">disk_status</a> - Get disk status</li>
|
||||||
@ -84,16 +99,15 @@
|
|||||||
|
|
||||||
<div class="para">
|
<div class="para">
|
||||||
<h3>Resources</h3>
|
<h3>Resources</h3>
|
||||||
<p>The FatFs module is opened for education, reserch and development. You can use, modify and republish it for personal, non-profit or profit use without any limitation under your responsibility.</p>
|
<p>The FatFs/Tiny-FatFs module is a freeware and is opened for education, research and development. You can use, modify and republish it for personal, non-profit or profit use without any limitation under your responsibility.</p>
|
||||||
<br>
|
<br>
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="rwtest.png">Benchmark</a> (Test Board: ATmega64/9.2MHz with <a href="rw_mmc.jpeg">MMC</a>/<a href="rw_ata.jpeg">HDD</a>/<a href="rw_cfc.jpeg">CFC</a>)</li>
|
<li><a href="rwtest.png">Benchmark</a> (Test Board: ATmega64/9.2MHz with <a href="rw_mmc.jpeg">MMC</a>/<a href="rw_ata.jpeg">HDD</a>/<a href="rw_cfc.jpeg">CFC</a>)</li>
|
||||||
<li><a href="http://www.microsoft.com/whdc/system/platform/firmware/fatgen.mspx">FAT32 Specification</a> (Microsoft)</li>
|
<li><a href="http://www.microsoft.com/whdc/system/platform/firmware/fatgen.mspx">FAT32 Specification</a> (Microsoft)</li>
|
||||||
<li><a href="http://elm-chan.org/docs/mmc/mmc_e.html">How to Use an MMC</a></li>
|
<li><a href="../../docs/mmc/mmc_e.html">How to Use an MMC</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<hr>
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@ -3,6 +3,8 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS">
|
<meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS">
|
||||||
<meta http-equiv="Content-Style-Type" content="text/css">
|
<meta http-equiv="Content-Style-Type" content="text/css">
|
||||||
|
<link rel="start" title="Site Top" href="../../index_j.html">
|
||||||
|
<link rel="up" title="Freewares" href="../../fsw.html">
|
||||||
<link rel="alternate" hreflang="en" title="English version" href="00index_e.html">
|
<link rel="alternate" hreflang="en" title="English version" href="00index_e.html">
|
||||||
<link rel="stylesheet" href="css_j.css" type="text/css" media="screen" title="ELM Default">
|
<link rel="stylesheet" href="css_j.css" type="text/css" media="screen" title="ELM Default">
|
||||||
<title>ELM - 汎用FATファイルシステム・モジュール</title>
|
<title>ELM - 汎用FATファイルシステム・モジュール</title>
|
||||||
@ -14,17 +16,11 @@
|
|||||||
|
|
||||||
<div class="abst">
|
<div class="abst">
|
||||||
<img src="layers.png" class="rset" width="245" height="255">
|
<img src="layers.png" class="rset" width="245" height="255">
|
||||||
<p>小規模な組み込みシステム向けの汎用FATファイルシステム・モジュールです。ANSI C準拠でハードウェア・アーキテクチャには依存しないので、必要なワークエリアが確保できれば、PIC, AVR, H8, Z80などほとんどのマイコンでそのまま使用可能です。いろいろな使用形態を考慮して、高速版(FatFs)と省メモリ版(Tiny-FatFs)の2通りを作成してみました。読み出し専用アプリケーションではさらに書き込み関係のコードを削減した構成もできます。実際に使用するには、各記録メディア(CFC, MMC, SDC, ATA, USB, SCSI等)に対応したディスクI/Oモジュールを用意する必要があります。</p>
|
<p>小規模な組み込みシステム向けの汎用FATファイルシステム・モジュールです。ANSI C準拠でハードウェア・アーキテクチャには依存しないので、必要なワークエリアが確保できれば、PIC, AVR, H8, Z80などほとんどのマイコンでそのまま使用可能です。いろいろな使用形態を考慮して、高速版(FatFs)と省メモリ版(Tiny-FatFs)の2通りを作成してみました。実際に使用するには、各記録メディア(CFC, MMC, SDC, ATA, USB, SCSI等)に対応したディスクI/Oモジュール(サンプルあり)を用意する必要があります。</p>
|
||||||
<h4>FatFsモジュールの特徴</h4>
|
<h4>FatFsモジュールの特徴</h4>
|
||||||
<ul>
|
<ul>
|
||||||
<li>システム用と各ファイル用バッファを分離し、複数ファイルの高速アクセスに適する</li>
|
<li>システム用と各ファイル用バッファを分離し、複数ファイルの高速アクセスに適する</li>
|
||||||
<li>メモリの消費が少ない(avrgccでの例)
|
<li>メモリの消費が少ない</li>
|
||||||
<ul>
|
|
||||||
<li>プログラム・エリア: 8282 bytes (R/W構成), 4482 bytes (R/O構成)</li>
|
|
||||||
<li>静的ワーク・エリア: 2 bytes</li>
|
|
||||||
<li>動的ワーク・エリア: 544 + 540 * <files> bytes</li>
|
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
<li>FAT12, FAT16(+FAT64), FAT32に対応 <small>(FAT64: FAT16 in 64KB/cluster)</small></li>
|
<li>FAT12, FAT16(+FAT64), FAT32に対応 <small>(FAT64: FAT16 in 64KB/cluster)</small></li>
|
||||||
<li>8.3形式ファイル名とNT小文字フラグに対応</li>
|
<li>8.3形式ファイル名とNT小文字フラグに対応</li>
|
||||||
<li>FDISKフォーマット(基本区画)およびSFDフォーマット(512B/sectorのみ)に対応</li>
|
<li>FDISKフォーマット(基本区画)およびSFDフォーマット(512B/sectorのみ)に対応</li>
|
||||||
@ -32,13 +28,7 @@
|
|||||||
<h4>Tiny-FatFsモジュールの特徴</h4>
|
<h4>Tiny-FatFsモジュールの特徴</h4>
|
||||||
<ul>
|
<ul>
|
||||||
<li>システム用と各ファイル用バッファを共通化し、RAMの使用量を削減</li>
|
<li>システム用と各ファイル用バッファを共通化し、RAMの使用量を削減</li>
|
||||||
<li>メモリの消費が少なく(avrgccでの例)、小メモリ・システム(1KB)に対応</li>
|
<li>メモリの消費が少なく、小メモリ・システム(1KB)に対応</li>
|
||||||
<ul>
|
|
||||||
<li>プログラム・エリア: 6868 bytes (R/W構成), 3804 bytes (R/O構成)</li>
|
|
||||||
<li>静的ワーク・エリア: 2 bytes</li>
|
|
||||||
<li>動的ワーク・エリア: 538 + 24 * <files> bytes</li>
|
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
<li>FAT12, FAT16(+FAT64)に対応</li>
|
<li>FAT12, FAT16(+FAT64)に対応</li>
|
||||||
<li>8.3形式ファイル名とNT小文字フラグに対応</li>
|
<li>8.3形式ファイル名とNT小文字フラグに対応</li>
|
||||||
<li>FDISKフォーマット(基本区画)およびSFDフォーマット(512B/sectorのみ)に対応</li>
|
<li>FDISKフォーマット(基本区画)およびSFDフォーマット(512B/sectorのみ)に対応</li>
|
||||||
@ -46,9 +36,34 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="para">
|
||||||
|
<h3>メモリ使用</h3>
|
||||||
|
<p>いくつかのコンフィギュレーション・オプションにより、不要な関数を削ってモジュールサイズを削減できます。次に実際のメモリ使用量[バイト]を示します(avrgccの例)。</p>
|
||||||
|
|
||||||
|
<div class="lset">
|
||||||
|
<table class="lst2">
|
||||||
|
<caption>FatFs</caption>
|
||||||
|
<tr><th>セクション</th><th>標準</th><th>最小</th></tr>
|
||||||
|
<tr><td>Program (R/W cfg.)</td><td>8282</td><td>6294</td></tr>
|
||||||
|
<tr><td>Program (R/O cfg.)</td><td>4482</td><td>3704</td></tr>
|
||||||
|
<tr><td>Work Area (static)</td><td colspan="2">2</td>
|
||||||
|
<tr><td>Work Area (dynamic)</td><td colspan="2">544 + 540 * <files></td>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<table class="lst2">
|
||||||
|
<caption>Tiny-FatFs</caption>
|
||||||
|
<tr><th>セクション</th><th>標準</th><th>最小</th></tr>
|
||||||
|
<tr><td>Program (R/W cfg.)</td><td>6868</td><td>5208</td></tr>
|
||||||
|
<tr><td>Program (R/O cfg.)</td><td>3804</td><td>3136</td></tr>
|
||||||
|
<tr><td>Work Area (static)</td><td colspan="2">2</td></tr>
|
||||||
|
<tr><td>Work Area (dynamic)</td><td colspan="2">538 + 24 * <files></td></tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para">
|
||||||
<h3>上位レイヤI/F</h3>
|
<h3>上位レイヤI/F</h3>
|
||||||
<p>FatFsモジュールとTiny-FatFsモジュールは、次のファイル操作関数を提供しています。</p>
|
<p>FatFs/Tiny-FatFsモジュールは、次のファイル操作関数を提供しています。</p>
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="ja/open.html">f_open</a> - ファイルのオープン・作成</li>
|
<li><a href="ja/open.html">f_open</a> - ファイルのオープン・作成</li>
|
||||||
<li><a href="ja/close.html">f_close</a> - ファイルのクローズ</li>
|
<li><a href="ja/close.html">f_close</a> - ファイルのクローズ</li>
|
||||||
@ -70,7 +85,7 @@
|
|||||||
|
|
||||||
<div class="para">
|
<div class="para">
|
||||||
<h3>下位レイヤI/F</h3>
|
<h3>下位レイヤI/F</h3>
|
||||||
<p>FatFsモジュールとTiny-FatFsモジュールは、物理ドライブへのアクセスや現在時刻を得るため、下位レイヤに次のインターフェースを要求します。</p>
|
<p>FatFs/Tiny-FatFsモジュールは、物理ドライブへのアクセスや現在時刻を得るため、下位レイヤに次のインターフェースを要求します。</p>
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="ja/dinit.html">disk_initialize</a> - ディスク・ドライブの初期化</li>
|
<li><a href="ja/dinit.html">disk_initialize</a> - ディスク・ドライブの初期化</li>
|
||||||
<li><a href="ja/dstat.html">disk_status</a> - ディスク・ドライブの状態取得</li>
|
<li><a href="ja/dstat.html">disk_status</a> - ディスク・ドライブの状態取得</li>
|
||||||
@ -83,16 +98,15 @@
|
|||||||
|
|
||||||
<div class="para">
|
<div class="para">
|
||||||
<h3>資料</h3>
|
<h3>資料</h3>
|
||||||
<p>FatFsモジュールとTiny-FatFsモジュールは教育・研究・開発用に公開しています。どのような利用目的(個人・非商用・商用)でも使用・改変・配布について一切の制限はありませんが、全て利用者の責任の下での利用とします。</p>
|
<p>FatFs/Tiny-FatFsモジュールはフリーウェアとして教育・研究・開発用に公開しています。どのような利用目的(個人・非商用・商用)でも使用・改変・配布について一切の制限はありませんが、全て利用者の責任の下での利用とします。</p>
|
||||||
<br>
|
<br>
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="rwtest.png">パフォーマンス・テスト</a>(テストボード:ATmega64/9.2MHz with <a href="rw_mmc.jpeg">MMC</a>/<a href="rw_ata.jpeg">HDD</a>/<a href="rw_cfc.jpeg">CFC</a>)</li>
|
<li><a href="rwtest.png">パフォーマンス・テスト</a>(テストボード:ATmega64/9.2MHz with <a href="rw_mmc.jpeg">MMC</a>/<a href="rw_ata.jpeg">HDD</a>/<a href="rw_cfc.jpeg">CFC</a>)</li>
|
||||||
<li><a href="http://www.microsoft.com/whdc/system/platform/firmware/fatgen.mspx">FAT32仕様書</a> (Microsoft)</li>
|
<li><a href="http://www.microsoft.com/whdc/system/platform/firmware/fatgen.mspx">FAT32仕様書</a> (Microsoft)</li>
|
||||||
<li><a href="http://elm-chan.org/docs/mmc/mmc.html">MMCの使いかた</a></li>
|
<li><a href="../../docs/mmc/mmc.html">MMCの使いかた</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<hr>
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@ -44,9 +44,10 @@ small {font-size: 80%;}
|
|||||||
.indent {margin-left: 2em;}
|
.indent {margin-left: 2em;}
|
||||||
|
|
||||||
/* Tables */
|
/* Tables */
|
||||||
table.lst {margin: 4px; border-collapse: collapse; border-style: solid; border-width: 2px; border-color: black; }
|
table {margin: 4px; border-collapse: collapse; border-style: solid; border-width: 2px; border-color: black; }
|
||||||
table.lst th {background-color: white; border-style: solid; border-width: 1px 1px 2px; border-color: black; padding: 0 3px; vertical-align: top; white-space: nowrap;}
|
th {background-color: white; border-style: solid; border-width: 1px 1px 2px; border-color: black; padding: 0 3px; vertical-align: top; white-space: nowrap;}
|
||||||
table.lst td {background-color: white; border-style: solid; border-width: 1px; border-color: black; padding: 0 3px; vertical-align: top; line-height: 1.3em;}
|
td {background-color: white; border-style: solid; border-width: 1px; border-color: black; padding: 0 3px; vertical-align: top; line-height: 1.3em;}
|
||||||
table.lst td:first-child {font-family: monospace;}
|
table.lst td:first-child {font-family: monospace;}
|
||||||
|
table caption {font-family: sans-serif; font-weight: bold;}
|
||||||
|
|
||||||
p.foot {clear: both; text-indent: 0; margin: 1em 0.5em 1em;}
|
p.foot {clear: both; text-indent: 0; margin: 1em 0.5em 1em;}
|
||||||
|
|||||||
@ -47,9 +47,10 @@ small {font-size: 80%;}
|
|||||||
.indent {margin-left: 2em;}
|
.indent {margin-left: 2em;}
|
||||||
|
|
||||||
/* Tables */
|
/* Tables */
|
||||||
table.lst {margin: 4px; border-collapse: collapse; border-style: solid; border-width: 2px; border-color: black; letter-spacing: 0;}
|
table {margin: 4px; border-collapse: collapse; border-style: solid; border-width: 2px; border-color: black; letter-spacing: 0;}
|
||||||
table.lst th {background-color: white; border-style: solid; border-width: 1px 1px 2px; border-color: black; padding: 0 3px; vertical-align: top;}
|
th {background-color: white; border-style: solid; border-width: 1px 1px 2px; border-color: black; padding: 0 3px; vertical-align: top;}
|
||||||
table.lst td {background-color: white; border-style: solid; border-width: 1px; border-color: black; padding: 0 3px; vertical-align: top; line-height: 1.3em;}
|
td {background-color: white; border-style: solid; border-width: 1px; border-color: black; padding: 0 3px; vertical-align: top; line-height: 1.3em;}
|
||||||
table.lst td:first-child {font-family: monospace; white-space: nowrap;}
|
table.lst td:first-child {font-family: monospace; white-space: nowrap;}
|
||||||
|
table caption {font-family: sans-serif; font-weight: bold;}
|
||||||
|
|
||||||
p.foot {clear: both; text-indent: 0; margin: 1em 0.5em 1em;}
|
p.foot {clear: both; text-indent: 0; margin: 1em 0.5em 1em;}
|
||||||
|
|||||||
@ -46,7 +46,7 @@ FRESULT f_chmod (
|
|||||||
<div class="para">
|
<div class="para">
|
||||||
<h4>Return Values</h4>
|
<h4>Return Values</h4>
|
||||||
<dl class="ret">
|
<dl class="ret">
|
||||||
<dt>FR_OK</dt>
|
<dt>FR_OK (0)</dt>
|
||||||
<dd>The function succeeded.</dd>
|
<dd>The function succeeded.</dd>
|
||||||
<dt>FR_NOFILE</dt>
|
<dt>FR_NOFILE</dt>
|
||||||
<dd>Could not find the file.</dd>
|
<dd>Could not find the file.</dd>
|
||||||
@ -72,7 +72,7 @@ FRESULT f_chmod (
|
|||||||
|
|
||||||
<div class="para">
|
<div class="para">
|
||||||
<h4>Description</h4>
|
<h4>Description</h4>
|
||||||
<p>The f_chmod changes the attribute of a file or directory. This function is not supported in read-only configuration.</p>
|
<p>The f_chmod changes the attribute of a file or directory. This function is not supported in read-only and minimum configuration.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -32,7 +32,7 @@ FRESULT f_close (
|
|||||||
<div class="para">
|
<div class="para">
|
||||||
<h4>Return Values</h4>
|
<h4>Return Values</h4>
|
||||||
<dl class="ret">
|
<dl class="ret">
|
||||||
<dt>FR_OK</dt>
|
<dt>FR_OK (0)</dt>
|
||||||
<dd>The file has been closed successfuly.</dd>
|
<dd>The file has been closed successfuly.</dd>
|
||||||
<dt>FR_RW_ERROR</dt>
|
<dt>FR_RW_ERROR</dt>
|
||||||
<dd>Any error occured in low level disk I/O.</dd>
|
<dd>Any error occured in low level disk I/O.</dd>
|
||||||
|
|||||||
@ -28,7 +28,7 @@ DRESULT disk_read (
|
|||||||
<dt>Buffer</dt>
|
<dt>Buffer</dt>
|
||||||
<dd>Pointer to the read buffer to store the read data. <tt>SectorCount * 512</tt> bytes is required for the size of the read buffer.</dd>
|
<dd>Pointer to the read buffer to store the read data. <tt>SectorCount * 512</tt> bytes is required for the size of the read buffer.</dd>
|
||||||
<dt>SectorNumber</dt>
|
<dt>SectorNumber</dt>
|
||||||
<dd>Specifies the sector number in logical block address to read from.</dd>
|
<dd>Specifies the start sector number in logical block address.</dd>
|
||||||
<dt>SectorCount</dt>
|
<dt>SectorCount</dt>
|
||||||
<dd>Specifies number of sectors to read. The value can be 1 to 255.</dd>
|
<dd>Specifies number of sectors to read. The value can be 1 to 255.</dd>
|
||||||
</dl>
|
</dl>
|
||||||
@ -41,7 +41,7 @@ DRESULT disk_read (
|
|||||||
<dt>RES_OK</dt>
|
<dt>RES_OK</dt>
|
||||||
<dd>The function succeeded.</dd>
|
<dd>The function succeeded.</dd>
|
||||||
<dt>RES_ERROR</dt>
|
<dt>RES_ERROR</dt>
|
||||||
<dd>Any error occured during read operation.</dd>
|
<dd>Any error occured during the read operation.</dd>
|
||||||
<dt>RES_PARERR</dt>
|
<dt>RES_PARERR</dt>
|
||||||
<dd>Invalid parameter.</dd>
|
<dd>Invalid parameter.</dd>
|
||||||
<dt>RES_NOTRDY</dt>
|
<dt>RES_NOTRDY</dt>
|
||||||
|
|||||||
@ -28,7 +28,7 @@ DRESULT disk_write (
|
|||||||
<dt>Buffer</dt>
|
<dt>Buffer</dt>
|
||||||
<dd>Pointer to the data to be written.</dd>
|
<dd>Pointer to the data to be written.</dd>
|
||||||
<dt>SectorNumber</dd>
|
<dt>SectorNumber</dd>
|
||||||
<dd>Specifies the sector number in logical block address to write from.</dd>
|
<dd>Specifies the start sector number in logical block address.</dd>
|
||||||
<dt>SectorCount</dt>
|
<dt>SectorCount</dt>
|
||||||
<dd>Specifies number of sectors to write. The value can be 1 to 255.</dd>
|
<dd>Specifies number of sectors to write. The value can be 1 to 255.</dd>
|
||||||
</dl>
|
</dl>
|
||||||
@ -41,7 +41,7 @@ DRESULT disk_write (
|
|||||||
<dt>RES_OK</dt>
|
<dt>RES_OK</dt>
|
||||||
<dd>The function succeeded.</dd>
|
<dd>The function succeeded.</dd>
|
||||||
<dt>RES_ERROR</dt>
|
<dt>RES_ERROR</dt>
|
||||||
<dd>Any error occured during read operation.</dd>
|
<dd>Any error occured during the write operation.</dd>
|
||||||
<dt>RES_WRPRT</dt>
|
<dt>RES_WRPRT</dt>
|
||||||
<dd>The disk is write protected.</dd>
|
<dd>The disk is write protected.</dd>
|
||||||
<dt>RES_PARERR</dt>
|
<dt>RES_PARERR</dt>
|
||||||
|
|||||||
@ -41,7 +41,7 @@ DWORD get_fattime ();
|
|||||||
|
|
||||||
<div class="para">
|
<div class="para">
|
||||||
<h4>Description</h4>
|
<h4>Description</h4>
|
||||||
<p>The function must be return any valid time even if the system does not support a real time clock. The get_fattime is not required in read only configuration.</p>
|
<p>The function must return any valid time even if the system does not support a real time clock. The get_fattime is not required in read only configuration.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -32,7 +32,7 @@ FRESULT f_getfree (
|
|||||||
<div class="para">
|
<div class="para">
|
||||||
<h4>Return Values</h4>
|
<h4>Return Values</h4>
|
||||||
<dl class="ret">
|
<dl class="ret">
|
||||||
<dt>FR_OK</dt>
|
<dt>FR_OK (0)</dt>
|
||||||
<dd>The function succeeded. The <tt><em>*Clusters</em></tt> havs number of free clusters.</dd>
|
<dd>The function succeeded. The <tt><em>*Clusters</em></tt> havs number of free clusters.</dd>
|
||||||
<dt>FR_NOT_READY</dt>
|
<dt>FR_NOT_READY</dt>
|
||||||
<dd>The disk drive cannot work due to no medium in the drive or any other reason.</dd>
|
<dd>The disk drive cannot work due to no medium in the drive or any other reason.</dd>
|
||||||
@ -50,7 +50,7 @@ FRESULT f_getfree (
|
|||||||
|
|
||||||
<div class="para">
|
<div class="para">
|
||||||
<h4>Descriptions</h4>
|
<h4>Descriptions</h4>
|
||||||
<p>The f_getfree gets number of free clusters on the drive. The <tt>FatFs.sects_clust</tt> is indicating number of sectors per cluster, so that the free space in unit of byte can be calcurated with this.</p>
|
<p>The f_getfree gets number of free clusters on the drive. The <tt>FatFs.sects_clust</tt> is indicating number of sectors per cluster, so that the free space in unit of byte can be calcurated with this. This function is not supported in minimum configuration.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -35,7 +35,7 @@ FRESULT f_lseek (
|
|||||||
<div class="para">
|
<div class="para">
|
||||||
<h4>Return Values</h4>
|
<h4>Return Values</h4>
|
||||||
<dl class="ret">
|
<dl class="ret">
|
||||||
<dt>FR_OK</dt>
|
<dt>FR_OK (0)</dt>
|
||||||
<dd>The function succeeded.</dd>
|
<dd>The function succeeded.</dd>
|
||||||
<dt>FR_RW_ERROR</dt>
|
<dt>FR_RW_ERROR</dt>
|
||||||
<dd>Any error occured in low level disk I/O.</dd>
|
<dd>Any error occured in low level disk I/O.</dd>
|
||||||
|
|||||||
@ -32,7 +32,7 @@ FRESULT f_mkdir (
|
|||||||
<div class="para">
|
<div class="para">
|
||||||
<h4>Return Value</h4>
|
<h4>Return Value</h4>
|
||||||
<dl class="ret">
|
<dl class="ret">
|
||||||
<dt>FR_OK</dt>
|
<dt>FR_OK (0)</dt>
|
||||||
<dd>The function succeeded.</dd>
|
<dd>The function succeeded.</dd>
|
||||||
<dt>FR_NOPATH</dt>
|
<dt>FR_NOPATH</dt>
|
||||||
<dd>Could not find the path.</dd>
|
<dd>Could not find the path.</dd>
|
||||||
@ -58,7 +58,7 @@ FRESULT f_mkdir (
|
|||||||
|
|
||||||
<div class="para">
|
<div class="para">
|
||||||
<h4>Description</h4>
|
<h4>Description</h4>
|
||||||
<p>The f_mkdir creates an empty directory. This function is not supported in read only configuration.</p>
|
<p>The f_mkdir creates an empty directory. This function is not supported in read-only and minimum configuration.</p>
|
||||||
<p>
|
<p>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -21,7 +21,7 @@ FRESULT f_mountdrv ();
|
|||||||
<div class="para">
|
<div class="para">
|
||||||
<h4>Return Values</h4>
|
<h4>Return Values</h4>
|
||||||
<dl class="ret">
|
<dl class="ret">
|
||||||
<dt>FR_OK</dt>
|
<dt>FR_OK (0)</dt>
|
||||||
<dd>The function succeeded.</dd>
|
<dd>The function succeeded.</dd>
|
||||||
<dt>FR_NOT_READY</dt>
|
<dt>FR_NOT_READY</dt>
|
||||||
<dd>The disk drive cannot work due to no medium in the drive or any other reason.</dd>
|
<dd>The disk drive cannot work due to no medium in the drive or any other reason.</dd>
|
||||||
@ -37,8 +37,7 @@ FRESULT f_mountdrv ();
|
|||||||
|
|
||||||
<div class="para">
|
<div class="para">
|
||||||
<h4>Description</h4>
|
<h4>Description</h4>
|
||||||
<p>The f_mountdrv mounts a partition (initializes <tt>FATFS</tt> structure) and put all file functions can be used. The file system is mounted (initialized) automatically in accordance with the necessity when any file function is called, so that any initialization is not needed before using file functions. To terminate use of the FatFs module, close all files and clear the global variable <em>FatFs</em>, then the <tt>FATFS</tt> structure can be discarded. In this function, following process is executed.</p>
|
<p>The f_mountdrv mounts a partition (initializes <tt>FATFS</tt> structure) and put it that can handle all file functions. This function should not be used except for recover FR_INCORRECT_DISK_CHANGE error because the file system is mounted(initialized) automatically in accordance with the necessity when any file function is called. To terminate use of the FatFs module, close all files and then the <tt>FATFS</tt> structure can be discarded. In this function, following process is executed.</p><br>
|
||||||
<br>
|
|
||||||
<ul>
|
<ul>
|
||||||
<li>Initializes lower level layer (disk I/O module).</li>
|
<li>Initializes lower level layer (disk I/O module).</li>
|
||||||
<li>Searches a FAT boot record in order of sector 0 (as SFD format) and first primary partition (as FDISK format).</li>
|
<li>Searches a FAT boot record in order of sector 0 (as SFD format) and first primary partition (as FDISK format).</li>
|
||||||
|
|||||||
@ -47,7 +47,7 @@ FRESULT f_open (
|
|||||||
<div class="para">
|
<div class="para">
|
||||||
<h4>Return Values</h4>
|
<h4>Return Values</h4>
|
||||||
<dl class="ret">
|
<dl class="ret">
|
||||||
<dt>FR_OK</dt>
|
<dt>FR_OK (0)</dt>
|
||||||
<dd>The function succeeded. The <tt><em>FileObject</em></tt> structure is used for subsequent calls to refer to the file. When close the file, use function <tt><a href="close.html">f_close()</a></tt>.</dd>
|
<dd>The function succeeded. The <tt><em>FileObject</em></tt> structure is used for subsequent calls to refer to the file. When close the file, use function <tt><a href="close.html">f_close()</a></tt>.</dd>
|
||||||
<dt>FR_NOFILE</dt>
|
<dt>FR_NOFILE</dt>
|
||||||
<dd>Could not find the file.</dd>
|
<dd>Could not find the file.</dd>
|
||||||
@ -92,7 +92,7 @@ void main ()
|
|||||||
WORD br, bw; // File R/W count
|
WORD br, bw; // File R/W count
|
||||||
|
|
||||||
|
|
||||||
// Give a work area for FatFs (activate module)
|
// Give a work area to FatFs module (activate module)
|
||||||
memset(&fs, 0, sizeof(FATFS));
|
memset(&fs, 0, sizeof(FATFS));
|
||||||
FatFs = &fs;
|
FatFs = &fs;
|
||||||
|
|
||||||
|
|||||||
@ -35,7 +35,7 @@ FRESULT f_opendir (
|
|||||||
<div class="para">
|
<div class="para">
|
||||||
<h4>Return Values</h4>
|
<h4>Return Values</h4>
|
||||||
<dl class="ret">
|
<dl class="ret">
|
||||||
<dt>FR_OK</dt>
|
<dt>FR_OK (0)</dt>
|
||||||
<dd>The function succeeded. The <tt><em>DirObject</em></tt> structure is used for subsequent calls to read the directory entries.</dd>
|
<dd>The function succeeded. The <tt><em>DirObject</em></tt> structure is used for subsequent calls to read the directory entries.</dd>
|
||||||
<dt>FR_NOPATH</dt>
|
<dt>FR_NOPATH</dt>
|
||||||
<dd>Could not find the path.</dd>
|
<dd>Could not find the path.</dd>
|
||||||
@ -57,7 +57,7 @@ FRESULT f_opendir (
|
|||||||
|
|
||||||
<div class="para">
|
<div class="para">
|
||||||
<h4>Description</h4>
|
<h4>Description</h4>
|
||||||
<p>The f_opendir opens a directory and initializes the <tt><em>DirObject</em></tt> structure for subsequent calls. The directory object structure can be discarded at any time.</p>
|
<p>The f_opendir opens a directory and initializes the <tt><em>DirObject</em></tt> structure for subsequent calls. The directory object structure can be discarded at any time. This function is not supported in minimum configuration.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -16,7 +16,7 @@
|
|||||||
<pre>
|
<pre>
|
||||||
FRESULT f_read (
|
FRESULT f_read (
|
||||||
FIL* <em>FileObject</em>, // Pointer to the file object structure
|
FIL* <em>FileObject</em>, // Pointer to the file object structure
|
||||||
BYTE* <em>Buffer</em>, // Pointer to the buffer to store read data
|
void* <em>Buffer</em>, // Pointer to the buffer to store read data
|
||||||
WORD <em>ByteToRead</em>, // Number of bytes to read
|
WORD <em>ByteToRead</em>, // Number of bytes to read
|
||||||
WORD* <em>ByteRead</em> // Pointer to the variable to return number of bytes read
|
WORD* <em>ByteRead</em> // Pointer to the variable to return number of bytes read
|
||||||
);
|
);
|
||||||
@ -41,7 +41,7 @@ FRESULT f_read (
|
|||||||
<div class="para">
|
<div class="para">
|
||||||
<h4>Return Values</h4>
|
<h4>Return Values</h4>
|
||||||
<dl class="ret">
|
<dl class="ret">
|
||||||
<dt>FR_OK</dt>
|
<dt>FR_OK (0)</dt>
|
||||||
<dd>The function succeeded.</dd>
|
<dd>The function succeeded.</dd>
|
||||||
<dt>FR_DENIED</dt>
|
<dt>FR_DENIED</dt>
|
||||||
<dd>The function denied due to the file has been opened in write only mode.</dd>
|
<dd>The function denied due to the file has been opened in write only mode.</dd>
|
||||||
@ -57,7 +57,7 @@ FRESULT f_read (
|
|||||||
|
|
||||||
<div class="para">
|
<div class="para">
|
||||||
<h4>Description</h4>
|
<h4>Description</h4>
|
||||||
<p>The read/write pointer increases in number of bytes read. The <tt>ByteRead</tt> will be smaller than <tt>ByteToRead</tt> when the read pointer reached to end of the file or alignment error occured during the read operation.</p>
|
<p>The read/write pointer increases in number of bytes read. The <tt>ByteRead</tt> will be smaller than <tt>ByteToRead</tt> when the read pointer reached to end of the file or any error occured during the read operation.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -35,7 +35,7 @@ FRESULT f_readdir (
|
|||||||
<div class="para">
|
<div class="para">
|
||||||
<h4>Return Values</h4>
|
<h4>Return Values</h4>
|
||||||
<dl class="ret">
|
<dl class="ret">
|
||||||
<dt>FR_OK</dt>
|
<dt>FR_OK (0)</dt>
|
||||||
<dd>The function succeeded.</dd>
|
<dd>The function succeeded.</dd>
|
||||||
<dt>FR_NOT_READY</dt>
|
<dt>FR_NOT_READY</dt>
|
||||||
<dd>The disk drive cannot work due to no medium in the drive or any other reason.</dd>
|
<dd>The disk drive cannot work due to no medium in the drive or any other reason.</dd>
|
||||||
@ -49,7 +49,7 @@ FRESULT f_readdir (
|
|||||||
|
|
||||||
<div class="para">
|
<div class="para">
|
||||||
<h4>Description</h4>
|
<h4>Description</h4>
|
||||||
<p>The f_readdir reads directory items in sequence. All items in the directory can be read by calling f_readdir repeatedly. When all items have been read and no item to read, the member <tt>f_name[]</tt> in the file information structure gets a null string. For details of the file informations, refer to the <tt>FILINFO</tt>.</p>
|
<p>The f_readdir reads directory items in sequence. All items in the directory can be read by calling f_readdir repeatedly. When all items have been read and no item to read, the member <tt>f_name[]</tt> in the file information structure gets a null string. For details of the file informations, refer to the <tt>FILINFO</tt>. This function is not supported in minimum configuration.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -25,7 +25,7 @@ FRESULT f_stat (
|
|||||||
<h4>Parameters</h4>
|
<h4>Parameters</h4>
|
||||||
<dl class="par">
|
<dl class="par">
|
||||||
<dt>FileName</dt>
|
<dt>FileName</dt>
|
||||||
<dd>Pointer to the null-terminated string that specifies the file or directory name to get the information .</dd>
|
<dd>Pointer to the null-terminated string that specifies the file or directory name to get the information. Do not specify root directory.</dd>
|
||||||
<dt>FileInfo</dt>
|
<dt>FileInfo</dt>
|
||||||
<dd>Pointer to the <tt>FILINFO</tt> structure to store the information.</dd>
|
<dd>Pointer to the <tt>FILINFO</tt> structure to store the information.</dd>
|
||||||
</dl>
|
</dl>
|
||||||
@ -35,7 +35,7 @@ FRESULT f_stat (
|
|||||||
<div class="para">
|
<div class="para">
|
||||||
<h4>Return Values</h4>
|
<h4>Return Values</h4>
|
||||||
<dl class="ret">
|
<dl class="ret">
|
||||||
<dt>FR_OK</dt>
|
<dt>FR_OK (0)</dt>
|
||||||
<dd>The function succeeded.</dd>
|
<dd>The function succeeded.</dd>
|
||||||
<dt>FR_NOPATH</dt>
|
<dt>FR_NOPATH</dt>
|
||||||
<dd>Could not find the path.</dd>
|
<dd>Could not find the path.</dd>
|
||||||
@ -57,7 +57,7 @@ FRESULT f_stat (
|
|||||||
|
|
||||||
<div class="para">
|
<div class="para">
|
||||||
<h4>Description</h4>
|
<h4>Description</h4>
|
||||||
<p>The f_stat gets the information of a file or directory. For details of the infomation, refer to the <tt>FILINFO</tt> structure.</p>
|
<p>The f_stat gets the information of a file or directory. For details of the infomation, refer to the <tt>FILINFO</tt> structure. This function is not supported in minimum configuration.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -32,7 +32,7 @@ FRESULT f_sync (
|
|||||||
<div class="para">
|
<div class="para">
|
||||||
<h4>Return Values</h4>
|
<h4>Return Values</h4>
|
||||||
<dl class="ret">
|
<dl class="ret">
|
||||||
<dt>FR_OK</dt>
|
<dt>FR_OK (0)</dt>
|
||||||
<dd>The function succeeded.</dd>
|
<dd>The function succeeded.</dd>
|
||||||
<dt>FR_RW_ERROR</dt>
|
<dt>FR_RW_ERROR</dt>
|
||||||
<dd>Any error occured in low level disk I/O.</dd>
|
<dd>Any error occured in low level disk I/O.</dd>
|
||||||
|
|||||||
@ -24,7 +24,7 @@ FRESULT f_unlink (
|
|||||||
<h4>Parameters</h4>
|
<h4>Parameters</h4>
|
||||||
<dl class="par">
|
<dl class="par">
|
||||||
<dt>FileName</dt>
|
<dt>FileName</dt>
|
||||||
<dd>Pointer to the null-terminated string that specifies the full path name of a file or directory to be removed. In read only configuration, this function is not supported.</dd>
|
<dd>Pointer to the null-terminated string that specifies the full path name of a file or directory to be removed. In read-only and minimum configuration, this function is not supported.</dd>
|
||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -32,7 +32,7 @@ FRESULT f_unlink (
|
|||||||
<div class="para">
|
<div class="para">
|
||||||
<h4>Return Values</h4>
|
<h4>Return Values</h4>
|
||||||
<dl class="ret">
|
<dl class="ret">
|
||||||
<dt>FR_OK</dt>
|
<dt>FR_OK (0)</dt>
|
||||||
<dd>The function succeeded.</dd>
|
<dd>The function succeeded.</dd>
|
||||||
<dt>FR_NOFILE</dt>
|
<dt>FR_NOFILE</dt>
|
||||||
<dd>Could not find the file or directory.</dd>
|
<dd>Could not find the file or directory.</dd>
|
||||||
@ -41,7 +41,7 @@ FRESULT f_unlink (
|
|||||||
<dt>FR_INVALID_NAME</dt>
|
<dt>FR_INVALID_NAME</dt>
|
||||||
<dd>The path name is invalid.</dd>
|
<dd>The path name is invalid.</dd>
|
||||||
<dt>FR_DENIED</dt>
|
<dt>FR_DENIED</dt>
|
||||||
<dd>The function was denied due to any of following reasons: the file or directory has read-only attribute, the directory is not empty.</dd>
|
<dd>The function was denied due to either of following reasons: the file or directory has read-only attribute, the directory is not empty.</dd>
|
||||||
<dt>FR_NOT_READY</dt>
|
<dt>FR_NOT_READY</dt>
|
||||||
<dd>The disk drive cannot work due to no medium in the drive or any other reason.</dd>
|
<dd>The disk drive cannot work due to no medium in the drive or any other reason.</dd>
|
||||||
<dt>FR_WRITE_PROTECTED</dt>
|
<dt>FR_WRITE_PROTECTED</dt>
|
||||||
|
|||||||
@ -16,7 +16,7 @@
|
|||||||
<pre>
|
<pre>
|
||||||
FRESULT f_write (
|
FRESULT f_write (
|
||||||
FIL* <em>FileObject</em>, // Pointer to the file object structure
|
FIL* <em>FileObject</em>, // Pointer to the file object structure
|
||||||
const BYTE* <em>Buffer</em>, // Pointer to the data to be written
|
const void* <em>Buffer</em>, // Pointer to the data to be written
|
||||||
WORD <em>ByteToWrite</em>, // Number of bytes to write
|
WORD <em>ByteToWrite</em>, // Number of bytes to write
|
||||||
WORD* <em>ByteWritten</em> // Pointer to the variable to return number of bytes written
|
WORD* <em>ByteWritten</em> // Pointer to the variable to return number of bytes written
|
||||||
);
|
);
|
||||||
@ -41,7 +41,7 @@ FRESULT f_write (
|
|||||||
<div class="para">
|
<div class="para">
|
||||||
<h4>Return Values</h4>
|
<h4>Return Values</h4>
|
||||||
<dl class="ret">
|
<dl class="ret">
|
||||||
<dt>FR_OK</dt>
|
<dt>FR_OK (0)</dt>
|
||||||
<dd>The function succeeded.</dd>
|
<dd>The function succeeded.</dd>
|
||||||
<dt>FR_DENIED</dt>
|
<dt>FR_DENIED</dt>
|
||||||
<dd>The function denied due to the file has been opened in read only mode.</dd>
|
<dd>The function denied due to the file has been opened in read only mode.</dd>
|
||||||
@ -57,7 +57,7 @@ FRESULT f_write (
|
|||||||
|
|
||||||
<div class="para">
|
<div class="para">
|
||||||
<h4>Description</h4>
|
<h4>Description</h4>
|
||||||
<p>The read/write pointer increases in number of bytes written. The <tt>ByteWritten</tt> will be smaller than <tt>ByteToWrite</tt> when disk gets full during write function. This function is not supported in read only configuration.</p>
|
<p>The read/write pointer increases in number of bytes written. The <tt>ByteWritten</tt> will be smaller than <tt>ByteToWrite</tt> when disk gets full during write function. This function is not supported in read-only configuration.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -46,7 +46,7 @@ FRESULT f_chmod (
|
|||||||
<div class="para">
|
<div class="para">
|
||||||
<h4>戻り値</h4>
|
<h4>戻り値</h4>
|
||||||
<dl class="ret">
|
<dl class="ret">
|
||||||
<dt>FR_OK</dt>
|
<dt>FR_OK (0)</dt>
|
||||||
<dd>正常終了。</dd>
|
<dd>正常終了。</dd>
|
||||||
<dt>FR_NOFILE</dt>
|
<dt>FR_NOFILE</dt>
|
||||||
<dd>ファイルが見つからない。</dd>
|
<dd>ファイルが見つからない。</dd>
|
||||||
@ -72,7 +72,7 @@ FRESULT f_chmod (
|
|||||||
|
|
||||||
<div class="para">
|
<div class="para">
|
||||||
<h4>解説</h4>
|
<h4>解説</h4>
|
||||||
<p>ファイルまたはディレクトリの属性を変更します。リードオンリー構成ではこの関数はサポートされません。</p>
|
<p>ファイルまたはディレクトリの属性を変更します。リードオンリー構成およびミニマム構成ではこの関数はサポートされません。</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -32,7 +32,7 @@ FRESULT f_close (
|
|||||||
<div class="para">
|
<div class="para">
|
||||||
<h4>戻り値</h4>
|
<h4>戻り値</h4>
|
||||||
<dl class="ret">
|
<dl class="ret">
|
||||||
<dt>FR_OK</dt>
|
<dt>FR_OK (0)</dt>
|
||||||
<dd>正常終了。</dd>
|
<dd>正常終了。</dd>
|
||||||
<dt>FR_RW_ERROR</dt>
|
<dt>FR_RW_ERROR</dt>
|
||||||
<dd>ディスクアクセスでエラーが発生した。</dd>
|
<dd>ディスクアクセスでエラーが発生した。</dd>
|
||||||
|
|||||||
@ -20,14 +20,14 @@ DSTATUS disk_status ();
|
|||||||
|
|
||||||
<div class="para">
|
<div class="para">
|
||||||
<h4>戻り値</h4>
|
<h4>戻り値</h4>
|
||||||
<p>ディスクの状態が次のフラグの組み合わせの値で返されます。</p>
|
<p>ディスクドライブの状態が次のフラグの組み合わせの値で返されます。</p>
|
||||||
<dl class="ret">
|
<dl class="ret">
|
||||||
<dt>STA_NOINIT</dt>
|
<dt>STA_NOINIT</dt>
|
||||||
<dd>ドライブが初期化されていないことを示すフラグ。電源ONまたはメディアの取り外しでセットされ、<tt>disk_initialize()</tt>の正常終了でクリア、失敗でセットされます。</dd>
|
<dd>ドライブが初期化されていないことを示すフラグ。電源ONまたはメディアの取り外しでセットされ、<tt>disk_initialize()</tt>の正常終了でクリア、失敗でセットされます。</dd>
|
||||||
<dt>STA_NODISK</dt>
|
<dt>STA_NODISK</dt>
|
||||||
<dd>メディアがセットされていないことを示すフラグ。メディアが取り外されているときセットされ、メディアがセットされているときクリアされます。ハードディスクでは常にクリアされています。</dd>
|
<dd>メディアがセットされていないことを示すフラグ。メディアが取り外されている間はセットされ、メディアがセットされている間はクリアされます。固定ディスクでは常にクリアされています。</dd>
|
||||||
<dt>STA_PROTECTED</dt>
|
<dt>STA_PROTECTED</dt>
|
||||||
<dd>メディアがライトプロテクトされていることを示すフラグ。ライトプロテクトノッチのないメディアでは常にクリアされています。</dd>
|
<dd>メディアがライトプロテクトされていることを示すフラグ。ライトプロテクトノッチをサポートしないメディアでは常にクリアされています。</dd>
|
||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@ -37,7 +37,7 @@ DRESULT disk_write (
|
|||||||
|
|
||||||
<div class="para">
|
<div class="para">
|
||||||
<h4>戻り値</h4>
|
<h4>戻り値</h4>
|
||||||
<dl class="par">
|
<dl class="ret">
|
||||||
<dt>RES_OK</dt>
|
<dt>RES_OK</dt>
|
||||||
<dd>正常終了。</dd>
|
<dd>正常終了。</dd>
|
||||||
<dt>RES_ERROR</dt>
|
<dt>RES_ERROR</dt>
|
||||||
|
|||||||
@ -32,7 +32,7 @@ FRESULT f_getfree (
|
|||||||
<div class="para">
|
<div class="para">
|
||||||
<h4>戻り値</h4>
|
<h4>戻り値</h4>
|
||||||
<dl class="ret">
|
<dl class="ret">
|
||||||
<dt>FR_OK</dt>
|
<dt>FR_OK (0)</dt>
|
||||||
<dd>正常終了。<tt><em>*Clusters</em></tt>に空きクラスタ数が返されます。</dd>
|
<dd>正常終了。<tt><em>*Clusters</em></tt>に空きクラスタ数が返されます。</dd>
|
||||||
<dt>FR_NOT_READY</dt>
|
<dt>FR_NOT_READY</dt>
|
||||||
<dd>メディアがセットされていないなど、ディスクドライブが動作不能状態。</dd>
|
<dd>メディアがセットされていないなど、ディスクドライブが動作不能状態。</dd>
|
||||||
@ -50,7 +50,7 @@ FRESULT f_getfree (
|
|||||||
|
|
||||||
<div class="para">
|
<div class="para">
|
||||||
<h4>解説</h4>
|
<h4>解説</h4>
|
||||||
<p>ファイルシステム上の空きクラスタ数を取得します。<tt>FatFs.sects_clust</tt> がクラスタあたりのセクタ数を示しているので、これを元に実際の空きサイズが計算できます。</p>
|
<p>ファイルシステム上の空きクラスタ数を取得します。<tt>FatFs.sects_clust</tt> がクラスタあたりのセクタ数を示しているので、これを元に実際の空きサイズが計算できます。ミニマム構成ではこの関数はサポートされません。</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -35,7 +35,7 @@ FRESULT f_lseek (
|
|||||||
<div class="para">
|
<div class="para">
|
||||||
<h4>戻り値</h4>
|
<h4>戻り値</h4>
|
||||||
<dl class="ret">
|
<dl class="ret">
|
||||||
<dt>FR_OK</dt>
|
<dt>FR_OK (0)</dt>
|
||||||
<dd>正常終了。</dd>
|
<dd>正常終了。</dd>
|
||||||
<dt>FR_RW_ERROR</dt>
|
<dt>FR_RW_ERROR</dt>
|
||||||
<dd>ディスクアクセスでエラーが発生した。</dd>
|
<dd>ディスクアクセスでエラーが発生した。</dd>
|
||||||
@ -49,14 +49,14 @@ FRESULT f_lseek (
|
|||||||
|
|
||||||
<div class="para">
|
<div class="para">
|
||||||
<h4>解説</h4>
|
<h4>解説</h4>
|
||||||
<p>ファイルR/Wポインタを移動します。オフセットの指定はファイル先頭からのみです。ファイル末尾以降への移動はできません。ファイルサイズ以上のオフセットを指定した場合、R/Wポインタはファイル末尾に移動します。</p>
|
<p>ファイルR/Wポインタを移動します。オフセットの指定はファイル先頭からのみです。ファイル末尾以降への移動はできません。ファイルサイズ以上のオフセットを指定した場合、R/Wポインタはファイルサイズと同じになります。</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para">
|
||||||
<h4>使用例</h4>
|
<h4>使用例</h4>
|
||||||
<pre>
|
<pre>
|
||||||
// ファイルオフセット 5000 へ移動
|
// ファイル先頭から5000バイト目へ移動
|
||||||
res = f_lseek(&file, 5000);
|
res = f_lseek(&file, 5000);
|
||||||
|
|
||||||
// 3000バイト進める
|
// 3000バイト進める
|
||||||
@ -65,7 +65,7 @@ FRESULT f_lseek (
|
|||||||
// 2000バイト戻す
|
// 2000バイト戻す
|
||||||
res = f_lseek(&file, file.fptr - 2000);
|
res = f_lseek(&file, file.fptr - 2000);
|
||||||
|
|
||||||
// ファイル末尾 + 1 へ移動
|
// ファイル追記の準備
|
||||||
res = f_lseek(&file, 0xFFFFFFFF);
|
res = f_lseek(&file, 0xFFFFFFFF);
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -24,7 +24,7 @@ FRESULT f_mkdir (
|
|||||||
<h4>パラメータ</h4>
|
<h4>パラメータ</h4>
|
||||||
<dl class="par">
|
<dl class="par">
|
||||||
<dt>DirName</dt>
|
<dt>DirName</dt>
|
||||||
<dd>作成するディレクトリのフルパス名が入った<tt>'\0'</tt>で終わる文字列へのポインタを指定します。ディレクトリセパレータには<tt>'/'</tt>を使用します。FatFsモジュールにはカレントディレクトリの概念がないので、パスはルートディレクトリから辿る絶対パスとなります。文字列先頭のスペースはスキップされます。パス先頭の<tt>'/'</tt>はあってもなくてもかまいません。</dd>
|
<dd>作成するディレクトリのフルパス名が入った<tt>'\0'</tt>で終わる文字列へのポインタを指定します。ディレクトリセパレータには<tt>'/'</tt>を使用します。FatFsモジュールにはカレントディレクトリの概念がないので、パスはルートディレクトリから辿る絶対パスとなります。文字列先頭のスペースはスキップされます。パス先頭の<tt>'/'</tt>はあってもなくてもかまいません。ミニマム構成ではこの関数はサポートされません。</dd>
|
||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -32,7 +32,7 @@ FRESULT f_mkdir (
|
|||||||
<div class="para">
|
<div class="para">
|
||||||
<h4>戻り値</h4>
|
<h4>戻り値</h4>
|
||||||
<dl class="ret">
|
<dl class="ret">
|
||||||
<dt>FR_OK</dt>
|
<dt>FR_OK (0)</dt>
|
||||||
<dd>正常終了。</dd>
|
<dd>正常終了。</dd>
|
||||||
<dt>FR_NOPATH</dt>
|
<dt>FR_NOPATH</dt>
|
||||||
<dd>パスが見つからない。</dd>
|
<dd>パスが見つからない。</dd>
|
||||||
|
|||||||
@ -21,7 +21,7 @@ FRESULT f_mountdrv ();
|
|||||||
<div class="para">
|
<div class="para">
|
||||||
<h4>戻り値</h4>
|
<h4>戻り値</h4>
|
||||||
<dl class="ret">
|
<dl class="ret">
|
||||||
<dt>FR_OK</dt>
|
<dt>FR_OK (0)</dt>
|
||||||
<dd>正常終了。</dd>
|
<dd>正常終了。</dd>
|
||||||
<dt>FR_NOT_READY</dt>
|
<dt>FR_NOT_READY</dt>
|
||||||
<dd>メディアがセットされていないなど、ディスクドライブが動作不能状態。</dd>
|
<dd>メディアがセットされていないなど、ディスクドライブが動作不能状態。</dd>
|
||||||
@ -37,7 +37,7 @@ FRESULT f_mountdrv ();
|
|||||||
|
|
||||||
<div class="para">
|
<div class="para">
|
||||||
<h4>解説</h4>
|
<h4>解説</h4>
|
||||||
<p>ファイルシステムを初期化(マウント)して他の全てのファイル関数が使える状態にします。FatFsモジュールではマウント動作はファイル関数呼び出し時に必要に応じて行われるため、通常はこの関数を使用する必要はありません。自動マウント動作中に回復不能エラー(たとえば<tt>FR_INCORRECT_DISK_CHANGE</tt>)が発生した場合、全てのファイル関数が使えなくなるので、そのときはこの関数で強制マウントして回復します。</p>
|
<p>ファイルシステムを初期化(マウント)して他の全てのファイル関数が使える状態にします。通常はこの関数を使用する必要はありません。FatFsモジュールではマウント動作はファイル関数呼び出し時に必要に応じて行われます。自動マウント動作中に回復不能エラー(たとえば<tt>FR_INCORRECT_DISK_CHANGE</tt>)が発生した場合、全てのファイル関数が使えなくなるので、そのときはこの関数で強制マウントして回復します。</p>
|
||||||
<p>FatFsモジュールの使用を終了するには、全てのファイルを閉じたあとグローバル変数<tt>FatFs</tt>をクリアします。その後、ワークエリアは解放できます。f_mountdrv関数内では次の処理が行われます。</p>
|
<p>FatFsモジュールの使用を終了するには、全てのファイルを閉じたあとグローバル変数<tt>FatFs</tt>をクリアします。その後、ワークエリアは解放できます。f_mountdrv関数内では次の処理が行われます。</p>
|
||||||
<br>
|
<br>
|
||||||
<ul>
|
<ul>
|
||||||
|
|||||||
@ -47,7 +47,7 @@ FRESULT f_open (
|
|||||||
<div class="para">
|
<div class="para">
|
||||||
<h4>戻り値</h4>
|
<h4>戻り値</h4>
|
||||||
<dl class="ret">
|
<dl class="ret">
|
||||||
<dt>FR_OK</dt>
|
<dt>FR_OK (0)</dt>
|
||||||
<dd>正常終了。以降、<tt><em>FileObject</em></tt>構造体を使ってこのファイルを操作できます。ファイルを閉じるときは、<tt><a href="close.html">f_close()</a></tt>を使用します。</dd>
|
<dd>正常終了。以降、<tt><em>FileObject</em></tt>構造体を使ってこのファイルを操作できます。ファイルを閉じるときは、<tt><a href="close.html">f_close()</a></tt>を使用します。</dd>
|
||||||
<dt>FR_NOFILE</dt>
|
<dt>FR_NOFILE</dt>
|
||||||
<dd>ファイルが見つからない。</dd>
|
<dd>ファイルが見つからない。</dd>
|
||||||
|
|||||||
@ -35,7 +35,7 @@ FRESULT f_opendir (
|
|||||||
<div class="para">
|
<div class="para">
|
||||||
<h4>戻り値</h4>
|
<h4>戻り値</h4>
|
||||||
<dl class="ret">
|
<dl class="ret">
|
||||||
<dt>FR_OK</dt>
|
<dt>FR_OK (0)</dt>
|
||||||
<dd>正常終了。</dd>
|
<dd>正常終了。</dd>
|
||||||
<dt>FR_NOPATH</dt>
|
<dt>FR_NOPATH</dt>
|
||||||
<dd>パスが見つからない。</dd>
|
<dd>パスが見つからない。</dd>
|
||||||
@ -57,7 +57,7 @@ FRESULT f_opendir (
|
|||||||
|
|
||||||
<div class="para">
|
<div class="para">
|
||||||
<h4>解説</h4>
|
<h4>解説</h4>
|
||||||
<p>ディレクトリをオープンします。正常終了したら、<tt><em>DirObject</em></tt>構造体を使ってこのディレクトリの項目を順次読み出せます。使用後の処理は必要ありません。<tt><em>DirObject</em></tt>構造体は任意の時点で破棄できます。</p>
|
<p>ディレクトリをオープンします。正常終了したら、<tt><em>DirObject</em></tt>構造体を使ってこのディレクトリの項目を順次読み出せます。使用後の処理は必要ありません。<tt><em>DirObject</em></tt>構造体は任意の時点で破棄できます。ミニマム構成ではこの関数はサポートされません。</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -16,7 +16,7 @@
|
|||||||
<pre>
|
<pre>
|
||||||
FRESULT f_read (
|
FRESULT f_read (
|
||||||
FIL* <em>FileObject</em>, // ファイルオブジェクト構造体
|
FIL* <em>FileObject</em>, // ファイルオブジェクト構造体
|
||||||
BYTE* <em>Buffer</em>, // 読み出したデータを格納するバッファ
|
void* <em>Buffer</em>, // 読み出したデータを格納するバッファ
|
||||||
WORD <em>ByteToRead</em>, // 読み出すバイト数
|
WORD <em>ByteToRead</em>, // 読み出すバイト数
|
||||||
WORD* <em>ByteRead</em> // 読み出されたバイト数
|
WORD* <em>ByteRead</em> // 読み出されたバイト数
|
||||||
);
|
);
|
||||||
@ -41,7 +41,7 @@ FRESULT f_read (
|
|||||||
<div class="para">
|
<div class="para">
|
||||||
<h4>戻り値</h4>
|
<h4>戻り値</h4>
|
||||||
<dl class="ret">
|
<dl class="ret">
|
||||||
<dt>FR_OK</dt>
|
<dt>FR_OK (0)</dt>
|
||||||
<dd>正常終了。</dd>
|
<dd>正常終了。</dd>
|
||||||
<dt>FR_DENIED</dt>
|
<dt>FR_DENIED</dt>
|
||||||
<dd>書き込み専用モードで開いたファイルから読み込もうとした。</dd>
|
<dd>書き込み専用モードで開いたファイルから読み込もうとした。</dd>
|
||||||
|
|||||||
@ -35,7 +35,7 @@ FRESULT f_readdir (
|
|||||||
<div class="para">
|
<div class="para">
|
||||||
<h4>戻り値</h4>
|
<h4>戻り値</h4>
|
||||||
<dl class="ret">
|
<dl class="ret">
|
||||||
<dt>FR_OK</dt>
|
<dt>FR_OK (0)</dt>
|
||||||
<dd>正常終了。</dd>
|
<dd>正常終了。</dd>
|
||||||
<dt>FR_NOT_READY</dt>
|
<dt>FR_NOT_READY</dt>
|
||||||
<dd>メディアがセットされていないなど、ディスクドライブが動作不能状態。</dd>
|
<dd>メディアがセットされていないなど、ディスクドライブが動作不能状態。</dd>
|
||||||
@ -49,7 +49,7 @@ FRESULT f_readdir (
|
|||||||
|
|
||||||
<div class="para">
|
<div class="para">
|
||||||
<h4>解説</h4>
|
<h4>解説</h4>
|
||||||
<p>ディレクトリ項目を順次読み出します。この関数を繰り返し実行することによりディレクトリの全ての項目を読み出すことができます。全ての項目を読み出し、読み出す項目がもう無いときは、<tt>f_name[]</tt>メンバにヌル文字列が返されます。得られるファイル情報の詳細については <tt>FILINFO</tt>構造体を参照してください。</p>
|
<p>ディレクトリ項目を順次読み出します。この関数を繰り返し実行することによりディレクトリの全ての項目を読み出すことができます。全ての項目を読み出し、読み出す項目がもう無いときは、<tt>f_name[]</tt>メンバにヌル文字列が返されます。得られるファイル情報の詳細については <tt>FILINFO</tt>構造体を参照してください。ミニマム構成ではこの関数はサポートされません。</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -25,7 +25,7 @@ FRESULT f_stat (
|
|||||||
<h4>パラメータ</h4>
|
<h4>パラメータ</h4>
|
||||||
<dl class="par">
|
<dl class="par">
|
||||||
<dt>FileName</dt>
|
<dt>FileName</dt>
|
||||||
<dd>情報を得るファイルまたはディレクトリ名の<tt>'\0'</tt>で終わる文字列を指すポインタを指定します。</dd>
|
<dd>情報を得るファイルまたはディレクトリ名の<tt>'\0'</tt>で終わる文字列を指すポインタを指定します。ルートディレクトリの指定は禁止です。</dd>
|
||||||
<dt>FileInfo</dt>
|
<dt>FileInfo</dt>
|
||||||
<dd>読み出し結果を格納するファイル情報構造体へのポインタを指定します。</dd>
|
<dd>読み出し結果を格納するファイル情報構造体へのポインタを指定します。</dd>
|
||||||
</dl>
|
</dl>
|
||||||
@ -35,7 +35,7 @@ FRESULT f_stat (
|
|||||||
<div class="para">
|
<div class="para">
|
||||||
<h4>戻り値</h4>
|
<h4>戻り値</h4>
|
||||||
<dl class="ret">
|
<dl class="ret">
|
||||||
<dt>FR_OK</dt>
|
<dt>FR_OK (0)</dt>
|
||||||
<dd>正常終了。</dd>
|
<dd>正常終了。</dd>
|
||||||
<dt>FR_NOPATH</dt>
|
<dt>FR_NOPATH</dt>
|
||||||
<dd>パスが見つからない。</dd>
|
<dd>パスが見つからない。</dd>
|
||||||
@ -57,7 +57,7 @@ FRESULT f_stat (
|
|||||||
|
|
||||||
<div class="para">
|
<div class="para">
|
||||||
<h4>解説</h4>
|
<h4>解説</h4>
|
||||||
<p>ファイルまたはディレクトリに関する情報を得ます。得られるファイル情報の詳細については <tt>FILINFO</tt>構造体を参照してください。</p>
|
<p>ファイルまたはディレクトリに関する情報を得ます。得られるファイル情報の詳細については <tt>FILINFO</tt>構造体を参照してください。ミニマム構成ではこの関数はサポートされません。</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -32,7 +32,7 @@ FRESULT f_sync (
|
|||||||
<div class="para">
|
<div class="para">
|
||||||
<h4>戻り値</h4>
|
<h4>戻り値</h4>
|
||||||
<dl class="ret">
|
<dl class="ret">
|
||||||
<dt>FR_OK</dt>
|
<dt>FR_OK (0)</dt>
|
||||||
<dd>正常終了。</dd>
|
<dd>正常終了。</dd>
|
||||||
<dt>FR_RW_ERROR</dt>
|
<dt>FR_RW_ERROR</dt>
|
||||||
<dd>ディスクアクセスでエラーが発生した。</dd>
|
<dd>ディスクアクセスでエラーが発生した。</dd>
|
||||||
|
|||||||
@ -24,7 +24,7 @@ FRESULT f_unlink (
|
|||||||
<h4>パラメータ</h4>
|
<h4>パラメータ</h4>
|
||||||
<dl class="par">
|
<dl class="par">
|
||||||
<dt>FileName</dt>
|
<dt>FileName</dt>
|
||||||
<dd>削除対象のファイルまたはディレクトリ名の入った<tt>'\0'</tt>で終わる文字列へのポインタを指定します。リードオンリー構成ではこの関数はサポートされません。</dd>
|
<dd>削除対象のファイルまたはディレクトリ名の入った<tt>'\0'</tt>で終わる文字列へのポインタを指定します。リードオンリー構成およびミニマム構成ではこの関数はサポートされません。</dd>
|
||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -32,7 +32,7 @@ FRESULT f_unlink (
|
|||||||
<div class="para">
|
<div class="para">
|
||||||
<h4>戻り値</h4>
|
<h4>戻り値</h4>
|
||||||
<dl class="ret">
|
<dl class="ret">
|
||||||
<dt>FR_OK</dt>
|
<dt>FR_OK (0)</dt>
|
||||||
<dd>正常終了。</dd>
|
<dd>正常終了。</dd>
|
||||||
<dt>FR_NOFILE</dt>
|
<dt>FR_NOFILE</dt>
|
||||||
<dd>ファイルが見つからない。</dd>
|
<dd>ファイルが見つからない。</dd>
|
||||||
|
|||||||
@ -16,7 +16,7 @@
|
|||||||
<pre>
|
<pre>
|
||||||
FRESULT f_write (
|
FRESULT f_write (
|
||||||
FIL* <em>FileObject</em>, // ファイルオブジェクト構造体
|
FIL* <em>FileObject</em>, // ファイルオブジェクト構造体
|
||||||
const BYTE* <em>Buffer</em>, // 書き込みデータ
|
const void* <em>Buffer</em>, // 書き込みデータ
|
||||||
WORD <em>ByteToWrite</em>, // 書き込むバイト数
|
WORD <em>ByteToWrite</em>, // 書き込むバイト数
|
||||||
WORD* <em>ByteWritten</em> // 書き込まれたバイト数
|
WORD* <em>ByteWritten</em> // 書き込まれたバイト数
|
||||||
);
|
);
|
||||||
@ -41,7 +41,7 @@ FRESULT f_write (
|
|||||||
<div class="para">
|
<div class="para">
|
||||||
<h4>戻り値</h4>
|
<h4>戻り値</h4>
|
||||||
<dl class="ret">
|
<dl class="ret">
|
||||||
<dt>FR_OK</dt>
|
<dt>FR_OK (0)</dt>
|
||||||
<dd>正常終了。</dd>
|
<dd>正常終了。</dd>
|
||||||
<dt>FR_DENIED</dt>
|
<dt>FR_DENIED</dt>
|
||||||
<dd>読み込み専用モードで開いたファイルに書き込もうとした。</dd>
|
<dd>読み込み専用モードで開いたファイルに書き込もうとした。</dd>
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
FatFs/Tiny-FatFs Module Source Files R0.02 (C)ChaN, 2006
|
FatFs/Tiny-FatFs Module Source Files R0.02a (C)ChaN, 2006
|
||||||
|
|
||||||
|
|
||||||
Files
|
Files
|
||||||
@ -19,31 +19,58 @@ Files
|
|||||||
|
|
||||||
Configuration Options
|
Configuration Options
|
||||||
|
|
||||||
There are several configuration options for various envilonment and requirement.
|
There are several configuration options for various envilonment and
|
||||||
The configuration options are in include files, ff.h and tff.h.
|
requirement. The configuration options are in include files, ff.h and
|
||||||
|
tff.h.
|
||||||
|
|
||||||
#define _BYTE_ACC
|
_BYTE_ACC
|
||||||
|
|
||||||
This is the most impotant option that depends on the processor architecture.
|
This is the most impotant option that depends on the processor architecture.
|
||||||
When your microcontroller corresponds to either or both of following terms, the
|
When your microcontroller corresponds to either or both of following terms,
|
||||||
_BYTE_ACC must be defined.
|
the _BYTE_ACC must be defined.
|
||||||
|
|
||||||
- Muti-byte integers (short, long) are stored in Big-Endian.
|
- Muti-byte integers (short, long) are stored in Big-Endian.
|
||||||
- Address unaligned word access causes an address error or incorrect behavior.
|
- An address unaligned word access causes an address error or any incorrect
|
||||||
|
behavior.
|
||||||
|
|
||||||
|
|
||||||
#define _FS_READONLY
|
_FS_READONLY
|
||||||
|
|
||||||
When application program does not require any write function, _FS_READONLY can be
|
When application program does not require any write function, _FS_READONLY
|
||||||
defined to eliminate writing code to reduce module size.
|
can be defined to eliminate writing code to reduce module size.
|
||||||
|
|
||||||
|
|
||||||
#define _USE_SJIS
|
_FS_MINIMUM
|
||||||
|
|
||||||
|
When application program requires only file read/write function, _FS_MINIMUM
|
||||||
|
can be defined to eliminate other functions to reduce module size.
|
||||||
|
|
||||||
|
|
||||||
|
_USE_SJIS
|
||||||
|
|
||||||
When _USE_SJIS is defined, Shift-JIS code set can be used as a file name,
|
When _USE_SJIS is defined, Shift-JIS code set can be used as a file name,
|
||||||
otherwire second byte of double-byte characters will be collapted.
|
otherwire second byte of double-byte characters will be collapted.
|
||||||
|
|
||||||
|
|
||||||
|
Following list shows which function is removed by configuratin options.
|
||||||
|
|
||||||
|
_FS_MINIMUM _FS_READONLY
|
||||||
|
f_open
|
||||||
|
f_read
|
||||||
|
f_write x
|
||||||
|
f_close
|
||||||
|
f_sync x
|
||||||
|
f_lseek
|
||||||
|
f_opendir x
|
||||||
|
f_readdir x
|
||||||
|
f_stat x
|
||||||
|
f_getfree x
|
||||||
|
f_unlink x x
|
||||||
|
f_mkdir x x
|
||||||
|
f_chmod x x
|
||||||
|
f_mountdrv
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Agreements
|
Agreements
|
||||||
|
|
||||||
@ -60,3 +87,4 @@ Revision History
|
|||||||
Apr 29, 2006 R0.01 First stable version
|
Apr 29, 2006 R0.01 First stable version
|
||||||
Jun 01, 2006 R0.02 Added FAT12. Removed unbuffered mode.
|
Jun 01, 2006 R0.02 Added FAT12. Removed unbuffered mode.
|
||||||
Fixed a problem on small (<32M) patition.
|
Fixed a problem on small (<32M) patition.
|
||||||
|
Jun 10, 2006 R0.02a Added a configuration option _FS_MINIMUM.
|
||||||
|
|||||||
@ -51,6 +51,7 @@ void disk_timerproc ();
|
|||||||
#define MMC_GET_OCR 12
|
#define MMC_GET_OCR 12
|
||||||
#define ATA_GET_REV 20
|
#define ATA_GET_REV 20
|
||||||
#define ATA_GET_MODEL 21
|
#define ATA_GET_MODEL 21
|
||||||
|
#define ATA_GET_SN 22
|
||||||
|
|
||||||
|
|
||||||
#define _DISKIF
|
#define _DISKIF
|
||||||
|
|||||||
52
src/ff.c
52
src/ff.c
@ -1,15 +1,16 @@
|
|||||||
/*--------------------------------------------------------------------------/
|
/*--------------------------------------------------------------------------/
|
||||||
/ FatFs - FAT file system module R0.02 (C)ChaN, 2006
|
/ FatFs - FAT file system module R0.02a (C)ChaN, 2006
|
||||||
/---------------------------------------------------------------------------/
|
/---------------------------------------------------------------------------/
|
||||||
/ FatFs module is an experimenal project to implement FAT file system to
|
/ FatFs module is an experimenal project to implement FAT file system to
|
||||||
/ cheap microcontrollers. This is opened for education, reserch and
|
/ cheap microcontrollers. This is a freeware and is opened for education,
|
||||||
/ development. You can use, modify and republish it for non-profit or profit
|
/ research and development. You can use, modify and republish it for
|
||||||
/ use without any limitation under your responsibility.
|
/ non-profit or profit use without any limitation under your responsibility.
|
||||||
/---------------------------------------------------------------------------/
|
/---------------------------------------------------------------------------/
|
||||||
/ Feb 26, 2006 R0.00 Prototype.
|
/ Feb 26, 2006 R0.00 Prototype.
|
||||||
/ Apr 29, 2006 R0.01 First stable version.
|
/ Apr 29, 2006 R0.01 First stable version.
|
||||||
/ Jun 01, 2006 R0.02 Added FAT12. Removed unbuffered mode.
|
/ Jun 01, 2006 R0.02 Added FAT12. Removed unbuffered mode.
|
||||||
/ Fixed a problem on small (<32M) patition.
|
/ Fixed a problem on small (<32M) patition.
|
||||||
|
/ Jun 10, 2006 R0.02a Added a configuration option (_FS_MINIMUM).
|
||||||
/---------------------------------------------------------------------------*/
|
/---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@ -144,7 +145,7 @@ BOOL put_cluster (
|
|||||||
fs->winflag = 1;
|
fs->winflag = 1;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* _FS_READONLY */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -210,7 +211,7 @@ DWORD create_chain (
|
|||||||
|
|
||||||
return ncl; /* Return new cluster number */
|
return ncl; /* Return new cluster number */
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* _FS_READONLY */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -243,7 +244,7 @@ BYTE check_fs (
|
|||||||
static const char fatsign[] = "FAT12FAT16FAT32";
|
static const char fatsign[] = "FAT12FAT16FAT32";
|
||||||
FATFS *fs = FatFs;
|
FATFS *fs = FatFs;
|
||||||
|
|
||||||
|
/* Determines FAT type by signature string but this is not correct */
|
||||||
memset(fs->win, 0, 512);
|
memset(fs->win, 0, 512);
|
||||||
if (disk_read(fs->win, sect, 1) == RES_OK) { /* Load boot record */
|
if (disk_read(fs->win, sect, 1) == RES_OK) { /* Load boot record */
|
||||||
if (LD_WORD(&(fs->win[510])) == 0xAA55) { /* Is it valid? */
|
if (LD_WORD(&(fs->win[510])) == 0xAA55) { /* Is it valid? */
|
||||||
@ -297,6 +298,7 @@ BOOL next_dir_entry (
|
|||||||
/*--------------------------------------*/
|
/*--------------------------------------*/
|
||||||
/* Get File Status from Directory Entry */
|
/* Get File Status from Directory Entry */
|
||||||
|
|
||||||
|
#ifndef _FS_MINIMUM
|
||||||
static
|
static
|
||||||
void get_fileinfo (
|
void get_fileinfo (
|
||||||
FILINFO *finfo, /* Ptr to Store the File Information */
|
FILINFO *finfo, /* Ptr to Store the File Information */
|
||||||
@ -332,6 +334,7 @@ void get_fileinfo (
|
|||||||
finfo->fdate = LD_WORD(dir+24); /* Date */
|
finfo->fdate = LD_WORD(dir+24); /* Date */
|
||||||
finfo->ftime = LD_WORD(dir+22); /* Time */
|
finfo->ftime = LD_WORD(dir+22); /* Time */
|
||||||
}
|
}
|
||||||
|
#endif /* _FS_MINIMUM */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -502,7 +505,7 @@ BYTE* reserve_direntry (
|
|||||||
fs->winflag = 1;
|
fs->winflag = 1;
|
||||||
return fs->win;
|
return fs->win;
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* _FS_READONLY */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -699,7 +702,7 @@ FRESULT f_open (
|
|||||||
}
|
}
|
||||||
/* Open a File */
|
/* Open a File */
|
||||||
else {
|
else {
|
||||||
#endif
|
#endif /* _FS_READONLY */
|
||||||
if (res != FR_OK) return res; /* Trace failed */
|
if (res != FR_OK) return res; /* Trace failed */
|
||||||
if ((dir == NULL) || (*(dir+11) & AM_DIR)) /* It is a directory */
|
if ((dir == NULL) || (*(dir+11) & AM_DIR)) /* It is a directory */
|
||||||
return FR_NO_FILE;
|
return FR_NO_FILE;
|
||||||
@ -731,14 +734,14 @@ FRESULT f_open (
|
|||||||
|
|
||||||
FRESULT f_read (
|
FRESULT f_read (
|
||||||
FIL *fp, /* Pointer to the file object */
|
FIL *fp, /* Pointer to the file object */
|
||||||
BYTE *buff, /* Pointer to data buffer */
|
void *buff, /* Pointer to data buffer */
|
||||||
WORD btr, /* Number of bytes to read */
|
WORD btr, /* Number of bytes to read */
|
||||||
WORD *br /* Pointer to number of bytes read */
|
WORD *br /* Pointer to number of bytes read */
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
DWORD clust, sect, ln;
|
DWORD clust, sect, ln;
|
||||||
WORD rcnt;
|
WORD rcnt;
|
||||||
BYTE cc;
|
BYTE cc, *rbuff = buff;
|
||||||
FATFS *fs = FatFs;
|
FATFS *fs = FatFs;
|
||||||
|
|
||||||
|
|
||||||
@ -751,7 +754,7 @@ FRESULT f_read (
|
|||||||
if (btr > ln) btr = ln; /* Truncate read count by number of bytes left */
|
if (btr > ln) btr = ln; /* Truncate read count by number of bytes left */
|
||||||
|
|
||||||
for ( ; btr; /* Repeat until all data transferred */
|
for ( ; btr; /* Repeat until all data transferred */
|
||||||
buff += rcnt, fp->fptr += rcnt, *br += rcnt, btr -= rcnt) {
|
rbuff += rcnt, fp->fptr += rcnt, *br += rcnt, btr -= rcnt) {
|
||||||
if ((fp->fptr % 512) == 0) { /* On the sector boundary */
|
if ((fp->fptr % 512) == 0) { /* On the sector boundary */
|
||||||
if (--(fp->sect_clust)) { /* Decrement sector counter */
|
if (--(fp->sect_clust)) { /* Decrement sector counter */
|
||||||
sect = fp->curr_sect + 1; /* Next sector */
|
sect = fp->curr_sect + 1; /* Next sector */
|
||||||
@ -772,7 +775,7 @@ FRESULT f_read (
|
|||||||
cc = btr / 512; /* When left bytes >= 512 */
|
cc = btr / 512; /* When left bytes >= 512 */
|
||||||
if (cc) { /* Read maximum contiguous sectors */
|
if (cc) { /* Read maximum contiguous sectors */
|
||||||
if (cc > fp->sect_clust) cc = fp->sect_clust;
|
if (cc > fp->sect_clust) cc = fp->sect_clust;
|
||||||
if (disk_read(buff, sect, cc) != RES_OK) goto fr_error;
|
if (disk_read(rbuff, sect, cc) != RES_OK) goto fr_error;
|
||||||
fp->sect_clust -= cc - 1;
|
fp->sect_clust -= cc - 1;
|
||||||
fp->curr_sect += cc - 1;
|
fp->curr_sect += cc - 1;
|
||||||
rcnt = cc * 512; continue;
|
rcnt = cc * 512; continue;
|
||||||
@ -782,7 +785,7 @@ FRESULT f_read (
|
|||||||
}
|
}
|
||||||
rcnt = 512 - (fp->fptr % 512); /* Copy fractional bytes from file I/O buffer */
|
rcnt = 512 - (fp->fptr % 512); /* Copy fractional bytes from file I/O buffer */
|
||||||
if (rcnt > btr) rcnt = btr;
|
if (rcnt > btr) rcnt = btr;
|
||||||
memcpy(buff, &fp->buffer[fp->fptr % 512], rcnt);
|
memcpy(rbuff, &fp->buffer[fp->fptr % 512], rcnt);
|
||||||
}
|
}
|
||||||
|
|
||||||
return FR_OK;
|
return FR_OK;
|
||||||
@ -800,7 +803,7 @@ fr_error: /* Abort this file due to an unrecoverable error */
|
|||||||
#ifndef _FS_READONLY
|
#ifndef _FS_READONLY
|
||||||
FRESULT f_write (
|
FRESULT f_write (
|
||||||
FIL *fp, /* Pointer to the file object */
|
FIL *fp, /* Pointer to the file object */
|
||||||
const BYTE *buff, /* Pointer to the data to be written */
|
const void *buff, /* Pointer to the data to be written */
|
||||||
WORD btw, /* Number of bytes to write */
|
WORD btw, /* Number of bytes to write */
|
||||||
WORD *bw /* Pointer to number of bytes written */
|
WORD *bw /* Pointer to number of bytes written */
|
||||||
)
|
)
|
||||||
@ -808,6 +811,7 @@ FRESULT f_write (
|
|||||||
DWORD clust, sect;
|
DWORD clust, sect;
|
||||||
WORD wcnt;
|
WORD wcnt;
|
||||||
BYTE cc;
|
BYTE cc;
|
||||||
|
const BYTE *wbuff = buff;
|
||||||
FATFS *fs = FatFs;
|
FATFS *fs = FatFs;
|
||||||
|
|
||||||
|
|
||||||
@ -819,7 +823,7 @@ FRESULT f_write (
|
|||||||
if (fp->fsize + btw < fp->fsize) btw = 0; /* File size cannot reach 4GB */
|
if (fp->fsize + btw < fp->fsize) btw = 0; /* File size cannot reach 4GB */
|
||||||
|
|
||||||
for ( ; btw; /* Repeat until all data transferred */
|
for ( ; btw; /* Repeat until all data transferred */
|
||||||
buff += wcnt, fp->fptr += wcnt, *bw += wcnt, btw -= wcnt) {
|
wbuff += wcnt, fp->fptr += wcnt, *bw += wcnt, btw -= wcnt) {
|
||||||
if ((fp->fptr % 512) == 0) { /* On the sector boundary */
|
if ((fp->fptr % 512) == 0) { /* On the sector boundary */
|
||||||
if (--(fp->sect_clust)) { /* Decrement sector counter */
|
if (--(fp->sect_clust)) { /* Decrement sector counter */
|
||||||
sect = fp->curr_sect + 1; /* Next sector */
|
sect = fp->curr_sect + 1; /* Next sector */
|
||||||
@ -844,7 +848,7 @@ FRESULT f_write (
|
|||||||
cc = btw / 512; /* When left bytes >= 512 */
|
cc = btw / 512; /* When left bytes >= 512 */
|
||||||
if (cc) { /* Write maximum contiguous sectors */
|
if (cc) { /* Write maximum contiguous sectors */
|
||||||
if (cc > fp->sect_clust) cc = fp->sect_clust;
|
if (cc > fp->sect_clust) cc = fp->sect_clust;
|
||||||
if (disk_write(buff, sect, cc) != RES_OK) goto fw_error;
|
if (disk_write(wbuff, sect, cc) != RES_OK) goto fw_error;
|
||||||
fp->sect_clust -= cc - 1;
|
fp->sect_clust -= cc - 1;
|
||||||
fp->curr_sect += cc - 1;
|
fp->curr_sect += cc - 1;
|
||||||
wcnt = cc * 512; continue;
|
wcnt = cc * 512; continue;
|
||||||
@ -855,7 +859,7 @@ FRESULT f_write (
|
|||||||
}
|
}
|
||||||
wcnt = 512 - (fp->fptr % 512); /* Copy fractional bytes to file I/O buffer */
|
wcnt = 512 - (fp->fptr % 512); /* Copy fractional bytes to file I/O buffer */
|
||||||
if (wcnt > btw) wcnt = btw;
|
if (wcnt > btw) wcnt = btw;
|
||||||
memcpy(&fp->buffer[fp->fptr % 512], buff, wcnt);
|
memcpy(&fp->buffer[fp->fptr % 512], wbuff, wcnt);
|
||||||
fp->flag |= FA__DIRTY;
|
fp->flag |= FA__DIRTY;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -867,7 +871,7 @@ fw_error: /* Abort this file due to an unrecoverable error */
|
|||||||
fp->flag |= FA__ERROR;
|
fp->flag |= FA__ERROR;
|
||||||
return FR_RW_ERROR;
|
return FR_RW_ERROR;
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* _FS_READONLY */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -961,7 +965,7 @@ FRESULT f_sync (
|
|||||||
|
|
||||||
return FR_OK;
|
return FR_OK;
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* _FS_READONLY */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -989,6 +993,7 @@ FRESULT f_close (
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef _FS_MINIMUM
|
||||||
/*------------------------------*/
|
/*------------------------------*/
|
||||||
/* Delete a File or a Directory */
|
/* Delete a File or a Directory */
|
||||||
|
|
||||||
@ -1036,7 +1041,7 @@ FRESULT f_unlink (
|
|||||||
|
|
||||||
return FR_OK;
|
return FR_OK;
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* _FS_READONLY */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -1104,7 +1109,7 @@ FRESULT f_mkdir (
|
|||||||
|
|
||||||
return FR_OK;
|
return FR_OK;
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* _FS_READONLY */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -1233,6 +1238,7 @@ FRESULT f_chmod (
|
|||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* _FS_READONLY */
|
||||||
|
|
||||||
|
#endif /* _FS_MINIMUM */
|
||||||
|
|
||||||
|
|||||||
17
src/ff.h
17
src/ff.h
@ -1,5 +1,5 @@
|
|||||||
/*--------------------------------------------------------------------------/
|
/*--------------------------------------------------------------------------/
|
||||||
/ FatFs - FAT file system module include file R0.01 (C)ChaN, 2006
|
/ FatFs - FAT file system module include file R0.02a (C)ChaN, 2006
|
||||||
/---------------------------------------------------------------------------/
|
/---------------------------------------------------------------------------/
|
||||||
/ FatFs module is an experimenal project to implement FAT file system to
|
/ FatFs module is an experimenal project to implement FAT file system to
|
||||||
/ cheap microcontrollers. This is opened for education, reserch and
|
/ cheap microcontrollers. This is opened for education, reserch and
|
||||||
@ -10,14 +10,17 @@
|
|||||||
#ifndef _FATFS
|
#ifndef _FATFS
|
||||||
|
|
||||||
//#define _BYTE_ACC
|
//#define _BYTE_ACC
|
||||||
/* This enables byte-by-byte access for multi-byte variables */
|
/* This enables byte-by-byte access for multi-byte variables. It must be defined
|
||||||
/* It must be defined on the big-endian processor, or to prevent address error */
|
on the big-endian processor, or to prevent address error. */
|
||||||
|
|
||||||
//#define _FS_READONLY
|
//#define _FS_READONLY
|
||||||
/* This removes writing code for read-only applications */
|
/* Read only configuration. This removes writing code for read-only applications. */
|
||||||
|
|
||||||
|
//#define _FS_MINIMUM
|
||||||
|
/* Minimum configuration. This removes some functions to reduce module size. */
|
||||||
|
|
||||||
#define _USE_SJIS
|
#define _USE_SJIS
|
||||||
/* This enables Shift-JIS code transparency, or only US-ASCII file name can be accepted */
|
/* This enables Shift-JIS code transparency, or only US-ASCII file name can be accepted. */
|
||||||
|
|
||||||
|
|
||||||
#include "integer.h"
|
#include "integer.h"
|
||||||
@ -89,7 +92,7 @@ typedef struct _FILINFO {
|
|||||||
extern FATFS *FatFs; /* Pointer to active file system object */
|
extern FATFS *FatFs; /* Pointer to active file system object */
|
||||||
|
|
||||||
FRESULT f_open (FIL*, const char*, BYTE); /* Open or create a file */
|
FRESULT f_open (FIL*, const char*, BYTE); /* Open or create a file */
|
||||||
FRESULT f_read (FIL*, BYTE*, WORD, WORD*); /* Read file */
|
FRESULT f_read (FIL*, void*, WORD, WORD*); /* Read file */
|
||||||
FRESULT f_close (FIL*); /* Close file */
|
FRESULT f_close (FIL*); /* Close file */
|
||||||
FRESULT f_lseek (FIL*, DWORD); /* Seek file pointer */
|
FRESULT f_lseek (FIL*, DWORD); /* Seek file pointer */
|
||||||
FRESULT f_opendir (DIR*, const char*); /* Initialize to read a directory */
|
FRESULT f_opendir (DIR*, const char*); /* Initialize to read a directory */
|
||||||
@ -98,7 +101,7 @@ FRESULT f_stat (const char*, FILINFO*); /* Get file status */
|
|||||||
FRESULT f_getfree (DWORD*); /* Get number of free clusters */
|
FRESULT f_getfree (DWORD*); /* Get number of free clusters */
|
||||||
FRESULT f_mountdrv (); /* Force initialized the file system */
|
FRESULT f_mountdrv (); /* Force initialized the file system */
|
||||||
#ifndef _FS_READONLY
|
#ifndef _FS_READONLY
|
||||||
FRESULT f_write (FIL*, const BYTE*, WORD, WORD*); /* Write file */
|
FRESULT f_write (FIL*, const void*, WORD, WORD*); /* Write file */
|
||||||
FRESULT f_sync (FIL*); /* Flush cached information of a writing file */
|
FRESULT f_sync (FIL*); /* Flush cached information of a writing file */
|
||||||
FRESULT f_unlink (const char*); /* Delete a file or directory */
|
FRESULT f_unlink (const char*); /* Delete a file or directory */
|
||||||
FRESULT f_mkdir (const char*); /* Create a directory */
|
FRESULT f_mkdir (const char*); /* Create a directory */
|
||||||
|
|||||||
53
src/tff.c
53
src/tff.c
@ -1,15 +1,16 @@
|
|||||||
/*--------------------------------------------------------------------------/
|
/*--------------------------------------------------------------------------/
|
||||||
/ Tiny FatFs - FAT file system module R0.02 (C)ChaN, 2006
|
/ Tiny FatFs - FAT file system module R0.02a (C)ChaN, 2006
|
||||||
/---------------------------------------------------------------------------/
|
/---------------------------------------------------------------------------/
|
||||||
/ FatFs module is an experimenal project to implement FAT file system to
|
/ FatFs module is an experimenal project to implement FAT file system to
|
||||||
/ cheap microcontrollers. This is opened for education, reserch and
|
/ cheap microcontrollers. This is a freeware and is opened for education,
|
||||||
/ development. You can use, modify and republish it for non-profit or profit
|
/ research and development. You can use, modify and republish it for
|
||||||
/ use without any limitation under your responsibility.
|
/ non-profit or profit use without any limitation under your responsibility.
|
||||||
/---------------------------------------------------------------------------/
|
/---------------------------------------------------------------------------/
|
||||||
/ Feb 26, 2006 R0.00 Prototype
|
/ Feb 26, 2006 R0.00 Prototype
|
||||||
/ Apr 29, 2006 R0.01 First stable version
|
/ Apr 29, 2006 R0.01 First stable version
|
||||||
/ Jun 01, 2006 R0.02 Added FAT12. Removed unbuffered mode.
|
/ Jun 01, 2006 R0.02 Added FAT12. Removed unbuffered mode.
|
||||||
/ Fixed a problem on small (<32M) patition.
|
/ Fixed a problem on small (<32M) patition.
|
||||||
|
/ Jun 10, 2006 R0.02a Added a configuration option (_FS_MINIMUM).
|
||||||
/---------------------------------------------------------------------------*/
|
/---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
||||||
@ -126,7 +127,7 @@ BOOL put_cluster (
|
|||||||
fs->winflag = 1;
|
fs->winflag = 1;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* _FS_READONLY */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -192,7 +193,7 @@ DWORD create_chain (
|
|||||||
|
|
||||||
return ncl; /* Return new cluster number */
|
return ncl; /* Return new cluster number */
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* _FS_READONLY */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -225,7 +226,7 @@ BYTE check_fs (
|
|||||||
static const char fatsign[] = "FAT12FAT16";
|
static const char fatsign[] = "FAT12FAT16";
|
||||||
FATFS *fs = FatFs;
|
FATFS *fs = FatFs;
|
||||||
|
|
||||||
|
/* Determines FAT type by signature string but this is not correct */
|
||||||
memset(fs->win, 0, 512);
|
memset(fs->win, 0, 512);
|
||||||
if (disk_read(fs->win, sect, 1) == RES_OK) { /* Load boot record */
|
if (disk_read(fs->win, sect, 1) == RES_OK) { /* Load boot record */
|
||||||
if (LD_WORD(&(fs->win[510])) == 0xAA55) { /* Is it valid? */
|
if (LD_WORD(&(fs->win[510])) == 0xAA55) { /* Is it valid? */
|
||||||
@ -277,6 +278,7 @@ BOOL next_dir_entry (
|
|||||||
/*--------------------------------------*/
|
/*--------------------------------------*/
|
||||||
/* Get File Status from Directory Entry */
|
/* Get File Status from Directory Entry */
|
||||||
|
|
||||||
|
#ifndef _FS_MINIMUM
|
||||||
static
|
static
|
||||||
void get_fileinfo (
|
void get_fileinfo (
|
||||||
FILINFO *finfo, /* Ptr to Store the File Information */
|
FILINFO *finfo, /* Ptr to Store the File Information */
|
||||||
@ -312,7 +314,7 @@ void get_fileinfo (
|
|||||||
finfo->fdate = LD_WORD(dir+24); /* Date */
|
finfo->fdate = LD_WORD(dir+24); /* Date */
|
||||||
finfo->ftime = LD_WORD(dir+22); /* Time */
|
finfo->ftime = LD_WORD(dir+22); /* Time */
|
||||||
}
|
}
|
||||||
|
#endif /* _FS_READONLY */
|
||||||
|
|
||||||
|
|
||||||
/*-----------------------------------------------------*/
|
/*-----------------------------------------------------*/
|
||||||
@ -478,7 +480,7 @@ BYTE* reserve_direntry (
|
|||||||
fs->winflag = 1;
|
fs->winflag = 1;
|
||||||
return fs->win;
|
return fs->win;
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* _FS_READONLY */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -665,7 +667,7 @@ FRESULT f_open (
|
|||||||
}
|
}
|
||||||
/* Open a File */
|
/* Open a File */
|
||||||
else {
|
else {
|
||||||
#endif
|
#endif /* _FS_READONLY */
|
||||||
if (res != FR_OK) return res; /* Trace failed */
|
if (res != FR_OK) return res; /* Trace failed */
|
||||||
if ((dir == NULL) || (*(dir+11) & AM_DIR)) /* It is a directory */
|
if ((dir == NULL) || (*(dir+11) & AM_DIR)) /* It is a directory */
|
||||||
return FR_NO_FILE;
|
return FR_NO_FILE;
|
||||||
@ -697,14 +699,14 @@ FRESULT f_open (
|
|||||||
|
|
||||||
FRESULT f_read (
|
FRESULT f_read (
|
||||||
FIL *fp, /* Pointer to the file object */
|
FIL *fp, /* Pointer to the file object */
|
||||||
BYTE *buff, /* Pointer to data buffer */
|
void *buff, /* Pointer to data buffer */
|
||||||
WORD btr, /* Number of bytes to read */
|
WORD btr, /* Number of bytes to read */
|
||||||
WORD *br /* Pointer to number of bytes read */
|
WORD *br /* Pointer to number of bytes read */
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
DWORD sect, ln;
|
DWORD sect, ln;
|
||||||
WORD clust, rcnt;
|
WORD clust, rcnt;
|
||||||
BYTE cc;
|
BYTE cc, *rbuff = buff;
|
||||||
FATFS *fs = FatFs;
|
FATFS *fs = FatFs;
|
||||||
|
|
||||||
|
|
||||||
@ -717,7 +719,7 @@ FRESULT f_read (
|
|||||||
if (btr > ln) btr = ln; /* Truncate read count by number of bytes left */
|
if (btr > ln) btr = ln; /* Truncate read count by number of bytes left */
|
||||||
|
|
||||||
for ( ; btr; /* Repeat until all data transferred */
|
for ( ; btr; /* Repeat until all data transferred */
|
||||||
buff += rcnt, fp->fptr += rcnt, *br += rcnt, btr -= rcnt) {
|
rbuff += rcnt, fp->fptr += rcnt, *br += rcnt, btr -= rcnt) {
|
||||||
if ((fp->fptr % 512) == 0) { /* On the sector boundary */
|
if ((fp->fptr % 512) == 0) { /* On the sector boundary */
|
||||||
if (--(fp->sect_clust)) { /* Decrement sector counter */
|
if (--(fp->sect_clust)) { /* Decrement sector counter */
|
||||||
sect = fp->curr_sect + 1; /* Next sector */
|
sect = fp->curr_sect + 1; /* Next sector */
|
||||||
@ -732,7 +734,7 @@ FRESULT f_read (
|
|||||||
cc = btr / 512; /* When left bytes >= 512 */
|
cc = btr / 512; /* When left bytes >= 512 */
|
||||||
if (cc) { /* Read maximum contiguous sectors */
|
if (cc) { /* Read maximum contiguous sectors */
|
||||||
if (cc > fp->sect_clust) cc = fp->sect_clust;
|
if (cc > fp->sect_clust) cc = fp->sect_clust;
|
||||||
if (disk_read(buff, sect, cc) != RES_OK) goto fr_error;
|
if (disk_read(rbuff, sect, cc) != RES_OK) goto fr_error;
|
||||||
fp->sect_clust -= cc - 1;
|
fp->sect_clust -= cc - 1;
|
||||||
fp->curr_sect += cc - 1;
|
fp->curr_sect += cc - 1;
|
||||||
rcnt = cc * 512; continue;
|
rcnt = cc * 512; continue;
|
||||||
@ -741,7 +743,7 @@ FRESULT f_read (
|
|||||||
if (!move_window(fp->curr_sect)) goto fr_error; /* Move sector window */
|
if (!move_window(fp->curr_sect)) goto fr_error; /* Move sector window */
|
||||||
rcnt = 512 - (fp->fptr % 512); /* Copy fractional bytes from sector window */
|
rcnt = 512 - (fp->fptr % 512); /* Copy fractional bytes from sector window */
|
||||||
if (rcnt > btr) rcnt = btr;
|
if (rcnt > btr) rcnt = btr;
|
||||||
memcpy(buff, &fs->win[fp->fptr % 512], rcnt);
|
memcpy(rbuff, &fs->win[fp->fptr % 512], rcnt);
|
||||||
}
|
}
|
||||||
|
|
||||||
return FR_OK;
|
return FR_OK;
|
||||||
@ -759,7 +761,7 @@ fr_error: /* Abort this function due to an unrecoverable error */
|
|||||||
#ifndef _FS_READONLY
|
#ifndef _FS_READONLY
|
||||||
FRESULT f_write (
|
FRESULT f_write (
|
||||||
FIL *fp, /* Pointer to the file object */
|
FIL *fp, /* Pointer to the file object */
|
||||||
const BYTE *buff, /* Pointer to the data to be written */
|
const void *buff, /* Pointer to the data to be written */
|
||||||
WORD btw, /* Number of bytes to write */
|
WORD btw, /* Number of bytes to write */
|
||||||
WORD *bw /* Pointer to number of bytes written */
|
WORD *bw /* Pointer to number of bytes written */
|
||||||
)
|
)
|
||||||
@ -767,6 +769,7 @@ FRESULT f_write (
|
|||||||
DWORD sect;
|
DWORD sect;
|
||||||
WORD clust, wcnt;
|
WORD clust, wcnt;
|
||||||
BYTE cc;
|
BYTE cc;
|
||||||
|
const BYTE *wbuff = buff;
|
||||||
FATFS *fs = FatFs;
|
FATFS *fs = FatFs;
|
||||||
|
|
||||||
|
|
||||||
@ -778,7 +781,7 @@ FRESULT f_write (
|
|||||||
if (fp->fsize + btw < fp->fsize) btw = 0; /* File size cannot reach 4GB */
|
if (fp->fsize + btw < fp->fsize) btw = 0; /* File size cannot reach 4GB */
|
||||||
|
|
||||||
for ( ; btw; /* Repeat until all data transferred */
|
for ( ; btw; /* Repeat until all data transferred */
|
||||||
buff += wcnt, fp->fptr += wcnt, *bw += wcnt, btw -= wcnt) {
|
wbuff += wcnt, fp->fptr += wcnt, *bw += wcnt, btw -= wcnt) {
|
||||||
if ((fp->fptr % 512) == 0) { /* On the sector boundary */
|
if ((fp->fptr % 512) == 0) { /* On the sector boundary */
|
||||||
if (--(fp->sect_clust)) { /* Decrement sector counter */
|
if (--(fp->sect_clust)) { /* Decrement sector counter */
|
||||||
sect = fp->curr_sect + 1; /* Next sector */
|
sect = fp->curr_sect + 1; /* Next sector */
|
||||||
@ -799,7 +802,7 @@ FRESULT f_write (
|
|||||||
cc = btw / 512; /* When left bytes >= 512 */
|
cc = btw / 512; /* When left bytes >= 512 */
|
||||||
if (cc) { /* Write maximum contiguous sectors */
|
if (cc) { /* Write maximum contiguous sectors */
|
||||||
if (cc > fp->sect_clust) cc = fp->sect_clust;
|
if (cc > fp->sect_clust) cc = fp->sect_clust;
|
||||||
if (disk_write(buff, sect, cc) != RES_OK) goto fw_error;
|
if (disk_write(wbuff, sect, cc) != RES_OK) goto fw_error;
|
||||||
fp->sect_clust -= cc - 1;
|
fp->sect_clust -= cc - 1;
|
||||||
fp->curr_sect += cc - 1;
|
fp->curr_sect += cc - 1;
|
||||||
wcnt = cc * 512; continue;
|
wcnt = cc * 512; continue;
|
||||||
@ -812,7 +815,7 @@ FRESULT f_write (
|
|||||||
if (!move_window(fp->curr_sect)) goto fw_error; /* Move sector window */
|
if (!move_window(fp->curr_sect)) goto fw_error; /* Move sector window */
|
||||||
wcnt = 512 - (fp->fptr % 512); /* Copy fractional bytes bytes to sector window */
|
wcnt = 512 - (fp->fptr % 512); /* Copy fractional bytes bytes to sector window */
|
||||||
if (wcnt > btw) wcnt = btw;
|
if (wcnt > btw) wcnt = btw;
|
||||||
memcpy(&fs->win[fp->fptr % 512], buff, wcnt);
|
memcpy(&fs->win[fp->fptr % 512], wbuff, wcnt);
|
||||||
fs->winflag = 1;
|
fs->winflag = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -824,7 +827,7 @@ fw_error: /* Abort this function due to an unrecoverable error */
|
|||||||
fp->flag |= FA__ERROR;
|
fp->flag |= FA__ERROR;
|
||||||
return FR_RW_ERROR;
|
return FR_RW_ERROR;
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* _FS_READONLY */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -901,7 +904,7 @@ FRESULT f_sync (
|
|||||||
|
|
||||||
return FR_OK;
|
return FR_OK;
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* _FS_READONLY */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -929,6 +932,7 @@ FRESULT f_close (
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef _FS_MINIMUM
|
||||||
/*----------------------------*/
|
/*----------------------------*/
|
||||||
/* Delete a File or Directory */
|
/* Delete a File or Directory */
|
||||||
|
|
||||||
@ -977,7 +981,7 @@ FRESULT f_unlink (
|
|||||||
|
|
||||||
return FR_OK;
|
return FR_OK;
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* _FS_READONLY */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -1043,7 +1047,7 @@ FRESULT f_mkdir (
|
|||||||
|
|
||||||
return FR_OK;
|
return FR_OK;
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* _FS_READONLY */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -1172,6 +1176,7 @@ FRESULT f_chmod (
|
|||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* _FS_READONLY */
|
||||||
|
|
||||||
|
#endif /* _FS_MINIMUM */
|
||||||
|
|
||||||
|
|||||||
17
src/tff.h
17
src/tff.h
@ -1,5 +1,5 @@
|
|||||||
/*--------------------------------------------------------------------------/
|
/*--------------------------------------------------------------------------/
|
||||||
/ FatFs - FAT file system module include file R0.01 (C)ChaN, 2006
|
/ Tiny-FatFs - FAT file system module include file R0.02a (C)ChaN, 2006
|
||||||
/---------------------------------------------------------------------------/
|
/---------------------------------------------------------------------------/
|
||||||
/ FatFs module is an experimenal project to implement FAT file system to
|
/ FatFs module is an experimenal project to implement FAT file system to
|
||||||
/ cheap microcontrollers. This is opened for education, reserch and
|
/ cheap microcontrollers. This is opened for education, reserch and
|
||||||
@ -10,14 +10,17 @@
|
|||||||
#ifndef _FATFS
|
#ifndef _FATFS
|
||||||
|
|
||||||
//#define _BYTE_ACC
|
//#define _BYTE_ACC
|
||||||
/* This enables byte-by-byte access for multi-byte variables */
|
/* This enables byte-by-byte access for multi-byte variables. It must be defined
|
||||||
/* It must be defined on the big-endian processor, or to prevent address error */
|
on the big-endian processor, or to prevent address error. */
|
||||||
|
|
||||||
//#define _FS_READONLY
|
//#define _FS_READONLY
|
||||||
/* This removes writing code for read-only applications */
|
/* Read only configuration. This removes writing code for read-only applications. */
|
||||||
|
|
||||||
|
//#define _FS_MINIMUM
|
||||||
|
/* Minimum configuration. This removes some functions to reduce module size. */
|
||||||
|
|
||||||
#define _USE_SJIS
|
#define _USE_SJIS
|
||||||
/* This enables Shift-JIS code transparency, or only US-ASCII file name can be accepted */
|
/* This enables Shift-JIS code transparency, or only US-ASCII file name can be accepted. */
|
||||||
|
|
||||||
|
|
||||||
#include "integer.h"
|
#include "integer.h"
|
||||||
@ -87,7 +90,7 @@ typedef struct _FILINFO {
|
|||||||
extern FATFS *FatFs; /* Pointer to active file system object */
|
extern FATFS *FatFs; /* Pointer to active file system object */
|
||||||
|
|
||||||
FRESULT f_open (FIL*, const char*, BYTE); /* Open or create a file */
|
FRESULT f_open (FIL*, const char*, BYTE); /* Open or create a file */
|
||||||
FRESULT f_read (FIL*, BYTE*, WORD, WORD*); /* Read file */
|
FRESULT f_read (FIL*, void*, WORD, WORD*); /* Read file */
|
||||||
FRESULT f_close (FIL*); /* Close file */
|
FRESULT f_close (FIL*); /* Close file */
|
||||||
FRESULT f_lseek (FIL*, DWORD); /* Seek file pointer */
|
FRESULT f_lseek (FIL*, DWORD); /* Seek file pointer */
|
||||||
FRESULT f_opendir (DIR*, const char*); /* Initialize to read a directory */
|
FRESULT f_opendir (DIR*, const char*); /* Initialize to read a directory */
|
||||||
@ -96,7 +99,7 @@ FRESULT f_stat (const char*, FILINFO*); /* Get file status */
|
|||||||
FRESULT f_getfree (DWORD*); /* Get number of free clusters */
|
FRESULT f_getfree (DWORD*); /* Get number of free clusters */
|
||||||
FRESULT f_mountdrv (); /* Force initialized the file system */
|
FRESULT f_mountdrv (); /* Force initialized the file system */
|
||||||
#ifndef _FS_READONLY
|
#ifndef _FS_READONLY
|
||||||
FRESULT f_write (FIL*, const BYTE*, WORD, WORD*); /* Write file */
|
FRESULT f_write (FIL*, const void*, WORD, WORD*); /* Write file */
|
||||||
FRESULT f_sync (FIL*); /* Flush cached information of a writing file */
|
FRESULT f_sync (FIL*); /* Flush cached information of a writing file */
|
||||||
FRESULT f_unlink (const char*); /* Delete a file or directory */
|
FRESULT f_unlink (const char*); /* Delete a file or directory */
|
||||||
FRESULT f_mkdir (const char*); /* Create a directory */
|
FRESULT f_mkdir (const char*); /* Create a directory */
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user