From a6163888f3c56123b1db313743c6147ba498732c Mon Sep 17 00:00:00 2001 From: Yuval Adam Date: Fri, 8 Aug 2014 14:42:07 +0300 Subject: Add third_party libs --- third_party/fatfs/doc/00index_e.html | 87 ++++++++++++++++++++ third_party/fatfs/doc/00index_j.html | 87 ++++++++++++++++++++ third_party/fatfs/doc/css_e.css | 55 +++++++++++++ third_party/fatfs/doc/css_j.css | 58 ++++++++++++++ third_party/fatfs/doc/en/appnote.html | 124 +++++++++++++++++++++++++++++ third_party/fatfs/doc/en/chmod.html | 89 +++++++++++++++++++++ third_party/fatfs/doc/en/close.html | 60 ++++++++++++++ third_party/fatfs/doc/en/dinit.html | 44 +++++++++++ third_party/fatfs/doc/en/dioctl.html | 65 +++++++++++++++ third_party/fatfs/doc/en/dread.html | 58 ++++++++++++++ third_party/fatfs/doc/en/dstat.html | 47 +++++++++++ third_party/fatfs/doc/en/dwrite.html | 66 ++++++++++++++++ third_party/fatfs/doc/en/fattime.html | 50 ++++++++++++ third_party/fatfs/doc/en/filename.html | 58 ++++++++++++++ third_party/fatfs/doc/en/getfree.html | 91 +++++++++++++++++++++ third_party/fatfs/doc/en/lseek.html | 86 ++++++++++++++++++++ third_party/fatfs/doc/en/mkdir.html | 83 +++++++++++++++++++ third_party/fatfs/doc/en/mkfs.html | 73 +++++++++++++++++ third_party/fatfs/doc/en/mount.html | 59 ++++++++++++++ third_party/fatfs/doc/en/mountdrv.html | 57 +++++++++++++ third_party/fatfs/doc/en/open.html | 136 ++++++++++++++++++++++++++++++++ third_party/fatfs/doc/en/opendir.html | 73 +++++++++++++++++ third_party/fatfs/doc/en/read.html | 71 +++++++++++++++++ third_party/fatfs/doc/en/readdir.html | 89 +++++++++++++++++++++ third_party/fatfs/doc/en/rename.html | 84 ++++++++++++++++++++ third_party/fatfs/doc/en/sdir.html | 42 ++++++++++ third_party/fatfs/doc/en/sfatfs.html | 63 +++++++++++++++ third_party/fatfs/doc/en/sfile.html | 55 +++++++++++++ third_party/fatfs/doc/en/sfileinfo.html | 43 ++++++++++ third_party/fatfs/doc/en/stat.html | 73 +++++++++++++++++ third_party/fatfs/doc/en/sync.html | 60 ++++++++++++++ third_party/fatfs/doc/en/unlink.html | 69 ++++++++++++++++ third_party/fatfs/doc/en/write.html | 71 +++++++++++++++++ third_party/fatfs/doc/img/f1.png | Bin 0 -> 1145 bytes third_party/fatfs/doc/img/f2.png | Bin 0 -> 1458 bytes third_party/fatfs/doc/img/f3.png | Bin 0 -> 1039 bytes third_party/fatfs/doc/img/f4.png | Bin 0 -> 2474 bytes third_party/fatfs/doc/img/f5.png | Bin 0 -> 2433 bytes third_party/fatfs/doc/img/layers.png | Bin 0 -> 1865 bytes third_party/fatfs/doc/img/rw_ata.jpeg | Bin 0 -> 66954 bytes third_party/fatfs/doc/img/rw_cfc.jpeg | Bin 0 -> 32242 bytes third_party/fatfs/doc/img/rw_mmc.jpeg | Bin 0 -> 29612 bytes third_party/fatfs/doc/img/rwtest.png | Bin 0 -> 19261 bytes third_party/fatfs/doc/ja/appnote.html | 125 +++++++++++++++++++++++++++++ third_party/fatfs/doc/ja/chmod.html | 89 +++++++++++++++++++++ third_party/fatfs/doc/ja/close.html | 60 ++++++++++++++ third_party/fatfs/doc/ja/dinit.html | 44 +++++++++++ third_party/fatfs/doc/ja/dioctl.html | 65 +++++++++++++++ third_party/fatfs/doc/ja/dread.html | 58 ++++++++++++++ third_party/fatfs/doc/ja/dstat.html | 47 +++++++++++ third_party/fatfs/doc/ja/dwrite.html | 66 ++++++++++++++++ third_party/fatfs/doc/ja/fattime.html | 50 ++++++++++++ third_party/fatfs/doc/ja/filename.html | 56 +++++++++++++ third_party/fatfs/doc/ja/getfree.html | 91 +++++++++++++++++++++ third_party/fatfs/doc/ja/lseek.html | 87 ++++++++++++++++++++ third_party/fatfs/doc/ja/mkdir.html | 83 +++++++++++++++++++ third_party/fatfs/doc/ja/mkfs.html | 73 +++++++++++++++++ third_party/fatfs/doc/ja/mount.html | 59 ++++++++++++++ third_party/fatfs/doc/ja/mountdrv.html | 58 ++++++++++++++ third_party/fatfs/doc/ja/open.html | 135 +++++++++++++++++++++++++++++++ third_party/fatfs/doc/ja/opendir.html | 73 +++++++++++++++++ third_party/fatfs/doc/ja/read.html | 71 +++++++++++++++++ third_party/fatfs/doc/ja/readdir.html | 89 +++++++++++++++++++++ third_party/fatfs/doc/ja/rename.html | 86 ++++++++++++++++++++ third_party/fatfs/doc/ja/sdir.html | 42 ++++++++++ third_party/fatfs/doc/ja/sfatfs.html | 63 +++++++++++++++ third_party/fatfs/doc/ja/sfile.html | 54 +++++++++++++ third_party/fatfs/doc/ja/sfileinfo.html | 43 ++++++++++ third_party/fatfs/doc/ja/stat.html | 73 +++++++++++++++++ third_party/fatfs/doc/ja/sync.html | 61 ++++++++++++++ third_party/fatfs/doc/ja/unlink.html | 68 ++++++++++++++++ third_party/fatfs/doc/ja/write.html | 71 +++++++++++++++++ third_party/fatfs/doc/updates.txt | 42 ++++++++++ 73 files changed, 4408 insertions(+) create mode 100644 third_party/fatfs/doc/00index_e.html create mode 100644 third_party/fatfs/doc/00index_j.html create mode 100644 third_party/fatfs/doc/css_e.css create mode 100644 third_party/fatfs/doc/css_j.css create mode 100644 third_party/fatfs/doc/en/appnote.html create mode 100644 third_party/fatfs/doc/en/chmod.html create mode 100644 third_party/fatfs/doc/en/close.html create mode 100644 third_party/fatfs/doc/en/dinit.html create mode 100644 third_party/fatfs/doc/en/dioctl.html create mode 100644 third_party/fatfs/doc/en/dread.html create mode 100644 third_party/fatfs/doc/en/dstat.html create mode 100644 third_party/fatfs/doc/en/dwrite.html create mode 100644 third_party/fatfs/doc/en/fattime.html create mode 100644 third_party/fatfs/doc/en/filename.html create mode 100644 third_party/fatfs/doc/en/getfree.html create mode 100644 third_party/fatfs/doc/en/lseek.html create mode 100644 third_party/fatfs/doc/en/mkdir.html create mode 100644 third_party/fatfs/doc/en/mkfs.html create mode 100644 third_party/fatfs/doc/en/mount.html create mode 100644 third_party/fatfs/doc/en/mountdrv.html create mode 100644 third_party/fatfs/doc/en/open.html create mode 100644 third_party/fatfs/doc/en/opendir.html create mode 100644 third_party/fatfs/doc/en/read.html create mode 100644 third_party/fatfs/doc/en/readdir.html create mode 100644 third_party/fatfs/doc/en/rename.html create mode 100644 third_party/fatfs/doc/en/sdir.html create mode 100644 third_party/fatfs/doc/en/sfatfs.html create mode 100644 third_party/fatfs/doc/en/sfile.html create mode 100644 third_party/fatfs/doc/en/sfileinfo.html create mode 100644 third_party/fatfs/doc/en/stat.html create mode 100644 third_party/fatfs/doc/en/sync.html create mode 100644 third_party/fatfs/doc/en/unlink.html create mode 100644 third_party/fatfs/doc/en/write.html create mode 100644 third_party/fatfs/doc/img/f1.png create mode 100644 third_party/fatfs/doc/img/f2.png create mode 100644 third_party/fatfs/doc/img/f3.png create mode 100644 third_party/fatfs/doc/img/f4.png create mode 100644 third_party/fatfs/doc/img/f5.png create mode 100644 third_party/fatfs/doc/img/layers.png create mode 100644 third_party/fatfs/doc/img/rw_ata.jpeg create mode 100644 third_party/fatfs/doc/img/rw_cfc.jpeg create mode 100644 third_party/fatfs/doc/img/rw_mmc.jpeg create mode 100644 third_party/fatfs/doc/img/rwtest.png create mode 100644 third_party/fatfs/doc/ja/appnote.html create mode 100644 third_party/fatfs/doc/ja/chmod.html create mode 100644 third_party/fatfs/doc/ja/close.html create mode 100644 third_party/fatfs/doc/ja/dinit.html create mode 100644 third_party/fatfs/doc/ja/dioctl.html create mode 100644 third_party/fatfs/doc/ja/dread.html create mode 100644 third_party/fatfs/doc/ja/dstat.html create mode 100644 third_party/fatfs/doc/ja/dwrite.html create mode 100644 third_party/fatfs/doc/ja/fattime.html create mode 100644 third_party/fatfs/doc/ja/filename.html create mode 100644 third_party/fatfs/doc/ja/getfree.html create mode 100644 third_party/fatfs/doc/ja/lseek.html create mode 100644 third_party/fatfs/doc/ja/mkdir.html create mode 100644 third_party/fatfs/doc/ja/mkfs.html create mode 100644 third_party/fatfs/doc/ja/mount.html create mode 100644 third_party/fatfs/doc/ja/mountdrv.html create mode 100644 third_party/fatfs/doc/ja/open.html create mode 100644 third_party/fatfs/doc/ja/opendir.html create mode 100644 third_party/fatfs/doc/ja/read.html create mode 100644 third_party/fatfs/doc/ja/readdir.html create mode 100644 third_party/fatfs/doc/ja/rename.html create mode 100644 third_party/fatfs/doc/ja/sdir.html create mode 100644 third_party/fatfs/doc/ja/sfatfs.html create mode 100644 third_party/fatfs/doc/ja/sfile.html create mode 100644 third_party/fatfs/doc/ja/sfileinfo.html create mode 100644 third_party/fatfs/doc/ja/stat.html create mode 100644 third_party/fatfs/doc/ja/sync.html create mode 100644 third_party/fatfs/doc/ja/unlink.html create mode 100644 third_party/fatfs/doc/ja/write.html create mode 100644 third_party/fatfs/doc/updates.txt (limited to 'third_party/fatfs/doc') diff --git a/third_party/fatfs/doc/00index_e.html b/third_party/fatfs/doc/00index_e.html new file mode 100644 index 0000000..128b58f --- /dev/null +++ b/third_party/fatfs/doc/00index_e.html @@ -0,0 +1,87 @@ + + + + + + + +ELM - Generic FAT File System Module + + + +

FAT File System Module

+
+ +
+layer +

FatFs module is an experimental project to implement a 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 8-bit microcontrollers, such as 8051, PIC, AVR, H8, Z80 and etc..., without any change. I created two modules in different configurations in consideration of various use.

+ +

Features of FatFs Module

+
    +
  1. Separated buffer for FAT structure and each file, suitable for fast multiple file accsess.
  2. +
  3. Supports multiple drives/partitions.
  4. +
  5. Supports FAT12, FAT16(+FAT64) and FAT32. (FAT64: FAT16 in 64KB/cluster)
  6. +
  7. Supports 8.3 format file name and NT lower case flag. (LFN is not supported)
  8. +
  9. Supports two partitioning rules: FDISK and Super-floppy.
  10. +
  11. Optimized for 8/16-bit microcontrollers.
  12. +
+

Features of Tiny-FatFs Module (different to FatFs)

+
    +
  1. Very low memory consumption, suitable for small memory system. (RAM:1KB)
  2. +
  3. Supports only single drive.
  4. +
+
+ + +
+

Application Interface

+

FatFs/Tiny-FatFs module provides following functions.

+ +
+ + +
+

Disk I/O Interface

+

Since the FatFs/Tiny-FatFs module is completely separated from disk I/O layer, it requires following functions to lower layer to read/write physical disk and to get current time. These functions must be provided by user. The low level disk I/O module that have this interace must be provided by user. The sample projects are also available.

+ +
+ + +
+

Resources

+

The FatFs/Tiny-FatFs module is a free software and is opened for education, research and development. You can use, modify and/or republish it for personal, non-profit or profit use without any restriction under your responsibility.

+ +
+ + + diff --git a/third_party/fatfs/doc/00index_j.html b/third_party/fatfs/doc/00index_j.html new file mode 100644 index 0000000..35fb0b5 --- /dev/null +++ b/third_party/fatfs/doc/00index_j.html @@ -0,0 +1,87 @@ + + + + + + + +ELM - 汎用FATファイルシステム・モジュール + + + +

FATファイルシステム・モジュール

+
+ +
+layer +

小規模な組み込みシステム向けの汎用FATファイルシステム・モジュールです。ANSI C準拠でハードウェア・アーキテクチャには依存しないので、必要なワーク・エリアが確保できれば、8051, PIC, AVR, H8, Z80などほとんどの8ビット・マイコンでそのまま使用可能です。いろいろな使用形態を考慮して、高機能版(FatFs)と省メモリ版(Tiny-FatFs)の2通りを作成してみました。

+

FatFsの特徴

+
    +
  1. ファイル・システム用とファイルI/O用バッファを分離し、複数ファイルの高速アクセスに適する
  2. +
  3. 複数のドライブ・パーテーションをサポート
  4. +
  5. FAT12, FAT16(+FAT64), FAT32に対応 (FAT64: FAT16 in 64KB/cluster)
  6. +
  7. 8.3形式ファイル名とNT小文字フラグに対応(LFN未対応)
  8. +
  9. FDISKフォーマットおよびSFDフォーマットに対応
  10. +
  11. 8/16ビットマイコン向けにコードを最適化
  12. +
+

Tiny-FatFsの特徴(FatFsとの相違)

+
    +
  1. RAMの使用量を削減し、小メモリ・システム(RAM:1KB)にも対応
  2. +
  3. 単一ドライブのみサポート
  4. +
+
+ + +
+

上位レイヤI/F

+

FatFs/Tiny-FatFsモジュールは、次のファイル操作関数を提供しています。

+ +
+ + +
+

下位レイヤI/F

+

FatFs/Tiny-FatFsモジュールは、物理ドライブへのアクセスや現在時刻を得るため、下位レイヤに次のインターフェースを要求します。これらのインターフェースを持つそれぞれの記録メディアに対応したディスクI/Oモジュールは、ユーザにより用意する必要があります。(サンプルもあり)

+ +
+ + +
+

資料

+

FatFs/Tiny-FatFsモジュールはフリー・ソフトウェアとして教育・研究・開発用に公開しています。どのような利用目的(個人・非商用・商用)でも使用・改変・配布について一切の制限はありませんが、全て利用者の責任の下での利用とします。

+ +
+ + + + diff --git a/third_party/fatfs/doc/css_e.css b/third_party/fatfs/doc/css_e.css new file mode 100644 index 0000000..8c5e121 --- /dev/null +++ b/third_party/fatfs/doc/css_e.css @@ -0,0 +1,55 @@ +* {margin: 0; padding: 0; border-width: 0;} +body {margin: 8px; background-color: #e0ffff; font-color: black; line-height: 133%; max-width: 1024px;} +a:link {color: blue;} +a:visited {color: darkmagenta;} +a:hover {background-color: #a0ffff;} +a:active {color: darkmagenta; position: relative; top: 1px; left: 1px;} +abbr {border-width: 1px;} + +p {margin: 0 0 0.3em 1em;} +em {font-style: normal; font-weight: bold; margin: 0 0.1em;} +pre em {font-style: italic; font-weight: normal;} +strong {} +pre {margin: 1em; line-height: 1.2em; background-color: white;} +tt {margin: 0 0.2em;} +ol {margin: 0 2em;} +ul {margin: 0 2em;} +dl {margin: 0 1em;} +dt {font-family: monospace;} +dl.par dt {margin: 0.5em 0 0 0 ; font-style: italic; } +dl.ret dt {margin: 0.5em 0 0 0 ; font-weight: bold;} +dd {margin: 0 2em;} +hr {border-width: 1px; margin: 1em;} +div.abst {font-family: sans-serif;} +div.para {clear: both; font-family: serif;} +.equ {text-indent: 0; margin: 1em 2em 1em;} +.indent {margin-left: 2em;} +.rset {float: right; margin: 0 0 0.5em 0.5em;} +.lset {float: left; margin: 0 0.5em 0.5em 0.5em;} +ul.flat li {list-style-type: none; margin: 0;} +a.imglnk img {border: 1px solid;} +.iequ {white-space: nowrap; font-weight: bold;} +.clr {clear: both;} +.it {font-style: italic;} +.mfd {font-size: 0.7em; padding: 0 1px; border: 1px solid; white-space : nowrap} + +h1 {line-height: 1em; font-size: 2em; font-family: sans-serif; padding: 0.3em 0 0.3em;} +p.hdd {float: right; text-align: right; margin-top: 0.5em;} +hr.hds {clear: both; margin-bottom: 1em;} + +h2 {font-size: 1.5em; font-family: sans-serif; margin: 0 0 0.5em;} +h3 {font-size: 1.5em; font-family: sans-serif; margin: 2em 0 0.5em;} +h4 {font-size: 1.2em; font-family: sans-serif; margin: 1.5em 0 0.2em;} +h5 {font-size: 1em; font-family: sans-serif; margin: 0.5em 0 0em;} +small {font-size: 80%;} +.indent {margin-left: 2em;} + +/* Tables */ +table {margin: 4px; border-collapse: collapse; border-style: solid; border-width: 2px; border-color: black; } +th {background-color: white; border-style: solid; border-width: 1px 1px 2px; border-color: black; padding: 0 3px; vertical-align: top; white-space: nowrap;} +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.lst2 td {font-family: monospace;} +table caption {font-family: sans-serif; font-weight: bold;} + +p.foot {clear: both; text-indent: 0; margin: 1em 0.5em 1em;} diff --git a/third_party/fatfs/doc/css_j.css b/third_party/fatfs/doc/css_j.css new file mode 100644 index 0000000..83c0372 --- /dev/null +++ b/third_party/fatfs/doc/css_j.css @@ -0,0 +1,58 @@ +@charset "Shift_JIS"; +/* Common style sheet for Tech Notes */ + +* {margin: 0; padding: 0; border-width: 0;} +body {margin: 8px; background-color: #e0ffff; font-color: black; line-height: 133%; letter-spacing: 1px; max-width: 1024px;} +a:link {color: blue;} +a:visited {color: darkmagenta;} +a:hover {background-color: #a0ffff;} +a:active {color: darkmagenta; position: relative; top: 1px; left: 1px;} +abbr {border-width: 1px;} + +p {text-indent: 1em; margin: 0 0 0.3em 0.5em;} +em {font-style: normal; font-weight: bold; margin: 0 0.1em;} +pre em {font-style: italic; font-weight: normal;} +strong {} +pre {margin: 1em; line-height: 1.2em; letter-spacing: 0; background-color: white;} +tt {margin: 0 0.2em; letter-spacing: 0;} +ol {margin: 0 2em;} +ul {margin: 0 2em;} +dl {margin: 0 1em;} +dt {font-family: monospace;} +dl.par dt {margin: 0.5em 0 0 0 ; font-style: italic; letter-spacing: 0;} +dl.ret dt {margin: 0.5em 0 0 0 ; font-family: monospace; letter-spacing: 0; font-weight: bold;} +dd {margin: 0 2em;} +hr {border-width: 1px; margin: 1em;} +div.abst {font-family: "MS Pゴシック",sans-serif;} +div.para {clear: both; font-family: "MS P明朝",serif;} +.equ {text-indent: 0; margin: 1em 2em 1em;} +.indent {margin-left: 2em;} +.rset {float: right; margin: 0 0 0.5em 0.5em;} +.lset {float: left; margin: 0 0.5em 0.5em 0.5em;} +ul.flat li {list-style-type: none; margin: 0;} +a.imglnk img {border: 1px solid;} +.iequ {white-space: nowrap; font-weight: bold;} +.clr {clear: both;} +.it {font-style: italic;} +.mfd {font-size: 0.7em; padding: 0 1px; border: 1px solid; white-space : nowrap} + +h1 {line-height: 1em; font-size: 2em; font-family: sans-serif; padding: 0.3em 0 0.3em;} +p.hdd {float: right; text-align: right; margin-top: 0.5em;} +hr.hds {clear: both; margin-bottom: 1em;} + +h2 {font-size: 1.5em; font-family: sans-serif; margin: 0 0 0.5em;} +h3 {font-size: 1.5em; font-family: sans-serif; margin: 2em 0 0.5em;} +h4 {font-size: 1.2em; font-family: sans-serif; margin: 1.5em 0 0.2em;} +h5 {font-size: 1em; font-family: sans-serif; margin: 0.5em 0 0em;} +small {font-size: 80%;} +.indent {margin-left: 2em;} + +/* Tables */ +table {margin: 4px; border-collapse: collapse; border-style: solid; border-width: 2px; border-color: black; letter-spacing: 0;} +th {background-color: white; border-style: solid; border-width: 1px 1px 2px; border-color: black; padding: 0 3px; vertical-align: top;} +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.lst2 td {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;} diff --git a/third_party/fatfs/doc/en/appnote.html b/third_party/fatfs/doc/en/appnote.html new file mode 100644 index 0000000..94560f4 --- /dev/null +++ b/third_party/fatfs/doc/en/appnote.html @@ -0,0 +1,124 @@ + + + + + + + +FatFs Module Application Note + + + +

FatFs Module Application Note

+
+ +
+

Considerations on porting to various platform

+

The FatFs module is assuming following terms on portability.

+ +
+ +
+

Memory Usage (R0.04b)

+

These are the memory usage on some target systems. The memory sizes are in unit of byte, D means number of logical drives and F means number of open files. All samples are optimezed in code size.

+ + + + + + + + + + + + + + + + +
AVRH8/300HMSP430TLCS-870/CV850ESSH2
CompilergccCH38CL430CC870CCA850SHC
_MCU_ENDIAN122112
FatFs Code
(Standard, R/W cfg.)
8722877664027338
FatFs Code
(Minimum, R/W cfg.)
5814572240944906
FatFs Code
(Standard, R/O cfg.)
4248409630103506
FatFs Code
(Minimum, R/O cfg.)
3038311022102698
FatFs Work (Static)D*2 + 2D*4 + 2D*4 + 2D*4 + 2
FatFs Work (Dynamic)D*554 + F*544D*554 + F*550D*554 + F*550D*554 + F*550
Tiny-FatFs Code
(Standard, R/W cfg.)
7264724066348837
Tiny-FatFs Code
(Minimum, R/W cfg.)
4750480643666163
Tiny-FatFs Code
(Standard, R/O cfg.)
3600354832124347
Tiny-FatFs Code
(Minimum, R/O cfg.)
2568270223943322
Tiny-FatFs Wrok (Static)4644
Tiny-FatFs Work (Dynamic)544 + F*28544 + F*32544 + F*28544 + F*28
+
+ +
+

FatFs vs. Tiny-FatFs

+

For most applications, such as portable audio and data logger, Tiny-FatFs is the best choice. However because the Tiny-FatFs does not support FAT32 in default, there is a limitation that can handle only tiny storage upto 2GB(4GB in FAT64). The FAT32 support can be added by _USE_FAT32 option with an additional code size. The FatFs is suitable for fast multiple files access, and for multiple drive system.

+
+ + + + + +
Memory SizeFAT Type
<= 64MBFAT12
128MB - 2GBFAT16
>= 4GBFAT32
+
+

Rignt table shows the correspondence between memory size and FAT type for SD memroy card and they are shipped with this format. The data area is justified to the erase block boundary and the memory card works with the best performance. For that reason, the memory card should not be reformated with PC. When cluster size or FAT type is changed, the write performance can be decreased.

+
+ + +
+

Performance effective file access

+

For good performance on reading/writing files on the small embedded system, application program should consider what process is done in the FatFs module. The file data on the disk is transferred by f_read function in following process.

+

Figure 1. Sector miss-aligned read (short)
+ +

+

Figure 2. Sector miss-aligned read (long)
+ +

+

Figure 3. Sector aligned read
+ +

+

The file I/O buffer means a sector buffer to read/write a partial data on the sector. On the FatFs, member buffer[] in the file object is used. On the Tiny-FatFs, member win[] in the file system object is used.

+

Tiny-FatFs processes all data transfer and access to the FAT/directory with only one sector buffer, so that FAT sector cached into the buffer is lost and it must reloaded at every cluster boundary. FatFs has a FAT/directory buffer separated from file I/O buffer, the frequency of FAT accesses is only 1/341, 1/256 or 1/128 (when cluster is contiguous) compared to Tiny-FatFs. Thus the Tiny-FatFs is sacrificing its performance in compensation for very small memory footprint.

+

Figure 1 shows that partial sector data is transferred via the file I/O buffer. At long data transfer shown in Figure 2, middle of transfer data that aligned to sector boundary is transferred into memory directly. Figure 3 shows that entier transfer data is aligned to the sector boundary. In this case, file I/O buffer is not used. At the unbuffered transfer, maximum extent of sectors are read with disk_read function at a time but it never across cluster boundary even if it is contiguous.

+

Therefore taking effort to sector aligned read/write accesss eliminates memcpy and the read/write performance will be improved. Besides the effect, cached FAT sector is not flushed during read/write access on the Tiny-FatFs, so that it can achieve same performance as FatFs and its small memory footprint simultanesously.

+
+ + +
+

Critical section

+

When write operation to the FAT file system is interrupted due to any accidental failure, such as sudden blackout, incorrect disk removal and unrecoverable data error, the FAT structure can be destroyed. Following images shows the critical section on the FatFs module.

+
+Figure 4. Long critical section
+fig.4 +
+
+Figure 5. Minimized critical section
+fig.5 +
+
+

An interruption in the red section can cause a cross link; as a result, the file/directory being changed will be lost. There is one or more possibility listed below when an interruption in the yellow section is occured.

+ +

Each case does not affect the files that not in write operation. To minimize risk of data loss, the critical section can be minimized like shown in Figure 5 by minimizing the time that file is opened in write mode and using f_sync function properly.

+
+ + +
+

Problems and Ideas

+ +
+

These are the problems and ideas on current revision of FatFs module. However the main target of FatFs module is 8 bit microcontrollers. These extensions requires much resource and the FatFs will unable to be ported to the 8 bit system. This may be the most serious problem on future plan.

+
+ +

Return

+ + diff --git a/third_party/fatfs/doc/en/chmod.html b/third_party/fatfs/doc/en/chmod.html new file mode 100644 index 0000000..bdb3c12 --- /dev/null +++ b/third_party/fatfs/doc/en/chmod.html @@ -0,0 +1,89 @@ + + + + + + + +FatFs - f_chmod + + + + +
+

f_chmod

+

The f_chmod function changes the attribute of a file or directory.

+
+FRESULT f_chmod (
+  const char* FileName, /* Pointer to the file or directory */
+  BYTE Attribute,       /* Attribute flags */
+  BYTE AttributeMask    /* Attribute masks */
+);
+
+
+ +
+

Parameter

+
+
FileName
+
Pointer to the null-terminated string that specifies a file or directory to be changed
+
Attribute
+
Attribute flags to be set in one or more combination of the following flags. The specified flags are set and others are cleard.
+ + + + + + +
AttributeDescription
AM_RDORead only
AM_ARCArchive
AM_SYSSystem
AM_HIDHidden
+
+
AttributeMask
+
Attribute mask that specifies which attribute is changed. The specified aattributes are set or cleard.
+
+
+ + +
+

Return Values

+
+
FR_OK (0)
+
The function succeeded.
+
FR_NO_FILE
+
Could not find the file.
+
FR_NO_PATH
+
Could not find the path.
+
FR_INVALID_NAME
+
The file name is invalid.
+
FR_INVALID_DRIVE
+
The drive number is invalid.
+
FR_NOT_READY
+
The disk drive cannot work due to no medium in the drive or any other reason.
+
FR_WRITE_PROTECTED
+
The medium is write protected.
+
FR_RW_ERROR
+
The function failed due to a disk error or an internal error.
+
FR_NOT_ENABLED
+
The logical drive has no work area.
+
FR_NO_FILESYSTEM
+
There is no valid FAT partition on the disk.
+
+
+ + +
+

Description

+

The f_chmod function changes the attribute of a file or directory. This function is not supported in read-only configuration and minimization level of >=1.

+
+ + +
+

Example

+
+    // Set read-only flag, clear archive flag and others are retained.
+    f_chmod("file.txt", AR_RDO, AR_RDO | AR_ARC);
+
+
+ +

Return

+ + diff --git a/third_party/fatfs/doc/en/close.html b/third_party/fatfs/doc/en/close.html new file mode 100644 index 0000000..642dda7 --- /dev/null +++ b/third_party/fatfs/doc/en/close.html @@ -0,0 +1,60 @@ + + + + + + + +FatFs - f_close + + + + +
+

f_close

+

The f_close function closes an open file.

+
+FRESULT f_close (
+  FIL* FileObject     /* Pointer to the file object structure */
+);
+
+
+ +
+

Parameter

+
+
FileObject
+
Pointer to the open file object structure to be closed.
+
+
+ + +
+

Return Values

+
+
FR_OK (0)
+
The file object has been closed successfuly.
+
FR_RW_ERROR
+
The function failed due to a disk error or an internal error.
+
FR_NOT_READY
+
The disk drive cannot work due to no medium in the drive or any other reason.
+
FR_INVALID_OBJECT
+
The file object is invalid.
+
+
+ + +
+

Description

+

The f_close function closes an open file object. If any data has been written to the file, the cached information of the file is written back to the disk. After the function succeeded, the file object is no longer valid and it can be discarded. If the file object has been opened in read-only mode, it may be discarded without closing process by this function.

+
+ + +
+

References

+

f_open, f_read, f_write, f_sync, FIL, FATFS

+
+ +

Return

+ + diff --git a/third_party/fatfs/doc/en/dinit.html b/third_party/fatfs/doc/en/dinit.html new file mode 100644 index 0000000..d95aef1 --- /dev/null +++ b/third_party/fatfs/doc/en/dinit.html @@ -0,0 +1,44 @@ + + + + + + + +FatFs - disk_initialize + + + + +
+

disk_initialize

+

The disk_initialize function initializes the disk drive.

+
+DSTATUS disk_initialize (
+  BYTE Drive           /* Physical drive number */
+);
+
+
+ +
+

Parameters

+
+
Drive
+
Specifies the physical drive number to initialize.
+
+
+ + +
+

Return Values

+

This function returns a disk status as the result. For details of the disk status, refer to the disk_status function.

+
+ +
+

Description

+

The disk_initialize function initializes a physical drive. When the function succeeded, STA_NOINIT flag in the return value is cleard.

+
+ +

Return

+ + diff --git a/third_party/fatfs/doc/en/dioctl.html b/third_party/fatfs/doc/en/dioctl.html new file mode 100644 index 0000000..f1797a7 --- /dev/null +++ b/third_party/fatfs/doc/en/dioctl.html @@ -0,0 +1,65 @@ + + + + + + + +FatFs - disk_ioctl + + + + +
+

disk_ioctl

+

The disk_ioctl function cntrols device specified features and miscellaneous functions other than disk read/write.

+
+DRESULT disk_ioctl (
+  BYTE Drive,      /* Drive number */
+  BYTE Command,    /* Control command code */
+  void* Buffer     /* Data transfer buffer */
+);
+
+
+ +
+

Parameters

+
+
Drive
+
Specifies drive number (0-9).
+
Command
+
Specifies the command code.
+
Buffer
+
Pointer to the parameter buffer depends on the command code. When it is not used, specify a NULL pointer.
+
+
+ + +
+

Return Value

+
+
RES_OK (0)
+
The function succeeded.
+
RES_ERROR
+
Any error occured.
+
RES_PARERR
+
Invalid command code.
+
RES_NOTRDY
+
The disk dirve has not been initialized.
+
+
+ + +
+

Description

+

The FatFs module uses only device independent commands described below. Any device dependent function is not used. In read-only configuration, This function is not needed.

+ + + + +
CommandDescription
GET_SECTOR_COUNTReturns total sectors on the drive into the DWORD variable pointed by Buffer.
CTRL_SYNCMake sure that the drive has finished to write data. When the module has a write back cache, write back the dirty sector immediately.
+
+ +

Return

+ + diff --git a/third_party/fatfs/doc/en/dread.html b/third_party/fatfs/doc/en/dread.html new file mode 100644 index 0000000..15e51d4 --- /dev/null +++ b/third_party/fatfs/doc/en/dread.html @@ -0,0 +1,58 @@ + + + + + + + +FatFs - disk_read + + + + +
+

disk_read

+

The disk_read function reads sector(s) from the disk drive.

+
+DRESULT disk_read (
+  BYTE Drive,          /* Physical drive number */
+  BYTE* Buffer,        /* Pointer to the read buffer */
+  DWORD SectorNumber,  /* Sector number to read from */
+  BYTE SectorCount     /* Number of sectros to read */
+);
+
+
+ +
+

Parameters

+
+
Drive
+
Specifies the physical drive number to read.
+
Buffer
+
Pointer to the read buffer to store the read data. SectorCount * 512 bytes is required for the size of the read buffer.
+
SectorNumber
+
Specifies the start sector number in logical block address.
+
SectorCount
+
Specifies number of sectors to read. The value can be 1 to 255.
+
+
+ + +
+

Return Value

+
+
RES_OK (0)
+
The function succeeded.
+
RES_ERROR
+
Any error occured during the read operation.
+
RES_PARERR
+
Invalid parameter.
+
RES_NOTRDY
+
The disk dirve has not been initialized.
+
+
+ + +

Return

+ + diff --git a/third_party/fatfs/doc/en/dstat.html b/third_party/fatfs/doc/en/dstat.html new file mode 100644 index 0000000..41179af --- /dev/null +++ b/third_party/fatfs/doc/en/dstat.html @@ -0,0 +1,47 @@ + + + + + + + +FatFs - disk_status + + + + +
+

disk_status

+

The disk_status function gets the disk status.

+
+DSTATUS disk_status (
+  BYTE Drive     /* Physical drive number */
+);
+
+
+ +
+

Parameters

+
+
Drive
+
Specifies the physical drive number to be tested.
+
+
+ + +
+

Return Values

+

The disk status is returned in combinatin of following flags.

+
+
STA_NOINIT
+
Indicates that the disk drive has not been initialiezed. This flag is set on: power-on, disk removal and disk_initialize function failed, and cleared on: disk_initialize function succeeded.
+
STA_NODISK
+
Indicates that no medium in the drive. It is always cleared on fixed disk drive.
+
STA_PROTECTED
+
Indicates that the medium is write protected. It is always cleared on the drive that does not support write protect notch.
+
+
+ +

Return

+ + diff --git a/third_party/fatfs/doc/en/dwrite.html b/third_party/fatfs/doc/en/dwrite.html new file mode 100644 index 0000000..87e3e8f --- /dev/null +++ b/third_party/fatfs/doc/en/dwrite.html @@ -0,0 +1,66 @@ + + + + + + + +FatFs - disk_write + + + + +
+

disk_write

+

The disk_write writes sector(s) to the disk.

+
+DRESULT disk_write (
+  BYTE Drive,          /* Physical drive number */
+  const BYTE* Buffer,  /* Pointer to the read buffer */
+  DWORD SectorNumber,  /* Sector number to write */
+  BYTE SectorCount     /* Number of sectors to write */
+);
+
+
+ +
+

Parameters

+
+
Drive
+
Specifies the physical drive number to write.
+
Buffer
+
Pointer to the data to be written.
+
SectorNumber +
Specifies the start sector number in logical block address.
+
SectorCount
+
Specifies number of sectors to write. The value can be 1 to 255.
+
+
+ + +
+

Return Values

+
+
RES_OK (0)
+
The function succeeded.
+
RES_ERROR
+
Any error occured during the write operation.
+
RES_WRPRT
+
The disk is write protected.
+
RES_PARERR
+
Invalid parameter.
+
RES_NOTRDY
+
The disk dirve has not been initialized.
+
+
+ + +
+

Description

+

This function is not required in read only configuration.

+
+ + +

Return

+ + diff --git a/third_party/fatfs/doc/en/fattime.html b/third_party/fatfs/doc/en/fattime.html new file mode 100644 index 0000000..dbb81a9 --- /dev/null +++ b/third_party/fatfs/doc/en/fattime.html @@ -0,0 +1,50 @@ + + + + + + + +FatFs - get_fattime + + + + +
+

get_fattime

+

The get_fattime function gets current time.

+
+DWORD get_fattime (void);
+
+
+ + +
+

Return Value

+

Currnet time is returned with packed into a DWORD value. The bit field is as follows:

+
+
bit31:25
+
Year from 1980 (0..127)
+
bit24:21
+
Month (1..12)
+
bit20:16
+
Date (1..31)
+
bit15:11
+
Hour (0..23)
+
bit10:5
+
Minute (0..59)
+
bit4:0
+
Second/2 (0..29)
+
+
+ + +
+

Description

+

The get_fattime function must return any valid time even if the system does not support a real time clock. This fucntion is not required in read only configuration.

+
+ + +

Return

+ + diff --git a/third_party/fatfs/doc/en/filename.html b/third_party/fatfs/doc/en/filename.html new file mode 100644 index 0000000..b80e069 --- /dev/null +++ b/third_party/fatfs/doc/en/filename.html @@ -0,0 +1,58 @@ + + + + + + + +FatFs - File and Path name on the FatFs module + + + + +
+

File and Path name on the FatFs module

+

The format of file and path name on the FatFs module is similer to MS-DOS. However it does not have a concept of current directory, all objects on the drive are specified in full path from the roor directory.

+
+
+ "[logical drive#:][/]directory/file"
+
+ "file1.txt"           a file on drive 0
+ "/file1.txt"          (same as above)
+ "dir1/dir2/file1.txt" a file on drive 0
+ "2:dir3/file2.txt"    a file on drive 2
+ "2:/dir5"             a directory on drive 2
+ ""                    the root directory on drive 0
+ "/"                   (same as above)
+ "2:"                  the root directory on drive 2
+
+
+

The FatFs module supports only 8.3 format file name and long file name is currentry not supported. For directory separator, a '/' is used, not a '\'. Heading '/' is ignored and can be omitted.

+

The logical drive number is specified in a numeral with a colon. When drive number is omitted, it means the default drive (0). As for the Tiny-FatFs, it has only one logical drive and always works as drive 0. Any drive number cannot be contained in the path name.

+
+ +


+
+

Correspondence between logical/physical drive

+

In default, the FatFs module has work areas that called file system object for each logical drive. The logical drive is bound simply to the physical drive that has same drive number, and first partition is mounted. When _MULTI_PARTITION is specified in configuration option, each individual logical drive can be bound to any physical drive/partition. In this case, a drive number resolution table must be defined as follows:

+
+Example: Logical drive 0-2 are assigned to three pri-partitions on the physical drive 0 (fixed disk)
+         Logical drive 3 is assigned to physical drive 0 (removable disk)
+
+const PARTITION Drives[] = {
+    {0, 0},     /* Logical drive 0 ==> Physical drive 0, 1st partition */
+    {0, 1},     /* Logical drive 1 ==> Physical drive 0, 2nd partition */
+    {0, 2},     /* Logical drive 2 ==> Physical drive 0, 3rd partition */
+    {1, 0}      /* Logical drive 3 ==> Physical drive 1 */
+};
+
+

There are some consideration when use _MULTI_PARTITION configuration.

+
+ + + diff --git a/third_party/fatfs/doc/en/getfree.html b/third_party/fatfs/doc/en/getfree.html new file mode 100644 index 0000000..e81de0a --- /dev/null +++ b/third_party/fatfs/doc/en/getfree.html @@ -0,0 +1,91 @@ + + + + + + + +FatFs - f_getfree + + + + +
+

f_getfree

+

The f_getfree function gets number of the free clusters.

+
+FRESULT f_getfree (
+  const char* Path,         /* Root directory of the drive */
+  DWORD* Clusters,          /* Pointer to the variable to store number of free clusters */
+  FATFS** FileSystemObject  /* Pointer to pointer to file system object */
+);
+
+
+ +
+

Parameters

+
+
Path
+
Pinter to the null-terminated string that specifies the root directory of the logical drive. Always specify a null-string for Tiny-FatFs.
+
Clusters
+
Pointer to the DWORD variable to store number of free clusters.
+
FileSystemObject
+
Pointer to the pointer that to be stored the pointer to corresponding file system object.
+
+
+ + +
+

Return Values

+
+
FR_OK (0)
+
The function succeeded. The *Clusters havs number of free clusters and *FileSystemObject points the file system object.
+
FR_INVALID_DRIVE
+
The drive number is invalid.
+
FR_NOT_READY
+
The disk drive cannot work due to no medium in the drive or any other reason.
+
FR_RW_ERROR
+
The function failed due to a disk error or an internal error.
+
FR_NOT_ENABLED
+
The logical drive has no work area.
+
FR_NO_FILESYSTEM
+
There is no valid FAT partition on the disk.
+
+
+ + +
+

Descriptions

+

The f_getfree function gets number of free clusters on the drive. The sects_clust member in the file system object refreting number of sectors per cluster, so that the free space in unit of sector can be calcurated with this. When _USE_FSINFO option is enabled, this function can return inaccurate free cluster count on FAT32 volume. When _USE_FSINFO option is disabled, this function will take a time on FAT32 volume.

+

This function is not supported in read-only configuration and minimization level of >= 1.

+
+ + +
+

Samples Code

+
+    FATFS *fs;
+    DWORD clust;
+
+
+    // Get free clusters
+    res = f_getfree("", &clust, &fs);
+    if (res) die(res);
+
+    // Get free space
+    printf("%lu KB total disk space.\n"
+           "%lu KB available on the disk.\n",
+           (DWORD)(fs->max_clust - 2) * fs->sects_clust / 2,
+           clust * fs->sects_clust / 2);
+
+
+ + +
+

References

+

FATFS

+
+ +

Return

+ + diff --git a/third_party/fatfs/doc/en/lseek.html b/third_party/fatfs/doc/en/lseek.html new file mode 100644 index 0000000..a60bfc2 --- /dev/null +++ b/third_party/fatfs/doc/en/lseek.html @@ -0,0 +1,86 @@ + + + + + + + +FatFs - f_lseek + + + + +
+

f_lseek

+

The f_lseek functione moves the file read/write pointer of an open file object.

+
+FRESULT f_lseek (
+  FIL* FileObject,   /* Pointer to the file object structure *
+  DWORD Offset       /* File offset in unit of byte *
+);
+
+
+ +
+

Parameters

+
+
FileObject
+
Pointer to the open file object.
+
Offset
+
Number of bytes where from start of file
+
+
+ + +
+

Return Values

+
+
FR_OK (0)
+
The function succeeded.
+
FR_RW_ERROR
+
The function failed due to a disk error or an internal error.
+
FR_NOT_READY
+
The disk drive cannot work due to no medium in the drive or any other reason.
+
FR_INVALID_OBJECT
+
The file object is invalid.
+
+
+ + +
+

Description

+

The f_lseek function moves the file R/W pointer of an open file. The offset can be specified in only origin from top of the file. When an offset above the file size is specified in write mode, the file is extended to the offset and the data in the extended area is undefined. After the function succeeded, member fptr in the file object should be checked in order to make sure the R/W pointer has been moved correctry. In case of fptr is less than Offset, any of the followings has been occured.

+ +

This function is not supported in minimization level of >= 3.

+ + +
+

Example

+
+    // Move to offset of 5000 from top of the file.
+    res = f_lseek(&file, 5000);
+
+    // Forward 3000 bytes
+    res = f_lseek(&file, file.fptr + 3000);
+
+    // Rewind 2000 bytes (take care on overflow)
+    res = f_lseek(&file, file.fptr - 2000);
+
+    // Move to end of the file
+    res = f_lseek(&file, file.fsize);
+
+
+ + +
+

References

+

f_open, FIL

+
+ +

Return

+ + diff --git a/third_party/fatfs/doc/en/mkdir.html b/third_party/fatfs/doc/en/mkdir.html new file mode 100644 index 0000000..5dcff74 --- /dev/null +++ b/third_party/fatfs/doc/en/mkdir.html @@ -0,0 +1,83 @@ + + + + + + + +FatFs - f_mkdir + + + + +
+

f_mkdir

+

The f_mkdir function creates a new directory.

+
+FRESULT f_mkdir (
+  const char* DirName /* Pointer to the directory name */
+);
+
+
+ +
+

Parameter

+
+
DirName
+
Pointer to the null-terminated string that specifies the directory name to create.
+
+
+ + +
+

Return Value

+
+
FR_OK (0)
+
The function succeeded.
+
FR_NO_PATH
+
Could not find the path.
+
FR_INVALID_NAME
+
The path name is invalid.
+
FR_INVALID_DRIVE
+
The drive number is invalid.
+
FR_DENIED
+
The directory cannot be created due to directory table or disk is full.
+
FR_EXIST
+
A file or directory that has same name is already existing.
+
FR_NOT_READY
+
The disk drive cannot work due to no medium in the drive or any other reason.
+
FR_WRITE_PROTECTED
+
The medium is write protected.
+
FR_RW_ERROR
+
The function failed due to a disk error or an internal error.
+
FR_NOT_ENABLED
+
The logical drive has no work area.
+
FR_NO_FILESYSTEM
+
There is no valid FAT partition on the disk.
+
+
+ + +
+

Description

+

The f_mkdir function creates a new directory. This function is not supported in read-only configuration and minimization level of >= 1.

+

+

+
+ + +
+

Example

+
+    res = f_mkdir("sub1");
+    if (res) die(res);
+    res = f_mkdir("sub1/sub2");
+    if (res) die(res);
+    res = f_mkdir("sub1/sub2/sub3");
+    if (res) die(res);
+
+
+ +

Return

+ + diff --git a/third_party/fatfs/doc/en/mkfs.html b/third_party/fatfs/doc/en/mkfs.html new file mode 100644 index 0000000..35ae3b9 --- /dev/null +++ b/third_party/fatfs/doc/en/mkfs.html @@ -0,0 +1,73 @@ + + + + + + + +FatFs - f_mkfs + + + + +
+

f_mkfs

+

The f_mkfs fucntion creates a file system on the drive.

+
+FRESULT f_mkfs (
+  BYTE  Drive,            /* Logical drive number */
+  BYTE  PartitioningRule, /* Partitioning rule */
+  BYTE  AllocSize         /* Allocation unit size */
+);
+
+
+ +
+

Parameters

+
+
Drive
+
Logical drive number (0-9) to be formatted.
+
PartitioningRule
+
When 0 is given, a partition table is created into first sector on the drive and then the file system is created on the partition. This is called FDISK format. When 1 is given, the file system starts from the first sector without partition table. This is often called super floppy (SFD) format.
+
AllocSize
+
Specifies allocation unit size (number of sectors per cluster). The value must be power of 2 in range of from 1 to 64.
+
+
+ +
+

Return Values

+
+
FR_OK (0)
+
The function succeeded.
+
FR_INVALID_DRIVE
+
The drive number is invalid.
+
FR_NOT_READY
+
The drive cannot work due to any reason.
+
FR_WRITE_PROTECTED
+
The drive is write protected.
+
FR_NOT_ENABLED
+
The logical drive has no work area.
+
FR_RW_ERROR
+
The function failed due to a disk error or an internal error.
+
FR_MKFS_ABORTED
+
The function aborted before start in format due to a reason as follows. +
    +
  • The disk size is too small.
  • +
  • Invalid parameter was given to any parameter.
  • +
  • Not allowable cluster size for this drive. This can occure when number of clusters becomes around 0xFF7 and 0xFFF7.
  • +
+
+
+
+ +
+

Description

+

The f_mkfs function creates a FAT file system on the drive. There are two partitioning rules, FDISK and SFD, for removable media. It can be selected with a parameter and FDISK format is recommended for most case. This function currently does not support multiple partition, so that existing partitions on the physical dirve will be deleted and re-created a partition occupies entire disk space.

+

The FAT type, FAT12/FAT16/FAT32, is determined by only how many clusters on the drive and nothing else, according to FAT specification. Thus which FAT type is selected, is depends on the drive size and specified cluster size. The cluster size affects performance of file system and large cluster increases the performance, so that 64 sectors per cluster is recommended except for small drive.

+

This function is supported on only FatFs with _USE_MKFS option.

+

+ + +

Return

+ + diff --git a/third_party/fatfs/doc/en/mount.html b/third_party/fatfs/doc/en/mount.html new file mode 100644 index 0000000..9a14392 --- /dev/null +++ b/third_party/fatfs/doc/en/mount.html @@ -0,0 +1,59 @@ + + + + + + + +FatFs - f_mount + + + + +
+

f_mount

+

The f_mount fucntion registers/unregisters a work area to the FatFs module.

+
+FRESULT f_mount (
+  BYTE  Drive,              /* Logical drive number */
+  FATFS*  FileSystemObject  /* Pointer to the work area */
+);
+
+
+ +
+

Parameters

+
+
Drive
+
Logical drive number (0-9) to register/unregister the work area. Always 0 for Tiny-FatFs.
+
FileSystemObject
+
Pointer to the work area (file system object) to be registered.
+
+
+ +
+

Return Values

+
+
FR_OK (0)
+
The function succeeded.
+
FR_INVALID_DRIVE
+
The drive number is invalid.
+
+
+ + +
+

Description

+

The f_mount function registers/unregisters a work area to the FatFs module. The work area must be given to the logical drive with this function before using any file function. To unregister a work area, specify a NULL to the FileSystemObject, and then the work area can be discarded.

+

This function only initializes the work area and registers its address to the internal table, any access to the disk I/O layer does not occure. Actual mounting process is performed in any other file funcitons with path name when it is needed.

+

+ + +
+

References

+

FATFS

+
+ +

Return

+ + diff --git a/third_party/fatfs/doc/en/mountdrv.html b/third_party/fatfs/doc/en/mountdrv.html new file mode 100644 index 0000000..7cc6bbf --- /dev/null +++ b/third_party/fatfs/doc/en/mountdrv.html @@ -0,0 +1,57 @@ + + + + + + + +FatFs - f_mountdrv + + + + +
+

f_mountdrv

+

The f_mountdrv forces the partition mounted.

+
+FRESULT f_mountdrv (void);
+
+
+ +
+

Return Values

+
+
FR_OK (0)
+
The function succeeded.
+
FR_NOT_READY
+
The disk drive cannot work due to no medium in the drive or any other reason.
+
FR_RW_ERROR
+
Any error occured in low level disk I/O.
+
FR_NOT_ENABLED
+
FatFs module is not enabled.
+
FR_NO_FILESYSTEM
+
There is no valid FAT partition on the disk.
+
+
+ + +
+

Description

+

The f_mountdrv forces the partition mounted (initializes FATFS structure). The file system is initialized automatically in accordance with the necessity when any file function is called. This function should not be used except for recovering FR_INCORRECT_DISK_CHANGE error. Using this function, while any file is opened, can destroy the file system.

+

In this function, following processes are executed.


+ +
+ + +
+

References

+

FATFS

+
+ +

Return

+ + diff --git a/third_party/fatfs/doc/en/open.html b/third_party/fatfs/doc/en/open.html new file mode 100644 index 0000000..d8cc7ff --- /dev/null +++ b/third_party/fatfs/doc/en/open.html @@ -0,0 +1,136 @@ + + + + + + + +FatFs - f_open + + + + +
+

f_open

+

The f_open function creates a file object to be used to access the file.

+
+FRESULT f_open (
+  FIL* FileObject,      /* Pointer to the blank file object structure */
+  const char* FileName, /* Pointer to the file neme */
+  BYTE ModeFlags        /* Mode flags */
+);
+
+
+ +
+

Parameters

+
+
FileObject
+
Pointer to the file object structure to be created. After the f_open funciton succeeded, the file can be accessed with the file object structure until it is closed.
+
FileName
+
Pointer to a null-terminated string that specifies the file name to create or open.
+
ModeFlags
+
Specifies the type of access and open method for the file. It is specified by a combination of following flags.
+ + + + + + + + +
ValueDescription
FA_READSpecifies read access to the object. Data can be read from the file.
Combine with FA_WRITE for read-write access.
FA_WRITESpecifies write access to the object. Data can be written to the file.
Combine with FA_READ for read-write access.
FA_OPEN_EXISTINGOpens the file. The function fails if the file is not existing.
FA_OPEN_ALWAYSOpens the file, if it is existing. If not, the function creates the new file.
FA_CREATE_NEWCreates a new file. The function fails if the file is already existing.
FA_CREATE_ALWAYSCreates a new file. If the file is existing, it is truncated and overwritten.
+
+
+
+ + +
+

Return Values

+
+
FR_OK (0)
+
The function succeeded and the file object is valid.
+
FR_NO_FILE
+
Could not find the file.
+
FR_NO_PATH
+
Could not find the path.
+
FR_INVALID_NAME
+
The file name is invalid.
+
FR_INVALID_DRIVE
+
The drive number is invalid.
+
FR_EXIST
+
The file is already existing.
+
FR_DENIED
+
The required access was denied due to any of following reasons: write mode open of a file that has read-only attribute, file creation under existing a same name directory or read-only file, cannot be created due to the directory table or disk full.
+
FR_NOT_READY
+
The disk drive cannot work due to no medium in the drive or any other reason.
+
FR_WRITE_PROTECTED
+
Write mode open or creation under the medium is write protected.
+
FR_RW_ERROR
+
The function failed due to a disk error or an internal error.
+
FR_NOT_ENABLED
+
The logical drive has no work area.
+
FR_NO_FILESYSTEM
+
There is no valid FAT partition on the disk.
+
+
+ + +
+

Description

+

The created file object is used for subsequent calls to refer to the file. When close an open file object, use f_close function.

+

Before using any file function, work area (file system object) must be given to each logical drive with f_mount function. All file functions can work after this procedure.

+

The mode flags, FA_WRITE, FA_CREATE_ALWAYS, FA_CREATE_NEW, FA_OPEN_ALWAYS, are not supported in read-only configuration.

+
+ + +
+

Example (File Copy)

+
+void main ()
+{
+    FATFS fs;            // Work area (file system object) for logical drive
+    FIL fsrc, fdst;      // file objects
+    BYTE buffer[4096];   // file copy buffer
+    FRESULT res;         // FatFs function common result code
+    WORD br, bw;         // File R/W count
+
+
+    // Register a work area to logical drive 0
+    f_mount(0, &fs);
+
+    // Open source file
+    res = f_open(&fsrc, "srcfile.dat", FA_OPEN_EXISTING | FA_READ);
+    if (res) die(res);
+
+    // Create destination file
+    res = f_open(&fdst, "dstfile.dat", FA_CREATE_ALWAYS | FA_WRITE);
+    if (res) die(res);
+
+    // Copy source to destination
+    for (;;) {
+        res = f_read(&fsrc, buffer, sizeof(buffer), &br);
+        if (res || br == 0) break;      // error or eof
+        res = f_write(&fdst, buffer, br, &bw);
+        if (res || bw < br) break;   // error or disk full
+    }
+
+    // Close all files
+    f_close(&fsrc);
+    f_close(&fdst);
+
+    // Unregister a work area before discard it
+    f_mount(0, NULL);
+}
+
+
+ + +
+

References

+

f_read, f_write, f_close, FIL, FATFS

+
+ +

Return

+ + diff --git a/third_party/fatfs/doc/en/opendir.html b/third_party/fatfs/doc/en/opendir.html new file mode 100644 index 0000000..dfe02cf --- /dev/null +++ b/third_party/fatfs/doc/en/opendir.html @@ -0,0 +1,73 @@ + + + + + + + +FatFs - f_opendir + + + + +
+

f_opendir

+

The f_opendir function opens a directory.

+
+FRESULT f_opendir (
+  DIR* DirObject,      /* Pointer to the blank directory object structure */
+  const char* DirName  /* Pointer to the directory name */
+);
+
+
+ +
+

Parameter

+
+
DirObject
+
Pointer to the blank directory object to be created.
+
DirName
+
Pinter to the null-terminated string that specifies the directory name to be opened.
+
+
+ + +
+

Return Values

+
+
FR_OK (0)
+
The function succeeded and the directory object is created. It is used for subsequent calls to read the directory entries.
+
FR_NO_FILE
+
Could not find the directory.
+
FR_NO_PATH
+
Could not find the path.
+
FR_INVALID_NAME
+
The path name is invalid.
+
FR_INVALID_DRIVE
+
The drive number is invalid.
+
FR_NOT_READY
+
The disk drive cannot work due to no medium in the drive or any other reason.
+
FR_RW_ERROR
+
The function failed due to a disk error or an internal error.
+
FR_NOT_ENABLED
+
The logical drive has no work area.
+
FR_NO_FILESYSTEM
+
There is no valid FAT partition on the disk.
+
+
+ + +
+

Description

+

The f_opendir function opens an exsisting directory and creates the directory object for subsequent calls. The directory object structure can be discarded at any time without any procedure. This function is not supported in minimization level of >=2.

+
+ + +
+

References

+

f_readdir, DIR

+
+ +

Return

+ + diff --git a/third_party/fatfs/doc/en/read.html b/third_party/fatfs/doc/en/read.html new file mode 100644 index 0000000..0c03971 --- /dev/null +++ b/third_party/fatfs/doc/en/read.html @@ -0,0 +1,71 @@ + + + + + + + +FatFs - f_read + + + + +
+

f_read

+

The f_read function reads data from a file.

+
+FRESULT f_read (
+  FIL* FileObject,    /* Pointer to the file object structure */
+  void* Buffer,       /* Pointer to the buffer to store read data */
+  WORD ByteToRead,    /* Number of bytes to read */
+  WORD* ByteRead      /* Pointer to the variable to return number of bytes read */
+);
+
+
+ +
+

Parameters

+
+
FileObject
+
Pointer to the open file object.
+
Buffer
+
Pointer to the buffer to store read data
+
ByteToRead
+
Number of bytes to read
+
ByteRead
+
Pointer to the WORD variable to return number of bytes read.
+ +
+ + +
+

Return Values

+
+
FR_OK (0)
+
The function succeeded.
+
FR_DENIED
+
The function denied due to the file has been opened in write only mode.
+
FR_RW_ERROR
+
The function failed due to a disk error or an internal error.
+
FR_NOT_READY
+
The disk drive cannot work due to no medium in the drive or any other reason.
+
FR_INVALID_OBJECT
+
The file object is invalid.
+
+
+ + +
+

Description

+

The file pointer in the file object increases in number of bytes read. The ByteRead will become less than ByteToRead when the read pointer reached to end of the file or any error occured during the read operation.

+
+ + +
+

References

+

f_open, f_write, f_close, FIL

+
+ +

Return

+ + diff --git a/third_party/fatfs/doc/en/readdir.html b/third_party/fatfs/doc/en/readdir.html new file mode 100644 index 0000000..5bf0004 --- /dev/null +++ b/third_party/fatfs/doc/en/readdir.html @@ -0,0 +1,89 @@ + + + + + + + +FatFs - f_readdir + + + + +
+

f_readdir

+

The f_readdir function reads directory entries.

+
+FRESULT f_readdir (
+  DIR* DirObject,    /* Pointer to the directory object structure */
+  FILINFO* FileInfo  /* Pointer to the file information structure */
+);
+
+
+ +
+

Parameters

+
+
DirObject
+
Pointer to the open directory strcture.
+
FileInfo
+
Pointer to the file information structure to store the read item.
+
+
+ + +
+

Return Values

+
+
FR_OK (0)
+
The function succeeded.
+
FR_NOT_READY
+
The disk drive cannot work due to no medium in the drive or any other reason.
+
FR_RW_ERROR
+
The function failed due to a disk error or an internal error.
+
FR_INVALID_OBJECT
+
The directory object is invalid.
+
+
+ + +
+

Description

+

The f_readdir function reads directory entries in sequence. All items in the directory can be read by calling f_readdir function repeatedly. When all directory items have been read and no item to read, the function returns a null string into f_name[] member without any error. For details of the file informations, refer to the FILINFO. This function is not supported in minimization level of >=2.

+
+ + +
+

Sample Code

+
+void scan_files (char* path)
+{
+    FILINFO finfo;
+    DIR dirs;
+    int i;
+
+    if (f_opendir(&dirs, path) == FR_OK) {
+        i = strlen(path);
+        while ((f_readdir(&dirs, &finfo) == FR_OK) && finfo.fname[0]) {
+            if (finfo.fattrib & AM_DIR) {
+                sprintf(path+i, "/%s", &finfo.fname[0]);
+                scan_files(path);
+                *(path+i) = '\0';
+            } else {
+                printf("%s/%s\n", path, &finfo.fname[0]);
+            }
+        }
+    }
+}
+
+
+ + +
+

References

+

f_opendir, f_stat, FILINFO, DIR

+
+ +

Return

+ + diff --git a/third_party/fatfs/doc/en/rename.html b/third_party/fatfs/doc/en/rename.html new file mode 100644 index 0000000..83bc6a2 --- /dev/null +++ b/third_party/fatfs/doc/en/rename.html @@ -0,0 +1,84 @@ + + + + + + + +FatFs - f_rename + + + + +
+

f_rename

+

Rename file or directory.

+
+FRESULT f_rename (
+  const char* OldName, /* Pointer to old file/directory name */
+  const char* NewName  /* Pointer to new file/directory name */
+);
+
+
+ +
+

Parameter

+
+
OldName
+
Pointer to a null-terminated string specifies the old file/directory name to be renamed.
+
NewName
+
Pointer to a null-terminated string specifies the new file/directory name without drive number. Existing object nannot be specified.
+
+
+ + +
+

Return Values

+
+
FR_OK (0)
+
The function succeeded.
+
FR_NO_FILE
+
Could not find the file nor directory.
+
FR_NO_PATH
+
Could not find the path.
+
FR_INVALID_NAME
+
The file name is invalid.
+
FR_INVALID_DRIVE
+
The drive number is invalid.
+
FR_NOT_READY
+
The disk drive cannot work due to no medium in the drive or any other reason.
+
FR_DENIED
+
The new name could not be created due to any reason.
+
FR_WRITE_PROTECTED
+
The medium is write protected.
+
FR_RW_ERROR
+
The function failed due to a disk error or an internal error.
+
FR_NOT_ENABLED
+
The logical drive has no work area.
+
FR_NO_FILESYSTEM
+
There is no valid FAT partition on the disk.
+
+
+ + +
+

Description

+

Rename a file or directory and can move it to other directory. Logical drive number is determined by old name, new name must not contain logical drive number. This function is not supported in read-only configuration or minimization level of >= 1.

+

Note: In this revision, moving any directory to other directory collapses the FAT structure on the disk.

+
+ + +
+

Example

+
+    // Rename file or directory
+    f_rename("oldname.txt", "newname.txt");
+
+    // Rename and move file to other directory simultaneously
+    f_rename("oldname.txt", "dir1/newname.txt");
+
+
+ +

Return

+ + diff --git a/third_party/fatfs/doc/en/sdir.html b/third_party/fatfs/doc/en/sdir.html new file mode 100644 index 0000000..a60b3c9 --- /dev/null +++ b/third_party/fatfs/doc/en/sdir.html @@ -0,0 +1,42 @@ + + + + + + + +FatFs - DIR + + + + +
+

DIR

+

The DIR structure is used for the work area to read a directory by f_oepndir and f_readdir functions.

+

FatFs

+
+typedef struct _DIR {
+    WORD    id;          /* Owner file system mount ID (inverted) */
+    WORD    index;       /* Current index */
+    FATFS*  fs;          /* Pointer to the owner file system object */
+    DWORD   sclust;      /* Start cluster */
+    DWORD   clust;       /* Current cluster */
+    DWORD   sect;        /* Current sector */
+} DIR;
+
+

Tiny-FatFs

+
+typedef struct _DIR {
+    WORD    id;          /* Owner file system mount ID (inverted) */
+    WORD    index;       /* Current index */
+    FATFS*  fs;          /* Pointer to the owner file system object */
+    CLUST   sclust;      /* Start cluster */
+    CLUST   clust;       /* Current cluster */
+    DWORD   sect;        /* Current sector */
+} DIR;
+
+
+ +

Return

+ + diff --git a/third_party/fatfs/doc/en/sfatfs.html b/third_party/fatfs/doc/en/sfatfs.html new file mode 100644 index 0000000..0878619 --- /dev/null +++ b/third_party/fatfs/doc/en/sfatfs.html @@ -0,0 +1,63 @@ + + + + + + + +FatFs - FATFS + + + + +
+

FATFS

+

The FATFS structure holds dynamic work area of individual logical drives. It is given by application program and registerd/unregisterd to the FatFs module with f_mount function. Following members are in standard configuration. There is no member that can be changed from the application program.

+

FatFs

+
+typedef struct _FATFS {
+    WORD    id;             /* File system mount ID */
+    WORD    n_rootdir;      /* Number of root directory entries */
+    DWORD   winsect;        /* Current sector appearing in the win[] */
+    DWORD   sects_fat;      /* Sectors per fat */
+    DWORD   max_clust;      /* Maximum cluster# + 1 */
+    DWORD   fatbase;        /* FAT start sector */
+    DWORD   dirbase;        /* Root directory start sector (cluster# for FAT32) */
+    DWORD   database;       /* Data start sector */
+    DWORD   last_clust;     /* Last allocated cluster */
+    DWORD   free_clust;     /* Number of free clusters */
+    BYTE    fs_type;        /* FAT type (0:Not mounted) */
+    BYTE    sects_clust;    /* Sectors per cluster */
+    BYTE    n_fats;         /* Number of FAT copies */
+    BYTE    drive;          /* Physical drive number */
+    BYTE    winflag;        /* win[] dirty flag (1:must be written back) */
+    BYTE    pad1;
+    BYTE    win[512];       /* Disk access window for Directory/FAT */
+} FATFS;
+
+ +

Tiny-FatFs

+
+typedef struct _FATFS {
+    WORD    id;             /* File system mount ID */
+    WORD    n_rootdir;      /* Number of root directory entries */
+    DWORD   winsect;        /* Current sector appearing in the win[] */
+    DWORD   fatbase;        /* FAT start sector */
+    DWORD   dirbase;        /* Root directory start sector */
+    DWORD   database;       /* Data start sector */
+    CLUST   sects_fat;      /* Sectors per fat */
+    CLUST   max_clust;      /* Maximum cluster# + 1 */
+    CLUST   last_clust;     /* Last allocated cluster */
+    CLUST   free_clust;     /* Number of free clusters */
+    BYTE    fs_type;        /* FAT type (0:Not mounted) */
+    BYTE    sects_clust;    /* Sectors per cluster */
+    BYTE    n_fats;         /* Number of FAT copies */
+    BYTE    winflag;        /* win[] dirty flag (1:must be written back) */
+    BYTE    win[512];       /* Disk access window for Directory/FAT/File */
+} FATFS;
+
+
+ +

Return

+ + diff --git a/third_party/fatfs/doc/en/sfile.html b/third_party/fatfs/doc/en/sfile.html new file mode 100644 index 0000000..cdc2eeb --- /dev/null +++ b/third_party/fatfs/doc/en/sfile.html @@ -0,0 +1,55 @@ + + + + + + + +FatFs - FIL + + + + +
+

FIL

+

The FIL structure (file object) holds state of a file. It is created by f_open function and discarded by f_close function. There is no member that can be changed by the application program.

+ +

FatFs

+
+typedef struct _FIL {
+    WORD    id;             /* Owner file system mount ID (inverted) */
+    BYTE    flag;           /* File status flags */
+    BYTE    sect_clust;     /* Left sectors in cluster */
+    FATFS*  fs;             /* Pointer to the owner file system object */
+    DWORD   fptr;           /* File R/W pointer */
+    DWORD   fsize;          /* File size */
+    DWORD   org_clust;      /* File start cluster */
+    DWORD   curr_clust;     /* Current cluster */
+    DWORD   curr_sect;      /* Current sector */
+    DWORD   dir_sect;       /* Sector containing the directory entry */
+    BYTE*   dir_ptr;        /* Ponter to the directory entry in the window */
+    BYTE    buffer[512];    /* File R/W buffer */
+} FIL;
+
+ +

Tiny-FatFs

+
+typedef struct _FIL {
+    WORD    id;             /* Owner file system mount ID (inverted) */
+    BYTE    flag;           /* File status flags */
+    BYTE    sect_clust;     /* Left sectors in cluster */
+    FATFS*  fs;             /* Pointer to owner file system */
+    DWORD   fptr;           /* File R/W pointer */
+    DWORD   fsize;          /* File size */
+    CLUST   org_clust;      /* File start cluster */
+    CLUST   curr_clust;     /* Current cluster */
+    DWORD   curr_sect;      /* Current sector */
+    DWORD   dir_sect;       /* Sector containing the directory entry */
+    BYTE*   dir_ptr;        /* Ponter to the directory entry in the window */
+} FIL;
+
+
+ +

Return

+ + diff --git a/third_party/fatfs/doc/en/sfileinfo.html b/third_party/fatfs/doc/en/sfileinfo.html new file mode 100644 index 0000000..f868d2f --- /dev/null +++ b/third_party/fatfs/doc/en/sfileinfo.html @@ -0,0 +1,43 @@ + + + + + + + +FatFs - FILINFO + + + + +
+

FILINFO

+

The FILINFO structure holds a file information returned by f_stat() and f_readdir().

+
+typedef struct _FILINFO {
+    DWORD fsize;            // Size
+    WORD fdate;             // Date
+    WORD ftime;             // Time
+    BYTE fattrib;           // Attribute
+    char fname[8+1+3+1];    // Name
+} FILINFO;
+
+
+ +

Members

+
+
fsize
+
Indicates size of the file in unit of byte. This is always zero when it is a directory.
+
fdate
+
Indicates the date that the file was modified or the directory was created.
+
ftime
+
Indicates the time that the file was modified or the directory was created.
+
fattrib
+
Indicates the file/directory attribute in combination of AM_DIR, AM_RDO, AM_HID, AM_SYS and AM_ARC.
+
fname[]
+
Indicates the file/directory name in 8.3 format null-terminated string.
+
+ +

Return

+ + diff --git a/third_party/fatfs/doc/en/stat.html b/third_party/fatfs/doc/en/stat.html new file mode 100644 index 0000000..bd14356 --- /dev/null +++ b/third_party/fatfs/doc/en/stat.html @@ -0,0 +1,73 @@ + + + + + + + +FatFs - f_stat + + + + +
+

f_stat

+

The f_stat gets the file status.

+
+FRESULT f_stat (
+  const char* FileName,   /* Pointer to the file or directory name */
+  FILINFO* FileInfo       /* Pointer to the FILINFO structure */
+);
+
+
+ +
+

Parameters

+
+
FileName
+
Pointer to the null-terminated string that specifies the file or directory to get its information.
+
FileInfo
+
Pointer to the blank FILINFO structure to store the information.
+
+
+ + +
+

Return Values

+
+
FR_OK (0)
+
The function succeeded.
+
FR_NO_FILE
+
Could not find the file or directory.
+
FR_NO_PATH
+
Could not find the path.
+
FR_INVALID_NAME
+
The file name is invalid.
+
FR_INVALID_DRIVE
+
The drive number is invalid.
+
FR_NOT_READY
+
The disk drive cannot work due to no medium in the drive or any other reason.
+
FR_RW_ERROR
+
The function failed due to a disk error or an internal error.
+
FR_NOT_ENABLED
+
The logical drive has no work area.
+
FR_NO_FILESYSTEM
+
There is no valid FAT partition on the disk.
+
+
+ + +
+

Description

+

The f_stat gets the information of a file or directory. For details of the infomation, refer to the FILINFO structure. This function is not supported in minimization level of >= 1.

+
+ + +
+

References

+

f_opendir, f_readdir, FILINFO

+
+ +

Return

+ + diff --git a/third_party/fatfs/doc/en/sync.html b/third_party/fatfs/doc/en/sync.html new file mode 100644 index 0000000..2f5afbe --- /dev/null +++ b/third_party/fatfs/doc/en/sync.html @@ -0,0 +1,60 @@ + + + + + + + +FatFs - f_sync + + + + +
+

f_sync

+

The f_sync function flushes the cached information of a wriiting file.

+
+FRESULT f_sync (
+  FIL* FileObject     /* Pointer to the file object */
+);
+
+
+ +
+

Parameters

+
+
FileObject
+
Pointer to the open file object to be flushed.
+
+
+ + +
+

Return Values

+
+
FR_OK (0)
+
The function succeeded.
+
FR_RW_ERROR
+
The function failed due to a disk error or an internal error.
+
FR_NOT_READY
+
The disk drive cannot work due to no medium in the drive or any other reason.
+
FR_INVALID_OBJECT
+
The file object is invalid.
+
+
+ + +
+

Description

+

The f_sync function performs the same process as f_close function but the file is left opened and can continue read/write/seek operations to the file. This is suitable for applications that open files for a long time in writing mode, such as data logger. Performing f_sync of periodic or immediataly after f_write can minimize risk of data loss due to sudden blackout or unintentional disk removal. This function is not supported in read-only configuration.

+
+ + +
+

References

+

f_close

+
+ +

Return

+ + diff --git a/third_party/fatfs/doc/en/unlink.html b/third_party/fatfs/doc/en/unlink.html new file mode 100644 index 0000000..d0652b5 --- /dev/null +++ b/third_party/fatfs/doc/en/unlink.html @@ -0,0 +1,69 @@ + + + + + + + +FatFs - f_unlink + + + + +
+

f_unlink

+

The f_unlink removes file or directory.

+
+FRESULT f_unlink (
+  const char* FileName  /* Pointer to the file or directory name */
+);
+
+
+ +
+

Parameters

+
+
FileName
+
Pointer to the null-terminated string that specifies a file or directory to be removed.
+
+
+ + +
+

Return Values

+
+
FR_OK (0)
+
The function succeeded.
+
FR_NO_FILE
+
Could not find the file or directory.
+
FR_NO_PATH
+
Could not find the path.
+
FR_INVALID_NAME
+
The path name is invalid.
+
FR_INVALID_DRIVE
+
The drive number is invalid.
+
FR_DENIED
+
The function was denied due to either of following reasons: the file or directory has read-only attribute, the directory is not empty.
+
FR_NOT_READY
+
The disk drive cannot work due to no medium in the drive or any other reason.
+
FR_WRITE_PROTECTED
+
The medium is write protected.
+
FR_RW_ERROR
+
The function failed due to a disk error or an internal error.
+
FR_NOT_ENABLED
+
The logical drive has no work area.
+
FR_NO_FILESYSTEM
+
There is no valid FAT partition on the disk.
+
+
+ + +
+

Description

+

The f_unlink function removes a file or directory. In read-only configuration or minimization level is >= 1, this function is not supported.

+
+ + +

Return

+ + diff --git a/third_party/fatfs/doc/en/write.html b/third_party/fatfs/doc/en/write.html new file mode 100644 index 0000000..dcd4e84 --- /dev/null +++ b/third_party/fatfs/doc/en/write.html @@ -0,0 +1,71 @@ + + + + + + + +FatFs - f_write + + + + +
+

f_write

+

The f_write writes data to a file.

+
+FRESULT f_write (
+  FIL* FileObject,     /* Pointer to the file object structure */
+  const void* Buffer,  /* Pointer to the data to be written */
+  WORD ByteToWrite,    /* Number of bytes to write */
+  WORD* ByteWritten    /* Pointer to the variable to return number of bytes written */
+);
+
+
+ +
+

Parameter

+
+
FileObject
+
Pointer to the open file object structure.
+
Buffer
+
Pointer to the data to be written.
+
ByteToWrite
+
Specifies number of bytes to write.
+
ByteWritten
+
Pointer to the WORD variable to return number of bytes written.
+
+
+ + +
+

Return Values

+
+
FR_OK (0)
+
The function succeeded.
+
FR_DENIED
+
The function denied due to the file has been opened in read only mode.
+
FR_RW_ERROR
+
The function failed due to a disk error or an internal error.
+
FR_NOT_READY
+
The disk drive cannot work due to no medium in the drive or any other reason.
+
FR_INVALID_OBJECT
+
The file object is invalid.
+
+
+ + +
+

Description

+

The read/write pointer in the file object is increased in number of bytes written. The ByteWritten will become less than ByteToWrite when disk gets full during write function. This function is not supported in read-only configuration.

+
+ + +
+

References

+

f_open, f_read, f_close, FIL

+
+ +

Return

+ + diff --git a/third_party/fatfs/doc/img/f1.png b/third_party/fatfs/doc/img/f1.png new file mode 100644 index 0000000..42cc271 Binary files /dev/null and b/third_party/fatfs/doc/img/f1.png differ diff --git a/third_party/fatfs/doc/img/f2.png b/third_party/fatfs/doc/img/f2.png new file mode 100644 index 0000000..8ef0ec2 Binary files /dev/null and b/third_party/fatfs/doc/img/f2.png differ diff --git a/third_party/fatfs/doc/img/f3.png b/third_party/fatfs/doc/img/f3.png new file mode 100644 index 0000000..9111bfc Binary files /dev/null and b/third_party/fatfs/doc/img/f3.png differ diff --git a/third_party/fatfs/doc/img/f4.png b/third_party/fatfs/doc/img/f4.png new file mode 100644 index 0000000..35716ff Binary files /dev/null and b/third_party/fatfs/doc/img/f4.png differ diff --git a/third_party/fatfs/doc/img/f5.png b/third_party/fatfs/doc/img/f5.png new file mode 100644 index 0000000..855917a Binary files /dev/null and b/third_party/fatfs/doc/img/f5.png differ diff --git a/third_party/fatfs/doc/img/layers.png b/third_party/fatfs/doc/img/layers.png new file mode 100644 index 0000000..69773ee Binary files /dev/null and b/third_party/fatfs/doc/img/layers.png differ diff --git a/third_party/fatfs/doc/img/rw_ata.jpeg b/third_party/fatfs/doc/img/rw_ata.jpeg new file mode 100644 index 0000000..2b97d93 Binary files /dev/null and b/third_party/fatfs/doc/img/rw_ata.jpeg differ diff --git a/third_party/fatfs/doc/img/rw_cfc.jpeg b/third_party/fatfs/doc/img/rw_cfc.jpeg new file mode 100644 index 0000000..c92d5fe Binary files /dev/null and b/third_party/fatfs/doc/img/rw_cfc.jpeg differ diff --git a/third_party/fatfs/doc/img/rw_mmc.jpeg b/third_party/fatfs/doc/img/rw_mmc.jpeg new file mode 100644 index 0000000..5f8115e Binary files /dev/null and b/third_party/fatfs/doc/img/rw_mmc.jpeg differ diff --git a/third_party/fatfs/doc/img/rwtest.png b/third_party/fatfs/doc/img/rwtest.png new file mode 100644 index 0000000..d2e646f Binary files /dev/null and b/third_party/fatfs/doc/img/rwtest.png differ diff --git a/third_party/fatfs/doc/ja/appnote.html b/third_party/fatfs/doc/ja/appnote.html new file mode 100644 index 0000000..ab82799 --- /dev/null +++ b/third_party/fatfs/doc/ja/appnote.html @@ -0,0 +1,125 @@ + + + + + + + +FatFsモジュール アプリケーション・ノート + + + +

FatFsモジュール アプリケーション・ノート

+
+ +
+

移植の際に配慮すべきこと

+

FatFsモジュールは移植性に関して次の点を前提としています。

+ +
+ +
+

メモリ使用量 (R0.04b)

+

各種環境でのモジュールのメモリ使用量の例を示します。数値の単位はバイトで、Dは論理ドライブ数、Fは同時オープン・ファイル数を示します。最適化オプションは、全てコード・サイズとしています。

+ + + + + + + + + + + + + + + + +
AVRH8/300HMSP430TLCS-870/CV850ESSH2
コンパイラgccCH38CL430CC870CCA850SHC
_MCU_ENDIAN122112
FatFs コード
(標準, R/W構成)
8722877664027338
FatFs コード
(最小, R/W構成)
5814572240944906
FatFs コード
(標準, R/O構成)
4248409630103506
FatFs コード
(最小, R/O構成)
3038311022102698
FatFs 静的ワークD*2 + 2D*4 + 2D*4 + 2D*4 + 2
FatFs 動的ワークD*554 + F*544D*554 + F*550D*554 + F*550D*554 + F*550
Tiny-FatFs コード
(標準, R/W構成)
7264724066348837
Tiny-FatFs コード
(最小, R/W構成)
4750480643666163
Tiny-FatFs コード
(標準, R/O構成)
3600354832124347
Tiny-FatFs コード
(最小, R/O構成)
2568270223943322
Tiny-FatFs 静的ワーク4644
Tiny-FatFs 動的ワーク544 + F*28544 + F*32544 + F*28544 + F*28
+
+ +
+

FatFs vs. Tiny-FatFs

+

ポータブル・オーディオやデータ・ロガーなど、よくある用途ではTiny-FatFsで十分です。しかし、Tiny-FatFsは標準構成ではFAT32に対応していないので、使用できるディスクは2GB(FAT64で4GB)までという制約があります。_FAT32オプションでFAT32対応を追加できますが、その分コード・サイズが膨らみます。フル機能のFatFsは、複数ファイルを高速アクセスする場合や、複数ドライブの対応が必要な場合に有効です。

+
+ + + + + +
メモリ容量FATタイプ
<= 64MBFAT12
128MB〜2GBFAT16
>= 4GBFAT32
+
+

2GBまでのカードに限るなら、FAT32への対応は不要です。右の表にメモリ・カードの容量と規定のFATタイプ(SDメモリの場合)を示します。メモリ・カードの出荷時は、最大のパフォーマンスが出るようにデータ領域の境界が調整されたフォーマットになっています。したがって、PCでフォーマットするなどして規定と違うフォーマットになると、書き込み性能が大幅に低下する場合があるので注意が必要です。

+
+ +
+

効率の良いファイル・アクセスの方法

+

資源の限られた組み込みシステムで効率よくアクセスするためには、ファイル・アクセスの仕組みをある程度意識した使用が求められます。FatFsモジュールでは、ディスク上のファイル・データは f_read()内で次のような手順で読み出されます。

+
図1. セクタ・ミスアライメント・リード
+fig.1 +
+
+
図2. セクタ・ミスアライメント・リード
+fig.2 +
+
+
図3. セクタ・アライメント・リード
+fig.3 +
+
+

ここでファイルI/Oバッファとは、データ・セクタの一部を読み書きするための1セクタ長のバッファで、FatFsではそのファイル・オブジェクト内の、Tiny-FatFsではワークエリア内のバッファのことを指しています。

+

Tiny-FatFsでは、全てのデータ転送とFATやディレクトリへのアクセスをただ一つのセクタ・バッファで行っているため、データ転送によりFATのキャッシュが失われ、クラスタ境界を通過するたびにFATセクタを読み直す必要があります。FatFsの場合は、データ用バッファはFAT用とは別なので、FATセクタを読む頻度はTiny-FatFsの 1/341, 1/256 または 1/128で済みます(クラスタが連続している場合)。つまり、Tiny-FatFsは性能低下の代償を払ってRAM使用量を削減しているわけです。

+

転送領域のうちセクタ全体を含む部分は(図2)のようにファイルI/Oバッファを介さず、ディスクとの間で直接転送されます。完全なセクタ・アライメント・アクセスの場合(図3)は、ファイルI/Oバッファは全く使用されません。直接転送では、可能ならdisk_read()に複数セクタを指定して最大限のマルチ・セクタ転送が行われます。ただし、クラスタ境界をまたぐときはクラスタが隣接していたとしても転送は分割されます。

+

このように、極力セクタ・アライメント・アクセスになるように配慮すれば、無駄なメモリ・コピーが減って性能が向上します。さらに、Tiny-FatFsではFATのキャッシュが生きるようになり、省メモリ特性とFatFsの性能とが同時に得られます。

+
+ +
+

クリチカル・セクション

+

ディスク上のFAT構造を操作している途中で、停電、不正なメディアの取り外し、回復不能なデータ・エラー等の障害が発生すると、処理が中途半端な状態で中断され、その結果としてFAT構造が破壊される可能性があります。次にFatFsモジュールにおけるクリチカル・セクションと、その間の障害により起きうるエラーの状態を示します。

+
+図4. 長いクリチカル・セクション
+fig.4 +
+
+図5. 短くしたクリチカル・セクション
+fig.5 +
+
+

赤で示したセクションを実行中に障害が発生した場合、クロス・リンクが発生して操作対象のファイル・ディレクトリが失われる可能性があります。黄色で示したセクションを実行中に障害が発生した場合、つぎのうちいずれかまたは複数の結果が生じる可能性があります。

+ +

いずれも書き込み中や操作対象でないファイルには影響はありません。これらのクリチカル・セクションは、ファイルを書き込みモードで開いている時間を最小限にするか、f_sync()を適宜使用することで図5のようにリスクを最小化することができます。

+
+ + +
+

現リビジョンの問題点とその改善案

+ +
+

そして、これらの機能拡張を行うとそれだけ多くのリソースが要求されるようになり、このプロジェクトの対象とする8/16ビット・マイコンのシステムに載せられなくなってしまうという問題もあります(これが一番の問題かも知れません)。

+
+ +

戻る

+ + diff --git a/third_party/fatfs/doc/ja/chmod.html b/third_party/fatfs/doc/ja/chmod.html new file mode 100644 index 0000000..8c76674 --- /dev/null +++ b/third_party/fatfs/doc/ja/chmod.html @@ -0,0 +1,89 @@ + + + + + + + +FatFs - f_chmod + + + + +
+

f_chmod

+

ファイルまたはディレクトリの属性を変更します。

+
+FRESULT f_chmod (
+  const char* FileName, /* ファイルまたはディレクトリ名へのポインタ */
+  BYTE Attribute,       /* 設定値 */
+  BYTE AttributeMask    /* 変更マスク */
+);
+
+
+ +
+

引数

+
+
FileName
+
属性変更対象のファイルまたはディレクトリのフルパス名の入った'\0'で終わる文字列を指定します。
+
Attribute
+
設定する属性。指定可能な属性は次の通りで、これらの組み合わせで指定します。指定されなかった属性は解除されます。
+ + + + + + +
値意味
AM_RDOリード・オンリー
AM_ARCアーカイブ
AM_SYSシステム
AM_HIDヒドゥン
+
+
AttributeMask
+
変更する属性のマスク。指定した属性が設定または解除され、指定されなかった属性は状態が保持されます。Attributeと同じ値を使います。
+
+
+ + +
+

戻り値

+
+
FR_OK (0)
+
正常終了。
+
FR_NO_FILE
+
ファイルが見つからない。
+
FR_NO_PATH
+
パスが見つからない。
+
FR_INVALID_NAME
+
パス名が不正。
+
FR_INVALID_NAME
+
ドライブ番号が不正。
+
FR_NOT_READY
+
メディアがセットされていないなど、ディスク・ドライブが動作不能状態。
+
FR_WRITE_PROTECTED
+
メディアが書き込み禁止状態。
+
FR_RW_ERROR
+
ディスク・エラーまたは内部エラーによる失敗。
+
FR_NOT_ENABLED
+
その論理ドライブにワーク・エリアが与えられていない。
+
FR_NO_FILESYSTEM
+
ディスク上に有効なFATパーテーションが見つからない。
+
+
+ + +
+

解説

+

ファイルまたはディレクトリの属性を変更します。リード・オンリー構成および_FS_MINIMIZE >= 1ではこの関数はサポートされません。

+
+ + +
+

使用例

+
+    // Set read-only flag , clear archive flag and others are left unchanged.
+    f_chmod("file.txt", AM_RDO, AM_RDO | AM_ARC);
+
+
+ +

戻る

+ + diff --git a/third_party/fatfs/doc/ja/close.html b/third_party/fatfs/doc/ja/close.html new file mode 100644 index 0000000..2da739a --- /dev/null +++ b/third_party/fatfs/doc/ja/close.html @@ -0,0 +1,60 @@ + + + + + + + +FatFs - f_close + + + + +
+

f_close

+

ファイルを閉じます。

+
+FRESULT f_close (
+  FIL* FileObject     /* ファイル・オブジェクトへのポインタ */
+);
+
+
+ +
+

引数

+
+
FileObject
+
閉じようとするファイルのファイル・オブジェクト構造体へのポインタを指定します。
+
+
+ + +
+

戻り値

+
+
FR_OK (0)
+
正常終了。
+
FR_RW_ERROR
+
ディスク・エラーまたは内部エラーによる失敗。
+
FR_NOT_READY
+
メディアがセットされていないなど、ディスク・ドライブが動作不能状態。
+
FR_INVALID_OBJECT
+
無効なファイル・オブジェクト。
+
+
+ + +
+

解説

+

ファイルを閉じます。書き込みの行われたファイルの場合、キャッシュされた状態(R/Wバッファ上のデータ、変更されたFATやディレクトリ項目)はディスクに書き戻されます。関数が正常終了すると、そのファイル・オブジェクトは無効になり、そのメモリも解放できます。読み込み専用モードで開かれたファイル・オブジェクトは、この関数によるクローズ処理を経ずに破棄することもできます。

+
+ + +
+

参照

+f_open, f_read, f_write, f_sync, FIL, FATFS +
+ +

戻る

+ + diff --git a/third_party/fatfs/doc/ja/dinit.html b/third_party/fatfs/doc/ja/dinit.html new file mode 100644 index 0000000..7a32450 --- /dev/null +++ b/third_party/fatfs/doc/ja/dinit.html @@ -0,0 +1,44 @@ + + + + + + + +FatFs - disk_initialize + + + + +
+

disk_initialize

+

ディスク・ドライブを初期化します。

+
+DSTATUS disk_initialize (
+  BYTE Drive      /* 物理ドライブ番号 */
+);
+
+
+ +
+

引数

+
+
Drive
+
初期化する物理ドライブ番号(0-9)を指定します。
+
+
+ + +
+

戻り値

+

この関数は戻り値としてディスク・ステータスを返します。ディスク・ステータスの詳細に関してはdisk_status()を参照してください。

+
+ +
+

解説

+

ディスク・ドライブを初期化します。関数が成功すると、戻り値のSTA_NOINITフラグがクリアされます。

+
+ +

戻る

+ + diff --git a/third_party/fatfs/doc/ja/dioctl.html b/third_party/fatfs/doc/ja/dioctl.html new file mode 100644 index 0000000..519f7c6 --- /dev/null +++ b/third_party/fatfs/doc/ja/dioctl.html @@ -0,0 +1,65 @@ + + + + + + + +FatFs - disk_ioctl + + + + +
+

disk_ioctl

+

セクタの読み書き以外のディスク・ドライブ自体に対する様々な制御をします。

+
+DRESULT disk_ioctl (
+  BYTE Drive,      /* 物理ドライブ番号 */
+  BYTE Command,    /* 制御コマンド */
+  void* Buffer     /* データ受け渡しバッファ */
+);
+
+
+ +
+

引数

+
+
Drive
+
物理ドライブ番号(0-9)を指定します。
+
Command
+
制御コマンド・コードを指定します。
+
Buffer
+
制御コマンドに依存したパラメータを授受するバッファを指すポインタを指定します。バッファを使用しないコマンドの場合は、NULLを指定します。
+
+
+ +
+

戻り値

+
+
RES_OK (0)
+
正常終了。
+
RES_ERROR
+
何らかのエラーが発生した。
+
RES_PARERR
+
コマンドが不正。
+
RES_NOTRDY
+
ドライブが動作可能状態ではない、または初期化されていない。
+
+
+ +
+

解説

+

物理ドライブの種類によりサポートされるコマンドは異なりますが、FatFsモジュールでは、ドライブの種類に依存した制御は行いません。次のドライブ共通コマンドを使用します。

+

リード・オンリー構成ではこの関数は必要とされません。

+ + + + +
コマンド解説
GET_SECTOR_COUNTBufferの指すDWORD変数にドライブ上の総セクタ数を返します。
CTRL_SYNCドライブがデータの書き込みを完了するのを待ちます。ライト・バック・キャッシュを持っている場合は、書き込まれていないデータを即時書き戻します。
+
+ + +

戻る

+ + diff --git a/third_party/fatfs/doc/ja/dread.html b/third_party/fatfs/doc/ja/dread.html new file mode 100644 index 0000000..f665b04 --- /dev/null +++ b/third_party/fatfs/doc/ja/dread.html @@ -0,0 +1,58 @@ + + + + + + + +FatFs - disk_read + + + + +
+

disk_read

+

ディスクからセクタを読み出します。

+
+DRESULT disk_read (
+  BYTE Drive,          /* 物理ドライブ番号 */
+  BYTE* Buffer,        /* 読み出しバッファへのポインタ */
+  DWORD SectorNumber,  /* 読み出し開始セクタ番号 */
+  BYTE SectorCount     /* 読み出しセクタ数 */
+);
+
+
+ +
+

引数

+
+
Drive
+
物理ドライブ番号(0-9)を指定します。
+
Buffer
+
ディスクから読み出したデータを格納するバッファ。SectorCount * 512バイトのサイズが必要です。
+
SectorNumber
+
読み出しを開始するセクタ番号。LBAで指定します。
+
SectorCount
+
読み出すセクタ数。 1〜255で設定します
+
+
+ + +
+

戻り値

+
+
RES_OK (0)
+
正常終了。
+
RES_ERROR
+
読み込み中にエラーが発生した。
+
RES_PARERR
+
パラメータが不正。
+
RES_NOTRDY
+
ドライブが動作可能状態ではない(初期化されていない)。
+
+
+ + +

戻る

+ + diff --git a/third_party/fatfs/doc/ja/dstat.html b/third_party/fatfs/doc/ja/dstat.html new file mode 100644 index 0000000..9e04ccb --- /dev/null +++ b/third_party/fatfs/doc/ja/dstat.html @@ -0,0 +1,47 @@ + + + + + + + +FatFs - disk_status + + + + +
+

disk_status

+

ディスク・ドライブの状態を取得します。

+
+DSTATUS disk_status (
+  BYTE Drive           /* 物理ドライブ番号 */
+);
+
+
+ +
+

引数

+
+
Drive
+
ステータスを取得する物理ドライブ番号を指定します。
+
+
+ + +
+

戻り値

+

物理ドライブの状態が次のフラグの組み合わせの値で返されます。

+
+
STA_NOINIT
+
ドライブが初期化されていないことを示すフラグ。システム・リセットやメディアの取り外し等でセットされ、disk_initialize() の正常終了でクリア、失敗でセットされます。
+
STA_NODISK
+
メディアがセットされていないことを示すフラグ。メディアが取り外されている間はセットされ、メディアがセットされている間はクリアされます。固定ディスクでは常にクリアされています。
+
STA_PROTECTED
+
メディアがライト・プロテクトされていることを示すフラグ。ライト・プロテクト機能をサポートしないメディアでは常にクリアされています。
+
+
+ +

戻る

+ + diff --git a/third_party/fatfs/doc/ja/dwrite.html b/third_party/fatfs/doc/ja/dwrite.html new file mode 100644 index 0000000..15eb2b2 --- /dev/null +++ b/third_party/fatfs/doc/ja/dwrite.html @@ -0,0 +1,66 @@ + + + + + + + +FatFs - disk_write + + + + +
+

disk_write

+

ディスクにデータを書き込みます。

+
+DRESULT disk_write (
+  BYTE Drive,          /* 物理ドライブ番号 */
+  const BYTE* Buffer,  /* 書き込むデータへのポインタ */
+  DWORD SectorNumber,  /* 書き込み開始セクタ番号 */
+  BYTE SectorCount     /* 書き込みセクタ数 */
+);
+
+
+ +
+

引数

+
+
Drive
+
物理ドライブ番号(0-9)を指定します。
+
Buffer
+
ディスクに書き込むデータを指定します。
+
SectorNumber
+
書き込みを開始するセクタ番号。LBAで指定します。
+
SectorCount
+
書き込むセクタ数。 1〜255で設定します。
+
+
+ + +
+

戻り値

+
+
RES_OK (0)
+
正常終了。
+
RES_ERROR
+
書き込み中にエラーが発生した。
+
RES_WRPRT
+
ディスクが書き込み禁止状態。
+
RES_PARERR
+
パラメータが不正。
+
RES_NOTRDY
+
ドライブが動作可能状態ではない(初期化されていない)。
+
+
+ + +
+

解説

+

リード・オンリー構成ではこの関数は必要とされません。

+
+ + +

戻る

+ + diff --git a/third_party/fatfs/doc/ja/fattime.html b/third_party/fatfs/doc/ja/fattime.html new file mode 100644 index 0000000..5473557 --- /dev/null +++ b/third_party/fatfs/doc/ja/fattime.html @@ -0,0 +1,50 @@ + + + + + + + +FatFs - get_fattime + + + + +
+

get_fattime

+

現在時刻を取得します。

+
+DWORD get_fattime (void);
+
+
+ + +
+

戻り値

+

現在のローカル・タイムがDWORD値にパックされて返されます。ビット・フィールドは次に示すようになります。

+
+
bit31:25
+
1980年を起点とした年が 0..127 で入ります。
+
bit24:21
+
月が 1..12 の値で入ります。
+
bit20:16
+
日が 1..31 の値で入ります。
+
bit15:11
+
時が 0..23 の値で入ります。
+
bit10:5
+
分が 0..59 の値で入ります。
+
bit4:0
+
秒/2が 0..29 の値で入ります。
+
+
+ + +
+

解説

+

RTCをサポートしないシステムでも、何らかの日付として有効な値を返さなければなりません。リード・オンリー構成ではこの関数は必要とされません。

+
+ + +

戻る

+ + diff --git a/third_party/fatfs/doc/ja/filename.html b/third_party/fatfs/doc/ja/filename.html new file mode 100644 index 0000000..6689b14 --- /dev/null +++ b/third_party/fatfs/doc/ja/filename.html @@ -0,0 +1,56 @@ + + + + + + + +FatFs - ファイル・ディレクトリの指定方法 + + + +
+

ファイル・ディレクトリの指定方法

+

FatFsモジュールでのファイル、ディレクトリ、ドライブの指定方法はMS-DOSとほぼ同じです。ただし、MS-DOSのようなカレント・ディレクトリの概念は無いので、常にルート・ディレクトリから辿る絶対パスでの指定となります。パス名の指定方法と例は次の通りです。

+
+
+ "[論理ドライブ番号:][/]ディレクトリ名/ファイル名"
+
+ "file1.txt"           ファイル(ドライブ0)
+ "/file1.txt"          ↑と同じ
+ "dir1/dir2/file1.txt" ファイル(ドライブ0)
+ "2:dir3/file2.txt"    ファイル(ドライブ2)
+ "2:/dir5"             ディレクトリ(ドライブ2)
+ ""                    ルート・ディレクトリ(ドライブ0)
+ "/"                   ↑と同じ
+ "2:"                  ルート・ディレクトリ(ドライブ2)
+
+
+

FatFsモジュールは8.3形式ファイル名にのみ対応しています。長いファイル名には対応していないので、ファイル名やディレクトリ名は8.3形式の範囲内で指定します。ディレクトリ・セパレータには'/'を使用します。パス名先頭の'/'は、あってもなくても同じです。論理ドライブ番号は、'0'〜'9'の一文字の数字とコロンで指定します。省略した場合は"0:"を指定したことになります。Tiny-FatFsでは一つのファイル・システム・オブジェクトしか持てず、常に論理ドライブ0として動作します。また、パス名中に論理ドライブ番号を使用できません。

+
+


+
+

論理ドライブと物理ドライブの対応

+

標準構成では、それぞれの論理ドライブは同じ番号の物理ドライブに1:1で結びつけられていて、先頭の区画がマウントされます。構成オプションで_MULTI_PARTITIONを指定すると、論理ドライブに対して個別に物理ドライブ番号・区画を指定できるようになります。この構成では、論理ドライブと区画の対応を解決するためのテーブルを次に示すように定義する必要があります。

+
+例:論理ドライブ0〜2を物理ドライブ0(固定ディスク)の3つの基本区画に割り当て、
+   論理ドライブ3を物理ドライブ1(リムーバブル・ディスク)に割り当てる場合。
+
+const PARTITION Drives[] = {
+    {0, 0},     /* Logical drive 0 ==> Physical drive 0, 1st partition */
+    {0, 1},     /* Logical drive 1 ==> Physical drive 0, 2nd partition */
+    {0, 2},     /* Logical drive 2 ==> Physical drive 0, 3rd partition */
+    {1, 0}      /* Logical drive 3 ==> Physical drive 1 */
+};
+
+

複数区画指定を使用する場合、次の点に注意しなければなりません。 +

+ + + diff --git a/third_party/fatfs/doc/ja/getfree.html b/third_party/fatfs/doc/ja/getfree.html new file mode 100644 index 0000000..eb328e7 --- /dev/null +++ b/third_party/fatfs/doc/ja/getfree.html @@ -0,0 +1,91 @@ + + + + + + + +FatFs - f_getfree + + + + +
+

f_getfree

+

論理ドライブ上の未使用クラスタ数を得ます。

+
+FRESULT f_getfree (
+  const char* Path,        /* 対象ドライブのルート・ディレクトリ */
+  DWORD* Clusters,         /* 空きクラスタ数を格納する変数へのポインタ */
+  FATFS** FileSystemObject /* ファイル・システム・オブジェクトを指すポインタへのポインタ */
+);
+
+
+ +
+

引数

+
+
Path
+
対象の論理ドライブのルートディレクトリのパス名が入った'\0'で終わる文字列へのポインタを指定します。
+
Clusters
+
空きクラスタ数を格納するDWORD変数へのポインタを指定します。
+
FileSystemObject
+
対象ドライブのファイル・システム・オブジェクトを指すポインタが返されます。
+
+
+ + +
+

戻り値

+
+
FR_OK (0)
+
正常終了。*Clustersに空きクラスタ数が返されます。
+
FR_INVALID_DRIVE
+
ドライブ番号が不正。
+
FR_NOT_READY
+
メディアがセットされていないなど、ディスクドライブが動作不能状態。
+
FR_RW_ERROR
+
ディスク・エラーまたは内部エラーによる失敗。
+
FR_NOT_ENABLED
+
その論理ドライブにワーク・エリアが与えられていない。
+
FR_NO_FILESYSTEM
+
ディスク上に有効なFATパーテーションが見つからない。
+
+
+ + +
+

解説

+

論理ドライブ上の空きクラスタ数を取得します。返されたファイル・システム・オブジェクトのsects_clustメンバがクラスタあたりのセクタ数を示しているので、これを元に実際の空きサイズが計算できます。FAT32ボリュームにおいて、_USE_FSINFOが指定されている場合、不正確な値を返す場合があります。指定されていない場合、処理に時間がかかります。

+

リードオンリー構成および_FS_MINIMIZE >= 1ではこの関数はサポートされません。

+
+ + +
+

使用例

+
+    FATFS *fs;
+    DWORD clust;
+
+
+    // Get free clusters
+    res = f_getfree("", &clust, &fs);
+    if (res) die(res);
+
+    // Get free space
+    printf("%lu KB total disk space.\n"
+           "%lu KB available on the disk.\n",
+           (DWORD)(fs->max_clust - 2) * fs->sects_clust / 2,
+           clust * fs->sects_clust / 2);
+
+
+ + +
+

参照

+FATFS +
+ +

戻る

+ + diff --git a/third_party/fatfs/doc/ja/lseek.html b/third_party/fatfs/doc/ja/lseek.html new file mode 100644 index 0000000..855894f --- /dev/null +++ b/third_party/fatfs/doc/ja/lseek.html @@ -0,0 +1,87 @@ + + + + + + + +FatFs - f_lseek + + + + +
+

f_lseek

+

ファイルのR/Wポインタを移動します。

+
+FRESULT f_lseek (
+  FIL* FileObject,   /* ファイル・オブジェクト構造体へのポインタ */
+  DWORD Offset       /* 移動先オフセット */
+);
+
+
+ +
+

引数

+
+
FileObject
+
対象となるファイル・オブジェクト構造体へのポインタを指定します。
+
Offset
+
移動先のオフセット(R/Wポインタ)値。ファイル先頭からのオフセットをバイト単位で指定します。
+
+
+ + +
+

戻り値

+
+
FR_OK (0)
+
正常終了。
+
FR_RW_ERROR
+
ディスク・エラーまたは内部エラーによる失敗。
+
FR_NOT_READY
+
メディアがセットされていないなど、ディスク・ドライブが動作不能状態。
+
FR_INVALID_OBJECT
+
無効なファイル・オブジェクト。
+
+
+ + +
+

解説

+

ファイルR/Wポインタ(ファイル・オブジェクト内のfptrメンバで、次に読み出し・書き込みされるバイトのオフセットを示す)を移動します。オフセットの原点はファイル先頭からです。書き込みモードでファイル・サイズより大きな値を指定すると、そこまでファイルが拡張され、拡張された部分のデータは未定義となります。大容量データを遅延無く高速に書き込みたいときは、予めこの関数で必要なサイズまでファイルを拡張しておくと良いです。f_lseek関数が正常終了したあとは、ファイルR/Wポインタが正しく移動したかfptrをチェックするべきです。ファイルR/Wポインタが指定より小さいときは、次の原因が考えられます。

+ +

_FS_MINIMIZE >= 3ではこの関数はサポートされません。

+
+ + +
+

使用例

+
+    // ファイル・オフセット5000へ移動
+    res = f_lseek(&file, 5000);
+
+    // 3000バイト進める
+    res = f_lseek(&file, file.fptr + 3000);
+
+    // 2000バイト戻す(オーバーフローに注意)
+    res = f_lseek(&file, file.fptr - 2000);
+
+    // ファイル追記の準備
+    res = f_lseek(&file, file.fsize);
+
+
+ + +
+

参照

+

f_open, FIL

+
+ +

戻る

+ + diff --git a/third_party/fatfs/doc/ja/mkdir.html b/third_party/fatfs/doc/ja/mkdir.html new file mode 100644 index 0000000..da2dbc4 --- /dev/null +++ b/third_party/fatfs/doc/ja/mkdir.html @@ -0,0 +1,83 @@ + + + + + + + +FatFs - f_mkdir + + + + +
+

f_mkdir

+

ディレクトリを作成します。

+
+FRESULT f_mkdir (
+  const char* DirName /* 作成するディレクトリ名へのポインタ */
+);
+
+
+ +
+

引数

+
+
DirName
+
作成するディレクトリのフルパス名が入った'\0'で終わる文字列へのポインタを指定します。
+
+
+ + +
+

戻り値

+
+
FR_OK (0)
+
正常終了。
+
FR_NO_PATH
+
パスが見つからない。
+
FR_INVALID_NAME
+
パス名が不正。
+
FR_INVALID_DRIVE
+
ドライブ番号が不正。
+
FR_DENIED
+
ディスクやディレクトリ・エントリが満杯の場合など。
+
FR_EXIST
+
同名のディレクトリやファイルが存在する。
+
FR_NOT_READY
+
メディアがセットされていないなど、ディスク・ドライブが動作不能状態。
+
FR_WRITE_PROTECTED
+
メディアが書き込み禁止状態。
+
FR_RW_ERROR
+
ディスク・エラーまたは内部エラーによる失敗。
+
FR_NOT_ENABLED
+
その論理ドライブにワーク・エリアが与えられていない。
+
FR_NO_FILESYSTEM
+
ディスク上に有効なFATパーテーションが見つからない。
+
+
+ + +
+

解説

+

空のディレクトリを作成します。リード・オンリー構成および_FS_MINIMIZE >= 1ではこの関数はサポートされません。

+

+

+
+ + +
+

使用例

+
+    res = f_mkdir("sub1");
+    if (res) die(res);
+    res = f_mkdir("sub1/sub2");
+    if (res) die(res);
+    res = f_mkdir("sub1/sub2/sub3");
+    if (res) die(res);
+
+
+ +

戻る

+ + diff --git a/third_party/fatfs/doc/ja/mkfs.html b/third_party/fatfs/doc/ja/mkfs.html new file mode 100644 index 0000000..c6271f0 --- /dev/null +++ b/third_party/fatfs/doc/ja/mkfs.html @@ -0,0 +1,73 @@ + + + + + + + +FatFs - f_mkfs + + + + +
+

f_mkfs

+

ドライブ上にFATファイル・システムを作成(フォーマット)します。

+
+FRESULT f_mkfs (
+  BYTE  Drive,              /* Logical drive number */
+  BYTE  PartitioningRule,   /* Partitioning rule */
+  BYTE  AllocSize           /* Allocation unit size */
+);
+
+
+ +
+

引数

+
+
Drive
+
フォーマットする論理ドライブ(0-9)。
+
PartitioningRule
+
0を指定すると、区画テーブルを作成したあとその区画にファイル・システムを作成します(FDISKフォーマット)。1を指定すると、先頭セクタから直接ファイル・システムを構築します(super floppy (SFD) フォーマット)。
+
AllocSize
+
クラスタ・サイズをセクタ単位で指定します。2の累乗でかつクラスタ・サイズが32Kバイトまでの範囲でなければなりません。
+
+
+ +
+

戻り値

+
+
FR_OK (0)
+
正常終了。
+
FR_INVALID_DRIVE
+
ドライブ番号が無効。
+
FR_NOT_READY
+
メディアがセットされていないなど、物理ドライブが動作不能状態。
+
FR_WRITE_PROTECTED
+
メディアが書き込み禁止状態。
+
FR_NOT_ENABLED
+
その論理ドライブにワーク・エリアが割り当てられていない。
+
FR_RW_ERROR
+
ディスク・エラーまたは内部エラーによる失敗。
+
FR_MKFS_ABORTED
+
次の理由で開始前に処理が中断された。 +
    +
  • ディスク・サイズが小さすぎる。
  • +
  • 何らかの引数が不正。
  • +
  • そのクラスタ・サイズが使えない。クラスタ数が0xFF7と0xFFF7近辺になるとき発生する可能性がある。
  • +
+
+
+
+ +
+

説明

+

f_mkfs関数はFATファイル・システムをドライブ上に作成します。リムーバブル・メディアのパーテーショニング・ルールとしては、FDISK形式とSFD形式がありますが、FDISK形式が一般的です。この関数は複数区画には対応していないので、その物理ドライブの既存の区画は全て削除され、全体が一つの区画になります。

+

FATタイプ(FAT12/FAT16/FAT32)は、ディスク上のクラスタ数によってのみ決定される[FAT仕様書より]決まりになっていて、それ以外の要因はありません。したがって、どのFATタイプになるかは、ディスク・サイズとクラスタ・サイズに依存します。クラスタ・サイズは大きいほど性能が上がるので、特に小容量のドライブでなければ64セクタを選択しておけばよいです。

+

この関数は、FatFsで構成オプション_USE_MKFSを選択したときにサポートされます。また、Tiny-FatFsではサポートされません。

+

+ + +

Return

+ + diff --git a/third_party/fatfs/doc/ja/mount.html b/third_party/fatfs/doc/ja/mount.html new file mode 100644 index 0000000..e2bbfc3 --- /dev/null +++ b/third_party/fatfs/doc/ja/mount.html @@ -0,0 +1,59 @@ + + + + + + + +FatFs - f_mount + + + + +
+

f_mount

+

論理ドライブのワーク・エリアを登録・抹消します。

+
+FRESULT f_mount (
+  BYTE  Drive,               /* 論理ドライブ番号 */
+  FATFS*  FileSystemObject   /* ワーク・エリアへのポインタ */
+);
+
+
+ +
+

引数

+
+
Drive
+
論理ドライブ番号(0-9)。Tiny-FatFsでは常に0。
+
FileSystemObject
+
登録するワーク・エリア(ファイル・システム・オブジェクト)へのポインタ。
+
+
+ +
+

戻り値

+
+
FR_OK (0)
+
正常終了。
+
FR_INVALID_DRIVE
+
ドライブ番号が無効。
+
+
+ + +
+

解説

+

FatFsモジュールではそれぞれの論理ドライブにファイル・システム・オブジェクトというワーク・エリアが必要です。この関数は論理ドライブにそのワーク・エリアを登録したり抹消したりします。何らかのファイル関数を使用する前にこの関数でその論理ドライブのワーク・エリアを与えておかなければなりません。FileSystemObjectにヌル・ポインタを指定するとその論理ドライブのワーク・エリアの登録は抹消され、登録されていたワーク・エリアは破棄できます。

+

この関数内では物理ドライブへのアクセスは発生せず、ワーク・エリアを初期化して内部配列にそのアドレスを登録するだけです。実際のマウント動作は、他のファイル関数(パス名を指定するもの)の中で必要に応じて行われます。

+
+ + +
+

参照

+

FATFS

+
+ +

戻る

+ + diff --git a/third_party/fatfs/doc/ja/mountdrv.html b/third_party/fatfs/doc/ja/mountdrv.html new file mode 100644 index 0000000..9411bea --- /dev/null +++ b/third_party/fatfs/doc/ja/mountdrv.html @@ -0,0 +1,58 @@ + + + + + + + +FatFs - f_mountdrv + + + + +
+

f_mountdrv

+

ファイルシステムを明示的に初期化します。

+
+FRESULT f_mountdrv (void);
+
+
+ +
+

戻り値

+
+
FR_OK (0)
+
正常終了。
+
FR_NOT_READY
+
メディアがセットされていないなど、ディスクドライブが動作不能状態。
+
FR_RW_ERROR
+
ディスクアクセスでエラーが発生した。
+
FR_NOT_ENABLED
+
FatFsモジュールが停止状態。
+
FR_NO_FILESYSTEM
+
ディスク上に有効なFATファイルシステムが見つからない。
+
+
+ + +
+

解説

+

ファイルシステムを強制的に初期化(マウント)します。FatFsモジュールではマウント動作はファイル関数呼び出し時に必要に応じて内部で行われるので、通常はこの関数を使用すべきではありません。自動マウント動作中に回復不能エラー(たとえばFR_INCORRECT_DISK_CHANGE)が発生した場合、全てのファイル関数が使えなくなるので、そのときはこの関数で再マウントして回復することができます。

+

f_mountdrv関数内では次の処理が行われます。

+
+ +
+ + +
+

参照

+

FATFS

+
+ +

戻る

+ + diff --git a/third_party/fatfs/doc/ja/open.html b/third_party/fatfs/doc/ja/open.html new file mode 100644 index 0000000..b6678c8 --- /dev/null +++ b/third_party/fatfs/doc/ja/open.html @@ -0,0 +1,135 @@ + + + + + + + +FatFs - f_open + + + + +
+

f_open

+

ファイルをオープンまたは作成します。

+
+FRESULT f_open (
+  FIL* FileObject,      /* 空のファイル・オブジェクト構造体へのポインタ */
+  const char* FileName, /* ファイルのフルパス名へのポインタ */
+  BYTE ModeFlags        /* モードフラグ */
+);
+
+
+ +
+

引数

+
+
FileObject
+
新しく作成するファイル・オブジェクト構造体へのポインタを指定します。以降、そのファイルを閉じるまでこのファイル・オブジェクトを使用してファイル操作をします。
+
FileName
+
開く(または作成する)ファイルの ファイル名が入った'\0'で終わる文字列へのポインタを指定します。
+
ModeFlags
+
ファイルのアクセス方法やオープン方法を決めるフラグです。このパラメータには次の組み合わせを指定します。
+ + + + + + + + +
値意味
FA_READ読み出しモードで開きます。読み書きする場合はFA_WRITEと共に指定します。
FA_WRITE書き込みモードで開きます。読み書きする場合はFA_READと共に指定します。
FA_OPEN_EXISTING既存のファイルを開きます。ファイルが無いときはエラーになります。
FA_OPEN_ALWAYS既存のファイルを開きます。ファイルが無いときはファイルを作成します。
FA_CREATE_NEWファイルを作成します。同名のファイルがある場合は、エラーになります。
FA_CREATE_ALWAYSファイルを作成します。同名のファイルがある場合は、サイズを0にしてから開きます。
+
+
+
+ + +
+

戻り値

+
+
FR_OK (0)
+
正常終了。以降、FileObject構造体を使ってこのファイルを操作できます。
+
FR_NO_FILE
+
ファイルが見つからない。
+
FR_NO_PATH
+
パスが見つからない。
+
FR_INVALID_NAME
+
ファイル名が不正。
+
FR_INVALID_DRIVE
+
ドライブ番号が不正。
+
FR_EXIST
+
同名のファイルが既にある。
+
FR_DENIED
+
アクセスが拒否された。リード・オンリー・ファイルの書き込みモード・オープン、同名のディレクトリまたはリード・オンリー・ファイルがある状態でのファイル作成、ディスクまたはディレクトリ・テーブルが満杯でファイルを作成できないなど。
+
FR_NOT_READY
+
メディアがセットされていないなど、ディスク・ドライブが動作不能状態。
+
FR_WRITE_PROTECTED
+
メディアが書き込み禁止状態で書き込み系オープンをした。
+
FR_RW_ERROR
+
ディスク・エラーまたは内部エラーによる失敗。
+
FR_NOT_ENABLED
+
その論理ドライブにワーク・エリアが割り当てられていない。
+
FR_NO_FILESYSTEM
+
ディスク上に有効なFATパーテーションが見つからない。
+
+
+ + +
+

解説

+

作成されたファイル・オブジェクトは、以降そのファイルに対するアクセスに使用します。ファイルを閉じるときは、f_close()を使用します。

+

ファイル操作関数を使用する前にまず、f_mount()を使ってそれぞれの論理ドライブにワーク・エリア(ファイル・システム・オブジェクト)を与えなければなりません。この初期化の後、その論理ドライブに対して全てのファイル関数が使えるようになります。

+

リードオンリー構成では、FA_WRITE, FA_CREATE_ALWAYS, FA_CREATE_NEW, FA_OPEN_ALWAYSの各フラグはサポートされません。

+
+ + +
+

使用例(ファイル・コピー)

+
+void main ()
+{
+    FATFS fs;            // 論理ドライブのワーク・エリア(ファイル・システム・オブジェクト)
+    FIL fsrc, fdst;      // ファイル・オブジェクト
+    BYTE buffer[4096];   // file copy buffer
+    FRESULT res;         // FatFs function common result code
+    WORD br, bw;         // File R/W count
+
+    // ドライブ0にワーク・エリアを与える
+    f_mount(0, &fs);
+
+    // ソース・ファイルを開く
+    res = f_open(&fsrc, "srcfile.dat", FA_OPEN_EXISTING | FA_READ);
+    if (res) die(res);
+
+    // デスティネーション・ファイルを作成する
+    res = f_open(&fdst, "dstfile.dat", FA_CREATE_ALWAYS | FA_WRITE);
+    if (res) die(res);
+
+    // ソースからデスティネーションにコピーする
+    for (;;) {
+        res = f_read(&fsrc, buffer, sizeof(buffer), &br);
+        if (res || br == 0) break;   // error or eof
+        res = f_write(&fdst, buffer, br, &bw);
+        if (res || bw < br) break;   // error or disk full
+    }
+
+    // 全てのファイルを閉じる
+    f_close(&fsrc);
+    f_close(&fdst);
+
+    // ワーク・エリアを開放する
+    f_mount(0, NULL);
+}
+
+
+ + +
+

参照

+

f_read, f_write, f_close, FIL, FATFS

+
+ +

戻る

+ + diff --git a/third_party/fatfs/doc/ja/opendir.html b/third_party/fatfs/doc/ja/opendir.html new file mode 100644 index 0000000..54e50e1 --- /dev/null +++ b/third_party/fatfs/doc/ja/opendir.html @@ -0,0 +1,73 @@ + + + + + + + +FatFs - f_opendir + + + + +
+

f_opendir

+

ディレクトリをオープンします。

+
+FRESULT f_opendir (
+  DIR* DirObject,      /* ディレクトリ・ブジェクト構造体へのポインタ */
+  const char* DirName  /* ディレクトリ名へのポインタ */
+);
+
+
+ +
+

引数

+
+
DirObject
+
初期化するディレクトリ・オブジェクト構造体へのポインタを指定します。
+
DirName
+
オープンするディレクトリのフルパス名が入った'\0'で終わる文字列へのポインタを指定します。
+
+
+ + +
+

戻り値

+
+
FR_OK (0)
+
正常終了。
+
FR_NO_FILE
+
ディレクトリが見つからない。
+
FR_NO_PATH
+
パスが見つからない。
+
FR_INVALID_NAME
+
パス名が不正。
+
FR_INVALID_DRIVE
+
ドライブ番号が不正。
+
FR_NOT_READY
+
メディアがセットされていないなど、ディスク・ドライブが動作不能状態。
+
FR_RW_ERROR
+
ディスク・エラーまたは内部エラーによる失敗。
+
FR_NOT_ENABLED
+
論理ドライブにワーク・エリアが与えられていない。
+
FR_NO_FILESYSTEM
+
ディスク上に有効なFATパーテーションが見つからない。
+
+
+ + +
+

解説

+

ディレクトリをオープンします。正常終了したら、DirObject構造体を使ってこのディレクトリの項目を順次読み出せます。DirObject構造体は使用後は任意の時点で破棄できます。_FS_MINIMIZE >= 2ではこの関数はサポートされません。

+
+ + +
+

参照

+

f_readdir, DIR

+
+ +

戻る

+ + diff --git a/third_party/fatfs/doc/ja/read.html b/third_party/fatfs/doc/ja/read.html new file mode 100644 index 0000000..3151f49 --- /dev/null +++ b/third_party/fatfs/doc/ja/read.html @@ -0,0 +1,71 @@ + + + + + + + +FatFs - f_read + + + + +
+

f_read

+

ファイルからデータを読み出します。

+
+FRESULT f_read (
+  FIL* FileObject,    // ファイル・オブジェクト構造体
+  void* Buffer,       // 読み出したデータを格納するバッファ
+  WORD ByteToRead,    // 読み出すバイト数
+  WORD* ByteRead      // 読み出されたバイト数
+);
+
+
+ +
+

引数

+
+
FileObject
+
ファイル・オブジェクト構造体へのポインタを指定します。
+
Buffer
+
読み出したデータを格納するバッファを指すポインタを指定します。
+
ByteToRead
+
読み出すバイト数(0〜65535)を指定します。
+
ByteRead
+
実際に読み出されたバイト数を格納する変数を指すポインタを指定します。
+ +
+ + +
+

戻り値

+
+
FR_OK (0)
+
正常終了。
+
FR_DENIED
+
非読み込みモードで開いたファイルから読み込もうとした。
+
FR_RW_ERROR
+
ディスク・エラーまたは内部エラーによる失敗。
+
FR_NOT_READY
+
メディアがセットされていないなど、ディスク・ドライブが動作不能状態。
+
FR_INVALID_OBJECT
+
無効なファイル・オブジェクト。
+
+
+ + +
+

解説

+

読み込み開始位置は、現在のファイルR/Wポインタからになります。ファイルR/Wポインタは読み込まれたバイト数だけ進みます。読み込み中にファイルの終端に達すると、*ByteReadはByteToReadよりも小さくなります。

+
+ + +
+

参照

+

f_open, f_write, f_close, FIL

+
+ +

戻る

+ + diff --git a/third_party/fatfs/doc/ja/readdir.html b/third_party/fatfs/doc/ja/readdir.html new file mode 100644 index 0000000..f6ad18f --- /dev/null +++ b/third_party/fatfs/doc/ja/readdir.html @@ -0,0 +1,89 @@ + + + + + + + +FatFs - f_readdir + + + + +
+

f_readdir

+

ディレクトリ項目を読み出します

+
+FRESULT f_readdir (
+  DIR* DirObject,    /* ディレクトリ・ブジェクト構造体へのポインタ */
+  FILINFO* FileInfo  /* ファイル情報構造体へのポインタ */
+);
+
+
+ +
+

引数

+
+
DirObject
+
ディレクトリ・オブジェクト構造体へのポインタを指定します。
+
FileInfo
+
読み出したディレクトリ項目を格納するファイル情報構造体へのポインタを指定します。
+
+
+ + +
+

戻り値

+
+
FR_OK (0)
+
正常終了。
+
FR_NOT_READY
+
メディアがセットされていないなど、ディスク・ドライブが動作不能状態。
+
FR_RW_ERROR
+
ディスク・エラーまたは内部エラーによる失敗。
+
FR_INVALID_OBJECT
+
無効なディレクトリ・オブジェクト。
+
+
+ + +
+

解説

+

ディレクトリ項目を順次読み出します。この関数を繰り返し実行することによりディレクトリの全ての項目を読み出すことができます。全ての項目を読み出し、読み出す項目がもう無いときは、f_name[]メンバにヌル文字列が返されます。得られるファイル情報の詳細については FILINFO構造体を参照してください。_FS_MINIMIZE >= 2ではこの関数はサポートされません。

+
+ + +
+

使用例

+
+void scan_files (char* path)
+{
+    FILINFO finfo;
+    DIR dirs;
+    int i;
+
+    if (f_opendir(&dirs, path) == FR_OK) {
+        i = strlen(path);
+        while ((f_readdir(&dirs, &finfo) == FR_OK) && finfo.fname[0]) {
+            if (finfo._attrib & AM_DIR) {
+                sprintf(path+i, "/%s", &finfo.fname[0]);
+                scan_files(path);
+                *(path+i) = '\0';
+            } else {
+                printf("%s/%s\n", path, &finfo.fname[0]);
+            }
+        }
+    }
+}
+
+
+ + +
+

参照

+

f_opendir, f_stat, FILINFO, DIR

+
+ +

戻る

+ + diff --git a/third_party/fatfs/doc/ja/rename.html b/third_party/fatfs/doc/ja/rename.html new file mode 100644 index 0000000..1c5ece8 --- /dev/null +++ b/third_party/fatfs/doc/ja/rename.html @@ -0,0 +1,86 @@ + + + + + + + +FatFs - f_rename + + + + +
+

f_rename

+

ファイルまたはディレクトリの名前の変更または移動。

+
+FRESULT f_rename (
+  const char* OldName, /* 古いファイルまたはディレクトリ名 */
+  const char* NewName  /* 新しいファイルまたはディレクトリ名 */
+);
+
+
+ +
+

引数

+
+
OldName
+
変更対象のファイルまたはディレクトリのフルパス名の入った'\0'で終わる文字列へのポインタを指定します。
+
NewName
+
新しいファイルまたはディレクトリのフルパス名の入った'\0'で終わる文字列へのポインタを指定します。既に存在するものと同じ名前は使えません。また、ドライブ番号は指定できず、OldNameで指定されたドライブ上のオブジェクトとして扱われます。
+
+
+ + +
+

戻り値

+
+
FR_OK (0)
+
正常終了。
+
FR_NO_FILE
+
ファイルが見つからない。
+
FR_NO_PATH
+
パスが見つからない。
+
FR_INVALID_NAME
+
パス名が不正。
+
FR_INVALID_DRIVE
+
ドライブ番号が不正。
+
FR_DENIED
+
新しい名前のオブジェクトが作れない。
+
FR_EXIST
+
NewNameと同じ名前のオブジェクトが既にある。
+
FR_NOT_READY
+
メディアがセットされていないなど、ディスク・ドライブが動作不能状態。
+
FR_WRITE_PROTECTED
+
メディアが書き込み禁止状態。
+
FR_RW_ERROR
+
ディスク・エラーまたは内部エラーによる失敗。
+
FR_NOT_ENABLED
+
論理ドライブにワークエリアが割り当てられていない。
+
FR_NO_FILESYSTEM
+
ディスク上に有効なFATパーテーションが見つからない。
+
+
+ + +
+

解説

+

ファイルまたはディレクトリの名前を変更します。別のディレクトリへの移動(同じドライブ内のみ)も可能です。リード・オンリー構成および_FS_MINIMIZE >= 1ではこの関数はサポートされません。

+

※現リビジョンでは、ディレクトリを別のディレクトリに移動するとファイル・システムが壊れます。

+
+ + +
+

使用例

+
+    // 名前を変更する
+    f_rename("oldname.txt", "newname.txt");
+
+    // 名前の変更と同時に別のディレクトリへ移動する
+    f_rename("oldname.txt", "dir1/newname.txt");
+
+
+ +

戻る

+ + diff --git a/third_party/fatfs/doc/ja/sdir.html b/third_party/fatfs/doc/ja/sdir.html new file mode 100644 index 0000000..350d10c --- /dev/null +++ b/third_party/fatfs/doc/ja/sdir.html @@ -0,0 +1,42 @@ + + + + + + + +FatFs - DIR + + + + +
+

DIR

+

DIR構造体は、f_opendir(), f_readdir()のワーク・エリアとして使用されます。

+

FatFs

+
+typedef struct _DIR {
+    WORD    id;          /* Owner file system mount ID (inverted) */
+    WORD    index;       /* Current index */
+    FATFS*  fs;          /* Pointer to the owner file system object */
+    DWORD   sclust;      /* Start cluster */
+    DWORD   clust;       /* Current cluster */
+    DWORD   sect;        /* Current sector */
+} DIR;
+
+

Tiny-FatFs

+
+typedef struct _DIR {
+    WORD    id;          /* Owner file system mount ID (inverted) */
+    WORD    index;       /* Current index */
+    FATFS*  fs;          /* Pointer to the owner file system object */
+    CLUST   sclust;      /* Start cluster */
+    CLUST   clust;       /* Current cluster */
+    DWORD   sect;        /* Current sector */
+} DIR;
+
+
+ +

戻る

+ + diff --git a/third_party/fatfs/doc/ja/sfatfs.html b/third_party/fatfs/doc/ja/sfatfs.html new file mode 100644 index 0000000..999f612 --- /dev/null +++ b/third_party/fatfs/doc/ja/sfatfs.html @@ -0,0 +1,63 @@ + + + + + + + +FatFs - FATFS + + + + +
+

FATFS

+

FATFS構造体は、個々の論理ドライブのダイナミック・ワーク・エリアを保持し、f_mount()でFatFsモジュールに登録されます。標準状態では次のようなメンバになっています。アプリケーションから書き換え可能なメンバはありません。

+

FatFs

+
+typedef struct _FATFS {
+    WORD    id;             /* File system mount ID */
+    WORD    n_rootdir;      /* Number of root directory entries */
+    DWORD   winsect;        /* Current sector appearing in the win[] */
+    DWORD   sects_fat;      /* Sectors per fat */
+    DWORD   max_clust;      /* Maximum cluster# + 1 */
+    DWORD   fatbase;        /* FAT start sector */
+    DWORD   dirbase;        /* Root directory start sector (cluster# for FAT32) */
+    DWORD   database;       /* Data start sector */
+    DWORD   last_clust;     /* Last allocated cluster */
+    DWORD   free_clust;     /* Number of free clusters */
+    BYTE    fs_type;        /* FAT type (0:Not mounted) */
+    BYTE    sects_clust;    /* Sectors per cluster */
+    BYTE    n_fats;         /* Number of FAT copies */
+    BYTE    drive;          /* Physical drive number */
+    BYTE    winflag;        /* win[] dirty flag (1:must be written back) */
+    BYTE    pad1;
+    BYTE    win[512];       /* Disk access window for Directory/FAT */
+} FATFS;
+
+ +

Tiny-FatFs

+
+typedef struct _FATFS {
+    WORD    id;             /* File system mount ID */
+    WORD    n_rootdir;      /* Number of root directory entries */
+    DWORD   winsect;        /* Current sector appearing in the win[] */
+    DWORD   fatbase;        /* FAT start sector */
+    DWORD   dirbase;        /* Root directory start sector */
+    DWORD   database;       /* Data start sector */
+    CLUST   sects_fat;      /* Sectors per fat */
+    CLUST   max_clust;      /* Maximum cluster# + 1 */
+    CLUST   last_clust;     /* Last allocated cluster */
+    CLUST   free_clust;     /* Number of free clusters */
+    BYTE    fs_type;        /* FAT type (0:Not mounted) */
+    BYTE    sects_clust;    /* Sectors per cluster */
+    BYTE    n_fats;         /* Number of FAT copies */
+    BYTE    winflag;        /* win[] dirty flag (1:must be written back) */
+    BYTE    win[512];       /* Disk access window for Directory/FAT/File */
+} FATFS;
+
+
+ +

戻る

+ + diff --git a/third_party/fatfs/doc/ja/sfile.html b/third_party/fatfs/doc/ja/sfile.html new file mode 100644 index 0000000..4dea75e --- /dev/null +++ b/third_party/fatfs/doc/ja/sfile.html @@ -0,0 +1,54 @@ + + + + + + + +FatFs - FIL + + + + +
+

FIL

+

FIL構造体は、f_open()で作成され、そのファイルの状態を保持します。アプリケーションから書き換え可能なメンバはありません。

+

FatFs

+
+typedef struct _FIL {
+    WORD    id;             /* Owner file system mount ID (inverted) */
+    BYTE    flag;           /* File status flags */
+    BYTE    sect_clust;     /* Left sectors in cluster */
+    FATFS*  fs;             /* Pointer to the owner file system object */
+    DWORD   fptr;           /* File R/W pointer */
+    DWORD   fsize;          /* File size */
+    DWORD   org_clust;      /* File start cluster */
+    DWORD   curr_clust;     /* Current cluster */
+    DWORD   curr_sect;      /* Current sector */
+    DWORD   dir_sect;       /* Sector containing the directory entry */
+    BYTE*   dir_ptr;        /* Ponter to the directory entry in the window */
+    BYTE    buffer[512];    /* File R/W buffer */
+} FIL;
+
+ +

Tiny-FatFs

+
+typedef struct _FIL {
+    WORD    id;             /* Owner file system mount ID (inverted) */
+    BYTE    flag;           /* File status flags */
+    BYTE    sect_clust;     /* Left sectors in cluster */
+    FATFS*  fs;             /* Pointer to owner file system */
+    DWORD   fptr;           /* File R/W pointer */
+    DWORD   fsize;          /* File size */
+    CLUST   org_clust;      /* File start cluster */
+    CLUST   curr_clust;     /* Current cluster */
+    DWORD   curr_sect;      /* Current sector */
+    DWORD   dir_sect;       /* Sector containing the directory entry */
+    BYTE*   dir_ptr;        /* Ponter to the directory entry in the window */
+} FIL;
+
+
+ +

戻る

+ + diff --git a/third_party/fatfs/doc/ja/sfileinfo.html b/third_party/fatfs/doc/ja/sfileinfo.html new file mode 100644 index 0000000..dc4aa05 --- /dev/null +++ b/third_party/fatfs/doc/ja/sfileinfo.html @@ -0,0 +1,43 @@ + + + + + + + +FatFs - FILINFO + + + + +
+

FILINFO

+

FILINFO構造体は、f_stat(), f_readdir()で返されるファイル情報を保持します。

+
+typedef struct _FILINFO {
+    DWORD fsize;            /* Size [bytes] */
+    WORD fdate;             /* Date [15-9]:Year-1980, [8-5]:Month, [4-0]:Mday */
+    WORD ftime;             /* Time [15-11]:Hour, [10-5]:Minute, [4-0]:Sec/2 */
+    BYTE fattrib;           /* Attribute */
+    char fname[8+1+3+1];    /* Name */
+} FILINFO;
+
+
+ +

メンバ

+
+
fsize
+
ファイルのバイト単位のサイズが格納されます。ディレクトリの場合は常に0です。
+
fdate
+
ファイルの変更された日付、またはディレクトリの作成された日付が格納されます。
+
ftime
+
ファイルの変更された時刻、またはディレクトリの作成された時刻が格納されます。
+
fattrib
+
属性フラグが格納されます。フラグはAM_DIR, AM_RDO, AM_HID, AM_SYS, AM_ARCの組み合わせとなります。
+
fname[]
+
8.3形式の名前が'\0'で終わる文字列として格納されます。
+
+ +

戻る

+ + diff --git a/third_party/fatfs/doc/ja/stat.html b/third_party/fatfs/doc/ja/stat.html new file mode 100644 index 0000000..5de8df9 --- /dev/null +++ b/third_party/fatfs/doc/ja/stat.html @@ -0,0 +1,73 @@ + + + + + + + +FatFs - f_stat + + + + +
+

f_stat

+

+
+FRESULT f_stat (
+  const char* FileName,  /* ファイルまたはディレクトリ名へのポインタ */
+  FILINFO* FileInfo      /* ファイル情報構造体へのポインタ *
+);
+
+
+ +
+

引数

+
+
FileName
+
情報を得るファイルまたはディレクトリ名の'\0'で終わる文字列を指すポインタを指定します。
+
FileInfo
+
読み出したファイル情報を格納するファイル情報構造体へのポインタを指定します。
+
+
+ + +
+

戻り値

+
+
FR_OK (0)
+
正常終了。
+
FR_NO_FILE
+
ファイルまたはディレクトリが見つからない。
+
FR_NO_PATH
+
パスが見つからない。
+
FR_INVALID_NAME
+
パス名が不正。
+
FR_INVALID_NAME
+
ドライブ番号が不正。
+
FR_NOT_READY
+
メディアがセットされていないなど、ディスク・ドライブが動作不能状態。
+
FR_RW_ERROR
+
ディスク・エラーまたは内部エラーによる失敗。
+
FR_NOT_ENABLED
+
論理ドライブにワークエリアが割り当てられていない。
+
FR_NO_FILESYSTEM
+
ディスク上に有効なFATパーテーションが見つからない。
+
+
+ + +
+

解説

+

ファイルまたはディレクトリに関する情報を得ます。得られるファイル情報の詳細については FILINFO構造体を参照してください。_FS_MINIMIZE >= 1ではこの関数はサポートされません。

+
+ + +
+

参照

+

f_opendir, f_readdir, FILINFO, DIR

+
+ +

戻る

+ + diff --git a/third_party/fatfs/doc/ja/sync.html b/third_party/fatfs/doc/ja/sync.html new file mode 100644 index 0000000..cfc159c --- /dev/null +++ b/third_party/fatfs/doc/ja/sync.html @@ -0,0 +1,61 @@ + + + + + + + +FatFs - f_sync + + + + +
+

f_sync

+

書き込み中のファイルのキャッシュされた情報をフラッシュします。

+
+FRESULT f_sync (
+  FIL* FileObject     /* ファイル・オブジェクト構造体へのポインタ */
+);
+
+
+ +
+

引数

+
+
FileObject
+
syncするファイルのファイル・オブジェクト構造体へのポインタを指定します。
+
+
+ + +
+

戻り値

+
+
FR_OK (0)
+
正常終了。
+
FR_RW_ERROR
+
ディスク・エラーまたは内部エラーによる失敗。
+
FR_NOT_READY
+
メディアがセットされていないなど、ディスク・ドライブが動作不能状態。
+
FR_INVALID_OBJECT
+
ファイル・オブジェクトが無効。
+
+
+ + +
+

解説

+

この関数はf_close()と同じ処理を実行しますが、ファイルは引き続き開かれたままになり、読み書きを続行できます。ロギングなど、書き込みモードで長時間ファイルが開かれているアプリケーションにおいて、定期的または区切りの良いところでsyncすることにより、不意の電源断やメディアの取り外しにより失われるデータを最小にすることができます。

+

リード・オンリー構成ではこの関数はサポートされません。

+
+ + +
+

参照

+

f_close

+
+ +

戻る

+ + diff --git a/third_party/fatfs/doc/ja/unlink.html b/third_party/fatfs/doc/ja/unlink.html new file mode 100644 index 0000000..6d7f9cc --- /dev/null +++ b/third_party/fatfs/doc/ja/unlink.html @@ -0,0 +1,68 @@ + + + + + + + +FatFs - f_unlink + + + + +
+

f_unlink

+

ファイルまたはディレクトリを削除します。

+
+FRESULT f_unlink (
+  const char* FileName  /* ファイルまたはディレクトリ名へのポインタ */
+);
+
+
+ +
+

引数

+
+
FileName
+
削除対象のファイルまたはディレクトリ名の入った'\0'で終わる文字列へのポインタを指定します。
+
+
+ + +
+

戻り値

+
+
FR_OK (0)
+
正常終了。
+
FR_NO_FILE
+
ファイルが見つからない。
+
FR_NO_PATH
+
パスが見つからない。
+
FR_INVALID_NAME
+
パス名が不正。
+
FR_INVALID_DRIVE
+
ドライブ番号が不正。
+
FR_DENIED
+
対象ファイル・ディレクトリがリード・オンリー状態、対象ディレクトリが空でない場合など。
+
FR_NOT_READY
+
メディアがセットされていないなど、物理ドライブが動作不能状態。
+
FR_WRITE_PROTECTED
+
メディアが書き込み禁止状態。
+
FR_RW_ERROR
+
ディスク・エラーまたは内部エラーによる失敗。
+
FR_NOT_ENABLED
+
論理ドライブにワーク・エリアが割り当てられていない。
+
FR_NO_FILESYSTEM
+
ディスク上に有効なFATパーテーションが見つからない。
+
+
+ + +
+

解説

+

ファイルまたはディレクトリを削除します。リード・オンリー構成や_FS_MINIMIZE >= 1ではこの関数はサポートされません。

+
+ +

戻る

+ + diff --git a/third_party/fatfs/doc/ja/write.html b/third_party/fatfs/doc/ja/write.html new file mode 100644 index 0000000..b7ff34e --- /dev/null +++ b/third_party/fatfs/doc/ja/write.html @@ -0,0 +1,71 @@ + + + + + + + +FatFs - f_write + + + + +
+

f_write

+

ファイルにデータを書き込みます。

+
+FRESULT f_write (
+  FIL* FileObject,     /* ファイル・オブジェクト */
+  const void* Buffer,  /* 書き込みデータ */
+  WORD ByteToWrite,    /* 書き込むバイト数 */
+  WORD* ByteWritten    /* 書き込まれたバイト数 */
+);
+
+
+ +
+

引数

+
+
FileObject
+
ファイル・オブジェクト構造体へのポインタを指定します。
+
Buffer
+
書き込むデータを格納したバッファを指すポインタを指定します。
+
ByteToWrite
+
書き込むバイト数(0〜65535)を指定します。
+
ByteWritten
+
書き込まれたバイト数を格納する変数を指すポインタを指定します。
+
+
+ + +
+

戻り値

+
+
FR_OK (0)
+
正常終了。
+
FR_DENIED
+
非書き込みモードで開いたファイルに書き込もうとした。
+
FR_RW_ERROR
+
ディスク・エラーまたは内部エラーによる失敗。
+
FR_NOT_READY
+
メディアがセットされていないなど、ディスク・ドライブが動作不能状態。
+
FR_INVALID_OBJECT
+
無効なファイルオブジェクト。
+
+
+ + +
+

解説

+

書き込み開始位置は、ファイルR/Wポインタの現在位置からになります。ファイルR/Wポインタは実際に書き込まれたバイト数だけ進みます。書き込み中にディスクが一杯になったときは、*ByteWrittenはByteToWriteよりも小さくなります。リード・オンリー構成ではこの関数はサポートされません。

+
+ + +
+

参照

+

f_open, f_read, f_close, FIL

+
+ +

戻る

+ + diff --git a/third_party/fatfs/doc/updates.txt b/third_party/fatfs/doc/updates.txt new file mode 100644 index 0000000..840d5a8 --- /dev/null +++ b/third_party/fatfs/doc/updates.txt @@ -0,0 +1,42 @@ +R0.04b, May 05, 2007 + Added _USE_NTFLAG option. + Added FSInfo support. + Fixed some problems corresponds to FAT32. (Tiny-FatFs) + Fixed DBCS name can result FR_INVALID_NAME. + Fixed short seek (<= csize) collapses the file object. + +R0.04a, Apr 01, 2007 + Supported multiple partitions on a plysical drive. (FatFs) + Added minimization level 3. + Added a capability of extending file size to f_lseek(). + Fixed an endian sensitive code in f_mkfs(). (FatFs) + Fixed a problem corresponds to FAT32 support. (Tiny-FatFs) + +R0.04, Feb 04, 2007 + Supported multiple drive system. (FatFs) + Changed some APIs for multiple drive system. + Added f_mkfs(). (FatFs) + Added _USE_FAT32 option. (Tiny-FatFs) + +R0.03a, Dec 11, 2006 + Improved cluster scan algolithm to write files fast. + Fixed f_mkdir() creates incorrect directory on FAT32. + +R0.02a, Jun 10, 2006 + Added a configuration option _FS_MINIMUM. + +R0.02, Jun 01, 2006 + Added FAT12. + Removed unbuffered mode. + Fixed a problem on small (<32M) patition. + +R0.03, Sep 22, 2006 + Added f_rename(). + Changed option _FS_MINIMUM to _FS_MINIMIZE. + +R0.01, Apr 29, 2006 + First release + +R0.00, Feb 26, 2006 + Prototype (not released) + -- cgit v1.3.1