fatfs v0.02 Jun 01, 2006:
- Added FAT12. Removed unbuffered mode. - Fixed a problem on small (<32M) patition.
This commit is contained in:
1 parent
4f7376e6aa
commit
238747ef97
56 files changed
+424
-336
No files matched your search
@@ -3,6 +3,7 @@
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS">
|
||||
<meta http-equiv="Content-Style-Type" content="text/css">
|
||||
<link rel="up" title="FatFs" href="../00index_j.html">
|
||||
<link rel="stylesheet" href="../css_j.css" type="text/css" media="screen" title="ELM Default">
|
||||
<title>FatFs - f_chmod</title>
|
||||
</head>
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS">
|
||||
<meta http-equiv="Content-Style-Type" content="text/css">
|
||||
<link rel="up" title="FatFs" href="../00index_j.html">
|
||||
<link rel="stylesheet" href="../css_j.css" type="text/css" media="screen" title="ELM Default">
|
||||
<title>FatFs - f_close</title>
|
||||
</head>
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS">
|
||||
<meta http-equiv="Content-Style-Type" content="text/css">
|
||||
<link rel="up" title="FatFs" href="../00index_j.html">
|
||||
<link rel="stylesheet" href="../css_j.css" type="text/css" media="screen" title="ELM Default">
|
||||
<title>FatFs - disk_initialize</title>
|
||||
</head>
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS">
|
||||
<meta http-equiv="Content-Style-Type" content="text/css">
|
||||
<link rel="up" title="FatFs" href="../00index_j.html">
|
||||
<link rel="stylesheet" href="../css_j.css" type="text/css" media="screen" title="ELM Default">
|
||||
<title>FatFs - disk_read</title>
|
||||
</head>
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS">
|
||||
<meta http-equiv="Content-Style-Type" content="text/css">
|
||||
<link rel="up" title="FatFs" href="../00index_j.html">
|
||||
<link rel="stylesheet" href="../css_j.css" type="text/css" media="screen" title="ELM Default">
|
||||
<title>FatFs - disk_status</title>
|
||||
</head>
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS">
|
||||
<meta http-equiv="Content-Style-Type" content="text/css">
|
||||
<link rel="up" title="FatFs" href="../00index_j.html">
|
||||
<link rel="stylesheet" href="../css_j.css" type="text/css" media="screen" title="ELM Default">
|
||||
<title>FatFs - disk_write</title>
|
||||
</head>
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS">
|
||||
<meta http-equiv="Content-Style-Type" content="text/css">
|
||||
<link rel="up" title="FatFs" href="../00index_j.html">
|
||||
<link rel="stylesheet" href="../css_j.css" type="text/css" media="screen" title="ELM Default">
|
||||
<title>FatFs - get_fattime</title>
|
||||
</head>
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS">
|
||||
<meta http-equiv="Content-Style-Type" content="text/css">
|
||||
<link rel="up" title="FatFs" href="../00index_j.html">
|
||||
<link rel="stylesheet" href="../css_j.css" type="text/css" media="screen" title="ELM Default">
|
||||
<title>FatFs - f_getfree</title>
|
||||
</head>
|
||||
|
||||
+7
-8
@@ -3,6 +3,7 @@
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS">
|
||||
<meta http-equiv="Content-Style-Type" content="text/css">
|
||||
<link rel="up" title="FatFs" href="../00index_j.html">
|
||||
<link rel="stylesheet" href="../css_j.css" type="text/css" media="screen" title="ELM Default">
|
||||
<title>FatFs - f_lseek</title>
|
||||
</head>
|
||||
@@ -36,8 +37,6 @@ FRESULT f_lseek (
|
||||
<dl class="ret">
|
||||
<dt>FR_OK</dt>
|
||||
<dd>正常終了。</dd>
|
||||
<dt>FR_ALIGN_ERROR</dt>
|
||||
<dd>アンバッファモードで開いたファイルで、512の整数倍でないオフセットを指定した。</dd>
|
||||
<dt>FR_RW_ERROR</dt>
|
||||
<dd>ディスクアクセスでエラーが発生した。</dd>
|
||||
<dt>FR_INCORRECT_DISK_CHANGE</dt>
|
||||
@@ -57,17 +56,17 @@ FRESULT f_lseek (
|
||||
<div class="para">
|
||||
<h4>使用例</h4>
|
||||
<pre>
|
||||
// Move to offset of 5000 from top of file.
|
||||
// ファイルオフセット 5000 へ移動
|
||||
res = f_lseek(&file, 5000);
|
||||
if (res) die(res);
|
||||
|
||||
// Move to 3000 bytes front of current offset.
|
||||
// 3000バイト進める
|
||||
res = f_lseek(&file, file.fptr + 3000);
|
||||
if (res) die(res);
|
||||
|
||||
// Move to 2000 bytes back of current offset.
|
||||
// 2000バイト戻す
|
||||
res = f_lseek(&file, file.fptr - 2000);
|
||||
if (res) die(res);
|
||||
|
||||
// ファイル末尾 + 1 へ移動
|
||||
res = f_lseek(&file, 0xFFFFFFFF);
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS">
|
||||
<meta http-equiv="Content-Style-Type" content="text/css">
|
||||
<link rel="up" title="FatFs" href="../00index_j.html">
|
||||
<link rel="stylesheet" href="../css_j.css" type="text/css" media="screen" title="ELM Default">
|
||||
<title>FatFs - f_mkdir</title>
|
||||
</head>
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS">
|
||||
<meta http-equiv="Content-Style-Type" content="text/css">
|
||||
<link rel="up" title="FatFs" href="../00index_j.html">
|
||||
<link rel="stylesheet" href="../css_j.css" type="text/css" media="screen" title="ELM Default">
|
||||
<title>FatFs - f_mountdrv</title>
|
||||
</head>
|
||||
|
||||
+18
-26
@@ -3,6 +3,7 @@
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS">
|
||||
<meta http-equiv="Content-Style-Type" content="text/css">
|
||||
<link rel="up" title="FatFs" href="../00index_j.html">
|
||||
<link rel="stylesheet" href="../css_j.css" type="text/css" media="screen" title="ELM Default">
|
||||
<title>FatFs - f_open</title>
|
||||
</head>
|
||||
@@ -25,22 +26,18 @@ FRESULT f_open (
|
||||
<h4>パラメータ</h4>
|
||||
<dl class="par">
|
||||
<dt>FileObject</dt>
|
||||
<dd>新しく作成するファイルオブジェクト構造体へのポインタを指定します。以降、このファイルを閉じるまでそのファイルオブジェクトを使用してファイル操作をします。構造体メンバの<tt>buffer</tt>は、オープン前または直後にそのファイルで使用するR/Wバッファへのアドレスで初期化しておく必要があります(<tt>FA_UNBUFFERED</tt>を指定した場合はバッファは不要)。</dd>
|
||||
<dd>新しく作成するファイルオブジェクト構造体へのポインタを指定します。以降、そのファイルを閉じるまでこのファイルオブジェクトを使用してファイル操作をします。</dd>
|
||||
<dt>FileName</dt>
|
||||
<dd>作成する (またはオープンする) ファイルのフルパス名が入った<tt>'\0'</tt>で終わる文字列へのポインタを指定します。ディレクトリセパレータには<tt>'/'</tt>を使用します。FatFsモジュールにはカレントディレクトリの概念がないので、パスはルートディレクトリから辿る絶対パスとなります。文字列先頭のスペースはスキップされます。パス先頭の<tt>'/'</tt>はあってもなくてもかまいません。</dd>
|
||||
<dt>ModeFlags</dt>
|
||||
<dd>ファイルのアクセス方法やオープン方法を決めるフラグです。このパラメータには次の組み合わせを指定します。<br>
|
||||
<table class="lst">
|
||||
<tr><th>値</th><th>意味</th></td>
|
||||
<tr><td>FA_READ</td><td>読み出しモードでオープンします。読み書きする場合は<tt>FA_WRITE</tt>と共に指定します。</td></td>
|
||||
<tr><td>FA_WRITE</td><td>書き込みモードでオープンします。読み書きする場合は<tt>FA_READ</tt>と共に指定します。</td></td>
|
||||
<tr><td>FA_UNBUFFERED</td><td>
|
||||
FatFsでのみ指定可。指定するとファイルR/Wバッファを使用せず、メモリを節約できます。<br>
|
||||
read/write/seekは512の整数倍単位でなければなりません。指定しない場合は、ファイル<br>
|
||||
R/Wバッファ(ファイルオブジェクト構造体メンバの<tt>buffer</tt>で指定)を使用。</td></td>
|
||||
<tr><td>FA_OPEN_EXISTING</td><td>既存のファイルを開きます。ファイルが無いときはエラーになります。</td></td>
|
||||
<tr><td>FA_CREATE_ALWAYS</td><td>ファイルを作成します。既存のファイルがある場合は、サイズを0にしてから開きます。</td></td>
|
||||
<tr><td>FA_OPEN_ALWAYS</td><td>既存のファイルを開きます。ファイルが無いときはファイルを作成します。</td></td>
|
||||
<tr><td>FA_READ</td><td>読み出しモードでオープンします。読み書きする場合は<tt>FA_WRITE</tt>と共に指定します。</td></tr>
|
||||
<tr><td>FA_WRITE</td><td>書き込みモードでオープンします。読み書きする場合は<tt>FA_READ</tt>と共に指定します。</td></tr>
|
||||
<tr><td>FA_OPEN_EXISTING</td><td>既存のファイルを開きます。ファイルが無いときはエラーになります。</td></tr>
|
||||
<tr><td>FA_CREATE_ALWAYS</td><td>ファイルを作成します。既存のファイルがある場合は、サイズを0にしてから開きます。</td></tr>
|
||||
<tr><td>FA_OPEN_ALWAYS</td><td>既存のファイルを開きます。ファイルが無いときはファイルを作成します。</td></tr>
|
||||
</table>
|
||||
</dd>
|
||||
</dl>
|
||||
@@ -84,47 +81,42 @@ R/W
|
||||
|
||||
|
||||
<div class="para">
|
||||
<h4>使用例</h4>
|
||||
<h4>使用例(ファイルコピー)</h4>
|
||||
<pre>
|
||||
void main ()
|
||||
{
|
||||
FATFS fs; // FatFs work area
|
||||
FIL fsrc, fdst; // file structures
|
||||
BYTE fbuff[512*2]; // file r/w buffers (not required for Tiny-FatFs)
|
||||
FATFS fs; // FatFsワークエリア
|
||||
FIL fsrc, fdst; // ファイルオブジェクト
|
||||
BYTE buffer[4096]; // file copy buffer
|
||||
FRESULT res; // FatFs function common result code
|
||||
WORD br, bw; // File R/W count
|
||||
|
||||
|
||||
// Activate FatFs module
|
||||
// FatFsのワークエリアを確保する
|
||||
memset(&fs, 0, sizeof(FATFS));
|
||||
FatFs = &fs;
|
||||
|
||||
// Open source file
|
||||
fsrc.buffer = fbuff+0; // (not required for Tiny-FatFs)
|
||||
// ソース・ファイルを開く
|
||||
res = f_open(&fsrc, "/srcfile.dat", FA_OPEN_EXISTING | FA_READ);
|
||||
if (res) die(res);
|
||||
|
||||
// Create destination file
|
||||
fdst.buffer = fbuff+512; // (not required for Tiny-FatFs)
|
||||
// デスティネーション・ファイルを作成する
|
||||
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) die(res);
|
||||
if (br == 0) break;
|
||||
if (res || br == 0) break;
|
||||
res = f_write(&fdst, buffer, br, &bw);
|
||||
if (res) die(res);
|
||||
if (bw < br) break;
|
||||
if (res || bw < br) break;
|
||||
}
|
||||
|
||||
// Close all files
|
||||
// 全てのファイルを閉じる
|
||||
f_close(&fsrc);
|
||||
f_close(&fdst);
|
||||
|
||||
// Deactivate FatFs module
|
||||
// FatFsのワークエリアを開放する
|
||||
FatFs = NULL;
|
||||
}
|
||||
</pre>
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS">
|
||||
<meta http-equiv="Content-Style-Type" content="text/css">
|
||||
<link rel="up" title="FatFs" href="../00index_j.html">
|
||||
<link rel="stylesheet" href="../css_j.css" type="text/css" media="screen" title="ELM Default">
|
||||
<title>FatFs - f_opendir</title>
|
||||
</head>
|
||||
|
||||
+2
-3
@@ -3,6 +3,7 @@
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS">
|
||||
<meta http-equiv="Content-Style-Type" content="text/css">
|
||||
<link rel="up" title="FatFs" href="../00index_j.html">
|
||||
<link rel="stylesheet" href="../css_j.css" type="text/css" media="screen" title="ELM Default">
|
||||
<title>FatFs - f_read</title>
|
||||
</head>
|
||||
@@ -44,8 +45,6 @@ FRESULT f_read (
|
||||
<dd>正常終了。</dd>
|
||||
<dt>FR_DENIED</dt>
|
||||
<dd>書き込み専用モードで開いたファイルから読み込もうとした。</dd>
|
||||
<dt>FR_ALIGN_ERROR</dt>
|
||||
<dd>アンバッファモードで開かれたファイルで、512の整数倍でないアクセスを検出した。</dd>
|
||||
<dt>FR_RW_ERROR</dt>
|
||||
<dd>ディスクアクセスでエラーが発生した。</dd>
|
||||
<dt>FR_NOT_READY</dt>
|
||||
@@ -58,7 +57,7 @@ FRESULT f_read (
|
||||
|
||||
<div class="para">
|
||||
<h4>解説</h4>
|
||||
<p>読み込み開始位置は、現在のファイルR/Wポインタからになります。ファイルR/Wポインタは読み込まれたバイト数だけ進みます。読み込み中にファイルの終端に達すると、<tt>*ByteRead</tt>は<tt>ByteToRead</tt>よりも小さくなります。アンバッファモードでは最後の端数バイトを残して<tt>FR_ALIGN_ERROR</tt>になります。</p>
|
||||
<p>読み込み開始位置は、現在のファイルR/Wポインタからになります。ファイルR/Wポインタは読み込まれたバイト数だけ進みます。読み込み中にファイルの終端に達すると、<tt>*ByteRead</tt>は<tt>ByteToRead</tt>よりも小さくなります。</p>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS">
|
||||
<meta http-equiv="Content-Style-Type" content="text/css">
|
||||
<link rel="up" title="FatFs" href="../00index_j.html">
|
||||
<link rel="stylesheet" href="../css_j.css" type="text/css" media="screen" title="ELM Default">
|
||||
<title>FatFs - f_readdir</title>
|
||||
</head>
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS">
|
||||
<meta http-equiv="Content-Style-Type" content="text/css">
|
||||
<link rel="up" title="FatFs" href="../00index_j.html">
|
||||
<link rel="stylesheet" href="../css_j.css" type="text/css" media="screen" title="ELM Default">
|
||||
<title>FatFs - DIR</title>
|
||||
</head>
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS">
|
||||
<meta http-equiv="Content-Style-Type" content="text/css">
|
||||
<link rel="up" title="FatFs" href="../00index_j.html">
|
||||
<link rel="stylesheet" href="../css_j.css" type="text/css" media="screen" title="ELM Default">
|
||||
<title>FatFs - FATFS</title>
|
||||
</head>
|
||||
|
||||
+3
-2
@@ -3,6 +3,7 @@
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS">
|
||||
<meta http-equiv="Content-Style-Type" content="text/css">
|
||||
<link rel="up" title="FatFs" href="../00index_j.html">
|
||||
<link rel="stylesheet" href="../css_j.css" type="text/css" media="screen" title="ELM Default">
|
||||
<title>FatFs - FIL</title>
|
||||
</head>
|
||||
@@ -11,7 +12,7 @@
|
||||
|
||||
<div class="para">
|
||||
<h2>FIL</h2>
|
||||
<p><tt>FIL</tt>構造体は、1個で1ファイルの状態を保持し、アプリケーション側で確保・管理されます。アプリケーションから変更可能なメンバは<tt>buffer</tt>のみです。</p>
|
||||
<p><tt>FIL</tt>構造体は、個々のファイルの状態を保持し、アプリケーション側で確保・管理されます。アプリケーションから変更可能なメンバはありません。</p>
|
||||
<h4>FatFs</h4>
|
||||
<pre>
|
||||
typedef struct _FIL {
|
||||
@@ -22,9 +23,9 @@ typedef struct _FIL {
|
||||
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; // Pointer to 512 byte file R/W buffer
|
||||
BYTE flag; // File status flags
|
||||
BYTE sect_clust; // Left sectors in current cluster
|
||||
BYTE buffer[512]; // File R/W buffer
|
||||
} FIL;
|
||||
</pre>
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS">
|
||||
<meta http-equiv="Content-Style-Type" content="text/css">
|
||||
<link rel="up" title="FatFs" href="../00index_j.html">
|
||||
<link rel="stylesheet" href="../css_j.css" type="text/css" media="screen" title="ELM Default">
|
||||
<title>FatFs - FILINFO</title>
|
||||
</head>
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS">
|
||||
<meta http-equiv="Content-Style-Type" content="text/css">
|
||||
<link rel="up" title="FatFs" href="../00index_j.html">
|
||||
<link rel="stylesheet" href="../css_j.css" type="text/css" media="screen" title="ELM Default">
|
||||
<title>FatFs - f_stat</title>
|
||||
</head>
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS">
|
||||
<meta http-equiv="Content-Style-Type" content="text/css">
|
||||
<link rel="up" title="FatFs" href="../00index_j.html">
|
||||
<link rel="stylesheet" href="../css_j.css" type="text/css" media="screen" title="ELM Default">
|
||||
<title>FatFs - f_sync</title>
|
||||
</head>
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS">
|
||||
<meta http-equiv="Content-Style-Type" content="text/css">
|
||||
<link rel="up" title="FatFs" href="../00index_j.html">
|
||||
<link rel="stylesheet" href="../css_j.css" type="text/css" media="screen" title="ELM Default">
|
||||
<title>FatFs - f_unlink</title>
|
||||
</head>
|
||||
|
||||
+3
-4
@@ -3,6 +3,7 @@
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS">
|
||||
<meta http-equiv="Content-Style-Type" content="text/css">
|
||||
<link rel="up" title="FatFs" href="../00index_j.html">
|
||||
<link rel="stylesheet" href="../css_j.css" type="text/css" media="screen" title="ELM Default">
|
||||
<title>FatFs - f_write</title>
|
||||
</head>
|
||||
@@ -32,7 +33,7 @@ FRESULT f_write (
|
||||
<dt>ByteToWrite</dt>
|
||||
<dd>書き込むバイト数を指定します。</dd>
|
||||
<dt>ByteWritten</dt>
|
||||
<dd>実際に書き込まれたバイト数を格納する変数を指すポインタを指定します。</dd>
|
||||
<dd>書き込まれたバイト数を格納する変数を指すポインタを指定します。</dd>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
@@ -44,8 +45,6 @@ FRESULT f_write (
|
||||
<dd>正常終了。</dd>
|
||||
<dt>FR_DENIED</dt>
|
||||
<dd>読み込み専用モードで開いたファイルに書き込もうとした。</dd>
|
||||
<dt>FR_ALIGN_ERROR</dt>
|
||||
<dd>アンバッファモードで開かれたファイルで、512の整数倍でないアクセスを検出した。</dd>
|
||||
<dt>FR_RW_ERROR</dt>
|
||||
<dd>ディスクアクセスでエラーが発生した。</dd>
|
||||
<dt>FR_NOT_READY</dt>
|
||||
@@ -58,7 +57,7 @@ FRESULT f_write (
|
||||
|
||||
<div class="para">
|
||||
<h4>解説</h4>
|
||||
<p>書き込み開始位置は、ファイルR/Wポインタの現在位置からになります。ファイルR/Wポインタは実際に書き込まれたバイト数だけ進みます。書き込み中にディスクが一杯になった、または<tt>FR_ALIGN_ERROR</tt>が帰ったときは、<tt>*ByteWritten</tt>は<tt>ByteToWrite</tt>よりも小さくなります。リードオンリー構成ではこの関数はサポートされません。</p>
|
||||
<p>書き込み開始位置は、ファイルR/Wポインタの現在位置からになります。ファイルR/Wポインタは実際に書き込まれたバイト数だけ進みます。書き込み中にディスクが一杯になったときは、<tt>*ByteWritten</tt>は<tt>ByteToWrite</tt>よりも小さくなります。リードオンリー構成ではこの関数はサポートされません。</p>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user