fatfs v0.08b Jan 15,2011:
- Fast seek feature is also applied to f_read() and f_write(). - f_lseek() reports required table size on creating CLMP. - Extended format syntax of f_printf function. - Ignores duplicated directory separators in given path names.
This commit is contained in:
parent
625f3adcbb
commit
5fa1073a5a
@ -4,13 +4,15 @@
|
|||||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||||
<meta http-equiv="Content-Style-Type" content="text/css">
|
<meta http-equiv="Content-Style-Type" content="text/css">
|
||||||
<meta name="description" content="Open souece FAT file system module for embedded projects">
|
<meta name="description" content="Open souece FAT file system module for embedded projects">
|
||||||
|
<link rel="start" title="Site Top" href="../../">
|
||||||
|
<link rel="up" title="Freewares" href="../../fsw_e.html">
|
||||||
<link rel="alternate" hreflang="ja" title="Japanese version" href="00index_j.html">
|
<link rel="alternate" hreflang="ja" title="Japanese version" href="00index_j.html">
|
||||||
<link rel="stylesheet" href="css_e.css" type="text/css" media="screen" title="ELM Default">
|
<link rel="stylesheet" href="css_e.css" type="text/css" media="screen" title="ELM Default">
|
||||||
<title>ELM - FatFs Generic File System Module</title>
|
<title>ELM - FatFs Generic FAT File System Module</title>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<h1>FatFs Generic File System Module</h1>
|
<h1>FatFs Generic FAT File System Module</h1>
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
<div class="abst">
|
<div class="abst">
|
||||||
@ -45,7 +47,7 @@
|
|||||||
<li><a href="en/close.html">f_close</a> - Close a file</li>
|
<li><a href="en/close.html">f_close</a> - Close a file</li>
|
||||||
<li><a href="en/read.html">f_read</a> - Read file</li>
|
<li><a href="en/read.html">f_read</a> - Read file</li>
|
||||||
<li><a href="en/write.html">f_write</a> - Write file</li>
|
<li><a href="en/write.html">f_write</a> - Write file</li>
|
||||||
<li><a href="en/lseek.html">f_lseek</a> - Move read/write pointer, Expand file zize</li>
|
<li><a href="en/lseek.html">f_lseek</a> - Move read/write pointer, Expand file size</li>
|
||||||
<li><a href="en/truncate.html">f_truncate</a> - Truncate file size</li>
|
<li><a href="en/truncate.html">f_truncate</a> - Truncate file size</li>
|
||||||
<li><a href="en/sync.html">f_sync</a> - Flush cached data</li>
|
<li><a href="en/sync.html">f_sync</a> - Flush cached data</li>
|
||||||
<li><a href="en/opendir.html">f_opendir</a> - Open a directory</li>
|
<li><a href="en/opendir.html">f_opendir</a> - Open a directory</li>
|
||||||
@ -66,6 +68,10 @@
|
|||||||
<li><a href="en/putc.html">f_putc</a> - Write a character</li>
|
<li><a href="en/putc.html">f_putc</a> - Write a character</li>
|
||||||
<li><a href="en/puts.html">f_puts</a> - Write a string</li>
|
<li><a href="en/puts.html">f_puts</a> - Write a string</li>
|
||||||
<li><a href="en/printf.html">f_printf</a> - Write a formatted string</li>
|
<li><a href="en/printf.html">f_printf</a> - Write a formatted string</li>
|
||||||
|
<li><a href="en/tell.html">f_tell</a> - Get the current read/write pointer</li>
|
||||||
|
<li><a href="en/eof.html">f_eof</a> - Test for end-of-file on a file</li>
|
||||||
|
<li><a href="en/size.html">f_size</a> - Get size of a file</li>
|
||||||
|
<li><a href="en/error.html">f_error</a> - Test for an error on a file</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -90,7 +96,6 @@
|
|||||||
<ul>
|
<ul>
|
||||||
<li><a href="http://elm-chan.org/fsw/ff/bd/"><em>FatFs User Forum</em></a></li>
|
<li><a href="http://elm-chan.org/fsw/ff/bd/"><em>FatFs User Forum</em></a></li>
|
||||||
<li>Read first: <a href="en/appnote.html">FatFs module application note</a></li>
|
<li>Read first: <a href="en/appnote.html">FatFs module application note</a></li>
|
||||||
<li>Download: <a href="ffsample.zip">FatFs sample projects</a> (AVR, PIC24, LPC2000, H8/300H, SH-2A, V850ES and Win32)</li>
|
|
||||||
<li><a href="http://www.siwawi.arubi.uni-kl.de/avr_projects/arm_projects/arm_memcards/index.html">ARM-Projects by Martin THOMAS</a> (examples for LPC2000, AT91SAM and STM32)</li>
|
<li><a href="http://www.siwawi.arubi.uni-kl.de/avr_projects/arm_projects/arm_memcards/index.html">ARM-Projects by Martin THOMAS</a> (examples for LPC2000, AT91SAM and STM32)</li>
|
||||||
<li><a href="http://www.microsoft.com/whdc/system/platform/firmware/fatgen.mspx">FAT32 Specification by Microsoft</a> (The reference document on FAT file system)</li>
|
<li><a href="http://www.microsoft.com/whdc/system/platform/firmware/fatgen.mspx">FAT32 Specification by Microsoft</a> (The reference document on FAT file system)</li>
|
||||||
<li><a href="http://elm-chan.org/docs/mmc/mmc_e.html">How to Use MMC/SDC</a></li>
|
<li><a href="http://elm-chan.org/docs/mmc/mmc_e.html">How to Use MMC/SDC</a></li>
|
||||||
@ -101,5 +106,6 @@
|
|||||||
|
|
||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
|
<p class="foot"><a href="http://elm-chan.org/fsw/ff/00index_e.html">FatFs Home Page</a></p>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@ -4,6 +4,8 @@
|
|||||||
<meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS">
|
<meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS">
|
||||||
<meta http-equiv="Content-Style-Type" content="text/css">
|
<meta http-equiv="Content-Style-Type" content="text/css">
|
||||||
<meta name="description" content="組み込みシステム向けFATファイル・システム">
|
<meta name="description" content="組み込みシステム向けFATファイル・システム">
|
||||||
|
<link rel="start" title="Site Top" href="../../index_j.html">
|
||||||
|
<link rel="up" title="Freewares" href="../../fsw.html">
|
||||||
<link rel="alternate" hreflang="en" title="英文" href="00index_e.html">
|
<link rel="alternate" hreflang="en" title="英文" href="00index_e.html">
|
||||||
<link rel="stylesheet" href="css_j.css" type="text/css" media="screen" title="ELM Default">
|
<link rel="stylesheet" href="css_j.css" type="text/css" media="screen" title="ELM Default">
|
||||||
<title>ELM - FatFs 汎用FATファイルシステム・モジュール</title>
|
<title>ELM - FatFs 汎用FATファイルシステム・モジュール</title>
|
||||||
@ -65,6 +67,10 @@
|
|||||||
<li><a href="ja/putc.html">f_putc</a> - 文字の書き込み</li>
|
<li><a href="ja/putc.html">f_putc</a> - 文字の書き込み</li>
|
||||||
<li><a href="ja/puts.html">f_puts</a> - 文字列の書き込み</li>
|
<li><a href="ja/puts.html">f_puts</a> - 文字列の書き込み</li>
|
||||||
<li><a href="ja/printf.html">f_printf</a> - 書式化文字列の書き込み</li>
|
<li><a href="ja/printf.html">f_printf</a> - 書式化文字列の書き込み</li>
|
||||||
|
<li><a href="ja/tell.html">f_tell</a> - 現在のリード/ライト・ポインタの取得</li>
|
||||||
|
<li><a href="ja/eof.html">f_eof</a> - ファイル終端の有無の取得</li>
|
||||||
|
<li><a href="ja/size.html">f_size</a> - ファイル・サイズの取得</li>
|
||||||
|
<li><a href="ja/error.html">f_error</a> - ファイルのエラーの有無の取得</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -89,7 +95,6 @@
|
|||||||
<ul>
|
<ul>
|
||||||
<li><a href="http://elm-chan.org/fsw/ff/bd/"><em>FatFsユーザ・フォーラム</em></a></li>
|
<li><a href="http://elm-chan.org/fsw/ff/bd/"><em>FatFsユーザ・フォーラム</em></a></li>
|
||||||
<li>最初に読め: <a href="ja/appnote.html">FatFsモジュール・アプリケーション・ノート</a></li>
|
<li>最初に読め: <a href="ja/appnote.html">FatFsモジュール・アプリケーション・ノート</a></li>
|
||||||
<li>ダウンロード: <a href="ffsample.zip">サンプル・プロジェクト</a> (AVR, PIC24, LPC2000, H8/300H, SH-2A, V850ES and Win32)</li>
|
|
||||||
<li><a href="http://www.siwawi.arubi.uni-kl.de/avr_projects/arm_projects/arm_memcards/index.html">ARM-Projects by Martin THOMAS</a> (examples for LPC2000, AT91SAM and STM32)</li>
|
<li><a href="http://www.siwawi.arubi.uni-kl.de/avr_projects/arm_projects/arm_memcards/index.html">ARM-Projects by Martin THOMAS</a> (examples for LPC2000, AT91SAM and STM32)</li>
|
||||||
<li><a href="http://www.microsoft.com/whdc/system/platform/firmware/fatgen.mspx">FATファイル・システム仕様書 by Microsoft</a> (FATの理解・実装に必要な唯一のリファレンス)</li>
|
<li><a href="http://www.microsoft.com/whdc/system/platform/firmware/fatgen.mspx">FATファイル・システム仕様書 by Microsoft</a> (FATの理解・実装に必要な唯一のリファレンス)</li>
|
||||||
<li><a href="http://elm-chan.org/docs/fat.html">FATファイル・システム概要</a> (↑を読むためのガイド)</li>
|
<li><a href="http://elm-chan.org/docs/fat.html">FATファイル・システム概要</a> (↑を読むためのガイド)</li>
|
||||||
@ -101,5 +106,6 @@
|
|||||||
|
|
||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
|
<p class="foot"><a href="http://elm-chan.org/fsw/ff/00index_j.html">FatFs Home Page</a></p>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@ -10,9 +10,10 @@ p {margin: 0 0 0.3em 1em;}
|
|||||||
em {font-style: normal; font-weight: bold; margin: 0 0.1em;}
|
em {font-style: normal; font-weight: bold; margin: 0 0.1em;}
|
||||||
pre em {font-style: italic; font-weight: normal;}
|
pre em {font-style: italic; font-weight: normal;}
|
||||||
strong {}
|
strong {}
|
||||||
pre {border: 1px dashed gray; margin: 0.5em 1em; padding: 0.5em; line-height: 1.2em; background-color: white;}
|
pre {border: 1px dashed gray; margin: 0.5em 1em; padding: 0.5em; line-height: 1.2em; font-family: monospace; background-color: white;}
|
||||||
pre span {color: green;}
|
pre span.c {color: green;}
|
||||||
tt {margin: 0 0.2em;}
|
pre span.k {color: blue;}
|
||||||
|
tt {margin: 0 0.2em; font-family: monospace; }
|
||||||
ol {margin: 0 2.5em;}
|
ol {margin: 0 2.5em;}
|
||||||
ul {margin: 0 2em;}
|
ul {margin: 0 2em;}
|
||||||
dl {margin: 0 1em;}
|
dl {margin: 0 1em;}
|
||||||
@ -23,6 +24,7 @@ dd {margin: 0 2em;}
|
|||||||
hr {border-width: 1px; margin: 1em;}
|
hr {border-width: 1px; margin: 1em;}
|
||||||
div.abst {font-family: sans-serif;}
|
div.abst {font-family: sans-serif;}
|
||||||
div.para {clear: both; font-family: serif;}
|
div.para {clear: both; font-family: serif;}
|
||||||
|
div.ret a {font-family: monospace; }
|
||||||
.equ {text-indent: 0; margin: 1em 2em 1em;}
|
.equ {text-indent: 0; margin: 1em 2em 1em;}
|
||||||
.indent {margin-left: 2em;}
|
.indent {margin-left: 2em;}
|
||||||
.rset {float: right; margin: 0 0 0.5em 0.5em;}
|
.rset {float: right; margin: 0 0 0.5em 0.5em;}
|
||||||
@ -38,7 +40,7 @@ h1 {line-height: 1em; font-size: 2em; font-family: sans-serif; padding: 0.3em 0
|
|||||||
p.hdd {float: right; text-align: right; margin-top: 0.5em;}
|
p.hdd {float: right; text-align: right; margin-top: 0.5em;}
|
||||||
hr.hds {clear: both; margin-bottom: 1em;}
|
hr.hds {clear: both; margin-bottom: 1em;}
|
||||||
|
|
||||||
h2 {font-size: 1.5em; color: blueviolet; font-family: sans-serif; margin: 0 0 0.5em;}
|
h2 {font-size: 1.6em; font-family: sans-serif; background-color: #d8d8FF; padding: 0.2em 0.5em; margin: 0 0 0.5em;}
|
||||||
h3 {font-size: 1.5em; font-family: sans-serif; margin: 1.5em 0 0.5em;}
|
h3 {font-size: 1.5em; font-family: sans-serif; margin: 1.5em 0 0.5em;}
|
||||||
h4 {font-size: 1.2em; font-family: sans-serif; margin: 1em 0 0.2em;}
|
h4 {font-size: 1.2em; font-family: sans-serif; margin: 1em 0 0.2em;}
|
||||||
h5 {font-size: 1em; font-family: sans-serif; margin: 0.5em 0 0em;}
|
h5 {font-size: 1em; font-family: sans-serif; margin: 0.5em 0 0em;}
|
||||||
|
|||||||
@ -13,9 +13,10 @@ p {text-indent: 1em; margin: 0 0 0.3em 0.5em;}
|
|||||||
em {font-style: normal; font-weight: bold; margin: 0 0.1em;}
|
em {font-style: normal; font-weight: bold; margin: 0 0.1em;}
|
||||||
pre em {font-style: italic; font-weight: normal;}
|
pre em {font-style: italic; font-weight: normal;}
|
||||||
strong {}
|
strong {}
|
||||||
pre {border: 1px dashed gray; margin: 0.5em 1em; padding: 0.5em; line-height: 1.2em; letter-spacing: 0; background-color: white;}
|
pre {border: 1px dashed gray; margin: 0.5em 1em; padding: 0.5em; line-height: 1.2em; letter-spacing: 0; font-family: monospace; background-color: white;}
|
||||||
pre span {color: green;}
|
pre span.c {color: green;}
|
||||||
tt {margin: 0 0.2em; letter-spacing: 0;}
|
pre span.k {color: blue;}
|
||||||
|
tt {margin: 0 0.2em; letter-spacing: 0; font-family: monospace; }
|
||||||
ol {margin: 0 2.5em;}
|
ol {margin: 0 2.5em;}
|
||||||
ul {margin: 0 2em;}
|
ul {margin: 0 2em;}
|
||||||
dl {margin: 0 1em;}
|
dl {margin: 0 1em;}
|
||||||
@ -26,6 +27,7 @@ dd {margin: 0 2em;}
|
|||||||
hr {border-width: 1px; margin: 1em;}
|
hr {border-width: 1px; margin: 1em;}
|
||||||
div.abst {font-family: "MS Pゴシック",sans-serif;}
|
div.abst {font-family: "MS Pゴシック",sans-serif;}
|
||||||
div.para {clear: both; font-family: "MS P明朝",serif;}
|
div.para {clear: both; font-family: "MS P明朝",serif;}
|
||||||
|
div.ret a {font-family: monospace; }
|
||||||
.equ {text-indent: 0; margin: 1em 2em 1em;}
|
.equ {text-indent: 0; margin: 1em 2em 1em;}
|
||||||
.indent {margin-left: 2em;}
|
.indent {margin-left: 2em;}
|
||||||
.rset {float: right; margin: 0 0 0.5em 0.5em;}
|
.rset {float: right; margin: 0 0 0.5em 0.5em;}
|
||||||
@ -41,7 +43,7 @@ h1 {line-height: 1em; font-size: 2em; font-family: sans-serif; padding: 0.3em 0
|
|||||||
p.hdd {float: right; text-align: right; margin-top: 0.5em;}
|
p.hdd {float: right; text-align: right; margin-top: 0.5em;}
|
||||||
hr.hds {clear: both; margin-bottom: 1em;}
|
hr.hds {clear: both; margin-bottom: 1em;}
|
||||||
|
|
||||||
h2 {font-size: 1.5em; color: blueviolet; font-family: "MS Pゴシック",sans-serif; margin: 0 0 0.5em;}
|
h2 {font-size: 1.6em; font-family: "MS Pゴシック",sans-serif; background-color: #d8d8FF; padding: 0.2em 0.5em; margin: 0 0 0.5em;}
|
||||||
h3 {font-size: 1.5em; font-family: "MS Pゴシック",sans-serif; margin: 1.5em 0 0.5em;}
|
h3 {font-size: 1.5em; font-family: "MS Pゴシック",sans-serif; margin: 1.5em 0 0.5em;}
|
||||||
h4 {font-size: 1.2em; font-family: "MS Pゴシック",sans-serif; margin: 1em 0 0.2em;}
|
h4 {font-size: 1.2em; font-family: "MS Pゴシック",sans-serif; margin: 1em 0 0.2em;}
|
||||||
h5 {font-size: 1em; font-family: "MS Pゴシック",sans-serif; margin: 0.5em 0 0em;}
|
h5 {font-size: 1em; font-family: "MS Pゴシック",sans-serif; margin: 0.5em 0 0em;}
|
||||||
|
|||||||
@ -43,24 +43,14 @@ The FatFs module assumes that size of char/short/long are 8/16/32 bit and int is
|
|||||||
<p>You need to provide only low level disk I/O functions that required by FatFs module and nothing else. If a working disk module for the target is already existing, you need to write only glue functions to attach it to the FatFs module. If not, you need to port any other disk module or write it from scratch. All defined functions are not that always required. For example, disk write function is not required in read-only configuration. Following table shows which function is required depends on configuration options.</p>
|
<p>You need to provide only low level disk I/O functions that required by FatFs module and nothing else. If a working disk module for the target is already existing, you need to write only glue functions to attach it to the FatFs module. If not, you need to port any other disk module or write it from scratch. All defined functions are not that always required. For example, disk write function is not required in read-only configuration. Following table shows which function is required depends on configuration options.</p>
|
||||||
<table class="lst2">
|
<table class="lst2">
|
||||||
<tr><th>Function</th><th>Required when:</th><th>Note</th></tr>
|
<tr><th>Function</th><th>Required when:</th><th>Note</th></tr>
|
||||||
<tr><td>disk_initialize</td><td>Always</td><td rowspan="10">Disk I/O functions.<br>Samples available in ffsample.zip.<br>There are many implementations on the web.</td></tr>
|
<tr><td>disk_initialize<br>disk_status<br>disk_read</td><td>Always</td><td rowspan="5">Disk I/O functions.<br>Samples available in ffsample.zip.<br>There are many implementations on the web.</td></tr>
|
||||||
<tr><td>disk_status</td><td>Always</td></tr>
|
<tr><td>disk_write<br>get_fattime<br>disk_ioctl (CTRL_SYNC)</td><td>_FS_READONLY == 0</td></tr>
|
||||||
<tr><td>disk_read</td><td>Always</td></tr>
|
<tr><td>disk_ioctl (GET_SECTOR_COUNT)<br>disk_ioctl (GET_BLOCK_SIZE)</td><td>_USE_MKFS == 1</td></tr>
|
||||||
<tr><td>disk_write</td><td>_FS_READONLY == 0</td></tr>
|
<tr><td>disk_ioctl (GET_SECTOR_SIZE)</td><td>_MAX_SS > 512</td></tr>
|
||||||
<tr><td>disk_ioctl (CTRL_SYNC)</td><td>_FS_READONLY == 0</td></tr>
|
|
||||||
<tr><td>disk_ioctl (GET_SECTOR_COUNT)</td><td>_USE_MKFS == 1</td></tr>
|
|
||||||
<tr><td>disk_ioctl (GET_SECTOR_SIZE)</td><td>_MAX_SS >= 1024</td></tr>
|
|
||||||
<tr><td>disk_ioctl (GET_BLOCK_SIZE)</td><td>_USE_MKFS == 1</td></tr>
|
|
||||||
<tr><td>disk_ioctl (CTRL_ERASE_SECTOR)</td><td>_USE_ERASE == 1</td></tr>
|
<tr><td>disk_ioctl (CTRL_ERASE_SECTOR)</td><td>_USE_ERASE == 1</td></tr>
|
||||||
<tr><td>get_fattime</td><td>_FS_READONLY == 0</td></tr>
|
<tr><td>ff_convert<br>ff_wtoupper</td><td>_USE_LFN >= 1</td><td>Unicode support functions.<br>Available in option/cc*.c.</td></tr>
|
||||||
<tr><td>ff_convert</td><td>_USE_LFN >= 1</td><td rowspan="2">Unicode support functions.<br>Available in option/cc*.c.</td></tr>
|
<tr><td>ff_cre_syncobj<br>ff_del_syncobj<br>ff_req_grant<br>ff_rel_grant</td><td>_FS_REENTRANT == 1</td><td rowspan="2">O/S dependent functions.<br>Samples available in option/syscall.c.</td></tr>
|
||||||
<tr><td>ff_wtoupper</td><td>_USE_LFN >= 1</td></tr>
|
<tr><td>ff_mem_alloc<br>ff_mem_free</td><td>_USE_LFN == 3</td></tr>
|
||||||
<tr><td>ff_cre_syncobj</td><td>_FS_REENTRANT == 1</td><td rowspan="6">O/S dependent functions.<br>Samples available in option/syscall.c.</td></tr>
|
|
||||||
<tr><td>ff_del_syncobj</td><td>_FS_REENTRANT == 1</td></tr>
|
|
||||||
<tr><td>ff_req_grant</td><td>_FS_REENTRANT == 1</td></tr>
|
|
||||||
<tr><td>ff_rel_grant</td><td>_FS_REENTRANT == 1</td></tr>
|
|
||||||
<tr><td>ff_mem_alloc</td><td>_USE_LFN == 3</td></tr>
|
|
||||||
<tr><td>ff_mem_free</td><td>_USE_LFN == 3</td></tr>
|
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -78,20 +68,20 @@ The FatFs module assumes that size of char/short/long are 8/16/32 bit and int is
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="para" id="memory">
|
<div class="para" id="memory">
|
||||||
<h3>Memory Usage (R0.08a)</h3>
|
<h3>Memory Usage (R0.08b)</h3>
|
||||||
<table class="lst2">
|
<table class="lst2">
|
||||||
<tr><th></th><th>AVR</th><th>H8/300H</th><th>PIC24</th><th>V850ES</th><th>SH-2A</th><th>ARM7</th><th>x86</th></tr>
|
<tr><th></th><th>ARM7<small><br>32bit</small></th><th>ARM7<small><br>Thumb</small></th><th>Cortex-M3<small><br>Thumb-2</small></th><th>AVR</th><th>H8/300H</th><th>PIC24</th><th>RL78</th><th>V850ES</th><th>SH-2A</th><th>RX62N</th><th>IA-32</th></tr>
|
||||||
<tr><td>Compiler</td><td>WinAVR(gcc)</td><td>CH38</td><td>C30(gcc)</td><td>CA850</td><td>SHC</td><td>WinARM(gcc)</td><td>VC6</td></tr>
|
<tr><td>Compiler</td><td>GCC</td><td>GCC</td><td>GCC</td><td>GCC</td><td>CH38</td><td>C30</td><td>CC78K0R</td><td>CA850</td><td>SHC</td><td>RXC</td><td>VC6</td></tr>
|
||||||
<tr><td>_WORD_ACCESS</td><td>1</td><td>0</td><td>0</td><td>1</td><td>0</td><td>0</td><td>1</td></tr>
|
<tr><td>_WORD_ACCESS</td><td>0</td><td>0</td><td>0</td><td>1</td><td>0</td><td>0</td><td>0</td><td>1</td><td>0</td><td>1</td><td>1</td></tr>
|
||||||
<tr class="lst3"><td>text (Full, R/W)</td><td>12646</td><td>10686</td><td>11430</td><td>7732</td><td>8752</td><td>10560</td><td>7545</td></tr>
|
<tr class="lst3"><td>text (Full, R/W)</td><td>10495</td><td>7205</td><td>6661</td><td>12646</td><td>10686</td><td>11430</td><td>12967</td><td>7732</td><td>8752</td><td>5747</td><td>7545</td></tr>
|
||||||
<tr> <td>text (Min, R/W)</td><td>8306</td><td>6986</td><td>7413</td><td>4938</td><td>5576</td><td>6680</td><td>4923</td></tr>
|
<tr> <td>text (Min, R/W)</td><td>6523</td><td>4749</td><td>4335</td><td>8306</td><td>6986</td><td>7413</td><td>8745</td><td>4938</td><td>5576</td><td>3746</td><td>4923</td></tr>
|
||||||
<tr><td>text (Full, R/O)</td><td>5960</td><td>4876</td><td>5250</td><td>3554</td><td>3804</td><td>4688</td><td>3450</td></tr>
|
<tr><td>text (Full, R/O)</td><td>4539</td><td>3183</td><td>2893</td><td>5960</td><td>4876</td><td>5250</td><td>6060</td><td>3554</td><td>3804</td><td>2659</td><td>3450</td></tr>
|
||||||
<tr> <td>text (Min, R/O)</td><td>4366</td><td>3770</td><td>3939</td><td>2684</td><td>2940</td><td>3452</td><td>2664</td></tr>
|
<tr> <td>text (Min, R/O)</td><td>3307</td><td>2495</td><td>2191</td><td>4366</td><td>3770</td><td>3939</td><td>4604</td><td>2684</td><td>2940</td><td>2025</td><td>2664</td></tr>
|
||||||
<tr><td>bss</td><td>D*2 + 2</td><td>D*4 + 2</td><td>D*2 + 2</td><td>D*4 + 2</td><td>D*4 + 2</td><td>D*4 + 2</td><td>D*4 + 2</td></tr>
|
<tr><td>bss</td><td>D*4 + 2</td><td>D*4 + 2</td><td>D*4 + 2</td><td>D*2 + 2</td><td>D*4 + 2</td><td>D*2 + 2</td><td>D*2 + 2</td><td>D*4 + 2</td><td>D*4 + 2</td><td>D*4 + 2</td><td>D*4 + 2</td></tr>
|
||||||
<tr><td>Work area<br>(_FS_TINY == 0)</td><td>D*560 +<br>F*544</td><td>D*560 +<br>F*550</td><td>D*560 +<br>F*544</td><td>D*560 +<br>F*550</td><td>D*560 +<br>F*550</td><td>D*560 +<br>F*550</td><td>D*560 +<br>F*550</td></tr>
|
<tr><td>Work area<br>(_FS_TINY == 0)</td><td>V*560 +<br>F*550</td><td>V*560 +<br>F*550</td><td>V*560 +<br>F*550</td><td>V*560 +<br>F*544</td><td>V*560 +<br>F*550</td><td>V*560 +<br>F*544</td><td>V*560 +<br>F*544</td><td>V*560 +<br>F*544</td><td>V*560 +<br>F*550</td><td>V*560 +<br>F*550</td><td>V*560 +<br>F*550</td></tr>
|
||||||
<tr><td>Work area<br>(_FS_TINY == 1)</td><td>D*560 +<br>F*32</td><td>D*560 +<br>F*36</td><td>D*560 +<br>F*32</td><td>D*560 +<br>F*36</td><td>D*560 +<br>F*36</td><td>D*560 +<br>F*36</td><td>D*560 +<br>F*36</td></tr>
|
<tr><td>Work area<br>(_FS_TINY == 1)</td><td>V*560 +<br>F*36</td><td>V*560 +<br>F*36</td><td>V*560 +<br>F*36</td><td>V*560 +<br>F*32</td><td>V*560 +<br>F*36</td><td>V*560 +<br>F*32</td><td>V*560 +<br>F*32</td><td>V*560 +<br>F*36</td><td>V*560 +<br>F*36</td><td>V*560 +<br>F*36</td><td>V*560 +<br>F*36</td></tr>
|
||||||
</table>
|
</table>
|
||||||
<p>These are the memory usage on some target systems with following condition. The memory sizes are in unit of byte, D means number of volumes and F means number of open files. All samples are optimezed in code size.</p>
|
<p>These are the memory usage on some target systems with following condition. The memory sizes are in unit of byte, <em>V</em> means number of mounted volumes and <em>F</em> means number of open files. All samples are optimezed in code size.</p>
|
||||||
<pre>
|
<pre>
|
||||||
_FS_READONLY 0 (R/W), 1 (R/O)
|
_FS_READONLY 0 (R/W), 1 (R/O)
|
||||||
_FS_MINIMIZE 0 (Full function), 3 (Minimized function)
|
_FS_MINIMIZE 0 (Full function), 3 (Minimized function)
|
||||||
@ -103,6 +93,7 @@ _CODE_PAGE 932 (Japanese Shift-JIS)
|
|||||||
_USE_LFN 0 (Disable LFN)
|
_USE_LFN 0 (Disable LFN)
|
||||||
_MAX_SS 512 (Fixed sector size)
|
_MAX_SS 512 (Fixed sector size)
|
||||||
_FS_RPATH 0 (Disable relative path)
|
_FS_RPATH 0 (Disable relative path)
|
||||||
|
_VOLUMES D (Number of logical drives to be used)
|
||||||
_MULTI_PARTITION 0 (Single partition per drive)
|
_MULTI_PARTITION 0 (Single partition per drive)
|
||||||
_FS_REENTRANT 0 (Disable reentrancy)
|
_FS_REENTRANT 0 (Disable reentrancy)
|
||||||
_FS_SHARE 0 (Disable shareing control)
|
_FS_SHARE 0 (Disable shareing control)
|
||||||
@ -114,7 +105,7 @@ _FS_SHARE 0 (Disable shareing control)
|
|||||||
<p>Follwing table shows which API function is removed by configuration options for the module size reduction.</p>
|
<p>Follwing table shows which API function is removed by configuration options for the module size reduction.</p>
|
||||||
<table class="lst2">
|
<table class="lst2">
|
||||||
<tr><td rowspan="2">Function</td><td colspan="4">_FS_MINIMIZE</td><td colspan="2">_FS_READONLY</td><td colspan="2">_USE_STRFUNC</td><td colspan="3">_FS_RPATH</td><td colspan="2">_USE_MKFS</td><td colspan="2">_USE_FORWARD</td></tr>
|
<tr><td rowspan="2">Function</td><td colspan="4">_FS_MINIMIZE</td><td colspan="2">_FS_READONLY</td><td colspan="2">_USE_STRFUNC</td><td colspan="3">_FS_RPATH</td><td colspan="2">_USE_MKFS</td><td colspan="2">_USE_FORWARD</td></tr>
|
||||||
<tr><td>0</td><td>1</td><td>2</td><td>3</td><td>0</td><td>1</td><td>0</td><td>1</td><td>0</td><td>1</td><td>2</td><td>0</td><td>1</td><td>0</td><td>1</td></tr>
|
<tr><td>0</td><td>1</td><td>2</td><td>3</td><td>0</td><td>1</td><td>0 </td><td>1/2</td><td>0</td><td>1</td><td>2</td><td>0</td><td>1</td><td>0</td><td>1</td></tr>
|
||||||
<tr class="lst3"><td>f_mount</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
|
<tr class="lst3"><td>f_mount</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
|
||||||
<tr><td>f_open</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
|
<tr><td>f_open</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
|
||||||
<tr><td>f_close</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
|
<tr><td>f_close</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
|
||||||
@ -156,8 +147,8 @@ _FS_SHARE 0 (Disable shareing control)
|
|||||||
<tr><td>949(Korean)</td><td>+139K</td></tr>
|
<tr><td>949(Korean)</td><td>+139K</td></tr>
|
||||||
<tr><td>950(Big5)</td><td>+111K</td></tr>
|
<tr><td>950(Big5)</td><td>+111K</td></tr>
|
||||||
</table>
|
</table>
|
||||||
<p>When the LFN feature is enabled, the module size will be increased depends on the selected code page. Right table shows how many bytes increased when LFN feature is enabled with some code pages. We are the Japanese, Chinese and Korean have tens of thousands of characters. Unfortunately, it requires a huge OEM-Unicode bidirectional conversion table and the module size will be drastically increased that shown in the table. As the result, the FatFs with LFN feature with DBCS will not able to be implemented to most 8-bit microcontrollers. <small>This is the reason why I had not been interested in implementing the LFN feature for a long time :-)</small></p>
|
<p>When the LFN feature is enabled, the module size will be increased depends on the selected code page. Right table shows how many bytes increased when LFN feature is enabled with some code pages. We are the East-Asians have tens of thousands of characters. Unfortunately, it requires a huge OEM-Unicode bidirectional conversion table and the module size will be drastically increased that shown in the table. As the result, the FatFs with LFN feature with DBCS will not able to be implemented to most 8-bit microcontrollers. <small>This is the reason why I had not been interested in implementing the LFN feature for a long time :-)</small></p>
|
||||||
<p>Note that the LFN feature on the FAT file system is a patent of Microsoft Corporation. When enable it on the commercial products, a license from Microsoft may be required depends on the final destination.</p>
|
<p>Note that the LFN feature on the FAT file system is a patent of Microsoft Corporation. This is not the case on FAT32. When enable LFN feature on the commercial products, a license from Microsoft may be required depends on the final destination.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="para" id="unicode">
|
<div class="para" id="unicode">
|
||||||
@ -168,15 +159,15 @@ _FS_SHARE 0 (Disable shareing control)
|
|||||||
<div class="para" id="reentrant">
|
<div class="para" id="reentrant">
|
||||||
<h3>Re-entrancy</h3>
|
<h3>Re-entrancy</h3>
|
||||||
<p>The file operations to the different volume is always re-entrant ant can work simultaneously. The file operations to the same volume is not re-entrant but it can also be configured to thread-safe with <tt>_FS_REENTRANT</tt> option. In this case, also the OS dependent synchronization object control functions, ff_cre_syncobj, ff_del_syncobj, ff_req_grant and ff_rel_grant must be added to the project.</p>
|
<p>The file operations to the different volume is always re-entrant ant can work simultaneously. The file operations to the same volume is not re-entrant but it can also be configured to thread-safe with <tt>_FS_REENTRANT</tt> option. In this case, also the OS dependent synchronization object control functions, ff_cre_syncobj, ff_del_syncobj, ff_req_grant and ff_rel_grant must be added to the project.</p>
|
||||||
<p>When a file function is called while the volume is in use by any other task, the access is blocked until the task leaves file function. If wait time exceeded a period defined by <tt>_TIMEOUT</tt>, the file function will abort with <tt>FR_TIMEOUT</tt>. The timeout feature might not be supported on some RTOS.</p>
|
<p>When a file function is called while the volume is in use by any other task, the file function is suspended until that task leaves file function. If wait time exceeded a period defined by <tt>_TIMEOUT</tt>, the file function will abort with <tt>FR_TIMEOUT</tt>. The timeout feature might not be supported on some RTOS.</p>
|
||||||
<p>There is an exception on f_mount and f_mkfs function. These functions are not re-entrant to the same volume. When use these functions, all other task must close the corresponding file on the volume and avoid to access the volume.</p>
|
<p>There is an exception on f_mount and f_mkfs function. These functions are not re-entrant to the same volume. When use these functions, all other task must close the corresponding file on the volume and avoid to access the volume.</p>
|
||||||
<p>Note that this section describes on the re-entrancy of the FatFs module itself. There is no assumtion on the re-entrancy of low level disk I/O module.</p>
|
<p>Note that this section describes on the re-entrancy of the FatFs module itself but also the low level disk I/O layer must be re-entrant.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="para" id="dup">
|
<div class="para" id="dup">
|
||||||
<h3>Duplicated File Access</h3>
|
<h3>Duplicated File Access</h3>
|
||||||
<p>FatFs module does not support the shareing controls of duplicated file access in default. It is permitted when open method to a file is only read mode. The duplicated open in write mode to a file is always prohibited and open file must not be renamed, deleted, otherwise the FAT structure on the volume can be collapted. Also current directory must not be deleted.</p>
|
<p>FatFs module does not support the shareing controls of duplicated file access in default. It is permitted when open method to a file is only read mode. The duplicated open in write mode to a file is always prohibited and open file must not be renamed, deleted, or the FAT structure on the volume can be collapted.</p>
|
||||||
<p>The file shareing control can also be available when <tt>_FS_SHARE</tt> is set to 1 or grater. In this case, if any open, rename or remove that violating the file shareing rule that described above is attempted, the file function will fail with <tt>FR_LOCKED</tt>.</p>
|
<p>The file shareing control can also be available when <tt>_FS_SHARE</tt> is set to 1 or grater. The value specifies the number of files to manage simultaneously. In this case, if any open, rename or remove that violating the file shareing rule that described above is attempted, the file function will fail with <tt>FR_LOCKED</tt>. If number of open files gets larger than <tt>_FS_SHARE</tt>, the f_open function will fail with <tt>FR_TOO_MANY_OPEN_FILES</tt>.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="para" id="fs1">
|
<div class="para" id="fs1">
|
||||||
@ -236,13 +227,13 @@ Figure 5. Minimized critical section<br>
|
|||||||
<h3>About FatFs License</h3>
|
<h3>About FatFs License</h3>
|
||||||
<p>This is a copy of the FatFs license document that included in the source codes.</p>
|
<p>This is a copy of the FatFs license document that included in the source codes.</p>
|
||||||
<pre>/*----------------------------------------------------------------------------/
|
<pre>/*----------------------------------------------------------------------------/
|
||||||
/ FatFs - FAT file system module R0.08a (C)ChaN, 2010
|
/ FatFs - FAT file system module R0.08b (C)ChaN, 2011
|
||||||
/-----------------------------------------------------------------------------/
|
/-----------------------------------------------------------------------------/
|
||||||
/ FatFs module is a generic FAT file system module for small embedded systems.
|
/ FatFs module is a generic FAT file system module for small embedded systems.
|
||||||
/ This is a free software that opened for education, research and commercial
|
/ This is a free software that opened for education, research and commercial
|
||||||
/ developments under license policy of following trems.
|
/ developments under license policy of following trems.
|
||||||
/
|
/
|
||||||
/ Copyright (C) 2010, ChaN, all right reserved.
|
/ Copyright (C) 2011, ChaN, all right reserved.
|
||||||
/
|
/
|
||||||
/ * The FatFs module is a free software and there is NO WARRANTY.
|
/ * The FatFs module is a free software and there is NO WARRANTY.
|
||||||
/ * No restriction on use. You can use, modify and redistribute it for
|
/ * No restriction on use. You can use, modify and redistribute it for
|
||||||
|
|||||||
@ -11,17 +11,17 @@
|
|||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para func">
|
||||||
<h2>f_chdir</h2>
|
<h2>f_chdir</h2>
|
||||||
<p>The f_chdir function changes the current directory of a drive.</p>
|
<p>The f_chdir function changes the current directory of a drive.</p>
|
||||||
<pre>
|
<pre>
|
||||||
FRESULT f_chdir (
|
FRESULT f_chdir (
|
||||||
const TCHAR* <em>Path</em> <span>/* Pointer to the path name */</span>
|
const TCHAR* <em>Path</em> <span class="c">/* Pointer to the path name */</span>
|
||||||
);
|
);
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para arg">
|
||||||
<h4>Parameters</h4>
|
<h4>Parameters</h4>
|
||||||
<dl class="par">
|
<dl class="par">
|
||||||
<dt>Path</dt>
|
<dt>Path</dt>
|
||||||
@ -30,55 +30,48 @@ FRESULT f_chdir (
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para ret">
|
||||||
<h4>Return Values</h4>
|
<h4>Return Values</h4>
|
||||||
<dl class="ret">
|
<p>
|
||||||
<dt>FR_OK (0)</dt>
|
<a href="rc.html#ok">FR_OK</a>,
|
||||||
<dd>The function succeeded.</dd>
|
<a href="rc.html#de">FR_DISK_ERR</a>,
|
||||||
<dt>FR_NO_PATH</dt>
|
<a href="rc.html#ie">FR_INT_ERR</a>,
|
||||||
<dd>Could not find the path.</dd>
|
<a href="rc.html#nr">FR_NOT_READY</a>,
|
||||||
<dt>FR_INVALID_NAME</dt>
|
<a href="rc.html#np">FR_NO_PATH</a>,
|
||||||
<dd>The path name is invalid.</dd>
|
<a href="rc.html#in">FR_INVALID_NAME</a>,
|
||||||
<dt>FR_INVALID_DRIVE</dt>
|
<a href="rc.html#id">FR_INVALID_DRIVE</a>,
|
||||||
<dd>The drive number is invalid.</dd>
|
<a href="rc.html#ne">FR_NOT_ENABLED</a>,
|
||||||
<dt>FR_NOT_READY</dt>
|
<a href="rc.html#ns">FR_NO_FILESYSTEM</a>,
|
||||||
<dd>The disk drive cannot work due to no medium in the drive or any other reason.</dd>
|
<a href="rc.html#tm">FR_TIMEOUT</a>,
|
||||||
<dt>FR_DISK_ERR</dt>
|
<a href="rc.html#nc">FR_NOT_ENOUGH_CORE</a>
|
||||||
<dd>The function failed due to an error in the disk function.</dd>
|
</p>
|
||||||
<dt>FR_INT_ERR</dt>
|
|
||||||
<dd>The function failed due to a wrong FAT structure or an internal error.</dd>
|
|
||||||
<dt>FR_NOT_ENABLED</dt>
|
|
||||||
<dd>The logical drive has no work area.</dd>
|
|
||||||
<dt>FR_NO_FILESYSTEM</dt>
|
|
||||||
<dd>There is no valid FAT volume on the drive.</dd>
|
|
||||||
</dl>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para desc">
|
||||||
<h4>Description</h4>
|
<h4>Description</h4>
|
||||||
<p>The f_chdir function changes the current directory of the logical drive. The current directory of a drive is initialized to the root directory when the drive is auto-mounted. Note that the current directory is retained in the each file system object so that it also affects other tasks that using the drive.</p>
|
<p>The f_chdir function changes the current directory of the logical drive. The current directory of a drive is initialized to the root directory when the drive is auto-mounted. Note that the current directory is retained in the each file system object so that it also affects other tasks that using the drive.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para comp">
|
||||||
<h4>QuickInfo</h4>
|
<h4>QuickInfo</h4>
|
||||||
<p>Available when <tt>_FS_RPATH >= 1</tt>.</p>
|
<p>Available when <tt>_FS_RPATH >= 1</tt>.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para use">
|
||||||
<h4>Example</h4>
|
<h4>Example</h4>
|
||||||
<pre>
|
<pre>
|
||||||
<span>/* Change current direcoty of the current drive (dir1 under root dir) */</span>
|
<span class="c">/* Change current direcoty of the current drive (dir1 under root dir) */</span>
|
||||||
f_chdir("/dir1");
|
f_chdir("/dir1");
|
||||||
|
|
||||||
<span>/* Change current direcoty of drive 2 (parent dir) */</span>
|
<span class="c">/* Change current direcoty of drive 2 (parent dir) */</span>
|
||||||
f_chdir("2:..");
|
f_chdir("2:..");
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para ref">
|
||||||
<h4>See Also</h4>
|
<h4>See Also</h4>
|
||||||
<p><tt><a href="chdrive.html">f_chdrive</a>, <a href="getcwd.html">f_getcwd</a></tt></p>
|
<p><tt><a href="chdrive.html">f_chdrive</a>, <a href="getcwd.html">f_getcwd</a></tt></p>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -11,17 +11,17 @@
|
|||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para func">
|
||||||
<h2>f_chdrive</h2>
|
<h2>f_chdrive</h2>
|
||||||
<p>The f_chdrive function changes the current drive.</p>
|
<p>The f_chdrive function changes the current drive.</p>
|
||||||
<pre>
|
<pre>
|
||||||
FRESULT f_chdrive (
|
FRESULT f_chdrive (
|
||||||
BYTE <em>Drive</em> <span>/* Logical drive number */</span>
|
BYTE <em>Drive</em> <span class="c">/* Logical drive number */</span>
|
||||||
);
|
);
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para arg">
|
||||||
<h4>Parameters</h4>
|
<h4>Parameters</h4>
|
||||||
<dl class="par">
|
<dl class="par">
|
||||||
<dt>Drive</dt>
|
<dt>Drive</dt>
|
||||||
@ -30,29 +30,27 @@ FRESULT f_chdrive (
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para ret">
|
||||||
<h4>Return Values</h4>
|
<h4>Return Values</h4>
|
||||||
<dl class="ret">
|
<p>
|
||||||
<dt>FR_OK (0)</dt>
|
<a href="rc.html#ok">FR_OK</a>,
|
||||||
<dd>The function succeeded.</dd>
|
<a href="rc.html#id">FR_INVALID_DRIVE</a>
|
||||||
<dt>FR_INVALID_DRIVE</dt>
|
</p>
|
||||||
<dd>The drive number is invalid.</dd>
|
|
||||||
</dl>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para desc">
|
||||||
<h4>Description</h4>
|
<h4>Description</h4>
|
||||||
<p>The f_chdrive function changes the current drive. The initial value of the current drive number is 0. Note that the current drive is retained in a static variable so that it also affects other tasks that using the file functions.</p>
|
<p>The f_chdrive function changes the current drive. The initial value of the current drive number is 0. Note that the current drive is retained in a static variable so that it also affects other tasks that using the file functions.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para comp">
|
||||||
<h4>QuickInfo</h4>
|
<h4>QuickInfo</h4>
|
||||||
<p>Available when <tt>_FS_RPATH >= 1</tt>.</p>
|
<p>Available when <tt>_FS_RPATH >= 1</tt>.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para ref">
|
||||||
<h4>See Also</h4>
|
<h4>See Also</h4>
|
||||||
<p><tt><a href="chdir.html">f_chdir</a>, <a href="getcwd.html">f_getcwd</a></tt></p>
|
<p><tt><a href="chdir.html">f_chdir</a>, <a href="getcwd.html">f_getcwd</a></tt></p>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -11,19 +11,19 @@
|
|||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para func">
|
||||||
<h2>f_chmod</h2>
|
<h2>f_chmod</h2>
|
||||||
<p>The f_chmod function changes the attribute of a file or directory.</p>
|
<p>The f_chmod function changes the attribute of a file or directory.</p>
|
||||||
<pre>
|
<pre>
|
||||||
FRESULT f_chmod (
|
FRESULT f_chmod (
|
||||||
const TCHAR* <em>FileName</em>, <span>/* Pointer to the file or directory */</span>
|
const TCHAR* <em>FileName</em>, <span class="c">/* Pointer to the file or directory */</span>
|
||||||
BYTE <em>Attribute</em>, <span>/* Attribute flags */</span>
|
BYTE <em>Attribute</em>, <span class="c">/* Attribute flags */</span>
|
||||||
BYTE <em>AttributeMask</em> <span>/* Attribute masks */</span>
|
BYTE <em>AttributeMask</em> <span class="c">/* Attribute masks */</span>
|
||||||
);
|
);
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para arg">
|
||||||
<h4>Parameters</h4>
|
<h4>Parameters</h4>
|
||||||
<dl class="par">
|
<dl class="par">
|
||||||
<dt>FileName</dt>
|
<dt>FileName</dt>
|
||||||
@ -44,51 +44,42 @@ FRESULT f_chmod (
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para ret">
|
||||||
<h4>Return Values</h4>
|
<h4>Return Values</h4>
|
||||||
<dl class="ret">
|
<p>
|
||||||
<dt>FR_OK (0)</dt>
|
<a href="rc.html#ok">FR_OK</a>,
|
||||||
<dd>The function succeeded.</dd>
|
<a href="rc.html#de">FR_DISK_ERR</a>,
|
||||||
<dt>FR_NO_FILE</dt>
|
<a href="rc.html#ie">FR_INT_ERR</a>,
|
||||||
<dd>Could not find the file.</dd>
|
<a href="rc.html#nr">FR_NOT_READY</a>,
|
||||||
<dt>FR_NO_PATH</dt>
|
<a href="rc.html#ok">FR_NO_FILE</a>,
|
||||||
<dd>Could not find the path.</dd>
|
<a href="rc.html#np">FR_NO_PATH</a>,
|
||||||
<dt>FR_INVALID_NAME</dt>
|
<a href="rc.html#in">FR_INVALID_NAME</a>,
|
||||||
<dd>The file name is invalid.</dd>
|
<a href="rc.html#wp">FR_WRITE_PROTECTED</a>,
|
||||||
<dt>FR_INVALID_DRIVE</dt>
|
<a href="rc.html#id">FR_INVALID_DRIVE</a>,
|
||||||
<dd>The drive number is invalid.</dd>
|
<a href="rc.html#ne">FR_NOT_ENABLED</a>,
|
||||||
<dt>FR_NOT_READY</dt>
|
<a href="rc.html#ns">FR_NO_FILESYSTEM</a>,
|
||||||
<dd>The disk drive cannot work due to no medium in the drive or any other reason.</dd>
|
<a href="rc.html#tm">FR_TIMEOUT</a>,
|
||||||
<dt>FR_WRITE_PROTECTED</dt>
|
<a href="rc.html#nc">FR_NOT_ENOUGH_CORE</a>
|
||||||
<dd>The medium is write protected.</dd>
|
</p>
|
||||||
<dt>FR_DISK_ERR</dt>
|
|
||||||
<dd>The function failed due to an error in the disk function.</dd>
|
|
||||||
<dt>FR_INT_ERR</dt>
|
|
||||||
<dd>The function failed due to a wrong FAT structure or an internal error.</dd>
|
|
||||||
<dt>FR_NOT_ENABLED</dt>
|
|
||||||
<dd>The logical drive has no work area.</dd>
|
|
||||||
<dt>FR_NO_FILESYSTEM</dt>
|
|
||||||
<dd>There is no valid FAT volume on the drive.</dd>
|
|
||||||
</dl>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para desc">
|
||||||
<h4>Description</h4>
|
<h4>Description</h4>
|
||||||
<p>The f_chmod function changes the attribute of a file or directory.</p>
|
<p>The f_chmod function changes the attribute of a file or directory.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para comp">
|
||||||
<h4>QuickInfo</h4>
|
<h4>QuickInfo</h4>
|
||||||
<p>Available when <tt>_FS_READONLY == 0</tt> and <tt>_FS_MINIMIZE == 0</tt>.</p>
|
<p>Available when <tt>_FS_READONLY == 0</tt> and <tt>_FS_MINIMIZE == 0</tt>.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para use">
|
||||||
<h4>Example</h4>
|
<h4>Example</h4>
|
||||||
<pre>
|
<pre>
|
||||||
<span>/* Set read-only flag, clear archive flag and others are retained. */</span>
|
<span class="c">/* Set read-only flag, clear archive flag and others are retained. */</span>
|
||||||
f_chmod("file.txt", AR_RDO, AR_RDO | AR_ARC);
|
f_chmod("file.txt", AR_RDO, AR_RDO | AR_ARC);
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -11,17 +11,17 @@
|
|||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para func">
|
||||||
<h2>f_close</h2>
|
<h2>f_close</h2>
|
||||||
<p>The f_close function closes an open file.</p>
|
<p>The f_close function closes an open file.</p>
|
||||||
<pre>
|
<pre>
|
||||||
FRESULT f_close (
|
FRESULT f_close (
|
||||||
FIL* <em>FileObject</em> <span>/* Pointer to the file object structure */</span>
|
FIL* <em>FileObject</em> <span class="c">/* Pointer to the file object structure */</span>
|
||||||
);
|
);
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para arg">
|
||||||
<h4>Parameter</h4>
|
<h4>Parameter</h4>
|
||||||
<dl class="par">
|
<dl class="par">
|
||||||
<dt>FileObject</dt>
|
<dt>FileObject</dt>
|
||||||
@ -30,36 +30,32 @@ FRESULT f_close (
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para ret">
|
||||||
<h4>Return Values</h4>
|
<h4>Return Values</h4>
|
||||||
<dl class="ret">
|
<p>
|
||||||
<dt>FR_OK (0)</dt>
|
<a href="rc.html#ok">FR_OK</a>,
|
||||||
<dd>The file object has been closed successfuly.</dd>
|
<a href="rc.html#de">FR_DISK_ERR</a>,
|
||||||
<dt>FR_DISK_ERR</dt>
|
<a href="rc.html#ie">FR_INT_ERR</a>,
|
||||||
<dd>The function failed due to an error in the disk function.</dd>
|
<a href="rc.html#nr">FR_NOT_READY</a>,
|
||||||
<dt>FR_INT_ERR</dt>
|
<a href="rc.html#io">FR_INVALID_OBJECT</a>,
|
||||||
<dd>The function failed due to a wrong FAT structure or an internal error.</dd>
|
<a href="rc.html#tm">FR_TIMEOUT</a>
|
||||||
<dt>FR_NOT_READY</dt>
|
</p>
|
||||||
<dd>The disk drive cannot work due to no medium in the drive or any other reason.</dd>
|
|
||||||
<dt>FR_INVALID_OBJECT</dt>
|
|
||||||
<dd>The file object is invalid.</dd>
|
|
||||||
</dl>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para desc">
|
||||||
<h4>Description</h4>
|
<h4>Description</h4>
|
||||||
<p>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.</p>
|
<p>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.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para comp">
|
||||||
<h4>QuickInfo</h4>
|
<h4>QuickInfo</h4>
|
||||||
<p>Always available.</p>
|
<p>Always available.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para ref">
|
||||||
<h4>See Also</h4>
|
<h4>See Also</h4>
|
||||||
<p><tt><a href="open.html">f_open</a>, <a href="read.html">f_read</a>, <a href="write.html">f_write</a>, <a href="sync.html">f_sync</a>, <a href="sfile.html">FIL</a>, <a href="sfatfs.html">FATFS</a></tt></p>
|
<p><tt><a href="open.html">f_open</a>, <a href="read.html">f_read</a>, <a href="write.html">f_write</a>, <a href="sync.html">f_sync</a>, <a href="sfile.html">FIL</a>, <a href="sfatfs.html">FATFS</a></tt></p>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -11,17 +11,17 @@
|
|||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para func">
|
||||||
<h2>disk_initialize</h2>
|
<h2>disk_initialize</h2>
|
||||||
<p>The disk_initialize function initializes the disk drive.</p>
|
<p>The disk_initialize function initializes the disk drive.</p>
|
||||||
<pre>
|
<pre>
|
||||||
DSTATUS disk_initialize (
|
DSTATUS disk_initialize (
|
||||||
BYTE <em>Drive</em> <span>/* Physical drive number */</span>
|
BYTE <em>Drive</em> <span class="c">/* Physical drive number */</span>
|
||||||
);
|
);
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para arg">
|
||||||
<h4>Parameter</h4>
|
<h4>Parameter</h4>
|
||||||
<dl class="par">
|
<dl class="par">
|
||||||
<dt>Drive</dt>
|
<dt>Drive</dt>
|
||||||
@ -30,12 +30,12 @@ DSTATUS disk_initialize (
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para ret">
|
||||||
<h4>Return Values</h4>
|
<h4>Return Values</h4>
|
||||||
<p>This function returns a disk status as the result. For details of the disk status, refer to the <a href="dstat.html">disk_status</a> function.</p>
|
<p>This function returns a disk status as the result. For details of the disk status, refer to the <a href="dstat.html">disk_status</a> function.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para desc">
|
||||||
<h4>Description</h4>
|
<h4>Description</h4>
|
||||||
<p>The disk_initialize function initializes a physical drive and put it ready to read/write. When the function succeeded, <tt>STA_NOINIT</tt> flag in the return value is cleard.</p>
|
<p>The disk_initialize function initializes a physical drive and put it ready to read/write. When the function succeeded, <tt>STA_NOINIT</tt> flag in the return value is cleard.</p>
|
||||||
<p><em>Application program should not call this function, or FAT structure on the volume can be collapted. To re-initialize the file system, use f_mount function.</em>This function is called on volume mount process in the FatFs module to manage the media change.</p>
|
<p><em>Application program should not call this function, or FAT structure on the volume can be collapted. To re-initialize the file system, use f_mount function.</em>This function is called on volume mount process in the FatFs module to manage the media change.</p>
|
||||||
|
|||||||
@ -11,19 +11,19 @@
|
|||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para func">
|
||||||
<h2>disk_ioctl</h2>
|
<h2>disk_ioctl</h2>
|
||||||
<p>The disk_ioctl function cntrols device specified features and miscellaneous functions other than disk read/write.</p>
|
<p>The disk_ioctl function cntrols device specified features and miscellaneous functions other than disk read/write.</p>
|
||||||
<pre>
|
<pre>
|
||||||
DRESULT disk_ioctl (
|
DRESULT disk_ioctl (
|
||||||
BYTE <em>Drive</em>, <span>/* Drive number */</span>
|
BYTE <em>Drive</em>, <span class="c">/* Drive number */</span>
|
||||||
BYTE <em>Command</em>, <span>/* Control command code */</span>
|
BYTE <em>Command</em>, <span class="c">/* Control command code */</span>
|
||||||
void* <em>Buffer</em> <span>/* Parameter and data buffer */</span>
|
void* <em>Buffer</em> <span class="c">/* Parameter and data buffer */</span>
|
||||||
);
|
);
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para arg">
|
||||||
<h4>Parameters</h4>
|
<h4>Parameters</h4>
|
||||||
<dl class="par">
|
<dl class="par">
|
||||||
<dt>Drive</dt>
|
<dt>Drive</dt>
|
||||||
@ -36,7 +36,7 @@ DRESULT disk_ioctl (
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para ret">
|
||||||
<h4>Return Value</h4>
|
<h4>Return Value</h4>
|
||||||
<dl class="ret">
|
<dl class="ret">
|
||||||
<dt>RES_OK (0)</dt>
|
<dt>RES_OK (0)</dt>
|
||||||
@ -51,7 +51,7 @@ DRESULT disk_ioctl (
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para desc">
|
||||||
<h4>Description</h4>
|
<h4>Description</h4>
|
||||||
<p>The FatFs module uses only device independent commands described below. Any device dependent function is not used.</p>
|
<p>The FatFs module uses only device independent commands described below. Any device dependent function is not used.</p>
|
||||||
<table class="lst">
|
<table class="lst">
|
||||||
|
|||||||
@ -11,20 +11,20 @@
|
|||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para func">
|
||||||
<h2>disk_read</h2>
|
<h2>disk_read</h2>
|
||||||
<p>The disk_read function reads sector(s) from the disk drive.</p>
|
<p>The disk_read function reads sector(s) from the disk drive.</p>
|
||||||
<pre>
|
<pre>
|
||||||
DRESULT disk_read (
|
DRESULT disk_read (
|
||||||
BYTE <em>Drive</em>, <span>/* Physical drive number */</span>
|
BYTE <em>Drive</em>, <span class="c">/* Physical drive number */</span>
|
||||||
BYTE* <em>Buffer</em>, <span>/* Pointer to the read data buffer */</span>
|
BYTE* <em>Buffer</em>, <span class="c">/* Pointer to the read data buffer */</span>
|
||||||
DWORD <em>SectorNumber</em>, <span>/* Start sector number */</span>
|
DWORD <em>SectorNumber</em>, <span class="c">/* Start sector number */</span>
|
||||||
BYTE <em>SectorCount</em> <span>/* Number of sectros to read */</span>
|
BYTE <em>SectorCount</em> <span class="c">/* Number of sectros to read */</span>
|
||||||
);
|
);
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para arg">
|
||||||
<h4>Parameters</h4>
|
<h4>Parameters</h4>
|
||||||
<dl class="par">
|
<dl class="par">
|
||||||
<dt>Drive</dt>
|
<dt>Drive</dt>
|
||||||
@ -39,7 +39,7 @@ DRESULT disk_read (
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para ret">
|
||||||
<h4>Return Value</h4>
|
<h4>Return Value</h4>
|
||||||
<dl class="ret">
|
<dl class="ret">
|
||||||
<dt>RES_OK (0)</dt>
|
<dt>RES_OK (0)</dt>
|
||||||
|
|||||||
@ -11,17 +11,17 @@
|
|||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para func">
|
||||||
<h2>disk_status</h2>
|
<h2>disk_status</h2>
|
||||||
<p>The disk_status function returns the current disk status.</p>
|
<p>The disk_status function returns the current disk status.</p>
|
||||||
<pre>
|
<pre>
|
||||||
DSTATUS disk_status (
|
DSTATUS disk_status (
|
||||||
BYTE <em>Drive</em> <span>/* Physical drive number */</span>
|
BYTE <em>Drive</em> <span class="c">/* Physical drive number */</span>
|
||||||
);
|
);
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para arg">
|
||||||
<h4>Parameter</h4>
|
<h4>Parameter</h4>
|
||||||
<dl class="par">
|
<dl class="par">
|
||||||
<dt>Drive</dt>
|
<dt>Drive</dt>
|
||||||
@ -30,7 +30,7 @@ DSTATUS disk_status (
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para ret">
|
||||||
<h4>Return Values</h4>
|
<h4>Return Values</h4>
|
||||||
<p>The disk status is returned in combination of following flags. FatFs refers only <tt>STA_NOINIT</tt> and <tt>STA_PROTECTED</tt>.</p>
|
<p>The disk status is returned in combination of following flags. FatFs refers only <tt>STA_NOINIT</tt> and <tt>STA_PROTECTED</tt>.</p>
|
||||||
<dl class="ret">
|
<dl class="ret">
|
||||||
|
|||||||
@ -11,20 +11,20 @@
|
|||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para func">
|
||||||
<h2>disk_write</h2>
|
<h2>disk_write</h2>
|
||||||
<p>The disk_write writes sector(s) to the disk.</p>
|
<p>The disk_write writes sector(s) to the disk.</p>
|
||||||
<pre>
|
<pre>
|
||||||
DRESULT disk_write (
|
DRESULT disk_write (
|
||||||
BYTE <em>Drive</em>, <span>/* Physical drive number */</span>
|
BYTE <em>Drive</em>, <span class="c">/* Physical drive number */</span>
|
||||||
const BYTE* <em>Buffer</em>, <span>/* Pointer to the write data (may be non aligned) */</span>
|
const BYTE* <em>Buffer</em>, <span class="c">/* Pointer to the write data (may be non aligned) */</span>
|
||||||
DWORD <em>SectorNumber</em>, <span>/* Sector number to write */</span>
|
DWORD <em>SectorNumber</em>, <span class="c">/* Sector number to write */</span>
|
||||||
BYTE <em>SectorCount</em> <span>/* Number of sectors to write */</span>
|
BYTE <em>SectorCount</em> <span class="c">/* Number of sectors to write */</span>
|
||||||
);
|
);
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para arg">
|
||||||
<h4>Parameters</h4>
|
<h4>Parameters</h4>
|
||||||
<dl class="par">
|
<dl class="par">
|
||||||
<dt>Drive</dt>
|
<dt>Drive</dt>
|
||||||
@ -39,7 +39,7 @@ DRESULT disk_write (
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para ret">
|
||||||
<h4>Return Values</h4>
|
<h4>Return Values</h4>
|
||||||
<dl class="ret">
|
<dl class="ret">
|
||||||
<dt>RES_OK (0)</dt>
|
<dt>RES_OK (0)</dt>
|
||||||
@ -56,7 +56,7 @@ DRESULT disk_write (
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para desc">
|
||||||
<h4>Description</h4>
|
<h4>Description</h4>
|
||||||
<p>This function is not required in read only configuration.</p>
|
<p>This function is not required in read only configuration.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
62
doc/en/eof.html
Normal file
62
doc/en/eof.html
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||||
|
<meta http-equiv="Content-Style-Type" content="text/css">
|
||||||
|
<link rel="up" title="FatFs" href="../00index_e.html">
|
||||||
|
<link rel="alternate" hreflang="ja" title="Japanese" href="../ja/eof.html">
|
||||||
|
<link rel="stylesheet" href="../css_e.css" type="text/css" media="screen" title="ELM Default">
|
||||||
|
<title>FatFs - f_eof</title>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<div class="para func">
|
||||||
|
<h2>f_eof</h2>
|
||||||
|
<p>The f_eof function tests for end-of-file on a file.</p>
|
||||||
|
<pre>
|
||||||
|
int f_eof (
|
||||||
|
FIL* <em>FileObject</em> <span class="c">/* File object */</span>
|
||||||
|
);
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="para arg">
|
||||||
|
<h4>Parameters</h4>
|
||||||
|
<dl class="par">
|
||||||
|
<dt>FileObject</dt>
|
||||||
|
<dd>Pointer to the open file object structure.</dd>
|
||||||
|
</dl>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="para ret">
|
||||||
|
<h4>Return Values</h4>
|
||||||
|
<p>The f_eof function returns a non-zero value if the read/write pointer has reached end of the file; otherwise it returns a zero.</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="para desc">
|
||||||
|
<h4>Description</h4>
|
||||||
|
<p>In this revision, the f_eof function is implemented as a macro.</p>
|
||||||
|
<pre>
|
||||||
|
<span class="k">#define</span> f_eof(fp) (((fp)->fptr) == ((fp)->fsize) ? 1 : 0)
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="para comp">
|
||||||
|
<h4>QuickInfo</h4>
|
||||||
|
<p>Always available.</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="para ref">
|
||||||
|
<h4>See Also</h4>
|
||||||
|
<p><tt><a href="open.html">f_open</a>, <a href="lseek.html">f_lseek</a>, <a href="sfile.html">FIL</a></tt></p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p class="foot"><a href="../00index_e.html">Return</a></p>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
62
doc/en/error.html
Normal file
62
doc/en/error.html
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||||
|
<meta http-equiv="Content-Style-Type" content="text/css">
|
||||||
|
<link rel="up" title="FatFs" href="../00index_e.html">
|
||||||
|
<link rel="alternate" hreflang="ja" title="Japanese" href="../ja/error.html">
|
||||||
|
<link rel="stylesheet" href="../css_e.css" type="text/css" media="screen" title="ELM Default">
|
||||||
|
<title>FatFs - f_error</title>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<div class="para func">
|
||||||
|
<h2>f_error</h2>
|
||||||
|
<p>The f_error tests for an error on a file.</p>
|
||||||
|
<pre>
|
||||||
|
int f_error (
|
||||||
|
FIL* <em>FileObject</em> <span class="c">/* File object */</span>
|
||||||
|
);
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="para arg">
|
||||||
|
<h4>Parameters</h4>
|
||||||
|
<dl class="par">
|
||||||
|
<dt>FileObject</dt>
|
||||||
|
<dd>Pointer to the open file object structure.</dd>
|
||||||
|
</dl>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="para ret">
|
||||||
|
<h4>Return Values</h4>
|
||||||
|
<p>Returns a non-zero value if an error has occured; otherwise it returns a zero.</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="para desc">
|
||||||
|
<h4>Description</h4>
|
||||||
|
<p>In this revision, the f_error function is implemented as a macro.</p>
|
||||||
|
<pre>
|
||||||
|
<span class="k">#define</span> f_error(fp) (((fp)->flag & FA__ERROR) ? 1 : 0)
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="para comp">
|
||||||
|
<h4>QuickInfo</h4>
|
||||||
|
<p>Always available.</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="para ref">
|
||||||
|
<h4>See Also</h4>
|
||||||
|
<p><tt><a href="open.html">f_open</a>, <a href="sfile.html">FIL</a></tt></p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p class="foot"><a href="../00index_e.html">Return</a></p>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para func">
|
||||||
<h2>get_fattime</h2>
|
<h2>get_fattime</h2>
|
||||||
<p>The get_fattime function gets current time.</p>
|
<p>The get_fattime function gets current time.</p>
|
||||||
<pre>
|
<pre>
|
||||||
@ -20,7 +20,7 @@ DWORD get_fattime (void);
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para ret">
|
||||||
<h4>Return Value</h4>
|
<h4>Return Value</h4>
|
||||||
<p>Currnet time is returned with packed into a DWORD value. The bit field is as follows:</p>
|
<p>Currnet time is returned with packed into a DWORD value. The bit field is as follows:</p>
|
||||||
<dl class="ret">
|
<dl class="ret">
|
||||||
@ -40,7 +40,7 @@ DWORD get_fattime (void);
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para desc">
|
||||||
<h4>Description</h4>
|
<h4>Description</h4>
|
||||||
<p>The get_fattime function must return any valid time even if the system does not support a real time clock. If a zero is returned, the file will not have a valid time. This fucntion is not required in read only configuration.</p>
|
<p>The get_fattime function must return any valid time even if the system does not support a real time clock. If a zero is returned, the file will not have a valid time. This fucntion is not required in read only configuration.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -10,12 +10,13 @@
|
|||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
<h1>Path Names</h1>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para">
|
||||||
<h3>Format of the path names</h3>
|
<h3>Format of the path names</h3>
|
||||||
<p>The path name format on the FatFs module is similer to the filename specs of DOS/Windos as follows:</p>
|
<p>The path name format on the FatFs module is similer to the filename specs of DOS/Windos as follows:</p>
|
||||||
<p><tt>"[drive#:][/]directory/file"</tt></p>
|
<p><tt>"[drive#:][/]directory/file"</tt></p>
|
||||||
<p>The FatFs module supports long file name (LFN) and 8.3 format file name (SFN). The LFN can be used when LFN feature is enabled <tt>(_USE_LFN > 0)</tt>. The sub directories are separated with a \ or / in the same way as DOS/Windows API. Only a difference is that the logical drive is specified in a numeral with a colon. When the drive number is omitted, it is assumed as default drive (0 or current drive).</p>
|
<p>The FatFs module supports long file name (LFN) and 8.3 format file name (SFN). The LFN can be used when LFN feature is enabled <tt>(_USE_LFN > 0)</tt>. The sub directories are separated with a \ or / in the same way as DOS/Windows API. Duplicated separators are skipped and ignored. Only a difference is that the logical drive is specified in a numeral with a colon. When the drive number is omitted, it is assumed as default drive (0 or current drive).</p>
|
||||||
<p>Control characters (\0 to \x1F) are recognized as end of the path name. Leading/embedded spaces in the path name are valid as a part of the name on LFN configuration but they are recognized as end of the path name on non-LFN configuration. Trailing spaces and dots are ignored.</p>
|
<p>Control characters (\0 to \x1F) are recognized as end of the path name. Leading/embedded spaces in the path name are valid as a part of the name on LFN configuration but they are recognized as end of the path name on non-LFN configuration. Trailing spaces and dots are ignored.</p>
|
||||||
<p>In default configuration <tt>(_FS_RPATH == 0)</tt>, it does not have a concept of current directory like OS oriented file system. All objects on the volume are always specified in full path name that follows from the root directory. Dot directory names are not allowed. Heading separator is ignored and it can be exist or omitted. The default drive number is fixed to 0.</p>
|
<p>In default configuration <tt>(_FS_RPATH == 0)</tt>, it does not have a concept of current directory like OS oriented file system. All objects on the volume are always specified in full path name that follows from the root directory. Dot directory names are not allowed. Heading separator is ignored and it can be exist or omitted. The default drive number is fixed to 0.</p>
|
||||||
<p>When relative path feature is enabled <tt>(_FS_RPATH == 1)</tt>, specified path is followed from the root directory if a heading separator is exist. If not, it is followed from the current directory set with <a href="chdir.html">f_chdir</a> function. Dot names are also allowed for the path name. The default drive is the current drive set with <a href="chdrive.html">f_chdrive</a> function.</p>
|
<p>When relative path feature is enabled <tt>(_FS_RPATH == 1)</tt>, specified path is followed from the root directory if a heading separator is exist. If not, it is followed from the current directory set with <a href="chdir.html">f_chdir</a> function. Dot names are also allowed for the path name. The default drive is the current drive set with <a href="chdrive.html">f_chdrive</a> function.</p>
|
||||||
@ -41,9 +42,9 @@
|
|||||||
<h3>Unicode API</h3>
|
<h3>Unicode API</h3>
|
||||||
<p>The path names are input/output in either ANSI/OEM code (SBCS/DBCS) or Unicode depends on the configuration options. The type of arguments that specifies the file names are defined as <tt>TCHAR</tt> which is an alias of <tt>char</tt> in default. The code set of the file name string is the ANSI/OEM code set specifid by <tt>_CODE_PAGE</tt>. When <tt>_LFN_UNICODE</tt> is set to 1 under LFN configuration, the type of the <tt>TCHAR</tt> is switched to <tt>unsigned short</tt> (UCS-2 character) to support Unicode. In this case, the LFN feature is fully supported and the Unicode specific characters, such as ✝☪✡☸☭, can also be used for the path name. It also affects data types and encoding of the string I/O functions. To define literal strings, <tt>_T(s)</tt> and <tt>_TEXT(s)</tt> macro are available to select either ANSI/OEM or Unicode automatically. The code shown below is an example to define the literal strings.</p>
|
<p>The path names are input/output in either ANSI/OEM code (SBCS/DBCS) or Unicode depends on the configuration options. The type of arguments that specifies the file names are defined as <tt>TCHAR</tt> which is an alias of <tt>char</tt> in default. The code set of the file name string is the ANSI/OEM code set specifid by <tt>_CODE_PAGE</tt>. When <tt>_LFN_UNICODE</tt> is set to 1 under LFN configuration, the type of the <tt>TCHAR</tt> is switched to <tt>unsigned short</tt> (UCS-2 character) to support Unicode. In this case, the LFN feature is fully supported and the Unicode specific characters, such as ✝☪✡☸☭, can also be used for the path name. It also affects data types and encoding of the string I/O functions. To define literal strings, <tt>_T(s)</tt> and <tt>_TEXT(s)</tt> macro are available to select either ANSI/OEM or Unicode automatically. The code shown below is an example to define the literal strings.</p>
|
||||||
<pre>
|
<pre>
|
||||||
f_open(fp, "filename.txt", FA_READ); <span>/* ANSI/OEM only */</span>
|
f_open(fp, "filename.txt", FA_READ); <span class="c">/* ANSI/OEM only */</span>
|
||||||
f_open(fp, L"filename.txt", FA_READ); <span>/* Unicode only */</span>
|
f_open(fp, L"filename.txt", FA_READ); <span class="c">/* Unicode only */</span>
|
||||||
f_open(fp, _T("filename.txt"), FA_READ); <span>/* Changed automatically */</span>
|
f_open(fp, _T("filename.txt"), FA_READ); <span class="c">/* Changed automatically */</span>
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -56,10 +57,10 @@ Example: Logical drive 0-2 are assigned to three pri-partitions on the physical
|
|||||||
Logical drive 3 is assigned to physical drive 1 (removable disk)
|
Logical drive 3 is assigned to physical drive 1 (removable disk)
|
||||||
|
|
||||||
const PARTITION Drives[] = {
|
const PARTITION Drives[] = {
|
||||||
{0, 0}, <span>/* Logical drive 0 ==> Physical drive 0, 1st partition */</span>
|
{0, 0}, <span class="c">/* Logical drive 0 ==> Physical drive 0, 1st partition */</span>
|
||||||
{0, 1}, <span>/* Logical drive 1 ==> Physical drive 0, 2nd partition */</span>
|
{0, 1}, <span class="c">/* Logical drive 1 ==> Physical drive 0, 2nd partition */</span>
|
||||||
{0, 2}, <span>/* Logical drive 2 ==> Physical drive 0, 3rd partition */</span>
|
{0, 2}, <span class="c">/* Logical drive 2 ==> Physical drive 0, 3rd partition */</span>
|
||||||
{1, 0} <span>/* Logical drive 3 ==> Physical drive 1 */</span>
|
{1, 0} <span class="c">/* Logical drive 3 ==> Physical drive 1 */</span>
|
||||||
};
|
};
|
||||||
</pre>
|
</pre>
|
||||||
<p>There are some considerations when use <tt>_MULTI_PARTITION</tt> configuration.</p>
|
<p>There are some considerations when use <tt>_MULTI_PARTITION</tt> configuration.</p>
|
||||||
|
|||||||
@ -11,20 +11,20 @@
|
|||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para func">
|
||||||
<h2>f_forward</h2>
|
<h2>f_forward</h2>
|
||||||
<p>The f_forward function reads the file data and forward it to the data streaming device.</p>
|
<p>The f_forward function reads the file data and forward it to the data streaming device.</p>
|
||||||
<pre>
|
<pre>
|
||||||
FRESULT f_forward (
|
FRESULT f_forward (
|
||||||
FIL* <em>FileObject</em>, <span>/* File object */</span>
|
FIL* <em>FileObject</em>, <span class="c">/* File object */</span>
|
||||||
UINT (*<em>Func</em>)(const BYTE*,UINT), <span>/* Data streaming function */</span>
|
UINT (*<em>Func</em>)(const BYTE*,UINT), <span class="c">/* Data streaming function */</span>
|
||||||
UINT <em>ByteToFwd</em>, <span>/* Number of bytes to forward */</span>
|
UINT <em>ByteToFwd</em>, <span class="c">/* Number of bytes to forward */</span>
|
||||||
UINT* <em>ByteFwd</em> <span>/* Number of bytes forwarded */</span>
|
UINT* <em>ByteFwd</em> <span class="c">/* Number of bytes forwarded */</span>
|
||||||
);
|
);
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para arg">
|
||||||
<h4>Parameters</h4>
|
<h4>Parameters</h4>
|
||||||
<dl class="par">
|
<dl class="par">
|
||||||
<dt>FileObject</dt>
|
<dt>FileObject</dt>
|
||||||
@ -39,60 +39,54 @@ FRESULT f_forward (
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para ret">
|
||||||
<h4>Return Values</h4>
|
<h4>Return Values</h4>
|
||||||
<dl class="ret">
|
<p>
|
||||||
<dt>FR_OK (0)</dt>
|
<a href="rc.html#ok">FR_OK</a>,
|
||||||
<dd>The function succeeded.</dd>
|
<a href="rc.html#de">FR_DISK_ERR</a>,
|
||||||
<dt>FR_DENIED</dt>
|
<a href="rc.html#ie">FR_INT_ERR</a>,
|
||||||
<dd>The function denied due to the file has been opened in non-read mode.</dd>
|
<a href="rc.html#nr">FR_NOT_READY</a>,
|
||||||
<dt>FR_DISK_ERR</dt>
|
<a href="rc.html#io">FR_INVALID_OBJECT</a>,
|
||||||
<dd>The function failed due to an error in the disk function.</dd>
|
<a href="rc.html#tm">FR_TIMEOUT</a>
|
||||||
<dt>FR_INT_ERR</dt>
|
</p>
|
||||||
<dd>The function failed due to a wrong FAT structure or an internal error.</dd>
|
|
||||||
<dt>FR_NOT_READY</dt>
|
|
||||||
<dd>The disk drive cannot work due to no medium in the drive or any other reason.</dd>
|
|
||||||
<dt>FR_INVALID_OBJECT</dt>
|
|
||||||
<dd>The file object is invalid.</dd>
|
|
||||||
</dl>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para desc">
|
||||||
<h4>Description</h4>
|
<h4>Description</h4>
|
||||||
<p>The f_forward function reads the data from the file and forward it to the outgoing stream without data buffer. This is suitable for small memory system because it does not require any data buffer at application module. The file pointer of the file object increases in number of bytes forwarded. In case of <tt>*ByteFwd < ByteToFwd</tt> without error, it means the requested bytes could not be transferred due to end of file or stream goes busy during data transfer.</p>
|
<p>The f_forward function reads the data from the file and forward it to the outgoing stream without data buffer. This is suitable for small memory system because it does not require any data buffer at application module. The file pointer of the file object increases in number of bytes forwarded. In case of <tt>*ByteFwd < ByteToFwd</tt> without error, it means the requested bytes could not be transferred due to end of file or stream goes busy during data transfer.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para comp">
|
||||||
<h4>QuickInfo</h4>
|
<h4>QuickInfo</h4>
|
||||||
<p>Available when <tt>_USE_FORWARD == 1</tt> and <tt>_FS_TINY == 1</tt>.</p>
|
<p>Available when <tt>_USE_FORWARD == 1</tt> and <tt>_FS_TINY == 1</tt>.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para use">
|
||||||
<h4>Example (Audio playback)</h4>
|
<h4>Example (Audio playback)</h4>
|
||||||
<pre>
|
<pre>
|
||||||
<span>/*------------------------------------------------------------------------*/</span>
|
<span class="c">/*------------------------------------------------------------------------*/</span>
|
||||||
<span>/* Sample code of data transfer function to be called back from f_forward */</span>
|
<span class="c">/* Sample code of data transfer function to be called back from f_forward */</span>
|
||||||
<span>/*------------------------------------------------------------------------*/</span>
|
<span class="c">/*------------------------------------------------------------------------*/</span>
|
||||||
|
|
||||||
UINT out_stream ( <span>/* Returns number of bytes sent or stream status */</span>
|
UINT out_stream ( <span class="c">/* Returns number of bytes sent or stream status */</span>
|
||||||
const BYTE *p, <span>/* Pointer to the data block to be sent */</span>
|
const BYTE *p, <span class="c">/* Pointer to the data block to be sent */</span>
|
||||||
UINT btf <span>/* >0: Transfer call (Number of bytes to be sent). 0: Sense call */</span>
|
UINT btf <span class="c">/* >0: Transfer call (Number of bytes to be sent). 0: Sense call */</span>
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
UINT cnt = 0;
|
UINT cnt = 0;
|
||||||
|
|
||||||
|
|
||||||
if (btf == 0) { <span>/* Sense call */</span>
|
if (btf == 0) { <span class="c">/* Sense call */</span>
|
||||||
<span>/* Return stream status (0: Busy, 1: Ready) */</span>
|
<span class="c">/* Return stream status (0: Busy, 1: Ready) */</span>
|
||||||
<span>/* When once it returned ready to sense call, it must accept a byte at least */</span>
|
<span class="c">/* When once it returned ready to sense call, it must accept a byte at least */</span>
|
||||||
<span>/* at subsequent transfer call, or f_forward will fail with FR_INT_ERROR. */</span>
|
<span class="c">/* at subsequent transfer call, or f_forward will fail with FR_INT_ERR. */</span>
|
||||||
if (FIFO_READY) cnt = 1;
|
if (FIFO_READY) cnt = 1;
|
||||||
}
|
}
|
||||||
else { <span>/* Transfer call */</span>
|
else { <span class="c">/* Transfer call */</span>
|
||||||
do { <span>/* Repeat while there is any data to be sent and the stream is ready */</span>
|
do { <span class="c">/* Repeat while there is any data to be sent and the stream is ready */</span>
|
||||||
FIFO_PORT = *p++;
|
FIFO_PORT = *p++;
|
||||||
cnt++;
|
cnt++;
|
||||||
} while (cnt < btf && FIFO_READY);
|
} while (cnt < btf && FIFO_READY);
|
||||||
@ -102,32 +96,32 @@ UINT out_stream ( <span>/* Returns number of bytes sent or stream status */</s
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
<span>/*------------------------------------------------------------------------*/</span>
|
<span class="c">/*------------------------------------------------------------------------*/</span>
|
||||||
<span>/* Sample code using f_forward function */</span>
|
<span class="c">/* Sample code using f_forward function */</span>
|
||||||
<span>/*------------------------------------------------------------------------*/</span>
|
<span class="c">/*------------------------------------------------------------------------*/</span>
|
||||||
|
|
||||||
FRESULT play_file (
|
FRESULT play_file (
|
||||||
char *fn <span>/* Pointer to the audio file name to be played */</span>
|
char *fn <span class="c">/* Pointer to the audio file name to be played */</span>
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
FRESULT rc;
|
FRESULT rc;
|
||||||
FIL fil;
|
FIL fil;
|
||||||
UINT dmy;
|
UINT dmy;
|
||||||
|
|
||||||
<span>/* Open the audio file in read only mode */</span>
|
<span class="c">/* Open the audio file in read only mode */</span>
|
||||||
rc = f_open(&fil, fn, FA_READ);
|
rc = f_open(&fil, fn, FA_READ);
|
||||||
if (rc) return rc;
|
if (rc) return rc;
|
||||||
|
|
||||||
<span>/* Repeat until the file pointer reaches end of the file */</span>
|
<span class="c">/* Repeat until the file pointer reaches end of the file */</span>
|
||||||
while (rc == FR_OK && fil.fptr < fil.fsize) {
|
while (rc == FR_OK && fil.fptr < fil.fsize) {
|
||||||
|
|
||||||
<span>/* any other processes... */</span>
|
<span class="c">/* any other processes... */</span>
|
||||||
|
|
||||||
<span>/* Fill output stream periodicaly or on-demand */</span>
|
<span class="c">/* Fill output stream periodicaly or on-demand */</span>
|
||||||
rc = f_forward(&fil, out_stream, 1000, &dmy);
|
rc = f_forward(&fil, out_stream, 1000, &dmy);
|
||||||
}
|
}
|
||||||
|
|
||||||
<span>/* Close the file and return */</span>
|
<span class="c">/* Close the file and return */</span>
|
||||||
f_close(&fil);
|
f_close(&fil);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
@ -135,7 +129,7 @@ FRESULT play_file (
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para ref">
|
||||||
<h4>See Also</h4>
|
<h4>See Also</h4>
|
||||||
<p><tt><a href="open.html">f_open</a>, <a href="gets.html">fgets</a>, <a href="write.html">f_write</a>, <a href="close.html">f_close</a>, <a href="sfile.html">FIL</a></tt></p>
|
<p><tt><a href="open.html">f_open</a>, <a href="gets.html">fgets</a>, <a href="write.html">f_write</a>, <a href="close.html">f_close</a>, <a href="sfile.html">FIL</a></tt></p>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
70
doc/en/getcwd.html
Normal file
70
doc/en/getcwd.html
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||||
|
<meta http-equiv="Content-Style-Type" content="text/css">
|
||||||
|
<link rel="up" title="FatFs" href="../00index_e.html">
|
||||||
|
<link rel="alternate" hreflang="ja" title="Japanese" href="../ja/getcwd.html">
|
||||||
|
<link rel="stylesheet" href="../css_e.css" type="text/css" media="screen" title="ELM Default">
|
||||||
|
<title>FatFs - f_getcwd</title>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<div class="para func">
|
||||||
|
<h2>f_getcwd</h2>
|
||||||
|
<p>The f_getcwd function retrieves the current directory.</p>
|
||||||
|
<pre>
|
||||||
|
FRESULT f_getcwd (
|
||||||
|
TCHAR* <em>Buffer</em>, <span class="c">/* Pointer to the buffer */</span>
|
||||||
|
UINT <em>BufferLen</em> <span class="c">/* The length of the buffer */</span>
|
||||||
|
);
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="para arg">
|
||||||
|
<h4>Parameters</h4>
|
||||||
|
<dl class="par">
|
||||||
|
<dt>Buffer</dt>
|
||||||
|
<dd>Pointer to the buffer to receive the current directory string.</dd>
|
||||||
|
<dt>BufferLen</dt>
|
||||||
|
<dd>Size of the buffer in unit of TCHAR.</dd>
|
||||||
|
</dl>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="para ret">
|
||||||
|
<h4>Return Values</h4>
|
||||||
|
<p>
|
||||||
|
<a href="rc.html#ok">FR_OK</a>,
|
||||||
|
<a href="rc.html#de">FR_DISK_ERR</a>,
|
||||||
|
<a href="rc.html#ie">FR_INT_ERR</a>,
|
||||||
|
<a href="rc.html#nr">FR_NOT_READY</a>,
|
||||||
|
<a href="rc.html#ne">FR_NOT_ENABLED</a>,
|
||||||
|
<a href="rc.html#ns">FR_NO_FILESYSTEM</a>,
|
||||||
|
<a href="rc.html#tm">FR_TIMEOUT</a>,
|
||||||
|
<a href="rc.html#nc">FR_NOT_ENOUGH_CORE</a>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="para desc">
|
||||||
|
<h4>Description</h4>
|
||||||
|
<p>The f_getcwd function retrieves the current directory of the current drive in full path string including drive number.</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="para comp">
|
||||||
|
<h4>QuickInfo</h4>
|
||||||
|
<p>Available when <tt>_FS_RPATH == 2</tt>.</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="para ref">
|
||||||
|
<h4>See Also</h4>
|
||||||
|
<p><tt><a href="chdrive.html">f_chdrive</a>, <a href="chdir.html">f_chdir</a></tt></p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p class="foot"><a href="../00index_e.html">Return</a></p>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@ -11,19 +11,19 @@
|
|||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para func">
|
||||||
<h2>f_getfree</h2>
|
<h2>f_getfree</h2>
|
||||||
<p>The f_getfree function gets number of the free clusters.</p>
|
<p>The f_getfree function gets number of the free clusters.</p>
|
||||||
<pre>
|
<pre>
|
||||||
FRESULT f_getfree (
|
FRESULT f_getfree (
|
||||||
const TCHAR* <em>Path</em>, <span>/* Logical drive number */</span>
|
const TCHAR* <em>Path</em>, <span class="c">/* Logical drive number */</span>
|
||||||
DWORD* <em>Clusters</em>, <span>/* Pointer to the variable to store number of free clusters */</span>
|
DWORD* <em>Clusters</em>, <span class="c">/* Pointer to the variable to store number of free clusters */</span>
|
||||||
FATFS** <em>FileSystemObject</em> <span>/* Pointer to pointer to file system object */</span>
|
FATFS** <em>FileSystemObject</em> <span class="c">/* Pointer to pointer to file system object */</span>
|
||||||
);
|
);
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para arg">
|
||||||
<h4>Parameters</h4>
|
<h4>Parameters</h4>
|
||||||
<dl class="par">
|
<dl class="par">
|
||||||
<dt>Path</dt>
|
<dt>Path</dt>
|
||||||
@ -36,55 +36,49 @@ FRESULT f_getfree (
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para ret">
|
||||||
<h4>Return Values</h4>
|
<h4>Return Values</h4>
|
||||||
<dl class="ret">
|
<p>
|
||||||
<dt>FR_OK (0)</dt>
|
<a href="rc.html#ok">FR_OK</a>,
|
||||||
<dd>The function succeeded. The <tt><em>*Clusters</em></tt> has number of free clusters and <tt><em>*FileSystemObject</em></tt> points the file system object.</dd>
|
<a href="rc.html#de">FR_DISK_ERR</a>,
|
||||||
<dt>FR_INVALID_DRIVE</dt>
|
<a href="rc.html#ie">FR_INT_ERR</a>,
|
||||||
<dd>The drive number is invalid.</dd>
|
<a href="rc.html#nr">FR_NOT_READY</a>,
|
||||||
<dt>FR_NOT_READY</dt>
|
<a href="rc.html#id">FR_INVALID_DRIVE</a>,
|
||||||
<dd>The disk drive cannot work due to no medium in the drive or any other reason.</dd>
|
<a href="rc.html#ne">FR_NOT_ENABLED</a>,
|
||||||
<dt>FR_DISK_ERR</dt>
|
<a href="rc.html#ns">FR_NO_FILESYSTEM</a>,
|
||||||
<dd>The function failed due to an error in the disk function.</dd>
|
<a href="rc.html#tm">FR_TIMEOUT</a>
|
||||||
<dt>FR_INT_ERR</dt>
|
</p>
|
||||||
<dd>The function failed due to a wrong FAT structure or an internal error.</dd>
|
|
||||||
<dt>FR_NOT_ENABLED</dt>
|
|
||||||
<dd>The logical drive has no work area.</dd>
|
|
||||||
<dt>FR_NO_FILESYSTEM</dt>
|
|
||||||
<dd>There is no valid FAT partition on the drive.</dd>
|
|
||||||
</dl>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para desc">
|
||||||
<h4>Descriptions</h4>
|
<h4>Descriptions</h4>
|
||||||
<p>The f_getfree function gets number of free clusters on the drive. The member <tt>csize</tt> in the file system object is refrecting number of sectors per cluster, so that the free space in unit of sector can be calcurated with this. When FSInfo structure on FAT32 volume is not in sync, this function can return an incorrect free cluster count.</p>
|
<p>The f_getfree function gets number of free clusters on the drive. The member <tt>csize</tt> in the file system object is refrecting number of sectors per cluster, so that the free space in unit of sector can be calcurated with this. When FSInfo structure on FAT32 volume is not in sync, this function can return an incorrect free cluster count.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para comp">
|
||||||
<h4>QuickInfo</h4>
|
<h4>QuickInfo</h4>
|
||||||
<p>Available when <tt>_FS_READONLY == 0</tt> and <tt>_FS_MINIMIZE == 0</tt>.</p>
|
<p>Available when <tt>_FS_READONLY == 0</tt> and <tt>_FS_MINIMIZE == 0</tt>.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para use">
|
||||||
<h4>Example</h4>
|
<h4>Example</h4>
|
||||||
<pre>
|
<pre>
|
||||||
FATFS *fs;
|
FATFS *fs;
|
||||||
DWORD fre_clust, fre_sect, tot_sect;
|
DWORD fre_clust, fre_sect, tot_sect;
|
||||||
|
|
||||||
|
|
||||||
<span>/* Get volume information and free clusters of drive 1 */</span>
|
<span class="c">/* Get volume information and free clusters of drive 1 */</span>
|
||||||
res = f_getfree("1:", &fre_clust, &fs);
|
res = f_getfree("1:", &fre_clust, &fs);
|
||||||
if (res) die(res);
|
if (res) die(res);
|
||||||
|
|
||||||
<span>/* Get total sectors and free sectors */</span>
|
<span class="c">/* Get total sectors and free sectors */</span>
|
||||||
tot_sect = (fs->n_fatent - 2) * fs->csize;
|
tot_sect = (fs->n_fatent - 2) * fs->csize;
|
||||||
fre_sect = fre_clust * fs->csize;
|
fre_sect = fre_clust * fs->csize;
|
||||||
|
|
||||||
<span>/* Print free space in unit of KB (assuming 512 bytes/sector) */</span>
|
<span class="c">/* Print free space in unit of KB (assuming 512 bytes/sector) */</span>
|
||||||
printf("%lu KB total drive space.\n"
|
printf("%lu KB total drive space.\n"
|
||||||
"%lu KB available.\n",
|
"%lu KB available.\n",
|
||||||
fre_sect / 2, tot_sect / 2);
|
fre_sect / 2, tot_sect / 2);
|
||||||
@ -92,7 +86,7 @@ FRESULT f_getfree (
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para ref">
|
||||||
<h4>See Also</h4>
|
<h4>See Also</h4>
|
||||||
<p><tt><a href="sfatfs.html">FATFS</a></tt></p>
|
<p><tt><a href="sfatfs.html">FATFS</a></tt></p>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -11,19 +11,19 @@
|
|||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para func">
|
||||||
<h2>f_gets</h2>
|
<h2>f_gets</h2>
|
||||||
<p>The f_gets reads a string from the file.</p>
|
<p>The f_gets reads a string from the file.</p>
|
||||||
<pre>
|
<pre>
|
||||||
TCHAR* f_gets (
|
TCHAR* f_gets (
|
||||||
TCHAR* <em>Str</em>, <span>/* Read buffer */</span>
|
TCHAR* <em>Str</em>, <span class="c">/* Read buffer */</span>
|
||||||
int <em>Size</em>, <span>/* Size of the read buffer */</span>
|
int <em>Size</em>, <span class="c">/* Size of the read buffer */</span>
|
||||||
FIL* <em>FileObject</em> <span>/* File object */</span>
|
FIL* <em>FileObject</em> <span class="c">/* File object */</span>
|
||||||
);
|
);
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para arg">
|
||||||
<h4>Parameters</h4>
|
<h4>Parameters</h4>
|
||||||
<dl class="par">
|
<dl class="par">
|
||||||
<dt>Str</dt>
|
<dt>Str</dt>
|
||||||
@ -36,26 +36,26 @@ TCHAR* f_gets (
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para ret">
|
||||||
<h4>Return Values</h4>
|
<h4>Return Values</h4>
|
||||||
<p>When the function succeeded, <tt>Str</tt> will be returuned.</p>
|
<p>When the function succeeded, <tt>Str</tt> will be returuned.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para desc">
|
||||||
<h4>Description</h4>
|
<h4>Description</h4>
|
||||||
<p>The f_gets() is a wrapper function of <a href="read.html">f_read()</a>. The read operation continues until a <tt>'\n'</tt> is stored, reached end of the file or the buffer is filled with <tt>Size - 1</tt> characters. The read string is terminated with a <tt>'\0'</tt>. When no character to read or any error occured during read operation, f_gets() returns a null pointer. The end of file and error status can be examined with <tt>f_eof()</tt> and <tt>f_error()</tt> macros.</p>
|
<p>The f_gets() is a wrapper function of <a href="read.html">f_read()</a>. The read operation continues until a <tt>'\n'</tt> is stored, reached end of the file or the buffer is filled with <tt>Size - 1</tt> characters. The read string is terminated with a <tt>'\0'</tt>. When no character to read or any error occured during read operation, f_gets() returns a null pointer. The end of file and error status can be examined with <tt>f_eof()</tt> and <tt>f_error()</tt> macros.</p>
|
||||||
<p>When the FatFs is configured to Unicode API (<tt>_LFN_UNICODE == 1</tt>), the file is read in UTF-8 encoding and stored it to the buffer in UCS-2. If not the case, the file will be read in one byte per character without any code conversion.</p>
|
<p>When the FatFs is configured to Unicode API (<tt>_LFN_UNICODE == 1</tt>), the file is read in UTF-8 encoding and stored it to the buffer in UCS-2. If not the case, the file will be read in one byte per character without any code conversion.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para comp">
|
||||||
<h4>QuickInfo</h4>
|
<h4>QuickInfo</h4>
|
||||||
<p>Available when <tt>_USE_STRFUNC</tt> is 1 or 2. When it is set to 2, <tt>'\r'</tt>s contained in the file are stripped out.</p>
|
<p>Available when <tt>_USE_STRFUNC</tt> is 1 or 2. When it is set to 2, <tt>'\r'</tt>s contained in the file are stripped out.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para ref">
|
||||||
<h4>See Also</h4>
|
<h4>See Also</h4>
|
||||||
<p><tt><a href="open.html">f_open</a>, <a href="read.html">f_read</a>, <a href="putc.html">f_putc</a>, <a href="puts.html">f_puts</a>, <a href="printf.html">f_printf</a>, <a href="close.html">f_close</a>, <a href="sfile.html">FIL</a></tt></p>
|
<p><tt><a href="open.html">f_open</a>, <a href="read.html">f_read</a>, <a href="putc.html">f_putc</a>, <a href="puts.html">f_puts</a>, <a href="printf.html">f_printf</a>, <a href="close.html">f_close</a>, <a href="sfile.html">FIL</a></tt></p>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -11,19 +11,19 @@
|
|||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para func">
|
||||||
<h2>f_lseek</h2>
|
<h2>f_lseek</h2>
|
||||||
<p>The f_lseek function moves the file read/write pointer of an open file object. It can also be used to increase the file size (cluster pre-allocation).</p>
|
<p>The f_lseek function moves the file read/write pointer of an open file object. It can also be used to increase the file size (cluster pre-allocation). </p>
|
||||||
|
|
||||||
<pre>
|
<pre>
|
||||||
FRESULT f_lseek (
|
FRESULT f_lseek (
|
||||||
FIL* <em>FileObject</em>, <span>/* Pointer to the file object structure */</span>
|
FIL* <em>FileObject</em>, <span class="c">/* Pointer to the file object structure */</span>
|
||||||
DWORD <em>Offset</em> <span>/* File offset in unit of byte */</span>
|
DWORD <em>Offset</em> <span class="c">/* File offset in unit of byte */</span>
|
||||||
);
|
);
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para arg">
|
||||||
<h4>Parameters</h4>
|
<h4>Parameters</h4>
|
||||||
<dl class="par">
|
<dl class="par">
|
||||||
<dt>FileObject</dt>
|
<dt>FileObject</dt>
|
||||||
@ -34,92 +34,91 @@ FRESULT f_lseek (
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para ret">
|
||||||
<h4>Return Values</h4>
|
<h4>Return Values</h4>
|
||||||
<dl class="ret">
|
<p>
|
||||||
<dt>FR_OK (0)</dt>
|
<a href="rc.html#ok">FR_OK</a>,
|
||||||
<dd>The function succeeded.</dd>
|
<a href="rc.html#de">FR_DISK_ERR</a>,
|
||||||
<dt>FR_DISK_ERR</dt>
|
<a href="rc.html#ie">FR_INT_ERR</a>,
|
||||||
<dd>The function failed due to an error in the disk function.</dd>
|
<a href="rc.html#nr">FR_NOT_READY</a>,
|
||||||
<dt>FR_INT_ERR</dt>
|
<a href="rc.html#io">FR_INVALID_OBJECT</a>,
|
||||||
<dd>The function failed due to a wrong FAT structure or an internal error.</dd>
|
<a href="rc.html#tm">FR_TIMEOUT</a>
|
||||||
<dt>FR_NOT_READY</dt>
|
</p>
|
||||||
<dd>The disk drive cannot work due to no medium in the drive or any other reason.</dd>
|
|
||||||
<dt>FR_INVALID_OBJECT</dt>
|
|
||||||
<dd>The file object is invalid.</dd>
|
|
||||||
<dt>FR_NOT_ENOUGH_CORE</dt>
|
|
||||||
<dd>Insufficient size of link map table for the file.</dd>
|
|
||||||
</dl>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para desc">
|
||||||
<h4>Description</h4>
|
<h4>Description</h4>
|
||||||
<p>The f_lseek function moves the file read/write pointer of an open file. The offset can be specified in only origin from top of the file. When an offset above the file size is specified in write mode, the file size is increased and the data in the expanded area is undefined. This is suitable to create a large file quickly, for fast write operation. After the f_lseek function succeeded, member fptr in the file object should be checked in order to make sure the read/write pointer has been moved correctry. In case of fptr is not the expected value, either of followings has been occured.</p>
|
<p>The f_lseek function moves the file read/write pointer of an open file. The offset can be specified in only origin from top of the file. When an offset above the file size is specified in write mode, the file size is increased to the offset and the data in the expanded area is undefined. This is suitable to create a large file quickly, for fast write operation. After the f_lseek function succeeded, member fptr in the file object should be checked in order to make sure the read/write pointer has been moved correctry. In case of fptr is not the expected value, either of followings has been occured.</p>
|
||||||
<ul>
|
<ul>
|
||||||
<li>End of file. The specified Offset was clipped at the file size because the file has been opened in read-only mode.</li>
|
<li>End of file. The specified Offset was clipped at the file size because the file has been opened in read-only mode.</li>
|
||||||
<li>Disk full. There is insufficient free space on the volume to expand the file size.</li>
|
<li>Disk full. There is insufficient free space on the volume to expand the file size.</li>
|
||||||
</ul>
|
</ul>
|
||||||
<p>When <tt>_USE_FASTSEEK</tt> is set to 1 and <tt>cltbl</tt> member in the file object is not NULL, the fast seek feature is enabled. This feature enables fast backward/long seek operations without FAT access by cluster link information stored on the user defined table. The cluster link information must be created prior to do the fast seek. The required size of the table is (number of fragments + 1) * 2 items. For example, when the file is fragmented in 5, 12 items will be required to store the cluster link information. The file size cannot be expanded when the fast seek feature is enabled.</p>
|
<p>Fast seek mode is enabled when <tt>_USE_FASTSEEK</tt> is set to 1 and <tt>cltbl</tt> member in the file object is not NULL. This feature enables fast backward/long seek operations without FAT access by cluster link map table (CLMT) stored in the user defined table. It is also applied to f_read/f_write functions. In this mode, the file size cannot be increased by f_write/f_lseek functions.</p>
|
||||||
|
<p>The CLMT must be created in the user defined DWORD array prior to use fast seek feature. To create the CLMT, set pointer to the DWORD array to <tt>cltbl</tt> member in the file object, set the array size in unit of items into the first item and call the f_lseek function with <tt>Offset = CREATE_LINKMAP</tt>. After the function succeeded and CLMT is created, no FAT access is occured in subsequent f_read/f_write/f_lseek functions to the file. If the function failed with <tt>FR_NOT_ENOUGH_CORE</tt>, the given array size is insufficient for the file and the required items is returned into the first item of the array. The required array size is (number of fragments + 1) * 2 items. For example, when the file is fragmented in 5, 12 items will be required for the CLMT. </p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para comp">
|
||||||
<h4>QuickInfo</h4>
|
<h4>QuickInfo</h4>
|
||||||
<p>Available when <tt>_FS_MINIMIZE <= 2</tt>.</p>
|
<p>Available when <tt>_FS_MINIMIZE <= 2</tt>.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para use">
|
||||||
<h4>Example</h4>
|
<h4>Example</h4>
|
||||||
<pre>
|
<pre>
|
||||||
<span>/* Move to offset of 5000 from top of the file */</span>
|
<span class="c">/* Open file */</span>
|
||||||
|
file = malloc(sizeof(FIL));
|
||||||
|
if (!file) ...
|
||||||
|
res = f_open(file, "file.dat", FA_READ|FA_WRITE);
|
||||||
|
if (res) ...
|
||||||
|
|
||||||
|
<span class="c">/* Move to offset of 5000 from top of the file */</span>
|
||||||
res = f_lseek(file, 5000);
|
res = f_lseek(file, 5000);
|
||||||
|
|
||||||
<span>/* Move to end of the file to append data */</span>
|
<span class="c">/* Move to end of the file to append data */</span>
|
||||||
res = f_lseek(file, file->fsize);
|
res = f_lseek(file, f_size(file));
|
||||||
|
|
||||||
<span>/* Forward 3000 bytes */</span>
|
<span class="c">/* Forward 3000 bytes */</span>
|
||||||
res = f_lseek(file, file->fptr + 3000);
|
res = f_lseek(file, f_tell(file) + 3000);
|
||||||
|
|
||||||
<span>/* Rewind 2000 bytes (take care on overflow) */</span>
|
<span class="c">/* Rewind 2000 bytes (take care on overflow) */</span>
|
||||||
res = f_lseek(file, file->fptr - 2000);
|
res = f_lseek(file, f_tell(file) - 2000);
|
||||||
</pre>
|
</pre>
|
||||||
<pre>
|
<pre> <span class="c">/* Cluster pre-allocation (to prevent buffer overrun on streaming write) */</span>
|
||||||
<span>/* Cluster pre-allocation (to prevent buffer overrun on streaming write) */</span>
|
|
||||||
|
|
||||||
res = f_open(file, recfile, FA_CREATE_NEW | FA_WRITE); <span>/* Create a file */</span>
|
res = f_open(file, recfile, FA_CREATE_NEW | FA_WRITE); <span class="c">/* Create a file */</span>
|
||||||
|
|
||||||
res = f_lseek(file, PRE_SIZE); <span>/* Pre-allocate clusters */</span>
|
res = f_lseek(file, PRE_SIZE); <span class="c">/* Pre-allocate clusters */</span>
|
||||||
if (res || file->fptr != PRE_SIZE) ... <span>/* Check if the file size has been increased correctly */</span>
|
if (res || f_tell(file) != PRE_SIZE) ... <span class="c">/* Check if the file size has been increased correctly */</span>
|
||||||
|
|
||||||
res = f_lseek(file, DATA_START); <span>/* Record data stream without cluster allocation delay */</span>
|
res = f_lseek(file, DATA_START); <span class="c">/* Record data stream without cluster allocation delay */</span>
|
||||||
...
|
...
|
||||||
|
|
||||||
res = f_truncate(file); <span>/* Truncate unused area */</span>
|
res = f_truncate(file); <span class="c">/* Truncate unused area */</span>
|
||||||
res = f_lseek(file, 0); <span>/* Put file header */</span>
|
res = f_lseek(file, 0); <span class="c">/* Put file header */</span>
|
||||||
...
|
...
|
||||||
|
|
||||||
res = f_close(file);
|
res = f_close(file);
|
||||||
</pre>
|
</pre>
|
||||||
<pre>
|
<pre> <span class="c">/* Using fast seek feature */</span>
|
||||||
<span>/* Using fast seek feature */</span>
|
|
||||||
|
|
||||||
DWORD lktbl[SZ_TBL]; <span>/* Link map table buffer */</span>
|
DWORD lktbl[SZ_TBL]; <span class="c">/* Link map table buffer */</span>
|
||||||
|
|
||||||
res = f_lseek(&file, ofs1); <span>/* This is normal seek (file.cltbl == NULL on file open) */</span>
|
res = f_lseek(file, ofs1); <span class="c">/* This is normal seek (file.cltbl is nulled on file open) */</span>
|
||||||
|
|
||||||
file.cltbl = lktbl; <span>/* Enable fast seek feature */</span>
|
file.cltbl = lktbl; <span class="c">/* Enable fast seek feature */</span>
|
||||||
lktbl[0] = SZ_TBL; <span>/* Set table size to the first item */</span>
|
lktbl[0] = SZ_TBL; <span class="c">/* Set table size to the first item */</span>
|
||||||
res = f_lseek(&file, CREATE_LINKMAP); <span>/* Create cluster link map table */</span>
|
res = f_lseek(file, CREATE_LINKMAP); <span class="c">/* Create CLMT */</span>
|
||||||
...
|
...
|
||||||
|
|
||||||
res = f_lseek(&file, ofs2); <span>/* This is fast seek (file.cltbl != NULL) */</span>
|
res = f_lseek(file, ofs2); <span class="c">/* This is fast seek (file.cltbl != NULL) */</span>
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para ref">
|
||||||
<h4>See Also</h4>
|
<h4>See Also</h4>
|
||||||
<p><tt><a href="open.html">f_open</a>, <a href="truncate.html">f_truncate</a>, <a href="sfile.html">FIL</a></tt></p>
|
<p><tt><a href="open.html">f_open</a>, <a href="truncate.html">f_truncate</a>, <a href="sfile.html">FIL</a></tt></p>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -11,17 +11,17 @@
|
|||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para func">
|
||||||
<h2>f_mkdir</h2>
|
<h2>f_mkdir</h2>
|
||||||
<p>The f_mkdir function creates a new directory.</p>
|
<p>The f_mkdir function creates a new directory.</p>
|
||||||
<pre>
|
<pre>
|
||||||
FRESULT f_mkdir (
|
FRESULT f_mkdir (
|
||||||
const TCHAR* <em>DirName</em> <span>/* Pointer to the directory name */</span>
|
const TCHAR* <em>DirName</em> <span class="c">/* Pointer to the directory name */</span>
|
||||||
);
|
);
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para arg">
|
||||||
<h4>Parameter</h4>
|
<h4>Parameter</h4>
|
||||||
<dl class="par">
|
<dl class="par">
|
||||||
<dt>DirName</dt>
|
<dt>DirName</dt>
|
||||||
@ -30,50 +30,40 @@ FRESULT f_mkdir (
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para ret">
|
||||||
<h4>Return Value</h4>
|
<h4>Return Value</h4>
|
||||||
<dl class="ret">
|
<p>
|
||||||
<dt>FR_OK (0)</dt>
|
<a href="rc.html#ok">FR_OK</a>,
|
||||||
<dd>The function succeeded.</dd>
|
<a href="rc.html#de">FR_DISK_ERR</a>,
|
||||||
<dt>FR_NO_PATH</dt>
|
<a href="rc.html#ie">FR_INT_ERR</a>,
|
||||||
<dd>Could not find the path.</dd>
|
<a href="rc.html#nr">FR_NOT_READY</a>,
|
||||||
<dt>FR_INVALID_NAME</dt>
|
<a href="rc.html#np">FR_NO_PATH</a>,
|
||||||
<dd>The path name is invalid.</dd>
|
<a href="rc.html#in">FR_INVALID_NAME</a>,
|
||||||
<dt>FR_INVALID_DRIVE</dt>
|
<a href="rc.html#de">FR_DENIED</a>,
|
||||||
<dd>The drive number is invalid.</dd>
|
<a href="rc.html#ex">FR_EXIST</a>,
|
||||||
<dt>FR_DENIED</dt>
|
<a href="rc.html#wp">FR_WRITE_PROTECTED</a>,
|
||||||
<dd>The directory cannot be created due to directory table or disk is full.</dd>
|
<a href="rc.html#id">FR_INVALID_DRIVE</a>,
|
||||||
<dt>FR_EXIST</dt>
|
<a href="rc.html#ne">FR_NOT_ENABLED</a>,
|
||||||
<dd>An object that has same name is already existing.</dd>
|
<a href="rc.html#ns">FR_NO_FILESYSTEM</a>,
|
||||||
<dt>FR_NOT_READY</dt>
|
<a href="rc.html#tm">FR_TIMEOUT</a>,
|
||||||
<dd>The disk drive cannot work due to no medium in the drive or any other reason.</dd>
|
<a href="rc.html#nc">FR_NOT_ENOUGH_CORE</a>
|
||||||
<dt>FR_WRITE_PROTECTED</dt>
|
</p>
|
||||||
<dd>The medium is write protected.</dd>
|
|
||||||
<dt>FR_DISK_ERR</dt>
|
|
||||||
<dd>The function failed due to an error in the disk function.</dd>
|
|
||||||
<dt>FR_INT_ERR</dt>
|
|
||||||
<dd>The function failed due to a wrong FAT structure or an internal error.</dd>
|
|
||||||
<dt>FR_NOT_ENABLED</dt>
|
|
||||||
<dd>The logical drive has no work area.</dd>
|
|
||||||
<dt>FR_NO_FILESYSTEM</dt>
|
|
||||||
<dd>There is no valid FAT volume on the drive.</dd>
|
|
||||||
</dl>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para desc">
|
||||||
<h4>Description</h4>
|
<h4>Description</h4>
|
||||||
<p>The f_mkdir function creates a new directory.</p>
|
<p>The f_mkdir function creates a new directory.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para comp">
|
||||||
<h4>QuickInfo</h4>
|
<h4>QuickInfo</h4>
|
||||||
<p>Available when <tt>_FS_READONLY == 0</tt> and <tt>_FS_MINIMIZE == 0</tt>.</p>
|
<p>Available when <tt>_FS_READONLY == 0</tt> and <tt>_FS_MINIMIZE == 0</tt>.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para use">
|
||||||
<h4>Example</h4>
|
<h4>Example</h4>
|
||||||
<pre>
|
<pre>
|
||||||
res = f_mkdir("sub1");
|
res = f_mkdir("sub1");
|
||||||
|
|||||||
@ -11,19 +11,19 @@
|
|||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para func">
|
||||||
<h2>f_mkfs</h2>
|
<h2>f_mkfs</h2>
|
||||||
<p>The f_mkfs fucntion creates a file system on the drive.</p>
|
<p>The f_mkfs fucntion creates a file system on the drive.</p>
|
||||||
<pre>
|
<pre>
|
||||||
FRESULT f_mkfs (
|
FRESULT f_mkfs (
|
||||||
BYTE <em>Drive</em>, <span>/* Logical drive number */</span>
|
BYTE <em>Drive</em>, <span class="c">/* Logical drive number */</span>
|
||||||
BYTE <em>PartitioningRule</em>, <span>/* Partitioning rule */</span>
|
BYTE <em>PartitioningRule</em>, <span class="c">/* Partitioning rule */</span>
|
||||||
UINT <em>AllocSize</em> <span>/* Size of the allocation unit */</span>
|
UINT <em>AllocSize</em> <span class="c">/* Size of the allocation unit */</span>
|
||||||
);
|
);
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para arg">
|
||||||
<h4>Parameters</h4>
|
<h4>Parameters</h4>
|
||||||
<dl class="par">
|
<dl class="par">
|
||||||
<dt>Drive</dt>
|
<dt>Drive</dt>
|
||||||
@ -35,33 +35,20 @@ FRESULT f_mkfs (
|
|||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para ret">
|
||||||
<h4>Return Values</h4>
|
<h4>Return Values</h4>
|
||||||
<dl class="ret">
|
<p>
|
||||||
<dt>FR_OK (0)</dt>
|
<a href="rc.html#ok">FR_OK</a>,
|
||||||
<dd>The function succeeded.</dd>
|
<a href="rc.html#de">FR_DISK_ERR</a>,
|
||||||
<dt>FR_INVALID_DRIVE</dt>
|
<a href="rc.html#nr">FR_NOT_READY</a>,
|
||||||
<dd>The drive number is invalid.</dd>
|
<a href="rc.html#wp">FR_WRITE_PROTECTED</a>,
|
||||||
<dt>FR_NOT_READY</dt>
|
<a href="rc.html#id">FR_INVALID_DRIVE</a>,
|
||||||
<dd>The drive cannot work due to any reason.</dd>
|
<a href="rc.html#ne">FR_NOT_ENABLED</a>,
|
||||||
<dt>FR_WRITE_PROTECTED</dt>
|
<a href="rc.html#ma">FR_MKFS_ABORTED</a>
|
||||||
<dd>The drive is write protected.</dd>
|
</p>
|
||||||
<dt>FR_NOT_ENABLED</dt>
|
|
||||||
<dd>The logical drive has no work area.</dd>
|
|
||||||
<dt>FR_DISK_ERR</dt>
|
|
||||||
<dd>The function failed due to an error in the disk function.</dd>
|
|
||||||
<dt>FR_MKFS_ABORTED</dt>
|
|
||||||
<dd>The function aborted before start in format due to a reason as follows.
|
|
||||||
<ul>
|
|
||||||
<li>The disk size is too small.</li>
|
|
||||||
<li>Invalid parameter was given to any parameter.</li>
|
|
||||||
<li>Not allowable cluster size for this drive. This can occure when number of clusters gets near the 0xFF7 and 0xFFF7.</li>
|
|
||||||
</ul>
|
|
||||||
</dd>
|
|
||||||
</dl>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para desc">
|
||||||
<h4>Description</h4>
|
<h4>Description</h4>
|
||||||
<p>The f_mkfs function creates an FAT volume on the drive. There are two partitioning rules, FDISK and SFD, for removable media. The FDISK format is recommended for the most case. This function currently <em>does not support multiple partition</em>, so that existing partitions on the physical dirve will be deleted and re-created a new partition occupies entire disk space.</p>
|
<p>The f_mkfs function creates an FAT volume on the drive. There are two partitioning rules, FDISK and SFD, for removable media. The FDISK format is recommended for the most case. This function currently <em>does not support multiple partition</em>, so that existing partitions on the physical dirve will be deleted and re-created a new partition occupies entire disk space.</p>
|
||||||
<p>The FAT sub-type, FAT12/FAT16/FAT32, is determined by number of clusters on the volume and nothing else, according to the FAT specification issued by Microsoft. Thus which FAT sub-type is selected, is depends on the volume size and the specified cluster size. The cluster size affects performance of the file system and large cluster increases the performance.</p>
|
<p>The FAT sub-type, FAT12/FAT16/FAT32, is determined by number of clusters on the volume and nothing else, according to the FAT specification issued by Microsoft. Thus which FAT sub-type is selected, is depends on the volume size and the specified cluster size. The cluster size affects performance of the file system and large cluster increases the performance.</p>
|
||||||
@ -69,7 +56,7 @@ FRESULT f_mkfs (
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para comp">
|
||||||
<h4>QuickInfo</h4>
|
<h4>QuickInfo</h4>
|
||||||
<p>Available when <tt>_FS_READOLNY == 0</tt> and <tt>_USE_MKFS == 1</tt>.</p>
|
<p>Available when <tt>_FS_READOLNY == 0</tt> and <tt>_USE_MKFS == 1</tt>.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -11,18 +11,18 @@
|
|||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para func">
|
||||||
<h2>f_mount</h2>
|
<h2>f_mount</h2>
|
||||||
<p>The f_mount fucntion registers/unregisters a work area to the FatFs module.</p>
|
<p>The f_mount fucntion registers/unregisters a work area to the FatFs module.</p>
|
||||||
<pre>
|
<pre>
|
||||||
FRESULT f_mount (
|
FRESULT f_mount (
|
||||||
BYTE <em>Drive</em>, <span>/* Logical drive number */</span>
|
BYTE <em>Drive</em>, <span class="c">/* Logical drive number */</span>
|
||||||
FATFS* <em>FileSystemObject</em> <span>/* Pointer to the work area */</span>
|
FATFS* <em>FileSystemObject</em> <span class="c">/* Pointer to the work area */</span>
|
||||||
);
|
);
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para arg">
|
||||||
<h4>Parameters</h4>
|
<h4>Parameters</h4>
|
||||||
<dl class="par">
|
<dl class="par">
|
||||||
<dt>Drive</dt>
|
<dt>Drive</dt>
|
||||||
@ -32,31 +32,29 @@ FRESULT f_mount (
|
|||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para ret">
|
||||||
<h4>Return Values</h4>
|
<h4>Return Values</h4>
|
||||||
<dl class="ret">
|
<p>
|
||||||
<dt>FR_OK (0)</dt>
|
<a href="rc.html#ok">FR_OK</a>,
|
||||||
<dd>The function succeeded.</dd>
|
<a href="rc.html#id">FR_INVALID_DRIVE</a>
|
||||||
<dt>FR_INVALID_DRIVE</dt>
|
</p>
|
||||||
<dd>The drive number is invalid.</dd>
|
|
||||||
</dl>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para desc">
|
||||||
<h4>Description</h4>
|
<h4>Description</h4>
|
||||||
<p>The f_mount function registers/unregisters a work area to the FatFs module. The work area must be given to the each volume with this function prior to use any other file function. To unregister a work area, specify a NULL to the <em>FileSystemObject</em>, and then the work area can be discarded.</p>
|
<p>The f_mount function registers/unregisters a work area to the FatFs module. The work area must be given to the each volume with this function prior to use any other file function. To unregister a work area, specify a NULL to the <em>FileSystemObject</em>, and then the work area can be discarded.</p>
|
||||||
<p>This function always succeeds regardless of the drive status. No media access is occured in this function and it only initializes the given work area and registers its address to the internal table. The volume mount process is performed on first file access after f_mount function or media change.</p>
|
<p>This function always succeeds regardless of the drive status. No media access is occured in this function. It only initializes the given work area and registers its address to the internal table. The volume mount process is performed on first file access after f_mount function or media change.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para comp">
|
||||||
<h4>QuickInfo</h4>
|
<h4>QuickInfo</h4>
|
||||||
<p>Always available.</p>
|
<p>Always available.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para ref">
|
||||||
<h4>See Also</h4>
|
<h4>See Also</h4>
|
||||||
<p><tt><a href="sfatfs.html">FATFS</a></tt></p>
|
<p><tt><a href="sfatfs.html">FATFS</a></tt></p>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
113
doc/en/open.html
113
doc/en/open.html
@ -11,19 +11,19 @@
|
|||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para func">
|
||||||
<h2>f_open</h2>
|
<h2>f_open</h2>
|
||||||
<p>The f_open function creates a <em>file object</em> to be used to access the file.</p>
|
<p>The f_open function creates a <em>file object</em> to be used to access the file.</p>
|
||||||
<pre>
|
<pre>
|
||||||
FRESULT f_open (
|
FRESULT f_open (
|
||||||
FIL* <em>FileObject</em>, <span>/* Pointer to the blank file object structure */</span>
|
FIL* <em>FileObject</em>, <span class="c">/* Pointer to the blank file object structure */</span>
|
||||||
const TCHAR* <em>FileName</em>, <span>/* Pointer to the file neme */</span>
|
const TCHAR* <em>FileName</em>, <span class="c">/* Pointer to the file neme */</span>
|
||||||
BYTE <em>ModeFlags</em> <span>/* Mode flags */</span>
|
BYTE <em>ModeFlags</em> <span class="c">/* Mode flags */</span>
|
||||||
);
|
);
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para arg">
|
||||||
<h4>Parameters</h4>
|
<h4>Parameters</h4>
|
||||||
<dl class="par">
|
<dl class="par">
|
||||||
<dt>FileObject</dt>
|
<dt>FileObject</dt>
|
||||||
@ -34,12 +34,12 @@ FRESULT f_open (
|
|||||||
<dd>Specifies the type of access and open method for the file. It is specified by a combination of following flags.<br>
|
<dd>Specifies the type of access and open method for the file. It is specified by a combination of following flags.<br>
|
||||||
<table class="lst">
|
<table class="lst">
|
||||||
<tr><th>Value</th><th>Description</th></tr>
|
<tr><th>Value</th><th>Description</th></tr>
|
||||||
<tr><td>FA_READ</td><td>Specifies read access to the object. Data can be read from the file.<br>Combine with FA_WRITE for read-write access.</td></tr>
|
<tr><td>FA_READ</td><td>Specifies read access to the object. Data can be read from the file.<br>Combine with <tt>FA_WRITE</tt> for read-write access.</td></tr>
|
||||||
<tr><td>FA_WRITE</td><td>Specifies write access to the object. Data can be written to the file.<br>Combine with FA_READ for read-write access.</td></tr>
|
<tr><td>FA_WRITE</td><td>Specifies write access to the object. Data can be written to the file.<br>Combine with <tt>FA_READ</tt> for read-write access.</td></tr>
|
||||||
<tr><td>FA_OPEN_EXISTING</td><td>Opens the file. The function fails if the file is not existing. (Default)</td></tr>
|
<tr><td>FA_OPEN_EXISTING</td><td>Opens the file. The function fails if the file is not existing. (Default)</td></tr>
|
||||||
<tr><td>FA_OPEN_ALWAYS</td><td>Opens the file if it is existing. If not, a new file is created.<br>
|
<tr><td>FA_OPEN_ALWAYS</td><td>Opens the file if it is existing. If not, a new file is created.<br>
|
||||||
To append data to the file, use f_lseek function after file open in this method.</td></tr>
|
To append data to the file, use <a href="lseek.html">f_lseek</a> function after file open in this method.</td></tr>
|
||||||
<tr><td>FA_CREATE_NEW</td><td>Creates a new file. The function fails with FR_EXIST if the file is existing.</td></tr>
|
<tr><td>FA_CREATE_NEW</td><td>Creates a new file. The function fails with <tt>FR_EXIST</tt> if the file is existing.</td></tr>
|
||||||
<tr><td>FA_CREATE_ALWAYS</td><td>Creates a new file. If the file is existing, it is truncated and overwritten.</td></tr>
|
<tr><td>FA_CREATE_ALWAYS</td><td>Creates a new file. If the file is existing, it is truncated and overwritten.</td></tr>
|
||||||
</table>
|
</table>
|
||||||
</dd>
|
</dd>
|
||||||
@ -47,94 +47,81 @@ To append data to the file, use f_lseek function after file open in this method.
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para ret">
|
||||||
<h4>Return Values</h4>
|
<h4>Return Values</h4>
|
||||||
<dl class="ret">
|
<p>
|
||||||
<dt>FR_OK (0)</dt>
|
<a href="rc.html#ok">FR_OK</a>,
|
||||||
<dd>The function succeeded and the file object is valid.</dd>
|
<a href="rc.html#de">FR_DISK_ERR</a>,
|
||||||
<dt>FR_NO_FILE</dt>
|
<a href="rc.html#ie">FR_INT_ERR</a>,
|
||||||
<dd>Could not find the file.</dd>
|
<a href="rc.html#nr">FR_NOT_READY</a>,
|
||||||
<dt>FR_NO_PATH</dt>
|
<a href="rc.html#ok">FR_NO_FILE</a>,
|
||||||
<dd>Could not find the path.</dd>
|
<a href="rc.html#np">FR_NO_PATH</a>,
|
||||||
<dt>FR_INVALID_NAME</dt>
|
<a href="rc.html#in">FR_INVALID_NAME</a>,
|
||||||
<dd>The file name is invalid.</dd>
|
<a href="rc.html#de">FR_DENIED</a>,
|
||||||
<dt>FR_INVALID_DRIVE</dt>
|
<a href="rc.html#ex">FR_EXIST</a>,
|
||||||
<dd>The drive number is invalid.</dd>
|
<a href="rc.html#wp">FR_WRITE_PROTECTED</a>,
|
||||||
<dt>FR_EXIST</dt>
|
<a href="rc.html#id">FR_INVALID_DRIVE</a>,
|
||||||
<dd>The file is already existing.</dd>
|
<a href="rc.html#ne">FR_NOT_ENABLED</a>,
|
||||||
<dt>FR_DENIED</dt>
|
<a href="rc.html#ns">FR_NO_FILESYSTEM</a>,
|
||||||
<dd>The required access was denied due to one of the following reasons:
|
<a href="rc.html#tm">FR_TIMEOUT</a>,
|
||||||
<ul><li>Write mode open against a read-only file.</li>
|
<a href="rc.html#lo">FR_LOCKED</a>,
|
||||||
<li>File cannot be created due to a directory or read-only file is existing.</li>
|
<a href="rc.html#nc">FR_NOT_ENOUGH_CORE</a>,
|
||||||
<li>File cannot be created due to the directory table is full.</li></ul></dd>
|
<a href="rc.html#tf">FR_TOO_MANY_OPEN_FILES</a>
|
||||||
<dt>FR_NOT_READY</dt>
|
</p>
|
||||||
<dd>The disk drive cannot work due to no medium in the drive or any other reason.</dd>
|
|
||||||
<dt>FR_WRITE_PROTECTED</dt>
|
|
||||||
<dd>Write mode open or creation under the medium is write protected.</dd>
|
|
||||||
<dt>FR_DISK_ERR</dt>
|
|
||||||
<dd>The function failed due to an error in the disk function.</dd>
|
|
||||||
<dt>FR_INT_ERR</dt>
|
|
||||||
<dd>The function failed due to a wrong FAT structure or an internal error.</dd>
|
|
||||||
<dt>FR_NOT_ENABLED</dt>
|
|
||||||
<dd>The logical drive has no work area.</dd>
|
|
||||||
<dt>FR_NO_FILESYSTEM</dt>
|
|
||||||
<dd>There is no valid FAT volume on the drive.</dd>
|
|
||||||
<dt>FR_LOCKED</dt>
|
|
||||||
<dd>The function was rejected due to file shareing policy (_FS_SHARE).</dd>
|
|
||||||
</dl>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para desc">
|
||||||
<h4>Description</h4>
|
<h4>Description</h4>
|
||||||
<p>A file object is created when the function succeeded. The file object is used for subsequent read/write functions to refer to the file. When close an open file object, use <a href="close.html">f_close</a> function. If the modified file is not closed, the file data can be collapsed.</p>
|
<p>A file object is created when the function succeeded. The file object is used for subsequent read/write functions to refer to the file. When close an open file object, use <a href="close.html">f_close</a> function. If the modified file is not closed, the file data can be collapsed.</p>
|
||||||
<p>Before using any file function, a work area (file system object) must be given to the logical drive with <a href="mount.html">f_mount</a> function. All file functions can work after this procedure.</p>
|
<p>If duplicated file open is needed, read <a href="appnote.html#dup">here</a> carefully.</p>
|
||||||
|
<p>Before using any file function, a work area (file system object) must be registered to the logical drive with <a href="mount.html">f_mount</a> function. All file functions can work after this procedure.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para comp">
|
||||||
<h4>QuickInfo</h4>
|
<h4>QuickInfo</h4>
|
||||||
<p>Always available. The mode flags, <tt>FA_WRITE, FA_CREATE_ALWAYS, FA_CREATE_NEW and FA_OPEN_ALWAYS</tt>, are not available when <tt>_FS_READONLY == 1</tt>.</p>
|
<p>Always available. The mode flags, <tt>FA_WRITE, FA_CREATE_ALWAYS, FA_CREATE_NEW and FA_OPEN_ALWAYS</tt>, are not available when <tt>_FS_READONLY == 1</tt>.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para use">
|
||||||
<h4>Example (File Copy)</h4>
|
<h4>Example (File Copy)</h4>
|
||||||
<pre>
|
<pre>
|
||||||
void main (void)
|
void main (void)
|
||||||
{
|
{
|
||||||
FATFS fs[2]; <span>/* Work area (file system object) for logical drives */</span>
|
FATFS fs[2]; <span class="c">/* Work area (file system object) for logical drives */</span>
|
||||||
FIL fsrc, fdst; <span>/* file objects */</span>
|
FIL fsrc, fdst; <span class="c">/* file objects */</span>
|
||||||
BYTE buffer[4096]; <span>/* file copy buffer */</span>
|
BYTE buffer[4096]; <span class="c">/* file copy buffer */</span>
|
||||||
FRESULT res; <span>/* FatFs function common result code */</span>
|
FRESULT res; <span class="c">/* FatFs function common result code */</span>
|
||||||
UINT br, bw; <span>/* File read/write count */</span>
|
UINT br, bw; <span class="c">/* File read/write count */</span>
|
||||||
|
|
||||||
|
|
||||||
<span>/* Register work area for each volume (Always succeeds regardless of disk status) */</span>
|
<span class="c">/* Register work area for each volume (Always succeeds regardless of disk status) */</span>
|
||||||
f_mount(0, &fs[0]);
|
f_mount(0, &fs[0]);
|
||||||
f_mount(1, &fs[1]);
|
f_mount(1, &fs[1]);
|
||||||
|
|
||||||
<span>/* Open source file on the drive 1 */</span>
|
<span class="c">/* Open source file on the drive 1 */</span>
|
||||||
res = f_open(&fsrc, "1:srcfile.dat", FA_OPEN_EXISTING | FA_READ);
|
res = f_open(&fsrc, "1:srcfile.dat", FA_OPEN_EXISTING | FA_READ);
|
||||||
if (res) die(res);
|
if (res) die(res);
|
||||||
|
|
||||||
<span>/* Create destination file on the drive 0 */</span>
|
<span class="c">/* Create destination file on the drive 0 */</span>
|
||||||
res = f_open(&fdst, "0:dstfile.dat", FA_CREATE_ALWAYS | FA_WRITE);
|
res = f_open(&fdst, "0:dstfile.dat", FA_CREATE_ALWAYS | FA_WRITE);
|
||||||
if (res) die(res);
|
if (res) die(res);
|
||||||
|
|
||||||
<span>/* Copy source to destination */</span>
|
<span class="c">/* Copy source to destination */</span>
|
||||||
for (;;) {
|
for (;;) {
|
||||||
res = f_read(&fsrc, buffer, sizeof(buffer), &br); <span>/* Read a chunk of src file */</span>
|
res = f_read(&fsrc, buffer, sizeof(buffer), &br); <span class="c">/* Read a chunk of src file */</span>
|
||||||
if (res || br == 0) break; <span>/* error or eof */</span>
|
if (res || br == 0) break; <span class="c">/* error or eof */</span>
|
||||||
res = f_write(&fdst, buffer, br, &bw); <span>/* Write it to the dst file */</span>
|
res = f_write(&fdst, buffer, br, &bw); <span class="c">/* Write it to the dst file */</span>
|
||||||
if (res || bw < br) break; <span>/* error or disk full */</span>
|
if (res || bw < br) break; <span class="c">/* error or disk full */</span>
|
||||||
}
|
}
|
||||||
|
|
||||||
<span>/* Close open files */</span>
|
<span class="c">/* Close open files */</span>
|
||||||
f_close(&fsrc);
|
f_close(&fsrc);
|
||||||
f_close(&fdst);
|
f_close(&fdst);
|
||||||
|
|
||||||
<span>/* Unregister work area prior to discard it */</span>
|
<span class="c">/* Unregister work area prior to discard it */</span>
|
||||||
f_mount(0, NULL);
|
f_mount(0, NULL);
|
||||||
f_mount(1, NULL);
|
f_mount(1, NULL);
|
||||||
}
|
}
|
||||||
@ -142,7 +129,7 @@ void main (void)
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para ref">
|
||||||
<h4>See Also</h4>
|
<h4>See Also</h4>
|
||||||
<p><tt><a href="read.html">f_read</a>, <a href="write.html">f_write</a>, <a href="close.html">f_close</a>, <a href="sfile.html">FIL</a>, <a href="sfatfs.html">FATFS</a></tt></p>
|
<p><tt><a href="read.html">f_read</a>, <a href="write.html">f_write</a>, <a href="close.html">f_close</a>, <a href="sfile.html">FIL</a>, <a href="sfatfs.html">FATFS</a></tt></p>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -11,18 +11,18 @@
|
|||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para func">
|
||||||
<h2>f_opendir</h2>
|
<h2>f_opendir</h2>
|
||||||
<p>The f_opendir function opens a directory.</p>
|
<p>The f_opendir function opens a directory.</p>
|
||||||
<pre>
|
<pre>
|
||||||
FRESULT f_opendir (
|
FRESULT f_opendir (
|
||||||
DIR* <em>DirObject</em>, <span>/* Pointer to the blank directory object structure */</span>
|
DIR* <em>DirObject</em>, <span class="c">/* Pointer to the blank directory object structure */</span>
|
||||||
const TCHAR* <em>DirName</em> <span>/* Pointer to the directory name */</span>
|
const TCHAR* <em>DirName</em> <span class="c">/* Pointer to the directory name */</span>
|
||||||
);
|
);
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para arg">
|
||||||
<h4>Parameters</h4>
|
<h4>Parameters</h4>
|
||||||
<dl class="par">
|
<dl class="par">
|
||||||
<dt>DirObject</dt>
|
<dt>DirObject</dt>
|
||||||
@ -33,44 +33,37 @@ FRESULT f_opendir (
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para ret">
|
||||||
<h4>Return Values</h4>
|
<h4>Return Values</h4>
|
||||||
<dl class="ret">
|
<p>
|
||||||
<dt>FR_OK (0)</dt>
|
<a href="rc.html#ok">FR_OK</a>,
|
||||||
<dd>The function succeeded and the directory object is created. It is used for subsequent calls to read the directory entries.</dd>
|
<a href="rc.html#de">FR_DISK_ERR</a>,
|
||||||
<dt>FR_NO_PATH</dt>
|
<a href="rc.html#ie">FR_INT_ERR</a>,
|
||||||
<dd>Could not find the path.</dd>
|
<a href="rc.html#nr">FR_NOT_READY</a>,
|
||||||
<dt>FR_INVALID_NAME</dt>
|
<a href="rc.html#np">FR_NO_PATH</a>,
|
||||||
<dd>The path name is invalid.</dd>
|
<a href="rc.html#in">FR_INVALID_NAME</a>,
|
||||||
<dt>FR_INVALID_DRIVE</dt>
|
<a href="rc.html#id">FR_INVALID_DRIVE</a>,
|
||||||
<dd>The drive number is invalid.</dd>
|
<a href="rc.html#ne">FR_NOT_ENABLED</a>,
|
||||||
<dt>FR_NOT_READY</dt>
|
<a href="rc.html#ns">FR_NO_FILESYSTEM</a>,
|
||||||
<dd>The disk drive cannot work due to no medium in the drive or any other reason.</dd>
|
<a href="rc.html#tm">FR_TIMEOUT</a>,
|
||||||
<dt>FR_DISK_ERR</dt>
|
<a href="rc.html#nc">FR_NOT_ENOUGH_CORE</a>
|
||||||
<dd>The function failed due to an error in the disk function.</dd>
|
</p>
|
||||||
<dt>FR_INT_ERR</dt>
|
|
||||||
<dd>The function failed due to a wrong FAT structure or an internal error.</dd>
|
|
||||||
<dt>FR_NOT_ENABLED</dt>
|
|
||||||
<dd>The logical drive has no work area.</dd>
|
|
||||||
<dt>FR_NO_FILESYSTEM</dt>
|
|
||||||
<dd>There is no valid FAT volume on the drive.</dd>
|
|
||||||
</dl>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para desc">
|
||||||
<h4>Description</h4>
|
<h4>Description</h4>
|
||||||
<p>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.</p>
|
<p>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.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para comp">
|
||||||
<h4>QuickInfo</h4>
|
<h4>QuickInfo</h4>
|
||||||
<p>Available when <tt>_FS_MINIMIZE <= 1</tt>.</p>
|
<p>Available when <tt>_FS_MINIMIZE <= 1</tt>.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para ref">
|
||||||
<h4>See Also</h4>
|
<h4>See Also</h4>
|
||||||
<p><tt><a href="readdir.html">f_readdir</a>, <a href="sdir.html">DIR</a></tt></p>
|
<p><tt><a href="readdir.html">f_readdir</a>, <a href="sdir.html">DIR</a></tt></p>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -11,19 +11,19 @@
|
|||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para func">
|
||||||
<h2>f_printf</h2>
|
<h2>f_printf</h2>
|
||||||
<p>The f_printf function writes formatted string to the file.</p>
|
<p>The f_printf function writes formatted string to the file.</p>
|
||||||
<pre>
|
<pre>
|
||||||
int f_printf (
|
int f_printf (
|
||||||
FIL* <em>FileObject</em>, <span>/* File object */</span>
|
FIL* <em>FileObject</em>, <span class="c">/* File object */</span>
|
||||||
const TCHAR* <em>Foramt</em>, <span>/* Format stirng */</span>
|
const TCHAR* <em>Foramt</em>, <span class="c">/* Format stirng */</span>
|
||||||
...
|
...
|
||||||
);
|
);
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para arg">
|
||||||
<h4>Parameters</h4>
|
<h4>Parameters</h4>
|
||||||
<dl class="par">
|
<dl class="par">
|
||||||
<dt>FileObject</dt>
|
<dt>FileObject</dt>
|
||||||
@ -37,45 +37,50 @@ int f_printf (
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para ret">
|
||||||
<h4>Return Values</h4>
|
<h4>Return Values</h4>
|
||||||
<p>When the function succeeded, number of characters written is returned. When the function failed due to disk full or any error, an <tt>EOF (-1)</tt> will be returned.</p>
|
<p>When the function succeeded, number of characters written is returned. When the function failed due to disk full or any error, an <tt>EOF (-1)</tt> will be returned.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para desc">
|
||||||
<h4>Description</h4>
|
<h4>Description</h4>
|
||||||
<p>The f_printf() is a wrapper function of <a href="putc.html">f_putc()</a> and <a href="puts.html">f_puts()</a>. The format control directive is a sub-set of standard library shown as follos:</p>
|
<p>The f_printf() is a wrapper function of <a href="putc.html">f_putc()</a> and <a href="puts.html">f_puts()</a>. The format control directive is a sub-set of standard library shown as follos:</p>
|
||||||
<ul>
|
<ul>
|
||||||
<li>Type: <tt>c C s S d D u U x X b B</tt></li>
|
<li>Type: <tt>c C s S d D u U x X b B</tt></li>
|
||||||
<li>Size: <tt>l L</tt></li>
|
<li>Size: <tt>l L</tt></li>
|
||||||
<li>Flag: <tt>0</tt></li>
|
<li>Flag: <tt>0 -</tt></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para comp">
|
||||||
<h4>QuickInfo</h4>
|
<h4>QuickInfo</h4>
|
||||||
<p>Available when <tt>_FS_READONLY == 0</tt> and <tt>_USE_STRFUNC</tt> is 1 or 2. When it is set to 2, <tt>'\n'</tt>s contained in the output are converted to <tt>"\r\n"</tt>.</p>
|
<p>Available when <tt>_FS_READONLY == 0</tt> and <tt>_USE_STRFUNC</tt> is 1 or 2. When it is set to 2, <tt>'\n'</tt>s contained in the output are converted to <tt>"\r\n"</tt>.</p>
|
||||||
<p>When the FatFs is configured to Unicode API (<tt>_LFN_UNICODE == 1</tt>), the generated UCS-2 characters are written to the file in UTF-8 encoding. If not the case, the byte characters will be written directly.</p>
|
<p>When the FatFs is configured to Unicode API (<tt>_LFN_UNICODE == 1</tt>), the generated UCS-2 characters are written to the file in UTF-8 encoding. If not the case, the byte characters will be written directly.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para use">
|
||||||
<h4>Example</h4>
|
<h4>Example</h4>
|
||||||
<pre>
|
<pre>
|
||||||
f_printf(&fil, "%6d", -200); <span>/* " -200" */</span>
|
f_printf(&fil, "%d", 1234); <span class="c">/* "1234" */</span>
|
||||||
f_printf(&fil, "%02u", 5); <span>/* "05" */</span>
|
f_printf(&fil, "%6d,%3d%%", -200, 5); <span class="c">/* " -200, 5%" */</span>
|
||||||
f_printf(&fil, "%ld", 12345678L); <span>/* "12345678" */</span>
|
f_printf(&fil, "%-6u", 100); <span class="c">/* "100 " */</span>
|
||||||
f_printf(&fil, "%08lX", 1194684UL); <span>/* "00123ABC" */</span>
|
f_printf(&fil, "%ld", 12345678L); <span class="c">/* "12345678" */</span>
|
||||||
f_printf(&fil, "%08b", 0x55); <span>/* "01010101" */</span>
|
f_printf(&fil, "%04x", 0xA3); <span class="c">/* "00a3" */</span>
|
||||||
f_printf(&fil, "%s", "String"); <span>/* "String" */</span>
|
f_printf(&fil, "%08LX", 0x123ABC); <span class="c">/* "00123ABC" */</span>
|
||||||
f_printf(&fil, "%c", 'a'); <span>/* "a" */</span>
|
f_printf(&fil, "%016b", 0x550F); <span class="c">/* "0101010100001111" */</span>
|
||||||
|
f_printf(&fil, "%s", "String"); <span class="c">/* "String" */</span>
|
||||||
|
f_printf(&fil, "%-4s", "abc"); <span class="c">/* "abc " */</span>
|
||||||
|
f_printf(&fil, "%4s", "abc"); <span class="c">/* " abc" */</span>
|
||||||
|
f_printf(&fil, "%c", 'a'); <span class="c">/* "a" */</span>
|
||||||
|
f_printf(&fil, "%f", 10.0); <span class="c">/* f_printf lacks floating point support */</span>
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para ref">
|
||||||
<h4>See Also</h4>
|
<h4>See Also</h4>
|
||||||
<p><tt><a href="open.html">f_open</a>, <a href="putc.html">f_putc</a>, <a href="puts.html">f_puts</a>, <a href="gets.html">f_gets</a>, <a href="close.html">f_close</a>, <a href="sfile.html">FIL</a></tt></p>
|
<p><tt><a href="open.html">f_open</a>, <a href="putc.html">f_putc</a>, <a href="puts.html">f_puts</a>, <a href="gets.html">f_gets</a>, <a href="close.html">f_close</a>, <a href="sfile.html">FIL</a></tt></p>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -11,18 +11,18 @@
|
|||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para func">
|
||||||
<h2>f_putc</h2>
|
<h2>f_putc</h2>
|
||||||
<p>The f_putc funciton puts a character to the file.</p>
|
<p>The f_putc funciton puts a character to the file.</p>
|
||||||
<pre>
|
<pre>
|
||||||
int f_putc (
|
int f_putc (
|
||||||
TCHAR <em>Chr</em>, <span>/* A character to put */</span>
|
TCHAR <em>Chr</em>, <span class="c">/* A character to put */</span>
|
||||||
FIL* <em>FileObject</em> <span>/* File object */</span>
|
FIL* <em>FileObject</em> <span class="c">/* File object */</span>
|
||||||
);
|
);
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para arg">
|
||||||
<h4>Parameters</h4>
|
<h4>Parameters</h4>
|
||||||
<dl class="par">
|
<dl class="par">
|
||||||
<dt>Chr</dt>
|
<dt>Chr</dt>
|
||||||
@ -33,26 +33,26 @@ int f_putc (
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para ret">
|
||||||
<h4>Return Values</h4>
|
<h4>Return Values</h4>
|
||||||
<p>When the character was written successfuly, the function returns the character. When the function failed due to disk full or any error, an <tt>EOF (-1)</tt> will be returned.</p>
|
<p>When the character was written successfuly, the function returns the character. When the function failed due to disk full or any error, an <tt>EOF (-1)</tt> will be returned.</p>
|
||||||
<p>When the FatFs is configured to Unicode API (<tt>_LFN_UNICODE == 1</tt>), the UCS-2 character is written to the file in UTF-8 encoding. If not the case, the byte will be written directly.</p>
|
<p>When the FatFs is configured to Unicode API (<tt>_LFN_UNICODE == 1</tt>), the UCS-2 character is written to the file in UTF-8 encoding. If not the case, the byte will be written directly.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para desc">
|
||||||
<h4>Description</h4>
|
<h4>Description</h4>
|
||||||
<p>The f_putc() is a wrapper function of <a href="write.html">f_write()</a>.</p>
|
<p>The f_putc() is a wrapper function of <a href="write.html">f_write()</a>.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para comp">
|
||||||
<h4>QuickInfo</h4>
|
<h4>QuickInfo</h4>
|
||||||
<p>Available when <tt>_FS_READONLY == 0</tt> and <tt>_USE_STRFUNC</tt> is 1 or 2. When it is set to 2, a <tt>'\n'</tt> is converted to <tt>"\r\n"</tt>.</p>
|
<p>Available when <tt>_FS_READONLY == 0</tt> and <tt>_USE_STRFUNC</tt> is 1 or 2. When it is set to 2, a <tt>'\n'</tt> is converted to <tt>"\r\n"</tt>.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para ref">
|
||||||
<h4>See Also</h4>
|
<h4>See Also</h4>
|
||||||
<p><tt><a href="open.html">f_open</a>, <a href="puts.html">f_puts</a>, <a href="printf.html">f_printf</a>, <a href="gets.html">f_gets</a>, <a href="close.html">f_close</a>, <a href="sfile.html">FIL</a></tt></p>
|
<p><tt><a href="open.html">f_open</a>, <a href="puts.html">f_puts</a>, <a href="printf.html">f_printf</a>, <a href="gets.html">f_gets</a>, <a href="close.html">f_close</a>, <a href="sfile.html">FIL</a></tt></p>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -11,18 +11,18 @@
|
|||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para func">
|
||||||
<h2>f_puts</h2>
|
<h2>f_puts</h2>
|
||||||
<p>The f_puts function writes a string to the file.</p>
|
<p>The f_puts function writes a string to the file.</p>
|
||||||
<pre>
|
<pre>
|
||||||
int f_puts (
|
int f_puts (
|
||||||
const TCHAR* <em>Str</em>, <span>/* String */</span>
|
const TCHAR* <em>Str</em>, <span class="c">/* String */</span>
|
||||||
FIL* <em>FileObject</em> <span>/* File object */</span>
|
FIL* <em>FileObject</em> <span class="c">/* File object */</span>
|
||||||
);
|
);
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para arg">
|
||||||
<h4>Parameters</h4>
|
<h4>Parameters</h4>
|
||||||
<dl class="par">
|
<dl class="par">
|
||||||
<dt>Str</dt>
|
<dt>Str</dt>
|
||||||
@ -33,26 +33,26 @@ int f_puts (
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para ret">
|
||||||
<h4>Return Value</h4>
|
<h4>Return Value</h4>
|
||||||
<p>When the function succeeded, number of characters written that is not minus value is returned. When the function failed due to disk full or any error, an <tt>EOF (-1)</tt> will be returned.</p>
|
<p>When the function succeeded, number of characters written that is not minus value is returned. When the function failed due to disk full or any error, an <tt>EOF (-1)</tt> will be returned.</p>
|
||||||
<p>When the FatFs is configured to Unicode API (<tt>_LFN_UNICODE == 1</tt>), the UCS-2 string is written to the file in UTF-8 encoding. If not the case, the byte stream will be written directly.</p>
|
<p>When the FatFs is configured to Unicode API (<tt>_LFN_UNICODE == 1</tt>), the UCS-2 string is written to the file in UTF-8 encoding. If not the case, the byte stream will be written directly.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para desc">
|
||||||
<h4>Description</h4>
|
<h4>Description</h4>
|
||||||
<p>The f_puts() is a wrapper function of <a href="putc.html">f_putc()</a>.</p>
|
<p>The f_puts() is a wrapper function of <a href="putc.html">f_putc()</a>.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para comp">
|
||||||
<h4>QuickInfo</h4>
|
<h4>QuickInfo</h4>
|
||||||
<p>Available when <tt>_FS_READONLY == 0</tt> and <tt>_USE_STRFUNC</tt> is 1 or 2. When it is set to 2, <tt>'\n'</tt>s contained in the string are converted to <tt>"\r\n"</tt>.</p>
|
<p>Available when <tt>_FS_READONLY == 0</tt> and <tt>_USE_STRFUNC</tt> is 1 or 2. When it is set to 2, <tt>'\n'</tt>s contained in the string are converted to <tt>"\r\n"</tt>.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para ref">
|
||||||
<h4>See Also</h4>
|
<h4>See Also</h4>
|
||||||
<p><tt><a href="open.html">f_open</a>, <a href="putc.html">f_putc</a>, <a href="printf.html">f_printf</a>, <a href="gets.html">f_gets</a>, <a href="close.html">f_close</a>, <a href="sfile.html">FIL</a></tt></p>
|
<p><tt><a href="open.html">f_open</a>, <a href="putc.html">f_putc</a>, <a href="printf.html">f_printf</a>, <a href="gets.html">f_gets</a>, <a href="close.html">f_close</a>, <a href="sfile.html">FIL</a></tt></p>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
83
doc/en/rc.html
Normal file
83
doc/en/rc.html
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
|
<meta http-equiv="Content-Style-Type" content="text/css">
|
||||||
|
<link rel="up" title="FatFs" href="../00index_e.html">
|
||||||
|
<link rel="alternate" hreflang="ja" title="Japanese" href="../ja/rc.html">
|
||||||
|
<link rel="stylesheet" href="../css_e.css" type="text/css" media="screen" title="ELM Default">
|
||||||
|
<title>FatFs - Return Codes</title>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<h1>Return Code of the File Functions</h1>
|
||||||
|
<p>On the FatFs API, most of file functions return common result code as enum type. When a function succeeded, it returns zero, otherwise returns non-zero value that indicates type of error.</p>
|
||||||
|
|
||||||
|
<dl class="ret">
|
||||||
|
<dt id="ok">FR_OK (0)</dt>
|
||||||
|
<dd>The function succeeded.</dd>
|
||||||
|
<dt id="de">FR_DISK_ERR</dt>
|
||||||
|
<dd>An unrecoverable error occured in the lower layer (disk I/O functions).</dd>
|
||||||
|
<dt id="ie">FR_INT_ERR</dt>
|
||||||
|
<dd>Assertion failed. An insanity is detected in the internal process. One of the following possibilities are suspected.
|
||||||
|
<ul>
|
||||||
|
<li>There is any error of the FAT structure on the volume.</li>
|
||||||
|
<li>Work area (file system object, file object or etc...) is broken by stack overflow or any other application. This is the reason in most case.</li>
|
||||||
|
</ul>
|
||||||
|
</dd>
|
||||||
|
<dt id="nr">FR_NOT_READY</dt>
|
||||||
|
<dd>The disk drive cannot work due to incorrect medium removal or disk_initialize function failed.</dd>
|
||||||
|
<dt id="nf">FR_NO_FILE</dt>
|
||||||
|
<dd>Could not find the file.</dd>
|
||||||
|
<dt id="np">FR_NO_PATH</dt>
|
||||||
|
<dd>Could not find the path.</dd>
|
||||||
|
<dt id="in">FR_INVALID_NAME</dt>
|
||||||
|
<dd>The given string is invalid as the <a href="filename.html">path name</a>.</dd>
|
||||||
|
<dt id="dn">FR_DENIED</dt>
|
||||||
|
<dd>The required access was denied due to one of the following reasons:
|
||||||
|
<ul>
|
||||||
|
<li>Write mode open against the file with read-only attribute.</li>
|
||||||
|
<li>Deleting the file or directory with read-only attribute.</li>
|
||||||
|
<li>Deleting the non-empty directory or current directory.</li>
|
||||||
|
<li>Reading the file opened without FA_READ flag.</li>
|
||||||
|
<li>Any modification to the file opened without FA_WRITE flag.</li>
|
||||||
|
<li>Could not create the file or directory due to the directory table is full.</li>
|
||||||
|
<li>Could not create the directory due to the volume is full.</li>
|
||||||
|
</ul>
|
||||||
|
</dd>
|
||||||
|
<dt id="ex">FR_EXIST</dt>
|
||||||
|
<dd>Any object that has the same name is already existing.</dd>
|
||||||
|
<dt id="io">FR_INVALID_OBJECT</dt>
|
||||||
|
<dd>The given file/directory object structure is invalid.</dd>
|
||||||
|
<dt id="wp">FR_WRITE_PROTECTED</dt>
|
||||||
|
<dd>Any write mode action against write-protected media.</dd>
|
||||||
|
<dt id="id">FR_INVALID_DRIVE</dt>
|
||||||
|
<dd>Invalid drive number is specified. (Related option: _VOLUMES)</dd>
|
||||||
|
<dt id="ne">FR_NOT_ENABLED</dt>
|
||||||
|
<dd>Work area for the logical drive has not been registered by f_mount function.</dd>
|
||||||
|
<dt id="ns">FR_NO_FILESYSTEM</dt>
|
||||||
|
<dd>There is no valid FAT volume on the drive.</dd>
|
||||||
|
<dt id="ma">FR_MKFS_ABORTED</dt>
|
||||||
|
<dd>The f_mkfs function aborted before start in format due to a reason as follows:
|
||||||
|
<ul>
|
||||||
|
<li>The disk size is too small.</li>
|
||||||
|
<li>Not allowable cluster size for this disk. This can occure when number of clusters gets near the 0xFF7 and 0xFFF7.</li>
|
||||||
|
</ul>
|
||||||
|
</dd>
|
||||||
|
<dt id="tm">FR_TIMEOUT</dt>
|
||||||
|
<dd>The function canceled due to a timeout of <a href="appnote.html#reentrant">thread-safe control</a>. (Related option: _TIMEOUT)</dd>
|
||||||
|
<dt id="lo">FR_LOCKED</dt>
|
||||||
|
<dd>The file access is rejected by <a href="appnote.html#dup">file sharing control</a>. (Related option: _FS_SHARE)</dd>
|
||||||
|
<dt id="nc">FR_NOT_ENOUGH_CORE</dt>
|
||||||
|
<dd>Not enough memory for the operation. There is one of the following reasons:
|
||||||
|
<ul>
|
||||||
|
<li>Could not allocate a memory for LFN working buffer. (Related option: _USE_LFN)</li>
|
||||||
|
<li>Given table size is insufficient for the required size.</li>
|
||||||
|
</ul>
|
||||||
|
</dd>
|
||||||
|
<dt id="tf">FR_TOO_MANY_OPEN_FILES</dt>
|
||||||
|
<dd>Number of open files has been reached maximum value and no more file can be opened. (Related option: _FS_SHARE)</dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@ -11,20 +11,20 @@
|
|||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para func">
|
||||||
<h2>f_read</h2>
|
<h2>f_read</h2>
|
||||||
<p>The f_read function reads data from a file.</p>
|
<p>The f_read function reads data from a file.</p>
|
||||||
<pre>
|
<pre>
|
||||||
FRESULT f_read (
|
FRESULT f_read (
|
||||||
FIL* <em>FileObject</em>, <span>/* Pointer to the file object structure */</span>
|
FIL* <em>FileObject</em>, <span class="c">/* Pointer to the file object structure */</span>
|
||||||
void* <em>Buffer</em>, <span>/* Pointer to the buffer to store read data */</span>
|
void* <em>Buffer</em>, <span class="c">/* Pointer to the buffer to store read data */</span>
|
||||||
UINT <em>ByteToRead</em>, <span>/* Number of bytes to read */</span>
|
UINT <em>ByteToRead</em>, <span class="c">/* Number of bytes to read */</span>
|
||||||
UINT* <em>ByteRead</em> <span>/* Pointer to the variable to return number of bytes read */</span>
|
UINT* <em>ByteRead</em> <span class="c">/* Pointer to the variable to return number of bytes read */</span>
|
||||||
);
|
);
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para arg">
|
||||||
<h4>Parameters</h4>
|
<h4>Parameters</h4>
|
||||||
<dl class="par">
|
<dl class="par">
|
||||||
<dt>FileObject</dt>
|
<dt>FileObject</dt>
|
||||||
@ -39,38 +39,32 @@ FRESULT f_read (
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para ret">
|
||||||
<h4>Return Values</h4>
|
<h4>Return Values</h4>
|
||||||
<dl class="ret">
|
<p>
|
||||||
<dt>FR_OK (0)</dt>
|
<a href="rc.html#ok">FR_OK</a>,
|
||||||
<dd>The function succeeded.</dd>
|
<a href="rc.html#de">FR_DISK_ERR</a>,
|
||||||
<dt>FR_DENIED</dt>
|
<a href="rc.html#ie">FR_INT_ERR</a>,
|
||||||
<dd>The function denied due to the file has been opened in non-read mode.</dd>
|
<a href="rc.html#nr">FR_NOT_READY</a>,
|
||||||
<dt>FR_DISK_ERR</dt>
|
<a href="rc.html#io">FR_INVALID_OBJECT</a>,
|
||||||
<dd>The function failed due to an error in the disk function.</dd>
|
<a href="rc.html#tm">FR_TIMEOUT</a>
|
||||||
<dt>FR_INT_ERR</dt>
|
</p>
|
||||||
<dd>The function failed due to a wrong FAT structure or an internal error.</dd>
|
|
||||||
<dt>FR_NOT_READY</dt>
|
|
||||||
<dd>The disk drive cannot work due to no medium in the drive or any other reason.</dd>
|
|
||||||
<dt>FR_INVALID_OBJECT</dt>
|
|
||||||
<dd>The file object is invalid.</dd>
|
|
||||||
</dl>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para desc">
|
||||||
<h4>Description</h4>
|
<h4>Description</h4>
|
||||||
<p>The file pointer of the file object increases in number of bytes read. After the function succeeded, <tt>*ByteRead</tt> should be checked to detect the end of file. In case of <tt>*ByteRead < ByteToRead</tt>, it means the read/write pointer reached end of the file during read operation.</p>
|
<p>The file pointer of the file object increases in number of bytes read. After the function succeeded, <tt>*ByteRead</tt> should be checked to detect the end of file. In case of <tt>*ByteRead < ByteToRead</tt>, it means the read/write pointer reached end of the file during read operation.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para comp">
|
||||||
<h4>QuickInfo</h4>
|
<h4>QuickInfo</h4>
|
||||||
<p>Always available.</p>
|
<p>Always available.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para ref">
|
||||||
<h4>See Also</h4>
|
<h4>See Also</h4>
|
||||||
<p><tt><a href="open.html">f_open</a>, <a href="gets.html">fgets</a>, <a href="write.html">f_write</a>, <a href="close.html">f_close</a>, <a href="sfile.html">FIL</a></tt></p>
|
<p><tt><a href="open.html">f_open</a>, <a href="gets.html">fgets</a>, <a href="write.html">f_write</a>, <a href="close.html">f_close</a>, <a href="sfile.html">FIL</a></tt></p>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -11,18 +11,18 @@
|
|||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para func">
|
||||||
<h2>f_readdir</h2>
|
<h2>f_readdir</h2>
|
||||||
<p>The f_readdir function reads directory entries.</p>
|
<p>The f_readdir function reads directory entries.</p>
|
||||||
<pre>
|
<pre>
|
||||||
FRESULT f_readdir (
|
FRESULT f_readdir (
|
||||||
DIR* <em>DirObject</em>, <span>/* Pointer to the open directory object */</span>
|
DIR* <em>DirObject</em>, <span class="c">/* Pointer to the open directory object */</span>
|
||||||
FILINFO* <em>FileInfo</em> <span>/* Pointer to the file information structure */</span>
|
FILINFO* <em>FileInfo</em> <span class="c">/* Pointer to the file information structure */</span>
|
||||||
);
|
);
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para arg">
|
||||||
<h4>Parameters</h4>
|
<h4>Parameters</h4>
|
||||||
<dl class="par">
|
<dl class="par">
|
||||||
<dt>DirObject</dt>
|
<dt>DirObject</dt>
|
||||||
@ -33,72 +33,71 @@ FRESULT f_readdir (
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para ret">
|
||||||
<h4>Return Values</h4>
|
<h4>Return Values</h4>
|
||||||
<dl class="ret">
|
<p>
|
||||||
<dt>FR_OK (0)</dt>
|
<a href="rc.html#ok">FR_OK</a>,
|
||||||
<dd>The function succeeded.</dd>
|
<a href="rc.html#de">FR_DISK_ERR</a>,
|
||||||
<dt>FR_NOT_READY</dt>
|
<a href="rc.html#ie">FR_INT_ERR</a>,
|
||||||
<dd>The disk drive cannot work due to no medium in the drive or any other reason.</dd>
|
<a href="rc.html#nr">FR_NOT_READY</a>,
|
||||||
<dt>FR_DISK_ERR</dt>
|
<a href="rc.html#io">FR_INVALID_OBJECT</a>,
|
||||||
<dd>The function failed due to an error in the disk function.</dd>
|
<a href="rc.html#tm">FR_TIMEOUT</a>,
|
||||||
<dt>FR_INT_ERR</dt>
|
<a href="rc.html#nc">FR_NOT_ENOUGH_CORE</a>
|
||||||
<dd>The function failed due to a wrong FAT structure or an internal error.</dd>
|
</p>
|
||||||
<dt>FR_INVALID_OBJECT</dt>
|
|
||||||
<dd>The directory object is invalid.</dd>
|
|
||||||
</dl>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para desc">
|
||||||
<h4>Description</h4>
|
<h4>Description</h4>
|
||||||
<p>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 entries have been read and no item to read, the function returns a null string into <tt>f_name[]</tt> member without any error. When a null pointer is given to the <tt>FileInfo</tt>, the read index of the directory object will be rewinded.</p>
|
<p>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 entries have been read and no item to read, the function returns a null string into <tt>f_name[]</tt> member without any error. When a null pointer is given to the <tt>FileInfo</tt>, the read index of the directory object will be rewinded.</p>
|
||||||
<p>When LFN feature is enabled, <tt>lfname</tt> and <tt>lfsize</tt> in the file information structure must be initialized with valid value prior to use the f_readdir function. The <tt>lfname</tt> is a pointer to the string buffer to return the long file name. The <tt>lfsize</tt> is the size of the string buffer in unit of character. If either the size of read buffer or LFN working buffer is insufficient for the LFN or the object has no LFN, a null string will be returned to the LFN read buffer. If the LFN contains any charactrer that cannot be converted to OEM code, a null string will be returned but this is not the case on Unicode API configuration. When <tt>lfname</tt> is a NULL, nothing of the LFN is returned. When the object has no LFN, any small capitals can be contained in the SFN.</p>
|
<p>When LFN feature is enabled, <tt>lfname</tt> and <tt>lfsize</tt> in the file information structure must be initialized with valid value prior to use the f_readdir function. The <tt>lfname</tt> is a pointer to the string buffer to return the long file name. The <tt>lfsize</tt> is the size of the string buffer in unit of TCHAR. If either the size of read buffer or LFN working buffer is insufficient for the LFN or the object has no LFN, a null string will be returned to the LFN read buffer. If the LFN contains any charactrer that cannot be converted to OEM code, a null string will be returned but this is not the case on Unicode API configuration. When <tt>lfname</tt> is a NULL, nothing of the LFN is returned. When the object has no LFN, some small capitals can be contained in the SFN.</p>
|
||||||
<p>When relative path feature is enabled <tt>(_FS_RPATH == 1)</tt>, "." and ".." entries are not filtered out and it will appear in the read entries.</p>
|
<p>When relative path feature is enabled <tt>(_FS_RPATH == 1)</tt>, "." and ".." entries are not filtered out and it will appear in the read entries.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para comp">
|
||||||
<h4>QuickInfo</h4>
|
<h4>QuickInfo</h4>
|
||||||
<p>Available when <tt>_FS_MINIMIZE <= 1</tt>.</p>
|
<p>Available when <tt>_FS_MINIMIZE <= 1</tt>.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para use">
|
||||||
<h4>Sample Code</h4>
|
<h4>Sample Code</h4>
|
||||||
<pre>
|
<pre>
|
||||||
FRESULT scan_files (char* path)
|
FRESULT scan_files (
|
||||||
|
char* path <span class="c">/* Start node to be scanned (also used as work area) */</span>
|
||||||
|
)
|
||||||
{
|
{
|
||||||
FRESULT res;
|
FRESULT res;
|
||||||
FILINFO fno;
|
FILINFO fno;
|
||||||
DIR dir;
|
DIR dir;
|
||||||
int i;
|
int i;
|
||||||
char *fn;
|
char *fn; <span class="c">/* This function is assuming non-Unicode cfg. */</span>
|
||||||
#if _USE_LFN
|
<span class="k">#if</span> _USE_LFN
|
||||||
static char lfn[_MAX_LFN * (_DF1S ? 2 : 1) + 1];
|
static char lfn[_MAX_LFN + 1];
|
||||||
fno.lfname = lfn;
|
fno.lfname = lfn;
|
||||||
fno.lfsize = sizeof(lfn);
|
fno.lfsize = sizeof(lfn);
|
||||||
#endif
|
<span class="k">#endif</span>
|
||||||
|
|
||||||
|
|
||||||
res = f_opendir(&dir, path);
|
res = f_opendir(&dir, path); <span class="c">/* Open the directory */</span>
|
||||||
if (res == FR_OK) {
|
if (res == FR_OK) {
|
||||||
i = strlen(path);
|
i = strlen(path);
|
||||||
for (;;) {
|
for (;;) {
|
||||||
res = f_readdir(&dir, &fno);
|
res = f_readdir(&dir, &fno); <span class="c">/* Read a directory item */</span>
|
||||||
if (res != FR_OK || fno.fname[0] == 0) break;
|
if (res != FR_OK || fno.fname[0] == 0) break; <span class="c">/* Break on error or end of dir */</span>
|
||||||
if (fno.fname[0] == '.') continue;
|
if (fno.fname[0] == '.') continue; <span class="c">/* Ignore dot entry */</span>
|
||||||
#if _USE_LFN
|
<span class="k">#if</span> _USE_LFN
|
||||||
fn = *fno.lfname ? fno.lfname : fno.fname;
|
fn = *fno.lfname ? fno.lfname : fno.fname;
|
||||||
#else
|
<span class="k">#else</span>
|
||||||
fn = fno.fname;
|
fn = fno.fname;
|
||||||
#endif
|
<span class="k">#endif</span>
|
||||||
if (fno.fattrib & AM_DIR) {
|
if (fno.fattrib & AM_DIR) { <span class="c">/* It is a directory */</span>
|
||||||
sprintf(&path[i], "/%s", fn);
|
sprintf(&path[i], "/%s", fn);
|
||||||
res = scan_files(path);
|
res = scan_files(path);
|
||||||
if (res != FR_OK) break;
|
if (res != FR_OK) break;
|
||||||
path[i] = 0;
|
path[i] = 0;
|
||||||
} else {
|
} else { <span class="c">/* It is a file. */</span>
|
||||||
printf("%s/%s\n", path, fn);
|
printf("%s/%s\n", path, fn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -110,7 +109,7 @@ FRESULT scan_files (char* path)
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para ref">
|
||||||
<h4>See Also</h4>
|
<h4>See Also</h4>
|
||||||
<p><tt><a href="opendir.html">f_opendir</a>, <a href="stat.html">f_stat</a>, <a href="sfileinfo.html">FILINFO</a>, <a href="sdir.html">DIR</a></tt></p>
|
<p><tt><a href="opendir.html">f_opendir</a>, <a href="stat.html">f_stat</a>, <a href="sfileinfo.html">FILINFO</a>, <a href="sdir.html">DIR</a></tt></p>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -11,18 +11,18 @@
|
|||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para func">
|
||||||
<h2>f_rename</h2>
|
<h2>f_rename</h2>
|
||||||
<p>Renames an object.</p>
|
<p>Renames an object.</p>
|
||||||
<pre>
|
<pre>
|
||||||
FRESULT f_rename (
|
FRESULT f_rename (
|
||||||
const TCHAR* <em>OldName</em>, <span>/* Pointer to old object name */</span>
|
const TCHAR* <em>OldName</em>, <span class="c">/* Pointer to old object name */</span>
|
||||||
const TCHAR* <em>NewName</em> <span>/* Pointer to new object name */</span>
|
const TCHAR* <em>NewName</em> <span class="c">/* Pointer to new object name */</span>
|
||||||
);
|
);
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para arg">
|
||||||
<h4>Parameters</h4>
|
<h4>Parameters</h4>
|
||||||
<dl class="par">
|
<dl class="par">
|
||||||
<dt>OldName</dt>
|
<dt>OldName</dt>
|
||||||
@ -33,60 +33,48 @@ FRESULT f_rename (
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para ret">
|
||||||
<h4>Return Values</h4>
|
<h4>Return Values</h4>
|
||||||
<dl class="ret">
|
<p>
|
||||||
<dt>FR_OK (0)</dt>
|
<a href="rc.html#ok">FR_OK</a>,
|
||||||
<dd>The function succeeded.</dd>
|
<a href="rc.html#de">FR_DISK_ERR</a>,
|
||||||
<dt>FR_NO_FILE</dt>
|
<a href="rc.html#ie">FR_INT_ERR</a>,
|
||||||
<dd>Could not find the old name.</dd>
|
<a href="rc.html#nr">FR_NOT_READY</a>,
|
||||||
<dt>FR_NO_PATH</dt>
|
<a href="rc.html#ok">FR_NO_FILE</a>,
|
||||||
<dd>Could not find the path.</dd>
|
<a href="rc.html#np">FR_NO_PATH</a>,
|
||||||
<dt>FR_INVALID_NAME</dt>
|
<a href="rc.html#in">FR_INVALID_NAME</a>,
|
||||||
<dd>The file name is invalid.</dd>
|
<a href="rc.html#de">FR_DENIED</a>,
|
||||||
<dt>FR_INVALID_DRIVE</dt>
|
<a href="rc.html#ex">FR_EXIST</a>,
|
||||||
<dd>The drive number is invalid.</dd>
|
<a href="rc.html#wp">FR_WRITE_PROTECTED</a>,
|
||||||
<dt>FR_NOT_READY</dt>
|
<a href="rc.html#id">FR_INVALID_DRIVE</a>,
|
||||||
<dd>The disk drive cannot work due to no medium in the drive or any other reason.</dd>
|
<a href="rc.html#ne">FR_NOT_ENABLED</a>,
|
||||||
<dt>FR_EXIST</dt>
|
<a href="rc.html#ns">FR_NO_FILESYSTEM</a>,
|
||||||
<dd>The new name is colliding with an existing name.</dd>
|
<a href="rc.html#tm">FR_TIMEOUT</a>,
|
||||||
<dt>FR_DENIED</dt>
|
<a href="rc.html#lo">FR_LOCKED</a>,
|
||||||
<dd>The new name could not be created due to any reason.</dd>
|
<a href="rc.html#nc">FR_NOT_ENOUGH_CORE</a>
|
||||||
<dt>FR_WRITE_PROTECTED</dt>
|
</p>
|
||||||
<dd>The medium is write protected.</dd>
|
|
||||||
<dt>FR_DISK_ERR</dt>
|
|
||||||
<dd>The function failed due to an error in the disk function.</dd>
|
|
||||||
<dt>FR_INT_ERR</dt>
|
|
||||||
<dd>The function failed due to a wrong FAT structure or an internal error.</dd>
|
|
||||||
<dt>FR_NOT_ENABLED</dt>
|
|
||||||
<dd>The logical drive has no work area.</dd>
|
|
||||||
<dt>FR_NO_FILESYSTEM</dt>
|
|
||||||
<dd>There is no valid FAT volume on the drive.</dd>
|
|
||||||
<dt>FR_LOCKED</dt>
|
|
||||||
<dd>The function was rejected due to file shareing policy (_FS_SHARE).</dd>
|
|
||||||
</dl>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para desc">
|
||||||
<h4>Description</h4>
|
<h4>Description</h4>
|
||||||
<p>Renames an object (file or directory) and can also move it to other directory. The logical drive number is determined by old name, new name must not contain a logical drive number. <em>Do not rename open objects</em>.</p>
|
<p>Renames an object (file or directory) and can also move it to other directory. The logical drive number is determined by old name, new name must not contain a logical drive number. <em>Do not rename open objects</em>.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para comp">
|
||||||
<h4>QuickInfo</h4>
|
<h4>QuickInfo</h4>
|
||||||
<p>Available when <tt>_FS_READONLY == 0</tt> and <tt>_FS_MINIMIZE == 0</tt>.</p>
|
<p>Available when <tt>_FS_READONLY == 0</tt> and <tt>_FS_MINIMIZE == 0</tt>.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para use">
|
||||||
<h4>Example</h4>
|
<h4>Example</h4>
|
||||||
<pre>
|
<pre>
|
||||||
<span>/* Rename an object */</span>
|
<span class="c">/* Rename an object */</span>
|
||||||
f_rename("oldname.txt", "newname.txt");
|
f_rename("oldname.txt", "newname.txt");
|
||||||
|
|
||||||
<span>/* Rename and move an object to other directory */</span>
|
<span class="c">/* Rename and move an object to other directory */</span>
|
||||||
f_rename("oldname.txt", "dir1/newname.txt");
|
f_rename("oldname.txt", "dir1/newname.txt");
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -15,19 +15,19 @@
|
|||||||
<h2>DIR</h2>
|
<h2>DIR</h2>
|
||||||
<p>The <tt>DIR</tt> structure is used for the work area to read a directory by f_oepndir, f_readdir function. There is no member that can be changed by application.</p>
|
<p>The <tt>DIR</tt> structure is used for the work area to read a directory by f_oepndir, f_readdir function. There is no member that can be changed by application.</p>
|
||||||
<pre>
|
<pre>
|
||||||
typedef struct {
|
<span class="k">typedef</span> <span class="k">struct</span> {
|
||||||
FATFS* fs; <span>/* Pointer to the owner file system object */</span>
|
FATFS* fs; <span class="c">/* Pointer to the owner file system object */</span>
|
||||||
WORD id; <span>/* Owner file system mount ID */</span>
|
WORD id; <span class="c">/* Owner file system mount ID */</span>
|
||||||
WORD index; <span>/* Directory index number to be read/write next */</span>
|
WORD index; <span class="c">/* Directory index number to be read/write next */</span>
|
||||||
DWORD sclust; <span>/* Table start cluster (0:Root dir) */</span>
|
DWORD sclust; <span class="c">/* Table start cluster (0:Root dir) */</span>
|
||||||
DWORD clust; <span>/* Current cluster */</span>
|
DWORD clust; <span class="c">/* Current cluster */</span>
|
||||||
DWORD sect; <span>/* Current sector */</span>
|
DWORD sect; <span class="c">/* Current sector */</span>
|
||||||
BYTE* dir; <span>/* Pointer to the current SFN entry in the win[] */</span>
|
BYTE* dir; <span class="c">/* Pointer to the current SFN entry in the win[] */</span>
|
||||||
BYTE* fn; <span>/* Pointer to the SFN (in/out) {file[8],ext[3],status[1]} */</span>
|
BYTE* fn; <span class="c">/* Pointer to the SFN (in/out) {file[8],ext[3],status[1]} */</span>
|
||||||
#if _USE_LFN
|
<span class="k">#if</span> _USE_LFN
|
||||||
WCHAR* lfn; <span>/* Pointer to the LFN working buffer */</span>
|
WCHAR* lfn; <span class="c">/* Pointer to the LFN working buffer */</span>
|
||||||
WORD lfn_idx; <span>/* Last matched LFN index (0xFFFF:No LFN) */</span>
|
WORD lfn_idx; <span class="c">/* Last matched LFN index (0xFFFF:No LFN) */</span>
|
||||||
#endif
|
<span class="k">#endif</span>
|
||||||
} DIR;
|
} DIR;
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -13,38 +13,38 @@
|
|||||||
|
|
||||||
<div class="para">
|
<div class="para">
|
||||||
<h2>FATFS</h2>
|
<h2>FATFS</h2>
|
||||||
<p>The <tt>FATFS</tt> 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.</p>
|
<p>The <tt>FATFS</tt> structure (file system object) holds dynamic work area of individual logical drives. It is given by application program and registerd/unregisterd to the FatFs module with f_mount function. Initialization is done on first file access after f_mount or media change. There is no member that can be changed from the application program.</p>
|
||||||
<pre>
|
<pre>
|
||||||
typedef struct {
|
<span class="k">typedef</span> <span class="k">struct</span> {
|
||||||
BYTE fs_type; <span>/* FAT sub-type (0:Not mounted) */</span>
|
BYTE fs_type; <span class="c">/* FAT sub-type (0:Not mounted) */</span>
|
||||||
BYTE drv; <span>/* Physical drive number */</span>
|
BYTE drv; <span class="c">/* Physical drive number */</span>
|
||||||
BYTE csize; <span>/* Sectors per cluster (1,2,4...128) */</span>
|
BYTE csize; <span class="c">/* Sectors per cluster (1,2,4...128) */</span>
|
||||||
BYTE n_fats; <span>/* Number of FAT copies (1,2) */</span>
|
BYTE n_fats; <span class="c">/* Number of FAT copies (1,2) */</span>
|
||||||
BYTE wflag; <span>/* win[] dirty flag */</span>
|
BYTE wflag; <span class="c">/* win[] dirty flag */</span>
|
||||||
BYTE fsi_flag; <span>/* fsinfo dirty flag */</span>
|
BYTE fsi_flag; <span class="c">/* fsinfo dirty flag */</span>
|
||||||
WORD id; <span>/* File system mount ID */</span>
|
WORD id; <span class="c">/* File system mount ID */</span>
|
||||||
WORD n_rootdir; <span>/* Number of root directory entries (FAT12/16) */</span>
|
WORD n_rootdir; <span class="c">/* Number of root directory entries (FAT12/16) */</span>
|
||||||
#if _MAX_SS != 512
|
<span class="k">#if</span> _MAX_SS != 512
|
||||||
WORD ssize; <span>/* Sector size (512,1024,2048,4096) */</span>
|
WORD ssize; <span class="c">/* Sector size (512,1024,2048,4096) */</span>
|
||||||
#endif
|
<span class="k">#endif</span>
|
||||||
#if _FS_REENTRANT
|
<span class="k">#if</span> _FS_REENTRANT
|
||||||
_SYNC_t sobj; <span>/* Identifier of sync object */</span>
|
_SYNC_t sobj; <span class="c">/* Identifier of sync object */</span>
|
||||||
#endif
|
<span class="k">#endif</span>
|
||||||
#if !_FS_READONLY
|
<span class="k">#if</span> !_FS_READONLY
|
||||||
DWORD last_clust; <span>/* Last allocated cluster */</span>
|
DWORD last_clust; <span class="c">/* Last allocated cluster */</span>
|
||||||
DWORD free_clust; <span>/* Number of free clusters */</span>
|
DWORD free_clust; <span class="c">/* Number of free clusters */</span>
|
||||||
DWORD fsi_sector; <span>/* fsinfo sector (FAT32) */</span>
|
DWORD fsi_sector; <span class="c">/* fsinfo sector (FAT32) */</span>
|
||||||
#endif
|
<span class="k">#endif</span>
|
||||||
#if _FS_RPATH
|
<span class="k">#if</span> _FS_RPATH
|
||||||
DWORD cdir; <span>/* Current directory cluster (0:root) */</span>
|
DWORD cdir; <span class="c">/* Current directory cluster (0:root) */</span>
|
||||||
#endif
|
<span class="k">#endif</span>
|
||||||
DWORD n_fatent; <span>/* Number of FAT entries (= number of clusters + 2) */</span>
|
DWORD n_fatent; <span class="c">/* Number of FAT entries (= number of clusters + 2) */</span>
|
||||||
DWORD fsize; <span>/* Sectors per FAT */</span>
|
DWORD fsize; <span class="c">/* Sectors per FAT */</span>
|
||||||
DWORD fatbase; <span>/* FAT area start sector */</span>
|
DWORD fatbase; <span class="c">/* FAT area start sector */</span>
|
||||||
DWORD dirbase; <span>/* Root directory area start sector (FAT32: cluster#) */</span>
|
DWORD dirbase; <span class="c">/* Root directory area start sector (FAT32: cluster#) */</span>
|
||||||
DWORD database; <span>/* Data area start sector */</span>
|
DWORD database; <span class="c">/* Data area start sector */</span>
|
||||||
DWORD winsect; <span>/* Current sector appearing in the win[] */</span>
|
DWORD winsect; <span class="c">/* Current sector appearing in the win[] */</span>
|
||||||
BYTE win[_MAX_SS]; <span>/* Disk access window for Directory, FAT (and Data on tiny cfg) */</span>
|
BYTE win[_MAX_SS]; <span class="c">/* Disk access window for Directory, FAT (and Data on tiny cfg) */</span>
|
||||||
} FATFS;
|
} FATFS;
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -16,29 +16,29 @@
|
|||||||
<p>The FIL structure (file object) holds state of an open 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 except for <tt>cltbl</tt>. Note that a sector buffer is defined in this structure under non-tiny configuration so that the FIL structures should not be defined as auto variable.</p>
|
<p>The FIL structure (file object) holds state of an open 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 except for <tt>cltbl</tt>. Note that a sector buffer is defined in this structure under non-tiny configuration so that the FIL structures should not be defined as auto variable.</p>
|
||||||
|
|
||||||
<pre>
|
<pre>
|
||||||
typedef struct {
|
<span class="k">typedef</span> <span class="k">struct</span> {
|
||||||
FATFS* fs; <span>/* Pointer to the owner file system object */</span>
|
FATFS* fs; <span class="c">/* Pointer to the owner file system object */</span>
|
||||||
WORD id; <span>/* Owner file system mount ID */</span>
|
WORD id; <span class="c">/* Owner file system mount ID */</span>
|
||||||
BYTE flag; <span>/* File status flags */</span>
|
BYTE flag; <span class="c">/* File status flags */</span>
|
||||||
BYTE pad1;
|
BYTE pad1;
|
||||||
DWORD fptr; <span>/* File read/write pointer (Byte offset origin from top of the file) */</span>
|
DWORD fptr; <span class="c">/* File read/write pointer (Byte offset origin from top of the file) */</span>
|
||||||
DWORD fsize; <span>/* File size */</span>
|
DWORD fsize; <span class="c">/* File size */</span>
|
||||||
DWORD org_clust; <span>/* File start cluster */</span>
|
DWORD sclust; <span class="c">/* File start cluster */</span>
|
||||||
DWORD curr_clust; <span>/* Current cluster */</span>
|
DWORD clust; <span class="c">/* Current cluster */</span>
|
||||||
DWORD dsect; <span>/* Current data sector */</span>
|
DWORD dsect; <span class="c">/* Current data sector */</span>
|
||||||
#if !_FS_READONLY
|
<span class="k">#if</span> !_FS_READONLY
|
||||||
DWORD dir_sect; <span>/* Sector containing the directory entry */</span>
|
DWORD dir_sect; <span class="c">/* Sector containing the directory entry */</span>
|
||||||
BYTE* dir_ptr; <span>/* Ponter to the directory entry in the window */</span>
|
BYTE* dir_ptr; <span class="c">/* Ponter to the directory entry in the window */</span>
|
||||||
#endif
|
<span class="k">#endif</span>
|
||||||
#if _USE_FASTSEEK
|
<span class="k">#if</span> _USE_FASTSEEK
|
||||||
DWORD* cltbl; <span>/* Pointer to the cluster link map table (Nulled on file open) */</span>
|
DWORD* cltbl; <span class="c">/* Pointer to the cluster link map table (Nulled on file open) */</span>
|
||||||
#endif
|
<span class="k">#endif</span>
|
||||||
#if _FS_SHARE
|
<span class="k">#if</span> _FS_SHARE
|
||||||
UINT lockid; <span>/* File lock ID */</span>
|
UINT lockid; <span class="c">/* File lock ID */</span>
|
||||||
#endif
|
<span class="k">#endif</span>
|
||||||
#if !_FS_TINY
|
<span class="k">#if</span> !_FS_TINY
|
||||||
BYTE buf[_MAX_SS]; <span>/* Data read/write buffer */</span>
|
BYTE buf[_MAX_SS]; <span class="c">/* Data read/write buffer */</span>
|
||||||
#endif
|
<span class="k">#endif</span>
|
||||||
} FIL;
|
} FIL;
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
|
|||||||
@ -15,16 +15,16 @@
|
|||||||
<h2>FILINFO</h2>
|
<h2>FILINFO</h2>
|
||||||
<p>The <tt>FILINFO</tt> structure holds a file information returned by f_stat and f_readdir function.</p>
|
<p>The <tt>FILINFO</tt> structure holds a file information returned by f_stat and f_readdir function.</p>
|
||||||
<pre>
|
<pre>
|
||||||
typedef struct {
|
<span class="k">typedef struct</span> {
|
||||||
DWORD fsize; <span>/* File size */</span>
|
DWORD fsize; <span class="c">/* File size */</span>
|
||||||
WORD fdate; <span>/* Last modified date */</span>
|
WORD fdate; <span class="c">/* Last modified date */</span>
|
||||||
WORD ftime; <span>/* Last modified time */</span>
|
WORD ftime; <span class="c">/* Last modified time */</span>
|
||||||
BYTE fattrib; <span>/* Attribute */</span>
|
BYTE fattrib; <span class="c">/* Attribute */</span>
|
||||||
TCHAR fname[13]; <span>/* Short file name (8.3 format) */</span>
|
TCHAR fname[13]; <span class="c">/* Short file name (8.3 format) */</span>
|
||||||
#if _USE_LFN
|
<span class="k">#if</span> _USE_LFN
|
||||||
TCHAR* lfname; <span>/* Pointer to the LFN buffer */</span>
|
TCHAR* lfname; <span class="c">/* Pointer to the LFN buffer */</span>
|
||||||
int lfsize; <span>/* Size of the LFN buffer in unit of TCHAR */</span>
|
int lfsize; <span class="c">/* Size of the LFN buffer in unit of TCHAR */</span>
|
||||||
#endif
|
<span class="k">#endif</span>
|
||||||
} FILINFO;
|
} FILINFO;
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
@ -32,7 +32,7 @@ typedef struct {
|
|||||||
<h4>Members</h4>
|
<h4>Members</h4>
|
||||||
<dl>
|
<dl>
|
||||||
<dt>fsize</dt>
|
<dt>fsize</dt>
|
||||||
<dd>Indicates size of the file in unit of byte. This is always zero when it is a directory.</dd>
|
<dd>Indicates size of the file in unit of byte. Always zero for directories.</dd>
|
||||||
<dt>fdate</dt>
|
<dt>fdate</dt>
|
||||||
<dd>Indicates the date that the file was modified or the directory was created.<br>
|
<dd>Indicates the date that the file was modified or the directory was created.<br>
|
||||||
<dl>
|
<dl>
|
||||||
@ -62,7 +62,7 @@ typedef struct {
|
|||||||
<dt>lfname</dt>
|
<dt>lfname</dt>
|
||||||
<dd>Pointer to the LFN buffer to store the read LFN. This member must be initialized by application prior to use this structure. Not available on non-LFN configuration.</dd>
|
<dd>Pointer to the LFN buffer to store the read LFN. This member must be initialized by application prior to use this structure. Not available on non-LFN configuration.</dd>
|
||||||
<dt>lfsize</dt>
|
<dt>lfsize</dt>
|
||||||
<dd>Size of the LFN buffer in unit of chars. This member must be initialized by application prior to use this structure. Not available on non-LFN configuration.</dd>
|
<dd>Size of the LFN buffer in unit of TCHAR. This member must be initialized by application prior to use this structure. Not available on non-LFN configuration.</dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
<p class="foot"><a href="../00index_e.html">Return</a></p>
|
<p class="foot"><a href="../00index_e.html">Return</a></p>
|
||||||
|
|||||||
62
doc/en/size.html
Normal file
62
doc/en/size.html
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||||
|
<meta http-equiv="Content-Style-Type" content="text/css">
|
||||||
|
<link rel="up" title="FatFs" href="../00index_e.html">
|
||||||
|
<link rel="alternate" hreflang="ja" title="Japanese" href="../ja/size.html">
|
||||||
|
<link rel="stylesheet" href="../css_e.css" type="text/css" media="screen" title="ELM Default">
|
||||||
|
<title>FatFs - f_size</title>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<div class="para func">
|
||||||
|
<h2>f_size</h2>
|
||||||
|
<p>The f_size function gets the size of a file.</p>
|
||||||
|
<pre>
|
||||||
|
DWORD f_size (
|
||||||
|
FIL* <em>FileObject</em> <span class="c">/* File object */</span>
|
||||||
|
);
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="para arg">
|
||||||
|
<h4>Parameters</h4>
|
||||||
|
<dl class="par">
|
||||||
|
<dt>FileObject</dt>
|
||||||
|
<dd>Pointer to the open file object structure.</dd>
|
||||||
|
</dl>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="para ret">
|
||||||
|
<h4>Return Values</h4>
|
||||||
|
<p>Returns the size of the file in unit of byte.</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="para desc">
|
||||||
|
<h4>Description</h4>
|
||||||
|
<p>In this revision, the f_size function is implemented as a macro.</p>
|
||||||
|
<pre>
|
||||||
|
<span class="k">#define</span> f_size(fp) ((fp)->fsize)
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="para comp">
|
||||||
|
<h4>QuickInfo</h4>
|
||||||
|
<p>Always available.</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="para ref">
|
||||||
|
<h4>See Also</h4>
|
||||||
|
<p><tt><a href="open.html">f_open</a>, <a href="lseek.html">f_lseek</a>, <a href="sfile.html">FIL</a></tt></p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p class="foot"><a href="../00index_e.html">Return</a></p>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@ -11,18 +11,18 @@
|
|||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para func">
|
||||||
<h2>f_stat</h2>
|
<h2>f_stat</h2>
|
||||||
<p>The f_stat gets the file status.</p>
|
<p>The f_stat gets the file status.</p>
|
||||||
<pre>
|
<pre>
|
||||||
FRESULT f_stat (
|
FRESULT f_stat (
|
||||||
const TCHAR* <em>FileName</em>, <span>/* Pointer to the file or directory name */</span>
|
const TCHAR* <em>FileName</em>, <span class="c">/* Pointer to the file or directory name */</span>
|
||||||
FILINFO* <em>FileInfo</em> <span>/* Pointer to the FILINFO structure */</span>
|
FILINFO* <em>FileInfo</em> <span class="c">/* Pointer to the FILINFO structure */</span>
|
||||||
);
|
);
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para arg">
|
||||||
<h4>Parameters</h4>
|
<h4>Parameters</h4>
|
||||||
<dl class="par">
|
<dl class="par">
|
||||||
<dt>FileName</dt>
|
<dt>FileName</dt>
|
||||||
@ -33,40 +33,32 @@ FRESULT f_stat (
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para ret">
|
||||||
<h4>Return Values</h4>
|
<h4>Return Values</h4>
|
||||||
<dl class="ret">
|
<p>
|
||||||
<dt>FR_OK (0)</dt>
|
<a href="rc.html#ok">FR_OK</a>,
|
||||||
<dd>The function succeeded.</dd>
|
<a href="rc.html#de">FR_DISK_ERR</a>,
|
||||||
<dt>FR_NO_FILE</dt>
|
<a href="rc.html#ie">FR_INT_ERR</a>,
|
||||||
<dd>Could not find the file or directory.</dd>
|
<a href="rc.html#nr">FR_NOT_READY</a>,
|
||||||
<dt>FR_NO_PATH</dt>
|
<a href="rc.html#ok">FR_NO_FILE</a>,
|
||||||
<dd>Could not find the path.</dd>
|
<a href="rc.html#np">FR_NO_PATH</a>,
|
||||||
<dt>FR_INVALID_NAME</dt>
|
<a href="rc.html#in">FR_INVALID_NAME</a>,
|
||||||
<dd>The file name is invalid.</dd>
|
<a href="rc.html#id">FR_INVALID_DRIVE</a>,
|
||||||
<dt>FR_INVALID_DRIVE</dt>
|
<a href="rc.html#ne">FR_NOT_ENABLED</a>,
|
||||||
<dd>The drive number is invalid.</dd>
|
<a href="rc.html#ns">FR_NO_FILESYSTEM</a>,
|
||||||
<dt>FR_NOT_READY</dt>
|
<a href="rc.html#tm">FR_TIMEOUT</a>,
|
||||||
<dd>The disk drive cannot work due to no medium in the drive or any other reason.</dd>
|
<a href="rc.html#nc">FR_NOT_ENOUGH_CORE</a>
|
||||||
<dt>FR_DISK_ERR</dt>
|
</p>
|
||||||
<dd>The function failed due to an error in the disk function.</dd>
|
|
||||||
<dt>FR_INT_ERR</dt>
|
|
||||||
<dd>The function failed due to a wrong FAT structure or an internal error.</dd>
|
|
||||||
<dt>FR_NOT_ENABLED</dt>
|
|
||||||
<dd>The logical drive has no work area.</dd>
|
|
||||||
<dt>FR_NO_FILESYSTEM</dt>
|
|
||||||
<dd>There is no valid FAT volume on the drive.</dd>
|
|
||||||
</dl>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para desc">
|
||||||
<h4>Description</h4>
|
<h4>Description</h4>
|
||||||
<p>The f_stat gets the information of a file or directory. For details of the infomation, refer to the <tt>FILINFO</tt> structure and <a href="readdir.html">f_readdir</a> function. This function is not supported in minimization level of >= 1.</p>
|
<p>The f_stat gets the information of a file or directory. For details of the infomation, refer to the <tt>FILINFO</tt> structure and <a href="readdir.html">f_readdir</a> function. This function is not supported in minimization level of >= 1.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para ref">
|
||||||
<h4>References</h4>
|
<h4>References</h4>
|
||||||
<p><tt><a href="opendir.html">f_opendir</a>, <a href="readdir.html">f_readdir</a>, <a href="sfileinfo.html">FILINFO</a></tt></p>
|
<p><tt><a href="opendir.html">f_opendir</a>, <a href="readdir.html">f_readdir</a>, <a href="sfileinfo.html">FILINFO</a></tt></p>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -11,17 +11,17 @@
|
|||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para func">
|
||||||
<h2>f_sync</h2>
|
<h2>f_sync</h2>
|
||||||
<p>The f_sync function flushes the cached information of a writing file.</p>
|
<p>The f_sync function flushes the cached information of a writing file.</p>
|
||||||
<pre>
|
<pre>
|
||||||
FRESULT f_sync (
|
FRESULT f_sync (
|
||||||
FIL* <em>FileObject</em> <span>/* Pointer to the file object */</span>
|
FIL* <em>FileObject</em> <span class="c">/* Pointer to the file object */</span>
|
||||||
);
|
);
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para arg">
|
||||||
<h4>Parameter</h4>
|
<h4>Parameter</h4>
|
||||||
<dl class="par">
|
<dl class="par">
|
||||||
<dt>FileObject</dt>
|
<dt>FileObject</dt>
|
||||||
@ -30,36 +30,32 @@ FRESULT f_sync (
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para ret">
|
||||||
<h4>Return Values</h4>
|
<h4>Return Values</h4>
|
||||||
<dl class="ret">
|
<p>
|
||||||
<dt>FR_OK (0)</dt>
|
<a href="rc.html#ok">FR_OK</a>,
|
||||||
<dd>The function succeeded.</dd>
|
<a href="rc.html#de">FR_DISK_ERR</a>,
|
||||||
<dt>FR_DISK_ERR</dt>
|
<a href="rc.html#ie">FR_INT_ERR</a>,
|
||||||
<dd>The function failed due to an error in the disk function.</dd>
|
<a href="rc.html#nr">FR_NOT_READY</a>,
|
||||||
<dt>FR_INT_ERR</dt>
|
<a href="rc.html#io">FR_INVALID_OBJECT</a>,
|
||||||
<dd>The function failed due to a wrong FAT structure or an internal error.</dd>
|
<a href="rc.html#tm">FR_TIMEOUT</a>
|
||||||
<dt>FR_NOT_READY</dt>
|
</p>
|
||||||
<dd>The disk drive cannot work due to no medium in the drive or any other reason.</dd>
|
|
||||||
<dt>FR_INVALID_OBJECT</dt>
|
|
||||||
<dd>The file object is invalid.</dd>
|
|
||||||
</dl>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para desc">
|
||||||
<h4>Description</h4>
|
<h4>Description</h4>
|
||||||
<p>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 the applications that open files for a long time in write mode, such as data logger. Performing f_sync of periodic or immediataly after f_write can minimize the risk of data loss due to a sudden blackout or an unintentional disk removal. However f_sync immediataly before f_close has no advantage because f_close performs f_sync in it. In other words, the differnce between those functions is that the file object is invalidated or not. </p>
|
<p>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 the applications that open files for a long time in write mode, such as data logger. Performing f_sync of periodic or immediataly after f_write can minimize the risk of data loss due to a sudden blackout or an unintentional disk removal. However f_sync immediataly before f_close has no advantage because f_close performs f_sync in it. In other words, the differnce between those functions is that the file object is invalidated or not. </p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para comp">
|
||||||
<h4>QuickInfo</h4>
|
<h4>QuickInfo</h4>
|
||||||
<p>Available when <tt>_FS_READONLY == 0</tt>.</p>
|
<p>Available when <tt>_FS_READONLY == 0</tt>.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para ref">
|
||||||
<h4>See Also</h4>
|
<h4>See Also</h4>
|
||||||
<p><tt><a href="close.html">f_close</a></tt></p>
|
<p><tt><a href="close.html">f_close</a></tt></p>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
62
doc/en/tell.html
Normal file
62
doc/en/tell.html
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||||
|
<meta http-equiv="Content-Style-Type" content="text/css">
|
||||||
|
<link rel="up" title="FatFs" href="../00index_e.html">
|
||||||
|
<link rel="alternate" hreflang="ja" title="Japanese" href="../ja/tell.html">
|
||||||
|
<link rel="stylesheet" href="../css_e.css" type="text/css" media="screen" title="ELM Default">
|
||||||
|
<title>FatFs - f_tell</title>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<div class="para func">
|
||||||
|
<h2>f_tell</h2>
|
||||||
|
<p>The f_tell function gets the current read/write pointer of a file.</p>
|
||||||
|
<pre>
|
||||||
|
DWORD f_tell (
|
||||||
|
FIL* <em>FileObject</em> <span class="c">/* File object */</span>
|
||||||
|
);
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="para arg">
|
||||||
|
<h4>Parameters</h4>
|
||||||
|
<dl class="par">
|
||||||
|
<dt>FileObject</dt>
|
||||||
|
<dd>Pointer to the open file object structure.</dd>
|
||||||
|
</dl>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="para ret">
|
||||||
|
<h4>Return Values</h4>
|
||||||
|
<p>Returns current read/write pointer of the file.</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="para desc">
|
||||||
|
<h4>Description</h4>
|
||||||
|
<p>In this revision, the f_tell function is implemented as a macro.</p>
|
||||||
|
<pre>
|
||||||
|
<span class="k">#define</span> f_tell(fp) ((fp)->fptr)
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="para comp">
|
||||||
|
<h4>QuickInfo</h4>
|
||||||
|
<p>Always available.</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="para ref">
|
||||||
|
<h4>See Also</h4>
|
||||||
|
<p><tt><a href="open.html">f_open</a>, <a href="lseek.html">f_lseek</a>, <a href="sfile.html">FIL</a></tt></p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p class="foot"><a href="../00index_e.html">Return</a></p>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@ -11,17 +11,17 @@
|
|||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para func">
|
||||||
<h2>f_truncate</h2>
|
<h2>f_truncate</h2>
|
||||||
<p>The f_truncate function truncates the file size.</p>
|
<p>The f_truncate function truncates the file size.</p>
|
||||||
<pre>
|
<pre>
|
||||||
FRESULT f_truncate (
|
FRESULT f_truncate (
|
||||||
FIL* <em>FileObject</em> <span>/* Pointer to the file object */</span>
|
FIL* <em>FileObject</em> <span class="c">/* Pointer to the file object */</span>
|
||||||
);
|
);
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para arg">
|
||||||
<h4>Parameter</h4>
|
<h4>Parameter</h4>
|
||||||
<dl class="par">
|
<dl class="par">
|
||||||
<dt>FileObject</dt>
|
<dt>FileObject</dt>
|
||||||
@ -30,38 +30,32 @@ FRESULT f_truncate (
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para ret">
|
||||||
<h4>Return Values</h4>
|
<h4>Return Values</h4>
|
||||||
<dl class="ret">
|
<p>
|
||||||
<dt>FR_OK (0)</dt>
|
<a href="rc.html#ok">FR_OK</a>,
|
||||||
<dd>The function succeeded.</dd>
|
<a href="rc.html#de">FR_DISK_ERR</a>,
|
||||||
<dt>FR_DENIED</dt>
|
<a href="rc.html#ie">FR_INT_ERR</a>,
|
||||||
<dd>The file has been opened in read-only mode.</dd>
|
<a href="rc.html#nr">FR_NOT_READY</a>,
|
||||||
<dt>FR_DISK_ERR</dt>
|
<a href="rc.html#io">FR_INVALID_OBJECT</a>,
|
||||||
<dd>The function failed due to an error in the disk function.</dd>
|
<a href="rc.html#tm">FR_TIMEOUT</a>
|
||||||
<dt>FR_INT_ERR</dt>
|
</p>
|
||||||
<dd>The function failed due to a wrong FAT structure or an internal error.</dd>
|
|
||||||
<dt>FR_NOT_READY</dt>
|
|
||||||
<dd>The disk drive cannot work due to no medium in the drive or any other reason.</dd>
|
|
||||||
<dt>FR_INVALID_OBJECT</dt>
|
|
||||||
<dd>The file object is invalid.</dd>
|
|
||||||
</dl>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para desc">
|
||||||
<h4>Description</h4>
|
<h4>Description</h4>
|
||||||
<p>The f_truncate function truncates the file size to the current file read/write point. This function has no effect if the file read/write pointer is already pointing end of the file.</p>
|
<p>The f_truncate function truncates the file size to the current file read/write point. This function has no effect if the file read/write pointer is already pointing end of the file.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para comp">
|
||||||
<h4>QuickInfo</h4>
|
<h4>QuickInfo</h4>
|
||||||
<p>Available when <tt>_FS_READONLY == 0</tt> and <tt>_FS_MINIMIZE == 0</tt>.</p>
|
<p>Available when <tt>_FS_READONLY == 0</tt> and <tt>_FS_MINIMIZE == 0</tt>.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para ref">
|
||||||
<h4>See Also</h4>
|
<h4>See Also</h4>
|
||||||
<p><tt><a href="open.html">f_open</a>, <a href="lseek.html">f_lseek</a>, <a href="sfile.html">FIL</a></tt></p>
|
<p><tt><a href="open.html">f_open</a>, <a href="lseek.html">f_lseek</a>, <a href="sfile.html">FIL</a></tt></p>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -11,17 +11,17 @@
|
|||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para func">
|
||||||
<h2>f_unlink</h2>
|
<h2>f_unlink</h2>
|
||||||
<p>The f_unlink function removes an object.</p>
|
<p>The f_unlink function removes a file or directory.</p>
|
||||||
<pre>
|
<pre>
|
||||||
FRESULT f_unlink (
|
FRESULT f_unlink (
|
||||||
const TCHAR* <em>FileName</em> <span>/* Pointer to the object name */</span>
|
const TCHAR* <em>FileName</em> <span class="c">/* Pointer to the object name */</span>
|
||||||
);
|
);
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para arg">
|
||||||
<h4>Parameter</h4>
|
<h4>Parameter</h4>
|
||||||
<dl class="par">
|
<dl class="par">
|
||||||
<dt>FileName</dt>
|
<dt>FileName</dt>
|
||||||
@ -30,47 +30,42 @@ FRESULT f_unlink (
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para ret">
|
||||||
<h4>Return Values</h4>
|
<h4>Return Values</h4>
|
||||||
<dl class="ret">
|
<p>
|
||||||
<dt>FR_OK (0)</dt>
|
<a href="rc.html#ok">FR_OK</a>,
|
||||||
<dd>The function succeeded.</dd>
|
<a href="rc.html#de">FR_DISK_ERR</a>,
|
||||||
<dt>FR_NO_FILE</dt>
|
<a href="rc.html#ie">FR_INT_ERR</a>,
|
||||||
<dd>Could not find the file or directory.</dd>
|
<a href="rc.html#nr">FR_NOT_READY</a>,
|
||||||
<dt>FR_NO_PATH</dt>
|
<a href="rc.html#ok">FR_NO_FILE</a>,
|
||||||
<dd>Could not find the path.</dd>
|
<a href="rc.html#np">FR_NO_PATH</a>,
|
||||||
<dt>FR_INVALID_NAME</dt>
|
<a href="rc.html#in">FR_INVALID_NAME</a>,
|
||||||
<dd>The path name is invalid.</dd>
|
<a href="rc.html#de">FR_DENIED</a>,
|
||||||
<dt>FR_INVALID_DRIVE</dt>
|
<a href="rc.html#ex">FR_EXIST</a>,
|
||||||
<dd>The drive number is invalid.</dd>
|
<a href="rc.html#wp">FR_WRITE_PROTECTED</a>,
|
||||||
<dt>FR_DENIED</dt>
|
<a href="rc.html#id">FR_INVALID_DRIVE</a>,
|
||||||
<dd>The function was denied due to either of following reasons:
|
<a href="rc.html#ne">FR_NOT_ENABLED</a>,
|
||||||
<ul><li>The object has read-only attribute</li><li>Not empty directory</li><li>Current directory</li></ul></dd>
|
<a href="rc.html#ns">FR_NO_FILESYSTEM</a>,
|
||||||
<dt>FR_NOT_READY</dt>
|
<a href="rc.html#tm">FR_TIMEOUT</a>,
|
||||||
<dd>The disk drive cannot work due to no medium in the drive or any other reason.</dd>
|
<a href="rc.html#lo">FR_LOCKED</a>,
|
||||||
<dt>FR_WRITE_PROTECTED</dt>
|
<a href="rc.html#nc">FR_NOT_ENOUGH_CORE</a>
|
||||||
<dd>The medium is write protected.</dd>
|
</p>
|
||||||
<dt>FR_DISK_ERR</dt>
|
|
||||||
<dd>The function failed due to an error in the disk function.</dd>
|
|
||||||
<dt>FR_INT_ERR</dt>
|
|
||||||
<dd>The function failed due to a wrong FAT structure or an internal error.</dd>
|
|
||||||
<dt>FR_NOT_ENABLED</dt>
|
|
||||||
<dd>The logical drive has no work area.</dd>
|
|
||||||
<dt>FR_NO_FILESYSTEM</dt>
|
|
||||||
<dd>There is no valid FAT volume on the drive.</dd>
|
|
||||||
<dt>FR_LOCKED</dt>
|
|
||||||
<dd>The function was rejected due to file shareing policy (_FS_SHARE).</dd>
|
|
||||||
</dl>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para desc">
|
||||||
<h4>Description</h4>
|
<h4>Description</h4>
|
||||||
<p>The f_unlink function removes an object. <em>Do not remove open objects</em>.</p>
|
<p>
|
||||||
|
If condition of the object to be removed is applicable to the following terms, the function will fail with error.
|
||||||
|
<ul>
|
||||||
|
<li>The object must not have read-only attribute (AM_RDO) or the function will be rejected with FR_DENIED.</li>
|
||||||
|
<li>The directory must be empty and must not be current directory or the function will be rejected with FR_DENIED.</li>
|
||||||
|
<li>The file must not being opened or the <em>FAT volume can be collapted</em>. It will able to be rejected with FR_LOCKED when <a href="appnote.html#dup">file shareing control</a> is enabled.</li>
|
||||||
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para comp">
|
||||||
<h4>QuickInfo</h4>
|
<h4>QuickInfo</h4>
|
||||||
<p>Available when <tt>_FS_READONLY == 0</tt> and <tt>_FS_MINIMIZE == 0</tt>.</p>
|
<p>Available when <tt>_FS_READONLY == 0</tt> and <tt>_FS_MINIMIZE == 0</tt>.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -11,18 +11,18 @@
|
|||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para func">
|
||||||
<h2>f_utime</h2>
|
<h2>f_utime</h2>
|
||||||
<p>The f_utime function changes the timestamp of a file or directory.</p>
|
<p>The f_utime function changes the timestamp of a file or directory.</p>
|
||||||
<pre>
|
<pre>
|
||||||
FRESULT f_utime (
|
FRESULT f_utime (
|
||||||
const TCHAR* <em>FileName</em>, <span>/* Pointer to the file or directory path */</span>
|
const TCHAR* <em>FileName</em>, <span class="c">/* Pointer to the file or directory path */</span>
|
||||||
const FILINFO* <em>TimeDate</em> <span>/* Time and data to be set */</span>
|
const FILINFO* <em>TimeDate</em> <span class="c">/* Time and data to be set */</span>
|
||||||
);
|
);
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para arg">
|
||||||
<h4>Parameters</h4>
|
<h4>Parameters</h4>
|
||||||
<dl class="par">
|
<dl class="par">
|
||||||
<dt>FileName</dt>
|
<dt>FileName</dt>
|
||||||
@ -33,46 +33,37 @@ FRESULT f_utime (
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para ret">
|
||||||
<h4>Return Values</h4>
|
<h4>Return Values</h4>
|
||||||
<dl class="ret">
|
<p>
|
||||||
<dt>FR_OK (0)</dt>
|
<a href="rc.html#ok">FR_OK</a>,
|
||||||
<dd>The function succeeded.</dd>
|
<a href="rc.html#de">FR_DISK_ERR</a>,
|
||||||
<dt>FR_NO_FILE</dt>
|
<a href="rc.html#ie">FR_INT_ERR</a>,
|
||||||
<dd>Could not find the file.</dd>
|
<a href="rc.html#nr">FR_NOT_READY</a>,
|
||||||
<dt>FR_NO_PATH</dt>
|
<a href="rc.html#ok">FR_NO_FILE</a>,
|
||||||
<dd>Could not find the path.</dd>
|
<a href="rc.html#np">FR_NO_PATH</a>,
|
||||||
<dt>FR_INVALID_NAME</dt>
|
<a href="rc.html#in">FR_INVALID_NAME</a>,
|
||||||
<dd>The file name is invalid.</dd>
|
<a href="rc.html#wp">FR_WRITE_PROTECTED</a>,
|
||||||
<dt>FR_INVALID_DRIVE</dt>
|
<a href="rc.html#id">FR_INVALID_DRIVE</a>,
|
||||||
<dd>The drive number is invalid.</dd>
|
<a href="rc.html#ne">FR_NOT_ENABLED</a>,
|
||||||
<dt>FR_NOT_READY</dt>
|
<a href="rc.html#ns">FR_NO_FILESYSTEM</a>,
|
||||||
<dd>The disk drive cannot work due to no medium in the drive or any other reason.</dd>
|
<a href="rc.html#tm">FR_TIMEOUT</a>,
|
||||||
<dt>FR_WRITE_PROTECTED</dt>
|
<a href="rc.html#nc">FR_NOT_ENOUGH_CORE</a>
|
||||||
<dd>The medium is write protected.</dd>
|
</p>
|
||||||
<dt>FR_DISK_ERR</dt>
|
|
||||||
<dd>The function failed due to an error in the disk function.</dd>
|
|
||||||
<dt>FR_INT_ERR</dt>
|
|
||||||
<dd>The function failed due to a wrong FAT structure or an internal error.</dd>
|
|
||||||
<dt>FR_NOT_ENABLED</dt>
|
|
||||||
<dd>The logical drive has no work area.</dd>
|
|
||||||
<dt>FR_NO_FILESYSTEM</dt>
|
|
||||||
<dd>There is no valid FAT volume on the drive.</dd>
|
|
||||||
</dl>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para desc">
|
||||||
<h4>Description</h4>
|
<h4>Description</h4>
|
||||||
<p>The f_utime function changes the timestamp of a file or directory</p>
|
<p>The f_utime function changes the timestamp of a file or directory</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para use">
|
||||||
<h4>Example</h4>
|
<h4>Example</h4>
|
||||||
<pre>
|
<pre>
|
||||||
FRESULT set_timestamp (
|
FRESULT set_timestamp (
|
||||||
char *obj, <span>/* Pointer to the file name */</span>
|
char *obj, <span class="c">/* Pointer to the file name */</span>
|
||||||
int year,
|
int year,
|
||||||
int month,
|
int month,
|
||||||
int mday,
|
int mday,
|
||||||
@ -92,13 +83,13 @@ FRESULT set_timestamp (
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para comp">
|
||||||
<h4>QuickInfo</h4>
|
<h4>QuickInfo</h4>
|
||||||
<p>Available when <tt>_FS_READONLY == 0</tt> and <tt>_FS_MINIMIZE == 0</tt>.</p>
|
<p>Available when <tt>_FS_READONLY == 0</tt> and <tt>_FS_MINIMIZE == 0</tt>.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para ref">
|
||||||
<h4>See Also</h4>
|
<h4>See Also</h4>
|
||||||
<p><tt><a href="stat.html">f_stat</a>, <a href="sfileinfo.html">FILINFO</a></tt></p>
|
<p><tt><a href="stat.html">f_stat</a>, <a href="sfileinfo.html">FILINFO</a></tt></p>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -11,20 +11,20 @@
|
|||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para func">
|
||||||
<h2>f_write</h2>
|
<h2>f_write</h2>
|
||||||
<p>The f_write writes data to a file.</p>
|
<p>The f_write writes data to a file.</p>
|
||||||
<pre>
|
<pre>
|
||||||
FRESULT f_write (
|
FRESULT f_write (
|
||||||
FIL* <em>FileObject</em>, <span>/* Pointer to the file object structure */</span>
|
FIL* <em>FileObject</em>, <span class="c">/* Pointer to the file object structure */</span>
|
||||||
const void* <em>Buffer</em>, <span>/* Pointer to the data to be written */</span>
|
const void* <em>Buffer</em>, <span class="c">/* Pointer to the data to be written */</span>
|
||||||
UINT <em>ByteToWrite</em>, <span>/* Number of bytes to write */</span>
|
UINT <em>ByteToWrite</em>, <span class="c">/* Number of bytes to write */</span>
|
||||||
UINT* <em>ByteWritten</em> <span>/* Pointer to the variable to return number of bytes written */</span>
|
UINT* <em>ByteWritten</em> <span class="c">/* Pointer to the variable to return number of bytes written */</span>
|
||||||
);
|
);
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para arg">
|
||||||
<h4>Parameters</h4>
|
<h4>Parameters</h4>
|
||||||
<dl class="par">
|
<dl class="par">
|
||||||
<dt>FileObject</dt>
|
<dt>FileObject</dt>
|
||||||
@ -39,38 +39,32 @@ FRESULT f_write (
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para ret">
|
||||||
<h4>Return Values</h4>
|
<h4>Return Values</h4>
|
||||||
<dl class="ret">
|
<p>
|
||||||
<dt>FR_OK (0)</dt>
|
<a href="rc.html#ok">FR_OK</a>,
|
||||||
<dd>The function succeeded.</dd>
|
<a href="rc.html#de">FR_DISK_ERR</a>,
|
||||||
<dt>FR_DENIED</dt>
|
<a href="rc.html#ie">FR_INT_ERR</a>,
|
||||||
<dd>The function denied due to the file has been opened in non-write mode.</dd>
|
<a href="rc.html#nr">FR_NOT_READY</a>,
|
||||||
<dt>FR_DISK_ERR</dt>
|
<a href="rc.html#io">FR_INVALID_OBJECT</a>,
|
||||||
<dd>The function failed due to an error in the disk function.</dd>
|
<a href="rc.html#tm">FR_TIMEOUT</a>
|
||||||
<dt>FR_INT_ERR</dt>
|
</p>
|
||||||
<dd>The function failed due to a wrong FAT structure or an internal error.</dd>
|
|
||||||
<dt>FR_NOT_READY</dt>
|
|
||||||
<dd>The disk drive cannot work due to no medium in the drive or any other reason.</dd>
|
|
||||||
<dt>FR_INVALID_OBJECT</dt>
|
|
||||||
<dd>The file object is invalid.</dd>
|
|
||||||
</dl>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para desc">
|
||||||
<h4>Description</h4>
|
<h4>Description</h4>
|
||||||
<p>The read/write pointer in the file object is increased in number of bytes written. After the function succeeded, <tt>*ByteWritten</tt> should be checked to detect the disk full. In case of <tt>*ByteWritten < ByteToWrite</tt>, it means the volume got full during the write operation. The function can take a time when the volume is full or close to full.</p>
|
<p>The read/write pointer in the file object is increased in number of bytes written. After the function succeeded, <tt>*ByteWritten</tt> should be checked to detect the disk full. In case of <tt>*ByteWritten < ByteToWrite</tt>, it means the volume got full during the write operation. The function can take a time when the volume is full or close to full.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para comp">
|
||||||
<h4>QuickInfo</h4>
|
<h4>QuickInfo</h4>
|
||||||
<p>Available when <tt>_FS_READONLY == 0</tt>.</p>
|
<p>Available when <tt>_FS_READONLY == 0</tt>.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para ref">
|
||||||
<h4>See Also</h4>
|
<h4>See Also</h4>
|
||||||
<p><tt><a href="open.html">f_open</a>, <a href="read.html">f_read</a>, <a href="putc.html">fputc</a>, <a href="puts.html">fputs</a>, <a href="printf.html">fprintf</a>, <a href="close.html">f_close</a>, <a href="sfile.html">FIL</a></tt></p>
|
<p><tt><a href="open.html">f_open</a>, <a href="read.html">f_read</a>, <a href="putc.html">fputc</a>, <a href="puts.html">fputs</a>, <a href="printf.html">fprintf</a>, <a href="close.html">f_close</a>, <a href="sfile.html">FIL</a></tt></p>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
BIN
doc/img/f6.png
Normal file
BIN
doc/img/f6.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.4 KiB |
@ -42,24 +42,14 @@ FatFsモジュールはANSI C(C89)準拠で記述されているので、ANSI C
|
|||||||
<p>必要なのは FatFsモジュールの要求するディスク関数を用意することだけで、それ以外にすることはありません。既に動作しているディスク関数があるならその APIを FatFsに合わせるだけで済みますが、無い場合はほかから移植するか、最初から書くかする必要があります。定義されている全ての関数が常に必要なわけではありません。例えば、リード・オンリー構成では書き込み系関数は必要ありません。次の表に構成オプションと要求される関数の対応を示します。</p>
|
<p>必要なのは FatFsモジュールの要求するディスク関数を用意することだけで、それ以外にすることはありません。既に動作しているディスク関数があるならその APIを FatFsに合わせるだけで済みますが、無い場合はほかから移植するか、最初から書くかする必要があります。定義されている全ての関数が常に必要なわけではありません。例えば、リード・オンリー構成では書き込み系関数は必要ありません。次の表に構成オプションと要求される関数の対応を示します。</p>
|
||||||
<table class="lst2">
|
<table class="lst2">
|
||||||
<tr><th>ユーザ作成関数</th><th>必要となる条件</th><th>備考</th></tr>
|
<tr><th>ユーザ作成関数</th><th>必要となる条件</th><th>備考</th></tr>
|
||||||
<tr><td>disk_initialize</td><td>常時</td><td rowspan="10">ffsample.zip (サンプル)<br>その他web上に多数</td></tr>
|
<tr><td>disk_initialize<br>disk_status<br>disk_read</td><td>常時</td><td rowspan="5">ffsample.zip (サンプル)<br>その他web上に多数</td></tr>
|
||||||
<tr><td>disk_status</td><td>常時</td></tr>
|
<tr><td>disk_write<br>get_fattime<br>disk_ioctl (CTRL_SYNC)</td><td>_FS_READONLY == 0</td></tr>
|
||||||
<tr><td>disk_read</td><td>常時</td></tr>
|
<tr><td>disk_ioctl (GET_SECTOR_COUNT)<br>disk_ioctl (GET_BLOCK_SIZE)</td><td>_USE_MKFS == 1</td></tr>
|
||||||
<tr><td>disk_write</td><td>_FS_READONLY == 0</td></tr>
|
|
||||||
<tr><td>disk_ioctl (CTRL_SYNC)</td><td>_FS_READONLY == 0</td></tr>
|
|
||||||
<tr><td>disk_ioctl (GET_SECTOR_COUNT)</td><td>_USE_MKFS == 1</td></tr>
|
|
||||||
<tr><td>disk_ioctl (GET_SECTOR_SIZE)</td><td>_MAX_SS >= 1024</td></tr>
|
<tr><td>disk_ioctl (GET_SECTOR_SIZE)</td><td>_MAX_SS >= 1024</td></tr>
|
||||||
<tr><td>disk_ioctl (GET_BLOCK_SIZE)</td><td>_USE_MKFS == 1</td></tr>
|
|
||||||
<tr><td>disk_ioctl (CTRL_ERASE_SECTOR)</td><td>_USE_ERASE == 1</td></tr>
|
<tr><td>disk_ioctl (CTRL_ERASE_SECTOR)</td><td>_USE_ERASE == 1</td></tr>
|
||||||
<tr><td>get_fattime</td><td>_FS_READONLY == 0</td></tr>
|
<tr><td>ff_convert<br>ff_wtoupper</td><td>_USE_LFN >= 1</td><td>option/cc*.c</td></tr>
|
||||||
<tr><td>ff_convert</td><td>_USE_LFN >= 1</td><td rowspan="2">option/cc*.c</td></tr>
|
<tr><td>ff_cre_syncobj<br>ff_rel_grant<br>ff_req_grant<br>ff_del_syncobj</td><td>_FS_REENTRANT == 1</td><td rowspan="2">option/syscall.c (サンプル)</td></tr>
|
||||||
<tr><td>ff_wtoupper</td><td>_USE_LFN >= 1</td></tr>
|
<tr><td>ff_mem_alloc<br>ff_mem_free</td><td>_USE_LFN == 3</td></tr>
|
||||||
<tr><td>ff_cre_syncobj</td><td>_FS_REENTRANT == 1</td><td rowspan="6">option/syscall.c (サンプル)</td></tr>
|
|
||||||
<tr><td>ff_del_syncobj</td><td>_FS_REENTRANT == 1</td></tr>
|
|
||||||
<tr><td>ff_req_grant</td><td>_FS_REENTRANT == 1</td></tr>
|
|
||||||
<tr><td>ff_rel_grant</td><td>_FS_REENTRANT == 1</td></tr>
|
|
||||||
<tr><td>ff_mem_alloc</td><td>_USE_LFN == 3</td></tr>
|
|
||||||
<tr><td>ff_mem_free</td><td>_USE_LFN == 3</td></tr>
|
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -77,19 +67,19 @@ FatFsモジュールはANSI C(C89)準拠で記述されているので、ANSI C
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="para" id="memory">
|
<div class="para" id="memory">
|
||||||
<h3>メモリ使用量 (R0.08a)</h3>
|
<h3>メモリ使用量 (R0.08b)</h3>
|
||||||
<p>次の表にいくつかのターゲットにおけるメモリ使用量の例を示します。テスト時の構成オプションはその下の通りです。数値の単位はバイトで、<em>D</em>は論理ボリューム数、<em>F</em>は同時オープン・ファイル数を示します。コンパイラの最適化オプションはコード・サイズとしています。</p>
|
<p>次の表にいくつかのターゲットにおけるメモリ使用量の例を示します。テスト時の構成オプションはその下の通りです。数値の単位はバイトで、<em>V</em>は同時マウント・ボリューム数、<em>F</em>は同時オープン・ファイル数を示します。コンパイラの最適化オプションはコード・サイズとしています。</p>
|
||||||
<table class="lst2">
|
<table class="lst2">
|
||||||
<tr><th></th><th>AVR</th><th>H8/300H</th><th>PIC24</th><th>V850ES</th><th>SH-2A</th><th>ARM7</th><th>x86</th></tr>
|
<tr><th></th><th>ARM7<small><br>32bit</small></th><th>ARM7<small><br>Thumb</small></th><th>Cortex-M3<small><br>Thumb-2</small></th><th>AVR</th><th>H8/300H</th><th>PIC24</th><th>RL78</th><th>V850ES</th><th>SH-2A</th><th>RX62N</th><th>IA-32</th></tr>
|
||||||
<tr><td>Compiler</td><td>WinAVR(gcc)</td><td>CH38</td><td>C30(gcc)</td><td>CA850</td><td>SHC</td><td>WinARM(gcc)</td><td>VC6</td></tr>
|
<tr><td>Compiler</td><td>GCC</td><td>GCC</td><td>GCC</td><td>GCC</td><td>CH38</td><td>C30</td><td>CC78K0R</td><td>CA850</td><td>SHC</td><td>RXC</td><td>VC6</td></tr>
|
||||||
<tr><td>_WORD_ACCESS</td><td>1</td><td>0</td><td>0</td><td>1</td><td>0</td><td>0</td><td>1</td></tr>
|
<tr><td>_WORD_ACCESS</td><td>0</td><td>0</td><td>0</td><td>1</td><td>0</td><td>0</td><td>0</td><td>1</td><td>0</td><td>1</td><td>1</td></tr>
|
||||||
<tr class="lst3"><td>text (Full, R/W)</td><td>12646</td><td>10686</td><td>11430</td><td>7732</td><td>8752</td><td>10560</td><td>7545</td></tr>
|
<tr class="lst3"><td>text (Full, R/W)</td><td>10495</td><td>7205</td><td>6661</td><td>12646</td><td>10686</td><td>11430</td><td>12967</td><td>7732</td><td>8752</td><td>5747</td><td>7545</td></tr>
|
||||||
<tr> <td>text (Min, R/W)</td><td>8306</td><td>6986</td><td>7413</td><td>4938</td><td>5576</td><td>6680</td><td>4923</td></tr>
|
<tr> <td>text (Min, R/W)</td><td>6523</td><td>4749</td><td>4335</td><td>8306</td><td>6986</td><td>7413</td><td>8745</td><td>4938</td><td>5576</td><td>3746</td><td>4923</td></tr>
|
||||||
<tr><td>text (Full, R/O)</td><td>5960</td><td>4876</td><td>5250</td><td>3554</td><td>3804</td><td>4688</td><td>3450</td></tr>
|
<tr><td>text (Full, R/O)</td><td>4539</td><td>3183</td><td>2893</td><td>5960</td><td>4876</td><td>5250</td><td>6060</td><td>3554</td><td>3804</td><td>2659</td><td>3450</td></tr>
|
||||||
<tr> <td>text (Min, R/O)</td><td>4366</td><td>3770</td><td>3939</td><td>2684</td><td>2940</td><td>3452</td><td>2664</td></tr>
|
<tr> <td>text (Min, R/O)</td><td>3307</td><td>2495</td><td>2191</td><td>4366</td><td>3770</td><td>3939</td><td>4604</td><td>2684</td><td>2940</td><td>2025</td><td>2664</td></tr>
|
||||||
<tr><td>bss</td><td>D*2 + 2</td><td>D*4 + 2</td><td>D*2 + 2</td><td>D*4 + 2</td><td>D*4 + 2</td><td>D*4 + 2</td><td>D*4 + 2</td></tr>
|
<tr><td>bss</td><td>D*4 + 2</td><td>D*4 + 2</td><td>D*4 + 2</td><td>D*2 + 2</td><td>D*4 + 2</td><td>D*2 + 2</td><td>D*2 + 2</td><td>D*4 + 2</td><td>D*4 + 2</td><td>D*4 + 2</td><td>D*4 + 2</td></tr>
|
||||||
<tr><td>Work area<br>(_FS_TINY == 0)</td><td>D*560 +<br>F*544</td><td>D*560 +<br>F*550</td><td>D*560 +<br>F*544</td><td>D*560 +<br>F*550</td><td>D*560 +<br>F*550</td><td>D*560 +<br>F*550</td><td>D*560 +<br>F*550</td></tr>
|
<tr><td>Work area<br>(_FS_TINY == 0)</td><td>V*560 +<br>F*550</td><td>V*560 +<br>F*550</td><td>V*560 +<br>F*550</td><td>V*560 +<br>F*544</td><td>V*560 +<br>F*550</td><td>V*560 +<br>F*544</td><td>V*560 +<br>F*544</td><td>V*560 +<br>F*544</td><td>V*560 +<br>F*550</td><td>V*560 +<br>F*550</td><td>V*560 +<br>F*550</td></tr>
|
||||||
<tr><td>Work area<br>(_FS_TINY == 1)</td><td>D*560 +<br>F*32</td><td>D*560 +<br>F*36</td><td>D*560 +<br>F*32</td><td>D*560 +<br>F*36</td><td>D*560 +<br>F*36</td><td>D*560 +<br>F*36</td><td>D*560 +<br>F*36</td></tr>
|
<tr><td>Work area<br>(_FS_TINY == 1)</td><td>V*560 +<br>F*36</td><td>V*560 +<br>F*36</td><td>V*560 +<br>F*36</td><td>V*560 +<br>F*32</td><td>V*560 +<br>F*36</td><td>V*560 +<br>F*32</td><td>V*560 +<br>F*32</td><td>V*560 +<br>F*36</td><td>V*560 +<br>F*36</td><td>V*560 +<br>F*36</td><td>V*560 +<br>F*36</td></tr>
|
||||||
</table>
|
</table>
|
||||||
<pre>
|
<pre>
|
||||||
_FS_READONLY 0 (R/W), 1 (R/O)
|
_FS_READONLY 0 (R/W), 1 (R/O)
|
||||||
@ -102,6 +92,7 @@ _CODE_PAGE 932 (Japanese Shift-JIS)
|
|||||||
_USE_LFN 0 (Disable LFN)
|
_USE_LFN 0 (Disable LFN)
|
||||||
_MAX_SS 512 (Fixed sector size)
|
_MAX_SS 512 (Fixed sector size)
|
||||||
_FS_RPATH 0 (Disable relative path)
|
_FS_RPATH 0 (Disable relative path)
|
||||||
|
_VOLUMES D (Number of logical drives to be used)
|
||||||
_MULTI_PARTITION 0 (Single partition per drive)
|
_MULTI_PARTITION 0 (Single partition per drive)
|
||||||
_FS_REENTRANT 0 (Disable reentrancy)
|
_FS_REENTRANT 0 (Disable reentrancy)
|
||||||
_FS_SHARE 0 (Disable shareing control)
|
_FS_SHARE 0 (Disable shareing control)
|
||||||
@ -113,7 +104,7 @@ _FS_SHARE 0 (Disable shareing control)
|
|||||||
<p>次の表は構成オプションの設定値によりどの機能が削除されるかを示します。</p>
|
<p>次の表は構成オプションの設定値によりどの機能が削除されるかを示します。</p>
|
||||||
<table class="lst2">
|
<table class="lst2">
|
||||||
<tr><td rowspan="2">Function</td><td colspan="4">_FS_MINIMIZE</td><td colspan="2">_FS_READONLY</td><td colspan="2">_USE_STRFUNC</td><td colspan="3">_FS_RPATH</td><td colspan="2">_USE_MKFS</td><td colspan="2">_USE_FORWARD</td></tr>
|
<tr><td rowspan="2">Function</td><td colspan="4">_FS_MINIMIZE</td><td colspan="2">_FS_READONLY</td><td colspan="2">_USE_STRFUNC</td><td colspan="3">_FS_RPATH</td><td colspan="2">_USE_MKFS</td><td colspan="2">_USE_FORWARD</td></tr>
|
||||||
<tr><td>0</td><td>1</td><td>2</td><td>3</td><td>0</td><td>1</td><td>0</td><td>1</td><td>0</td><td>1</td><td>2</td><td>0</td><td>1</td><td>0</td><td>1</td></tr>
|
<tr><td>0</td><td>1</td><td>2</td><td>3</td><td>0</td><td>1</td><td>0 </td><td>1/2</td><td>0</td><td>1</td><td>2</td><td>0</td><td>1</td><td>0</td><td>1</td></tr>
|
||||||
<tr class="lst3"><td>f_mount</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
|
<tr class="lst3"><td>f_mount</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
|
||||||
<tr><td>f_open</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
|
<tr><td>f_open</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
|
||||||
<tr><td>f_close</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
|
<tr><td>f_close</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
|
||||||
@ -146,7 +137,7 @@ _FS_SHARE 0 (Disable shareing control)
|
|||||||
<div class="para" id="lfn">
|
<div class="para" id="lfn">
|
||||||
<h3>長いファイル名</h3>
|
<h3>長いファイル名</h3>
|
||||||
<p>FatFsモジュールはR0.07から長いファイル名(LFN)をサポートしました。ファイルに付けられた2つの異なる名前(短いファル名と長いファイル名)は、f_readdir関数を除くファイル操作関数において透過です。LFN機能を有効にするには、<tt>_USE_LFN</tt>を1,2または3に設定し、Unicode変換関数<tt>ff_convert(), ff_wtoupper()</tt>をプロジェクトに追加します。これらの関数は、<tt>option/cc*.c</tt>に含まれています。LFN機能は、加えてある程度のワーク・エリア(LFN操作バッファ)を必要とします。バッファ長は使用できるメモリに応じて<tt>_MAX_LFN</tt>オプションで構成されることができます。LFNの長さは最大255文字に達するので、LFN完全対応のためには<tt>_MAX_LFN</tt>は255に設定されるべきです。与えられたファイル名に対してバッファ長が不足した場合、ファイル関数は<tt>FR_INVALID_NAME</tt>で失敗します。</p>
|
<p>FatFsモジュールはR0.07から長いファイル名(LFN)をサポートしました。ファイルに付けられた2つの異なる名前(短いファル名と長いファイル名)は、f_readdir関数を除くファイル操作関数において透過です。LFN機能を有効にするには、<tt>_USE_LFN</tt>を1,2または3に設定し、Unicode変換関数<tt>ff_convert(), ff_wtoupper()</tt>をプロジェクトに追加します。これらの関数は、<tt>option/cc*.c</tt>に含まれています。LFN機能は、加えてある程度のワーク・エリア(LFN操作バッファ)を必要とします。バッファ長は使用できるメモリに応じて<tt>_MAX_LFN</tt>オプションで構成されることができます。LFNの長さは最大255文字に達するので、LFN完全対応のためには<tt>_MAX_LFN</tt>は255に設定されるべきです。与えられたファイル名に対してバッファ長が不足した場合、ファイル関数は<tt>FR_INVALID_NAME</tt>で失敗します。</p>
|
||||||
<p>LFN機能をリエントラント構成で使用する場合は、<tt>_USE_LFN</tt>は2または3に設定されなければなりません。この場合、ファイル関数はバッファをスタックやヒープに確保します。バッファ・サイズは、<tt>(_MAX_LFN + 1) * 2</tt>バイトになるので、スタック等のサイズはそれを考慮した十分なサイズでなければなりません。</p>
|
<p>何らかのリエントラント状態の下でLFN機能を使用する場合は、<tt>_USE_LFN</tt>は2または3に設定されなければなりません。この場合、ファイル関数はバッファをスタックやヒープに確保します。バッファ・サイズは、<tt>(_MAX_LFN + 1) * 2</tt>バイトになるので、スタック等のサイズはそれを考慮した十分なサイズでなければなりません。</p>
|
||||||
<table class="lst2 rset">
|
<table class="lst2 rset">
|
||||||
<caption>LFN cfg on ARM7</caption>
|
<caption>LFN cfg on ARM7</caption>
|
||||||
<tr><th>コードページ</th><th>コードサイズ[bytes]</th></tr>
|
<tr><th>コードページ</th><th>コードサイズ[bytes]</th></tr>
|
||||||
@ -157,7 +148,7 @@ _FS_SHARE 0 (Disable shareing control)
|
|||||||
<tr><td>950(Big5)</td><td>+111497</td></tr>
|
<tr><td>950(Big5)</td><td>+111497</td></tr>
|
||||||
</table>
|
</table>
|
||||||
<p>LFN機能の上手な使い方は、それを使わないということです。実際、組み込み用途ではLFN機能がどうしても必要になるということはほとんど無いはずです。LFNを有効にすると、選択されたコード・ページに応じてモジュール・サイズが増大されます。右の表に各コード・ページにおけるLFNを有効にしたときのモジュール・サイズの違いを示します。私たち日本人、中国人および韓国人は数万の文字を持ちます。不幸なことに、それは巨大なOEM-Unicode相互変換テーブルを要求し、モジュール・サイズは劇的に増大されます。その結果、LFNを有効にしたFatFsモジュールは、AVRを含む殆どの8ビット・マイコンにインプリメントされることができません。<small>これは長い間私がLFNをインプリメントすることに興味を持ってこなかった理由です。</small></p>
|
<p>LFN機能の上手な使い方は、それを使わないということです。実際、組み込み用途ではLFN機能がどうしても必要になるということはほとんど無いはずです。LFNを有効にすると、選択されたコード・ページに応じてモジュール・サイズが増大されます。右の表に各コード・ページにおけるLFNを有効にしたときのモジュール・サイズの違いを示します。私たち日本人、中国人および韓国人は数万の文字を持ちます。不幸なことに、それは巨大なOEM-Unicode相互変換テーブルを要求し、モジュール・サイズは劇的に増大されます。その結果、LFNを有効にしたFatFsモジュールは、AVRを含む殆どの8ビット・マイコンにインプリメントされることができません。<small>これは長い間私がLFNをインプリメントすることに興味を持ってこなかった理由です。</small></p>
|
||||||
<p>注: マイクロソフト社はFATファイル・システムについていくつかの特許を保有しています。いずれもLFNの実装に関するもので、LFN機能に対して$0.25/unitのライセンス料を要求しています。このため、商用製品でLFN機能有効にするときは、最終仕向地によってはライセンスが必要かも知れません。</p>
|
<p>注: マイクロソフト社はFATファイル・システムについていくつかの特許を保有しています。いずれもLFNの実装に関するもので、LFN機能に対して$0.25/unitのライセンス料を要求しています。FAT32は無関係です。このため、商用製品でLFN機能有効にするときは、最終仕向地によってはライセンスが必要かも知れません。</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="para" id="jap">
|
<div class="para" id="jap">
|
||||||
@ -173,15 +164,15 @@ _FS_SHARE 0 (Disable shareing control)
|
|||||||
<div class="para" id="reentrant">
|
<div class="para" id="reentrant">
|
||||||
<h3>リエントランシー</h3>
|
<h3>リエントランシー</h3>
|
||||||
<p>互いに異なるボリュームに対するファイル操作はリエントラントで、常に同時平行に動作できます。同じボリュームに対してはデフォルトではリエントラントではありませんが、<tt>_FS_REENTRANT</tt>オプションでリエントラント(スレッド・セーフ)にすることはできます。この場合、OS依存の同期オブジェクト操作関数<tt>ff_cre_syncobj, ff_del_syncobj, ff_req_grant</tt> と <tt>ff_rel_grant</tt>もまたプロジェクトに追加されなければなりません。サンプル・コードと解説は<tt>option/syncobj.c</tt>にあります。</p>
|
<p>互いに異なるボリュームに対するファイル操作はリエントラントで、常に同時平行に動作できます。同じボリュームに対してはデフォルトではリエントラントではありませんが、<tt>_FS_REENTRANT</tt>オプションでリエントラント(スレッド・セーフ)にすることはできます。この場合、OS依存の同期オブジェクト操作関数<tt>ff_cre_syncobj, ff_del_syncobj, ff_req_grant</tt> と <tt>ff_rel_grant</tt>もまたプロジェクトに追加されなければなりません。サンプル・コードと解説は<tt>option/syncobj.c</tt>にあります。</p>
|
||||||
<p>あるタスクがボリュームを使用中に他のタスクからそのボリュームに対するファイル関数が呼び出されると、そのアクセスは先のタスクがファイル関数を抜けるまでブロックされます。もし、待ち時間が<tt>_TIMEOUT</tt>で指定された期間を越すと、その関数は<tt>FR_TIMEOUT</tt>でアボートします。いくつかのRTOSではタイムアウト機能はサポートされないかも知れません。</p>
|
<p>この場合、あるタスクがボリュームを使用中に他のタスクからそのボリュームに対するファイル関数が呼び出されると、そのアクセスは先のタスクがファイル関数を抜けるまでブロックされます。もし、待ち時間が<tt>_TIMEOUT</tt>で指定された期間を越すと、その関数は<tt>FR_TIMEOUT</tt>でアボートします。いくつかのRTOSではタイムアウト機能はサポートされないかも知れません。</p>
|
||||||
<p>ひとつの例外が<tt>f_mount()</tt>と<tt>f_mkfs()</tt>にあります。これらの関数は同じボリュームに対してリエントラントではありません。これらの関数を使用するときは、アプリケーション・レベルで排他制御しなければなりません。</p>
|
<p>ひとつの例外が<tt>f_mount()</tt>と<tt>f_mkfs()</tt>にあります。これらの関数は同じボリュームに対してリエントラントではありません。これらの関数を使用するときは、アプリケーション・レベルで排他制御しなければなりません。</p>
|
||||||
<p>注: このセクションはFatFsモジュールそれ自体のリエントランシーについて説明しています。ディスクI/Oモジュールのリエントランシーに関しては何の前提もありません。</p>
|
<p>注: このセクションはFatFsモジュールそれ自体のリエントランシーについて説明しています。ディスクI/Oモジュールのリエントランシーに関しては何の前提もありません。</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="para" id="dup">
|
<div class="para" id="dup">
|
||||||
<h3>多重ファイル・アクセス</h3>
|
<h3>多重ファイル・アクセス</h3>
|
||||||
<p>FatFsモジュールではデフォルトでは多重アクセス制御機能をサポートしていません。ファイルに対する多重アクセスは、そのアクセス・モードによって制限されます。一つのファイルに対する多重オープンは、それらが全てリード・モードのときに限って許可されます。書き込みモードを含む多重オープン、また開かれているファイルに対するリネームや削除、カレント・ディレクトリの削除を行ってはなりません。さもないと、そのボリュームのFAT構造が破壊される可能性があります。</p>
|
<p>FatFsモジュールではデフォルトでは多重アクセス制御機能をサポートしていません。ファイルに対する多重アクセスは、そのアクセス・モードによって制限されます。一つのファイルに対する多重オープンは、それらが全てリード・モードのときに限って許可されます。書き込みモードを含む多重オープン、また開かれているファイルに対するリネームや削除を行ってはなりません。さもないと、そのボリュームのFAT構造が破壊される可能性があります。</p>
|
||||||
<p><tt>_FS_SHARE</tt>に1以上の値をセットすることにより、ファイル単位の排他制御を自動で行うこともできます。この場合、上記のルールを破ったオープン・リネーム・削除を試みると、その関数は<tt>FR_LOCKED</tt>で失敗します。</p>
|
<p><tt>_FS_SHARE</tt>に1以上の値(値は同時に管理できるファイル数)をセットすることで多重アクセス制御機能が有効になり、ファイル単位の排他制御を自動で行うこともできます。この場合、上記のルールを破ったオープン・リネーム・削除を試みると、その関数は<tt>FR_LOCKED</tt>で失敗します。<tt>_FS_SHARE</tt>を越えた数のファイルをオープンしようとすると、<tt>FR_TOO_MANY_OPEN_FILES</tt>で失敗します。</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="para" id="fs1">
|
<div class="para" id="fs1">
|
||||||
@ -241,13 +232,13 @@ _FS_SHARE 0 (Disable shareing control)
|
|||||||
<h3>FatFsのライセンスについて</h3>
|
<h3>FatFsのライセンスについて</h3>
|
||||||
<p>ソース・ファイルのヘッダにライセンス条件が記述されているので、利用の際はそれに従うこと。英語を読めない方のために以下に日本語訳を示しておきます。</p>
|
<p>ソース・ファイルのヘッダにライセンス条件が記述されているので、利用の際はそれに従うこと。英語を読めない方のために以下に日本語訳を示しておきます。</p>
|
||||||
<pre>/*----------------------------------------------------------------------------/
|
<pre>/*----------------------------------------------------------------------------/
|
||||||
/ FatFs - FAT file system module R0.08a (C)ChaN, 2010
|
/ FatFs - FAT file system module R0.08b (C)ChaN, 2011
|
||||||
/-----------------------------------------------------------------------------/
|
/-----------------------------------------------------------------------------/
|
||||||
/ FatFsモジュールは、小規模な組み込みシステム向けの汎用FATファイルシステム・
|
/ FatFsモジュールは、小規模な組み込みシステム向けの汎用FATファイルシステム・
|
||||||
/ モジュールです。これはフリー・ソフトウェアとして、教育・研究・開発のために
|
/ モジュールです。これはフリー・ソフトウェアとして、教育・研究・開発のために
|
||||||
/ 以下のライセンス・ポリシーの下で公開されています。
|
/ 以下のライセンス・ポリシーの下で公開されています。
|
||||||
/
|
/
|
||||||
/ Copyright (C) 2010, ChaN, all right reserved.
|
/ Copyright (C) 2011, ChaN, all right reserved.
|
||||||
/
|
/
|
||||||
/ * FatFsモジュールはフリー・ソフトウェアであり、また<em>無保証です</em>。
|
/ * FatFsモジュールはフリー・ソフトウェアであり、また<em>無保証です</em>。
|
||||||
/ * 用途に制限はありません。<em>あなたの責任の下において</em>、個人的・非営利的な
|
/ * 用途に制限はありません。<em>あなたの責任の下において</em>、個人的・非営利的な
|
||||||
|
|||||||
@ -11,17 +11,17 @@
|
|||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para func">
|
||||||
<h2>f_chdir</h2>
|
<h2>f_chdir</h2>
|
||||||
<p>カレント・ディレクトリを変更します。</p>
|
<p>カレント・ディレクトリを変更します。</p>
|
||||||
<pre>
|
<pre>
|
||||||
FRESULT f_chdir (
|
FRESULT f_chdir (
|
||||||
const XCHAR* <em>Path</em> <span>/* ディレクトリ名へのポインタ */</span>
|
const XCHAR* <em>Path</em> <span class="c">/* ディレクトリ名へのポインタ */</span>
|
||||||
);
|
);
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para arg">
|
||||||
<h4>引数</h4>
|
<h4>引数</h4>
|
||||||
<dl class="par">
|
<dl class="par">
|
||||||
<dt>Path</dt>
|
<dt>Path</dt>
|
||||||
@ -30,48 +30,37 @@ FRESULT f_chdir (
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para ret">
|
||||||
<h4>戻り値</h4>
|
<h4>戻り値</h4>
|
||||||
<dl class="ret">
|
<p>
|
||||||
<dt>FR_OK (0)</dt>
|
<a href="rc.html#ok">FR_OK</a>,
|
||||||
<dd>正常終了。</dd>
|
<a href="rc.html#de">FR_DISK_ERR</a>,
|
||||||
<dt>FR_NO_FILE</dt>
|
<a href="rc.html#ie">FR_INT_ERR</a>,
|
||||||
<dd>ファイルが見つからない。</dd>
|
<a href="rc.html#nr">FR_NOT_READY</a>,
|
||||||
<dt>FR_NO_PATH</dt>
|
<a href="rc.html#ok">FR_NO_FILE</a>,
|
||||||
<dd>パスが見つからない。</dd>
|
<a href="rc.html#np">FR_NO_PATH</a>,
|
||||||
<dt>FR_INVALID_NAME</dt>
|
<a href="rc.html#in">FR_INVALID_NAME</a>,
|
||||||
<dd>パス名が不正。</dd>
|
<a href="rc.html#id">FR_INVALID_DRIVE</a>,
|
||||||
<dt>FR_INVALID_DRIVE</dt>
|
<a href="rc.html#ne">FR_NOT_ENABLED</a>,
|
||||||
<dd>ドライブ番号が不正。</dd>
|
<a href="rc.html#ns">FR_NO_FILESYSTEM</a>,
|
||||||
<dt>FR_NOT_READY</dt>
|
<a href="rc.html#nc">FR_NOT_ENOUGH_CORE</a>
|
||||||
<dd>メディアがセットされていないなど、物理ドライブが動作不能状態。</dd>
|
</p>
|
||||||
<dt>FR_WRITE_PROTECTED</dt>
|
|
||||||
<dd>メディアが書き込み禁止状態。</dd>
|
|
||||||
<dt>FR_DISK_ERR</dt>
|
|
||||||
<dd>ディスク・エラーによる失敗。</dd>
|
|
||||||
<dt>FR_INT_ERR</dt>
|
|
||||||
<dd>不正なFAT構造または内部エラーによる失敗。</dd>
|
|
||||||
<dt>FR_NOT_ENABLED</dt>
|
|
||||||
<dd>その論理ドライブにワーク・エリアが与えられていない。</dd>
|
|
||||||
<dt>FR_NO_FILESYSTEM</dt>
|
|
||||||
<dd>有効なFATボリュームが見つからない。</dd>
|
|
||||||
</dl>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para desc">
|
||||||
<h4>解説</h4>
|
<h4>解説</h4>
|
||||||
<p>f_chdir関数は各ボリュームのカレント・ディレクトリを変更します。カレント・ディレクトリはファイル・システム・オブジェクトの初期化が行われたとき、ルート・ディレクトリに設定されます。カレント・ディレクトリは、ファイル・システム・オブジェクトに記録されるため、そのボリュームを使用する全てのタスクに対して影響を与えます。</p>
|
<p>f_chdir関数は各ボリュームのカレント・ディレクトリを変更します。カレント・ディレクトリはファイル・システム・オブジェクトの初期化が行われたとき、ルート・ディレクトリに設定されます。カレント・ディレクトリは、ファイル・システム・オブジェクトに記録されるため、そのボリュームを使用する全てのタスクに対して影響を与えます。</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para comp">
|
||||||
<h4>対応情報</h4>
|
<h4>対応情報</h4>
|
||||||
<p><tt>_FS_RPATH == 1</tt>のときに使用可能となります。</p>
|
<p><tt>_FS_RPATH == 1</tt>のときに使用可能となります。</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para exa">
|
||||||
<h4>使用例</h4>
|
<h4>使用例</h4>
|
||||||
<pre>
|
<pre>
|
||||||
// カレント・ドライブのカレント・ディレクトリを変更 (ルート下のdir1へ)
|
// カレント・ドライブのカレント・ディレクトリを変更 (ルート下のdir1へ)
|
||||||
@ -82,7 +71,7 @@ FRESULT f_chdir (
|
|||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para ref">
|
||||||
<h4>参照</h4>
|
<h4>参照</h4>
|
||||||
<p><tt><a href="chdrive.html">f_chdrive</a></tt></p>
|
<p><tt><a href="chdrive.html">f_chdrive</a></tt></p>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -11,17 +11,17 @@
|
|||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para func">
|
||||||
<h2>f_chdrive</h2>
|
<h2>f_chdrive</h2>
|
||||||
<p>カレント・ドライブを変更します。</p>
|
<p>カレント・ドライブを変更します。</p>
|
||||||
<pre>
|
<pre>
|
||||||
FRESULT f_chdrive (
|
FRESULT f_chdrive (
|
||||||
BYTE <em>Drive</em> <span>/* 論理ドライブ番号 */</span>
|
BYTE <em>Drive</em> <span class="c">/* 論理ドライブ番号 */</span>
|
||||||
);
|
);
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para arg">
|
||||||
<h4>引数</h4>
|
<h4>引数</h4>
|
||||||
<dl class="par">
|
<dl class="par">
|
||||||
<dt>Drive</dt>
|
<dt>Drive</dt>
|
||||||
@ -30,30 +30,28 @@ FRESULT f_chdrive (
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para ret">
|
||||||
<h4>戻り値</h4>
|
<h4>戻り値</h4>
|
||||||
<dl class="ret">
|
<p>
|
||||||
<dt>FR_OK (0)</dt>
|
<a href="rc.html#ok">FR_OK</a>,
|
||||||
<dd>正常終了。</dd>
|
<a href="rc.html#id">FR_INVALID_DRIVE</a>
|
||||||
<dt>FR_INVALID_DRIVE</dt>
|
</p>
|
||||||
<dd>ドライブ番号が不正。</dd>
|
|
||||||
</dl>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para desc">
|
||||||
<h4>解説</h4>
|
<h4>解説</h4>
|
||||||
<p>f_chdrive関数はカレント・ドライブを変更します。システム起動時の初期値は0です。この設定はFatFsモジュールの静的変数に記録されるため、全てのタスクに対して影響を与えます。</p>
|
<p>f_chdrive関数はカレント・ドライブを変更します。システム起動時の初期値は0です。この設定はFatFsモジュールの静的変数に記録されるため、全てのタスクに対して影響を与えます。</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para comp">
|
||||||
<h4>対応情報</h4>
|
<h4>対応情報</h4>
|
||||||
<p><tt>_FS_RPATH == 1</tt>のときに使用可能となります。</p>
|
<p><tt>_FS_RPATH == 1</tt>のときに使用可能となります。</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para ref">
|
||||||
<h4>参照</h4>
|
<h4>参照</h4>
|
||||||
<p><tt><a href="chdir.html">f_chdir</a></tt></p>
|
<p><tt><a href="chdir.html">f_chdir</a></tt></p>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -11,19 +11,19 @@
|
|||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para func">
|
||||||
<h2>f_chmod</h2>
|
<h2>f_chmod</h2>
|
||||||
<p>ファイルまたはディレクトリの属性を変更します。</p>
|
<p>ファイルまたはディレクトリの属性を変更します。</p>
|
||||||
<pre>
|
<pre>
|
||||||
FRESULT f_chmod (
|
FRESULT f_chmod (
|
||||||
const TCHAR* <em>FileName</em>, <span>/* ファイルまたはディレクトリ名へのポインタ */</span>
|
const TCHAR* <em>FileName</em>, <span class="c">/* ファイルまたはディレクトリ名へのポインタ */</span>
|
||||||
BYTE <em>Attribute</em>, <span>/* 設定値 */</span>
|
BYTE <em>Attribute</em>, <span class="c">/* 設定値 */</span>
|
||||||
BYTE <em>AttributeMask</em> <span>/* 変更マスク */</span>
|
BYTE <em>AttributeMask</em> <span class="c">/* 変更マスク */</span>
|
||||||
);
|
);
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para arg">
|
||||||
<h4>引数</h4>
|
<h4>引数</h4>
|
||||||
<dl class="par">
|
<dl class="par">
|
||||||
<dt>FileName</dt>
|
<dt>FileName</dt>
|
||||||
@ -44,51 +44,42 @@ FRESULT f_chmod (
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para ret">
|
||||||
<h4>戻り値</h4>
|
<h4>戻り値</h4>
|
||||||
<dl class="ret">
|
<p>
|
||||||
<dt>FR_OK (0)</dt>
|
<a href="rc.html#ok">FR_OK</a>,
|
||||||
<dd>正常終了。</dd>
|
<a href="rc.html#de">FR_DISK_ERR</a>,
|
||||||
<dt>FR_NO_FILE</dt>
|
<a href="rc.html#ie">FR_INT_ERR</a>,
|
||||||
<dd>ファイルが見つからない。</dd>
|
<a href="rc.html#nr">FR_NOT_READY</a>,
|
||||||
<dt>FR_NO_PATH</dt>
|
<a href="rc.html#ok">FR_NO_FILE</a>,
|
||||||
<dd>パスが見つからない。</dd>
|
<a href="rc.html#np">FR_NO_PATH</a>,
|
||||||
<dt>FR_INVALID_NAME</dt>
|
<a href="rc.html#in">FR_INVALID_NAME</a>,
|
||||||
<dd>パス名が不正。</dd>
|
<a href="rc.html#wp">FR_WRITE_PROTECTED</a>,
|
||||||
<dt>FR_INVALID_DRIVE</dt>
|
<a href="rc.html#ne">FR_NOT_ENABLED</a>,
|
||||||
<dd>ドライブ番号が不正。</dd>
|
<a href="rc.html#ns">FR_NO_FILESYSTEM</a>,
|
||||||
<dt>FR_NOT_READY</dt>
|
<a href="rc.html#tm">FR_TIMEOUT</a>,
|
||||||
<dd>メディアがセットされていないなど、物理ドライブが動作不能状態。</dd>
|
<a href="rc.html#lo">FR_LOCKED</a>,
|
||||||
<dt>FR_WRITE_PROTECTED</dt>
|
<a href="rc.html#nc">FR_NOT_ENOUGH_CORE</a>
|
||||||
<dd>メディアが書き込み禁止状態。</dd>
|
</p>
|
||||||
<dt>FR_DISK_ERR</dt>
|
|
||||||
<dd>ディスク・エラーによる失敗。</dd>
|
|
||||||
<dt>FR_INT_ERR</dt>
|
|
||||||
<dd>不正なFAT構造または内部エラーによる失敗。</dd>
|
|
||||||
<dt>FR_NOT_ENABLED</dt>
|
|
||||||
<dd>その論理ドライブにワーク・エリアが与えられていない。</dd>
|
|
||||||
<dt>FR_NO_FILESYSTEM</dt>
|
|
||||||
<dd>有効なFATボリュームが見つからない。</dd>
|
|
||||||
</dl>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para desc">
|
||||||
<h4>解説</h4>
|
<h4>解説</h4>
|
||||||
<p>ファイルまたはディレクトリの属性を変更します。</p>
|
<p>ファイルまたはディレクトリの属性を変更します。</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para comp">
|
||||||
<h4>対応情報</h4>
|
<h4>対応情報</h4>
|
||||||
<p><tt>_FS_READONLY == 0</tt>で、且つ<tt>_FS_MINIMIZE == 0</tt>のとき使用可能です。</p>
|
<p><tt>_FS_READONLY == 0</tt>で、且つ<tt>_FS_MINIMIZE == 0</tt>のとき使用可能です。</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para use">
|
||||||
<h4>使用例</h4>
|
<h4>使用例</h4>
|
||||||
<pre>
|
<pre>
|
||||||
<span>/* リードオンリーをセット、アーカイブをクリア、その他は変更しない */</span>
|
<span class="c">/* リードオンリーをセット、アーカイブをクリア、その他は変更しない */</span>
|
||||||
f_chmod("file.txt", AM_RDO, AM_RDO | AM_ARC);
|
f_chmod("file.txt", AM_RDO, AM_RDO | AM_ARC);
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -11,17 +11,17 @@
|
|||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para func">
|
||||||
<h2>f_close</h2>
|
<h2>f_close</h2>
|
||||||
<p>ファイルを閉じます。</p>
|
<p>ファイルを閉じます。</p>
|
||||||
<pre>
|
<pre>
|
||||||
FRESULT f_close (
|
FRESULT f_close (
|
||||||
FIL* <em>FileObject</em> <span>/* ファイル・オブジェクトへのポインタ */</span>
|
FIL* <em>FileObject</em> <span class="c">/* ファイル・オブジェクトへのポインタ */</span>
|
||||||
);
|
);
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para arg">
|
||||||
<h4>引数</h4>
|
<h4>引数</h4>
|
||||||
<dl class="par">
|
<dl class="par">
|
||||||
<dt>FileObject</dt>
|
<dt>FileObject</dt>
|
||||||
@ -30,36 +30,32 @@ FRESULT f_close (
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para ret">
|
||||||
<h4>戻り値</h4>
|
<h4>戻り値</h4>
|
||||||
<dl class="ret">
|
<p>
|
||||||
<dt>FR_OK (0)</dt>
|
<a href="rc.html#ok">FR_OK</a>,
|
||||||
<dd>正常終了。</dd>
|
<a href="rc.html#de">FR_DISK_ERR</a>,
|
||||||
<dt>FR_DISK_ERR</dt>
|
<a href="rc.html#ie">FR_INT_ERR</a>,
|
||||||
<dd>ディスク・エラーによる失敗。</dd>
|
<a href="rc.html#nr">FR_NOT_READY</a>,
|
||||||
<dt>FR_INT_ERR</dt>
|
<a href="rc.html#io">FR_INVALID_OBJECT</a>,
|
||||||
<dd>不正なFAT構造または内部エラーによる失敗。</dd>
|
<a href="rc.html#tm">FR_TIMEOUT</a>
|
||||||
<dt>FR_NOT_READY</dt>
|
</p>
|
||||||
<dd>メディアがセットされていないなど、物理ドライブが動作不能状態。</dd>
|
|
||||||
<dt>FR_INVALID_OBJECT</dt>
|
|
||||||
<dd>無効なファイル・オブジェクト。</dd>
|
|
||||||
</dl>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para desc">
|
||||||
<h4>解説</h4>
|
<h4>解説</h4>
|
||||||
<p>ファイルを閉じます。何らかの書き込みの行われたファイルの場合、キャッシュされた状態(リード/ライト・バッファ上のデータ、変更されたFATやディレクトリ項目)はディスクに書き戻されます。関数が正常終了すると、そのファイル・オブジェクトは無効になり、そのメモリも解放できます。</p>
|
<p>ファイルを閉じます。何らかの書き込みの行われたファイルの場合、キャッシュされた状態(リード/ライト・バッファ上のデータ、変更されたFATやディレクトリ項目)はディスクに書き戻されます。関数が正常終了すると、そのファイル・オブジェクトは無効になり、そのメモリも解放できます。</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para comp">
|
||||||
<h4>対応情報</h4>
|
<h4>対応情報</h4>
|
||||||
<p>全ての構成で使用可能です。</p>
|
<p>全ての構成で使用可能です。</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para ref">
|
||||||
<h4>参照</h4>
|
<h4>参照</h4>
|
||||||
<tt><a href="open.html">f_open</a>, <a href="read.html">f_read</a>, <a href="write.html">f_write</a>, <a href="sync.html">f_sync</a>, <a href="sfile.html">FIL</a>, <a href="sfatfs.html">FATFS</a></tt>
|
<tt><a href="open.html">f_open</a>, <a href="read.html">f_read</a>, <a href="write.html">f_write</a>, <a href="sync.html">f_sync</a>, <a href="sfile.html">FIL</a>, <a href="sfatfs.html">FATFS</a></tt>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -11,17 +11,17 @@
|
|||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para func">
|
||||||
<h2>disk_initialize</h2>
|
<h2>disk_initialize</h2>
|
||||||
<p>ディスク・ドライブを初期化します。</p>
|
<p>ディスク・ドライブを初期化します。</p>
|
||||||
<pre>
|
<pre>
|
||||||
DSTATUS disk_initialize (
|
DSTATUS disk_initialize (
|
||||||
BYTE <em>Drive</em> <span>/* 物理ドライブ番号 */</span>
|
BYTE <em>Drive</em> <span class="c">/* 物理ドライブ番号 */</span>
|
||||||
);
|
);
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para arg">
|
||||||
<h4>引数</h4>
|
<h4>引数</h4>
|
||||||
<dl class="par">
|
<dl class="par">
|
||||||
<dt>Drive</dt>
|
<dt>Drive</dt>
|
||||||
@ -30,12 +30,12 @@ DSTATUS disk_initialize (
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para ret">
|
||||||
<h4>戻り値</h4>
|
<h4>戻り値</h4>
|
||||||
<p>この関数は戻り値としてディスク・ステータスを返します。ディスク・ステータスの詳細に関しては<tt><a href="dstat.html">disk_status()</a></tt>を参照してください。</p>
|
<p>この関数は戻り値としてディスク・ステータスを返します。ディスク・ステータスの詳細に関しては<tt><a href="dstat.html">disk_status()</a></tt>を参照してください。</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para desc">
|
||||||
<h4>解説</h4>
|
<h4>解説</h4>
|
||||||
<p>ディスク・ドライブを初期化します。関数が成功すると、戻り値の<tt>STA_NOINIT</tt>フラグがクリアされます。</p>
|
<p>ディスク・ドライブを初期化します。関数が成功すると、戻り値の<tt>STA_NOINIT</tt>フラグがクリアされます。</p>
|
||||||
<p><em>アプリケーションからこの関数を呼び出すと、FATボリュームが破壊される可能性があります。エラー等により再初期化が必要なときは、<tt>f_mount()</tt>を使用します。</em>FatFsモジュールは、自動マウント動作により、必要に応じてこの関数を呼び出します。</p>
|
<p><em>アプリケーションからこの関数を呼び出すと、FATボリュームが破壊される可能性があります。エラー等により再初期化が必要なときは、<tt>f_mount()</tt>を使用します。</em>FatFsモジュールは、自動マウント動作により、必要に応じてこの関数を呼び出します。</p>
|
||||||
|
|||||||
@ -11,19 +11,19 @@
|
|||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para func">
|
||||||
<h2>disk_ioctl</h2>
|
<h2>disk_ioctl</h2>
|
||||||
<p>セクタの読み書き以外のディスク・ドライブ自体に対する様々な制御をします。</p>
|
<p>セクタの読み書き以外のディスク・ドライブ自体に対する様々な制御をします。</p>
|
||||||
<pre>
|
<pre>
|
||||||
DRESULT disk_ioctl (
|
DRESULT disk_ioctl (
|
||||||
BYTE <em>Drive</em>, <span>/* 物理ドライブ番号 */</span>
|
BYTE <em>Drive</em>, <span class="c">/* 物理ドライブ番号 */</span>
|
||||||
BYTE <em>Command</em>, <span>/* 制御コマンド */</span>
|
BYTE <em>Command</em>, <span class="c">/* 制御コマンド */</span>
|
||||||
void* <em>Buffer</em> <span>/* データ受け渡しバッファ */</span>
|
void* <em>Buffer</em> <span class="c">/* データ受け渡しバッファ */</span>
|
||||||
);
|
);
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para arg">
|
||||||
<h4>引数</h4>
|
<h4>引数</h4>
|
||||||
<dl class="par">
|
<dl class="par">
|
||||||
<dt>Drive</dt>
|
<dt>Drive</dt>
|
||||||
@ -35,7 +35,7 @@ DRESULT disk_ioctl (
|
|||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para ret">
|
||||||
<h4>戻り値</h4>
|
<h4>戻り値</h4>
|
||||||
<dl class="ret">
|
<dl class="ret">
|
||||||
<dt>RES_OK (0)</dt>
|
<dt>RES_OK (0)</dt>
|
||||||
@ -49,7 +49,7 @@ DRESULT disk_ioctl (
|
|||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para desc">
|
||||||
<h4>解説</h4>
|
<h4>解説</h4>
|
||||||
<p>物理ドライブの種類によりサポートされるコマンドは異なりますが、FatFsモジュールでは、次の汎用コマンドのみ使用し、特定のハードウェアに依存した制御は行いません。</p>
|
<p>物理ドライブの種類によりサポートされるコマンドは異なりますが、FatFsモジュールでは、次の汎用コマンドのみ使用し、特定のハードウェアに依存した制御は行いません。</p>
|
||||||
<table class="lst">
|
<table class="lst">
|
||||||
|
|||||||
@ -11,20 +11,20 @@
|
|||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para func">
|
||||||
<h2>disk_read</h2>
|
<h2>disk_read</h2>
|
||||||
<p>ディスクからセクタを読み出します。</p>
|
<p>ディスクからセクタを読み出します。</p>
|
||||||
<pre>
|
<pre>
|
||||||
DRESULT disk_read (
|
DRESULT disk_read (
|
||||||
BYTE <em>Drive</em>, <span>/* 物理ドライブ番号 */</span>
|
BYTE <em>Drive</em>, <span class="c">/* 物理ドライブ番号 */</span>
|
||||||
BYTE* <em>Buffer</em>, <span>/* 読み出しバッファへのポインタ */</span>
|
BYTE* <em>Buffer</em>, <span class="c">/* 読み出しバッファへのポインタ */</span>
|
||||||
DWORD <em>SectorNumber</em>, <span>/* 読み出し開始セクタ番号 */</span>
|
DWORD <em>SectorNumber</em>, <span class="c">/* 読み出し開始セクタ番号 */</span>
|
||||||
BYTE <em>SectorCount</em> <span>/* 読み出しセクタ数 */</span>
|
BYTE <em>SectorCount</em> <span class="c">/* 読み出しセクタ数 */</span>
|
||||||
);
|
);
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para arg">
|
||||||
<h4>引数</h4>
|
<h4>引数</h4>
|
||||||
<dl class="par">
|
<dl class="par">
|
||||||
<dt>Drive</dt>
|
<dt>Drive</dt>
|
||||||
@ -34,12 +34,12 @@ DRESULT disk_read (
|
|||||||
<dt>SectorNumber</dt>
|
<dt>SectorNumber</dt>
|
||||||
<dd>読み出しを開始するセクタ番号。LBAで指定します。</dd>
|
<dd>読み出しを開始するセクタ番号。LBAで指定します。</dd>
|
||||||
<dt>SectorCount</dt>
|
<dt>SectorCount</dt>
|
||||||
<dd>読み出すセクタ数。 1~128の範囲で指定します。一般的に、複数セクタの転送要求はデバイスに対してマルチ・セクタ転送しなければなりません。複数のシングル・セクタ転送に分解した場合、読み出し速度が低下します。</dd>
|
<dd>読み出すセクタ数。 1~128の範囲で指定します。一般的に、複数セクタの転送要求はデバイスに対して可能な限りマルチ・セクタ転送しなければなりません。複数のシングル・セクタ転送に分解した場合、読み出し速度が低下します。</dd>
|
||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para ret">
|
||||||
<h4>戻り値</h4>
|
<h4>戻り値</h4>
|
||||||
<dl class="ret">
|
<dl class="ret">
|
||||||
<dt>RES_OK (0)</dt>
|
<dt>RES_OK (0)</dt>
|
||||||
|
|||||||
@ -11,17 +11,17 @@
|
|||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para func">
|
||||||
<h2>disk_status</h2>
|
<h2>disk_status</h2>
|
||||||
<p>ディスク・ドライブの状態を取得します。</p>
|
<p>ディスク・ドライブの状態を取得します。</p>
|
||||||
<pre>
|
<pre>
|
||||||
DSTATUS disk_status (
|
DSTATUS disk_status (
|
||||||
BYTE <em>Drive</em> <span>/* 物理ドライブ番号 */</span>
|
BYTE <em>Drive</em> <span class="c">/* 物理ドライブ番号 */</span>
|
||||||
);
|
);
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para arg">
|
||||||
<h4>引数</h4>
|
<h4>引数</h4>
|
||||||
<dl class="par">
|
<dl class="par">
|
||||||
<dt>Drive</dt>
|
<dt>Drive</dt>
|
||||||
@ -30,7 +30,7 @@ DSTATUS disk_status (
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para ret">
|
||||||
<h4>戻り値</h4>
|
<h4>戻り値</h4>
|
||||||
<p>物理ドライブの状態が次のフラグの組み合わせの値で返されます。</p>
|
<p>物理ドライブの状態が次のフラグの組み合わせの値で返されます。</p>
|
||||||
<dl class="ret">
|
<dl class="ret">
|
||||||
|
|||||||
@ -11,20 +11,20 @@
|
|||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para func">
|
||||||
<h2>disk_write</h2>
|
<h2>disk_write</h2>
|
||||||
<p>ディスクにデータを書き込みます。</p>
|
<p>ディスクにデータを書き込みます。</p>
|
||||||
<pre>
|
<pre>
|
||||||
DRESULT disk_write (
|
DRESULT disk_write (
|
||||||
BYTE <em>Drive</em>, /* 物理ドライブ番号 */
|
BYTE <em>Drive</em>, <span class="c">/* 物理ドライブ番号 */</span>
|
||||||
const BYTE* <em>Buffer</em>, /* 書き込むデータへのポインタ */
|
const BYTE* <em>Buffer</em>, <span class="c">/* 書き込むデータへのポインタ */</span>
|
||||||
DWORD <em>SectorNumber</em>, /* 書き込み開始セクタ番号 */
|
DWORD <em>SectorNumber</em>, <span class="c">/* 書き込み開始セクタ番号 */</span>
|
||||||
BYTE <em>SectorCount</em> /* 書き込みセクタ数 */
|
BYTE <em>SectorCount</em> <span class="c">/* 書き込みセクタ数 */</span>
|
||||||
);
|
);
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para arg">
|
||||||
<h4>引数</h4>
|
<h4>引数</h4>
|
||||||
<dl class="par">
|
<dl class="par">
|
||||||
<dt>Drive</dt>
|
<dt>Drive</dt>
|
||||||
@ -34,12 +34,12 @@ DRESULT disk_write (
|
|||||||
<dt>SectorNumber</dt>
|
<dt>SectorNumber</dt>
|
||||||
<dd>書き込みを開始するセクタ番号。LBAで指定します。</dd>
|
<dd>書き込みを開始するセクタ番号。LBAで指定します。</dd>
|
||||||
<dt>SectorCount</dt>
|
<dt>SectorCount</dt>
|
||||||
<dd>書き込むセクタ数。 1~128で指定します。一般的に、複数セクタの転送要求はデバイスに対してマルチ・セクタ転送しなければなりません。複数のシングル・セクタ転送に分解した場合、書き込み速度は極端に低下します。</dd>
|
<dd>書き込むセクタ数。 1~128で指定します。一般的に、複数セクタの転送要求はデバイスに対して可能な限りマルチ・セクタ転送しなければなりません。複数のシングル・セクタ転送に分解した場合、書き込み速度は極端に低下します。</dd>
|
||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para ret">
|
||||||
<h4>戻り値</h4>
|
<h4>戻り値</h4>
|
||||||
<dl class="ret">
|
<dl class="ret">
|
||||||
<dt>RES_OK (0)</dt>
|
<dt>RES_OK (0)</dt>
|
||||||
@ -56,7 +56,7 @@ DRESULT disk_write (
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para desc">
|
||||||
<h4>解説</h4>
|
<h4>解説</h4>
|
||||||
<p>リード・オンリー構成ではこの関数は必要とされません。</p>
|
<p>リード・オンリー構成ではこの関数は必要とされません。</p>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
62
doc/ja/eof.html
Normal file
62
doc/ja/eof.html
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||||
|
<html lang="ja">
|
||||||
|
<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="alternate" hreflang="en" title="English" href="../en/eof.html">
|
||||||
|
<link rel="stylesheet" href="../css_j.css" type="text/css" media="screen" title="ELM Default">
|
||||||
|
<title>FatFs - f_eof</title>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<div class="para func">
|
||||||
|
<h2>f_eof</h2>
|
||||||
|
<p>リード/ライト・ポインタがファイル終端に達しているかどうか調べます。.</p>
|
||||||
|
<pre>
|
||||||
|
int f_eof (
|
||||||
|
FIL* <em>FileObject</em> <span class="c">/* ファイル・オブジェクト */</span>
|
||||||
|
);
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="para arg">
|
||||||
|
<h4>引数</h4>
|
||||||
|
<dl class="par">
|
||||||
|
<dt>FileObject</dt>
|
||||||
|
<dd>ファイル・オブジェクト構造体へのポインタを指定します。</dd>
|
||||||
|
</dl>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="para ret">
|
||||||
|
<h4>戻り値</h4>
|
||||||
|
<p>リード/ライト・ポインタがファイル終端にあり読み出すデータがない場合は、0以外の値を返します。それ以外の時は0を返します。</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="para desc">
|
||||||
|
<h4>解説</h4>
|
||||||
|
<p>f_eof関数は、現リビジョンではマクロとして実装されています。</p>
|
||||||
|
<pre>
|
||||||
|
<span class="k">#define</span> f_eof(fp) (((fp)->fptr) == ((fp)->fsize) ? 1 : 0)
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="para comp">
|
||||||
|
<h4>対応情報</h4>
|
||||||
|
<p>常に使用可能。</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="para ref">
|
||||||
|
<h4>参照</h4>
|
||||||
|
<p><tt><a href="open.html">f_open</a>, <a href="lseek.html">f_lseek</a>, <a href="sfile.html">FIL</a></tt></p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p class="foot"><a href="../00index_j.html">戻る</a></p>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
62
doc/ja/error.html
Normal file
62
doc/ja/error.html
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||||
|
<html lang="ja">
|
||||||
|
<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="alternate" hreflang="en" title="English" href="../en/error.html">
|
||||||
|
<link rel="stylesheet" href="../css_j.css" type="text/css" media="screen" title="ELM Default">
|
||||||
|
<title>FatFs - f_error</title>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<div class="para func">
|
||||||
|
<h2>f_error</h2>
|
||||||
|
<p>エラー発生の有無を調べます。</p>
|
||||||
|
<pre>
|
||||||
|
int f_error (
|
||||||
|
FIL* <em>FileObject</em> <span class="c">/* ファイル・オブジェクト */</span>
|
||||||
|
);
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="para arg">
|
||||||
|
<h4>引数</h4>
|
||||||
|
<dl class="par">
|
||||||
|
<dt>FileObject</dt>
|
||||||
|
<dd>ファイル・オブジェクト構造体へのポインタを指定します。</dd>
|
||||||
|
</dl>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="para ret">
|
||||||
|
<h4>戻り値</h4>
|
||||||
|
<p>ファイル操作中のエラーで処理が中断されている場合は、0以外の値を返します。それ以外の時は0を返します。</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="para desc">
|
||||||
|
<h4>解説</h4>
|
||||||
|
<p>f_error関数は、現リビジョンではマクロとして実装されています。</p>
|
||||||
|
<pre>
|
||||||
|
<span class="k">#define</span> f_error(fp) (((fp)->flag & FA__ERROR) ? 1 : 0)
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="para comp">
|
||||||
|
<h4>対応情報</h4>
|
||||||
|
<p>常に使用可能。</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="para ref">
|
||||||
|
<h4>参照</h4>
|
||||||
|
<p><tt><a href="open.html">f_open</a>, <a href="sfile.html">FIL</a></tt></p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p class="foot"><a href="../00index_j.html">戻る</a></p>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para func">
|
||||||
<h2>get_fattime</h2>
|
<h2>get_fattime</h2>
|
||||||
<p>現在時刻を取得します。</p>
|
<p>現在時刻を取得します。</p>
|
||||||
<pre>
|
<pre>
|
||||||
@ -20,7 +20,7 @@ DWORD get_fattime (void);
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para ret">
|
||||||
<h4>戻り値</h4>
|
<h4>戻り値</h4>
|
||||||
<p>現在のローカル・タイムが<tt>DWORD</tt>値にパックされて返されます。ビット・フィールドは次に示すようになります。</p>
|
<p>現在のローカル・タイムが<tt>DWORD</tt>値にパックされて返されます。ビット・フィールドは次に示すようになります。</p>
|
||||||
<dl>
|
<dl>
|
||||||
@ -40,7 +40,7 @@ DWORD get_fattime (void);
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para desc">
|
||||||
<h4>解説</h4>
|
<h4>解説</h4>
|
||||||
<p>RTCをサポートしないシステムでも、何らかの日付として有効な値を返さなければなりません。0を返した場合、そのファイルは日付を持ちません。リード・オンリー構成ではこの関数は必要とされません。</p>
|
<p>RTCをサポートしないシステムでも、何らかの日付として有効な値を返さなければなりません。0を返した場合、そのファイルは日付を持ちません。リード・オンリー構成ではこの関数は必要とされません。</p>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -6,15 +6,16 @@
|
|||||||
<link rel="up" title="FatFs" href="../00index_j.html">
|
<link rel="up" title="FatFs" href="../00index_j.html">
|
||||||
<link rel="alternate" hreflang="en" title="English" href="../en/filename.html">
|
<link rel="alternate" hreflang="en" title="English" href="../en/filename.html">
|
||||||
<link rel="stylesheet" href="../css_j.css" type="text/css" media="screen" title="ELM Default">
|
<link rel="stylesheet" href="../css_j.css" type="text/css" media="screen" title="ELM Default">
|
||||||
<title>FatFs - ファイル・ディレクトリの指定方法</title>
|
<title>FatFs - パス名のフォーマット</title>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
<h1>パス名のフォーマット</h1>
|
||||||
<div class="para">
|
<div class="para">
|
||||||
<h3>ファイル・ディレクトリの指定方法</h3>
|
<h3>ファイル・ディレクトリ名</h3>
|
||||||
<p>FatFsモジュールでのファイル、ディレクトリ、ドライブの指定方法はDOS/Windowsとほぼ同じです。パス名のフォーマットは次の通りです。</p>
|
<p>FatFsモジュールでのファイル、ディレクトリ、ドライブの指定方法はDOS/Windows APIとほぼ同じです。パス名のフォーマットは次の通りです。</p>
|
||||||
<p><tt>"[論理ドライブ番号:][/]ディレクトリ名/ファイル名"</tt></p>
|
<p><tt>"[論理ドライブ番号:][/]ディレクトリ名/ファイル名"</tt></p>
|
||||||
<p>FatFsモジュールは長いファイル名(LFN)および8.3形式ファイル名(SFN)に対応しています。LFNは、<tt>(_USE_LFN > 0)</tt>のとき使用可能になります。DOS/Windowsとの違いは、ディレクトリ・セパレータと論理ドライブ番号の指定です。ディレクトリ・セパレータには / または \ を使用します。論理ドライブ番号は、'0'~'9'の一文字の数字とコロンで指定し、省略した場合はデフォルト・ドライブ(0またはカレント・ドライブ)が選択されます。</p>
|
<p>FatFsモジュールは長いファイル名(LFN)および8.3形式ファイル名(SFN)に対応しています。LFNは、<tt>(_USE_LFN > 0)</tt>のとき使用可能になります。ディレクトリ・セパレータにはDOS/Windows APIと同じく / と \ を使用します。連続したセパレータは無視され1個として扱われます。唯一の違いは、論理ドライブの指定だけです。論理ドライブ番号は、'0'~'9'の一文字の数字とコロンで指定し、省略した場合はデフォルト・ドライブ(0またはカレント・ドライブ)が選択されます。</p>
|
||||||
<p>Nul文字と制御文字(\0~\x1F)は、パス名の終端として認識されます。パス名に先行あるいは中に含まれるスペースは、LFN構成では名前の一部として有効ですが、非LFN構成ではパス名の終端として認識されます。</p>
|
<p>Nul文字と制御文字(\0~\x1F)は、パス名の終端として認識されます。パス名に先行あるいは中に含まれるスペースは、LFN構成では名前の一部として有効ですが、非LFN構成ではパス名の終端として認識されます。</p>
|
||||||
<p>標準構成<tt>(_FS_RPATH == 0)</tt>のときは、全てのオブジェクトがルート・ディレクトリから辿る絶対パスで指定されます。OS指向なカレント・ディレクトリという概念は無く、またドット・ディレクトリ("."や"..")は使用できません。パス名先頭のセパレータは無視されます。デフォルト・ドライブ番号は常に0になります。</p>
|
<p>標準構成<tt>(_FS_RPATH == 0)</tt>のときは、全てのオブジェクトがルート・ディレクトリから辿る絶対パスで指定されます。OS指向なカレント・ディレクトリという概念は無く、またドット・ディレクトリ("."や"..")は使用できません。パス名先頭のセパレータは無視されます。デフォルト・ドライブ番号は常に0になります。</p>
|
||||||
<p>相対パスを有効<tt>(_FS_RPATH == 1)</tt>にしたときは、先行するセパレータの有無によって検索開始ディレクトリが変わり、セパレータがある場合はルート・ディレクトリから、無い場合は<a href="chdir.html">f_chdir関数</a>で設定されるカレント・ディレクトリからになります。またパス名にドット・ディレクトリが使用できます。デフォルト・ドライブ番号は<a href="chdrive.html">f_chdrive関数</a>で設定された値となります。</p>
|
<p>相対パスを有効<tt>(_FS_RPATH == 1)</tt>にしたときは、先行するセパレータの有無によって検索開始ディレクトリが変わり、セパレータがある場合はルート・ディレクトリから、無い場合は<a href="chdir.html">f_chdir関数</a>で設定されるカレント・ディレクトリからになります。またパス名にドット・ディレクトリが使用できます。デフォルト・ドライブ番号は<a href="chdrive.html">f_chdrive関数</a>で設定された値となります。</p>
|
||||||
@ -39,9 +40,9 @@
|
|||||||
<h3>Unicode API</h3>
|
<h3>Unicode API</h3>
|
||||||
<p>ファイル関数の入出力のうちファイル名やパス名を指定する引数の型は、<tt>TCHAR</tt>で定義されていますが、これは<tt>char</tt>のエリアスになっています。そして、<tt>_CODE_PAGE</tt>で指定される ANSI/OEMコード(SBCSまたはDBCS)の文字列として扱われます。ファイル名入出力をUnicodeとする構成(LFN構成で、かつ<tt>_LFN_UNICODE</tt>を 1)にしたときは、<tt>TCHAR</tt>はワイド文字(<tt>unsigned short</tt>)に切り替わり、パス名にUnicodeを使用するようになります。これにより LFNフル対応となり、ANSI/OEMコードにない文字(たとえば ✝☪✡☸☭など)も使用できます。この設定は文字列入出力関数のデータ型とエンコーディングにも影響を与えます。リテラル文字列を定義するとき、次に示すように<tt>_T(s)</tt>および<tt>_TEXT(s)</tt>マクロを使ってANSI/OEMとUnicodeを自動切り替えすることができます。</p>
|
<p>ファイル関数の入出力のうちファイル名やパス名を指定する引数の型は、<tt>TCHAR</tt>で定義されていますが、これは<tt>char</tt>のエリアスになっています。そして、<tt>_CODE_PAGE</tt>で指定される ANSI/OEMコード(SBCSまたはDBCS)の文字列として扱われます。ファイル名入出力をUnicodeとする構成(LFN構成で、かつ<tt>_LFN_UNICODE</tt>を 1)にしたときは、<tt>TCHAR</tt>はワイド文字(<tt>unsigned short</tt>)に切り替わり、パス名にUnicodeを使用するようになります。これにより LFNフル対応となり、ANSI/OEMコードにない文字(たとえば ✝☪✡☸☭など)も使用できます。この設定は文字列入出力関数のデータ型とエンコーディングにも影響を与えます。リテラル文字列を定義するとき、次に示すように<tt>_T(s)</tt>および<tt>_TEXT(s)</tt>マクロを使ってANSI/OEMとUnicodeを自動切り替えすることができます。</p>
|
||||||
<pre>
|
<pre>
|
||||||
f_open(fp, "filename.txt", FA_READ); <span>/* ANSI/OEM専用コード */</span>
|
f_open(fp, "filename.txt", FA_READ); <span class="c">/* ANSI/OEM専用コード */</span>
|
||||||
f_open(fp, L"filename.txt", FA_READ); <span>/* Unicode専用コード */</span>
|
f_open(fp, L"filename.txt", FA_READ); <span class="c">/* Unicode専用コード */</span>
|
||||||
f_open(fp, _T("filename.txt"), FA_READ); <span>/* 両用コード */</span>
|
f_open(fp, _T("filename.txt"), FA_READ); <span class="c">/* 両用コード */</span>
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -54,10 +55,10 @@
|
|||||||
論理ドライブ3を物理ドライブ1(リムーバブル・ディスク)に割り当てる場合。
|
論理ドライブ3を物理ドライブ1(リムーバブル・ディスク)に割り当てる場合。
|
||||||
|
|
||||||
const PARTITION Drives[] = {
|
const PARTITION Drives[] = {
|
||||||
{0, 0}, <span>/* Logical drive 0 ==> Physical drive 0, 1st partition */</span>
|
{0, 0}, <span class="c">/* Logical drive 0 ==> Physical drive 0, 1st partition */</span>
|
||||||
{0, 1}, <span>/* Logical drive 1 ==> Physical drive 0, 2nd partition */</span>
|
{0, 1}, <span class="c">/* Logical drive 1 ==> Physical drive 0, 2nd partition */</span>
|
||||||
{0, 2}, <span>/* Logical drive 2 ==> Physical drive 0, 3rd partition */</span>
|
{0, 2}, <span class="c">/* Logical drive 2 ==> Physical drive 0, 3rd partition */</span>
|
||||||
{1, 0} <span>/* Logical drive 3 ==> Physical drive 1 */</span>
|
{1, 0} <span class="c">/* Logical drive 3 ==> Physical drive 1 */</span>
|
||||||
};
|
};
|
||||||
</pre>
|
</pre>
|
||||||
<p>複数区画指定を使用する場合、次の点に注意しなければなりません。
|
<p>複数区画指定を使用する場合、次の点に注意しなければなりません。
|
||||||
@ -66,7 +67,6 @@ const PARTITION Drives[] = {
|
|||||||
<li>物理ドライブがSFD形式(区画テーブル無し)の場合、区画指定は無視される。</li>
|
<li>物理ドライブがSFD形式(区画テーブル無し)の場合、区画指定は無視される。</li>
|
||||||
<li>複数の論理ドライブを持つ物理ドライブは、固定ディスクでなければならない。</li>
|
<li>複数の論理ドライブを持つ物理ドライブは、固定ディスクでなければならない。</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@ -11,20 +11,20 @@
|
|||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para func">
|
||||||
<h2>f_forward</h2>
|
<h2>f_forward</h2>
|
||||||
<p>ファイルからデータを読み出し、送信ストリームに直接転送します。</p>
|
<p>ファイルからデータを読み出し、送信ストリームに直接転送します。</p>
|
||||||
<pre>
|
<pre>
|
||||||
FRESULT f_forward (
|
FRESULT f_forward (
|
||||||
FIL* <em>FileObject</em>, <span>/* ファイル・オブジェクト構造体 */</span>
|
FIL* <em>FileObject</em>, <span class="c">/* ファイル・オブジェクト構造体 */</span>
|
||||||
UINT (*<em>Func</em>)(const BYTE*,UINT), <span>/* データ転送関数 */</span>
|
UINT (*<em>Func</em>)(const BYTE*,UINT), <span class="c">/* データ転送関数 */</span>
|
||||||
UINT <em>ByteToFwd</em>, <span>/* 転送するバイト数 */</span>
|
UINT <em>ByteToFwd</em>, <span class="c">/* 転送するバイト数 */</span>
|
||||||
UINT* <em>ByteFwd</em> <span>/* 転送されたバイト数 */</span>
|
UINT* <em>ByteFwd</em> <span class="c">/* 転送されたバイト数 */</span>
|
||||||
);
|
);
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para arg">
|
||||||
<h4>引数</h4>
|
<h4>引数</h4>
|
||||||
<dl class="par">
|
<dl class="par">
|
||||||
<dt>FileObject</dt>
|
<dt>FileObject</dt>
|
||||||
@ -39,60 +39,55 @@ FRESULT f_forward (
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para ret">
|
||||||
<h4>戻り値</h4>
|
<h4>戻り値</h4>
|
||||||
<dl class="ret">
|
<p>
|
||||||
<dt>FR_OK (0)</dt>
|
<a href="rc.html#ok">FR_OK</a>,
|
||||||
<dd>正常終了。</dd>
|
<a href="rc.html#de">FR_DISK_ERR</a>,
|
||||||
<dt>FR_DENIED</dt>
|
<a href="rc.html#ie">FR_INT_ERR</a>,
|
||||||
<dd>非読み込みモードで開いたファイルから読み込もうとした。</dd>
|
<a href="rc.html#nr">FR_NOT_READY</a>,
|
||||||
<dt>FR_DISK_ERR</dt>
|
<a href="rc.html#de">FR_DENIED</a>,
|
||||||
<dd>ディスク・エラーによる失敗。</dd>
|
<a href="rc.html#io">FR_INVALID_OBJECT</a>,
|
||||||
<dt>FR_INT_ERR</dt>
|
<a href="rc.html#tm">FR_TIMEOUT</a>
|
||||||
<dd>不正なFAT構造または内部エラーによる失敗。</dd>
|
</p>
|
||||||
<dt>FR_NOT_READY</dt>
|
|
||||||
<dd>メディアがセットされていないなど、物理ドライブが動作不能状態。</dd>
|
|
||||||
<dt>FR_INVALID_OBJECT</dt>
|
|
||||||
<dd>無効なファイル・オブジェクト。</dd>
|
|
||||||
</dl>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para desc">
|
||||||
<h4>解説</h4>
|
<h4>解説</h4>
|
||||||
<p>ファイルのデータをバッファに読み出さずに送信ストリームに直接転送します。アプリケーション側でデータ・バッファを必要としないので、メモリの限られた環境で有効です。リード/ライト・ポインタは転送されたバイト数だけ進みます。指定されたバイト数の転送中にファイルの終端に達した場合や送信ストリームがビジーになった場合、<tt>*ByteFwd</tt>は<tt>ByteToFwd</tt>よりも小さくなります。</p>
|
<p>ファイルのデータをバッファに読み出さずに送信ストリームに直接転送します。アプリケーション側でデータ・バッファを必要としないので、メモリの限られた環境で有効です。リード/ライト・ポインタは転送されたバイト数だけ進みます。指定されたバイト数の転送中にファイルの終端に達した場合や送信ストリームがビジーになった場合、<tt>*ByteFwd</tt>は<tt>ByteToFwd</tt>よりも小さくなります。</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para comp">
|
||||||
<h4>対応情報</h4>
|
<h4>対応情報</h4>
|
||||||
<p><tt>_USE_FORWARD == 1</tt>で、且つ<tt>_FS_TINY == 1</tt>のときに使用可能です。</p>
|
<p><tt>_USE_FORWARD == 1</tt>で、且つ<tt>_FS_TINY == 1</tt>のときに使用可能です。</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para use">
|
||||||
<h4>使用例(オーディオ再生)</h4>
|
<h4>使用例(オーディオ再生)</h4>
|
||||||
<pre>
|
<pre>
|
||||||
<span>/*-----------------------------------------------------------------------*/</span>
|
<span class="c">/*-----------------------------------------------------------------------*/</span>
|
||||||
<span>/* f_forward関数から呼ばれるデータ送信関数の例 */</span>
|
<span class="c">/* f_forward関数から呼ばれるデータ送信関数の例 */</span>
|
||||||
<span>/*-----------------------------------------------------------------------*/</span>
|
<span class="c">/*-----------------------------------------------------------------------*/</span>
|
||||||
|
|
||||||
UINT out_stream ( <span>/* 戻り値: 転送されたバイト数またはストリームの状態 */</span>
|
UINT out_stream ( <span class="c">/* 戻り値: 転送されたバイト数またはストリームの状態 */</span>
|
||||||
const BYTE *p, <span>/* 転送するデータを指すポインタ */</span>
|
const BYTE *p, <span class="c">/* 転送するデータを指すポインタ */</span>
|
||||||
UINT btf <span>/* >0: 転送を行う(バイト数). 0: ストリームの状態を調べる */</span>
|
UINT btf <span class="c">/* >0: 転送を行う(バイト数). 0: ストリームの状態を調べる */</span>
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
UINT cnt = 0;
|
UINT cnt = 0;
|
||||||
|
|
||||||
|
|
||||||
if (btf == 0) { <span>/* センス要求 */</span>
|
if (btf == 0) { <span class="c">/* センス要求 */</span>
|
||||||
<span>/* ストリームの状態を返す (0: ビジー, 1: レディ) */</span>
|
<span class="c">/* ストリームの状態を返す (0: ビジー, 1: レディ) */</span>
|
||||||
<span>/* 一旦、レディを返したら、続く転送要求で少なくとも1バイトは */</span>
|
<span class="c">/* 一旦、レディを返したら、続く転送要求で少なくとも1バイトは */</span>
|
||||||
<span>/* 転送されないと f_forward関数は FR_RW_ERROR となる。 */</span>
|
<span class="c">/* 転送されないと f_forward関数は FR_INT_ERR となる。 */</span>
|
||||||
if (FIFO_READY) cnt = 1;
|
if (FIFO_READY) cnt = 1;
|
||||||
}
|
}
|
||||||
else { <span>/* 転送要求 */</span>
|
else { <span class="c">/* 転送要求 */</span>
|
||||||
do { <span>/* 全てのバイトを転送するか、ストリームがビジーになるまで繰り返す */</span>
|
do { <span class="c">/* 全てのバイトを転送するか、ストリームがビジーになるまで繰り返す */</span>
|
||||||
FIFO_PORT = *p++;
|
FIFO_PORT = *p++;
|
||||||
cnt++;
|
cnt++;
|
||||||
} while (cnt < btf && FIFO_READY);
|
} while (cnt < btf && FIFO_READY);
|
||||||
@ -102,32 +97,32 @@ UINT out_stream ( <span>/*
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
<span>/*-----------------------------------------------------------------------*/</span>
|
<span class="c">/*-----------------------------------------------------------------------*/</span>
|
||||||
<span>/* f_forward関数の使用例 */</span>
|
<span class="c">/* f_forward関数の使用例 */</span>
|
||||||
<span>/*-----------------------------------------------------------------------*/</span>
|
<span class="c">/*-----------------------------------------------------------------------*/</span>
|
||||||
|
|
||||||
FRESULT play_file (
|
FRESULT play_file (
|
||||||
char *fn <span>/* 再生するオーディオ・ファイル名を指すポインタ */</span>
|
char *fn <span class="c">/* 再生するオーディオ・ファイル名を指すポインタ */</span>
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
FRESULT rc;
|
FRESULT rc;
|
||||||
FIL fil;
|
FIL fil;
|
||||||
UINT dmy;
|
UINT dmy;
|
||||||
|
|
||||||
<span>/* ファイルを読み出しモードで開く */</span>
|
<span class="c">/* ファイルを読み出しモードで開く */</span>
|
||||||
rc = f_open(&fil, fn, FA_READ);
|
rc = f_open(&fil, fn, FA_READ);
|
||||||
if (rc) return rc;
|
if (rc) return rc;
|
||||||
|
|
||||||
<span>/* 全てのデータが転送されるかエラーが発生するまで続ける */</span>
|
<span class="c">/* 全てのデータが転送されるかエラーが発生するまで続ける */</span>
|
||||||
while (rc == FR_OK && fil.fptr < fil.fsize) {
|
while (rc == FR_OK && fil.fptr < fil.fsize) {
|
||||||
|
|
||||||
<span>/* ほかの処理... */</span>
|
<span class="c">/* ほかの処理... */</span>
|
||||||
|
|
||||||
<span>/* 定期的または要求に応じてデータをストリームに送出する */</span>
|
<span class="c">/* 定期的または要求に応じてデータをストリームに送出する */</span>
|
||||||
rc = f_forward(&fil, out_stream, 1000, &dmy);
|
rc = f_forward(&fil, out_stream, 1000, &dmy);
|
||||||
}
|
}
|
||||||
|
|
||||||
<span>/* ファイルを閉じて戻る */</span>
|
<span class="c">/* ファイルを閉じて戻る */</span>
|
||||||
f_close(&fil);
|
f_close(&fil);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
@ -135,7 +130,7 @@ FRESULT play_file (
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para ref">
|
||||||
<h4>参照</h4>
|
<h4>参照</h4>
|
||||||
<p><tt><a href="open.html">f_open</a>, <a href="gets.html">fgets</a>, <a href="write.html">f_write</a>, <a href="close.html">f_close</a>, <a href="sfile.html">FIL</a></tt></p>
|
<p><tt><a href="open.html">f_open</a>, <a href="gets.html">fgets</a>, <a href="write.html">f_write</a>, <a href="close.html">f_close</a>, <a href="sfile.html">FIL</a></tt></p>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
70
doc/ja/getcwd.html
Normal file
70
doc/ja/getcwd.html
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||||
|
<html lang="ja">
|
||||||
|
<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="alternate" hreflang="en" title="English" href="../en/getcwd.html">
|
||||||
|
<link rel="stylesheet" href="../css_j.css" type="text/css" media="screen" title="ELM Default">
|
||||||
|
<title>FatFs - f_getcwd</title>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<div class="para func">
|
||||||
|
<h2>f_getcwd</h2>
|
||||||
|
<p>カレント・ディレクトリを得ます</p>
|
||||||
|
<pre>
|
||||||
|
FRESULT f_getcwd (
|
||||||
|
TCHAR* <em>Buffer</em>, <span class="c">/* バッファ */</span>
|
||||||
|
UINT <em>BufferLen</em> <span class="c">/* バッファ・サイズ */</span>
|
||||||
|
);
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="para arg">
|
||||||
|
<h4>引数</h4>
|
||||||
|
<dl class="par">
|
||||||
|
<dt>Buffer</dt>
|
||||||
|
<dd>カレント・ディレクトリの文字列を格納するバッファ</dd>
|
||||||
|
<dt>BufferLen</dt>
|
||||||
|
<dd>TCHAR単位のバッファ・サイズ</dd>
|
||||||
|
</dl>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="para ret">
|
||||||
|
<h4>戻り値</h4>
|
||||||
|
<p>
|
||||||
|
<a href="rc.html#ok">FR_OK</a>,
|
||||||
|
<a href="rc.html#de">FR_DISK_ERR</a>,
|
||||||
|
<a href="rc.html#ie">FR_INT_ERR</a>,
|
||||||
|
<a href="rc.html#nr">FR_NOT_READY</a>,
|
||||||
|
<a href="rc.html#ne">FR_NOT_ENABLED</a>,
|
||||||
|
<a href="rc.html#ns">FR_NO_FILESYSTEM</a>,
|
||||||
|
<a href="rc.html#tm">FR_TIMEOUT</a>,
|
||||||
|
<a href="rc.html#nc">FR_NOT_ENOUGH_CORE</a>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="para desc">
|
||||||
|
<h4>解説</h4>
|
||||||
|
<p>f_getcwd関数は、カレント・ドライブのカレント・ディレクトリのパス文字列を取得します。パス文字列は、ドライブ番号を含んだフル・パス名です。</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="para comp">
|
||||||
|
<h4>対応情報</h4>
|
||||||
|
<p><tt>_FS_RPATH == 2</tt>のとき使用可能です。</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="para ref">
|
||||||
|
<h4>参照</h4>
|
||||||
|
<p><tt><a href="chdrive.html">f_chdrive</a>, <a href="chdir.html">f_chdir</a></tt></p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p class="foot"><a href="../00index_j.html">戻る</a></p>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@ -11,19 +11,19 @@
|
|||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para func">
|
||||||
<h2>f_getfree</h2>
|
<h2>f_getfree</h2>
|
||||||
<p>論理ドライブ上の未使用クラスタ数を得ます。</p>
|
<p>論理ドライブ上の未使用クラスタ数を得ます。</p>
|
||||||
<pre>
|
<pre>
|
||||||
FRESULT f_getfree (
|
FRESULT f_getfree (
|
||||||
const TCHAR* <em>Path</em>, <span>/* 対象ドライブを指定します */</span>
|
const TCHAR* <em>Path</em>, <span class="c">/* 対象ドライブを指定します */</span>
|
||||||
DWORD* <em>Clusters</em>, <span>/* 空きクラスタ数を格納する変数へのポインタ */</span>
|
DWORD* <em>Clusters</em>, <span class="c">/* 空きクラスタ数を格納する変数へのポインタ */</span>
|
||||||
FATFS** <em>FileSystemObject</em> <span>/* ファイル・システム・オブジェクトを指すポインタへのポインタ */</span>
|
FATFS** <em>FileSystemObject</em> <span class="c">/* ファイル・システム・オブジェクトを指すポインタへのポインタ */</span>
|
||||||
);
|
);
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para arg">
|
||||||
<h4>引数</h4>
|
<h4>引数</h4>
|
||||||
<dl class="par">
|
<dl class="par">
|
||||||
<dt>Path</dt>
|
<dt>Path</dt>
|
||||||
@ -36,55 +36,49 @@ FRESULT f_getfree (
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para ret">
|
||||||
<h4>戻り値</h4>
|
<h4>戻り値</h4>
|
||||||
<dl class="ret">
|
<p>
|
||||||
<dt>FR_OK (0)</dt>
|
<a href="rc.html#ok">FR_OK</a>,
|
||||||
<dd>正常終了。<tt>*Clusters</tt>に空きクラスタ数が返されます。</dd>
|
<a href="rc.html#de">FR_DISK_ERR</a>,
|
||||||
<dt>FR_INVALID_DRIVE</dt>
|
<a href="rc.html#ie">FR_INT_ERR</a>,
|
||||||
<dd>ドライブ番号が不正。</dd>
|
<a href="rc.html#nr">FR_NOT_READY</a>,
|
||||||
<dt>FR_NOT_READY</dt>
|
<a href="rc.html#id">FR_INVALID_DRIVE</a>,
|
||||||
<dd>メディアがセットされていないなど、物理ドライブが動作不能状態。</dd>
|
<a href="rc.html#ne">FR_NOT_ENABLED</a>,
|
||||||
<dt>FR_DISK_ERR</dt>
|
<a href="rc.html#ns">FR_NO_FILESYSTEM</a>,
|
||||||
<dd>ディスク・エラーによる失敗。</dd>
|
<a href="rc.html#tm">FR_TIMEOUT</a>
|
||||||
<dt>FR_INT_ERR</dt>
|
</p>
|
||||||
<dd>不正なFAT構造または内部エラーによる失敗。</dd>
|
|
||||||
<dt>FR_NOT_ENABLED</dt>
|
|
||||||
<dd>その論理ドライブにワーク・エリアが与えられていない。</dd>
|
|
||||||
<dt>FR_NO_FILESYSTEM</dt>
|
|
||||||
<dd>有効なFATボリュームが見つからない。</dd>
|
|
||||||
</dl>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para desc">
|
||||||
<h4>解説</h4>
|
<h4>解説</h4>
|
||||||
<p>論理ドライブ上の空きクラスタ数を取得します。返されたファイル・システム・オブジェクトの<tt>csize</tt>メンバがクラスタあたりのセクタ数を示しているので、これを元に実際の空きサイズが計算できます。FAT32ボリュームにおいては、FSINFOセクタの状態によっては不正確な値を返したり、処理に時間がかかったりする可能性があります。</p>
|
<p>論理ドライブ上の空きクラスタ数を取得します。返されたファイル・システム・オブジェクトの<tt>csize</tt>メンバがクラスタあたりのセクタ数を示しているので、これを元に実際の空きサイズが計算できます。FAT32ボリュームにおいては、FSINFOセクタの状態によっては不正確な値を返したり、処理に時間がかかったりする可能性があります。</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para comp">
|
||||||
<h4>対応情報</h4>
|
<h4>対応情報</h4>
|
||||||
<p><tt>_FS_READONLY == 0</tt>で、且つ<tt>_FS_MINIMIZE == 0</tt>のとき使用可能です。</p>
|
<p><tt>_FS_READONLY == 0</tt>で、且つ<tt>_FS_MINIMIZE == 0</tt>のとき使用可能です。</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para use">
|
||||||
<h4>使用例</h4>
|
<h4>使用例</h4>
|
||||||
<pre>
|
<pre>
|
||||||
FATFS *fs;
|
FATFS *fs;
|
||||||
DWORD fre_clust, fre_sect, tot_sect;
|
DWORD fre_clust, fre_sect, tot_sect;
|
||||||
|
|
||||||
|
|
||||||
<span>/* ドライブ1のボリューム情報と空きクラスタ数を得る */</span>
|
<span class="c">/* ドライブ1のボリューム情報と空きクラスタ数を得る */</span>
|
||||||
res = f_getfree("1:", &fre_clust, &fs);
|
res = f_getfree("1:", &fre_clust, &fs);
|
||||||
if (res) die(res);
|
if (res) die(res);
|
||||||
|
|
||||||
<span>/* 全セクタ数と空きセクタ数を計算 */</span>
|
<span class="c">/* 全セクタ数と空きセクタ数を計算 */</span>
|
||||||
tot_sect = (fs->n_fatent - 2) * fs->csize;
|
tot_sect = (fs->n_fatent - 2) * fs->csize;
|
||||||
fre_sect = fre_clust * fs->csize;
|
fre_sect = fre_clust * fs->csize;
|
||||||
|
|
||||||
<span>/* ドライブサイズと空きサイズの表示 (512バイト/セクタと仮定) */</span>
|
<span class="c">/* ドライブサイズと空きサイズの表示 (512バイト/セクタと仮定) */</span>
|
||||||
printf("%lu KB total drive space.\n"
|
printf("%lu KB total drive space.\n"
|
||||||
"%lu KB available.\n",
|
"%lu KB available.\n",
|
||||||
fre_sect / 2, tot_sect / 2);
|
fre_sect / 2, tot_sect / 2);
|
||||||
@ -92,7 +86,7 @@ FRESULT f_getfree (
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para ref">
|
||||||
<h4>参照</h4>
|
<h4>参照</h4>
|
||||||
<tt><a href="sfatfs.html">FATFS</a></tt>
|
<tt><a href="sfatfs.html">FATFS</a></tt>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -11,19 +11,19 @@
|
|||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para func">
|
||||||
<h2>f_gets</h2>
|
<h2>f_gets</h2>
|
||||||
<p>ファイルから文字列を読み出します。</p>
|
<p>ファイルから文字列を読み出します。</p>
|
||||||
<pre>
|
<pre>
|
||||||
TCHAR* f_gets (
|
TCHAR* f_gets (
|
||||||
TCHAR* <em>Str</em>, <span>/* バッファ */</span>
|
TCHAR* <em>Str</em>, <span class="c">/* バッファ */</span>
|
||||||
int <em>Size</em>, <span>/* バッファのサイズ */</span>
|
int <em>Size</em>, <span class="c">/* バッファのサイズ */</span>
|
||||||
FIL* <em>FileObject</em> <span>/* ファイル・オブジェクト */</span>
|
FIL* <em>FileObject</em> <span class="c">/* ファイル・オブジェクト */</span>
|
||||||
);
|
);
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para arg">
|
||||||
<h4>引数</h4>
|
<h4>引数</h4>
|
||||||
<dl class="par">
|
<dl class="par">
|
||||||
<dt>Str</dt>
|
<dt>Str</dt>
|
||||||
@ -36,26 +36,26 @@ TCHAR* f_gets (
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para ret">
|
||||||
<h4>戻り値</h4>
|
<h4>戻り値</h4>
|
||||||
<p>関数が成功すると<tt>Str</tt>が返されます。</p>
|
<p>関数が成功すると<tt>Str</tt>が返されます。</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para desc">
|
||||||
<h4>解説</h4>
|
<h4>解説</h4>
|
||||||
<p>この関数は<a href="read.html">f_read()</a>のラッパー関数です。読み出し動作は、最初の<tt>'\n'</tt>を読み込むか、ファイル終端に達するか、<tt>Size - 1</tt>文字を読み出すまで続きます。読み込まれた文字列の終端には<tt>'\0'</tt>が付加されます。既にファイル終端で1文字も読み込まれなかったとき、または何らかのエラーが発生したときは関数は失敗しヌル・ポインタを返します。ファイル終端かエラーかは<tt>f_eof()</tt>,<tt>f_error()</tt>マクロで調べられます。</p>
|
<p>この関数は<a href="read.html">f_read()</a>のラッパー関数です。読み出し動作は、最初の<tt>'\n'</tt>を読み込むか、ファイル終端に達するか、<tt>Size - 1</tt>文字を読み出すまで続きます。読み込まれた文字列の終端には<tt>'\0'</tt>が付加されます。既にファイル終端で1文字も読み込まれなかったとき、または何らかのエラーが発生したときは関数は失敗しヌル・ポインタを返します。ファイル終端かエラーかは<tt>f_eof()</tt>,<tt>f_error()</tt>マクロで調べられます。</p>
|
||||||
<p>APIにUnicodeが選択されている(<tt>_LFN_UNICODE</tt>が1)ときは、UTF-8エンコードのテキスト・ファイルとしてUCS-2に変換してバッファに読み込みます。それ以外の時は無変換(1文字1バイト)で読み込みます。</p>
|
<p>APIにUnicodeが選択されている(<tt>_LFN_UNICODE</tt>が1)ときは、UTF-8エンコードのテキスト・ファイルとしてUCS-2に変換してバッファに読み込みます。それ以外の時は無変換(1文字1バイト)で読み込みます。</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para comp">
|
||||||
<h4>対応情報</h4>
|
<h4>対応情報</h4>
|
||||||
<p><tt>_USE_STRFUNC</tt>が 1または 2のとき使用可能です。2のときは、ファイルに含まれる<tt>'\r'</tt>が取り除かれてバッファに読み込まれます。</p>
|
<p><tt>_USE_STRFUNC</tt>が 1または 2のとき使用可能です。2のときは、ファイルに含まれる<tt>'\r'</tt>が取り除かれてバッファに読み込まれます。</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para ref">
|
||||||
<h4>参照</h4>
|
<h4>参照</h4>
|
||||||
<p><tt><a href="open.html">f_open</a>, <a href="read.html">f_read</a>, <a href="putc.html">f_putc</a>, <a href="puts.html">f_puts</a>, <a href="printf.html">f_printf</a>, <a href="close.html">f_close</a>, <a href="sfile.html">FIL</a></tt></p>
|
<p><tt><a href="open.html">f_open</a>, <a href="read.html">f_read</a>, <a href="putc.html">f_putc</a>, <a href="puts.html">f_puts</a>, <a href="printf.html">f_printf</a>, <a href="close.html">f_close</a>, <a href="sfile.html">FIL</a></tt></p>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -11,18 +11,18 @@
|
|||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para func">
|
||||||
<h2>f_lseek</h2>
|
<h2>f_lseek</h2>
|
||||||
<p>ファイルのリード/ライト・ポインタを移動します。</p>
|
<p>ファイルのリード/ライト・ポインタを移動します。また、高速シーク機能使用時にはCLMT(後述)の作成にも使用します。</p>
|
||||||
<pre>
|
<pre>
|
||||||
FRESULT f_lseek (
|
FRESULT f_lseek (
|
||||||
FIL* <em>FileObject</em>, <span>/* ファイル・オブジェクト構造体へのポインタ */</span>
|
FIL* <em>FileObject</em>, <span class="c">/* ファイル・オブジェクト構造体へのポインタ */</span>
|
||||||
DWORD <em>Offset</em> <span>/* 移動先オフセット */</span>
|
DWORD <em>Offset</em> <span class="c">/* 移動先オフセット */</span>
|
||||||
);
|
);
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para arg">
|
||||||
<h4>引数</h4>
|
<h4>引数</h4>
|
||||||
<dl class="par">
|
<dl class="par">
|
||||||
<dt>FileObject</dt>
|
<dt>FileObject</dt>
|
||||||
@ -33,91 +33,94 @@ FRESULT f_lseek (
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para ret">
|
||||||
<h4>戻り値</h4>
|
<h4>戻り値</h4>
|
||||||
<dl class="ret">
|
<p>
|
||||||
<dt>FR_OK (0)</dt>
|
<a href="rc.html#ok">FR_OK</a>,
|
||||||
<dd>正常終了。</dd>
|
<a href="rc.html#de">FR_DISK_ERR</a>,
|
||||||
<dt>FR_DISK_ERR</dt>
|
<a href="rc.html#ie">FR_INT_ERR</a>,
|
||||||
<dd>ディスク・エラーによる失敗。</dd>
|
<a href="rc.html#nr">FR_NOT_READY</a>,
|
||||||
<dt>FR_INT_ERR</dt>
|
<a href="rc.html#io">FR_INVALID_OBJECT</a>,
|
||||||
<dd>不正なFAT構造または内部エラーによる失敗。</dd>
|
<a href="rc.html#tm">FR_TIMEOUT</a>,
|
||||||
<dt>FR_NOT_READY</dt>
|
<a href="rc.html#nc">FR_NOT_ENOUGH_CORE</a>
|
||||||
<dd>メディアがセットされていないなど、物理ドライブが動作不能状態。</dd>
|
</p>
|
||||||
<dt>FR_INVALID_OBJECT</dt>
|
|
||||||
<dd>無効なファイル・オブジェクト。</dd>
|
|
||||||
<dt>FR_NOT_ENOUGH_CORE</dt>
|
|
||||||
<dd>リンク・マップ・テーブルのサイズが不足。</dd>
|
|
||||||
</dl>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para desc">
|
||||||
<h4>解説</h4>
|
<h4>解説</h4>
|
||||||
<p>ファイルのリード/ライト・ポインタ(ファイル・オブジェクト内のfptrメンバで、次に読み出し・書き込みされるバイトのオフセットを示す)を移動します。オフセットの原点はファイル先頭です。書き込みモードでファイル・サイズより大きな値を指定すると、そこまでファイル・サイズが拡張され、拡張された部分のデータは未定義となります。データを遅延無く高速に書き込みたいときは、予めこの関数で必要なサイズまでファイル・サイズを拡張しておくと良いでしょう。f_lseek関数が正常終了したあとは、リード/ライト・ポインタが正しく移動したかfptrをチェックするべきです。リード/ライト・ポインタが指定より小さいときは、次の原因が考えられます。</p>
|
<p>ファイルのリード/ライト・ポインタ(次に読み出し・書き込みされるバイトのオフセット)を移動します。オフセットの原点はファイル先頭です。書き込みモードでファイル・サイズより大きな値を指定すると、そこまでファイル・サイズが拡張され、拡張された部分のデータは未定義となります。データを遅延無く高速に書き込みたいときは、予めこの関数で必要なサイズまでファイル・サイズを拡張しておくと良いでしょう。f_lseek関数が正常終了したあとは、リード/ライト・ポインタが正しく移動したかチェックするべきです。リード/ライト・ポインタが指定より小さいときは、次の原因が考えられます。</p>
|
||||||
<ul>
|
<ul>
|
||||||
<li>非書き込みモードまたは高速シーク・モードのため、ファイル・サイズでクリップされた。</li>
|
<li>非書き込みモードまたは高速シーク・モードのため、ファイル・サイズでクリップされた。</li>
|
||||||
<li>ファイル拡張中にディスクが満杯になった。</li>
|
<li>ファイル拡張中にディスクが満杯になった。</li>
|
||||||
</ul>
|
</ul>
|
||||||
<p><tt>_USE_FASTSEEK</tt>に1が指定されていて、且つファイル・オブジェクトの<tt>cltbl</tt>メンバがNULL以外のとき、高速シーク・モードになります。これはファイルのクラスタ情報をアプリケーションの指定した配列に保持しておくことにより、FATにアクセスすることなく後方シークやロング・シークを高速に行う機能です。高速シーク動作を行う前には、配列を初期化しておく必要があります。必要な配列サイズ(要素数)は、(ファイルの分割数 + 1) * 2 です。たとえば、ファイルが5つに分断されているときに必要な配列サイズは、12要素となります。高速シーク使用時はファイル・サイズの拡張はできません。</p>
|
<p><tt>_USE_FASTSEEK</tt>に1が指定されていて、且つファイル・オブジェクトの<tt>cltbl</tt>メンバがNULL以外(ファイルを開いたときはNULL)のとき、高速シーク・モードになります。これはファイルのクラスタ配置情報(CLMT)をメモリ上に保持しておくことにより、FATにアクセスすることなく後方シークやロング・シークを高速に行う機能です。高速シーク・モードは、f_read/f_wtite関数にも適用されます。高速シーク・モードではf_wtite/f_lseek関数によるファイル・サイズの拡張はできません。</p>
|
||||||
|
<p>高速シーク動作を行う前に、CLMTを作成しておく必要があります。これを作成するには、まず<tt>cltbl</tt>メンバにCLMT格納バッファ(DWORD配列)へのポインタをセットします。そして、配列の先頭要素にその配列の要素数を入れ、f_lseek関数を<tt>Offset</tt>に<tt>CREATE_LINKMAP</tt>を指定して実行します。関数が成功するとCLMTが作成され、以降のf_read/f_write/f_lseek関数ではFATへのアクセスは発生しません。<tt>FR_NOT_ENOUGH_CORE</tt>で失敗したときは配列サイズが不足で、先頭要素には実際に必要となる要素数が返されます。必要な要素数は、(ファイルの分割数 + 1) * 2 です。たとえば、ファイルが5つに分断されているときに必要な要素数は、12となります。</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para comp">
|
||||||
<h4>対応情報</h4>
|
<h4>対応情報</h4>
|
||||||
<p><tt>_FS_MINIMIZE < 3</tt>のとき使用可能です。</p>
|
<p><tt>_FS_MINIMIZE < 3</tt>のとき使用可能です。</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para use">
|
||||||
<h4>使用例</h4>
|
<h4>使用例</h4>
|
||||||
<pre>
|
<pre>
|
||||||
<span>/* ファイル・オフセット5000へ移動 */</span>
|
<span class="c">/* ファイルを開く */</span>
|
||||||
res = f_lseek(&file, 5000, 0);
|
file = malloc(sizeof(FIL));
|
||||||
|
if (!file) ...
|
||||||
|
res = f_open(file, "file.dat", FA_READ|FA_WRITE);
|
||||||
|
if (res) ...
|
||||||
|
|
||||||
<span>/* ファイル追記の準備 (ファイル終端へ移動) */</span>
|
<span class="c">/* ファイル・オフセット5000へ移動 */</span>
|
||||||
res = f_lseek(&file, file.fsize, 0);
|
res = f_lseek(file, 5000, 0);
|
||||||
|
|
||||||
<span>/* 3000バイト進める */</span>
|
<span class="c">/* ファイル終端へ移動(ファイル追記の準備) */</span>
|
||||||
res = f_lseek(&file, file.fptr + 3000, 0);
|
res = f_lseek(file, f_size(file), 0);
|
||||||
|
|
||||||
<span>/* 2000バイト戻す (オーバーフローに注意) */</span>
|
<span class="c">/* 3000バイト進める */</span>
|
||||||
res = f_lseek(&file, file.fptr - 2000, 0);
|
res = f_lseek(file, f_tell(file) + 3000, 0);
|
||||||
|
|
||||||
|
<span class="c">/* 2000バイト戻す (オーバーフローに注意) */</span>
|
||||||
|
res = f_lseek(file, f_tell(file) - 2000, 0);
|
||||||
</pre>
|
</pre>
|
||||||
<pre>
|
<pre>
|
||||||
<span>/* クラスタ先行割り当て (ストリーミング・ライト時のバッファ・オーバーラン防止) */</span>
|
<span class="c">/* クラスタ先行割り当て (ストリーミング・ライト時のバッファ・オーバーラン防止) */</span>
|
||||||
|
|
||||||
res = f_open(&file, "record.wav", FA_CREATE_NEW | FA_WRITE); <span>/* ファイル作成 */</span>
|
res = f_open(file, "record.wav", FA_CREATE_NEW | FA_WRITE); <span class="c">/* ファイル作成 */</span>
|
||||||
|
|
||||||
res = f_lseek(&file, MAX_SIZE, 0); <span>/* 十分なクラスタの先行割り当て */</span>
|
res = f_lseek(file, MAX_SIZE, 0); <span class="c">/* 十分なクラスタの先行割り当て */</span>
|
||||||
if (res || file.fptr != PRE_SIZE) .... <span>/* 正しくファイルが拡張されたかチェック */</span>
|
if (res || f_tell(file) != PRE_SIZE) ... <span class="c">/* 正しくファイルが拡張されたかチェック */</span>
|
||||||
|
|
||||||
res = f_lseek(&file, DATA_START, 0); <span>/* データ・ストリームの記録(アロケーションディレイ無し) */</span>
|
res = f_lseek(file, DATA_START, 0); <span class="c">/* データ・ストリームの記録(アロケーションディレイ無し) */</span>
|
||||||
...
|
...
|
||||||
|
|
||||||
res = f_truncate(&file); <span>/* 不要領域の切り捨て */</span>
|
res = f_truncate(file); <span class="c">/* 不要領域の切り捨て */</span>
|
||||||
res = f_lseek(&file, 0, 0); <span>/* ヘッダの記録 */</span>
|
res = f_lseek(file, 0, 0); <span class="c">/* ヘッダの記録 */</span>
|
||||||
...
|
...
|
||||||
|
|
||||||
res = f_close(&file);
|
res = f_close(file);
|
||||||
</pre>
|
</pre>
|
||||||
<pre>
|
<pre>
|
||||||
<span>/* 高速シーク機能を使う */</span>
|
<span class="c">/* 高速シーク機能を使う */</span>
|
||||||
|
|
||||||
DWORD lktbl[SZ_TBL]; <span>/* リンク・マップ・テーブル格納バッファ */</span>
|
DWORD lktbl[SZ_TBL]; <span class="c">/* リンク・マップ・テーブル格納バッファ */</span>
|
||||||
|
|
||||||
res = f_lseek(&file, ofs1); <span>/* 通常シーク (オープン時、file.cltbl == NULL) */</span>
|
res = f_lseek(file, ofs1); <span class="c">/* 通常シーク (オープン時、file.cltbl == NULL) */</span>
|
||||||
|
|
||||||
file.cltbl = lktbl; <span>/* 高速シーク機能の有効化 */</span>
|
file.cltbl = lktbl; <span class="c">/* 高速シーク機能の有効化 */</span>
|
||||||
lktbl[0] = SZ_TBL; <span>/* 先頭要素に配列要素数をセット */</span>
|
lktbl[0] = SZ_TBL; <span class="c">/* 先頭要素に配列要素数をセット */</span>
|
||||||
res = f_lseek(&file, CREATE_LINKMAP); <span>/* リンク・マップ・テーブルの作成 */</span>
|
res = f_lseek(file, CREATE_LINKMAP); <span class="c">/* CLMTの作成 */</span>
|
||||||
|
...
|
||||||
|
|
||||||
res = f_lseek(&file, ofs2); <span>/* 高速シーク (file.cltbl != NULL) */</span>
|
res = f_lseek(file, ofs2); <span class="c">/* 以降、f_read/f_write/f_lseekでFATアクセスが発生しない */</span>
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para ref">
|
||||||
<h4>参照</h4>
|
<h4>参照</h4>
|
||||||
<p><tt><a href="open.html">f_open</a>, <a href="sfile.html">FIL</a></tt></p>
|
<p><tt><a href="open.html">f_open</a>, <a href="sfile.html">FIL</a></tt></p>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -11,17 +11,17 @@
|
|||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para func">
|
||||||
<h2>f_mkdir</h2>
|
<h2>f_mkdir</h2>
|
||||||
<p>ディレクトリを作成します。</p>
|
<p>ディレクトリを作成します。</p>
|
||||||
<pre>
|
<pre>
|
||||||
FRESULT f_mkdir (
|
FRESULT f_mkdir (
|
||||||
const TCHAR* <em>DirName</em> <span>/* 作成するディレクトリ名へのポインタ */</span>
|
const TCHAR* <em>DirName</em> <span class="c">/* 作成するディレクトリ名へのポインタ */</span>
|
||||||
);
|
);
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para arg">
|
||||||
<h4>引数</h4>
|
<h4>引数</h4>
|
||||||
<dl class="par">
|
<dl class="par">
|
||||||
<dt>DirName</dt>
|
<dt>DirName</dt>
|
||||||
@ -30,50 +30,40 @@ FRESULT f_mkdir (
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para ret">
|
||||||
<h4>戻り値</h4>
|
<h4>戻り値</h4>
|
||||||
<dl class="ret">
|
<p>
|
||||||
<dt>FR_OK (0)</dt>
|
<a href="rc.html#ok">FR_OK</a>,
|
||||||
<dd>正常終了。</dd>
|
<a href="rc.html#de">FR_DISK_ERR</a>,
|
||||||
<dt>FR_NO_PATH</dt>
|
<a href="rc.html#ie">FR_INT_ERR</a>,
|
||||||
<dd>パスが見つからない。</dd>
|
<a href="rc.html#nr">FR_NOT_READY</a>,
|
||||||
<dt>FR_INVALID_NAME</dt>
|
<a href="rc.html#np">FR_NO_PATH</a>,
|
||||||
<dd>パス名が不正。</dd>
|
<a href="rc.html#in">FR_INVALID_NAME</a>,
|
||||||
<dt>FR_INVALID_DRIVE</dt>
|
<a href="rc.html#de">FR_DENIED</a>,
|
||||||
<dd>ドライブ番号が不正。</dd>
|
<a href="rc.html#ex">FR_EXIST</a>,
|
||||||
<dt>FR_DENIED</dt>
|
<a href="rc.html#wp">FR_WRITE_PROTECTED</a>,
|
||||||
<dd>ディスクやディレクトリ・エントリが満杯の場合など。</dd>
|
<a href="rc.html#id">FR_INVALID_DRIVE</a>,
|
||||||
<dt>FR_EXIST</dt>
|
<a href="rc.html#ne">FR_NOT_ENABLED</a>,
|
||||||
<dd>同名のオブジェクトが存在する。</dd>
|
<a href="rc.html#ns">FR_NO_FILESYSTEM</a>,
|
||||||
<dt>FR_NOT_READY</dt>
|
<a href="rc.html#tm">FR_TIMEOUT</a>,
|
||||||
<dd>メディアがセットされていないなど、物理ドライブが動作不能状態。</dd>
|
<a href="rc.html#nc">FR_NOT_ENOUGH_CORE</a>
|
||||||
<dt>FR_WRITE_PROTECTED</dt>
|
</p>
|
||||||
<dd>メディアが書き込み禁止状態。</dd>
|
|
||||||
<dt>FR_DISK_ERR</dt>
|
|
||||||
<dd>ディスク・エラーによる失敗。</dd>
|
|
||||||
<dt>FR_INT_ERR</dt>
|
|
||||||
<dd>不正なFAT構造または内部エラーによる失敗。</dd>
|
|
||||||
<dt>FR_NOT_ENABLED</dt>
|
|
||||||
<dd>その論理ドライブにワーク・エリアが与えられていない。</dd>
|
|
||||||
<dt>FR_NO_FILESYSTEM</dt>
|
|
||||||
<dd>有効なFATボリュームが見つからない。</dd>
|
|
||||||
</dl>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para desc">
|
||||||
<h4>解説</h4>
|
<h4>解説</h4>
|
||||||
<p>空のディレクトリを作成します。</p>
|
<p>空のディレクトリを作成します。</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para comp">
|
||||||
<h4>対応情報</h4>
|
<h4>対応情報</h4>
|
||||||
<p><tt>_FS_READONLY == 0</tt>で、且つ<tt>_FS_MINIMIZE == 0</tt>のとき使用可能です。</p>
|
<p><tt>_FS_READONLY == 0</tt>で、且つ<tt>_FS_MINIMIZE == 0</tt>のとき使用可能です。</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para use">
|
||||||
<h4>使用例</h4>
|
<h4>使用例</h4>
|
||||||
<pre>
|
<pre>
|
||||||
res = f_mkdir("sub1");
|
res = f_mkdir("sub1");
|
||||||
|
|||||||
@ -11,19 +11,19 @@
|
|||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para func">
|
||||||
<h2>f_mkfs</h2>
|
<h2>f_mkfs</h2>
|
||||||
<p>物理ドライブ上にFATボリュームを作成(フォーマット)します。</p>
|
<p>物理ドライブ上にFATボリュームを作成(フォーマット)します。</p>
|
||||||
<pre>
|
<pre>
|
||||||
FRESULT f_mkfs (
|
FRESULT f_mkfs (
|
||||||
BYTE <em>Drive</em>, <span>/* 論理ドライブ番号 */</span>
|
BYTE <em>Drive</em>, <span class="c">/* 論理ドライブ番号 */</span>
|
||||||
BYTE <em>PartitioningRule</em>, <span>/* 区画作成方法 */</span>
|
BYTE <em>PartitioningRule</em>, <span class="c">/* 区画作成方法 */</span>
|
||||||
UINT <em>AllocSize</em> <span>/* クラス・タサイズ */</span>
|
UINT <em>AllocSize</em> <span class="c">/* クラス・タサイズ */</span>
|
||||||
);
|
);
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para arg">
|
||||||
<h4>引数</h4>
|
<h4>引数</h4>
|
||||||
<dl class="par">
|
<dl class="par">
|
||||||
<dt>Drive</dt>
|
<dt>Drive</dt>
|
||||||
@ -35,33 +35,18 @@ FRESULT f_mkfs (
|
|||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para ret">
|
||||||
<h4>戻り値</h4>
|
<h4>戻り値</h4>
|
||||||
<dl class="ret">
|
<p>
|
||||||
<dt>FR_OK (0)</dt>
|
<a href="rc.html#ok">FR_OK</a>,
|
||||||
<dd>正常終了。</dd>
|
<a href="rc.html#de">FR_DISK_ERR</a>,
|
||||||
<dt>FR_INVALID_DRIVE</dt>
|
<a href="rc.html#nr">FR_NOT_READY</a>,
|
||||||
<dd>ドライブ番号が無効。</dd>
|
<a href="rc.html#ne">FR_NOT_ENABLED</a>,
|
||||||
<dt>FR_NOT_READY</dt>
|
<a href="rc.html#ma">FR_MKFS_ABORTED</a>
|
||||||
<dd>メディアがセットされていないなど、物理ドライブが動作不能状態。</dd>
|
</p>
|
||||||
<dt>FR_WRITE_PROTECTED</dt>
|
|
||||||
<dd>メディアが書き込み禁止状態。</dd>
|
|
||||||
<dt>FR_NOT_ENABLED</dt>
|
|
||||||
<dd>その論理ドライブにワーク・エリアが割り当てられていない。</dd>
|
|
||||||
<dt>FR_DISK_ERR</dt>
|
|
||||||
<dd>ディスク・エラーによる失敗。</dd>
|
|
||||||
<dt>FR_MKFS_ABORTED</dt>
|
|
||||||
<dd>次の理由で開始前に処理が中断された。
|
|
||||||
<ul>
|
|
||||||
<li>ディスク・サイズが小さすぎる。</li>
|
|
||||||
<li>何らかの引数が不正。</li>
|
|
||||||
<li>そのクラスタ・サイズが使えない。クラスタ数がFATタイプの境界に近くなるとき発生する可能性がある。</li>
|
|
||||||
</ul>
|
|
||||||
</dd>
|
|
||||||
</dl>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para desc">
|
||||||
<h4>説明</h4>
|
<h4>説明</h4>
|
||||||
<p>f_mkfs関数は物理ドライブ上にFATボリュームを作成します。リムーバブル・メディアのパーテーショニング・ルールとしてはFDISK形式とSFD形式があり、メモリ・カードではFDISK形式が普通です。この関数は<em>複数区画には対応していない</em>ので、その物理ドライブの既存の区画は全て削除され、全体が一つの区画になります。</p>
|
<p>f_mkfs関数は物理ドライブ上にFATボリュームを作成します。リムーバブル・メディアのパーテーショニング・ルールとしてはFDISK形式とSFD形式があり、メモリ・カードではFDISK形式が普通です。この関数は<em>複数区画には対応していない</em>ので、その物理ドライブの既存の区画は全て削除され、全体が一つの区画になります。</p>
|
||||||
<p>FATタイプ(FAT12/FAT16/FAT32)は、その論理ドライブ上の<em>クラスタ数によってのみ決定</em>される決まり[FAT仕様書より]になっていて、それ以外の要因はありません。したがって、どのFATタイプになるかはドライブ・サイズとクラスタ・サイズに依存します。クラスタ・サイズは大きくするほど性能が上がり、逆にディスク利用効率は落ちます。</p>
|
<p>FATタイプ(FAT12/FAT16/FAT32)は、その論理ドライブ上の<em>クラスタ数によってのみ決定</em>される決まり[FAT仕様書より]になっていて、それ以外の要因はありません。したがって、どのFATタイプになるかはドライブ・サイズとクラスタ・サイズに依存します。クラスタ・サイズは大きくするほど性能が上がり、逆にディスク利用効率は落ちます。</p>
|
||||||
@ -69,7 +54,7 @@ FRESULT f_mkfs (
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para comp">
|
||||||
<h4>対応情報</h4>
|
<h4>対応情報</h4>
|
||||||
<p><tt>_FS_READONLY == 0</tt>で、且つ<tt>_USE_MKFS == 1</tt>のとき使用可能です。</p>
|
<p><tt>_FS_READONLY == 0</tt>で、且つ<tt>_USE_MKFS == 1</tt>のとき使用可能です。</p>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -11,18 +11,18 @@
|
|||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para func">
|
||||||
<h2>f_mount</h2>
|
<h2>f_mount</h2>
|
||||||
<p>論理ドライブのワーク・エリアを登録・抹消します。</p>
|
<p>論理ドライブのワーク・エリアを登録・抹消します。</p>
|
||||||
<pre>
|
<pre>
|
||||||
FRESULT f_mount (
|
FRESULT f_mount (
|
||||||
BYTE <em>Drive</em>, <span>/* 論理ドライブ番号 */</span>
|
BYTE <em>Drive</em>, <span class="c">/* 論理ドライブ番号 */</span>
|
||||||
FATFS* <em>FileSystemObject</em> <span>/* ワーク・エリアへのポインタ */</span>
|
FATFS* <em>FileSystemObject</em> <span class="c">/* ワーク・エリアへのポインタ */</span>
|
||||||
);
|
);
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para arg">
|
||||||
<h4>引数</h4>
|
<h4>引数</h4>
|
||||||
<dl class="par">
|
<dl class="par">
|
||||||
<dt>Drive</dt>
|
<dt>Drive</dt>
|
||||||
@ -32,31 +32,29 @@ FRESULT f_mount (
|
|||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para ret">
|
||||||
<h4>戻り値</h4>
|
<h4>戻り値</h4>
|
||||||
<dl class="ret">
|
<p>
|
||||||
<dt>FR_OK (0)</dt>
|
<a href="rc.html#ok">FR_OK</a>,
|
||||||
<dd>正常終了。</dd>
|
<a href="rc.html#id">FR_INVALID_DRIVE</a>
|
||||||
<dt>FR_INVALID_DRIVE</dt>
|
</p>
|
||||||
<dd>論理ドライブ番号が無効。</dd>
|
|
||||||
</dl>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para desc">
|
||||||
<h4>解説</h4>
|
<h4>解説</h4>
|
||||||
<p>FatFsモジュールではそれぞれの論理ドライブにファイル・システム・オブジェクトというワーク・エリアが必要です。この関数は論理ドライブにそのワーク・エリアを登録したり抹消したりします。何らかのファイル関数を使用する前にこの関数でその論理ドライブのワーク・エリアを与えておかなければなりません。<tt>FileSystemObject</tt>にヌル・ポインタを指定するとその論理ドライブのワーク・エリアの登録は抹消され、登録されていたワーク・エリアは破棄できます。操作対象のドライブに対して開かれているファイルやディレクトリがあった場合、それらは全て無効になります。</p>
|
<p>FatFsモジュールではそれぞれの論理ドライブにファイル・システム・オブジェクトというワーク・エリアが必要です。この関数は論理ドライブにそのワーク・エリアを登録したり抹消したりします。何らかのファイル関数を使用する前にこの関数でその論理ドライブのワーク・エリアを与えておかなければなりません。<tt>FileSystemObject</tt>にヌル・ポインタを指定するとその論理ドライブのワーク・エリアの登録は抹消され、登録されていたワーク・エリアは破棄できます。操作対象のドライブに対して開かれているファイルやディレクトリがあった場合、それらは全て無効になります。</p>
|
||||||
<p>この関数は、ドライブの状態に関わらず常に成功します。関数内では下位レイヤ(物理ドライブ)へのアクセスは発生せず、ワーク・エリアを初期化して内部配列にそのアドレスを登録するだけです。実際のマウント動作は、この関数の実行またはメディア交換発生の後、最初のファイル・アクセスのときに行われます。</p>
|
<p>この関数は、ドライブの状態に関わらず常に成功します。関数内では下位レイヤ(物理ドライブ)へのアクセスは発生せず、ワーク・エリアを初期化して内部配列にそのアドレスを登録するだけです。実際のマウント動作は、この関数の実行またはメディア交換発生の後、最初のファイル・アクセスのときに行われます。</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para comp">
|
||||||
<h4>対応情報</h4>
|
<h4>対応情報</h4>
|
||||||
<p>全ての構成で使用可能です。</p>
|
<p>全ての構成で使用可能です。</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para ref">
|
||||||
<h4>参照</h4>
|
<h4>参照</h4>
|
||||||
<p><tt><a href="sfatfs.html">FATFS</a></tt></p>
|
<p><tt><a href="sfatfs.html">FATFS</a></tt></p>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
106
doc/ja/open.html
106
doc/ja/open.html
@ -11,19 +11,19 @@
|
|||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para func">
|
||||||
<h2>f_open</h2>
|
<h2>f_open</h2>
|
||||||
<p>ファイルをオープンまたは作成します。</p>
|
<p>ファイルをオープンまたは作成します。</p>
|
||||||
<pre>
|
<pre>
|
||||||
FRESULT f_open (
|
FRESULT f_open (
|
||||||
FIL* <em>FileObject</em>, <span>/* 空のファイル・オブジェクト構造体へのポインタ */</span>
|
FIL* <em>FileObject</em>, <span class="c">/* 空のファイル・オブジェクト構造体へのポインタ */</span>
|
||||||
const TCHAR* <em>FileName</em>, <span>/* ファイルのフルパス名へのポインタ */</span>
|
const TCHAR* <em>FileName</em>, <span class="c">/* ファイルのフルパス名へのポインタ */</span>
|
||||||
BYTE <em>ModeFlags</em> <span>/* モードフラグ */</span>
|
BYTE <em>ModeFlags</em> <span class="c">/* モードフラグ */</span>
|
||||||
);
|
);
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para arg">
|
||||||
<h4>引数</h4>
|
<h4>引数</h4>
|
||||||
<dl class="par">
|
<dl class="par">
|
||||||
<dt>FileObject</dt>
|
<dt>FileObject</dt>
|
||||||
@ -37,8 +37,8 @@ FRESULT f_open (
|
|||||||
<tr><td>FA_READ</td><td>読み出しモードで開きます。読み書きする場合は<tt>FA_WRITE</tt>と共に指定します。</td></tr>
|
<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_WRITE</td><td>書き込みモードで開きます。読み書きする場合は<tt>FA_READ</tt>と共に指定します。</td></tr>
|
||||||
<tr><td>FA_OPEN_EXISTING</td><td>既存のファイルを開きます。ファイルが無いときはエラーになります。(デフォルト)</td></tr>
|
<tr><td>FA_OPEN_EXISTING</td><td>既存のファイルを開きます。ファイルが無いときはエラーになります。(デフォルト)</td></tr>
|
||||||
<tr><td>FA_OPEN_ALWAYS</td><td>既存のファイルを開きます。ファイルが無いときはファイルを作成します。追記操作する場合は、この方法でオープンした後、<tt>f_lseek()</tt>でファイルの最後尾に移動してください。</td></tr>
|
<tr><td>FA_OPEN_ALWAYS</td><td>既存のファイルを開きます。ファイルが無いときはファイルを作成します。追記の場合は、この方法でオープンした後、<a href="lseek.html">f_lseek()</a>でファイルの最後尾に移動してください。</td></tr>
|
||||||
<tr><td>FA_CREATE_NEW</td><td>ファイルを作成します。同名のファイルがある場合は、エラー(FR_EXIST)になります。</td></tr>
|
<tr><td>FA_CREATE_NEW</td><td>ファイルを作成します。同名のファイルがある場合は、<tt>FR_EXIST</tt>で失敗します。</td></tr>
|
||||||
<tr><td>FA_CREATE_ALWAYS</td><td>ファイルを作成します。同名のファイルがある場合は、サイズを0にしてから開きます。</td></tr>
|
<tr><td>FA_CREATE_ALWAYS</td><td>ファイルを作成します。同名のファイルがある場合は、サイズを0にしてから開きます。</td></tr>
|
||||||
</table>
|
</table>
|
||||||
</dd>
|
</dd>
|
||||||
@ -46,96 +46,80 @@ FRESULT f_open (
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para ret">
|
||||||
<h4>戻り値</h4>
|
<h4>戻り値</h4>
|
||||||
<dl class="ret">
|
<p>
|
||||||
<dt>FR_OK (0)</dt>
|
<a href="rc.html#ok">FR_OK</a>,
|
||||||
<dd>正常終了。以降、<tt>FileObject</tt>構造体を使ってこのファイルを操作できます。</dd>
|
<a href="rc.html#de">FR_DISK_ERR</a>,
|
||||||
<dt>FR_NO_FILE</dt>
|
<a href="rc.html#ie">FR_INT_ERR</a>,
|
||||||
<dd>ファイルが見つからない。</dd>
|
<a href="rc.html#nr">FR_NOT_READY</a>,
|
||||||
<dt>FR_NO_PATH</dt>
|
<a href="rc.html#ok">FR_NO_FILE</a>,
|
||||||
<dd>パスが見つからない。</dd>
|
<a href="rc.html#np">FR_NO_PATH</a>,
|
||||||
<dt>FR_INVALID_NAME</dt>
|
<a href="rc.html#in">FR_INVALID_NAME</a>,
|
||||||
<dd>ファイル名が不正。</dd>
|
<a href="rc.html#de">FR_DENIED</a>,
|
||||||
<dt>FR_INVALID_DRIVE</dt>
|
<a href="rc.html#ex">FR_EXIST</a>,
|
||||||
<dd>ドライブ番号が不正。</dd>
|
<a href="rc.html#wp">FR_WRITE_PROTECTED</a>,
|
||||||
<dt>FR_EXIST</dt>
|
<a href="rc.html#id">FR_INVALID_DRIVE</a>,
|
||||||
<dd>同名のファイルが既に存在する。</dd>
|
<a href="rc.html#ne">FR_NOT_ENABLED</a>,
|
||||||
<dt>FR_DENIED</dt>
|
<a href="rc.html#ns">FR_NO_FILESYSTEM</a>,
|
||||||
<dd>アクセスが拒否された。
|
<a href="rc.html#tm">FR_TIMEOUT</a>,
|
||||||
<ul>
|
<a href="rc.html#lo">FR_LOCKED</a>,
|
||||||
<li>リード・オンリー・ファイルの書き込みモード・オープン。</li>
|
<a href="rc.html#nc">FR_NOT_ENOUGH_CORE</a>,
|
||||||
<li>同名のディレクトリまたはリード・オンリー・ファイルがある状態でのファイル作成。</li>
|
<a href="rc.html#tf">FR_TOO_MANY_OPEN_FILES</a>
|
||||||
<li>ディレクトリ・テーブルが満杯でファイルを作成できない。</li>
|
</p>
|
||||||
</ul>
|
|
||||||
</dd>
|
|
||||||
<dt>FR_NOT_READY</dt>
|
|
||||||
<dd>メディアがセットされていないなど、物理ドライブが動作不能状態。</dd>
|
|
||||||
<dt>FR_WRITE_PROTECTED</dt>
|
|
||||||
<dd>メディアが書き込み禁止状態で書き込み系オープンをした。</dd>
|
|
||||||
<dt>FR_DISK_ERR</dt>
|
|
||||||
<dd>ディスク・エラーによる失敗。</dd>
|
|
||||||
<dt>FR_INT_ERR</dt>
|
|
||||||
<dd>不正なFAT構造または内部エラーによる失敗。</dd>
|
|
||||||
<dt>FR_NOT_ENABLED</dt>
|
|
||||||
<dd>その論理ドライブにワーク・エリアが割り当てられていない。</dd>
|
|
||||||
<dt>FR_NO_FILESYSTEM</dt>
|
|
||||||
<dd>有効なFATボリュームが見つからない。</dd>
|
|
||||||
<dt>FR_LOCKED</dt>
|
|
||||||
<dd>ファイル共有機能(_FS_SHARE)によるアクセス拒否。</dd>
|
|
||||||
</dl>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para desc">
|
||||||
<h4>解説</h4>
|
<h4>解説</h4>
|
||||||
<p>既存のファイルを開いたり、新しいファイルを作成します。関数が成功するとファイル・オブジェクトが作成され、以降そのファイルに対するアクセスに使用します。ファイルを閉じるときは、<a href="close.html">f_close()</a>を使用します。何らかの変更が行われたファイルがその後正しく閉じられなかった場合、そのファイルが破損する場合があります。</p>
|
<p>既存のファイルを開いたり、新しいファイルを作成します。関数が成功するとファイル・オブジェクトが作成され、以降そのファイルに対するアクセスに使用します。ファイルを閉じるときは、<a href="close.html">f_close()</a>を使用します。何らかの変更が行われたファイルがその後正しく閉じられなかった場合、そのファイルが破損する場合があります。</p>
|
||||||
|
<p>もしも既に開かれているファイルを開く必要がある場合は、<a href="appnote.html#dup">多重アクセス制御</a>を参照してください。</p>
|
||||||
<p>ファイル・アクセスを開始する前に、<a href="mount.html">f_mount()</a>を使ってそれぞれの論理ドライブにワーク・エリア(ファイル・システム・オブジェクト)を与える必要があります。この初期化の後、その論理ドライブに対して全てのファイル関数が使えるようになります。</p>
|
<p>ファイル・アクセスを開始する前に、<a href="mount.html">f_mount()</a>を使ってそれぞれの論理ドライブにワーク・エリア(ファイル・システム・オブジェクト)を与える必要があります。この初期化の後、その論理ドライブに対して全てのファイル関数が使えるようになります。</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para comp">
|
||||||
<h4>対応情報</h4>
|
<h4>対応情報</h4>
|
||||||
<p>全ての構成で使用可能です。<tt>_FS_READONLY == 1</tt>のときは、<tt>FA_WRITE, FA_CREATE_ALWAYS, FA_CREATE_NEW, FA_OPEN_ALWAYS</tt>の各フラグはサポートされません。</p>
|
<p>全ての構成で使用可能です。<tt>_FS_READONLY == 1</tt>のときは、<tt>FA_WRITE, FA_CREATE_ALWAYS, FA_CREATE_NEW, FA_OPEN_ALWAYS</tt>の各フラグはサポートされません。</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para use">
|
||||||
<h4>使用例(ファイル・コピー)</h4>
|
<h4>使用例(ファイル・コピー)</h4>
|
||||||
<pre>
|
<pre>
|
||||||
void main (void)
|
void main (void)
|
||||||
{
|
{
|
||||||
FATFS fs[2]; <span>/* 論理ドライブのワーク・エリア(ファイル・システム・オブジェクト) */</span>
|
FATFS fs[2]; <span class="c">/* 論理ドライブのワーク・エリア(ファイル・システム・オブジェクト) */</span>
|
||||||
FIL fsrc, fdst; <span>/* ファイル・オブジェクト */</span>
|
FIL fsrc, fdst; <span class="c">/* ファイル・オブジェクト */</span>
|
||||||
BYTE buffer[4096]; <span>/* file copy buffer */</span>
|
BYTE buffer[4096]; <span class="c">/* file copy buffer */</span>
|
||||||
FRESULT res; <span>/* FatFs function common result code */</span>
|
FRESULT res; <span class="c">/* FatFs function common result code */</span>
|
||||||
UINT br, bw; <span>/* File R/W count */</span>
|
UINT br, bw; <span class="c">/* File R/W count */</span>
|
||||||
|
|
||||||
<span>/* ドライブ0,1にワーク・エリアを与える (常に成功する) */</span>
|
<span class="c">/* ドライブ0,1にワーク・エリアを与える (常に成功する) */</span>
|
||||||
f_mount(0, &fs[0]);
|
f_mount(0, &fs[0]);
|
||||||
f_mount(1, &fs[1]);
|
f_mount(1, &fs[1]);
|
||||||
|
|
||||||
<span>/* ドライブ1のソース・ファイルを開く */</span>
|
<span class="c">/* ドライブ1のソース・ファイルを開く */</span>
|
||||||
res = f_open(&fsrc, "1:srcfile.dat", FA_OPEN_EXISTING | FA_READ);
|
res = f_open(&fsrc, "1:srcfile.dat", FA_OPEN_EXISTING | FA_READ);
|
||||||
if (res) die(res);
|
if (res) die(res);
|
||||||
|
|
||||||
<span>/* ドライブ0にデスティネーション・ファイルを作成する */</span>
|
<span class="c">/* ドライブ0にデスティネーション・ファイルを作成する */</span>
|
||||||
res = f_open(&fdst, "0:dstfile.dat", FA_CREATE_ALWAYS | FA_WRITE);
|
res = f_open(&fdst, "0:dstfile.dat", FA_CREATE_ALWAYS | FA_WRITE);
|
||||||
if (res) die(res);
|
if (res) die(res);
|
||||||
|
|
||||||
<span>/* ソースからデスティネーションにコピーする */</span>
|
<span class="c">/* ソースからデスティネーションにコピーする */</span>
|
||||||
for (;;) {
|
for (;;) {
|
||||||
res = f_read(&fsrc, buffer, sizeof(buffer), &br);
|
res = f_read(&fsrc, buffer, sizeof(buffer), &br);
|
||||||
if (res || br == 0) break; <span>/* エラーかファイル終端 */</span>
|
if (res || br == 0) break; <span class="c">/* エラーかファイル終端 */</span>
|
||||||
res = f_write(&fdst, buffer, br, &bw);
|
res = f_write(&fdst, buffer, br, &bw);
|
||||||
if (res || bw < br) break; <span>/* エラーかディスク満杯 */</span>
|
if (res || bw < br) break; <span class="c">/* エラーかディスク満杯 */</span>
|
||||||
}
|
}
|
||||||
|
|
||||||
<span>/* 全てのファイルを閉じる */</span>
|
<span class="c">/* 全てのファイルを閉じる */</span>
|
||||||
f_close(&fsrc);
|
f_close(&fsrc);
|
||||||
f_close(&fdst);
|
f_close(&fdst);
|
||||||
|
|
||||||
<span>/* ワーク・エリアを開放する */</span>
|
<span class="c">/* ワーク・エリアを開放する */</span>
|
||||||
f_mount(0, NULL);
|
f_mount(0, NULL);
|
||||||
f_mount(1, NULL);
|
f_mount(1, NULL);
|
||||||
}
|
}
|
||||||
@ -143,7 +127,7 @@ void main (void)
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para ref">
|
||||||
<h4>参照</h4>
|
<h4>参照</h4>
|
||||||
<p><tt><a href="read.html">f_read</a>, <a href="write.html">f_write</a>, <a href="close.html">f_close</a>, <a href="sfile.html">FIL</a>, <a href="sfatfs.html">FATFS</a></tt></p>
|
<p><tt><a href="read.html">f_read</a>, <a href="write.html">f_write</a>, <a href="close.html">f_close</a>, <a href="sfile.html">FIL</a>, <a href="sfatfs.html">FATFS</a></tt></p>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -11,18 +11,18 @@
|
|||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para func">
|
||||||
<h2>f_opendir</h2>
|
<h2>f_opendir</h2>
|
||||||
<p>ディレクトリを開きます。</p>
|
<p>ディレクトリを開きます。</p>
|
||||||
<pre>
|
<pre>
|
||||||
FRESULT f_opendir (
|
FRESULT f_opendir (
|
||||||
DIR* <em>DirObject</em>, <span>/* ディレクトリ・ブジェクト構造体へのポインタ */</span>
|
DIR* <em>DirObject</em>, <span class="c">/* ディレクトリ・ブジェクト構造体へのポインタ */</span>
|
||||||
const TCHAR* <em>DirName</em> <span>/* ディレクトリ名へのポインタ */</span>
|
const TCHAR* <em>DirName</em> <span class="c">/* ディレクトリ名へのポインタ */</span>
|
||||||
);
|
);
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para arg">
|
||||||
<h4>引数</h4>
|
<h4>引数</h4>
|
||||||
<dl class="par">
|
<dl class="par">
|
||||||
<dt>DirObject</dt>
|
<dt>DirObject</dt>
|
||||||
@ -33,44 +33,37 @@ FRESULT f_opendir (
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para ret">
|
||||||
<h4>戻り値</h4>
|
<h4>戻り値</h4>
|
||||||
<dl class="ret">
|
<p>
|
||||||
<dt>FR_OK (0)</dt>
|
<a href="rc.html#ok">FR_OK</a>,
|
||||||
<dd>正常終了。</dd>
|
<a href="rc.html#de">FR_DISK_ERR</a>,
|
||||||
<dt>FR_NO_PATH</dt>
|
<a href="rc.html#ie">FR_INT_ERR</a>,
|
||||||
<dd>パスが見つからない。</dd>
|
<a href="rc.html#nr">FR_NOT_READY</a>,
|
||||||
<dt>FR_INVALID_NAME</dt>
|
<a href="rc.html#np">FR_NO_PATH</a>,
|
||||||
<dd>パス名が不正。</dd>
|
<a href="rc.html#in">FR_INVALID_NAME</a>,
|
||||||
<dt>FR_INVALID_DRIVE</dt>
|
<a href="rc.html#id">FR_INVALID_DRIVE</a>,
|
||||||
<dd>論理ドライブ番号が不正。</dd>
|
<a href="rc.html#ne">FR_NOT_ENABLED</a>,
|
||||||
<dt>FR_NOT_READY</dt>
|
<a href="rc.html#ns">FR_NO_FILESYSTEM</a>,
|
||||||
<dd>メディアがセットされていないなど、物理ドライブが動作不能状態。</dd>
|
<a href="rc.html#tm">FR_TIMEOUT</a>,
|
||||||
<dt>FR_DISK_ERR</dt>
|
<a href="rc.html#nc">FR_NOT_ENOUGH_CORE</a>
|
||||||
<dd>ディスク・エラーによる失敗。</dd>
|
</p>
|
||||||
<dt>FR_INT_ERR</dt>
|
|
||||||
<dd>不正なFAT構造または内部エラーによる失敗。</dd>
|
|
||||||
<dt>FR_NOT_ENABLED</dt>
|
|
||||||
<dd>論理ドライブにワーク・エリアが与えられていない。</dd>
|
|
||||||
<dt>FR_NO_FILESYSTEM</dt>
|
|
||||||
<dd>有効なFATボリュームが見つからない。</dd>
|
|
||||||
</dl>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para desc">
|
||||||
<h4>解説</h4>
|
<h4>解説</h4>
|
||||||
<p>ディレクトリを開きます。正常終了したら、<tt>DirObject</tt>構造体を使ってこのディレクトリの項目を順次読み出せます。<tt>DirObject</tt>構造体は使用後は任意の時点で破棄できます。</p>
|
<p>ディレクトリを開きます。正常終了したら、<tt>DirObject</tt>構造体を使ってこのディレクトリの項目を順次読み出せます。<tt>DirObject</tt>構造体は使用後は任意の時点で破棄できます。</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para comp">
|
||||||
<h4>対応情報</h4>
|
<h4>対応情報</h4>
|
||||||
<p><tt>_FS_MINIMIZE <= 1</tt>のとき使用可能になります。</p>
|
<p><tt>_FS_MINIMIZE <= 1</tt>のとき使用可能になります。</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para ref">
|
||||||
<h4>参照</h4>
|
<h4>参照</h4>
|
||||||
<p><tt><a href="readdir.html">f_readdir</a>, <a href="sdir.html">DIR</a></tt></p>
|
<p><tt><a href="readdir.html">f_readdir</a>, <a href="sdir.html">DIR</a></tt></p>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -11,19 +11,19 @@
|
|||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para func">
|
||||||
<h2>f_printf</h2>
|
<h2>f_printf</h2>
|
||||||
<p>ファイルに書式化文字列を書き込みます。</p>
|
<p>ファイルに書式化文字列を書き込みます。</p>
|
||||||
<pre>
|
<pre>
|
||||||
int f_printf (
|
int f_printf (
|
||||||
FIL* <em>FileObject</em>, <span>/* ファイル・オブジェクト */</span>
|
FIL* <em>FileObject</em>, <span class="c">/* ファイル・オブジェクト */</span>
|
||||||
const TCHAR* <em>Foramt</em>, <span>/* 書式制御文字列 */</span>
|
const TCHAR* <em>Foramt</em>, <span class="c">/* 書式制御文字列 */</span>
|
||||||
...
|
...
|
||||||
);
|
);
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para arg">
|
||||||
<h4>引数</h4>
|
<h4>引数</h4>
|
||||||
<dl class="par">
|
<dl class="par">
|
||||||
<dt>FileObject</dt>
|
<dt>FileObject</dt>
|
||||||
@ -37,44 +37,50 @@ int f_printf (
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para ret">
|
||||||
<h4>戻り値</h4>
|
<h4>戻り値</h4>
|
||||||
<p>文字列が正常に書き込まれると書き込まれた文字数が返されます。ディスクが満杯またはその他エラーにより正常に書き込まれなかったときは関数は失敗し<tt>EOF (-1)</tt>が返されます。</p>
|
<p>文字列が正常に書き込まれると書き込まれた文字数が返されます。ディスクが満杯またはその他エラーにより正常に書き込まれなかったときは関数は失敗し<tt>EOF (-1)</tt>が返されます。</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para desc">
|
||||||
<h4>解説</h4>
|
<h4>解説</h4>
|
||||||
<p>この関数は<a href="putc.html">f_putc()</a>および<a href="puts.html">f_puts()</a>のラッパー関数です。書式制御機能はサブセットとなっていて、書式制御文字は次に示すものが使用可能です。</p>
|
<p>この関数は<a href="putc.html">f_putc()</a>および<a href="puts.html">f_puts()</a>のラッパー関数です。書式制御機能はサブセットとなっていて、書式制御文字は次に示すものが使用可能です。</p>
|
||||||
<ul>
|
<ul>
|
||||||
<li>タイプ: <tt>c C s S d D u U x X b B</tt></li>
|
<li>タイプ: <tt>c C s S d D u U x X b B</tt></li>
|
||||||
<li>精度指定: <tt>l L</tt></li>
|
<li>精度指定: <tt>l L</tt></li>
|
||||||
<li>フラグ: <tt>0</tt></li>
|
<li>フラグ: <tt>0 -</tt></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para comp">
|
||||||
<h4>対応情報</h4>
|
<h4>対応情報</h4>
|
||||||
<p><tt>_FS_READONLY == 0</tt>で、且つ<tt>_USE_STRFUNC</tt>が 1または 2のとき使用可能になります。2の時は、出力に含まれる<tt>'\n'</tt>が<tt>"\r\n"</tt>に展開されてファイルに書き込まれます。</p>
|
<p><tt>_FS_READONLY == 0</tt>で、且つ<tt>_USE_STRFUNC</tt>が 1または 2のとき使用可能になります。2の時は、出力に含まれる<tt>'\n'</tt>が<tt>"\r\n"</tt>に展開されてファイルに書き込まれます。</p>
|
||||||
<p>APIにUnicodeが選択されている(<tt>_LFN_UNICODE</tt>が1)ときは、UTF-8エンコードでファイルに書き込みます。それ以外の時は無変換(1文字1バイト)で書き込みます。</p>
|
<p>APIにUnicodeが選択されている(<tt>_LFN_UNICODE</tt>が1)ときは、UTF-8エンコードでファイルに書き込みます。それ以外の時は無変換(1文字1バイト)で書き込みます。</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para use">
|
||||||
<h4>使用例</h4>
|
<h4>使用例</h4>
|
||||||
<pre>
|
<pre>
|
||||||
f_printf(&fil, "%6d", -200); <span>/* " -200" */</span>
|
f_printf(&fil, "%d", 1234); <span class="c">/* "1234" */</span>
|
||||||
f_printf(&fil, "%02u", 5); <span>/* "05" */</span>
|
f_printf(&fil, "%6d,%3d%%", -200, 5); <span class="c">/* " -200, 5%" */</span>
|
||||||
f_printf(&fil, "%ld", 12345678L); <span>/* "12345678" */</span>
|
f_printf(&fil, "%-6u", 100); <span class="c">/* "100 " */</span>
|
||||||
f_printf(&fil, "%08lX", 1194684UL); <span>/* "00123ABC" */</span>
|
f_printf(&fil, "%ld", 12345678L); <span class="c">/* "12345678" */</span>
|
||||||
f_printf(&fil, "%s", "String"); <span>/* "String" */</span>
|
f_printf(&fil, "%04x", 0xA3); <span class="c">/* "00a3" */</span>
|
||||||
f_printf(&fil, "%c", 'a'); <span>/* "a" */</span>
|
f_printf(&fil, "%08LX", 0x123ABC); <span class="c">/* "00123ABC" */</span>
|
||||||
|
f_printf(&fil, "%016b", 0x550F); <span class="c">/* "0101010100001111" */</span>
|
||||||
|
f_printf(&fil, "%s", "String"); <span class="c">/* "String" */</span>
|
||||||
|
f_printf(&fil, "%-4s", "abc"); <span class="c">/* "abc " */</span>
|
||||||
|
f_printf(&fil, "%4s", "abc"); <span class="c">/* " abc" */</span>
|
||||||
|
f_printf(&fil, "%c", 'a'); <span class="c">/* "a" */</span>
|
||||||
|
f_printf(&fil, "%f", 10.0); <span class="c">/* 浮動小数点は未サポート */</span>
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para ref">
|
||||||
<h4>参照</h4>
|
<h4>参照</h4>
|
||||||
<p><tt><a href="open.html">f_open</a>, <a href="putc.html">f_putc</a>, <a href="puts.html">f_puts</a>, <a href="gets.html">f_gets</a>, <a href="close.html">f_close</a>, <a href="sfile.html">FIL</a></tt></p>
|
<p><tt><a href="open.html">f_open</a>, <a href="putc.html">f_putc</a>, <a href="puts.html">f_puts</a>, <a href="gets.html">f_gets</a>, <a href="close.html">f_close</a>, <a href="sfile.html">FIL</a></tt></p>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -11,18 +11,18 @@
|
|||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para func">
|
||||||
<h2>f_putc</h2>
|
<h2>f_putc</h2>
|
||||||
<p>ファイルに文字を書き込みます。</p>
|
<p>ファイルに文字を書き込みます。</p>
|
||||||
<pre>
|
<pre>
|
||||||
int f_putc (
|
int f_putc (
|
||||||
TCHAR <em>Chr</em>, <span>/* 書き込む文字 */</span>
|
TCHAR <em>Chr</em>, <span class="c">/* 書き込む文字 */</span>
|
||||||
FIL* <em>FileObject</em> <span>/* ファイル・オブジェクト */</span>
|
FIL* <em>FileObject</em> <span class="c">/* ファイル・オブジェクト */</span>
|
||||||
);
|
);
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para arg">
|
||||||
<h4>引数</h4>
|
<h4>引数</h4>
|
||||||
<dl class="par">
|
<dl class="par">
|
||||||
<dt>Chr</dt>
|
<dt>Chr</dt>
|
||||||
@ -33,26 +33,26 @@ int f_putc (
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para ret">
|
||||||
<h4>戻り値</h4>
|
<h4>戻り値</h4>
|
||||||
<p>文字が正常に書き込まれると書き込んだ文字が返されます。ディスクが満杯またはエラーにより書き込まれなかったときは<tt>EOF (-1)</tt>が返されます。</p>
|
<p>文字が正常に書き込まれると書き込んだ文字が返されます。ディスクが満杯またはエラーにより書き込まれなかったときは<tt>EOF (-1)</tt>が返されます。</p>
|
||||||
<p>APIにUnicodeが選択されている(<tt>_LFN_UNICODE</tt>が1)ときは、UTF-8エンコードでファイルに書き込みます。それ以外の時は無変換(1文字1バイト)で書き込みます。</p>
|
<p>APIにUnicodeが選択されている(<tt>_LFN_UNICODE</tt>が1)ときは、UTF-8エンコードでファイルに書き込みます。それ以外の時は無変換(1文字1バイト)で書き込みます。</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para desc">
|
||||||
<h4>解説</h4>
|
<h4>解説</h4>
|
||||||
<p>1文字をファイルに書き込みます。この関数は<a href="write.html">f_write()</a>のラッパー関数です。</p>
|
<p>1文字をファイルに書き込みます。この関数は<a href="write.html">f_write()</a>のラッパー関数です。</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para comp">
|
||||||
<h4>対応情報</h4>
|
<h4>対応情報</h4>
|
||||||
<p><tt>_FS_READONLY == 0</tt>で、且つ<tt>_USE_STRFUNC</tt>が 1または 2のとき使用可能です。2を指定すると、<tt>'\n'</tt>は<tt>"\r\n"</tt>に展開されてファイルに書き込まれます。</p>
|
<p><tt>_FS_READONLY == 0</tt>で、且つ<tt>_USE_STRFUNC</tt>が 1または 2のとき使用可能です。2を指定すると、<tt>'\n'</tt>は<tt>"\r\n"</tt>に展開されてファイルに書き込まれます。</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para ref">
|
||||||
<h4>参照</h4>
|
<h4>参照</h4>
|
||||||
<p><tt><a href="open.html">f_open</a>, <a href="puts.html">f_puts</a>, <a href="printf.html">f_printf</a>, <a href="gets.html">f_gets</a>, <a href="close.html">f_close</a>, <a href="sfile.html">FIL</a></tt></p>
|
<p><tt><a href="open.html">f_open</a>, <a href="puts.html">f_puts</a>, <a href="printf.html">f_printf</a>, <a href="gets.html">f_gets</a>, <a href="close.html">f_close</a>, <a href="sfile.html">FIL</a></tt></p>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -11,18 +11,18 @@
|
|||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para func">
|
||||||
<h2>f_puts</h2>
|
<h2>f_puts</h2>
|
||||||
<p>ファイルに文字列を書き込みます。</p>
|
<p>ファイルに文字列を書き込みます。</p>
|
||||||
<pre>
|
<pre>
|
||||||
int f_puts (
|
int f_puts (
|
||||||
const TCHAR* <em>Str</em>, <span>/* 文字列 */</span>
|
const TCHAR* <em>Str</em>, <span class="c">/* 文字列 */</span>
|
||||||
FIL* <em>FileObject</em> <span>/* ファイル・オブジェクト */</span>
|
FIL* <em>FileObject</em> <span class="c">/* ファイル・オブジェクト */</span>
|
||||||
);
|
);
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para arg">
|
||||||
<h4>引数</h4>
|
<h4>引数</h4>
|
||||||
<dl class="par">
|
<dl class="par">
|
||||||
<dt>Str</dt>
|
<dt>Str</dt>
|
||||||
@ -33,26 +33,26 @@ int f_puts (
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para ret">
|
||||||
<h4>戻り値</h4>
|
<h4>戻り値</h4>
|
||||||
<p>文字列が正常に書き込まれると、書き込まれた文字数が返されます。ディスクが満杯またはエラーにより正常に書き込まれなかったときは<tt>EOF (-1)</tt>が返されます。</p>
|
<p>文字列が正常に書き込まれると、書き込まれた文字数が返されます。ディスクが満杯またはエラーにより正常に書き込まれなかったときは<tt>EOF (-1)</tt>が返されます。</p>
|
||||||
<p>APIにUnicodeが選択されている(<tt>_LFN_UNICODE</tt>が1)ときは、UTF-8エンコードでファイルに書き込みます。それ以外の時は無変換(1文字1バイト)で書き込みます。</p>
|
<p>APIにUnicodeが選択されている(<tt>_LFN_UNICODE</tt>が1)ときは、UTF-8エンコードでファイルに書き込みます。それ以外の時は無変換(1文字1バイト)で書き込みます。</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para desc">
|
||||||
<h4>解説</h4>
|
<h4>解説</h4>
|
||||||
<p>文字列をファイルに書き込みます。この関数は<a href="putc.html">f_putc()</a>のラッパー関数です。</p>
|
<p>文字列をファイルに書き込みます。この関数は<a href="putc.html">f_putc()</a>のラッパー関数です。</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para comp">
|
||||||
<h4>対応情報</h4>
|
<h4>対応情報</h4>
|
||||||
<p><tt>_FS_READONLY == 0</tt>で、且つ<tt>_USE_STRFUNC</tt>が 1または 2のとき使用可能です。2を指定すると、文字列に含まれる<tt>'\n'</tt>は<tt>"\r\n"</tt>に展開されてファイルに書き込まれます。</p>
|
<p><tt>_FS_READONLY == 0</tt>で、且つ<tt>_USE_STRFUNC</tt>が 1または 2のとき使用可能です。2を指定すると、文字列に含まれる<tt>'\n'</tt>は<tt>"\r\n"</tt>に展開されてファイルに書き込まれます。</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para ref">
|
||||||
<h4>参照</h4>
|
<h4>参照</h4>
|
||||||
<p><tt><a href="open.html">f_open</a>, <a href="putc.html">f_putc</a>, <a href="printf.html">f_printf</a>, <a href="gets.html">f_gets</a>, <a href="close.html">f_close</a>, <a href="sfile.html">FIL</a></tt></p>
|
<p><tt><a href="open.html">f_open</a>, <a href="putc.html">f_putc</a>, <a href="printf.html">f_printf</a>, <a href="gets.html">f_gets</a>, <a href="close.html">f_close</a>, <a href="sfile.html">FIL</a></tt></p>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
83
doc/ja/rc.html
Normal file
83
doc/ja/rc.html
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||||
|
<html lang="ja">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
|
<meta http-equiv="Content-Style-Type" content="text/css">
|
||||||
|
<link rel="up" title="FatFs" href="../00index_j.html">
|
||||||
|
<link rel="alternate" hreflang="en" title="English" href="../en/rc.html">
|
||||||
|
<link rel="stylesheet" href="../css_j.css" type="text/css" media="screen" title="ELM Default">
|
||||||
|
<title>FatFs - 戻り値</title>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<h1>ファイル関数の戻り値</h1>
|
||||||
|
<p>FatFsのAPIでは、一部の関数を除き結果に応じた共通のリザルト・コード(enum型)を返します。関数が成功した場合は0を返します。失敗した場合は0以外の値を返し、値はエラーの種類を示します。</p>
|
||||||
|
|
||||||
|
<dl class="ret">
|
||||||
|
<dt id="ok">FR_OK (0)</dt>
|
||||||
|
<dd>関数は成功した。</dd>
|
||||||
|
<dt id="de">FR_DISK_ERR</dt>
|
||||||
|
<dd>下位レイヤ(ディスクI/O関数)で回復不能なエラーが発生した。</dd>
|
||||||
|
<dt id="ie">FR_INT_ERR</dt>
|
||||||
|
<dd>内部処理の健全性に異常が検出された。原因としては次のようなことが考えられます。
|
||||||
|
<ul>
|
||||||
|
<li>ボリューム上のFAT構造にエラーがある。</li>
|
||||||
|
<li>スタック不足や他のタスク等によるワーク・エリア(ファイル・システム・オブジェクトやファイル・オブジェクト)の破壊。多くはこれが原因。</li>
|
||||||
|
</ul>
|
||||||
|
</dd>
|
||||||
|
<dt id="nr">FR_NOT_READY</dt>
|
||||||
|
<dd>物理ドライブが動作可能な状態にない。または、ドライブの初期化に失敗した。</dd>
|
||||||
|
<dt id="nf">FR_NO_FILE</dt>
|
||||||
|
<dd>指定されたファイルが見つからなかった。</dd>
|
||||||
|
<dt id="np">FR_NO_PATH</dt>
|
||||||
|
<dd>指定されたパスが見つからなかった。</dd>
|
||||||
|
<dt id="in">FR_INVALID_NAME</dt>
|
||||||
|
<dd>指定された文字列が<a href="filename.html">パス名のフォーマット</a>として無効。</dd>
|
||||||
|
<dt id="dn">FR_DENIED</dt>
|
||||||
|
<dd>そのオブジェクトに対する操作の拒否。原因としては次のようなことが考えられます。
|
||||||
|
<ul>
|
||||||
|
<li>書き込み禁止属性(AM_RDO)を持つファイルを書き込みモードで開こうとした。</li>
|
||||||
|
<li>書き込み禁止属性を持つファイルやディレクトリを削除しようとした。</li>
|
||||||
|
<li>空でないディレクトリまたはカレント・ディレクトリを削除しようとした。</li>
|
||||||
|
<li>FA_READを付けずに開いたファイルに対して読み出しを行った。</li>
|
||||||
|
<li>FA_WRITEを付けずに開いたファイルに対して変更操作を行った。</li>
|
||||||
|
<li>ディレクトリ・テーブルが満杯でファイルやディレクトリを作成できなかった。</li>
|
||||||
|
<li>ボリュームが満杯でディレクトリを作成できなかった。</li>
|
||||||
|
</ul>
|
||||||
|
</dd>
|
||||||
|
<dt id="ex">FR_EXIST</dt>
|
||||||
|
<dd>新しく作成しようとしたオブジェクトと同じ名前のオブジェクトが既に存在する。</dd>
|
||||||
|
<dt id="io">FR_INVALID_OBJECT</dt>
|
||||||
|
<dd>指定されたファイル・オブジェクトやディレクトリ・オブジェクトが無効。</dd>
|
||||||
|
<dt id="wp">FR_WRITE_PROTECTED</dt>
|
||||||
|
<dd>物理ドライブが書き込み禁止状態のとき、書き込みを伴う操作を行おうとした。</dd>
|
||||||
|
<dt id="id">FR_INVALID_DRIVE</dt>
|
||||||
|
<dd>指定されたドライブ番号が無効。(関連オプション: _VOLUMES)</dd>
|
||||||
|
<dt id="ne">FR_NOT_ENABLED</dt>
|
||||||
|
<dd>そのボリュームの操作に必要なワーク・エリア(ファイル・システム・オブジェクト構造体)が与えられていない。</dd>
|
||||||
|
<dt id="ns">FR_NO_FILESYSTEM</dt>
|
||||||
|
<dd>物理ドライブ上に有効なFATボリュームが見つからなかった。</dd>
|
||||||
|
<dt id="ma">FR_MKFS_ABORTED</dt>
|
||||||
|
<dd>f_mkfs()の処理が開始前に中断された。原因としては次のようなことが考えられます。
|
||||||
|
<ul>
|
||||||
|
<li>ボリュームが小さすぎる。</li>
|
||||||
|
<li>FATタイプの計算に矛盾が見つかった。クラスタ数がFATタイプの境界付近になるときに発生する場合があります。</li>
|
||||||
|
</ul>
|
||||||
|
</dd>
|
||||||
|
<dt id="tm">FR_TIMEOUT</dt>
|
||||||
|
<dd><a href="appnote.html#reentrant">再入制御</a>による待ち時間が定義された時間を越えたため、関数は実行されなかった。(関連オプション: _TIMEOUT)</dd>
|
||||||
|
<dt id="lo">FR_LOCKED</dt>
|
||||||
|
<dd><a href="appnote.html#dup">多重アクセス排他機能</a>により、そのファイルに対して行おうとしたアクセスが拒否された。(関連オプション: _FS_SHARE)</dd>
|
||||||
|
<dt id="nc">FR_NOT_ENOUGH_CORE</dt>
|
||||||
|
<dd>メモリ不足による失敗。原因としては次のようなことが考えられます。
|
||||||
|
<ul>
|
||||||
|
<li>LFN操作バッファの動的確保に失敗した。(関連オプション: _USE_LFN)</li>
|
||||||
|
<li>与えられた配列のサイズが実際に必要なサイズに対して不足している。</li>
|
||||||
|
</ul>
|
||||||
|
</dd>
|
||||||
|
<dt id="tf">FR_TOO_MANY_OPEN_FILES</dt>
|
||||||
|
<dd>同時オープン可能なファイル数を越えてファイルを開こうとした。(関連オプション: _FS_SHARE)</dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@ -11,20 +11,20 @@
|
|||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para func">
|
||||||
<h2>f_read</h2>
|
<h2>f_read</h2>
|
||||||
<p>ファイルからデータを読み出します。</p>
|
<p>ファイルからデータを読み出します。</p>
|
||||||
<pre>
|
<pre>
|
||||||
FRESULT f_read (
|
FRESULT f_read (
|
||||||
FIL* <em>FileObject</em>, <span>/* ファイル・オブジェクト構造体 */</span>
|
FIL* <em>FileObject</em>, <span class="c">/* ファイル・オブジェクト構造体 */</span>
|
||||||
void* <em>Buffer</em>, <span>/* 読み出したデータを格納するバッファ */</span>
|
void* <em>Buffer</em>, <span class="c">/* 読み出したデータを格納するバッファ */</span>
|
||||||
UINT <em>ByteToRead</em>, <span>/* 読み出すバイト数 */</span>
|
UINT <em>ByteToRead</em>, <span class="c">/* 読み出すバイト数 */</span>
|
||||||
UINT* <em>ByteRead</em> <span>/* 読み出されたバイト数 */</span>
|
UINT* <em>ByteRead</em> <span class="c">/* 読み出されたバイト数 */</span>
|
||||||
);
|
);
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para arg">
|
||||||
<h4>引数</h4>
|
<h4>引数</h4>
|
||||||
<dl class="par">
|
<dl class="par">
|
||||||
<dt>FileObject</dt>
|
<dt>FileObject</dt>
|
||||||
@ -39,38 +39,33 @@ FRESULT f_read (
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para ret">
|
||||||
<h4>戻り値</h4>
|
<h4>戻り値</h4>
|
||||||
<dl class="ret">
|
<p>
|
||||||
<dt>FR_OK (0)</dt>
|
<a href="rc.html#ok">FR_OK</a>,
|
||||||
<dd>正常終了。</dd>
|
<a href="rc.html#de">FR_DISK_ERR</a>,
|
||||||
<dt>FR_DENIED</dt>
|
<a href="rc.html#ie">FR_INT_ERR</a>,
|
||||||
<dd>非読み込みモードで開いたファイルから読み込もうとした。</dd>
|
<a href="rc.html#nr">FR_NOT_READY</a>,
|
||||||
<dt>FR_DISK_ERR</dt>
|
<a href="rc.html#de">FR_DENIED</a>,
|
||||||
<dd>ディスク・エラーによる失敗。</dd>
|
<a href="rc.html#io">FR_INVALID_OBJECT</a>,
|
||||||
<dt>FR_INT_ERR</dt>
|
<a href="rc.html#tm">FR_TIMEOUT</a>
|
||||||
<dd>不正なFAT構造または内部エラーによる失敗。</dd>
|
</p>
|
||||||
<dt>FR_NOT_READY</dt>
|
|
||||||
<dd>メディアがセットされていないなど、物理ドライブが動作不能状態。</dd>
|
|
||||||
<dt>FR_INVALID_OBJECT</dt>
|
|
||||||
<dd>無効なファイル・オブジェクト。</dd>
|
|
||||||
</dl>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para desc">
|
||||||
<h4>解説</h4>
|
<h4>解説</h4>
|
||||||
<p>読み込み開始位置は、現在のリード/ライト・ポインタからになります。リード/ライト・ポインタは読み込まれたバイト数だけ進みます。関数が正常終了した後は、<tt>*ByteRead</tt>の値をチェックすべきです。<tt>*ByteRead</tt>が<tt>ByteToRead</tt>よりも小さいときは、読み込み中にファイルの終端に達したことを示しています。</p>
|
<p>読み込み開始位置は、現在のリード/ライト・ポインタからになります。リード/ライト・ポインタは読み込まれたバイト数だけ進みます。関数が正常終了した後は、<tt>*ByteRead</tt>の値をチェックすべきです。<tt>*ByteRead</tt>が<tt>ByteToRead</tt>よりも小さいときは、読み込み中にファイルの終端に達したことを示しています。</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para comp">
|
||||||
<h4>対応情報</h4>
|
<h4>対応情報</h4>
|
||||||
<p>全ての構成で使用可能です。</p>
|
<p>全ての構成で使用可能です。</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para ref">
|
||||||
<h4>参照</h4>
|
<h4>参照</h4>
|
||||||
<p><tt><a href="open.html">f_open</a>, <a href="gets.html">fgets</a>, <a href="write.html">f_write</a>, <a href="close.html">f_close</a>, <a href="sfile.html">FIL</a></tt></p>
|
<p><tt><a href="open.html">f_open</a>, <a href="gets.html">fgets</a>, <a href="write.html">f_write</a>, <a href="close.html">f_close</a>, <a href="sfile.html">FIL</a></tt></p>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -11,18 +11,18 @@
|
|||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para func">
|
||||||
<h2>f_readdir</h2>
|
<h2>f_readdir</h2>
|
||||||
<p>ディレクトリ項目を読み出します</p>
|
<p>ディレクトリ項目を読み出します</p>
|
||||||
<pre>
|
<pre>
|
||||||
FRESULT f_readdir (
|
FRESULT f_readdir (
|
||||||
DIR* <em>DirObject</em>, <span>/* ディレクトリ・ブジェクト構造体へのポインタ */</span>
|
DIR* <em>DirObject</em>, <span class="c">/* ディレクトリ・ブジェクト構造体へのポインタ */</span>
|
||||||
FILINFO* <em>FileInfo</em> <span>/* ファイル情報構造体へのポインタ */</span>
|
FILINFO* <em>FileInfo</em> <span class="c">/* ファイル情報構造体へのポインタ */</span>
|
||||||
);
|
);
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para arg">
|
||||||
<h4>引数</h4>
|
<h4>引数</h4>
|
||||||
<dl class="par">
|
<dl class="par">
|
||||||
<dt>DirObject</dt>
|
<dt>DirObject</dt>
|
||||||
@ -33,77 +33,76 @@ FRESULT f_readdir (
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para ret">
|
||||||
<h4>戻り値</h4>
|
<h4>戻り値</h4>
|
||||||
<dl class="ret">
|
<p>
|
||||||
<dt>FR_OK (0)</dt>
|
<a href="rc.html#ok">FR_OK</a>,
|
||||||
<dd>正常終了。</dd>
|
<a href="rc.html#de">FR_DISK_ERR</a>,
|
||||||
<dt>FR_NOT_READY</dt>
|
<a href="rc.html#ie">FR_INT_ERR</a>,
|
||||||
<dd>メディアがセットされていないなど、物理ドライブが動作不能状態。</dd>
|
<a href="rc.html#nr">FR_NOT_READY</a>,
|
||||||
<dt>FR_DISK_ERR</dt>
|
<a href="rc.html#io">FR_INVALID_OBJECT</a>,
|
||||||
<dd>ディスク・エラーによる失敗。</dd>
|
<a href="rc.html#tm">FR_TIMEOUT</a>,
|
||||||
<dt>FR_INT_ERR</dt>
|
<a href="rc.html#nc">FR_NOT_ENOUGH_CORE</a>
|
||||||
<dd>不正なFAT構造または内部エラーによる失敗。</dd>
|
</p>
|
||||||
<dt>FR_INVALID_OBJECT</dt>
|
|
||||||
<dd>無効なディレクトリ・オブジェクト。</dd>
|
|
||||||
</dl>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para desc">
|
||||||
<h4>解説</h4>
|
<h4>解説</h4>
|
||||||
<p>ディレクトリ項目を順次読み出します。この関数を繰り返し実行することによりディレクトリの全ての項目を読み出すことができます。全ての項目を読み出し、読み出す項目がもう無いときは、<tt>f_name[]</tt>メンバにヌル文字列が返されます。ボリューム・ラベルは読み出すときに棄てられ、現れることはありません。"."、".."は、相対パスが有効なとき(<tt>_FS_RPATH == 1</tt>)にのみ現れます。得られるファイル情報の詳細については <tt>FILINFO</tt>構造体を参照してください。FileInfoにヌル・ポインタを指定すると、そのディレクトリのリード・インデックスを巻き戻します。</p>
|
<p>ディレクトリ項目を順次読み出します。この関数を繰り返し実行することによりディレクトリの全ての項目を読み出すことができます。全ての項目を読み出し、読み出す項目がもう無いときは、<tt>f_name[]</tt>メンバにヌル文字列が返されます。ボリューム・ラベルは読み出すときに棄てられ、現れることはありません。"."、".."は、相対パスが有効なとき(<tt>_FS_RPATH == 1</tt>)にのみ現れます。得られるファイル情報の詳細については <tt>FILINFO</tt>構造体を参照してください。FileInfoにヌル・ポインタを指定すると、そのディレクトリのリード・インデックスを巻き戻します。</p>
|
||||||
<p>LFN機能が有効な時は、f_readdir関数の呼び出しに先立ってFILINFO構造体の<tt>lfname</tt>と<tt>lfsize</tt>が有効な値で初期化されていなければなりません。<tt>lfname</tt>はLFNを格納するバッファで、<tt>lfsize</tt>はそのバッファ・サイズ(文字数)です。次の条件に一つでも該当する場合は、LFN格納バッファにヌル文字列が返されます。</p>
|
<p>LFN機能が有効な時は、f_readdir関数の呼び出しに先立ってFILINFO構造体の<tt>lfname</tt>と<tt>lfsize</tt>が有効な値で初期化されていなければなりません。<tt>lfname</tt>はLFNを格納するバッファで、<tt>lfsize</tt>はそのバッファ・サイズ(TCHAR)です。次の条件に一つでも該当する場合は、LFN格納バッファにヌル文字列が返されます。</p>
|
||||||
<ul>
|
<ul>
|
||||||
<li>そのディレクトリ項目にLFNが存在しない。</li>
|
<li>そのディレクトリ項目にLFNが存在しない。</li>
|
||||||
<li>LFNの長さに対してLFN格納バッファまたはLFN操作バッファのサイズが不十分。</li>
|
<li>LFNの長さに対してLFN格納バッファまたはLFN操作バッファのサイズが不十分。</li>
|
||||||
<li>LFNにOEMコードに存在しない文字が含まれている。(Unicode APIではないとき)</li>
|
<li>LFNに現在のOEMコードに存在しない文字が含まれている。(Unicode APIではないとき)</li>
|
||||||
</ul>
|
</ul>
|
||||||
<p>また、<tt>lfname</tt>にヌル・ポインタを指定した場合は、LFNに関して何も返されません。LFNが存在しないときは、<tt>f_name[]</tt>メンバのSFNにASCII英小文字が含まれる場合があります。</p>
|
<p>また、<tt>lfname</tt>にヌル・ポインタを指定した場合は、LFNに関して何も返されません。LFNが存在しないときは、<tt>f_name[]</tt>メンバのSFNにASCII英小文字が含まれる場合があります。</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para comp">
|
||||||
<h4>対応情報</h4>
|
<h4>対応情報</h4>
|
||||||
<p><tt>_FS_MINIMIZE <= 1</tt>のときに使用可能です。</p>
|
<p><tt>_FS_MINIMIZE <= 1</tt>のときに使用可能です。</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para use">
|
||||||
<h4>使用例</h4>
|
<h4>使用例</h4>
|
||||||
<pre>
|
<pre>
|
||||||
FRESULT scan_files (char* path)
|
FRESULT scan_files (
|
||||||
|
char* path <span class="c">/* 開始ノード (ワークエリアとしても使用) */</span>
|
||||||
|
)
|
||||||
{
|
{
|
||||||
FRESULT res;
|
FRESULT res;
|
||||||
FILINFO fno;
|
FILINFO fno;
|
||||||
DIR dir;
|
DIR dir;
|
||||||
int i;
|
int i;
|
||||||
char *fn;
|
char *fn; <span class="c">/* 非Unicode構成を想定 */</span>
|
||||||
#if _USE_LFN
|
<span class="k">#if</span> _USE_LFN
|
||||||
static char lfn[_MAX_LFN * (_DF1S ? 2 : 1) + 1];
|
static char lfn[_MAX_LFN + 1];
|
||||||
fno.lfname = lfn;
|
fno.lfname = lfn;
|
||||||
fno.lfsize = sizeof(lfn);
|
fno.lfsize = sizeof(lfn);
|
||||||
#endif
|
<span class="k">#endif</span>
|
||||||
|
|
||||||
|
|
||||||
res = f_opendir(&dir, path);
|
res = f_opendir(&dir, path); <span class="c">/* ディレクトリを開く */</span>
|
||||||
if (res == FR_OK) {
|
if (res == FR_OK) {
|
||||||
i = strlen(path);
|
i = strlen(path);
|
||||||
for (;;) {
|
for (;;) {
|
||||||
res = f_readdir(&dir, &fno);
|
res = f_readdir(&dir, &fno); <span class="c">/* ディレクトリ項目を1個読み出す */</span>
|
||||||
if (res != FR_OK || fno.fname[0] == 0) break;
|
if (res != FR_OK || fno.fname[0] == 0) break; <span class="c">/* エラーまたは項目無しのときは抜ける */</span>
|
||||||
if (fno.fname[0] == '.') continue;
|
if (fno.fname[0] == '.') continue; <span class="c">/* ドットエントリは無視 */</span>
|
||||||
#if _USE_LFN
|
<span class="k">#if</span> _USE_LFN
|
||||||
fn = *fno.lfname ? fno.lfname : fno.fname;
|
fn = *fno.lfname ? fno.lfname : fno.fname;
|
||||||
#else
|
<span class="k">#else</span>
|
||||||
fn = fno.fname;
|
fn = fno.fname;
|
||||||
#endif
|
<span class="k">#endif</span>
|
||||||
if (fno.fattrib & AM_DIR) {
|
if (fno.fattrib & AM_DIR) { <span class="c">/* ディレクトリ */</span>
|
||||||
sprintf(&path[i], "/%s", fn);
|
sprintf(&path[i], "/%s", fn);
|
||||||
res = scan_files(path);
|
res = scan_files(path);
|
||||||
if (res != FR_OK) break;
|
if (res != FR_OK) break;
|
||||||
path[i] = 0;
|
path[i] = 0;
|
||||||
} else {
|
} else { <span class="c">/* ファイル */</span>
|
||||||
printf("%s/%s\n", path, fn);
|
printf("%s/%s\n", path, fn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -115,7 +114,7 @@ FRESULT scan_files (char* path)
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para ref">
|
||||||
<h4>参照</h4>
|
<h4>参照</h4>
|
||||||
<p><tt><a href="opendir.html">f_opendir</a>, <a href="stat.html">f_stat</a>, <a href="sfileinfo.html">FILINFO</a>, <a href="sdir.html">DIR</a></tt></p>
|
<p><tt><a href="opendir.html">f_opendir</a>, <a href="stat.html">f_stat</a>, <a href="sfileinfo.html">FILINFO</a>, <a href="sdir.html">DIR</a></tt></p>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -11,18 +11,18 @@
|
|||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para func">
|
||||||
<h2>f_rename</h2>
|
<h2>f_rename</h2>
|
||||||
<p>オブジェクトの名前の変更または移動。</p>
|
<p>オブジェクトの名前の変更または移動。</p>
|
||||||
<pre>
|
<pre>
|
||||||
FRESULT f_rename (
|
FRESULT f_rename (
|
||||||
const TCHAR* <em>OldName</em>, <span>/* 古いオブジェクト名 */</span>
|
const TCHAR* <em>OldName</em>, <span class="c">/* 古いオブジェクト名 */</span>
|
||||||
const TCHAR* <em>NewName</em> <span>/* 新しいオブジェクト名 */</span>
|
const TCHAR* <em>NewName</em> <span class="c">/* 新しいオブジェクト名 */</span>
|
||||||
);
|
);
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para arg">
|
||||||
<h4>引数</h4>
|
<h4>引数</h4>
|
||||||
<dl class="par">
|
<dl class="par">
|
||||||
<dt>OldName</dt>
|
<dt>OldName</dt>
|
||||||
@ -33,60 +33,46 @@ FRESULT f_rename (
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para ret">
|
||||||
<h4>戻り値</h4>
|
<h4>戻り値</h4>
|
||||||
<dl class="ret">
|
<p>
|
||||||
<dt>FR_OK (0)</dt>
|
<a href="rc.html#ok">FR_OK</a>,
|
||||||
<dd>正常終了。</dd>
|
<a href="rc.html#de">FR_DISK_ERR</a>,
|
||||||
<dt>FR_NO_FILE</dt>
|
<a href="rc.html#ie">FR_INT_ERR</a>,
|
||||||
<dd>OldNameのオブジェクトが見つからない。</dd>
|
<a href="rc.html#nr">FR_NOT_READY</a>,
|
||||||
<dt>FR_NO_PATH</dt>
|
<a href="rc.html#ok">FR_NO_FILE</a>,
|
||||||
<dd>パスが見つからない。</dd>
|
<a href="rc.html#np">FR_NO_PATH</a>,
|
||||||
<dt>FR_INVALID_NAME</dt>
|
<a href="rc.html#in">FR_INVALID_NAME</a>,
|
||||||
<dd>パス名が不正。</dd>
|
<a href="rc.html#ex">FR_EXIST</a>,
|
||||||
<dt>FR_INVALID_DRIVE</dt>
|
<a href="rc.html#wp">FR_WRITE_PROTECTED</a>,
|
||||||
<dd>ドライブ番号が不正。</dd>
|
<a href="rc.html#id">FR_INVALID_DRIVE</a>,
|
||||||
<dt>FR_DENIED</dt>
|
<a href="rc.html#ne">FR_NOT_ENABLED</a>,
|
||||||
<dd>ドライブ容量の不足等の理由で新しい名前のオブジェクトが作れない。</dd>
|
<a href="rc.html#ns">FR_NO_FILESYSTEM</a>,
|
||||||
<dt>FR_EXIST</dt>
|
<a href="rc.html#tm">FR_TIMEOUT</a>,
|
||||||
<dd>NewNameと同じ名前が既に存在する。</dd>
|
<a href="rc.html#lo">FR_LOCKED</a>
|
||||||
<dt>FR_NOT_READY</dt>
|
</p>
|
||||||
<dd>メディアがセットされていないなど、物理ドライブが動作不能状態。</dd>
|
|
||||||
<dt>FR_WRITE_PROTECTED</dt>
|
|
||||||
<dd>メディアが書き込み禁止状態。</dd>
|
|
||||||
<dt>FR_DISK_ERR</dt>
|
|
||||||
<dd>ディスク・エラーによる失敗。</dd>
|
|
||||||
<dt>FR_INT_ERR</dt>
|
|
||||||
<dd>不正なFAT構造または内部エラーによる失敗。</dd>
|
|
||||||
<dt>FR_NOT_ENABLED</dt>
|
|
||||||
<dd>論理ドライブにワークエリアが割り当てられていない。</dd>
|
|
||||||
<dt>FR_NO_FILESYSTEM</dt>
|
|
||||||
<dd>有効なFATボリュームが見つからない。</dd>
|
|
||||||
<dt>FR_LOCKED</dt>
|
|
||||||
<dd>ファイル共有機能(_FS_SHARE)によるアクセス拒否。</dd>
|
|
||||||
</dl>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para desc">
|
||||||
<h4>解説</h4>
|
<h4>解説</h4>
|
||||||
<p>オブジェクトの名前を変更します。また、別のディレクトリへの移動も可能です。<em>開かれているオブジェクトに対して使用してはなりません</em>。</p>
|
<p>オブジェクトの名前を変更します。また、別のディレクトリへの移動も可能です。<em>開かれているオブジェクトに対して使用してはなりません</em>。</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para comp">
|
||||||
<h4>対応情報</h4>
|
<h4>対応情報</h4>
|
||||||
<p><tt>_FS_READONLY == 0</tt>で、且つ<tt>_FS_MINIMIZE == 0</tt>のときに使用可能です。</p>
|
<p><tt>_FS_READONLY == 0</tt>で、且つ<tt>_FS_MINIMIZE == 0</tt>のときに使用可能です。</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para use">
|
||||||
<h4>使用例</h4>
|
<h4>使用例</h4>
|
||||||
<pre>
|
<pre>
|
||||||
<span>/* ファイルまたはサブディレクトリの名前を変更する */</span>
|
<span class="c">/* ファイルまたはサブディレクトリの名前を変更する */</span>
|
||||||
f_rename("oldname.txt", "newname.txt");
|
f_rename("oldname.txt", "newname.txt");
|
||||||
|
|
||||||
<span>/* ファイルまたはサブディレクトリの名前の変更と別のディレクトリへの移動 */</span>
|
<span class="c">/* ファイルまたはサブディレクトリの名前の変更と別のディレクトリへの移動 */</span>
|
||||||
f_rename("oldname.txt", "dir1/newname.txt");
|
f_rename("oldname.txt", "dir1/newname.txt");
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -15,19 +15,19 @@
|
|||||||
<h2>DIR</h2>
|
<h2>DIR</h2>
|
||||||
<p><tt>DIR</tt>構造体は、f_opendir(), f_readdir()のワーク・エリアとして使用されます。アプリケーションから変更可能なメンバはありません。</p>
|
<p><tt>DIR</tt>構造体は、f_opendir(), f_readdir()のワーク・エリアとして使用されます。アプリケーションから変更可能なメンバはありません。</p>
|
||||||
<pre>
|
<pre>
|
||||||
typedef struct {
|
<span class="k">typedef</span> <span class="k">struct</span> {
|
||||||
FATFS* fs; <span>/* 親ファイル・システム・オブジェクトへのポインタ */</span>
|
FATFS* fs; <span class="c">/* 親ファイル・システム・オブジェクトへのポインタ */</span>
|
||||||
WORD id; <span>/* 親ファイル・システム・オブジェクトのマウントID */</span>
|
WORD id; <span class="c">/* 親ファイル・システム・オブジェクトのマウントID */</span>
|
||||||
WORD index; <span>/* 次に読み出すディレクトリ・インデックス番号 */</span>
|
WORD index; <span class="c">/* 次に読み出すディレクトリ・インデックス番号 */</span>
|
||||||
DWORD sclust; <span>/* ディレクトリ開始クラスタ (0:ルート) */</span>
|
DWORD sclust; <span class="c">/* ディレクトリ開始クラスタ (0:ルート) */</span>
|
||||||
DWORD clust; <span>/* 現在のクラスタ番号 */</span>
|
DWORD clust; <span class="c">/* 現在のクラスタ番号 */</span>
|
||||||
DWORD sect; <span>/* 現在のセクタ番号 */</span>
|
DWORD sect; <span class="c">/* 現在のセクタ番号 */</span>
|
||||||
BYTE* dir; <span>/* 現在のSFNエントリへのポインタ */</span>
|
BYTE* dir; <span class="c">/* 現在のSFNエントリへのポインタ */</span>
|
||||||
BYTE* fn; <span>/* SFNバッファへのポインタ (in/out) {file[8],ext[3],status[1]} */</span>
|
BYTE* fn; <span class="c">/* SFNバッファへのポインタ (in/out) {file[8],ext[3],status[1]} */</span>
|
||||||
#if _USE_LFN
|
<span class="k">#if</span> _USE_LFN
|
||||||
WCHAR* lfn; <span>/* LFNバッファへのポインタ */</span>
|
WCHAR* lfn; <span class="c">/* LFNバッファへのポインタ */</span>
|
||||||
WORD lfn_idx; <span>/* 最後にマッチしたLFNエントリのインデックス (0xFFFF:無効) */</span>
|
WORD lfn_idx; <span class="c">/* 最後にマッチしたLFNエントリのインデックス (0xFFFF:無効) */</span>
|
||||||
#endif
|
<span class="k">#endif</span>
|
||||||
} DIR;
|
} DIR;
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -13,39 +13,39 @@
|
|||||||
|
|
||||||
<div class="para">
|
<div class="para">
|
||||||
<h2>FATFS</h2>
|
<h2>FATFS</h2>
|
||||||
<p><tt>FATFS</tt>構造体は、個々の論理ドライブのダイナミック・ワーク・エリアを保持し、f_mount()でFatFsモジュールに登録されます。標準状態では次のようなメンバになっています。アプリケーションから書き換え可能なメンバはありません。</p>
|
<p><tt>FATFS</tt>構造体(ファイル・システム・オブジェクト)は、個々の論理ドライブのダイナミック・ワーク・エリアを保持し、f_mount()でFatFsモジュールに登録されます。初期化が行われるタイミングは、f_mount()またはメディア交換の後の最初のファイル・アクセスの時です。アプリケーションから書き換え可能なメンバはありません。</p>
|
||||||
|
|
||||||
<pre>
|
<pre>
|
||||||
typedef struct {
|
<span class="k">typedef</span> <span class="k">struct</span> {
|
||||||
BYTE fs_type; <span>/* FATタイプ */</span>
|
BYTE fs_type; <span class="c">/* FATタイプ */</span>
|
||||||
BYTE drv; <span>/* 物理ドライブ番号 */</span>
|
BYTE drv; <span class="c">/* 物理ドライブ番号 */</span>
|
||||||
BYTE csize; <span>/* クラスタ当たりのセクタ数 */</span>
|
BYTE csize; <span class="c">/* クラスタ当たりのセクタ数 */</span>
|
||||||
BYTE n_fats; <span>/* FATの多重化数 */</span>
|
BYTE n_fats; <span class="c">/* FATの多重化数 */</span>
|
||||||
BYTE wflag; <span>/* win[]ダーティ・フラグ */</span>
|
BYTE wflag; <span class="c">/* win[]ダーティ・フラグ */</span>
|
||||||
BYTE fsi_flag; <span>/* fsinfoダーティ・フラグ */</span>
|
BYTE fsi_flag; <span class="c">/* fsinfoダーティ・フラグ */</span>
|
||||||
WORD id; <span>/* ファイル・システム・マウントID */</span>
|
WORD id; <span class="c">/* ファイル・システム・マウントID */</span>
|
||||||
WORD n_rootdir; <span>/* ルート・ディレクトリのエントリ数 (FAT12/16) */</span>
|
WORD n_rootdir; <span class="c">/* ルート・ディレクトリのエントリ数 (FAT12/16) */</span>
|
||||||
#if _MAX_SS != 512
|
<span class="k">#if</span> _MAX_SS != 512
|
||||||
WORD ssize; <span>/* セクタ・サイズ (可変セクタ長のみ) */</span>
|
WORD ssize; <span class="c">/* セクタ・サイズ (可変セクタ長のみ) */</span>
|
||||||
#endif
|
<span class="k">#endif</span>
|
||||||
#if _FS_REENTRANT
|
<span class="k">#if</span> _FS_REENTRANT
|
||||||
HANDLE h_mutex; <span>/* 同期オブジェクトID */</span>
|
HANDLE h_mutex; <span class="c">/* 同期オブジェクトID */</span>
|
||||||
#endif
|
<span class="k">#endif</span>
|
||||||
#if !_FS_READONLY
|
<span class="k">#if</span> !_FS_READONLY
|
||||||
DWORD last_clust; <span>/* 最後に割り当てられたクラスタ番号 */</span>
|
DWORD last_clust; <span class="c">/* 最後に割り当てられたクラスタ番号 */</span>
|
||||||
DWORD free_clust; <span>/* 空きクラスタ数 */</span>
|
DWORD free_clust; <span class="c">/* 空きクラスタ数 */</span>
|
||||||
DWORD fsi_sector; <span>/* fsinfoセクタ (FAT32) */</span>
|
DWORD fsi_sector; <span class="c">/* fsinfoセクタ (FAT32) */</span>
|
||||||
#endif
|
<span class="k">#endif</span>
|
||||||
#if _FS_RPATH
|
<span class="k">#if</span> _FS_RPATH
|
||||||
DWORD cdir; <span>/* カレント・ディレクトリのクラスタ (0:ルート) */</span>
|
DWORD cdir; <span class="c">/* カレント・ディレクトリのクラスタ (0:ルート) */</span>
|
||||||
#endif
|
<span class="k">#endif</span>
|
||||||
DWORD n_fatent; <span>/* FATのエントリ数 (= クラスタ数 + 2) */</span>
|
DWORD n_fatent; <span class="c">/* FATのエントリ数 (= クラスタ数 + 2) */</span>
|
||||||
DWORD fsize; <span>/* FAT 1個当たりのセクタ数 */</span>
|
DWORD fsize; <span class="c">/* FAT 1個当たりのセクタ数 */</span>
|
||||||
DWORD fatbase; <span>/* FAT領域開始セクタ */</span>
|
DWORD fatbase; <span class="c">/* FAT領域開始セクタ */</span>
|
||||||
DWORD dirbase; <span>/* ルート・ディレクトリ開始セクタ (FAT32: クラスタ番号) */</span>
|
DWORD dirbase; <span class="c">/* ルート・ディレクトリ開始セクタ (FAT32: クラスタ番号) */</span>
|
||||||
DWORD database; <span>/* データ領域開始区セクタ */</span>
|
DWORD database; <span class="c">/* データ領域開始区セクタ */</span>
|
||||||
DWORD winsect; <span>/* win[]に現れているセクタ番号 */</span>
|
DWORD winsect; <span class="c">/* win[]に現れているセクタ番号 */</span>
|
||||||
BYTE win[_MAX_SS]; <span>/* ディスク・アクセス・ウィンドウ */</span>
|
BYTE win[_MAX_SS]; <span class="c">/* ディスク・アクセス・ウィンドウ */</span>
|
||||||
} FATFS;
|
} FATFS;
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -13,32 +13,32 @@
|
|||||||
|
|
||||||
<div class="para">
|
<div class="para">
|
||||||
<h2>FIL</h2>
|
<h2>FIL</h2>
|
||||||
<p><tt>FIL</tt>構造体は、f_open関数で作成され、そのファイルの状態を保持します。また、f_close関数でファイルが閉じられると無効化されます。アプリケーションからの書き換えが可能なメンバは<tt>cltbl</tt>のみです。非タイニー構成では内部にセクタ・バッファが確保されるので、サイズに注意が必要です。</p>
|
<p><tt>FIL</tt>構造体(ファイル・オブジェクト)は、f_open関数で初期化され、以後そのファイルの状態を保持します。また、f_close関数でファイルが閉じられると無効化されます。アプリケーションからの書き換えが可能なメンバは<tt>cltbl</tt>のみです。非タイニー構成では内部にセクタ・バッファが確保されるので、サイズに注意が必要です。</p>
|
||||||
|
|
||||||
<pre>
|
<pre>
|
||||||
typedef struct {
|
<span class="k">typedef</span> <span class="k">struct</span> {
|
||||||
FATFS* fs; <span>/* 親ファイル・システム・オブジェクトへのポインタ */</span>
|
FATFS* fs; <span class="c">/* 親ファイル・システム・オブジェクトへのポインタ */</span>
|
||||||
WORD id; <span>/* 親ファイル・システム・オブジェクトのマウントID */</span>
|
WORD id; <span class="c">/* 親ファイル・システム・オブジェクトのマウントID */</span>
|
||||||
BYTE flag; <span>/* ファイル・ステータス・フラグ */</span>
|
BYTE flag; <span class="c">/* ファイル・ステータス・フラグ */</span>
|
||||||
BYTE pad1;
|
BYTE pad1;
|
||||||
DWORD fptr; <span>/* ファイル読み書きポインタ (ファイル先頭からのバイト・オフセット) */</span>
|
DWORD fptr; <span class="c">/* ファイル読み書きポインタ (ファイル先頭からのバイト・オフセット) */</span>
|
||||||
DWORD fsize; <span>/* ファイル・サイズ(バイト単位) */</span>
|
DWORD fsize; <span class="c">/* ファイル・サイズ(バイト単位) */</span>
|
||||||
DWORD org_clust; <span>/* ファイル開始クラスタ番号 (0 on fsize==0) */</span>
|
DWORD sclust; <span class="c">/* ファイル開始クラスタ番号 (0 on fsize==0) */</span>
|
||||||
DWORD curr_clust; <span>/* 現在のクラスタ */</span>
|
DWORD clust; <span class="c">/* 現在のクラスタ */</span>
|
||||||
DWORD dsect; <span>/* 現在のデータ・セクタ */</span>
|
DWORD dsect; <span class="c">/* 現在のデータ・セクタ */</span>
|
||||||
#if _FS_READONLY == 0
|
<span class="k">#if</span> _FS_READONLY == 0
|
||||||
DWORD dir_sect; <span>/* このファイルのディレクトリ・エントリのあるセクタ */</span>
|
DWORD dir_sect; <span class="c">/* このファイルのディレクトリ・エントリのあるセクタ */</span>
|
||||||
BYTE* dir_ptr; <span>/* このファイルのディレクトリへのポインタ */</span>
|
BYTE* dir_ptr; <span class="c">/* このファイルのディレクトリへのポインタ */</span>
|
||||||
#endif
|
<span class="k">#endif</span>
|
||||||
#if _USE_FASTSEEK
|
<span class="k">#if</span> _USE_FASTSEEK
|
||||||
DWORD* cltbl; <span>/* ファイルのクラスタ・リンク情報へのポインタ (Nulled on file open) */</span>
|
DWORD* cltbl; <span class="c">/* ファイルのクラスタ・リンク情報へのポインタ (Nulled on file open) */</span>
|
||||||
#endif
|
<span class="k">#endif</span>
|
||||||
#if _FS_SHARE
|
<span class="k">#if</span> _FS_SHARE
|
||||||
UINT lockid; <span>/* ファイル・ロックID */</span>
|
UINT lockid; <span class="c">/* ファイル・ロックID */</span>
|
||||||
#endif
|
<span class="k">#endif</span>
|
||||||
#if !_FS_TINY
|
<span class="k">#if</span> !_FS_TINY
|
||||||
BYTE buf[_MAX_SS]; <span>/* データ転送バッファ */</span>
|
BYTE buf[_MAX_SS]; <span class="c">/* データ転送バッファ */</span>
|
||||||
#endif
|
<span class="k">#endif</span>
|
||||||
} FIL;
|
} FIL;
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -15,16 +15,16 @@
|
|||||||
<h2>FILINFO</h2>
|
<h2>FILINFO</h2>
|
||||||
<p><tt>FILINFO</tt>構造体は、<tt>f_stat(), f_readdir()</tt>で返されるファイル情報を保持します。</p>
|
<p><tt>FILINFO</tt>構造体は、<tt>f_stat(), f_readdir()</tt>で返されるファイル情報を保持します。</p>
|
||||||
<pre>
|
<pre>
|
||||||
typedef struct {
|
<span class="k">typedef</span> <span class="k">struct</span> {
|
||||||
DWORD fsize; <span>/* ファイル・サイズ */</span>
|
DWORD fsize; <span class="c">/* ファイル・サイズ */</span>
|
||||||
WORD fdate; <span>/* 最後に更新された日付 */</span>
|
WORD fdate; <span class="c">/* 最後に更新された日付 */</span>
|
||||||
WORD ftime; <span>/* 最後に更新された時刻 */</span>
|
WORD ftime; <span class="c">/* 最後に更新された時刻 */</span>
|
||||||
BYTE fattrib; <span>/* アトリビュート */</span>
|
BYTE fattrib; <span class="c">/* アトリビュート */</span>
|
||||||
TCHAR fname[13]; <span>/* 短いファイル名 (8.3フォーマット) */</span>
|
TCHAR fname[13]; <span class="c">/* 短いファイル名 (8.3フォーマット) */</span>
|
||||||
#if _USE_LFN
|
<span class="k">#if</span> _USE_LFN
|
||||||
TCHAR* lfname; <span>/* 長いファイル名のバッファへのポインタ */</span>
|
TCHAR* lfname; <span class="c">/* 長いファイル名のバッファへのポインタ */</span>
|
||||||
int lfsize; <span>/* 長いファイル名のバッファのサイズ [文字数] */</span>
|
int lfsize; <span class="c">/* 長いファイル名のバッファのサイズ [文字数] */</span>
|
||||||
#endif
|
<span class="k">#endif</span>
|
||||||
} FILINFO;
|
} FILINFO;
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
62
doc/ja/size.html
Normal file
62
doc/ja/size.html
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||||
|
<html lang="ja">
|
||||||
|
<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="alternate" hreflang="en" title="English" href="../en/size.html">
|
||||||
|
<link rel="stylesheet" href="../css_j.css" type="text/css" media="screen" title="ELM Default">
|
||||||
|
<title>FatFs - f_size</title>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<div class="para func">
|
||||||
|
<h2>f_size</h2>
|
||||||
|
<p>ファイルのサイズを取得します。</p>
|
||||||
|
<pre>
|
||||||
|
DWORD f_size (
|
||||||
|
FIL* <em>FileObject</em> <span class="c">/* ファイル・オブジェクト */</span>
|
||||||
|
);
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="para arg">
|
||||||
|
<h4>引数</h4>
|
||||||
|
<dl class="par">
|
||||||
|
<dt>FileObject</dt>
|
||||||
|
<dd>ファイル・オブジェクト構造体へのポインタを指定します。</dd>
|
||||||
|
</dl>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="para ret">
|
||||||
|
<h4>戻り値</h4>
|
||||||
|
<p>バイト単位のファイル・サイズが返ります。</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="para desc">
|
||||||
|
<h4>解説</h4>
|
||||||
|
<p>f_size関数は、現リビジョンではマクロとして実装されています。</p>
|
||||||
|
<pre>
|
||||||
|
<span class="k">#define</span> f_size(fp) ((fp)->fsize)
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="para comp">
|
||||||
|
<h4>対応情報</h4>
|
||||||
|
<p>常に使用可能。</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="para ref">
|
||||||
|
<h4>参照</h4>
|
||||||
|
<p><tt><a href="open.html">f_open</a>, <a href="lseek.html">f_lseek</a>, <a href="sfile.html">FIL</a></tt></p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p class="foot"><a href="../00index_j.html">戻る</a></p>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@ -11,17 +11,17 @@
|
|||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para func">
|
||||||
<h2>f_stat</h2>
|
<h2>f_stat</h2>
|
||||||
<pre>
|
<pre>
|
||||||
FRESULT f_stat (
|
FRESULT f_stat (
|
||||||
const TCHAR* <em>FileName</em>, <span>/* ファイルまたはディレクトリ名へのポインタ */</span>
|
const TCHAR* <em>FileName</em>, <span class="c">/* ファイルまたはディレクトリ名へのポインタ */</span>
|
||||||
FILINFO* <em>FileInfo</em> <span>/* ファイル情報構造体へのポインタ */</span>
|
FILINFO* <em>FileInfo</em> <span class="c">/* ファイル情報構造体へのポインタ */</span>
|
||||||
);
|
);
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para arg">
|
||||||
<h4>引数</h4>
|
<h4>引数</h4>
|
||||||
<dl class="par">
|
<dl class="par">
|
||||||
<dt>FileName</dt>
|
<dt>FileName</dt>
|
||||||
@ -32,46 +32,38 @@ FRESULT f_stat (
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para ret">
|
||||||
<h4>戻り値</h4>
|
<h4>戻り値</h4>
|
||||||
<dl class="ret">
|
<p>
|
||||||
<dt>FR_OK (0)</dt>
|
<a href="rc.html#ok">FR_OK</a>,
|
||||||
<dd>正常終了。</dd>
|
<a href="rc.html#de">FR_DISK_ERR</a>,
|
||||||
<dt>FR_NO_FILE</dt>
|
<a href="rc.html#ie">FR_INT_ERR</a>,
|
||||||
<dd>ファイルまたはディレクトリが見つからない。</dd>
|
<a href="rc.html#nr">FR_NOT_READY</a>,
|
||||||
<dt>FR_NO_PATH</dt>
|
<a href="rc.html#ok">FR_NO_FILE</a>,
|
||||||
<dd>パスが見つからない。</dd>
|
<a href="rc.html#np">FR_NO_PATH</a>,
|
||||||
<dt>FR_INVALID_NAME</dt>
|
<a href="rc.html#in">FR_INVALID_NAME</a>,
|
||||||
<dd>パス名が不正。</dd>
|
<a href="rc.html#id">FR_INVALID_DRIVE</a>,
|
||||||
<dt>FR_INVALID_DRIVE</dt>
|
<a href="rc.html#ne">FR_NOT_ENABLED</a>,
|
||||||
<dd>論理ドライブ番号が不正。</dd>
|
<a href="rc.html#ns">FR_NO_FILESYSTEM</a>,
|
||||||
<dt>FR_NOT_READY</dt>
|
<a href="rc.html#tm">FR_TIMEOUT</a>,
|
||||||
<dd>メディアがセットされていないなど、物理ドライブが動作不能状態。</dd>
|
<a href="rc.html#nc">FR_NOT_ENOUGH_CORE</a>
|
||||||
<dt>FR_DISK_ERR</dt>
|
</p>
|
||||||
<dd>ディスク・エラーによる失敗。</dd>
|
|
||||||
<dt>FR_INT_ERR</dt>
|
|
||||||
<dd>不正なFAT構造または内部エラーによる失敗。</dd>
|
|
||||||
<dt>FR_NOT_ENABLED</dt>
|
|
||||||
<dd>論理ドライブにワークエリアが割り当てられていない。</dd>
|
|
||||||
<dt>FR_NO_FILESYSTEM</dt>
|
|
||||||
<dd>有効なFATボリュームが見つからない。</dd>
|
|
||||||
</dl>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para desc">
|
||||||
<h4>解説</h4>
|
<h4>解説</h4>
|
||||||
<p>ファイルまたはディレクトリに関する情報を得ます。得られるファイル情報の詳細については <tt>FILINFO</tt>構造体を参照してください。</p>
|
<p>ファイルまたはディレクトリに関する情報を得ます。得られるファイル情報の詳細については <tt>FILINFO</tt>構造体を参照してください。</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para comp">
|
||||||
<h4>対応情報</h4>
|
<h4>対応情報</h4>
|
||||||
<p><tt>_FS_MINIMIZE == 0</tt>のときに使用可能です。</p>
|
<p><tt>_FS_MINIMIZE == 0</tt>のときに使用可能です。</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para ref">
|
||||||
<h4>参照</h4>
|
<h4>参照</h4>
|
||||||
<p><tt><a href="opendir.html">f_opendir</a>, <a href="readdir.html">f_readdir</a>, <a href="sfileinfo.html">FILINFO</a>, <a href="sdir.html">DIR</a></tt></p>
|
<p><tt><a href="opendir.html">f_opendir</a>, <a href="readdir.html">f_readdir</a>, <a href="sfileinfo.html">FILINFO</a>, <a href="sdir.html">DIR</a></tt></p>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -11,17 +11,17 @@
|
|||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para func">
|
||||||
<h2>f_sync</h2>
|
<h2>f_sync</h2>
|
||||||
<p>書き込み中のファイルのキャッシュされた情報をフラッシュします。</p>
|
<p>書き込み中のファイルのキャッシュされた情報をフラッシュします。</p>
|
||||||
<pre>
|
<pre>
|
||||||
FRESULT f_sync (
|
FRESULT f_sync (
|
||||||
FIL* <em>FileObject</em> <span>/* ファイル・オブジェクト構造体へのポインタ */</span>
|
FIL* <em>FileObject</em> <span class="c">/* ファイル・オブジェクト構造体へのポインタ */</span>
|
||||||
);
|
);
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para arg">
|
||||||
<h4>引数</h4>
|
<h4>引数</h4>
|
||||||
<dl class="par">
|
<dl class="par">
|
||||||
<dt>FileObject</dt>
|
<dt>FileObject</dt>
|
||||||
@ -30,36 +30,32 @@ FRESULT f_sync (
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para ret">
|
||||||
<h4>戻り値</h4>
|
<h4>戻り値</h4>
|
||||||
<dl class="ret">
|
<p>
|
||||||
<dt>FR_OK (0)</dt>
|
<a href="rc.html#ok">FR_OK</a>,
|
||||||
<dd>正常終了。</dd>
|
<a href="rc.html#de">FR_DISK_ERR</a>,
|
||||||
<dt>FR_DISK_ERR</dt>
|
<a href="rc.html#ie">FR_INT_ERR</a>,
|
||||||
<dd>ディスク・エラーによる失敗。</dd>
|
<a href="rc.html#nr">FR_NOT_READY</a>,
|
||||||
<dt>FR_INT_ERR</dt>
|
<a href="rc.html#io">FR_INVALID_OBJECT</a>,
|
||||||
<dd>不正なFAT構造または内部エラーによる失敗。</dd>
|
<a href="rc.html#tm">FR_TIMEOUT</a>
|
||||||
<dt>FR_NOT_READY</dt>
|
</p>
|
||||||
<dd>メディアがセットされていないなど、物理ドライブが動作不能状態。</dd>
|
|
||||||
<dt>FR_INVALID_OBJECT</dt>
|
|
||||||
<dd>ファイル・オブジェクトが無効。</dd>
|
|
||||||
</dl>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para desc">
|
||||||
<h4>解説</h4>
|
<h4>解説</h4>
|
||||||
<p>この関数は<tt>f_close()</tt>と同じ処理を実行しますが、ファイルは引き続き開かれたままになり、読み書きを続行できます。ロギングなど、書き込みモードで長時間ファイルが開かれているアプリケーションにおいて、定期的または区切りの良いところでこの関数を使用することにより、不意の電源断やメディアの取り外しにより失われるデータを最小にすることができます。実際のところ、<tt>f_close()</tt>内ではこの関数を呼び出した後ファイル・オブジェクトを無効化しているだけなので、<tt>f_close()</tt>直前の<tt>f_sync()</tt>は意味がありません。</p>
|
<p>この関数は<tt>f_close()</tt>と同じ処理を実行しますが、ファイルは引き続き開かれたままになり、読み書きを続行できます。ロギングなど、書き込みモードで長時間ファイルが開かれているアプリケーションにおいて、定期的または区切りの良いところでこの関数を使用することにより、不意の電源断やメディアの取り外しにより失われるデータを最小にすることができます。実際のところ、<tt>f_close()</tt>内ではこの関数を呼び出した後ファイル・オブジェクトを無効化しているだけなので、<tt>f_close()</tt>直前の<tt>f_sync()</tt>は意味がありません。</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para comp">
|
||||||
<h4>対応情報</h4>
|
<h4>対応情報</h4>
|
||||||
<p><tt>_FS_READONLY == 0</tt>のときに使用可能です。</p>
|
<p><tt>_FS_READONLY == 0</tt>のときに使用可能です。</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para ref">
|
||||||
<h4>参照</h4>
|
<h4>参照</h4>
|
||||||
<p><tt><a href="close.html">f_close</a></tt></p>
|
<p><tt><a href="close.html">f_close</a></tt></p>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
62
doc/ja/tell.html
Normal file
62
doc/ja/tell.html
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||||
|
<html lang="ja">
|
||||||
|
<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_e.html">
|
||||||
|
<link rel="alternate" hreflang="en" title="English" href="../en/tell.html">
|
||||||
|
<link rel="stylesheet" href="../css_j.css" type="text/css" media="screen" title="ELM Default">
|
||||||
|
<title>FatFs - f_tell</title>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<div class="para func">
|
||||||
|
<h2>f_tell</h2>
|
||||||
|
<p>現在のリード/ライト・ポインタを取得します。</p>
|
||||||
|
<pre>
|
||||||
|
DWORD f_tell (
|
||||||
|
FIL* <em>FileObject</em> <span class="c">/* ファイル・オブジェクト */</span>
|
||||||
|
);
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="para arg">
|
||||||
|
<h4>引数</h4>
|
||||||
|
<dl class="par">
|
||||||
|
<dt>FileObject</dt>
|
||||||
|
<dd>ファイル・オブジェクト構造体へのポインタを指定します。</dd>
|
||||||
|
</dl>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="para ret">
|
||||||
|
<h4>戻り値</h4>
|
||||||
|
<p>現在のリード/ライト・ポインタ(ファイル先頭からのバイト単位のオフセット)が返ります。</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="para desc">
|
||||||
|
<h4>解説</h4>
|
||||||
|
<p>f_tell関数は、現リビジョンではマクロとして実装されています。</p>
|
||||||
|
<pre>
|
||||||
|
<span class="k">#define</span> f_tell(fp) ((fp)->fptr)
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="para comp">
|
||||||
|
<h4>対応情報</h4>
|
||||||
|
<p>常に使用可能。</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="para ref">
|
||||||
|
<h4>参照</h4>
|
||||||
|
<p><tt><a href="open.html">f_open</a>, <a href="lseek.html">f_lseek</a>, <a href="sfile.html">FIL</a></tt></p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p class="foot"><a href="../00index_j.html">戻る</a></p>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@ -11,17 +11,17 @@
|
|||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para func">
|
||||||
<h2>f_truncate</h2>
|
<h2>f_truncate</h2>
|
||||||
<p>ファイル長を切り詰めます。</p>
|
<p>ファイル長を切り詰めます。</p>
|
||||||
<pre>
|
<pre>
|
||||||
FRESULT f_truncate (
|
FRESULT f_truncate (
|
||||||
FIL* <em>FileObject</em> <span>/* ファイル・オブジェクトへのポインタ */</span>
|
FIL* <em>FileObject</em> <span class="c">/* ファイル・オブジェクトへのポインタ */</span>
|
||||||
);
|
);
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para arg">
|
||||||
<h4>引数</h4>
|
<h4>引数</h4>
|
||||||
<dl class="par">
|
<dl class="par">
|
||||||
<dt>FileObject</dt>
|
<dt>FileObject</dt>
|
||||||
@ -30,38 +30,33 @@ FRESULT f_truncate (
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para ret">
|
||||||
<h4>戻り値</h4>
|
<h4>戻り値</h4>
|
||||||
<dl class="ret">
|
<p>
|
||||||
<dt>FR_OK (0)</dt>
|
<a href="rc.html#ok">FR_OK</a>,
|
||||||
<dd>正常終了。</dd>
|
<a href="rc.html#de">FR_DISK_ERR</a>,
|
||||||
<dt>FR_DENIED</dt>
|
<a href="rc.html#ie">FR_INT_ERR</a>,
|
||||||
<dd>ファイルが非書き込みモードで開かれている。</dd>
|
<a href="rc.html#nr">FR_NOT_READY</a>,
|
||||||
<dt>FR_DISK_ERR</dt>
|
<a href="rc.html#de">FR_DENIED</a>,
|
||||||
<dd>ディスク・エラーによる失敗。</dd>
|
<a href="rc.html#io">FR_INVALID_OBJECT</a>,
|
||||||
<dt>FR_INT_ERR</dt>
|
<a href="rc.html#tm">FR_TIMEOUT</a>
|
||||||
<dd>不正なFAT構造または内部エラーによる失敗。</dd>
|
</p>
|
||||||
<dt>FR_NOT_READY</dt>
|
|
||||||
<dd>メディアがセットされていないなど、物理ドライブが動作不能状態。</dd>
|
|
||||||
<dt>FR_INVALID_OBJECT</dt>
|
|
||||||
<dd>無効なファイル・オブジェクト。</dd>
|
|
||||||
</dl>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para desc">
|
||||||
<h4>解説</h4>
|
<h4>解説</h4>
|
||||||
<p>ファイルの長さが現在のリード/ライト・ポインタに切り詰められます。リード/ライト・ポインタが既にファイルの終端を指しているときは、この関数は何の効果も持ちません。</p>
|
<p>ファイルの長さが現在のリード/ライト・ポインタに切り詰められます。リード/ライト・ポインタが既にファイルの終端を指しているときは、この関数は何の効果も持ちません。</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para comp">
|
||||||
<h4>対応情報</h4>
|
<h4>対応情報</h4>
|
||||||
<p><tt>_FS_READONLY == 0</tt>で、且つ<tt>_FS_MINIMIZE == 0</tt>のときに使用可能です。</p>
|
<p><tt>_FS_READONLY == 0</tt>で、且つ<tt>_FS_MINIMIZE == 0</tt>のときに使用可能です。</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para ref">
|
||||||
<h4>参照</h4>
|
<h4>参照</h4>
|
||||||
<p><tt><a href="open.html">f_open</a>, <a href="lseek.html">f_lseek</a>, <a href="sfile.html">FIL</a></tt></p>
|
<p><tt><a href="open.html">f_open</a>, <a href="lseek.html">f_lseek</a>, <a href="sfile.html">FIL</a></tt></p>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -11,64 +11,59 @@
|
|||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para func">
|
||||||
<h2>f_unlink</h2>
|
<h2>f_unlink</h2>
|
||||||
<p>オブジェクトを削除します。</p>
|
<p>ファイルまたはディレクトリを削除します。</p>
|
||||||
<pre>
|
<pre>
|
||||||
FRESULT f_unlink (
|
FRESULT f_unlink (
|
||||||
const TCHAR* <em>FileName</em> <span>/* オブジェクト名へのポインタ */</span>
|
const TCHAR* <em>FileName</em> <span class="c">/* オブジェクト名へのポインタ */</span>
|
||||||
);
|
);
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para arg">
|
||||||
<h4>引数</h4>
|
<h4>引数</h4>
|
||||||
<dl class="par">
|
<dl class="par">
|
||||||
<dt>FileName</dt>
|
<dt>FileName</dt>
|
||||||
<dd>削除対象の<a href="filename.html">ファイルまたはディレクトリ名</a>の入った<tt>'\0'</tt>で終わる文字列へのポインタを指定します。</dd>
|
<dd>削除対象の<a href="filename.html">パス名</a>の入った<tt>'\0'</tt>で終わる文字列へのポインタを指定します。</dd>
|
||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para ret">
|
||||||
<h4>戻り値</h4>
|
<h4>戻り値</h4>
|
||||||
<dl class="ret">
|
<p>
|
||||||
<dt>FR_OK (0)</dt>
|
<a href="rc.html#ok">FR_OK</a>,
|
||||||
<dd>正常終了。</dd>
|
<a href="rc.html#de">FR_DISK_ERR</a>,
|
||||||
<dt>FR_NO_FILE</dt>
|
<a href="rc.html#ie">FR_INT_ERR</a>,
|
||||||
<dd>ファイルが見つからない。</dd>
|
<a href="rc.html#nr">FR_NOT_READY</a>,
|
||||||
<dt>FR_NO_PATH</dt>
|
<a href="rc.html#ok">FR_NO_FILE</a>,
|
||||||
<dd>パスが見つからない。</dd>
|
<a href="rc.html#np">FR_NO_PATH</a>,
|
||||||
<dt>FR_INVALID_NAME</dt>
|
<a href="rc.html#in">FR_INVALID_NAME</a>,
|
||||||
<dd>パス名が不正。</dd>
|
<a href="rc.html#de">FR_DENIED</a>,
|
||||||
<dt>FR_INVALID_DRIVE</dt>
|
<a href="rc.html#wp">FR_WRITE_PROTECTED</a>,
|
||||||
<dd>ドライブ番号が不正。</dd>
|
<a href="rc.html#id">FR_INVALID_DRIVE</a>,
|
||||||
<dt>FR_DENIED</dt>
|
<a href="rc.html#ne">FR_NOT_ENABLED</a>,
|
||||||
<dd>対象オブジェクトがリード・オンリー属性、空でないディレクトリやカレント・ディレクトリ。</dd>
|
<a href="rc.html#ns">FR_NO_FILESYSTEM</a>,
|
||||||
<dt>FR_NOT_READY</dt>
|
<a href="rc.html#tm">FR_TIMEOUT</a>,
|
||||||
<dd>メディアがセットされていないなど、物理ドライブが動作不能状態。</dd>
|
<a href="rc.html#lo">FR_LOCKED</a>,
|
||||||
<dt>FR_WRITE_PROTECTED</dt>
|
<a href="rc.html#nc">FR_NOT_ENOUGH_CORE</a>
|
||||||
<dd>メディアが書き込み禁止状態。</dd>
|
</p>
|
||||||
<dt>FR_DISK_ERR</dt>
|
|
||||||
<dd>ディスク・エラーによる失敗。</dd>
|
|
||||||
<dt>FR_INT_ERR</dt>
|
|
||||||
<dd>不正なFAT構造または内部エラーによる失敗。</dd>
|
|
||||||
<dt>FR_NOT_ENABLED</dt>
|
|
||||||
<dd>論理ドライブにワーク・エリアが割り当てられていない。</dd>
|
|
||||||
<dt>FR_NO_FILESYSTEM</dt>
|
|
||||||
<dd>有効なFATボリュームが見つからない。</dd>
|
|
||||||
<dt>FR_LOCKED</dt>
|
|
||||||
<dd>ファイル共有機能(_FS_SHARE)によるアクセス拒否。</dd>
|
|
||||||
</dl>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para desc">
|
||||||
<h4>解説</h4>
|
<h4>解説</h4>
|
||||||
<p>オブジェクトを削除します。<em>開かれているオブジェクトは削除してはなりません</em>。</p>
|
<p>削除対象のオブジェクが次の条件に当てはまる場合、そのアクセスは拒否され関数は失敗します。
|
||||||
|
<ul>
|
||||||
|
<li>リード・オンリー属性 (AM_RDO)を持っている。</li>
|
||||||
|
<li>空でないディレクトリまたはカレント・ディレクトリ。</li>
|
||||||
|
<li>開かれているファイル。この場合、<em>FAT構造が破壊される可能性</em>があります。<a href="appnote.html#dup">多重アクセス制御</a>が有効なときは、安全に拒否されます。</li>
|
||||||
|
</ul>
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para comp">
|
||||||
<h4>対応情報</h4>
|
<h4>対応情報</h4>
|
||||||
<p><tt>_FS_READONLY == 0</tt>で、且つ<tt>_FS_MINIMIZE == 0</tt>のときに使用可能です。</p>
|
<p><tt>_FS_READONLY == 0</tt>で、且つ<tt>_FS_MINIMIZE == 0</tt>のときに使用可能です。</p>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -11,18 +11,18 @@
|
|||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para func">
|
||||||
<h2>f_utime</h2>
|
<h2>f_utime</h2>
|
||||||
<p>オブジェクトのタイムスタンプを変更します。</p>
|
<p>オブジェクトのタイムスタンプを変更します。</p>
|
||||||
<pre>
|
<pre>
|
||||||
FRESULT f_utime (
|
FRESULT f_utime (
|
||||||
const TCHAR* <em>FileName</em>, <span>/* オブジェクト名へのポインタ */</span>
|
const TCHAR* <em>FileName</em>, <span class="c">/* オブジェクト名へのポインタ */</span>
|
||||||
const FILINFO* <em>TimeDate</em> <span>/* 設定する日付 */</span>
|
const FILINFO* <em>TimeDate</em> <span class="c">/* 設定する日付 */</span>
|
||||||
);
|
);
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para arg">
|
||||||
<h4>引数</h4>
|
<h4>引数</h4>
|
||||||
<dl class="par">
|
<dl class="par">
|
||||||
<dt>FileName</dt>
|
<dt>FileName</dt>
|
||||||
@ -33,46 +33,37 @@ FRESULT f_utime (
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para ret">
|
||||||
<h4>戻り値</h4>
|
<h4>戻り値</h4>
|
||||||
<dl class="ret">
|
<p>
|
||||||
<dt>FR_OK (0)</dt>
|
<a href="rc.html#ok">FR_OK</a>,
|
||||||
<dd>正常終了。</dd>
|
<a href="rc.html#de">FR_DISK_ERR</a>,
|
||||||
<dt>FR_NO_FILE</dt>
|
<a href="rc.html#ie">FR_INT_ERR</a>,
|
||||||
<dd>ファイルが見つからない。</dd>
|
<a href="rc.html#nr">FR_NOT_READY</a>,
|
||||||
<dt>FR_NO_PATH</dt>
|
<a href="rc.html#ok">FR_NO_FILE</a>,
|
||||||
<dd>パスが見つからない。</dd>
|
<a href="rc.html#np">FR_NO_PATH</a>,
|
||||||
<dt>FR_INVALID_NAME</dt>
|
<a href="rc.html#in">FR_INVALID_NAME</a>,
|
||||||
<dd>パス名が不正。</dd>
|
<a href="rc.html#wp">FR_WRITE_PROTECTED</a>,
|
||||||
<dt>FR_INVALID_NAME</dt>
|
<a href="rc.html#id">FR_INVALID_DRIVE</a>,
|
||||||
<dd>論理ドライブ番号が不正。</dd>
|
<a href="rc.html#ne">FR_NOT_ENABLED</a>,
|
||||||
<dt>FR_NOT_READY</dt>
|
<a href="rc.html#ns">FR_NO_FILESYSTEM</a>,
|
||||||
<dd>メディアがセットされていないなど、物理ドライブが動作不能状態。</dd>
|
<a href="rc.html#tm">FR_TIMEOUT</a>,
|
||||||
<dt>FR_WRITE_PROTECTED</dt>
|
<a href="rc.html#nc">FR_NOT_ENOUGH_CORE</a>
|
||||||
<dd>メディアが書き込み禁止状態。</dd>
|
</p>
|
||||||
<dt>FR_DISK_ERR</dt>
|
|
||||||
<dd>ディスク・エラーによる失敗。</dd>
|
|
||||||
<dt>FR_INT_ERR</dt>
|
|
||||||
<dd>不正なFAT構造または内部エラーによる失敗。</dd>
|
|
||||||
<dt>FR_NOT_ENABLED</dt>
|
|
||||||
<dd>その論理ドライブにワーク・エリアが与えられていない。</dd>
|
|
||||||
<dt>FR_NO_FILESYSTEM</dt>
|
|
||||||
<dd>有効なFATボリュームが見つからない。</dd>
|
|
||||||
</dl>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para desc">
|
||||||
<h4>解説</h4>
|
<h4>解説</h4>
|
||||||
<p>オブジェクトのタイムスタンプを変更します。</p>
|
<p>オブジェクトのタイムスタンプを変更します。</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para use">
|
||||||
<h4>使用例</h4>
|
<h4>使用例</h4>
|
||||||
<pre>
|
<pre>
|
||||||
FRESULT set_timestamp (
|
FRESULT set_timestamp (
|
||||||
char *obj, <span>/* ファイル名へのポインタ */</span>
|
char *obj, <span class="c">/* ファイル名へのポインタ */</span>
|
||||||
int year,
|
int year,
|
||||||
int month,
|
int month,
|
||||||
int mday,
|
int mday,
|
||||||
@ -92,13 +83,13 @@ FRESULT set_timestamp (
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para comp">
|
||||||
<h4>対応情報</h4>
|
<h4>対応情報</h4>
|
||||||
<p><tt>_FS_READONLY == 0</tt>で、且つ<tt>_FS_MINIMIZE == 0</tt>のときに使用可能です。</p>
|
<p><tt>_FS_READONLY == 0</tt>で、且つ<tt>_FS_MINIMIZE == 0</tt>のときに使用可能です。</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para ref">
|
||||||
<h4>参照</h4>
|
<h4>参照</h4>
|
||||||
<p><tt><a href="stat.html">f_stat</a>, <a href="sfileinfo.html">FILINFO</a></tt></p>
|
<p><tt><a href="stat.html">f_stat</a>, <a href="sfileinfo.html">FILINFO</a></tt></p>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -11,20 +11,20 @@
|
|||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para func">
|
||||||
<h2>f_write</h2>
|
<h2>f_write</h2>
|
||||||
<p>ファイルにデータを書き込みます。</p>
|
<p>ファイルにデータを書き込みます。</p>
|
||||||
<pre>
|
<pre>
|
||||||
FRESULT f_write (
|
FRESULT f_write (
|
||||||
FIL* <em>FileObject</em>, <span>/* ファイル・オブジェクト */</span>
|
FIL* <em>FileObject</em>, <span class="c">/* ファイル・オブジェクト */</span>
|
||||||
const void* <em>Buffer</em>, <span>/* 書き込みデータ */</span>
|
const void* <em>Buffer</em>, <span class="c">/* 書き込みデータ */</span>
|
||||||
UINT <em>ByteToWrite</em>, <span>/* 書き込むバイト数 */</span>
|
UINT <em>ByteToWrite</em>, <span class="c">/* 書き込むバイト数 */</span>
|
||||||
UINT* <em>ByteWritten</em> <span>/* 書き込まれたバイト数 */</span>
|
UINT* <em>ByteWritten</em> <span class="c">/* 書き込まれたバイト数 */</span>
|
||||||
);
|
);
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="para">
|
<div class="para arg">
|
||||||
<h4>引数</h4>
|
<h4>引数</h4>
|
||||||
<dl class="par">
|
<dl class="par">
|
||||||
<dt>FileObject</dt>
|
<dt>FileObject</dt>
|
||||||
@ -39,38 +39,33 @@ FRESULT f_write (
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para ret">
|
||||||
<h4>戻り値</h4>
|
<h4>戻り値</h4>
|
||||||
<dl class="ret">
|
<p>
|
||||||
<dt>FR_OK (0)</dt>
|
<a href="rc.html#ok">FR_OK</a>,
|
||||||
<dd>正常終了。</dd>
|
<a href="rc.html#de">FR_DISK_ERR</a>,
|
||||||
<dt>FR_DISK_ERR</dt>
|
<a href="rc.html#ie">FR_INT_ERR</a>,
|
||||||
<dd>ディスク・エラーによる失敗。</dd>
|
<a href="rc.html#nr">FR_NOT_READY</a>,
|
||||||
<dt>FR_INT_ERR</dt>
|
<a href="rc.html#de">FR_DENIED</a>,
|
||||||
<dd>不正なFAT構造または内部エラーによる失敗。</dd>
|
<a href="rc.html#io">FR_INVALID_OBJECT</a>,
|
||||||
<dt>FR_NOT_READY</dt>
|
<a href="rc.html#tm">FR_TIMEOUT</a>
|
||||||
<dd>メディアがセットされていないなど、物理ドライブが動作不能状態。</dd>
|
</p>
|
||||||
<dt>FR_DENIED</dt>
|
|
||||||
<dd>非書き込みモードで開かれたファイルに書き込もうとした。</dd>
|
|
||||||
<dt>FR_INVALID_OBJECT</dt>
|
|
||||||
<dd>無効なファイルオブジェクト。</dd>
|
|
||||||
</dl>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para desc">
|
||||||
<h4>解説</h4>
|
<h4>解説</h4>
|
||||||
<p>書き込み開始位置は、リード/ライト・ポインタの位置からになります。リード/ライト・ポインタは実際に書き込まれたバイト数だけ進みます。関数が正常終了した後、要求したバイト数が書き込まれたかどうか<tt>*ByteWritten</tt>をチェックすべきです。<tt>*ByteWritten < ByteToWrite</tt>のときは、ディスク・フルを意味します。ディスク・フルが発生しているときまたはそれに近いときは、制御が帰るまで時間がかかる場合があります。</p>
|
<p>書き込み開始位置は、リード/ライト・ポインタの位置からになります。リード/ライト・ポインタは実際に書き込まれたバイト数だけ進みます。関数が正常終了した後、要求したバイト数が書き込まれたかどうか<tt>*ByteWritten</tt>をチェックすべきです。<tt>*ByteWritten < ByteToWrite</tt>のときは、ディスク・フルを意味します。ディスク・フルが発生しているときまたはそれに近いときは、制御が帰るまで時間がかかる場合があります。</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para comp">
|
||||||
<h4>対応情報</h4>
|
<h4>対応情報</h4>
|
||||||
<p><tt>_FS_READONLY == 0</tt>のときに使用可能です。</p>
|
<p><tt>_FS_READONLY == 0</tt>のときに使用可能です。</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="para">
|
<div class="para ref">
|
||||||
<h4>参照</h4>
|
<h4>参照</h4>
|
||||||
<p><tt><a href="open.html">f_open</a>, <a href="read.html">f_read</a>, <a href="putc.html">fputc</a>, <a href="puts.html">fputs</a>, <a href="printf.html">fprintf</a>, <a href="close.html">f_close</a>, <a href="sfile.html">FIL</a></tt></p>
|
<p><tt><a href="open.html">f_open</a>, <a href="read.html">f_read</a>, <a href="putc.html">fputc</a>, <a href="puts.html">fputs</a>, <a href="printf.html">fprintf</a>, <a href="close.html">f_close</a>, <a href="sfile.html">FIL</a></tt></p>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -1,3 +1,9 @@
|
|||||||
|
R0.08b, Jan 15, 2011
|
||||||
|
Fast seek feature is also applied to f_read() and f_write().
|
||||||
|
f_lseek() reports required table size on creating CLMP.
|
||||||
|
Extended format syntax of f_printf function.
|
||||||
|
Ignores duplicated directory separators in given path names.
|
||||||
|
|
||||||
R0.08a, Aug 16, 2010
|
R0.08a, Aug 16, 2010
|
||||||
Added f_getcwd(). (_FS_RPATH = 2)
|
Added f_getcwd(). (_FS_RPATH = 2)
|
||||||
Added sector erase feature. (_USE_ERASE)
|
Added sector erase feature. (_USE_ERASE)
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
FatFs Module Source Files R0.08a (C)ChaN, 2010
|
FatFs Module Source Files R0.08b (C)ChaN, 2011
|
||||||
|
|
||||||
|
|
||||||
FILES
|
FILES
|
||||||
@ -23,7 +23,7 @@ AGREEMENTS
|
|||||||
small embedded systems. This is a free software and is opened for education,
|
small embedded systems. This is a free software and is opened for education,
|
||||||
research and commercial developments under license policy of following trems.
|
research and commercial developments under license policy of following trems.
|
||||||
|
|
||||||
Copyright (C) 2010, ChaN, all right reserved.
|
Copyright (C) 2011, ChaN, all right reserved.
|
||||||
|
|
||||||
* The FatFs module is a free software and there is NO WARRANTY.
|
* The FatFs module is a free software and there is NO WARRANTY.
|
||||||
* No restriction on use. You can use, modify and redistribute it for
|
* No restriction on use. You can use, modify and redistribute it for
|
||||||
@ -121,3 +121,7 @@ REVISION HISTORY
|
|||||||
Fixed a wrong directory entry is created on non-LFN cfg when the given name contains ';'.
|
Fixed a wrong directory entry is created on non-LFN cfg when the given name contains ';'.
|
||||||
Fixed f_mkfs() creates wrong FAT32 volume.
|
Fixed f_mkfs() creates wrong FAT32 volume.
|
||||||
|
|
||||||
|
Jan 15,'11 R0.08b Fast seek feature is also applied to f_read() and f_write().
|
||||||
|
f_lseek() reports required table size on creating CLMP.
|
||||||
|
Extended format syntax of f_printf function.
|
||||||
|
Ignores duplicated directory separators in given path names.
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
/*-----------------------------------------------------------------------
|
/*-----------------------------------------------------------------------
|
||||||
/ Low level disk interface modlue include file (C)ChaN, 2010
|
/ Low level disk interface modlue include file
|
||||||
/-----------------------------------------------------------------------*/
|
/-----------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef _DISKIO
|
#ifndef _DISKIO
|
||||||
|
|||||||
232
src/ff.h
232
src/ff.h
@ -1,11 +1,11 @@
|
|||||||
/*---------------------------------------------------------------------------/
|
/*---------------------------------------------------------------------------/
|
||||||
/ FatFs - FAT file system module include file R0.08a (C)ChaN, 2010
|
/ FatFs - FAT file system module include file R0.08b (C)ChaN, 2011
|
||||||
/----------------------------------------------------------------------------/
|
/----------------------------------------------------------------------------/
|
||||||
/ FatFs module is a generic FAT file system module for small embedded systems.
|
/ FatFs module is a generic FAT file system module for small embedded systems.
|
||||||
/ This is a free software that opened for education, research and commercial
|
/ This is a free software that opened for education, research and commercial
|
||||||
/ developments under license policy of following trems.
|
/ developments under license policy of following trems.
|
||||||
/
|
/
|
||||||
/ Copyright (C) 2010, ChaN, all right reserved.
|
/ Copyright (C) 2011, ChaN, all right reserved.
|
||||||
/
|
/
|
||||||
/ * The FatFs module is a free software and there is NO WARRANTY.
|
/ * The FatFs module is a free software and there is NO WARRANTY.
|
||||||
/ * No restriction on use. You can use, modify and redistribute it for
|
/ * No restriction on use. You can use, modify and redistribute it for
|
||||||
@ -15,7 +15,7 @@
|
|||||||
/----------------------------------------------------------------------------*/
|
/----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef _FATFS
|
#ifndef _FATFS
|
||||||
#define _FATFS 8255 /* Revision ID */
|
#define _FATFS 8237 /* Revision ID */
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@ -29,200 +29,6 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* DBCS code ranges and SBCS extend char conversion table */
|
|
||||||
|
|
||||||
#if _CODE_PAGE == 932 /* Japanese Shift-JIS */
|
|
||||||
#define _DF1S 0x81 /* DBC 1st byte range 1 start */
|
|
||||||
#define _DF1E 0x9F /* DBC 1st byte range 1 end */
|
|
||||||
#define _DF2S 0xE0 /* DBC 1st byte range 2 start */
|
|
||||||
#define _DF2E 0xFC /* DBC 1st byte range 2 end */
|
|
||||||
#define _DS1S 0x40 /* DBC 2nd byte range 1 start */
|
|
||||||
#define _DS1E 0x7E /* DBC 2nd byte range 1 end */
|
|
||||||
#define _DS2S 0x80 /* DBC 2nd byte range 2 start */
|
|
||||||
#define _DS2E 0xFC /* DBC 2nd byte range 2 end */
|
|
||||||
|
|
||||||
#elif _CODE_PAGE == 936 /* Simplified Chinese GBK */
|
|
||||||
#define _DF1S 0x81
|
|
||||||
#define _DF1E 0xFE
|
|
||||||
#define _DS1S 0x40
|
|
||||||
#define _DS1E 0x7E
|
|
||||||
#define _DS2S 0x80
|
|
||||||
#define _DS2E 0xFE
|
|
||||||
|
|
||||||
#elif _CODE_PAGE == 949 /* Korean */
|
|
||||||
#define _DF1S 0x81
|
|
||||||
#define _DF1E 0xFE
|
|
||||||
#define _DS1S 0x41
|
|
||||||
#define _DS1E 0x5A
|
|
||||||
#define _DS2S 0x61
|
|
||||||
#define _DS2E 0x7A
|
|
||||||
#define _DS3S 0x81
|
|
||||||
#define _DS3E 0xFE
|
|
||||||
|
|
||||||
#elif _CODE_PAGE == 950 /* Traditional Chinese Big5 */
|
|
||||||
#define _DF1S 0x81
|
|
||||||
#define _DF1E 0xFE
|
|
||||||
#define _DS1S 0x40
|
|
||||||
#define _DS1E 0x7E
|
|
||||||
#define _DS2S 0xA1
|
|
||||||
#define _DS2E 0xFE
|
|
||||||
|
|
||||||
#elif _CODE_PAGE == 437 /* U.S. (OEM) */
|
|
||||||
#define _DF1S 0
|
|
||||||
#define _EXCVT {0x80,0x9A,0x90,0x41,0x8E,0x41,0x8F,0x80,0x45,0x45,0x45,0x49,0x49,0x49,0x8E,0x8F,0x90,0x92,0x92,0x4F,0x99,0x4F,0x55,0x55,0x59,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, \
|
|
||||||
0x41,0x49,0x4F,0x55,0xA5,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0x21,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \
|
|
||||||
0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \
|
|
||||||
0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF,0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF}
|
|
||||||
|
|
||||||
#elif _CODE_PAGE == 720 /* Arabic (OEM) */
|
|
||||||
#define _DF1S 0
|
|
||||||
#define _EXCVT {0x80,0x81,0x45,0x41,0x84,0x41,0x86,0x43,0x45,0x45,0x45,0x49,0x49,0x8D,0x8E,0x8F,0x90,0x92,0x92,0x93,0x94,0x95,0x49,0x49,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, \
|
|
||||||
0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \
|
|
||||||
0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \
|
|
||||||
0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF,0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF}
|
|
||||||
|
|
||||||
#elif _CODE_PAGE == 737 /* Greek (OEM) */
|
|
||||||
#define _DF1S 0
|
|
||||||
#define _EXCVT {0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0x90,0x92,0x92,0x93,0x94,0x95,0x96,0x97,0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87, \
|
|
||||||
0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0x90,0x91,0xAA,0x92,0x93,0x94,0x95,0x96,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \
|
|
||||||
0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \
|
|
||||||
0x97,0xEA,0xEB,0xEC,0xE4,0xED,0xEE,0xE7,0xE8,0xF1,0xEA,0xEB,0xEC,0xED,0xEE,0xEF,0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF}
|
|
||||||
|
|
||||||
#elif _CODE_PAGE == 775 /* Baltic (OEM) */
|
|
||||||
#define _DF1S 0
|
|
||||||
#define _EXCVT {0x80,0x9A,0x91,0xA0,0x8E,0x95,0x8F,0x80,0xAD,0xED,0x8A,0x8A,0xA1,0x8D,0x8E,0x8F,0x90,0x92,0x92,0xE2,0x99,0x95,0x96,0x97,0x97,0x99,0x9A,0x9D,0x9C,0x9D,0x9E,0x9F, \
|
|
||||||
0xA0,0xA1,0xE0,0xA3,0xA3,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \
|
|
||||||
0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xB5,0xB6,0xB7,0xB8,0xBD,0xBE,0xC6,0xC7,0xA5,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \
|
|
||||||
0xE0,0xE1,0xE2,0xE3,0xE5,0xE5,0xE6,0xE3,0xE8,0xE8,0xEA,0xEA,0xEE,0xED,0xEE,0xEF,0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF}
|
|
||||||
|
|
||||||
#elif _CODE_PAGE == 850 /* Multilingual Latin 1 (OEM) */
|
|
||||||
#define _DF1S 0
|
|
||||||
#define _EXCVT {0x80,0x9A,0x90,0xB6,0x8E,0xB7,0x8F,0x80,0xD2,0xD3,0xD4,0xD8,0xD7,0xDE,0x8E,0x8F,0x90,0x92,0x92,0xE2,0x99,0xE3,0xEA,0xEB,0x59,0x99,0x9A,0x9D,0x9C,0x9D,0x9E,0x9F, \
|
|
||||||
0xB5,0xD6,0xE0,0xE9,0xA5,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0x21,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \
|
|
||||||
0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC7,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \
|
|
||||||
0xE0,0xE1,0xE2,0xE3,0xE5,0xE5,0xE6,0xE7,0xE7,0xE9,0xEA,0xEB,0xED,0xED,0xEE,0xEF,0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF}
|
|
||||||
|
|
||||||
#elif _CODE_PAGE == 852 /* Latin 2 (OEM) */
|
|
||||||
#define _DF1S 0
|
|
||||||
#define _EXCVT {0x80,0x9A,0x90,0xB6,0x8E,0xDE,0x8F,0x80,0x9D,0xD3,0x8A,0x8A,0xD7,0x8D,0x8E,0x8F,0x90,0x91,0x91,0xE2,0x99,0x95,0x95,0x97,0x97,0x99,0x9A,0x9B,0x9B,0x9D,0x9E,0x9F, \
|
|
||||||
0xB5,0xD6,0xE0,0xE9,0xA4,0xA4,0xA6,0xA6,0xA8,0xA8,0xAA,0x8D,0xAC,0xB8,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBD,0xBF, \
|
|
||||||
0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC6,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD1,0xD1,0xD2,0xD3,0xD2,0xD5,0xD6,0xD7,0xB7,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \
|
|
||||||
0xE0,0xE1,0xE2,0xE3,0xE3,0xD5,0xE6,0xE6,0xE8,0xE9,0xE8,0xEB,0xED,0xED,0xDD,0xEF,0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xEB,0xFC,0xFC,0xFE,0xFF}
|
|
||||||
|
|
||||||
#elif _CODE_PAGE == 855 /* Cyrillic (OEM) */
|
|
||||||
#define _DF1S 0
|
|
||||||
#define _EXCVT {0x81,0x81,0x83,0x83,0x85,0x85,0x87,0x87,0x89,0x89,0x8B,0x8B,0x8D,0x8D,0x8F,0x8F,0x91,0x91,0x93,0x93,0x95,0x95,0x97,0x97,0x99,0x99,0x9B,0x9B,0x9D,0x9D,0x9F,0x9F, \
|
|
||||||
0xA1,0xA1,0xA3,0xA3,0xA5,0xA5,0xA7,0xA7,0xA9,0xA9,0xAB,0xAB,0xAD,0xAD,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB6,0xB6,0xB8,0xB8,0xB9,0xBA,0xBB,0xBC,0xBE,0xBE,0xBF, \
|
|
||||||
0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC7,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD1,0xD1,0xD3,0xD3,0xD5,0xD5,0xD7,0xD7,0xDD,0xD9,0xDA,0xDB,0xDC,0xDD,0xE0,0xDF, \
|
|
||||||
0xE0,0xE2,0xE2,0xE4,0xE4,0xE6,0xE6,0xE8,0xE8,0xEA,0xEA,0xEC,0xEC,0xEE,0xEE,0xEF,0xF0,0xF2,0xF2,0xF4,0xF4,0xF6,0xF6,0xF8,0xF8,0xFA,0xFA,0xFC,0xFC,0xFD,0xFE,0xFF}
|
|
||||||
|
|
||||||
#elif _CODE_PAGE == 857 /* Turkish (OEM) */
|
|
||||||
#define _DF1S 0
|
|
||||||
#define _EXCVT {0x80,0x9A,0x90,0xB6,0x8E,0xB7,0x8F,0x80,0xD2,0xD3,0xD4,0xD8,0xD7,0x98,0x8E,0x8F,0x90,0x92,0x92,0xE2,0x99,0xE3,0xEA,0xEB,0x98,0x99,0x9A,0x9D,0x9C,0x9D,0x9E,0x9E, \
|
|
||||||
0xB5,0xD6,0xE0,0xE9,0xA5,0xA5,0xA6,0xA6,0xA8,0xA9,0xAA,0xAB,0xAC,0x21,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \
|
|
||||||
0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC7,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \
|
|
||||||
0xE0,0xE1,0xE2,0xE3,0xE5,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xDE,0x59,0xEE,0xEF,0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF}
|
|
||||||
|
|
||||||
#elif _CODE_PAGE == 858 /* Multilingual Latin 1 + Euro (OEM) */
|
|
||||||
#define _DF1S 0
|
|
||||||
#define _EXCVT {0x80,0x9A,0x90,0xB6,0x8E,0xB7,0x8F,0x80,0xD2,0xD3,0xD4,0xD8,0xD7,0xDE,0x8E,0x8F,0x90,0x92,0x92,0xE2,0x99,0xE3,0xEA,0xEB,0x59,0x99,0x9A,0x9D,0x9C,0x9D,0x9E,0x9F, \
|
|
||||||
0xB5,0xD6,0xE0,0xE9,0xA5,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0x21,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \
|
|
||||||
0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC7,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD1,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \
|
|
||||||
0xE0,0xE1,0xE2,0xE3,0xE5,0xE5,0xE6,0xE7,0xE7,0xE9,0xEA,0xEB,0xED,0xED,0xEE,0xEF,0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF}
|
|
||||||
|
|
||||||
#elif _CODE_PAGE == 862 /* Hebrew (OEM) */
|
|
||||||
#define _DF1S 0
|
|
||||||
#define _EXCVT {0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, \
|
|
||||||
0x41,0x49,0x4F,0x55,0xA5,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0x21,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \
|
|
||||||
0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \
|
|
||||||
0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF,0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF}
|
|
||||||
|
|
||||||
#elif _CODE_PAGE == 866 /* Russian (OEM) */
|
|
||||||
#define _DF1S 0
|
|
||||||
#define _EXCVT {0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, \
|
|
||||||
0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \
|
|
||||||
0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \
|
|
||||||
0x90,0x91,0x92,0x93,0x9d,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F,0xF0,0xF0,0xF2,0xF2,0xF4,0xF4,0xF6,0xF6,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF}
|
|
||||||
|
|
||||||
#elif _CODE_PAGE == 874 /* Thai (OEM, Windows) */
|
|
||||||
#define _DF1S 0
|
|
||||||
#define _EXCVT {0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, \
|
|
||||||
0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \
|
|
||||||
0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \
|
|
||||||
0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF,0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF}
|
|
||||||
|
|
||||||
#elif _CODE_PAGE == 1250 /* Central Europe (Windows) */
|
|
||||||
#define _DF1S 0
|
|
||||||
#define _EXCVT {0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x8A,0x9B,0x8C,0x8D,0x8E,0x8F, \
|
|
||||||
0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF,0xB0,0xB1,0xB2,0xA3,0xB4,0xB5,0xB6,0xB7,0xB8,0xA5,0xAA,0xBB,0xBC,0xBD,0xBC,0xAF, \
|
|
||||||
0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \
|
|
||||||
0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xF7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xFF}
|
|
||||||
|
|
||||||
#elif _CODE_PAGE == 1251 /* Cyrillic (Windows) */
|
|
||||||
#define _DF1S 0
|
|
||||||
#define _EXCVT {0x80,0x81,0x82,0x82,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0x80,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x8A,0x9B,0x8C,0x8D,0x8E,0x8F, \
|
|
||||||
0xA0,0xA2,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF,0xB0,0xB1,0xB2,0xB2,0xA5,0xB5,0xB6,0xB7,0xA8,0xB9,0xAA,0xBB,0xA3,0xBD,0xBD,0xAF, \
|
|
||||||
0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \
|
|
||||||
0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF}
|
|
||||||
|
|
||||||
#elif _CODE_PAGE == 1252 /* Latin 1 (Windows) */
|
|
||||||
#define _DF1S 0
|
|
||||||
#define _EXCVT {0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0xAd,0x9B,0x8C,0x9D,0xAE,0x9F, \
|
|
||||||
0xA0,0x21,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \
|
|
||||||
0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \
|
|
||||||
0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xF7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0x9F}
|
|
||||||
|
|
||||||
#elif _CODE_PAGE == 1253 /* Greek (Windows) */
|
|
||||||
#define _DF1S 0
|
|
||||||
#define _EXCVT {0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, \
|
|
||||||
0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \
|
|
||||||
0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xA2,0xB8,0xB9,0xBA, \
|
|
||||||
0xE0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xF2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xFB,0xBC,0xFD,0xBF,0xFF}
|
|
||||||
|
|
||||||
#elif _CODE_PAGE == 1254 /* Turkish (Windows) */
|
|
||||||
#define _DF1S 0
|
|
||||||
#define _EXCVT {0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x8A,0x9B,0x8C,0x9D,0x9E,0x9F, \
|
|
||||||
0xA0,0x21,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \
|
|
||||||
0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \
|
|
||||||
0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xF7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0x9F}
|
|
||||||
|
|
||||||
#elif _CODE_PAGE == 1255 /* Hebrew (Windows) */
|
|
||||||
#define _DF1S 0
|
|
||||||
#define _EXCVT {0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, \
|
|
||||||
0xA0,0x21,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \
|
|
||||||
0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \
|
|
||||||
0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF,0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF}
|
|
||||||
|
|
||||||
#elif _CODE_PAGE == 1256 /* Arabic (Windows) */
|
|
||||||
#define _DF1S 0
|
|
||||||
#define _EXCVT {0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x8C,0x9D,0x9E,0x9F, \
|
|
||||||
0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \
|
|
||||||
0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \
|
|
||||||
0x41,0xE1,0x41,0xE3,0xE4,0xE5,0xE6,0x43,0x45,0x45,0x45,0x45,0xEC,0xED,0x49,0x49,0xF0,0xF1,0xF2,0xF3,0x4F,0xF5,0xF6,0xF7,0xF8,0x55,0xFA,0x55,0x55,0xFD,0xFE,0xFF}
|
|
||||||
|
|
||||||
#elif _CODE_PAGE == 1257 /* Baltic (Windows) */
|
|
||||||
#define _DF1S 0
|
|
||||||
#define _EXCVT {0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, \
|
|
||||||
0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xA8,0xB9,0xAA,0xBB,0xBC,0xBD,0xBE,0xAF, \
|
|
||||||
0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \
|
|
||||||
0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xF7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xFF}
|
|
||||||
|
|
||||||
#elif _CODE_PAGE == 1258 /* Vietnam (OEM, Windows) */
|
|
||||||
#define _DF1S 0
|
|
||||||
#define _EXCVT {0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0xAC,0x9D,0x9E,0x9F, \
|
|
||||||
0xA0,0x21,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \
|
|
||||||
0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \
|
|
||||||
0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xEC,0xCD,0xCE,0xCF,0xD0,0xD1,0xF2,0xD3,0xD4,0xD5,0xD6,0xF7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xFE,0x9F}
|
|
||||||
|
|
||||||
#elif _CODE_PAGE == 1 /* ASCII (for only non-LFN cfg) */
|
|
||||||
#define _DF1S 0
|
|
||||||
|
|
||||||
#else
|
|
||||||
#error Unknown code page
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Definitions of volume management */
|
/* Definitions of volume management */
|
||||||
|
|
||||||
@ -311,8 +117,8 @@ typedef struct {
|
|||||||
BYTE pad1;
|
BYTE pad1;
|
||||||
DWORD fptr; /* File read/write pointer (0 on file open) */
|
DWORD fptr; /* File read/write pointer (0 on file open) */
|
||||||
DWORD fsize; /* File size */
|
DWORD fsize; /* File size */
|
||||||
DWORD org_clust; /* File start cluster (0 when fsize==0) */
|
DWORD sclust; /* File start cluster (0 when fsize==0) */
|
||||||
DWORD curr_clust; /* Current cluster */
|
DWORD clust; /* Current cluster */
|
||||||
DWORD dsect; /* Current data sector */
|
DWORD dsect; /* Current data sector */
|
||||||
#if !_FS_READONLY
|
#if !_FS_READONLY
|
||||||
DWORD dir_sect; /* Sector containing the directory entry */
|
DWORD dir_sect; /* Sector containing the directory entry */
|
||||||
@ -403,8 +209,6 @@ FRESULT f_close (FIL*); /* Close an open file object */
|
|||||||
FRESULT f_opendir (DIR*, const TCHAR*); /* Open an existing directory */
|
FRESULT f_opendir (DIR*, const TCHAR*); /* Open an existing directory */
|
||||||
FRESULT f_readdir (DIR*, FILINFO*); /* Read a directory item */
|
FRESULT f_readdir (DIR*, FILINFO*); /* Read a directory item */
|
||||||
FRESULT f_stat (const TCHAR*, FILINFO*); /* Get file status */
|
FRESULT f_stat (const TCHAR*, FILINFO*); /* Get file status */
|
||||||
|
|
||||||
#if !_FS_READONLY
|
|
||||||
FRESULT f_write (FIL*, const void*, UINT, UINT*); /* Write data to a file */
|
FRESULT f_write (FIL*, const void*, UINT, UINT*); /* Write data to a file */
|
||||||
FRESULT f_getfree (const TCHAR*, DWORD*, FATFS**); /* Get number of free clusters on the drive */
|
FRESULT f_getfree (const TCHAR*, DWORD*, FATFS**); /* Get number of free clusters on the drive */
|
||||||
FRESULT f_truncate (FIL*); /* Truncate file */
|
FRESULT f_truncate (FIL*); /* Truncate file */
|
||||||
@ -414,31 +218,19 @@ FRESULT f_mkdir (const TCHAR*); /* Create a new directory */
|
|||||||
FRESULT f_chmod (const TCHAR*, BYTE, BYTE); /* Change attriburte of the file/dir */
|
FRESULT f_chmod (const TCHAR*, BYTE, BYTE); /* Change attriburte of the file/dir */
|
||||||
FRESULT f_utime (const TCHAR*, const FILINFO*); /* Change timestamp of the file/dir */
|
FRESULT f_utime (const TCHAR*, const FILINFO*); /* Change timestamp of the file/dir */
|
||||||
FRESULT f_rename (const TCHAR*, const TCHAR*); /* Rename/Move a file or directory */
|
FRESULT f_rename (const TCHAR*, const TCHAR*); /* Rename/Move a file or directory */
|
||||||
#endif
|
|
||||||
|
|
||||||
#if _USE_FORWARD
|
|
||||||
FRESULT f_forward (FIL*, UINT(*)(const BYTE*,UINT), UINT, UINT*); /* Forward data to the stream */
|
FRESULT f_forward (FIL*, UINT(*)(const BYTE*,UINT), UINT, UINT*); /* Forward data to the stream */
|
||||||
#endif
|
|
||||||
|
|
||||||
#if _USE_MKFS
|
|
||||||
FRESULT f_mkfs (BYTE, BYTE, UINT); /* Create a file system on the drive */
|
FRESULT f_mkfs (BYTE, BYTE, UINT); /* Create a file system on the drive */
|
||||||
#endif
|
|
||||||
|
|
||||||
#if _FS_RPATH
|
|
||||||
FRESULT f_chdrive (BYTE); /* Change current drive */
|
FRESULT f_chdrive (BYTE); /* Change current drive */
|
||||||
FRESULT f_chdir (const TCHAR*); /* Change current directory */
|
FRESULT f_chdir (const TCHAR*); /* Change current directory */
|
||||||
FRESULT f_getcwd (TCHAR*, UINT); /* Get current directory */
|
FRESULT f_getcwd (TCHAR*, UINT); /* Get current directory */
|
||||||
#endif
|
|
||||||
|
|
||||||
#if _USE_STRFUNC
|
|
||||||
int f_putc (TCHAR, FIL*); /* Put a character to the file */
|
int f_putc (TCHAR, FIL*); /* Put a character to the file */
|
||||||
int f_puts (const TCHAR*, FIL*); /* Put a string to the file */
|
int f_puts (const TCHAR*, FIL*); /* Put a string to the file */
|
||||||
int f_printf (FIL*, const TCHAR*, ...); /* Put a formatted string to the file */
|
int f_printf (FIL*, const TCHAR*, ...); /* Put a formatted string to the file */
|
||||||
TCHAR* f_gets (TCHAR*, int, FIL*); /* Get a string from the file */
|
TCHAR* f_gets (TCHAR*, int, FIL*); /* Get a string from the file */
|
||||||
|
|
||||||
#ifndef EOF
|
#ifndef EOF
|
||||||
#define EOF (-1)
|
#define EOF (-1)
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
|
|
||||||
#define f_eof(fp) (((fp)->fptr == (fp)->fsize) ? 1 : 0)
|
#define f_eof(fp) (((fp)->fptr == (fp)->fsize) ? 1 : 0)
|
||||||
#define f_error(fp) (((fp)->flag & FA__ERROR) ? 1 : 0)
|
#define f_error(fp) (((fp)->flag & FA__ERROR) ? 1 : 0)
|
||||||
@ -447,6 +239,7 @@ TCHAR* f_gets (TCHAR*, int, FIL*); /* Get a string from the file */
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*--------------------------------------------------------------*/
|
/*--------------------------------------------------------------*/
|
||||||
/* Additional user defined functions */
|
/* Additional user defined functions */
|
||||||
|
|
||||||
@ -468,9 +261,9 @@ void ff_memfree (void*); /* Free memory block */
|
|||||||
/* Sync functions */
|
/* Sync functions */
|
||||||
#if _FS_REENTRANT
|
#if _FS_REENTRANT
|
||||||
int ff_cre_syncobj (BYTE, _SYNC_t*);/* Create a sync object */
|
int ff_cre_syncobj (BYTE, _SYNC_t*);/* Create a sync object */
|
||||||
int ff_del_syncobj (_SYNC_t); /* Delete a sync object */
|
|
||||||
int ff_req_grant (_SYNC_t); /* Lock sync object */
|
int ff_req_grant (_SYNC_t); /* Lock sync object */
|
||||||
void ff_rel_grant (_SYNC_t); /* Unlock sync object */
|
void ff_rel_grant (_SYNC_t); /* Unlock sync object */
|
||||||
|
int ff_del_syncobj (_SYNC_t); /* Delete a sync object */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
@ -519,6 +312,7 @@ void ff_rel_grant (_SYNC_t); /* Unlock sync object */
|
|||||||
#define CREATE_LINKMAP 0xFFFFFFFF
|
#define CREATE_LINKMAP 0xFFFFFFFF
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*--------------------------------*/
|
/*--------------------------------*/
|
||||||
/* Multi-byte word access macros */
|
/* Multi-byte word access macros */
|
||||||
|
|
||||||
@ -528,10 +322,10 @@ void ff_rel_grant (_SYNC_t); /* Unlock sync object */
|
|||||||
#define ST_WORD(ptr,val) *(WORD*)(BYTE*)(ptr)=(WORD)(val)
|
#define ST_WORD(ptr,val) *(WORD*)(BYTE*)(ptr)=(WORD)(val)
|
||||||
#define ST_DWORD(ptr,val) *(DWORD*)(BYTE*)(ptr)=(DWORD)(val)
|
#define ST_DWORD(ptr,val) *(DWORD*)(BYTE*)(ptr)=(DWORD)(val)
|
||||||
#else /* Use byte-by-byte access to the FAT structure */
|
#else /* Use byte-by-byte access to the FAT structure */
|
||||||
#define LD_WORD(ptr) (WORD)(((WORD)*(BYTE*)((ptr)+1)<<8)|(WORD)*(BYTE*)(ptr))
|
#define LD_WORD(ptr) (WORD)(((WORD)*((BYTE*)(ptr)+1)<<8)|(WORD)*(BYTE*)(ptr))
|
||||||
#define LD_DWORD(ptr) (DWORD)(((DWORD)*(BYTE*)((ptr)+3)<<24)|((DWORD)*(BYTE*)((ptr)+2)<<16)|((WORD)*(BYTE*)((ptr)+1)<<8)|*(BYTE*)(ptr))
|
#define LD_DWORD(ptr) (DWORD)(((DWORD)*((BYTE*)(ptr)+3)<<24)|((DWORD)*((BYTE*)(ptr)+2)<<16)|((WORD)*((BYTE*)(ptr)+1)<<8)|*(BYTE*)(ptr))
|
||||||
#define ST_WORD(ptr,val) *(BYTE*)(ptr)=(BYTE)(val); *(BYTE*)((ptr)+1)=(BYTE)((WORD)(val)>>8)
|
#define ST_WORD(ptr,val) *(BYTE*)(ptr)=(BYTE)(val); *((BYTE*)(ptr)+1)=(BYTE)((WORD)(val)>>8)
|
||||||
#define ST_DWORD(ptr,val) *(BYTE*)(ptr)=(BYTE)(val); *(BYTE*)((ptr)+1)=(BYTE)((WORD)(val)>>8); *(BYTE*)((ptr)+2)=(BYTE)((DWORD)(val)>>16); *(BYTE*)((ptr)+3)=(BYTE)((DWORD)(val)>>24)
|
#define ST_DWORD(ptr,val) *(BYTE*)(ptr)=(BYTE)(val); *((BYTE*)(ptr)+1)=(BYTE)((WORD)(val)>>8); *((BYTE*)(ptr)+2)=(BYTE)((DWORD)(val)>>16); *((BYTE*)(ptr)+3)=(BYTE)((DWORD)(val)>>24)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|||||||
19
src/ffconf.h
19
src/ffconf.h
@ -1,5 +1,5 @@
|
|||||||
/*---------------------------------------------------------------------------/
|
/*---------------------------------------------------------------------------/
|
||||||
/ FatFs - FAT file system module configuration file R0.08a (C)ChaN, 2010
|
/ FatFs - FAT file system module configuration file R0.08b (C)ChaN, 2011
|
||||||
/----------------------------------------------------------------------------/
|
/----------------------------------------------------------------------------/
|
||||||
/
|
/
|
||||||
/ CAUTION! Do not forget to make clean the project after any changes to
|
/ CAUTION! Do not forget to make clean the project after any changes to
|
||||||
@ -7,7 +7,7 @@
|
|||||||
/
|
/
|
||||||
/----------------------------------------------------------------------------*/
|
/----------------------------------------------------------------------------*/
|
||||||
#ifndef _FFCONF
|
#ifndef _FFCONF
|
||||||
#define _FFCONF 8255 /* Revision ID */
|
#define _FFCONF 8237 /* Revision ID */
|
||||||
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------/
|
/*---------------------------------------------------------------------------/
|
||||||
@ -132,9 +132,9 @@
|
|||||||
#define _MAX_SS 512 /* 512, 1024, 2048 or 4096 */
|
#define _MAX_SS 512 /* 512, 1024, 2048 or 4096 */
|
||||||
/* Maximum sector size to be handled.
|
/* Maximum sector size to be handled.
|
||||||
/ Always set 512 for memory card and hard disk but a larger value may be
|
/ Always set 512 for memory card and hard disk but a larger value may be
|
||||||
/ required for floppy disk (512/1024) and optical disk (512/2048).
|
/ required for on-board flash memory, floppy disk and optical disk.
|
||||||
/ When _MAX_SS is larger than 512, GET_SECTOR_SIZE command must be implememted
|
/ When _MAX_SS is larger than 512, it configures FatFs to variable sector size
|
||||||
/ to the disk_ioctl function. */
|
/ and GET_SECTOR_SIZE command must be implememted to the disk_ioctl function. */
|
||||||
|
|
||||||
|
|
||||||
#define _MULTI_PARTITION 0 /* 0:Single partition or 1:Multiple partition */
|
#define _MULTI_PARTITION 0 /* 0:Single partition or 1:Multiple partition */
|
||||||
@ -144,7 +144,8 @@
|
|||||||
|
|
||||||
|
|
||||||
#define _USE_ERASE 0 /* 0:Disable or 1:Enable */
|
#define _USE_ERASE 0 /* 0:Disable or 1:Enable */
|
||||||
/* To enable sector erase feature, set _USE_ERASE to 1. */
|
/* To enable sector erase feature, set _USE_ERASE to 1. CTRL_ERASE_SECTOR command
|
||||||
|
/ should be added to the disk_ioctl functio. */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -165,14 +166,14 @@
|
|||||||
/ performance and code size. */
|
/ performance and code size. */
|
||||||
|
|
||||||
|
|
||||||
/* Include a header file here to define sync object types on the O/S */
|
/* A header file that defines sync object types on the O/S, such as
|
||||||
/* #include <windows.h>, <ucos_ii.h>, <semphr.h> or ohters. */
|
/ windows.h, ucos_ii.h and semphr.h, must be included prior to ff.h. */
|
||||||
|
|
||||||
#define _FS_REENTRANT 0 /* 0:Disable or 1:Enable */
|
#define _FS_REENTRANT 0 /* 0:Disable or 1:Enable */
|
||||||
#define _FS_TIMEOUT 1000 /* Timeout period in unit of time ticks */
|
#define _FS_TIMEOUT 1000 /* Timeout period in unit of time ticks */
|
||||||
#define _SYNC_t HANDLE /* O/S dependent type of sync object. e.g. HANDLE, OS_EVENT*, ID and etc.. */
|
#define _SYNC_t HANDLE /* O/S dependent type of sync object. e.g. HANDLE, OS_EVENT*, ID and etc.. */
|
||||||
|
|
||||||
/* The _FS_REENTRANT option switches the reentrancy of the FatFs module.
|
/* The _FS_REENTRANT option switches the reentrancy (thread safe) of the FatFs module.
|
||||||
/
|
/
|
||||||
/ 0: Disable reentrancy. _SYNC_t and _FS_TIMEOUT have no effect.
|
/ 0: Disable reentrancy. _SYNC_t and _FS_TIMEOUT have no effect.
|
||||||
/ 1: Enable reentrancy. Also user provided synchronization handlers,
|
/ 1: Enable reentrancy. Also user provided synchronization handlers,
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
/*------------------------------------------------------------------------*/
|
/*------------------------------------------------------------------------*/
|
||||||
/* Sample code of OS dependent controls for FatFs R0.08 */
|
/* Sample code of OS dependent controls for FatFs R0.08b */
|
||||||
/* (C)ChaN, 2010 */
|
/* (C)ChaN, 2011 */
|
||||||
/*------------------------------------------------------------------------*/
|
/*------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include <stdlib.h> /* ANSI memory controls */
|
#include <stdlib.h> /* ANSI memory controls */
|
||||||
@ -14,28 +14,28 @@
|
|||||||
/* Create a Synchronization Object
|
/* Create a Synchronization Object
|
||||||
/*------------------------------------------------------------------------*/
|
/*------------------------------------------------------------------------*/
|
||||||
/* This function is called in f_mount function to create a new
|
/* This function is called in f_mount function to create a new
|
||||||
/ synchronization object, such as semaphore and mutex. When a FALSE is
|
/ synchronization object, such as semaphore and mutex. When a zero is
|
||||||
/ returned, the f_mount function fails with FR_INT_ERR.
|
/ returned, the f_mount function fails with FR_INT_ERR.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
BOOL ff_cre_syncobj ( /* TRUE:Function succeeded, FALSE:Could not create due to any error */
|
int ff_cre_syncobj ( /* TRUE:Function succeeded, FALSE:Could not create due to any error */
|
||||||
BYTE vol, /* Corresponding logical drive being processed */
|
BYTE vol, /* Corresponding logical drive being processed */
|
||||||
_SYNC_t *sobj /* Pointer to return the created sync object */
|
_SYNC_t *sobj /* Pointer to return the created sync object */
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
BOOL ret;
|
int ret;
|
||||||
|
|
||||||
*sobj = CreateMutex(NULL, FALSE, NULL); /* Win32 */
|
*sobj = CreateMutex(NULL, FALSE, NULL); /* Win32 */
|
||||||
ret = (*sobj != INVALID_HANDLE_VALUE) ? TRUE : FALSE;
|
ret = (*sobj != INVALID_HANDLE_VALUE);
|
||||||
|
|
||||||
// *sobj = SyncObjects[vol]; /* uITRON (give a static created sync object) */
|
// *sobj = SyncObjects[vol]; /* uITRON (give a static sync object) */
|
||||||
// ret = TRUE; /* The initial value of the semaphore must be 1. */
|
// ret = 1; /* The initial value of the semaphore must be 1. */
|
||||||
|
|
||||||
// *sobj = OSMutexCreate(0, &err); /* uC/OS-II */
|
// *sobj = OSMutexCreate(0, &err); /* uC/OS-II */
|
||||||
// ret = (err == OS_NO_ERR) ? TRUE : FALSE;
|
// ret = (err == OS_NO_ERR);
|
||||||
|
|
||||||
// *sobj = xSemaphoreCreateMutex(); /* FreeRTOS */
|
// *sobj = xSemaphoreCreateMutex(); /* FreeRTOS */
|
||||||
// ret = (*sobj != NULL) ? TRUE : FALSE;
|
// ret = (*sobj != NULL);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -46,24 +46,24 @@ BOOL ff_cre_syncobj ( /* TRUE:Function succeeded, FALSE:Could not create due to
|
|||||||
/* Delete a Synchronization Object */
|
/* Delete a Synchronization Object */
|
||||||
/*------------------------------------------------------------------------*/
|
/*------------------------------------------------------------------------*/
|
||||||
/* This function is called in f_mount function to delete a synchronization
|
/* This function is called in f_mount function to delete a synchronization
|
||||||
/ object that created with ff_cre_syncobj function. When a FALSE is
|
/ object that created with ff_cre_syncobj function. When a zero is
|
||||||
/ returned, the f_mount function fails with FR_INT_ERR.
|
/ returned, the f_mount function fails with FR_INT_ERR.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
BOOL ff_del_syncobj ( /* TRUE:Function succeeded, FALSE:Could not delete due to any error */
|
int ff_del_syncobj ( /* TRUE:Function succeeded, FALSE:Could not delete due to any error */
|
||||||
_SYNC_t sobj /* Sync object tied to the logical drive to be deleted */
|
_SYNC_t sobj /* Sync object tied to the logical drive to be deleted */
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
BOOL ret;
|
BOOL ret;
|
||||||
|
|
||||||
ret = CloseHandle(sobj); /* Win32 *
|
ret = CloseHandle(sobj); /* Win32 */
|
||||||
|
|
||||||
// ret = TRUE; /* uITRON (nothing to do) *
|
// ret = 1; /* uITRON (nothing to do) */
|
||||||
|
|
||||||
// OSMutexDel(sobj, OS_DEL_ALWAYS, &err); /* uC/OS-II */
|
// OSMutexDel(sobj, OS_DEL_ALWAYS, &err); /* uC/OS-II */
|
||||||
// ret = (err == OS_NO_ERR) ? TRUE : FALSE;
|
// ret = (err == OS_NO_ERR);
|
||||||
|
|
||||||
// ret = TRUE; /* FreeRTOS (nothing to do) */
|
// ret = 1; /* FreeRTOS (nothing to do) */
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -74,23 +74,23 @@ BOOL ff_del_syncobj ( /* TRUE:Function succeeded, FALSE:Could not delete due to
|
|||||||
/* Request Grant to Access the Volume */
|
/* Request Grant to Access the Volume */
|
||||||
/*------------------------------------------------------------------------*/
|
/*------------------------------------------------------------------------*/
|
||||||
/* This function is called on entering file functions to lock the volume.
|
/* This function is called on entering file functions to lock the volume.
|
||||||
/ When a FALSE is returned, the file function fails with FR_TIMEOUT.
|
/ When a zero is returned, the file function fails with FR_TIMEOUT.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
BOOL ff_req_grant ( /* TRUE:Got a grant to access the volume, FALSE:Could not get a grant */
|
int ff_req_grant ( /* TRUE:Got a grant to access the volume, FALSE:Could not get a grant */
|
||||||
_SYNC_t sobj /* Sync object to wait */
|
_SYNC_t sobj /* Sync object to wait */
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
BOOL ret;
|
int ret;
|
||||||
|
|
||||||
ret = (WaitForSingleObject(sobj, _FS_TIMEOUT) == WAIT_OBJECT_0) ? TRUE : FALSE; /* Win32 */
|
ret = (WaitForSingleObject(sobj, _FS_TIMEOUT) == WAIT_OBJECT_0); /* Win32 */
|
||||||
|
|
||||||
// ret = (wai_sem(sobj) == E_OK) ? TRUE : FALSE; /* uITRON */
|
// ret = (wai_sem(sobj) == E_OK); /* uITRON */
|
||||||
|
|
||||||
// OSMutexPend(sobj, _FS_TIMEOUT, &err)); /* uC/OS-II */
|
// OSMutexPend(sobj, _FS_TIMEOUT, &err)); /* uC/OS-II */
|
||||||
// ret = (err == OS_NO_ERR) ? TRUE : FALSE;
|
// ret = (err == OS_NO_ERR);
|
||||||
|
|
||||||
// ret = (xSemaphoreTake(sobj, _FS_TIMEOUT) == pdTRUE) ? TRUE : FALSE; /* FreeRTOS */
|
// ret = (xSemaphoreTake(sobj, _FS_TIMEOUT) == pdTRUE); /* FreeRTOS */
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user