fatfs v0.04 Feb 04, 2007:
- Supported multiple drive system. - Changed some APIs for multiple drive system. - Added f_mkfs().
This commit is contained in:
1 parent
f76dc3a97f
commit
3d65978d31
75 files changed
+2636
-1380
No files matched your search
@@ -0,0 +1,108 @@
|
||||
<!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="stylesheet" href="../css_e.css" type="text/css" media="screen" title="ELM Default">
|
||||
<title>FatFs Module Application Note</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>FatFs Module Application Note (for R0.04)</h1>
|
||||
<hr>
|
||||
|
||||
<div class="para">
|
||||
<h3>Considerations on porting to various platform</h3>
|
||||
<p>The FatFs module is assuming following terms on portability.</p>
|
||||
<ul>
|
||||
<li>ANSI C<br>
|
||||
The FatFs module is a middleware that written in ANSI C. There is no platform dependence, so long as the compiler is in compliance with ANSI C. However it handles system portable FAT structures. You must take the <strong>endian</strong> into consideration. This setting is defined in ff.h (tff.h). It must be changed for your platform first or the compiler will abort with an error.</li>
|
||||
<li>Size of char/short/long is 8/16/32 bit.<br>
|
||||
This will not be a problem on most C compilers. When any conflict of integer definitions between integer.h and existing definitions is occured, you must resolve the confrict with care.</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="para">
|
||||
<h3>FatFs vs. Tiny-FatFs</h3>
|
||||
<p>For most applications, such as portable audio and data logger, Tiny-FatFs is the best choice. However because the Tiny-FatFs does not support FAT32 in default, there is a limitation that can handle only tiny storage upto 2GB(4GB in FAT64). The FAT32 support can be added by <tt>_USE_FAT32</tt> option with an additional code size.</p>
|
||||
<p>FatFs is suitable for accessing multiple files fast, and for multiple drive system.</p>
|
||||
<div class="rset">
|
||||
<table class="lst2">
|
||||
<tr><th>Memory Size</th><th>FAT Type</th></tr>
|
||||
<tr><td><= 64MB</td><td>FAT12</td></tr>
|
||||
<tr><td>128MB - 2GB</td><td>FAT16</td></tr>
|
||||
<tr><td>>= 4GB</td><td>FAT32</td></tr>
|
||||
</table>
|
||||
</div>
|
||||
<p>Rignt table shows the correspondence between memory size and FAT type for SD memroy card and they are shipped with this format. The data area is justified to the erase block and the memory card works the best performance. For that reason, the memory card should not be reformated with PC. When cluster size or FAT type is changed, the write performance can be worse.</p>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="para">
|
||||
<h3>Performance effective file access</h3>
|
||||
<p>For good performance on reading/writing files on the small embedded system, application program should consider what process is done in the FatFs module. The file data on the disk is transferred by f_read function in following process.</p>
|
||||
<p>Figure 1. Sector miss-aligned read (short)<br>
|
||||
<img src="../img/f1.png" width="490" height="73">
|
||||
</p>
|
||||
<p>Figure 2. Sector miss-aligned read (long)<br>
|
||||
<img src="../img/f2.png" width="490" height="140">
|
||||
</p>
|
||||
<p>Figure 3. Sector aligned read<br>
|
||||
<img src="../img/f3.png" width="490" height="119">
|
||||
</p>
|
||||
<p>The file I/O buffer means a sector buffer to read/write partial data on the sector. For FatFs, member buffer[] in the file object is used. For Tiny-FatFs, member win[] in the file system object is used.</p>
|
||||
<p>Tiny-FatFs processes all data transfer and access to the FAT/directory with only one sector buffer, so that FAT sector cached into the buffer is lost and it must reloaded at every cluster boundary. FatFs has a FAT/directory buffer separated from file I/O buffer, the frequency of FAT accesses is only 1/341, 1/256 or 1/128 (when cluster is contiguous) compared to Tiny-FatFs. Thus the Tiny-FatFs is sacrificing its performance in compensation for very small memory footprint.</p>
|
||||
<p>Figure 1 shows that partial sector data is transferred via the file I/O buffer. At long data transfer shown in Figure 2, middle of transfer data that aligned to sector boundary is transferred into memory directly. Figure 3 shows that entier transfer data is aligned to the sector boundary. In this case, file I/O buffer is not used. At the direct transfer, maximum extent of sectors are read with disk_read function at a time but it never across cluster boundary even if it is contiguous.</p>
|
||||
<p>Therefore taking effort to sector aligned read/write accesss reduces memcpy and read/write performance will be improved. Besides the effect, cached FAT sector on the Tiny-FatFs is not flushed during read/write access, so that it can achieve same performance as FatFs and its small memory footprint simultanesously.</p>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="para">
|
||||
<h3>Critical section</h3>
|
||||
<p>When write operation to the FAT file system is interrupted due to any accidental failure, such as sudden blackout, incorrect disk removal and unrecoverable data error, the FAT structure can be destroyed. Following images shows the critical section on the FatFs module.</p>
|
||||
<div class="lset">
|
||||
Figure 4. Long critical section<br>
|
||||
<img src="../img/f4.png" width="320" height="470" alt="fig.4">
|
||||
</div>
|
||||
<div class="lset">
|
||||
Figure 5. Minimized critical section<br>
|
||||
<img src="../img/f5.png" width="320" height="470" alt="fig.5">
|
||||
</div>
|
||||
<br class="clr">
|
||||
<p>An interruption in the red section can cause a cross link; as a result, the file/directory is lost. There is one or more possibility listed below when an interruption in the yellow section is occured.</p>
|
||||
<ul>
|
||||
<li>File data being rewrited is collapted.</li>
|
||||
<li>A file being appended returns initial state.</li>
|
||||
<li>A file created as new is gone.</li>
|
||||
<li>A file created as new remains with length of zero.</li>
|
||||
<li>A file created in overwrite remains with length of zero.</li>
|
||||
<li>A file created in overwrite returns initial state.</li>
|
||||
<li>Efficiency of disk use gets worse due to lost chain.</li>
|
||||
</ul>
|
||||
<p>Every case does not affect the files that not in write operation. To minimize risk of data loss, the critical section can be minimized like shown in Figure 5 by minimizing the time that file is opened in write mode and using f_sync function properly.</p>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="para">
|
||||
<h3>Problems and Ideas</h3>
|
||||
<ul>
|
||||
<li>Abstraction of file object<br>
|
||||
Currently the file object structure is held by application layer. This is not a problem for Tiny-FatFs, it consumes the task stack only 26 bytes per file. But FatFs requires 550 bytes per file. When manage the file objects in file handle, stack consumption at application module will able to be reduced. In this case, the work area for file objects is managed in FatFs module. This has a disadvantage that direct access to the file object structure cannot be used and additional file functions, such as feof and ftell, will be needed.</li>
|
||||
<li>Efficient sector buffer management<br>
|
||||
The FatFs module has only one sector buffer per logical drive. There is an ineffciency on random file access with many files simultanesously. When additional memory for the sector buffer is available, the file access performance will able to be improved with an advanced cache mechanism.</li>
|
||||
<li>FSInfo sector<br>
|
||||
On FAT32 file system, the cluster search to create a file as new or get number of free clusters takes time due to a great many clusters. The FSInfo sector that has last allocated cluster number and number of free clusters is provided to prevent the silly cluster search. However the FatFs module does not support this feature.</li>
|
||||
<li>Long file name<br>
|
||||
There is an extended feature to handle long file name (LFN) up to 255 characters, in addition to 8.3 format file name, on FAT file system. To support this, 512 byte string buffer for file name and UCS-2 - Shift_JIS mutual conversion table are required. Therefore memory consumption of code and work area will be increased drastically. The FatFs module does not support this feature. The LFN on the FAT file system is a patent of Microsoft. When support it on the commercial products, you have to be licensed.</li>
|
||||
<li>Porting to RTOS<br>
|
||||
When use FatFs module from only one task, no consideration is needed. However when use it from two or more tasks simultanesously, any exclusion control will be required. Porting of FatFs module to μITRON is in progress by <a href="http://www.toppers.jp/">TOPPERS Project</a>.</li>
|
||||
</ul>
|
||||
<br>
|
||||
<p>These are the problems and ideas on current revision of FatFs module. However the main target of FatFs module is 8 bit microcontrollers. These extensions requires much resource and the FatFs will unable to be ported to the 8 bit system. This may be the most serious problem on future plan.</p>
|
||||
</div>
|
||||
|
||||
<p class="foot"><a href="../00index_e.html">Return</a></p>
|
||||
</body>
|
||||
</html>
|
||||
+10
-10
@@ -12,12 +12,12 @@
|
||||
|
||||
<div class="para">
|
||||
<h2>f_chmod</h2>
|
||||
<p>The f_chmod changes the attribute of a file or directory.</p>
|
||||
<p>The f_chmod function changes the attribute of a file or directory.</p>
|
||||
<pre>
|
||||
FRESULT f_chmod (
|
||||
const char* <em>FileName</em>, // Pointer to the file or directory
|
||||
BYTE <em>Attribute</em>, // Attribute flags
|
||||
BYTE <em>AttributeMask</em> // Attribute masks
|
||||
const char* <em>FileName</em>, /* Pointer to the file or directory */
|
||||
BYTE <em>Attribute</em>, /* Attribute flags */
|
||||
BYTE <em>AttributeMask</em> /* Attribute masks */
|
||||
);
|
||||
</pre>
|
||||
</div>
|
||||
@@ -26,7 +26,7 @@ FRESULT f_chmod (
|
||||
<h4>Parameter</h4>
|
||||
<dl class="par">
|
||||
<dt>FileName</dt>
|
||||
<dd>Pointer to the null-terminated string that specifies a file or directory to be changed</dd>
|
||||
<dd>Pointer to the null-terminated string that specifies a <a href="filename.html">file or directory</a> to be changed</dd>
|
||||
<dt>Attribute</dt>
|
||||
<dd>Attribute flags to be set in one or more combination of the following flags. The specified flags are set and others are cleard.<br>
|
||||
<table class="lst">
|
||||
@@ -54,16 +54,16 @@ FRESULT f_chmod (
|
||||
<dd>Could not find the path.</dd>
|
||||
<dt>FR_INVALID_NAME</dt>
|
||||
<dd>The file name is invalid.</dd>
|
||||
<dt>FR_INVALID_DRIVE</dt>
|
||||
<dd>The drive number is invalid.</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_WRITE_PROTECTED</dt>
|
||||
<dd>The medium is write protected.</dd>
|
||||
<dt>FR_RW_ERROR</dt>
|
||||
<dd>Any error occured in low level disk I/O.</dd>
|
||||
<dt>FR_INCORRECT_DISK_CHANGE</dt>
|
||||
<dd>Incorrect disk removal/change has occured.</dd>
|
||||
<dt>FR_NOT_ENABLED</dt>
|
||||
<dd>FatFs module is not enabled.</dd>
|
||||
<dd>The logical drive has no work area.</dd>
|
||||
<dt>FR_NO_FILESYSTEM</dt>
|
||||
<dd>There is no valid FAT partition on the disk.</dd>
|
||||
</dl>
|
||||
@@ -72,14 +72,14 @@ FRESULT f_chmod (
|
||||
|
||||
<div class="para">
|
||||
<h4>Description</h4>
|
||||
<p>The f_chmod changes the attribute of a file or directory. This function is not supported in read-only configuration and minimization level of >=1.</p>
|
||||
<p>The f_chmod function changes the attribute of a file or directory. This function is not supported in read-only configuration and minimization level of >=1.</p>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="para">
|
||||
<h4>Example</h4>
|
||||
<pre>
|
||||
// Set read-only flag, clear archive flag and others are left unchanged.
|
||||
// Set read-only flag, clear archive flag and others are retained.
|
||||
f_chmod("file.txt", AR_RDO, AR_RDO | AR_ARC);
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
+10
-10
@@ -12,10 +12,10 @@
|
||||
|
||||
<div class="para">
|
||||
<h2>f_close</h2>
|
||||
<p>Function f_close closes a file.</p>
|
||||
<p>The f_close function closes an open file.</p>
|
||||
<pre>
|
||||
FRESULT f_close (
|
||||
FIL* <em>FileObject</em> // Pointer to the file object structure
|
||||
FIL* <em>FileObject</em> /* Pointer to the file object structure */
|
||||
);
|
||||
</pre>
|
||||
</div>
|
||||
@@ -24,7 +24,7 @@ FRESULT f_close (
|
||||
<h4>Parameter</h4>
|
||||
<dl class="par">
|
||||
<dt>FileObject</dt>
|
||||
<dd>Pointer to the file object structure to be closed.</dd>
|
||||
<dd>Pointer to the open file object structure to be closed.</dd>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
@@ -33,20 +33,20 @@ FRESULT f_close (
|
||||
<h4>Return Values</h4>
|
||||
<dl class="ret">
|
||||
<dt>FR_OK (0)</dt>
|
||||
<dd>The file has been closed successfuly.</dd>
|
||||
<dd>The file object has been closed successfuly.</dd>
|
||||
<dt>FR_RW_ERROR</dt>
|
||||
<dd>Any error occured in low level disk I/O.</dd>
|
||||
<dt>FR_INCORRECT_DISK_CHANGE</dt>
|
||||
<dd>Incorrect disk removal/change occured.</dd>
|
||||
<dt>FR_NOT_ENABLED</dt>
|
||||
<dd>FatFs module is not enabled.</dd>
|
||||
<dd>Any error has occured in low level disk I/O.</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 class="para">
|
||||
<h4>Description</h4>
|
||||
<p>Function f_close closes a file. If any data has been written, the cached information of the file is written back to the disk. When the function succeeded, the file object is no longer valid and structure 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>
|
||||
|
||||
|
||||
|
||||
+15
-4
@@ -12,20 +12,31 @@
|
||||
|
||||
<div class="para">
|
||||
<h2>disk_initialize</h2>
|
||||
<p>The disk_initialize initializes the disk drive.</p>
|
||||
<p>The disk_initialize function initializes the disk drive.</p>
|
||||
<pre>
|
||||
DSTATUS disk_initialize ();
|
||||
DSTATUS disk_initialize (
|
||||
BYTE <em>Drive</em> /* Physical drive number */
|
||||
);
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<div class="para">
|
||||
<h4>Parameters</h4>
|
||||
<dl class="par">
|
||||
<dt>Drive</dt>
|
||||
<dd>Specifies the physical drive number to initialize.</dd>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="para">
|
||||
<h4>Return Values</h4>
|
||||
<p>This function returns a disk status. For details of the disk status, refer to the <tt><a href="dstat.html">disk_status()</a></tt>.</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 class="para">
|
||||
<h4>Description</h4>
|
||||
<p>The disk_initialize initializes the disk drive. When the function succeeded, <tt>STA_NOINIT</tt> flag in the return value will be cleard.</p>
|
||||
<p>The disk_initialize function initializes a physical drive. When the function succeeded, <tt>STA_NOINIT</tt> flag in the return value is cleard.</p>
|
||||
</div>
|
||||
|
||||
<p class="foot"><a href="../00index_e.html">Return</a></p>
|
||||
|
||||
+7
-4
@@ -12,12 +12,13 @@
|
||||
|
||||
<div class="para">
|
||||
<h2>disk_read</h2>
|
||||
<p>The disk_read reads sector(s) from the disk drive.</p>
|
||||
<p>The disk_read function reads sector(s) from the disk drive.</p>
|
||||
<pre>
|
||||
DRESULT disk_read (
|
||||
BYTE* <em>Buffer</em>, // Pointer to the read buffer.
|
||||
DWORD <em>SectorNumber</em>, // Sector number to read from.
|
||||
BYTE <em>SectorCount</em> // Number of sectros to read.
|
||||
BYTE <em>Drive</em>, /* Physical drive number */
|
||||
BYTE* <em>Buffer</em>, /* Pointer to the read buffer */
|
||||
DWORD <em>SectorNumber</em>, /* Sector number to read from */
|
||||
BYTE <em>SectorCount</em> /* Number of sectros to read */
|
||||
);
|
||||
</pre>
|
||||
</div>
|
||||
@@ -25,6 +26,8 @@ DRESULT disk_read (
|
||||
<div class="para">
|
||||
<h4>Parameters</h4>
|
||||
<dl class="par">
|
||||
<dt>Drive</dt>
|
||||
<dd>Specifies the physical drive number to read.</dd>
|
||||
<dt>Buffer</dt>
|
||||
<dd>Pointer to the read buffer to store the read data. <tt>SectorCount * 512</tt> bytes is required for the size of the read buffer.</dd>
|
||||
<dt>SectorNumber</dt>
|
||||
|
||||
+16
-5
@@ -12,22 +12,33 @@
|
||||
|
||||
<div class="para">
|
||||
<h2>disk_status</h2>
|
||||
<p>The disk_status gets the disk status.</p>
|
||||
<p>The disk_status function gets the disk status.</p>
|
||||
<pre>
|
||||
DSTATUS disk_status ();
|
||||
DSTATUS disk_status (
|
||||
BYTE <em>Drive</em> /* Physical drive number */
|
||||
);
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<div class="para">
|
||||
<h4>Parameters</h4>
|
||||
<dl class="par">
|
||||
<dt>Drive</dt>
|
||||
<dd>Specifies the physical drive number to be tested.</dd>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="para">
|
||||
<h4>Return Values</h4>
|
||||
<p>The disk status is returned in combinatin of following flags.</p>
|
||||
<dl class="ret">
|
||||
<dt>STA_NOINIT</dt>
|
||||
<dd>Indicates that the disk drive has not been initialiezed. This flag is set when power-on, occurrence of disk removal or <tt>disk_initialize()</tt> failed and cleared when <tt>disk_initialize()</tt> succeeded.</dd>
|
||||
<dd>Indicates that the disk drive has not been initialiezed. This flag is set on: power-on, disk removal and disk_initialize function failed, and cleared on: disk_initialize function succeeded.</dd>
|
||||
<dt>STA_NODISK</dt>
|
||||
<dd>Indicates that no disk in the drive. It is always cleared on non-removable drive.</dd>
|
||||
<dd>Indicates that no medium in the drive. It is always cleared on fixed disk drive.</dd>
|
||||
<dt>STA_PROTECTED</dt>
|
||||
<dd>Indicates that the disk is write protected. It is always cleared on the disk that has not write protect notch.</dd>
|
||||
<dd>Indicates that the medium is write protected. It is always cleared on the drive that does not support write protect notch.</dd>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
|
||||
+6
-3
@@ -15,9 +15,10 @@
|
||||
<p>The disk_write writes sector(s) to the disk.</p>
|
||||
<pre>
|
||||
DRESULT disk_write (
|
||||
const BYTE* <em>Buffer</em>, // Pointer to the data to be written.
|
||||
DWORD <em>SectorNumber</em>, // Sector number to write.
|
||||
BYTE <em>SectorCount</em> // Number of sectors to write.
|
||||
BYTE <em>Drive</em>, /* Physical drive number */
|
||||
const BYTE* <em>Buffer</em>, /* Pointer to the read buffer */
|
||||
DWORD <em>SectorNumber</em>, /* Sector number to write */
|
||||
BYTE <em>SectorCount</em> /* Number of sectors to write */
|
||||
);
|
||||
</pre>
|
||||
</div>
|
||||
@@ -25,6 +26,8 @@ DRESULT disk_write (
|
||||
<div class="para">
|
||||
<h4>Parameters</h4>
|
||||
<dl class="par">
|
||||
<dt>Drive</dt>
|
||||
<dd>Specifies the physical drive number to write.</dd>
|
||||
<dt>Buffer</dt>
|
||||
<dd>Pointer to the data to be written.</dd>
|
||||
<dt>SectorNumber</dd>
|
||||
|
||||
+3
-3
@@ -12,9 +12,9 @@
|
||||
|
||||
<div class="para">
|
||||
<h2>get_fattime</h2>
|
||||
<p>The get_fattime gets current time.</p>
|
||||
<p>The get_fattime function gets current time.</p>
|
||||
<pre>
|
||||
DWORD get_fattime ();
|
||||
DWORD get_fattime (void);
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
@@ -41,7 +41,7 @@ DWORD get_fattime ();
|
||||
|
||||
<div class="para">
|
||||
<h4>Description</h4>
|
||||
<p>The function must return any valid time even if the system does not support a real time clock. The get_fattime is not required in read only configuration.</p>
|
||||
<p>The get_fattime function must return any valid time even if the system does not support a real time clock. This fucntion is not required in read only configuration.</p>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
<!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="stylesheet" href="../css_e.css" type="text/css" media="screen" title="ELM Default">
|
||||
<title>FatFs - File and Path name on the FatFs module</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h2>File and Path name on the FatFs module</h2>
|
||||
|
||||
<div class="para">
|
||||
<p>The format of file and path name on the FatFs module is similer to MS-DOS. However does not have a concept of current directory, all objects on the drive are specified in full path from the roor directory.</p>
|
||||
<pre>
|
||||
|
||||
"<em>Drive#</em>:<em>directory</em>/<em>file</em>"
|
||||
|
||||
"file1.txt" a file on drive 0
|
||||
"/file1.txt" (same as above)
|
||||
"dir1/dir2/file1.txt" a file on drive 0
|
||||
"2:dir3/file2.txt" a file on drive 2
|
||||
"2:/dir5" a directory on drive 2
|
||||
"" the root directory on drive 0
|
||||
"/" (same as above)
|
||||
"2:" the root directory on drive 2
|
||||
|
||||
</pre>
|
||||
<p>The FatFs module supports only 8.3 format file name and long file name is currentry not supported. For directory separator, a '/' is used, not a '\'.</p>
|
||||
<p>The FatFs module has work areas that called file system object for each logical drive. The logical drive number is specified in a numeral with a colon. When drive number is omitted, it means the default drive (0). The logical drive is bound to the physical drive that has same drive number.</p>
|
||||
<p>As for the Tiny-FatFs, it has only one logical drive and always works as drive 0. Any drive number cannot be contained in the path name.</p>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
+21
-10
@@ -12,10 +12,12 @@
|
||||
|
||||
<div class="para">
|
||||
<h2>f_getfree</h2>
|
||||
<p>The f_getfree gets number of the free clusters.</p>
|
||||
<p>The f_getfree function gets number of the free clusters.</p>
|
||||
<pre>
|
||||
FRESULT f_getfree (
|
||||
DWORD* <em>Clusters</em> // Pointer to the variable to store number of free clusters.
|
||||
const char* <em>Path</em>, /* Root directory of the drive */
|
||||
DWORD* <em>Clusters</em>, /* Pointer to the variable to store number of free clusters */
|
||||
FATFS** <em>FileSystemObject</em> /* Pointer to pointer to file system object */
|
||||
);
|
||||
</pre>
|
||||
</div>
|
||||
@@ -23,8 +25,12 @@ FRESULT f_getfree (
|
||||
<div class="para">
|
||||
<h4>Parameters</h4>
|
||||
<dl class="par">
|
||||
<dt>Path</dt>
|
||||
<dd>Pinter to the null-terminated string that specifies the <a href="filename.html">root directory</a> of the logical drive. Always specify a null-string for Tiny-FatFs.</dd>
|
||||
<dt>Clusters</dt>
|
||||
<dd>Pointer to the DWORD variable to store number of free clusters.</dd>
|
||||
<dt>FileSystemObject</dt>
|
||||
<dd>Pointer to the pointer that to be stored the pointer to corresponding file system object.</dd>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
@@ -33,15 +39,15 @@ FRESULT f_getfree (
|
||||
<h4>Return Values</h4>
|
||||
<dl class="ret">
|
||||
<dt>FR_OK (0)</dt>
|
||||
<dd>The function succeeded. The <tt><em>*Clusters</em></tt> havs number of free clusters.</dd>
|
||||
<dd>The function succeeded. The <tt><em>*Clusters</em></tt> havs number of free clusters and <tt><em>*FileSystemObject</em></tt> points the file system object.</dd>
|
||||
<dt>FR_INVALID_DRIVE</dt>
|
||||
<dd>The drive number is invalid.</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_RW_ERROR</dt>
|
||||
<dd>Any error occured in low level disk I/O.</dd>
|
||||
<dt>FR_INCORRECT_DISK_CHANGE</dt>
|
||||
<dd>Incorrect disk removal/change has occured.</dd>
|
||||
<dt>FR_NOT_ENABLED</dt>
|
||||
<dd>FatFs module is not enabled.</dd>
|
||||
<dd>The logical drive has no work area.</dd>
|
||||
<dt>FR_NO_FILESYSTEM</dt>
|
||||
<dd>There is no valid FAT partition on the disk.</dd>
|
||||
</dl>
|
||||
@@ -50,21 +56,26 @@ FRESULT f_getfree (
|
||||
|
||||
<div class="para">
|
||||
<h4>Descriptions</h4>
|
||||
<p>The f_getfree gets number of free clusters on the drive. The <tt>FatFs.sects_clust</tt> is indicating number of sectors per cluster, so that the free space in unit of byte can be calcurated with this. This function is not supported in read-only configuration and minimization level of >= 1.</p>
|
||||
<p>The f_getfree function gets number of free clusters on the drive. The <tt>sects_clust</tt> member in the file system object refreting number of sectors per cluster, so that the free space in unit of sector can be calcurated with this. This function is not supported in read-only configuration and minimization level of >= 1.</p>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="para">
|
||||
<h4>Samples Code</h4>
|
||||
<pre>
|
||||
FATFS *fs;
|
||||
DWORD clust;
|
||||
|
||||
|
||||
// Get free clusters
|
||||
res = f_getfree(&clust);
|
||||
res = f_getfree("", &clust, &fs);
|
||||
if (res) die(res);
|
||||
|
||||
// Get free bytes
|
||||
printf("%lu bytes available on the disk.\n", clust * FatFs->sects_clust * 512);
|
||||
// Get free space
|
||||
printf("%lu KB total disk space.\n"
|
||||
"%lu KB available on the disk.\n",
|
||||
(fs->max_clust - 2) * fs->sects_clust / 2,
|
||||
clust * fs->sects_clust / 2);
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
|
||||
+10
-10
@@ -12,11 +12,11 @@
|
||||
|
||||
<div class="para">
|
||||
<h2>f_lseek</h2>
|
||||
<p>The f_lseek moves the file read/write pointer.</p>
|
||||
<p>The f_lseek functione moves the file read/write pointer of an open file object.</p>
|
||||
<pre>
|
||||
FRESULT f_lseek (
|
||||
FIL* <em>FileObject</em>, // Pointer to the file object structure
|
||||
DWORD <em>Offset</em> // File offset in unit of byte
|
||||
FIL* <em>FileObject</em>, /* Pointer to the file object structure *
|
||||
DWORD <em>Offset</em> /* File offset in unit of byte *
|
||||
);
|
||||
</pre>
|
||||
</div>
|
||||
@@ -25,7 +25,7 @@ FRESULT f_lseek (
|
||||
<h4>Parameters</h4>
|
||||
<dl class="par">
|
||||
<dt>FileObject</dt>
|
||||
<dd>Pointer to the file object structure.</dd>
|
||||
<dd>Pointer to the open file object.</dd>
|
||||
<dt>Offset</dt>
|
||||
<dd>Number of bytes where from start of file</dd>
|
||||
</dl>
|
||||
@@ -39,17 +39,17 @@ FRESULT f_lseek (
|
||||
<dd>The function succeeded.</dd>
|
||||
<dt>FR_RW_ERROR</dt>
|
||||
<dd>Any error occured in low level disk I/O.</dd>
|
||||
<dt>FR_INCORRECT_DISK_CHANGE</dt>
|
||||
<dd>Incorrect disk removal, such as a medium change during any file is opend, has been occured.</dd>
|
||||
<dt>FR_NOT_ENABLED</dt>
|
||||
<dd>FatFs module is not enabled.</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 class="para">
|
||||
<h4>Description</h4>
|
||||
<p>The f_lseek moves the file read/write pointer. The offset can be specified in only origin from top of the file and cannot moved to above end of the file. When an offset above the file size was specified, the read/write pointer moves to end of the file.</p>
|
||||
<p>The f_lseek function moves the file read/write pointer of an open file object. The offset can be specified in only origin from top of the file and cannot moved to above end of the file. When an offset above the file size was specified, the read/write pointer moves to end of the file.</p>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ FRESULT f_lseek (
|
||||
res = f_lseek(&file, file.fptr - 2000);
|
||||
|
||||
// Move to end of the file
|
||||
res = f_lseek(&file, 0xFFFFFFFF);
|
||||
res = f_lseek(&file, file.fsize);
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
|
||||
+7
-7
@@ -12,10 +12,10 @@
|
||||
|
||||
<div class="para">
|
||||
<h2>f_mkdir</h2>
|
||||
<p>The f_mkdir creates a directory.</p>
|
||||
<p>The f_mkdir function creates a new directory.</p>
|
||||
<pre>
|
||||
FRESULT f_mkdir (
|
||||
const char* <em>DirName</em> // Pointer to the directory name
|
||||
const char* <em>DirName</em> /* Pointer to the directory name */
|
||||
);
|
||||
</pre>
|
||||
</div>
|
||||
@@ -24,7 +24,7 @@ FRESULT f_mkdir (
|
||||
<h4>Parameter</h4>
|
||||
<dl class="par">
|
||||
<dt>DirName</dt>
|
||||
<dd>Pointer to the null-terminated string that specifies the full-path directory name to create. The directory separator is <tt>'/'</tt>. Because the FatFs module does not have a concept of current directory, a full-path name that followed from the root directory must be used. Leading space charactors are skipped if exist and heading <tt>'/'</tt> can be exist or omitted.</dd>
|
||||
<dd>Pointer to the null-terminated string that specifies the <a href="filename.html">directory name</a> to create. </dd>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
@@ -38,6 +38,8 @@ FRESULT f_mkdir (
|
||||
<dd>Could not find the path.</dd>
|
||||
<dt>FR_INVALID_NAME</dt>
|
||||
<dd>The path name is invalid.</dd>
|
||||
<dt>FR_INVALID_DRIVE</dt>
|
||||
<dd>The drive number is invalid.</dd>
|
||||
<dt>FR_DENIED</dt>
|
||||
<dd>The function was denied due to any of following reasons: any file or directory that has same name is existing, cannot be created due to directory table or disk is full.</dd>
|
||||
<dt>FR_NOT_READY</dt>
|
||||
@@ -46,10 +48,8 @@ FRESULT f_mkdir (
|
||||
<dd>The medium is write protected.</dd>
|
||||
<dt>FR_RW_ERROR</dt>
|
||||
<dd>Any error occured in low level disk I/O.</dd>
|
||||
<dt>FR_INCORRECT_DISK_CHANGE</dt>
|
||||
<dd>Incorrect disk removal/change has occured.</dd>
|
||||
<dt>FR_NOT_ENABLED</dt>
|
||||
<dd>FatFs module is not enabled.</dd>
|
||||
<dd>The logical drive has no work area.</dd>
|
||||
<dt>FR_NO_FILESYSTEM</dt>
|
||||
<dd>There is no valid FAT partition on the disk.</dd>
|
||||
</dl>
|
||||
@@ -58,7 +58,7 @@ FRESULT f_mkdir (
|
||||
|
||||
<div class="para">
|
||||
<h4>Description</h4>
|
||||
<p>The f_mkdir creates an empty directory. This function is not supported in read-only configuration and minimization level of >= 1.</p>
|
||||
<p>The f_mkdir function creates a new directory. This function is not supported in read-only configuration and minimization level of >= 1.</p>
|
||||
<p>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
@@ -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="stylesheet" href="../css_e.css" type="text/css" media="screen" title="ELM Default">
|
||||
<title>FatFs - f_mkfs</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div class="para">
|
||||
<h2>f_mkfs</h2>
|
||||
<p>The f_mkfs fucntion creates a file system on the drive.</p>
|
||||
<pre>
|
||||
FRESULT f_mkfs (
|
||||
BYTE <em>Drive</em>, /* Logical drive number */
|
||||
BYTE <em>PartitioningRule</em>, /* Partitioning rule */
|
||||
BYTE <em>AllocSize</em> /* Allocation unit size */
|
||||
);
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<div class="para">
|
||||
<h4>Parameters</h4>
|
||||
<dl class="par">
|
||||
<dt>Drive</dt>
|
||||
<dd>Logical drive number (0-9) to be formatted.</dd>
|
||||
<dt>PartitioningRule</dt>
|
||||
<dd>When 0 is given, a partition table is created into first sector on the drive and then the file system is created on the partition. This is called FDISK format. When 1 is given, the file system starts from the first sector without partition table. This is often called super floppy (SFD) format.</dd>
|
||||
<dt>AllocSize</dt>
|
||||
<dd>Specifies allocation unit size (number of sectors per cluster). The value must be power of 2 in range of from 1 to 64.</dd>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
<div class="para">
|
||||
<h4>Return Values</h4>
|
||||
<dl class="ret">
|
||||
<dt>FR_OK (0)</dt>
|
||||
<dd>The function succeeded.</dd>
|
||||
<dt>FR_INVALID_DRIVE</dt>
|
||||
<dd>The drive number is invalid.</dd>
|
||||
<dt>FR_NOT_READY</dt>
|
||||
<dd>The drive cannot work due to any reason.</dd>
|
||||
<dt>FR_WRITE_PROTECTED</dt>
|
||||
<dd>The drive is write protected.</dd>
|
||||
<dt>FR_RW_ERROR</dt>
|
||||
<dd>The function failed due to a write error in the low level disk I/O.</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 becomes around 0xFF7 and 0xFFF7.</li>
|
||||
</ul>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
<div class="para">
|
||||
<h4>Description</h4>
|
||||
<p>The f_mkfs function creates a FAT file system on the drive. There are two partitioning rules, FDISK and SFD, for removable media. It can be selected with a parameter and FDISK format is recommended for most case. The FAT type, FAT12/FAT16/FAT32, is determined by only how many clusters on the drive and nothing else, according to FAT specification. Thus which FAT type is selected, is depends on the drive size and specified cluster size.</p>
|
||||
<p>This function is supported on only FatFs with _USE_MKFS option.<p>
|
||||
</div>
|
||||
|
||||
|
||||
<p class="foot"><a href="../00index_e.html">Return</a></p>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,59 @@
|
||||
<!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="stylesheet" href="../css_e.css" type="text/css" media="screen" title="ELM Default">
|
||||
<title>FatFs - f_mount</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div class="para">
|
||||
<h2>f_mount</h2>
|
||||
<p>The f_mount fucntion registers/unregisters a work area to the FatFs module.</p>
|
||||
<pre>
|
||||
FRESULT f_mount (
|
||||
BYTE <em>Drive</em>, /* Logical drive number */
|
||||
FATFS* <em>FileSystemObject</em> /* Pointer to the work area */
|
||||
);
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<div class="para">
|
||||
<h4>Parameters</h4>
|
||||
<dl class="par">
|
||||
<dt>Drive</dt>
|
||||
<dd>Logical drive number (0-9) to register/unregister the work area. Always 0 for Tiny-FatFs.</dd>
|
||||
<dt>FileSystemObject</dt>
|
||||
<dd>Pointer to the work area (file system object) to be registered.</dd>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
<div class="para">
|
||||
<h4>Return Values</h4>
|
||||
<dl class="ret">
|
||||
<dt>FR_OK (0)</dt>
|
||||
<dd>The function succeeded.</dd>
|
||||
<dt>FR_INVALID_DRIVE</dt>
|
||||
<dd>The drive number is invalid.</dd>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="para">
|
||||
<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 logical drive with this function before using any 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 only initializes the work area and registers its address to the internal table, any access to the disk I/O layer does not occure. Actual mounting process is performed in any other file funcitons when it is needed.<p>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="para">
|
||||
<h4>References</h4>
|
||||
<p><tt><a href="sfatfs.html">FATFS</a></tt></p>
|
||||
</div>
|
||||
|
||||
<p class="foot"><a href="../00index_e.html">Return</a></p>
|
||||
</body>
|
||||
</html>
|
||||
+19
-19
@@ -12,12 +12,12 @@
|
||||
|
||||
<div class="para">
|
||||
<h2>f_open</h2>
|
||||
<p>The f_open function creates or opens the file and initialize a file object structure 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>
|
||||
FRESULT f_open (
|
||||
FIL* <em>FileObject</em>, // Pointer to the file object structure
|
||||
const char* <em>FileName</em>, // Pointer to the file neme
|
||||
BYTE <em>ModeFlags</em> // Mode flags
|
||||
FIL* <em>FileObject</em>, /* Pointer to the blank file object structure */
|
||||
const char* <em>FileName</em>, /* Pointer to the file neme */
|
||||
BYTE <em>ModeFlags</em> /* Mode flags */
|
||||
);
|
||||
</pre>
|
||||
</div>
|
||||
@@ -26,9 +26,9 @@ FRESULT f_open (
|
||||
<h4>Parameters</h4>
|
||||
<dl class="par">
|
||||
<dt>FileObject</dt>
|
||||
<dd>Pointer to the blank file object structure to be initialized. After the f_open() succeeded, the file can be accessed with the file object structure until it is closed.</dd>
|
||||
<dd>Pointer to the file object structure to be created. After the f_open funciton succeeded, the file can be accessed with the file object structure until it is closed.</dd>
|
||||
<dt>FileName</dt>
|
||||
<dd>Pointer to a null-terminated string specifies the full-path file name to create or open. The directory separator is <tt>'/'</tt>. Because the FatFs module does not have a concept of current directory, a full-path name that followed from the root directory must be used. Leading space charactors are skipped if exist, and heading <tt>'/'</tt> can be exist or omitted.</dd>
|
||||
<dd>Pointer to a null-terminated string that specifies the <a href="filename.html">file name</a> to create or open.</dd>
|
||||
<dt>ModeFlags</dt>
|
||||
<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">
|
||||
@@ -48,13 +48,15 @@ FRESULT f_open (
|
||||
<h4>Return Values</h4>
|
||||
<dl class="ret">
|
||||
<dt>FR_OK (0)</dt>
|
||||
<dd>The function succeeded. The <tt><em>FileObject</em></tt> structure is used for subsequent calls to refer to the file. When close the file, use function <tt><a href="close.html">f_close()</a></tt>.</dd>
|
||||
<dd>The function succeeded and the file object is valid.</dd>
|
||||
<dt>FR_NO_FILE</dt>
|
||||
<dd>Could not find the file.</dd>
|
||||
<dt>FR_NO_PATH</dt>
|
||||
<dd>Could not find the path.</dd>
|
||||
<dt>FR_INVALID_NAME</dt>
|
||||
<dd>The file name is invalid.</dd>
|
||||
<dt>FR_INVALID_DRIVE</dt>
|
||||
<dd>The drive number is invalid.</dd>
|
||||
<dt>FR_DENIED</dt>
|
||||
<dd>The required access was denied due to any of following reasons: write mode open of a file that has read-only attribute, file creation under existing a same name directory or read-only file, cannot be created due to the directory table or disk full.</dd>
|
||||
<dt>FR_NOT_READY</dt>
|
||||
@@ -63,10 +65,8 @@ FRESULT f_open (
|
||||
<dd>Write mode open or creation under the medium is write protected.</dd>
|
||||
<dt>FR_RW_ERROR</dt>
|
||||
<dd>Any error occured in low level disk I/O.</dd>
|
||||
<dt>FR_INCORRECT_DISK_CHANGE</dt>
|
||||
<dd>Incorrect disk removal/change has occured.</dd>
|
||||
<dt>FR_NOT_ENABLED</dt>
|
||||
<dd>FatFs module is not enabled.</dd>
|
||||
<dd>The logical drive has no work area.</dd>
|
||||
<dt>FR_NO_FILESYSTEM</dt>
|
||||
<dd>There is no valid FAT partition on the disk.</dd>
|
||||
</dl>
|
||||
@@ -75,7 +75,8 @@ FRESULT f_open (
|
||||
|
||||
<div class="para">
|
||||
<h4>Description</h4>
|
||||
<p>To start FatFs module, prepare a work area (<tt>FATFS</tt> structure), fill it with zero and set its address to the global variable <em>FatFs</em> to give the work area to the FatFs module. All file functions can work after the initialization. <a href="mountdrv.html">f_mountdrv()</a> can also be used instead of the zero filling, however, the physical drive must be ready at that time. To terminate use of the FatFs module, close all files, clear <em>FatFs</em> and then the work area can be discarded.</p>
|
||||
<p>The created file object is used for subsequent calls to refer to the file. When close an open file object, use <a href="close.html">f_close</a> function.</p>
|
||||
<p>Before using any file function, work area (file system object) must be given to each logical drive with <a href="mount.html">f_mount</a> function. All file functions can work after this procedure.</p>
|
||||
<p>Flags <tt>FA_WRITE, FA_CREATE_ALWAYS, FA_OPEN_ALWAYS</tt> are not supported in read-only configuration.</p>
|
||||
</div>
|
||||
|
||||
@@ -85,16 +86,15 @@ FRESULT f_open (
|
||||
<pre>
|
||||
void main ()
|
||||
{
|
||||
FATFS fs; // FatFs work area
|
||||
FIL fsrc, fdst; // file structures
|
||||
FATFS fs; // Work area (file system object) for logical drive
|
||||
FIL fsrc, fdst; // file objects
|
||||
BYTE buffer[4096]; // file copy buffer
|
||||
FRESULT res; // FatFs function common result code
|
||||
WORD br, bw; // File R/W count
|
||||
|
||||
|
||||
// Give a work area to FatFs module (activate FatFs module)
|
||||
FatFs = &fs;
|
||||
memset(&fs, 0, sizeof(FATFS)); // Clear work area. f_mountdrv() can also be used instead.
|
||||
// Register a work area to logical drive 0
|
||||
f_mount(0, &fs);
|
||||
|
||||
// Open source file
|
||||
res = f_open(&fsrc, "srcfile.dat", FA_OPEN_EXISTING | FA_READ);
|
||||
@@ -107,7 +107,7 @@ void main ()
|
||||
// Copy source to destination
|
||||
for (;;) {
|
||||
res = f_read(&fsrc, buffer, sizeof(buffer), &br);
|
||||
if (res || br == 0) break; // error or eof
|
||||
if (res || br == 0) break; // error or eof
|
||||
res = f_write(&fdst, buffer, br, &bw);
|
||||
if (res || bw < br) break; // error or disk full
|
||||
}
|
||||
@@ -116,8 +116,8 @@ void main ()
|
||||
f_close(&fsrc);
|
||||
f_close(&fdst);
|
||||
|
||||
// Deactivate FatFs module
|
||||
FatFs = NULL;
|
||||
// Unregister a work area before discard it
|
||||
f_mount(0, NULL);
|
||||
}
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
+10
-10
@@ -12,11 +12,11 @@
|
||||
|
||||
<div class="para">
|
||||
<h2>f_opendir</h2>
|
||||
<p>The f_opendir opens a directory.</p>
|
||||
<p>The f_opendir function opens a directory.</p>
|
||||
<pre>
|
||||
FRESULT f_opendir (
|
||||
DIR* <em>DirObject</em>, // Pointer to blank directory object structure
|
||||
const char* <em>DirName</em> // Pointer to the directory name
|
||||
DIR* <em>DirObject</em>, /* Pointer to the blank directory object structure */
|
||||
const char* <em>DirName</em> /* Pointer to the directory name */
|
||||
);
|
||||
</pre>
|
||||
</div>
|
||||
@@ -25,9 +25,9 @@ FRESULT f_opendir (
|
||||
<h4>Parameter</h4>
|
||||
<dl class="par">
|
||||
<dt>DirObject</dt>
|
||||
<dd>Pointer to the blank directory object to be initialized</dd>
|
||||
<dd>Pointer to the blank directory object to be created.</dd>
|
||||
<dt>DirName</dt>
|
||||
<dd>Pinter to the null-terminated string that specifies the full-path directory name to be opened. The directory separator is <tt>'/'</tt>. Because the FatFs module does not have a concept of current directory, a full-path name that followed from the root directory must be used. Leading space charactors are skipped if exist and heading <tt>'/'</tt> can be exist or omitted. The target directory name cannot be followed by a <tt>'/'</tt>. When open the root directory, specify <tt>""</tt> or <tt>"/"</tt>.</dd>
|
||||
<dd>Pinter to the null-terminated string that specifies the <a href="filename.html">directory name</a> to be opened.</dd>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
@@ -36,21 +36,21 @@ FRESULT f_opendir (
|
||||
<h4>Return Values</h4>
|
||||
<dl class="ret">
|
||||
<dt>FR_OK (0)</dt>
|
||||
<dd>The function succeeded. The <tt><em>DirObject</em></tt> structure is used for subsequent calls to read the directory entries.</dd>
|
||||
<dd>The function succeeded and the directory object is created. It is used for subsequent calls to read the directory entries.</dd>
|
||||
<dt>FR_NO_FILE</dt>
|
||||
<dd>Could not find the directory.</dd>
|
||||
<dt>FR_NO_PATH</dt>
|
||||
<dd>Could not find the path.</dd>
|
||||
<dt>FR_INVALID_NAME</dt>
|
||||
<dd>The path name is invalid.</dd>
|
||||
<dt>FR_INVALID_DRIVE</dt>
|
||||
<dd>The drive number is invalid.</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_RW_ERROR</dt>
|
||||
<dd>Any error occured in low level disk I/O.</dd>
|
||||
<dt>FR_INCORRECT_DISK_CHANGE</dt>
|
||||
<dd>Incorrect disk removal/change has occured.</dd>
|
||||
<dt>FR_NOT_ENABLED</dt>
|
||||
<dd>FatFs module is not enabled.</dd>
|
||||
<dd>The logical drive has no work area.</dd>
|
||||
<dt>FR_NO_FILESYSTEM</dt>
|
||||
<dd>There is no valid FAT partition on the disk.</dd>
|
||||
</dl>
|
||||
@@ -59,7 +59,7 @@ FRESULT f_opendir (
|
||||
|
||||
<div class="para">
|
||||
<h4>Description</h4>
|
||||
<p>The f_opendir opens a directory and initializes the <tt><em>DirObject</em></tt> structure for subsequent calls. The directory object structure can be discarded at any time. This function is not supported in minimization level 2.</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. This function is not supported in minimization level 2.</p>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
+10
-10
@@ -12,13 +12,13 @@
|
||||
|
||||
<div class="para">
|
||||
<h2>f_read</h2>
|
||||
<p>The f_read reads data from a file.</p>
|
||||
<p>The f_read function reads data from a file.</p>
|
||||
<pre>
|
||||
FRESULT f_read (
|
||||
FIL* <em>FileObject</em>, // Pointer to the file object structure
|
||||
void* <em>Buffer</em>, // Pointer to the buffer to store read data
|
||||
WORD <em>ByteToRead</em>, // Number of bytes to read
|
||||
WORD* <em>ByteRead</em> // Pointer to the variable to return number of bytes read
|
||||
FIL* <em>FileObject</em>, /* Pointer to the file object structure */
|
||||
void* <em>Buffer</em>, /* Pointer to the buffer to store read data */
|
||||
WORD <em>ByteToRead</em>, /* Number of bytes to read */
|
||||
WORD* <em>ByteRead</em> /* Pointer to the variable to return number of bytes read */
|
||||
);
|
||||
</pre>
|
||||
</div>
|
||||
@@ -27,7 +27,7 @@ FRESULT f_read (
|
||||
<h4>Parameters</h4>
|
||||
<dl class="par">
|
||||
<dt>FileObject</dt>
|
||||
<dd>Pointer to the valid file object structure.</dd>
|
||||
<dd>Pointer to the open file object.</dd>
|
||||
<dt>Buffer</dt>
|
||||
<dd>Pointer to the buffer to store read data</dd>
|
||||
<dt>ByteToRead</dt>
|
||||
@@ -46,18 +46,18 @@ FRESULT f_read (
|
||||
<dt>FR_DENIED</dt>
|
||||
<dd>The function denied due to the file has been opened in write only mode.</dd>
|
||||
<dt>FR_RW_ERROR</dt>
|
||||
<dd>Any error occured in low level disk I/O.</dd>
|
||||
<dd>Any error has occured in low level disk I/O.</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_NOT_ENABLED</dt>
|
||||
<dd>FatFs module is not enabled.</dd>
|
||||
<dt>FR_INVALID_OBJECT</dt>
|
||||
<dd>The file object is invalid.</dd>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="para">
|
||||
<h4>Description</h4>
|
||||
<p>The read/write pointer increases in number of bytes read. The <tt>ByteRead</tt> will be less than <tt>ByteToRead</tt> when the read pointer reached to end of the file or any error occured during the read operation.</p>
|
||||
<p>The file pointer in the file object increases in number of bytes read. The <tt>ByteRead</tt> will become less than <tt>ByteToRead</tt> when the read pointer reached to end of the file or any error occured during the read operation.</p>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
+7
-7
@@ -12,11 +12,11 @@
|
||||
|
||||
<div class="para">
|
||||
<h2>f_readdir</h2>
|
||||
<p>The f_readdir reads directory items.</p>
|
||||
<p>The f_readdir function reads directory entries.</p>
|
||||
<pre>
|
||||
FRESULT f_readdir (
|
||||
DIR* <em>DirObject</em>, // Pointer to the directory object strcture
|
||||
FILINFO* <em>FileInfo</em> // Pointer to the blank file information structure
|
||||
DIR* <em>DirObject</em>, /* Pointer to the directory object strcture */
|
||||
FILINFO* <em>FileInfo</em> /* Pointer to the blank file information structure */
|
||||
);
|
||||
</pre>
|
||||
</div>
|
||||
@@ -25,7 +25,7 @@ FRESULT f_readdir (
|
||||
<h4>Parameters</h4>
|
||||
<dl class="par">
|
||||
<dt>DirObject</dt>
|
||||
<dd>Pointer to the valid directory object strcture.</dd>
|
||||
<dd>Pointer to the open directory strcture.</dd>
|
||||
<dt>FileInfo</dt>
|
||||
<dd>Pointer to the file information structure to store the read item.</dd>
|
||||
</dl>
|
||||
@@ -41,15 +41,15 @@ FRESULT f_readdir (
|
||||
<dd>The disk drive cannot work due to no medium in the drive or any other reason.</dd>
|
||||
<dt>FR_RW_ERROR</dt>
|
||||
<dd>Any error occured in low level disk I/O.</dd>
|
||||
<dt>FR_NOT_ENABLED</dt>
|
||||
<dd>FatFs module is not enabled.</dd>
|
||||
<dt>FR_INVALID_OBJECT</dt>
|
||||
<dd>The directory object is invalid.</dd>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="para">
|
||||
<h4>Description</h4>
|
||||
<p>The f_readdir reads directory items in sequence. All items in the directory can be read by calling f_readdir repeatedly. When all items have been read and no item to read, the member <tt>f_name[]</tt> in the file information structure gets a null string. For details of the file informations, refer to the <tt>FILINFO</tt>. This function is not supported in minimization level of 2.</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 items have been read and no item to read, the function returns a null string into <tt>f_name[]</tt> member without any error. For details of the file informations, refer to the <tt>FILINFO</tt>. This function is not supported in minimization level of 2.</p>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
+10
-10
@@ -15,8 +15,8 @@
|
||||
<p>Rename file or directory.</p>
|
||||
<pre>
|
||||
FRESULT f_rename (
|
||||
const char* <em>OldName</em>, // Pointer to old object name
|
||||
const char* <em>NewName</em> // Pointer to new object name
|
||||
const char* <em>OldName</em>, /* Pointer to old file/directory name */
|
||||
const char* <em>NewName</em> /* Pointer to new file/directory name */
|
||||
);
|
||||
</pre>
|
||||
</div>
|
||||
@@ -25,9 +25,9 @@ FRESULT f_rename (
|
||||
<h4>Parameter</h4>
|
||||
<dl class="par">
|
||||
<dt>OldName</dt>
|
||||
<dd>Pointer to a null-terminated string specifies the old object name to be renamed.</dd>
|
||||
<dd>Pointer to a null-terminated string specifies the old <a href="filename.html">file/directory name</a> to be renamed.</dd>
|
||||
<dt>NewName</dt>
|
||||
<dd>Pointer to a null-terminated string specifies the new object name. Existing name cannot be used.</dd>
|
||||
<dd>Pointer to a null-terminated string specifies the new file/directory name without drive number. Existing object nannot be specified.</dd>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
@@ -38,11 +38,13 @@ FRESULT f_rename (
|
||||
<dt>FR_OK (0)</dt>
|
||||
<dd>The function succeeded.</dd>
|
||||
<dt>FR_NO_FILE</dt>
|
||||
<dd>Could not find the file or directory.</dd>
|
||||
<dd>Could not find the file nor directory.</dd>
|
||||
<dt>FR_NO_PATH</dt>
|
||||
<dd>Could not find the path.</dd>
|
||||
<dt>FR_INVALID_NAME</dt>
|
||||
<dd>The file name is invalid.</dd>
|
||||
<dt>FR_INVALID_DRIVE</dt>
|
||||
<dd>The drive number is invalid.</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_DENIED</dt>
|
||||
@@ -51,10 +53,8 @@ FRESULT f_rename (
|
||||
<dd>The medium is write protected.</dd>
|
||||
<dt>FR_RW_ERROR</dt>
|
||||
<dd>Any error occured in low level disk I/O.</dd>
|
||||
<dt>FR_INCORRECT_DISK_CHANGE</dt>
|
||||
<dd>Incorrect disk removal/change has occured.</dd>
|
||||
<dt>FR_NOT_ENABLED</dt>
|
||||
<dd>FatFs module is not enabled.</dd>
|
||||
<dd>The logical drive has no work area.</dd>
|
||||
<dt>FR_NO_FILESYSTEM</dt>
|
||||
<dd>There is no valid FAT partition on the disk.</dd>
|
||||
</dl>
|
||||
@@ -63,8 +63,8 @@ FRESULT f_rename (
|
||||
|
||||
<div class="para">
|
||||
<h4>Description</h4>
|
||||
<p>Rename a file or directory and can move it to other directory. This function is not supported in read-only configuration or minimization level of >= 1.</p>
|
||||
<p>Note: In this revision, moving any directory to other directory collapses the file system.</p>
|
||||
<p>Rename a file or directory and can move it to other directory. Logical drive number is determined by old name, new name must not contain logical drive number. This function is not supported in read-only configuration or minimization level of >= 1.</p>
|
||||
<p>Note: In this revision, moving any directory to other directory collapses the FAT structure on the disk.</p>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
+13
-9
@@ -12,23 +12,27 @@
|
||||
|
||||
<div class="para">
|
||||
<h2>DIR</h2>
|
||||
<p>The <tt>DIR</tt> structure is used for the work area to read a directory.</p>
|
||||
<p>The <tt>DIR</tt> structure is used for the work area to read a directory by f_oepndir and f_readdir functions.</p>
|
||||
<h4>FatFs</h4>
|
||||
<pre>
|
||||
typedef struct _DIR {
|
||||
DWORD sclust; // Directory start cluster
|
||||
DWORD clust; // Current reading cluster
|
||||
DWORD sect; // Current reading sector
|
||||
WORD index; // Current index
|
||||
FATFS* fs; /* Pointer to the owner file system object */
|
||||
DWORD sclust; /* Start cluster */
|
||||
DWORD clust; /* Current cluster */
|
||||
DWORD sect; /* Current sector */
|
||||
WORD index; /* Current index */
|
||||
WORD id; /* Sum of owner file system mount ID */
|
||||
} DIR;
|
||||
</pre>
|
||||
<h4>Tiny-FatFs</h4>
|
||||
<pre>
|
||||
typedef struct _DIR {
|
||||
WORD sclust; // Directory start cluster
|
||||
WORD clust; // Current reading cluster
|
||||
DWORD sect; // Current reading sector
|
||||
WORD index; // Current index
|
||||
FATFS* fs; /* Pointer to the owner file system object */
|
||||
CLUST sclust; /* Start cluster */
|
||||
CLUST clust; /* Current cluster */
|
||||
DWORD sect; /* Current sector */
|
||||
WORD index; /* Current index */
|
||||
WORD id; /* Sum of owner file system mount ID */
|
||||
} DIR;
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
+12
-13
@@ -12,17 +12,16 @@
|
||||
|
||||
<div class="para">
|
||||
<h2>FATFS</h2>
|
||||
<p>The <tt>FATFS</tt> structure holds dynamic work area of the FatFs modlue and it is allocated by an application program. There is no members that can be changed from the application program.</p>
|
||||
<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. There is no member that can be changed from the application program.</p>
|
||||
<h4>FatFs</h4>
|
||||
<pre>
|
||||
typedef struct _FATFS {
|
||||
BYTE fs_type; /* FAT type */
|
||||
BYTE files; /* Number of files currently opend */
|
||||
BYTE fs_type; /* FAT type (0:Not mouted) */
|
||||
BYTE sects_clust; /* Sectors per cluster */
|
||||
BYTE n_fats; /* Number of FAT copies */
|
||||
WORD n_rootdir; /* Number of root directory entry */
|
||||
BYTE winflag; /* win[] dirty flag (1:must be written back) */
|
||||
BYTE pad1;
|
||||
BYTE drive; /* Physical drive number */
|
||||
WORD id; /* File system mount ID */
|
||||
WORD n_rootdir; /* Number of root directory entries */
|
||||
DWORD winsect; /* Current sector appearing in the win[] */
|
||||
DWORD sects_fat; /* Sectors per fat */
|
||||
DWORD max_clust; /* Maximum cluster# + 1 */
|
||||
@@ -30,6 +29,7 @@ typedef struct _FATFS {
|
||||
DWORD dirbase; /* Root directory start sector (cluster# for FAT32) */
|
||||
DWORD database; /* Data start sector */
|
||||
DWORD last_clust; /* Last allocated cluster */
|
||||
BYTE winflag; /* win[] dirty flag (1:must be written back) */
|
||||
BYTE win[512]; /* Disk access window for Directory/FAT */
|
||||
} FATFS;
|
||||
</pre>
|
||||
@@ -37,20 +37,19 @@ typedef struct _FATFS {
|
||||
<h4>Tiny-FatFs</h4>
|
||||
<pre>
|
||||
typedef struct _FATFS {
|
||||
BYTE fs_type; /* FAT type */
|
||||
BYTE files; /* Number of files currently opend */
|
||||
BYTE fs_type; /* FAT type (0:Not mouted) */
|
||||
BYTE sects_clust; /* Sectors per cluster */
|
||||
BYTE n_fats; /* Number of FAT copies */
|
||||
WORD n_rootdir; /* Number of root directory entry */
|
||||
BYTE winflag; /* win[] dirty flag (1:must be written back) */
|
||||
BYTE pad1;
|
||||
WORD id; /* File system mount ID */
|
||||
WORD n_rootdir; /* Number of root directory entries */
|
||||
DWORD winsect; /* Current sector appearing in the win[] */
|
||||
WORD sects_fat; /* Sectors per fat */
|
||||
WORD max_clust; /* Maximum cluster# + 1 */
|
||||
DWORD fatbase; /* FAT start sector */
|
||||
DWORD dirbase; /* Root directory start sector */
|
||||
DWORD database; /* Data start sector */
|
||||
WORD last_clust; /* Last allocated cluster */
|
||||
CLUST sects_fat; /* Sectors per fat */
|
||||
CLUST max_clust; /* Maximum cluster# + 1 */
|
||||
CLUST last_clust; /* Last allocated cluster */
|
||||
BYTE win[512]; /* Disk access window for Directory/FAT/File */
|
||||
} FATFS;
|
||||
</pre>
|
||||
|
||||
+24
-20
@@ -12,36 +12,40 @@
|
||||
|
||||
<div class="para">
|
||||
<h2>FIL</h2>
|
||||
<p>The FIL structure holds state of a file and it is allocated by an application program. There is no member that can be changed by the application program.</p>
|
||||
<p>The FIL structure (file object) holds state of a file. It is created by f_open function and discarded by f_close function. There is no member that can be changed by the application program.</p>
|
||||
|
||||
<h4>FatFs</h4>
|
||||
<pre>
|
||||
typedef struct _FIL {
|
||||
DWORD fptr; // File R/W pointer
|
||||
DWORD fsize; // File size
|
||||
DWORD org_clust; // File start cluster
|
||||
DWORD curr_clust; // Current cluster
|
||||
DWORD curr_sect; // Current sector
|
||||
DWORD dir_sect; // Sector# containing the directory entry
|
||||
BYTE* dir_ptr; // Ponter to the directory entry in the window
|
||||
BYTE flag; // File status flags
|
||||
BYTE sect_clust; // Left sectors in current cluster
|
||||
BYTE buffer[512]; // File R/W buffer
|
||||
FATFS* fs; /* Pointer to the owner file system object */
|
||||
DWORD fptr; /* File R/W pointer */
|
||||
DWORD fsize; /* File size */
|
||||
DWORD org_clust; /* File start cluster */
|
||||
DWORD curr_clust; /* Current cluster */
|
||||
DWORD curr_sect; /* Current sector */
|
||||
DWORD dir_sect; /* Sector containing the directory entry */
|
||||
BYTE* dir_ptr; /* Ponter to the directory entry in the window */
|
||||
WORD id; /* Sum of owner file system mount ID */
|
||||
BYTE flag; /* File status flags */
|
||||
BYTE sect_clust; /* Left sectors in cluster */
|
||||
BYTE buffer[512]; /* File R/W buffer */
|
||||
} FIL;
|
||||
</pre>
|
||||
|
||||
<h4>Tiny-FatFs</h4>
|
||||
<pre>
|
||||
typedef struct _FIL {
|
||||
DWORD fptr; // File R/W pointer
|
||||
DWORD fsize; // File size
|
||||
WORD org_clust; // File start cluster
|
||||
WORD curr_clust; // Current cluster
|
||||
DWORD curr_sect; // Current sector
|
||||
DWORD dir_sect; // Sector# containing the directory entry
|
||||
BYTE* dir_ptr; // Ponter to the directory entry in the window
|
||||
BYTE flag; // File status flags
|
||||
BYTE sect_clust; // Left sectors in current cluster
|
||||
FATFS* fs; /* Pointer to owner file system */
|
||||
DWORD fptr; /* File R/W pointer */
|
||||
DWORD fsize; /* File size */
|
||||
CLUST org_clust; /* File start cluster */
|
||||
CLUST curr_clust; /* Current cluster */
|
||||
DWORD curr_sect; /* Current sector */
|
||||
DWORD dir_sect; /* Sector containing the directory entry */
|
||||
BYTE* dir_ptr; /* Ponter to the directory entry in the window */
|
||||
WORD id; /* Sum of owner file system mount ID */
|
||||
BYTE flag; /* File status flags */
|
||||
BYTE sect_clust; /* Left sectors in cluster */
|
||||
} FIL;
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
+7
-7
@@ -15,8 +15,8 @@
|
||||
<p>The f_stat gets the file status.</p>
|
||||
<pre>
|
||||
FRESULT f_stat (
|
||||
const char* <em>FileName</em>, // Pointer to the file or directory name
|
||||
FILINFO* <em>FileInfo</em> // Pointer to the FILINFO structure
|
||||
const char* <em>FileName</em>, /* Pointer to the file or directory name */
|
||||
FILINFO* <em>FileInfo</em> /* Pointer to the FILINFO structure */
|
||||
);
|
||||
</pre>
|
||||
</div>
|
||||
@@ -25,9 +25,9 @@ FRESULT f_stat (
|
||||
<h4>Parameters</h4>
|
||||
<dl class="par">
|
||||
<dt>FileName</dt>
|
||||
<dd>Pointer to the null-terminated string that specifies the file or directory name to get the information. Do not specify root directory.</dd>
|
||||
<dd>Pointer to the null-terminated string that specifies the <a href="filename.html">file or directory</a> to get its information. Do not specify root directory.</dd>
|
||||
<dt>FileInfo</dt>
|
||||
<dd>Pointer to the <tt>FILINFO</tt> structure to store the information.</dd>
|
||||
<dd>Pointer to the blank <tt>FILINFO</tt> structure to store the information.</dd>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
@@ -43,14 +43,14 @@ FRESULT f_stat (
|
||||
<dd>Could not find the path.</dd>
|
||||
<dt>FR_INVALID_NAME</dt>
|
||||
<dd>The file name is invalid.</dd>
|
||||
<dt>FR_INVALID_DRIVE</dt>
|
||||
<dd>The drive number is invalid.</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_RW_ERROR</dt>
|
||||
<dd>Any error occured in low level disk I/O.</dd>
|
||||
<dt>FR_INCORRECT_DISK_CHANGE</dt>
|
||||
<dd>Incorrect disk removal/change has occured.</dd>
|
||||
<dt>FR_NOT_ENABLED</dt>
|
||||
<dd>FatFs module is not enabled.</dd>
|
||||
<dd>The logical drive has no work area.</dd>
|
||||
<dt>FR_NO_FILESYSTEM</dt>
|
||||
<dd>There is no valid FAT partition on the disk.</dd>
|
||||
</dl>
|
||||
|
||||
+9
-9
@@ -12,10 +12,10 @@
|
||||
|
||||
<div class="para">
|
||||
<h2>f_sync</h2>
|
||||
<p>The f_sync flushes the cached information of the wriiting file.</p>
|
||||
<p>The f_sync function flushes the cached information of a wriiting file.</p>
|
||||
<pre>
|
||||
FRESULT f_sync (
|
||||
FIL* <em>FileObject</em> // Pointer to the file object structure
|
||||
FIL* <em>FileObject</em> /* Pointer to the file object */
|
||||
);
|
||||
</pre>
|
||||
</div>
|
||||
@@ -24,7 +24,7 @@ FRESULT f_sync (
|
||||
<h4>Parameters</h4>
|
||||
<dl class="par">
|
||||
<dt>FileObject</dt>
|
||||
<dd>Pointer to the file object to be flushed.</dd>
|
||||
<dd>Pointer to the open file object to be flushed.</dd>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
@@ -35,18 +35,18 @@ FRESULT f_sync (
|
||||
<dt>FR_OK (0)</dt>
|
||||
<dd>The function succeeded.</dd>
|
||||
<dt>FR_RW_ERROR</dt>
|
||||
<dd>Any error occured in low level disk I/O.</dd>
|
||||
<dt>FR_INCORRECT_DISK_CHANGE</dt>
|
||||
<dd>Incorrect disk removal/change has been occured.</dd>
|
||||
<dt>FR_NOT_ENABLED</dt>
|
||||
<dd>FatFs module is not enabled.</dd>
|
||||
<dd>Any error has occured in low level disk I/O.</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 class="para">
|
||||
<h4>Description</h4>
|
||||
<p>The function f_sync() performs the same process as f_close() but the file is left opened and can continue file read/write operations to the file. This is suitable for applications that open files for a long time in writing mode, such as data logger. Performing f_sync() of periodic or immediataly after f_write() can minimize risk of data loss due to sudden blackout or unintentional disk removal. This function is not supported in read-only configuration.</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 applications that open files for a long time in writing mode, such as data logger. Performing f_sync of periodic or immediataly after f_write can minimize risk of data loss due to sudden blackout or unintentional disk removal. This function is not supported in read-only configuration.</p>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
+6
-6
@@ -15,7 +15,7 @@
|
||||
<p>The f_unlink removes file or directory.</p>
|
||||
<pre>
|
||||
FRESULT f_unlink (
|
||||
const char* <em>FileName</em> // Pointer to the file or directory name
|
||||
const char* <em>FileName</em> /* Pointer to the file or directory name */
|
||||
);
|
||||
</pre>
|
||||
</div>
|
||||
@@ -24,7 +24,7 @@ FRESULT f_unlink (
|
||||
<h4>Parameters</h4>
|
||||
<dl class="par">
|
||||
<dt>FileName</dt>
|
||||
<dd>Pointer to the null-terminated string that specifies the full path name of a file or directory to be removed. In read-only and minimum configuration, this function is not supported.</dd>
|
||||
<dd>Pointer to the null-terminated string that specifies a <a href="filename.html">file or directory</a> to be removed.</dd>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
@@ -40,6 +40,8 @@ FRESULT f_unlink (
|
||||
<dd>Could not find the path.</dd>
|
||||
<dt>FR_INVALID_NAME</dt>
|
||||
<dd>The path name is invalid.</dd>
|
||||
<dt>FR_INVALID_DRIVE</dt>
|
||||
<dd>The drive number is invalid.</dd>
|
||||
<dt>FR_DENIED</dt>
|
||||
<dd>The function was denied due to either of following reasons: the file or directory has read-only attribute, the directory is not empty.</dd>
|
||||
<dt>FR_NOT_READY</dt>
|
||||
@@ -48,10 +50,8 @@ FRESULT f_unlink (
|
||||
<dd>The medium is write protected.</dd>
|
||||
<dt>FR_RW_ERROR</dt>
|
||||
<dd>Any error occured in low level disk I/O.</dd>
|
||||
<dt>FR_INCORRECT_DISK_CHANGE</dt>
|
||||
<dd>Incorrect disk removal/change has occured.</dd>
|
||||
<dt>FR_NOT_ENABLED</dt>
|
||||
<dd>FatFs module is not enabled.</dd>
|
||||
<dd>The logical drive has no work area.</dd>
|
||||
<dt>FR_NO_FILESYSTEM</dt>
|
||||
<dd>There is no valid FAT partition on the disk.</dd>
|
||||
</dl>
|
||||
@@ -60,7 +60,7 @@ FRESULT f_unlink (
|
||||
|
||||
<div class="para">
|
||||
<h4>Description</h4>
|
||||
<p>The f_unlink removes file or directory. This function is not supported in minimization level of >= 1.</p>
|
||||
<p>The f_unlink function removes a file or directory. In read-only configuration or minimization level is >= 1, this function is not supported.</p>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
+9
-9
@@ -15,10 +15,10 @@
|
||||
<p>The f_write writes data to a file.</p>
|
||||
<pre>
|
||||
FRESULT f_write (
|
||||
FIL* <em>FileObject</em>, // Pointer to the file object structure
|
||||
const void* <em>Buffer</em>, // Pointer to the data to be written
|
||||
WORD <em>ByteToWrite</em>, // Number of bytes to write
|
||||
WORD* <em>ByteWritten</em> // Pointer to the variable to return number of bytes written
|
||||
FIL* <em>FileObject</em>, /* Pointer to the file object structure */
|
||||
const void* <em>Buffer</em>, /* Pointer to the data to be written */
|
||||
WORD <em>ByteToWrite</em>, /* Number of bytes to write */
|
||||
WORD* <em>ByteWritten</em> /* Pointer to the variable to return number of bytes written */
|
||||
);
|
||||
</pre>
|
||||
</div>
|
||||
@@ -27,7 +27,7 @@ FRESULT f_write (
|
||||
<h4>Parameter</h4>
|
||||
<dl class="par">
|
||||
<dt>FileObject</dt>
|
||||
<dd>Pointer to the valid file object structure.</dd>
|
||||
<dd>Pointer to the open file object structure.</dd>
|
||||
<dt>Buffer</dt>
|
||||
<dd>Pointer to the data to be written.</dd>
|
||||
<dt>ByteToWrite</dt>
|
||||
@@ -46,18 +46,18 @@ FRESULT f_write (
|
||||
<dt>FR_DENIED</dt>
|
||||
<dd>The function denied due to the file has been opened in read only mode.</dd>
|
||||
<dt>FR_RW_ERROR</dt>
|
||||
<dd>Any error occured in low level disk I/O.</dd>
|
||||
<dd>Any error has occured in low level disk I/O layer.</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_NOT_ENABLED</dt>
|
||||
<dd>FatFs module is not enabled.</dd>
|
||||
<dt>FR_INVALID_OBJECT</dt>
|
||||
<dd>The file object is invalid.</dd>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="para">
|
||||
<h4>Description</h4>
|
||||
<p>The read/write pointer increases in number of bytes written. The <tt>ByteWritten</tt> will be less than <tt>ByteToWrite</tt> when disk gets full during write function. This function is not supported in read-only configuration.</p>
|
||||
<p>The read/write pointer in the file object is increased in number of bytes written. The <tt>ByteWritten</tt> will become less than <tt>ByteToWrite</tt> when disk gets full during write function. This function is not supported in read-only configuration.</p>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user