From 7b78a5a287827db9e9b16286f3604aef69b37c5c Mon Sep 17 00:00:00 2001 From: Leo C Date: Mon, 17 Nov 2014 14:47:05 +0100 Subject: Import fatfs R0.10c --- fatfs/doc/00index_e.html | 19 ++++---- fatfs/doc/00index_j.html | 78 ++++++++++++++++--------------- fatfs/doc/en/appnote.html | 18 ++++---- fatfs/doc/en/dinit.html | 6 +-- fatfs/doc/en/dioctl.html | 19 +++++--- fatfs/doc/en/dread.html | 9 ++-- fatfs/doc/en/dstat.html | 10 ++-- fatfs/doc/en/dwrite.html | 4 +- fatfs/doc/en/eof.html | 2 +- fatfs/doc/en/error.html | 2 +- fatfs/doc/en/filename.html | 14 +++--- fatfs/doc/en/getcwd.html | 2 +- fatfs/doc/en/mkfs.html | 48 ++++++++++++++++--- fatfs/doc/en/mount.html | 2 +- fatfs/doc/en/rc.html | 6 +-- fatfs/doc/en/readdir.html | 4 +- fatfs/doc/en/sfile.html | 2 +- fatfs/doc/en/sfileinfo.html | 4 +- fatfs/doc/en/stat.html | 40 ++++++++++++++++ fatfs/doc/img/app3.c | 2 +- fatfs/doc/img/mkfatimg.zip | Bin 0 -> 686662 bytes fatfs/doc/ja/appnote.html | 110 ++++++++++++++++++++++---------------------- fatfs/doc/ja/chdir.html | 30 ++++++------ fatfs/doc/ja/chdrive.html | 22 ++++----- fatfs/doc/ja/chmod.html | 40 ++++++++-------- fatfs/doc/ja/close.html | 26 +++++------ fatfs/doc/ja/closedir.html | 26 +++++------ fatfs/doc/ja/dinit.html | 22 ++++----- fatfs/doc/ja/dioctl.html | 86 +++++++++++++++++----------------- fatfs/doc/ja/dread.html | 47 ++++++++++--------- fatfs/doc/ja/dstat.html | 22 ++++----- fatfs/doc/ja/dwrite.html | 50 ++++++++++---------- fatfs/doc/ja/eof.html | 28 +++++------ fatfs/doc/ja/error.html | 28 +++++------ fatfs/doc/ja/fattime.html | 30 ++++++------ fatfs/doc/ja/fdisk.html | 48 +++++++++---------- fatfs/doc/ja/filename.html | 34 +++++++------- fatfs/doc/ja/forward.html | 72 ++++++++++++++--------------- fatfs/doc/ja/getcwd.html | 28 +++++------ fatfs/doc/ja/getfree.html | 40 ++++++++-------- fatfs/doc/ja/getlabel.html | 34 +++++++------- fatfs/doc/ja/gets.html | 36 +++++++-------- fatfs/doc/ja/lseek.html | 76 +++++++++++++++--------------- fatfs/doc/ja/mkdir.html | 24 +++++----- fatfs/doc/ja/mkfs.html | 80 +++++++++++++++++++++++--------- fatfs/doc/ja/mount.html | 50 ++++++++++---------- fatfs/doc/ja/open.html | 96 +++++++++++++++++++------------------- fatfs/doc/ja/opendir.html | 28 +++++------ fatfs/doc/ja/printf.html | 44 +++++++++--------- fatfs/doc/ja/putc.html | 32 ++++++------- fatfs/doc/ja/puts.html | 32 ++++++------- fatfs/doc/ja/rc.html | 18 ++++---- fatfs/doc/ja/read.html | 36 +++++++-------- fatfs/doc/ja/readdir.html | 60 ++++++++++++------------ fatfs/doc/ja/rename.html | 32 ++++++------- fatfs/doc/ja/sdir.html | 28 +++++------ fatfs/doc/ja/setlabel.html | 38 +++++++-------- fatfs/doc/ja/sfatfs.html | 48 +++++++++---------- fatfs/doc/ja/sfile.html | 34 +++++++------- fatfs/doc/ja/sfileinfo.html | 48 +++++++++---------- fatfs/doc/ja/size.html | 26 +++++------ fatfs/doc/ja/stat.html | 67 +++++++++++++++++++++------ fatfs/doc/ja/sync.html | 26 +++++------ fatfs/doc/ja/tell.html | 26 +++++------ fatfs/doc/ja/truncate.html | 22 ++++----- fatfs/doc/ja/unlink.html | 28 +++++------ fatfs/doc/ja/utime.html | 32 ++++++------- fatfs/doc/ja/write.html | 36 +++++++-------- fatfs/doc/updates.txt | 6 +++ 69 files changed, 1198 insertions(+), 1025 deletions(-) create mode 100644 fatfs/doc/img/mkfatimg.zip (limited to 'fatfs/doc') diff --git a/fatfs/doc/00index_e.html b/fatfs/doc/00index_e.html index aa249b1..9dc9d8e 100644 --- a/fatfs/doc/00index_e.html +++ b/fatfs/doc/00index_e.html @@ -4,7 +4,10 @@ - + + + +
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 small microcontrollers with limited resource, such as AVR, 8051, PIC, ARM, Z80, 68k and etc. Also Petit FatFs module for tiny microcontrollers is available here.
+FatFs is a generic FAT file system module for small embedded systems. The FatFs module is written in compliance with ANSI C (C89) and completely separated from the disk I/O layer. Therefore it is independent of the platform. It can be incorporated into small microcontrollers with limited resource, such as 8051, PIC, AVR, ARM, Z80, 78K and etc. Also Petit FatFs module for tiny microcontrollers is available here↗.
Since the FatFs module is a file system driver, it is completely separated from physical devices, such as memory card, harddisk and any type of storage devices. The low level device control module is not a part of FatFs module. FatFs accesses the storage device via a simple interface described below. These functions are provided by implementer. Sample implementations for some platforms are also available in the downloads.
+Since the FatFs module is a file system layer, it is completely separated from physical devices, such as memory card, harddisk and any type of storage devices. FatFs accesses the storage device via a simple interface described below. The low level device control module is not a part of FatFs module. It is provided by implementer. Also sample implementations for some platforms are available in the downloads.
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.
FatFsは小規模な組み込みシステム向けの汎用FATファイルシステム・モジュールです。ANSI C準拠でハードウェア・アーキテクチャには依存しないので、必要なワーク・エリアが確保できれば、8051, PIC, AVR, SH, Z80, 68k, H8, ARMなど安価なマイコンでも使用可能です。FatFsをシュリンクしたぷちFatFs↗もあります。
+FatFsは小規模な組み込みシステム向けの汎用FATファイルシステム モジュールです。ANSI C(C89)準拠でハードウェア アーキテクチャには依存しないので、必要なワーク エリアが確保できれば、8051, PIC, AVR, SH, Z80, 68k, H8, ARMなど安価なマイコンでも使用可能です。このほか、FatFsを極小マイコン向けにシュリンクしたぷちFatFs↗ もあります。
FatFsモジュールは、アプリケーション・レイヤに対し、次のファイル操作関数(API)を提供します。つまり、このリストはFatFsにできることをシンプルに示しています。
+FatFsモジュールは、アプリケーション レイヤに対し、次のファイル操作関数(API)を提供します。つまり、このリストはFatFsにできることをシンプルに示しています。
FatFsモジュールは、単なるファイル・システム・レイヤなので、ストレージ・デバイス制御レイヤは含まれません。使用するストレージに対応した制御関数は、ユーザによって提供される必要があります。FatFsモジュールは、下位レイヤに対し少なくとも次のインターフェースを要求します。OS関連機能を有効にしたときは、これに加えてプロセス/メモリ関連関数も必要になります。サンプル・プロジェクトに下位レイヤの実装例を示します。
+FatFsモジュールは、単なるファイル システム レイヤなので、ストレージ デバイス制御レイヤは含まれません。使用するプラットフォームやストレージ デバイスに対応した制御関数は、ユーザによって提供される必要があります。FatFsモジュールは、下位レイヤに対し標準的には次のインターフェースを要求します。拡張機能、たとえばOS関連機能を有効にしたときは、加えてプロセス/メモリ操作関数なども必要になります。サンプル プロジェクトに下位レイヤの実装例を示します。
FatFsモジュールはフリー・ソフトウェアとして教育・研究・開発用に公開しています。どのような利用目的(個人利用から商用まで)でも使用・改変・配布について一切の制限はありませんが、全て利用者の責任の下での利用とします。詳しくはアプリケーション・ノートを参照してください。
+FatFsモジュールはフリー ソフトウェアとして教育・研究・開発用に公開しています。どのような利用目的(個人利用から商用まで)でも使用・改変・配布について一切の制限はありませんが、全て利用者の責任の下での利用とします。詳しくはアプリケーション ノートを参照してください。
FatFs module supports LFN (long file name). The two different file names, SFN (short file name) and LFN, of a file is transparent on the API except for f_readdir() function. The LFN feature is disabled by default. To enable it, set _USE_LFN to 1, 2 or 3, and add option/unicode.c to the project. The LFN feature requiers a certain working buffer in addition. The buffer size can be configured by _MAX_LFN according to the available memory. The length of an LFN will reach up to 255 characters, so that the _MAX_LFN should be set to 255 for full featured LFN operation. If the size of working buffer is insufficient for the input file name, the file function fails with FR_INVALID_NAME. When enable the LFN feature with re-entrant configuration, _USE_LFN must be set to 2 or 3. In this case, the file function allocates the working buffer on the stack or heap. The working buffer occupies (_MAX_LFN + 1) * 2 bytes.
+FatFs module supports LFN (long file name). The two different file names, SFN (short file name) and LFN, of a file is transparent on the API except for f_readdir() function. The LFN feature is disabled by default. To enable it, set _USE_LFN to 1, 2 or 3, and add option/unicode.c to the project. The LFN feature requiers a certain working buffer in addition. The buffer size can be configured by _MAX_LFN according to the available memory. The length of an LFN will reach up to 255 characters, so that the _MAX_LFN should be set to 255 for full featured LFN operation. If the size of working buffer is insufficient for the input file name, the file function fails with FR_INVALID_NAME. When enable the LFN feature under re-entrant configuration, _USE_LFN must be set to 2 or 3. In this case, the file function allocates the working buffer on the stack or heap. The working buffer occupies (_MAX_LFN + 1) * 2 bytes.
Code page | Program size |
---|---|
SBCS | +3.7K |
932(Shift-JIS) | +62K |
932(Shift_JIS) | +62K |
936(GBK) | +177K |
949(Korean) | +139K |
950(Big5) | +111K |
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. Especially, in the CJK region, tens of thousands of characters are being used. 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 those code pages will not able to be implemented to most 8-bit microcontrollers.
+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. Especially, in the CJK region, tens of thousands of characters are being used. Unfortunately, it requires a huge OEM-Unicode bidirectional conversion table and the module size will be drastically increased as shown in the table. As the result, the FatFs with LFN feature with those code pages will not able to be implemented to most 8-bit microcontrollers.
Note that the LFN feature on the FAT file system is a patent of Microsoft Corporation. This is not the case on FAT32 but most FAT32 drivers come with the LFN feature. FatFs can swich the LFN feature off by configuration option. When enable LFN feature on the commercial products, a license from Microsoft may be required depends on the final destination.
FatFs module does not support the read/write collision control of duplicated open to a file. The duplicated open is permitted only when each of open method to a file is read mode. The duplicated open with one or more write mode to a file is always prohibited, and also open file must not be renamed and deleted. A violation of these rules can cause data colluption.
-The file lock control can also be available by _FS_LOCK option. The value defines the number of open objects 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 FR_LOCKED. If number of open objects, files and sub-directories, gets larger than _FS_LOCK, the f_open(), f_optndir() function will fail with FR_TOO_MANY_OPEN_FILES.
+The file lock control can be enabled by _FS_LOCK option. The value of option defines the number of open objects 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 FR_LOCKED. If number of open objects, files and sub-directories, is equal to _FS_LOCK, an extra f_open(), f_optndir() function will fail with FR_TOO_MANY_OPEN_FILES.
Figure 3. Fully sector aligned read
The file I/O buffer is a sector buffer to read/write a partial data on the sector. The sector buffer is either file private sector buffer on each file object or shared sector buffer in the file system object. The buffer configuration option _FS_TINY determins which sector buffer is used for the file data transfer. When tiny buffer (1) is selected, data memory consumption is reduced 512 bytes each file object. In this case, FatFs module uses only a sector buffer in the file system object for file data transfer and FAT/directory access. The disadvantage of the tiny buffer configuration is: the FAT data cached in the sector buffer will be lost by file data transfer and it must be reloaded at every cluster boundary. However it will be suitable for most application from view point of the decent performance and low memory comsumption.
+The file I/O buffer is a sector buffer to read/write a partial data on the sector. The sector buffer is either file private sector buffer on each file object or shared sector buffer in the file system object. The buffer configuration option _FS_TINY determins which sector buffer is used for the file data transfer. When tiny buffer configuration (1) is selected, data memory consumption is reduced _MAX_SS bytes each file object. In this case, FatFs module uses only a sector buffer in the file system object for file data transfer and FAT/directory access. The disadvantage of the tiny buffer configuration is: the FAT data cached in the sector buffer will be lost by file data transfer and it must be reloaded at every cluster boundary. However it will be suitable for most application from view point of the decent performance and low memory comsumption.
Figure 1 shows that a partial sector, sector misaligned part of the file, is transferred via the file I/O buffer. At long data transfer shown in Figure 2, middle of transfer data that covers one or more sector is transferred to the application buffer directly. Figure 3 shows that the case of entier transfer data is aligned to the sector boundary. In this case, file I/O buffer is not used. On the direct transfer, the maximum extent of sectors are read with disk_read() function at a time but the multiple sector transfer is divided at cluster boundary even if it is contiguous.
Therefore taking effort to sector aligned read/write accesss eliminates buffered data transfer and the read/write performance will be improved. Besides the effect, cached FAT data will not be flushed by file data transfer at the tiny configuration, so that it can achieve same performance as non-tiny configuration with small memory footprint.
The write throughput of the flash memory media becomes the worst at single sector write transaction. The write throughput increases as the number of sectors per a write transaction. This effect more appers at faster interface speed and the performance ratio often becomes grater than ten. This graph is clearly explaining how fast is multiple block write (W:16K, 32 sectors) than single block write (W:100, 1 sector), and also larger card tends to be slow at single block write. The number of write transactions also affects the life time of the flash memory media. Therefore the application program should write the data in large block as possible. The ideal write chunk size and alighment is size of sector, and size of cluster is the best. Of course all layers between the application and the storage device must have consideration on multiple sector write, however most of open-source disk drivers lack it. Do not split a multiple sector write request into single sector write transactions or the write throughput gets poor. Note that FatFs module and its sample disk drivers supprt multiple sector read/write feature.
When remove a file with f_remove() function, the data clusters occupied by the file are marked 'free' on the FAT. But the data sectors containing the file data are not that applied any process, so that the file data left occupies a part of the flash memory array as 'live block'. If the file data is forced erased on removing the file, those data blocks will be turned in to the free block pool. This may skip internal block erase operation to the data block on next write operation. As the result the write performance might be improved. FatFs can manage this feature by setting _USE_ERASE to 1. Note that this is an expectation of internal process of the flash memory storage and not that always effective. Also f_remove() function will take a time when remove a large file. Most applications will not need this feature.
+When remove a file with f_remove() function, the data clusters occupied by the file are marked 'free' on the FAT. But the data sectors containing the file data are not that applied any process, so that the file data left occupies a part of the flash memory array as 'live block'. If the file data is forced erased on removing the file, those data blocks will be turned in to the free block pool. This may skip internal block erase operation to the data block on next write operation. As the result the write performance might be improved. FatFs can manage this feature by setting _USE_TRIM to 1. Note that this is an expectation of internal process of the flash memory storage and not that always effective. Also f_remove() function will take a time when remove a large file. Most applications will not need this feature.
Therefore FatFs license is one of the BSD-style licenses but there is a significant feature. Because FatFs is for embedded projects, the conditions of redistributions in binary form, such as embedded code, hex file, binary library or any forms without source code, are not specified in order to extend usability for commercial products. The documentation of the distributions need not include about FatFs and its license document, and it may also. This is equivalent to the BSD 1-Clause License. Of course FatFs is compatible with the projects under GNU GPL. When redistribute the FatFs with any modification or branch it as a folk, the license can also be changed to GNU GPL or BSD-style license.
+Therefore FatFs license is one of the BSD-style licenses but there is a significant feature. Because FatFs is mainly intended for embedded projects, the redistributions in binary form, such as embedded code or any forms without source code, need not to explain about FatFs in order to extend usability for commercial products. The documentation of the distributions need not include about FatFs and its license documents, and it may also. This is equivalent to the BSD 1-Clause License. Of course FatFs is compatible with the projects under GNU GPL. When redistribute the FatFs with any modification or branch it as a fork, the license can also be changed to GNU GPL, BSD-style license or any free software licenses that not conflict with FatFs license.
This function returns a disk status as the result. For details of the disk status, refer to the disk_status() function.
+This function returns the current drive status flags as the result. For details of the drive status, refer to the disk_status() function.
This function initializes a storage device and put it ready to generic read/write data. When the function succeeded, STA_NOINIT flag in the return value is cleared.
+This function initializes the storage device and put it ready to generic read/write. When the function succeeded, STA_NOINIT flag in the return value is cleared.
Application program MUST NOT call this function, or FAT structure on the volume can be broken. To re-initialize the file system, use f_mount() function instead. This function is called at volume mount process by FatFs module to manage the media change.
Command | Description |
---|---|
CTRL_SYNC | Make sure that the device has finished pending write process. If the disk I/O module has a write back cache, the dirty buffers must be written back to the media immediately. Nothing to do for this command if each write operation to the media is completed within the disk_write() function. Required at _FS_READONLY == 0. |
CTRL_SYNC | Make sure that the device has finished pending write process. If the disk I/O module has a write back cache, the dirty buffers must be written back to the media immediately. Nothing to do for this command if each write operation to the media is completed within the disk_write() function. |
GET_SECTOR_COUNT | Returns number of available sectors on the drive into the DWORD variable pointed by buff. This command is used by only f_mkfs() and f_fdisk() function to determine the volume/partition size to be created. Required at _USE_MKFS == 1 or _MULTI_PARTITION == 1. |
GET_SECTOR_SIZE | Returns sector size of the media into the WORD variable pointed by buff. Valid return values of this command are 512, 1024, 2048 or 4096. This command is required at variable sector size configuration, _MAX_SS > _MIN_SS. Never used at fixed sector size configuration, _MAX_SS == _MIN_SS, and it must work at that sector size. |
GET_BLOCK_SIZE | Returns erase block size of the flash memory in unit of sector into the DWORD variable pointed by buff. The allowable value is from 1 to 32768 in power of 2. Return 1 if the erase block size is unknown or disk media. This command is used by only f_mkfs() function and it attempts to align data area to the erase block boundary. Required at _USE_MKFS == 1. |
CTRL_ERASE_SECTOR | Informs device that the data on the block of sectors specified by a DWORD array {<start sector>, <end sector>} pointed by buff is no longer needed and may be erased. The device would force erased the memory block. This is a command similar to Trim command of ATA device. When this feature is not supported or not a flash memory media, nothing to do for this command. The FatFs does not check the result code and the file function is not affected even if the sectors ware not erased well. This command is called on removing a cluster chain and f_mkfs() function. Required at _USE_ERASE == 1. |
GET_SECTOR_SIZE | Returns sector size of the media into the WORD variable pointed by buff. Valid return values of this command are 512, 1024, 2048 and 4096. This command is required only at variable sector size configuration, _MAX_SS > _MIN_SS. At fixed sector size configuration, _MAX_SS == _MIN_SS, this command is not used and the device must work at that sector size. |
GET_BLOCK_SIZE | Returns erase block size of the flash memory media in unit of sector into the DWORD variable pointed by buff. The allowable value is from 1 to 32768 in power of 2. Return 1 if the erase block size is unknown or non flash memory media. This command is used by only f_mkfs() function and it attempts to align data area to the erase block boundary. Required at _USE_MKFS == 1. |
CTRL_TRIM | Informs the device the data on the block of sectors that specified by DWORD array {<start sector>, <end sector>} pointed by buff is no longer needed and it may be erased. This is an identical command to Trim of ATA device. When this feature is not supported or not a flash memory device, nothing to do for this command. The FatFs does not check the result code and the file function is not affected even if the sector block was not erased well. This command is called on removing a cluster chain and f_mkfs() function. Required at _USE_TRIM == 1. |
FatFs never uses any device dependent command and user defined command. Following table shows an example of non-standard commands usable for some applications.
+FatFs never uses any device dependent command nor user defined command. Following table shows an example of non-standard commands usable for some applications.
Command | Description |
---|---|
CTRL_FORMAT | Create a physical format on the media. If buff is not null, it is pointer to the call-back function for progress notification. |
CTRL_POWER_IDLE | Put the device idle state. STA_NOINIT in status flag may not be set if the device would go active state by generic read/write function. |
CTRL_POWER_IDLE | Put the device idle state. STA_NOINIT in status flag may not be set if the device goes active state by generic read/write function. |
CTRL_POWER_OFF | Put the device off state. Shut-down the power to the device and deinitialize the device interface if needed. STA_NOINIT in status flag must be set. The device goes active state by disk_initialize() function. |
CTRL_LOCK | Lock media eject mechanism. |
CTRL_UNLOCK | Unlock media eject mechanism. |
The disk_ioctl function is not needed when _FS_READONLY == 1 and _MAX_SS == _MIN_SS.
+