<p>FatFs is a generic FAT file system module for small embedded systems. The FatFs is written in compliance with ANSI C and completely separated from the disk I/O layer. Therefore it is independent of hardware architecture. It can be incorporated into low cost microcontrollers, such as AVR, 8051, PIC, ARM, Z80, 68k and etc..., without any change. Petit FatFs module is also available <ahref="http://elm-chan.org/fsw/ff/00index_p.html">here</a>.</p>
<h4>Features</h4>
<ul>
<li>Windows compatible FAT file system.</li>
<li>Platform independent. Easy to port.</li>
<li>Very small footprint for code and work area.</li>
<li>Various configuration options:
<ul>
<li>Multiple volumes (physical drives and partitions).</li>
<li>Multiple ANSI/OEM code pages including DBCS.</li>
<li>Long file name support in ANSI/OEM or Unicode.</li>
<li>RTOS support.</li>
<li>Multiple sector size support.</li>
<li>Read-only, minimized API, I/O buffer and etc...</li>
</ul>
</li>
</ul>
</div>
<divclass="para">
<h3>Application Interface</h3>
<p>FatFs module provides following functions to the applications. In other words, this list describes what FatFs can do to access the FAT volumes.</p>
<ul>
<li><ahref="en/open.html">f_open</a> - Open/Create a file</li>
<li><ahref="en/close.html">f_close</a> - Close an open file</li>
<li><ahref="en/rename.html">f_rename</a> - Rename/Move a file or sub-directory</li>
<li><ahref="en/chdir.html">f_chdir</a> - Change current directory</li>
<li><ahref="en/chdrive.html">f_chdrive</a> - Change current drive</li>
<li><ahref="en/getcwd.html">f_getcwd</a> - Retrieve the current directory</li>
<li><ahref="en/getfree.html">f_getfree</a> - Get free clusters</li>
<li><ahref="en/getlabel.html">f_getlabel</a> - Get volume label</li>
<li><ahref="en/setlabel.html">f_setlabel</a> - Set volume label</li>
<li><ahref="en/mount.html">f_mount</a> - Register/Unregister a work area</li>
<li><ahref="en/mkfs.html">f_mkfs</a> - Create a file system on the drive</li>
<li><ahref="en/fdisk.html">f_fdisk</a> - Divide a physical drive</li>
<li><ahref="en/gets.html">f_gets</a> - Read a string</li>
<li><ahref="en/putc.html">f_putc</a> - Write a character</li>
<li><ahref="en/puts.html">f_puts</a> - Write a string</li>
<li><ahref="en/printf.html">f_printf</a> - Write a formatted string</li>
<li><ahref="en/tell.html">f_tell</a> - Get current read/write pointer</li>
<li><ahref="en/eof.html">f_eof</a> - Test for end-of-file on a file</li>
<li><ahref="en/size.html">f_size</a> - Get size of a file</li>
<li><ahref="en/error.html">f_error</a> - Test for an error on a file</li>
</ul>
</div>
<divclass="para">
<h3>Disk I/O Interface</h3>
<p>Since the FatFs module is completely separated from disk I/O layer, it requires following functions to access the physical media. When O/S related feature is enabled, it will require process/memory functions in addition. However the low level disk I/O module is not a part of FatFs module, so that it must be provided by user. The sample implementations are also available in the downloads.</p>
<ul>
<li><ahref="en/dinit.html">disk_initialize</a> - Initialize disk drive</li>
<li><ahref="en/dstat.html">disk_status</a> - Get disk status</li>
<li><ahref="en/dioctl.html">disk_ioctl</a> - Control device dependent features</li>
<li><ahref="en/fattime.html">get_fattime</a> - Get current time</li>
</ul>
</div>
<divclass="para">
<h3>Resources</h3>
<p>The FatFs module is a free software opened for education, research and development. You can use, modify and/or redistribute it for personal projects or commercial products without any restriction under your responsibility. For further information, refer to the application note.</p>
<ul>
<li><ahref="http://elm-chan.org/fsw/ff/bd/"><em>FatFs User Forum</em></a></li>
<li><ahref="http://nemuisan.blog.bai.ne.jp/">Nemuisan's Blog</a> (Well written implementations for STM32F/SDIO and LPC2300/MCI)</li>
<li><ahref="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><ahref="http://www.microsoft.com/whdc/system/platform/firmware/fatgen.mspx">FAT32 Specification by Microsoft</a> (The reference document on FAT file system)</li>
<li><ahref="http://elm-chan.org/docs/fat.html">The basics of FAT file system [ja]</a></li>
<li><ahref="http://elm-chan.org/docs/mmc/mmc_e.html">How to Use MMC/SDC</a></li>
<li><ahref="img/rwtest.png">Benchmark 1</a> (ATmega64/9.2MHz with MMC via SPI, HDD/CFC via GPIO)</li>
<li><ahref="img/rwtest2.png">Benchmark 2</a> (LPC2368/72MHz with MMC via MCI)</li>
<li><ahref="http://members.jcom.home.ne.jp/felm/fd.mp4">Demo movie of an application</a> (this project is in ffsample.zip/lpc23xx)</li>
<li><ahref="http://nemuisan.blog.bai.ne.jp/">ねむいさんのぶろぐ</a> (Well written implementations for STM32F/SDIO and LPC2300/MCI)</li>
<li><ahref="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><ahref="http://www.microsoft.com/whdc/system/platform/firmware/fatgen.mspx">FATファイル・システム仕様書 by Microsoft</a> (The reference document on FAT file system)</li>
<p>The f_chdir function changes the current directory of a drive.</p>
<pre>
FRESULT f_chdir (
const TCHAR* <spanclass="arg">path</span><spanclass="c">/* [IN] Path name */</span>
);
</pre>
</div>
<divclass="para arg">
<h4>Parameters</h4>
<dlclass="par">
<dt>path</dt>
<dd>Pointer to the null-terminated string that specifies a <ahref="filename.html">directory</a> to go.</dd>
</dl>
</div>
<divclass="para ret">
<h4>Return Values</h4>
<p>
<ahref="rc.html#ok">FR_OK</a>,
<ahref="rc.html#de">FR_DISK_ERR</a>,
<ahref="rc.html#ie">FR_INT_ERR</a>,
<ahref="rc.html#nr">FR_NOT_READY</a>,
<ahref="rc.html#np">FR_NO_PATH</a>,
<ahref="rc.html#in">FR_INVALID_NAME</a>,
<ahref="rc.html#id">FR_INVALID_DRIVE</a>,
<ahref="rc.html#ne">FR_NOT_ENABLED</a>,
<ahref="rc.html#ns">FR_NO_FILESYSTEM</a>,
<ahref="rc.html#tm">FR_TIMEOUT</a>,
<ahref="rc.html#nc">FR_NOT_ENOUGH_CORE</a>
</p>
</div>
<divclass="para desc">
<h4>Description</h4>
<p>The <tt>f_chdir()</tt> 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 volume.</p>