diff --git a/doc/00index_e.html b/doc/00index_e.html index 5c8cde8..aa249b1 100644 --- a/doc/00index_e.html +++ b/doc/00index_e.html @@ -1,11 +1,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 low cost microcontrollers, such as AVR, 8051, PIC, ARM, Z80, 68k and etc..., without any change. Petit FatFs module is also available here.
+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 module provides following functions to the applications. In other words, this list describes what FatFs can do to access the FAT volumes.
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.
+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.
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͏K͂ȑgݍ݃VXe̔ėpFATt@CVXeEW[łBANSI CŃn[hEFAEA[LeN`ɂ͈ˑȂ̂ŁAKvȃ[NEGAmۂłA8051, PIC, AVR, SH, Z80, 68k, H8, ARMȂLjȃ}CRłgp\łBFatFsVNՂFatFs܂B
-FatFsは小規模な組み込みシステム向けの汎用FATファイルシステム・モジュールです。ANSI C準拠でハードウェア・アーキテクチャには依存しないので、必要なワーク・エリアが確保できれば、8051, PIC, AVR, SH, Z80, 68k, H8, ARMなど安価なマイコンでも使用可能です。FatFsをシュリンクしたぷちFatFs↗もあります。
+FatFsW[́AAvP[VECɑÃt@C(API)܂B܂ÃXgFatFsɂł邱ƂVvɎĂ܂B
+FatFsモジュールは、アプリケーション・レイヤに対し、次のファイル操作関数(API)を提供します。つまり、このリストはFatFsにできることをシンプルに示しています。
FatFsW[́APȂt@CEVXeECȂ̂ŁAXg[WEfoCX䃌C͊܂܂܂BgpXg[WɑΉ́A[UɂĒKv܂BFatFsW[́AʃCɑȂƂ̃C^[tF[Xv܂BOS֘A@\LɂƂ́AɉăvZX/֘AKvɂȂ܂BTvEvWFNgɉʃC̎܂B
+FatFsモジュールは、単なるファイル・システム・レイヤなので、ストレージ・デバイス制御レイヤは含まれません。使用するストレージに対応した制御関数は、ユーザによって提供される必要があります。FatFsモジュールは、下位レイヤに対し少なくとも次のインターフェースを要求します。OS関連機能を有効にしたときは、これに加えてプロセス/メモリ関連関数も必要になります。サンプル・プロジェクトに下位レイヤの実装例を示します。
FatFsW[̓t[E\tgEFAƂċEEJpɌJĂ܂Bǂ̂悤ȗpړIilp珤p܂ŁjłgpEρEzzɂĈ̐͂܂ASėp҂̐ӔC̉ł̗pƂ܂Bڂ̓AvP[VEm[gQƂĂB
+FatFsモジュールはフリー・ソフトウェアとして教育・研究・開発用に公開しています。どのような利用目的(個人利用から商用まで)でも使用・改変・配布について一切の制限はありませんが、全て利用者の責任の下での利用とします。詳しくはアプリケーション・ノートを参照してください。
The dependency diagram shown below is a typical configuration of the embedded system with FatFs module.

(a) If a working disk module with FatFs API is provided, no additional function is needed. (b) To attach existing disk drivers with different API, glue functions are needed to translate the APIs between FatFs and the drivers.
+
You need to provide only low level disk I/O functions that required by FatFs module and nothing else. If a working disk module for the target is already existing, you need to write only glue functions to attach it to the FatFs module. If not, you need to port any other disk module or write it from scratch. Most of defined functions are not that always required. For example, disk write function is not required in read-only configuration. Following table shows which function is required depends on configuration options.
| Function | Required when: | Note |
|---|---|---|
| disk_initialize disk_status disk_read | Always | Disk I/O functions. Samples available in ffsample.zip. There are many implementations on the web. |
| disk_status disk_initialize disk_read | Always | Disk I/O functions. Samples available in ffsample.zip. There are many implementations on the web. |
| disk_write get_fattime disk_ioctl (CTRL_SYNC) | _FS_READONLY == 0 | |
| disk_ioctl (GET_SECTOR_COUNT) disk_ioctl (GET_BLOCK_SIZE) | _USE_MKFS == 1 | |
| disk_ioctl (GET_SECTOR_SIZE) | _MAX_SS != _MIN_SS | |
| disk_ioctl (CTRL_ERASE_SECTOR) | _USE_ERASE == 1 | |
| ff_convert ff_wtoupper | _USE_LFN >= 1 | Unicode support functions. Available in option/cc*.c. |
| disk_ioctl (CTRL_TRIM) | _USE_TRIM == 1 | |
| ff_convert ff_wtoupper | _USE_LFN >= 1 | Unicode support functions. Available in option/unicode.c. |
| ff_cre_syncobj ff_del_syncobj ff_req_grant ff_rel_grant | _FS_REENTRANT == 1 | O/S dependent functions. Samples available in option/syscall.c. |
| ff_mem_alloc ff_mem_free | _USE_LFN == 3 |
The FatFs module has started to support long file name (LFN) at revision 0.07. The two different file names, SFN and LFN, of a file is transparent in the file functions except for f_readdir function. To enable LFN feature, set _USE_LFN to 1, 2 or 3, and add a Unicode code conversion function ff_convert() and ff_wtoupper() to the project. The LFN feature requiers a certain working buffer in addition. The buffer size can be configured by _MAX_LFN corresponding to the available memory size. The size of long file name 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 given file name, the file function fails with FR_INVALID_NAME. When enable the LFN feature with re-entrant feature, _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 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.
| Code page | Program size |
|---|
| Command | Description |
|---|---|
| CTRL_SYNC | Make sure that the disk drive has finished pending write process. When the disk I/O module has a write back cache, the dirty sectors must be written back immediately. This command is not used at read-only configuration. |
| 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. |
| 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 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 devices. This command is used by only f_mkfs() function and it attempts to align data area to the erase block boundary. |
| CTRL_ERASE_SECTOR | Erases a part of the flash memory specified by a DWORD array {<start sector>, <end sector>} pointed by buff. This is similar command to Trim command of ATA command set. When this feature is not supported or not a flash memory media, this command has no effect and can be ignored. 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 when _USE_ERASE is 1. |
| 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. |
| 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. |
FatFs never uses any device dependent command and 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_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. |
| CTRL_EJECT | Eject media cartridge. STA_NOINIT and STA_NODISK in status flag are set after the function succeeded. |
| MMC_GET_TYPE | Get card type. The type flags, bit0:MMCv3, bit1:SDv1, bit2:SDv2+ and bit3:LBA, is stored to a BYTE variable pointed by buff. (MMC/SDC specific command) |
| MMC_GET_CSD | Get CSD register into a 16-byte buffer pointed by buff. (MMC/SDC specific command) |
| MMC_GET_CID | Get CID register into a 16-byte buffer pointed by buff. (MMC/SDC specific command) |
| MMC_GET_OCR | Get OCR register into a 4-byte buffer pointed by buff. (MMC/SDC specific command) |
| MMC_GET_SDSTAT | Get SDSTATUS register into a 64-byte buffer pointed by buff. (SDC specific command) |
| ATA_GET_REV | Get the revision string into a 16-byte buffer pointed by buff. (ATA/CFC specific command) |
| ATA_GET_MODEL | Get the model string into a 40-byte buffer pointed by buff. (ATA/CFC specific command) |
| ATA_GET_SN | Get the serial number string into a 20-byte buffer pointed by buff. (ATA/CFC specific command) |
The disk_read function reads sector(s) from the disk drive.
+The disk_read function reads sector(s) from the storage device.
DRESULT disk_read ( BYTE pdrv, /* [IN] Physical drive number */ @@ -28,13 +28,13 @@ DRESULT disk_read (Parameters
Generally, a multiple sector transfer request must not be split into single sector transactions to the storage device, or you will not get good read throughput.
diff --git a/doc/en/dstat.html b/doc/en/dstat.html index 2bdfb33..5ae2775 100644 --- a/doc/en/dstat.html +++ b/doc/en/dstat.html @@ -25,21 +25,21 @@ DSTATUS disk_status (The disk status is returned in combination of following flags. FatFs refers only STA_NOINIT and STA_PROTECTED.
+The disk status is returned in combination of following flags. FatFs refers only STA_NOINIT and STA_PROTECT.
The disk_write writes sector(s) to the disk.
+The disk_write writes sector(s) to the storage device.
DRESULT disk_write ( BYTE drv, /* [IN] Physical drive number */ - const BYTE* buff, /* [IN] Write data (may be non aligned) */ - DWORD sector, /* [IN] Sector number to write */ + const BYTE* buff, /* [IN] Pointer to the data to be written */ + DWORD sector, /* [IN] Sector number to write from */ UINT count /* [IN] Number of sectors to write */ );@@ -28,13 +28,13 @@ DRESULT disk_write (
This function is not required in read only configuration. The specified memory address is not that always aligned to word boundary because the type of pointer is defined as BYTE. For more information, read description in disk_read function.
-Application program MUST NOT call this function while FatFs is in use, or FAT structure on the volume can be corrapted.
+The specified memory address is not that always aligned to word boundary because the type of pointer is defined as BYTE*. For more information, refer to the description of disk_read() function.
+Generally, a multiple sector transfer request must not be split into single sector transactions to the storage device, or you will never get good write throughput.
+FatFs expects delayed write feature of the disk functions. The write operation to the media need not to be completed due to write operation is in progress or only stored it into the cache buffer when return from this function. But data on the buff is invalid after return from this function. The write completion request is done by CTRL_SYNC command of disk_ioctl() function. Therefore, if delayed write feature is implemented, the write throughput may be improved.
+Application program MUST NOT call this function, or FAT structure on the volume can be collapsed.
+This function is not needed when _FS_READONLY == 1.
Currnet time is returned with packed into a DWORD value. The bit field is as follows:
The get_fattime() function must return any valid time even if the system does not support a real time clock. If a zero is returned, the file will not have a valid time. This fucntion is not required in read only configuration.
+The get_fattime() function shall return any valid time even if the system does not support a real time clock. If a zero is returned, the file will not have a valid timestamp.
+This function is not needed when _FS_READONLY == 1.
The f_fdisk() function creates a partition table into the MBR of the physical drive. The partitioning rule is in generic FDISK format, so that it can create upto four primary partitions. Extended partition is not supported. The part[] array with four items specifies how to divide the physical drive. The first item specifies the size of first primary partition and fourth item specifies the fourth primary partition. If the value is less than or equal to 100, it means percentage of the partition in the entire disk space. If it is larger than 100, it means partition size in unit of sector.
+The f_fdisk() function creates a partition table into the MBR of the physical drive. The partitioning rule is in generic FDISK format, so that it can create upto four primary partitions. Logical volumes in the extended partition is not supported. The part[] with four items specifies how to divide the physical drive. The first item specifies the size of first primary partition and fourth item specifies the fourth primary partition. If the value is less than or equal to 100, it specifies percentage of the partition in the entire disk space. If it is larger than 100, it specifies the partition size in unit of sector.
The format of path name on the FatFs module is similer to the filename specs of DOS/Windos as follows:
-"[drive#:][/]directory/file"-
The FatFs module supports long file name (LFN) and 8.3 format file name (SFN). The LFN can be used when LFN feature is enabled (_USE_LFN > 0). The sub directories are separated with a \ or / in the same way as DOS/Windows API. Duplicated separators are skipped and ignored. Only a difference is that the logical drive is specified in a numeral with a colon. When the drive number is omitted, it is assumed as default drive (drive 0 or current drive).
+"[drive:][/]directory/file"+
The FatFs module supports long file name (LFN) and 8.3 format file name (SFN). The LFN can be used when LFN feature is enabled (_USE_LFN > 0). The sub directories are separated with a \ or / in the same way as DOS/Windows API. Duplicated separators are skipped and ignored. Only a difference is that the logical drive is specified in a numeral with a colon. When drive number is omitted, the drive number is assumed as default drive (drive 0 or current drive).
Control characters ('\0' to '\x1F') are recognized as end of the path name. Leading/embedded spaces in the path name are valid as a part of the name at LFN configuration but they are recognized as end of the path name at non-LFN configuration. Trailing spaces and dots are ignored.
-In default configuration (_FS_RPATH == 0), it does not have a concept of current directory like OS oriented file system. All objects on the volume are always specified in full path name that follows from the root directory. Dot directory names are not allowed. Heading separator is ignored and it can be exist or omitted. The default drive number is fixed to 0.
-When relative path feature is enabled (_FS_RPATH == 1), specified path is followed from the root directory if a heading separator is exist. If not, it is followed from the current directory set with f_chdir function. Dot names are also allowed for the path name. The default drive is the current drive set with f_chdrive function.
+In default configuration (_FS_RPATH == 0), it does not have a concept of current directory like OS oriented file system. All objects on the volume are always specified in full path name that follows from the root directory. Dot directory names are not allowed. Heading separator is ignored and it can be exist or omitted. The default drive is fixed to drive 0.
+When relative path feature is enabled (_FS_RPATH == 1), specified path is followed from the root directory if a heading separator is exist. If not, it is followed from the current directory of the drive set with f_chdir function. Dot names are also allowed for the path name. The default drive is the current drive set with f_chdrive function.
| Path name | _FS_RPATH == 0 | _FS_RPATH == 1 |
| file.txt | A file in the root directory of the drive 0 | A file in the current directory of the current drive |
| ユーザ作成関数 | 必要となる条件 | 備考 |
|---|---|---|
| disk_initialize disk_status disk_read | 常時 | ffsample.zip (サンプル) その他web上に多数 |
| 必要な関数 | 必要となる条件 | 備考 |
| disk_status disk_initialize disk_read | 常時 | ffsample.zip (サンプル) その他web上に多数 |
| disk_write get_fattime disk_ioctl (CTRL_SYNC) | _FS_READONLY == 0 | |
| disk_ioctl (GET_SECTOR_COUNT) disk_ioctl (GET_BLOCK_SIZE) | _USE_MKFS == 1 | |
| disk_ioctl (GET_SECTOR_SIZE) | _MAX_SS != _MIN_SS | |
| disk_ioctl (CTRL_ERASE_SECTOR) | _USE_ERASE == 1 | |
| ff_convert ff_wtoupper | _USE_LFN >= 1 | option/cc*.c |
| ff_convert ff_wtoupper | _USE_LFN >= 1 | option/unicode.c |
| ff_cre_syncobj ff_rel_grant ff_req_grant ff_del_syncobj | _FS_REENTRANT == 1 | option/syscall.c (サンプル) |
| ff_mem_alloc ff_mem_free | _USE_LFN == 3 |
FatFsモジュールはR0.07から長いファイル名(LFN)をサポートしました。ファイルに付けられた2つの異なる名前(短いファル名と長いファイル名)は、f_readdir()を除くファイル操作関数において透過です。LFN機能を有効にするには、_USE_LFNを1,2または3に設定し、Unicode変換関数ff_convert(), ff_wtoupper()をプロジェクトに追加します。これらの関数は、option/cc*.cに含まれています。LFN機能は、加えてある程度のワーク・エリア(LFN操作バッファ)を必要とします。バッファ長は使用できるメモリに応じて_MAX_LFNオプションで構成されることができます。LFNの長さは最大255文字に達するので、LFN完全対応のためには_MAX_LFNは255に設定されるべきです。与えられたファイル名に対してバッファ長が不足した場合、ファイル関数はFR_INVALID_NAMEで失敗します。
-何らかのリエントラント状態の下でLFN機能を使用する場合は、_USE_LFNは2または3に設定されなければなりません。この場合、ファイル関数はバッファをスタックやヒープに確保します。バッファ・サイズは、(_MAX_LFN + 1) * 2バイトになるので、スタック等のサイズはそれを考慮した十分なサイズでなければなりません。
+FatFsモジュールは、長いファイル名(LFN)をサポートします。ファイルに付けられた2つの異なる名前(短いファル名と長いファイル名)は、f_readdir()を除くファイル操作関数において透過です。デフォルト構成では、LFN機能はOFFになっています。LFN機能を有効にするには、_USE_LFNを1,2または3に設定し、option/unicode.cをプロジェクトに追加します。LFN機能は、加えてある程度のワーク・エリア(LFN操作バッファ)を必要とします。バッファ長は使用できるメモリに応じて_MAX_LFNオプションで構成されることができます。LFNの長さは最大255文字に達するので、LFN完全対応のためには_MAX_LFNは255に設定されるべきです。与えられたファイル名に対してバッファ長が不足した場合、ファイル関数はFR_INVALID_NAMEで失敗します。
+ファイル関数に再入を行う条件の下でLFN機能を使用する場合は、_USE_LFNは2または3に設定されなければなりません。この場合、ファイル関数はワーク・エリアを動的に確保(スタックまたはヒープ)します。バッファ・サイズは、(_MAX_LFN + 1) * 2バイトになるので、スタック等のサイズはそれを考慮した十分なサイズでなければなりません。
| コードページ | コードサイズ[bytes] |
|---|
| R}h | |
|---|---|
| CTRL_SYNC | hCũf[^ݏ̊҂BCgEobNELbVȂǂ݂ꍇ́A܂ĂȂf[^߂܂B[hEI[\ł͎gp܂B |
| GET_SECTOR_COUNT | buff̎wDWORD^ϐɃhCȗZN^Ԃ܂Bf_mkfs()ŌĂяoA쐬{[̃TCY肷邽߂Ɏgp܂B |
| GET_SECTOR_SIZE | buff̎wWORD^ϐɃhCũZN^ETCYԂ܂BLl512A1024A2048܂4096łBZN^ETCYŒ\(_MAX_SS ==_MIN_SS)̂Ƃ͂̃R}h͎g邱Ƃ͂ȂÃZN^ETCYœ삵ȂȂ܂B |
| CTRL_SYNC | Xg[WEfoCX̃f[^ݏ܂BCgEobNELbVȂǂ݂ꍇ́A܂ĂȂf[^݂܂BfBAւ݂̏ꂼdisk_write()̓Ŋꍇ́ÃR}hɑĂ邱Ƃ͂܂B |
| GET_SECTOR_COUNT | buff̎wDWORD^ϐɃhCȗZN^Ԃ܂Bf_mkfs()f_fdisk()ĂяoA쐬{[̃TCY肷邽߂Ɏgp܂B |
| GET_SECTOR_SIZE | buff̎wWORD^ϐɃhCũZN^ETCYԂ܂BLl512A1024A2048܂4096łBZN^ETCYŒ\(_MAX_SS ==_MIN_SS)̂Ƃ͂̃R}h͎g邱Ƃ͂ȂAɂ̃ZN^ETCYœ삵ȂȂ܂B |
| GET_BLOCK_SIZE | buff̎wDWORD^ϐɃtbVȄubNETCY(ZN^P)Ԃ܂B132768͈̔͂2̗ݏ̒lłȂȂ܂Bsȏꍇ܂̓tbVEȊÕfBAł1Ԃ܂Bf_mkfs()ł̂ݎgpA{[̃f[^̈͂̋EɃACg܂B |
| CTRL_ERASE_SECTOR | tbVE̎ẅ̏Bbuff̎wDWORD^zɂ͏̈ {JnZN^,IZN^} w肵ČĂяo܂B_USE_ERASE1̂ƂANX^ƂɌĂяo܂B́AATAR}hEZbgTrimR}hƓŁA̋@\T|[gȂꍇ͉Kv͂܂B܂A߂l̓`FbNꂸASɍsȂƂĂFatFs̓ɂ͉e܂B |
| CTRL_ERASE_SECTOR | tbVË̗̖IBbuff̎wDWORD^zɂ͏̈ {JnZN^,IZN^} w肵ČĂяo܂B_USE_ERASE1̂ƂANX^ƂɌĂяo܂B́AATAR}hEZbgTrimR}hƓŁA̋@\T|[gȂꍇ͉Kv͂܂B܂A߂l̓`FbNꂸASɍsȂƂĂFatFs̓ɂ͉e܂B |
FatFŝ̓foCXˑR}h[U`R}h͈؎gp܂AAvP[V牽炩̃foCX䂪sƕ֗ȂƂ܂BAvP[VŕWȊO̐䂪KvȂƂ́AKvɉă[U`R}hljėpƂ悢ł傤BɃR}h̗܂B
+| R}h | |
|---|---|
| CTRL_FORMAT | fBA̕tH[}bgs܂BbuffNULLłȂƂAis\̂߂̃R[obÑAhX܂B |
| CTRL_POWER_IDLE | foCXAChԂɂ܂Bʏ̓ǂݏvŃANeBuԂɖ߂ȂASTA_NOINITtOZbgKv͂܂B |
| CTRL_POWER_OFF | foCXVbg_EԂɂ܂BSTA_NOINIT̓Zbg܂BfoCXdisk_initialize()ŃANeBuԂɖ߂܂B |
| CTRL_LOCK | [Uɂ郁fBA̎o֎~܂B |
| CTRL_UNLOCK | [Uɂ郁fBA̎o܂B |
| CTRL_EJECT | fBAro܂BASTA_NOINITSTA_NODISKtO̓Zbg܂B |
| MMC_GET_TYPE | J[hE^CvtO(b0:MMCv3, b1:SDv1, b2:SDv2+, b3:LBA)buff̎BYTEϐɓǂݏo܂B(MMC/SDJ[hp) |
| MMC_GET_CSD | CSDWX^̓ebuff̎16oCg̃obt@ɓǂݏo܂B(MMC/SDJ[hp) |
| MMC_GET_CID | CIDWX^̓ebuff̎16oCg̃obt@ɓǂݏo܂B(MMC/SDJ[hp) |
| MMC_GET_OCR | OCRWX^̓ebuff̎4oCg̃obt@ɓǂݏo܂B(MMC/SDJ[hp) |
| MMC_GET_SDSTAT | SD STATUSWX^̓ebuff̎64oCg̃obt@ɓǂݏo܂B(SDJ[hp) |
| ATA_GET_REV | rWER[hbuff̎16oCg̃obt@ɓǂݏo܂B(ATA/CFJ[hp) |
| ATA_GET_MODEL | fER[hbuff̎40oCg̃obt@ɓǂݏo܂B(ATA/CFJ[hp) |
| ATA_GET_SN | VAԍbuff̎20oCg̃obt@ɓǂݏo܂B(ATA/CFJ[hp) |
[hEI[\ŁAZN^ETCYŒ\̂Ƃ́Å͕KvƂ܂B
hCuZN^ǂݏo܂B
+Xg[WEfoCXf[^ǂݏo܂B
DRESULT disk_read ( BYTE pdrv, /* [IN] hCuԍ */ @@ -28,13 +28,13 @@ DRESULT disk_read (
ʓIɁAZN^̓]v́AXg[WEfoCXɑĉ\Ȍ}`EZN^]ȂȂ܂B̃VOEZN^ǂݏoɕꂽꍇAX[vbgቺ邱Ƃ܂B
+ diff --git a/doc/ja/dstat.html b/doc/ja/dstat.html index d21f8ef..a74fc30 100644 --- a/doc/ja/dstat.html +++ b/doc/ja/dstat.html @@ -13,7 +13,7 @@fBXNEhCȕԂ擾܂B
+Xg[WEfoCX̏Ԃ擾܂B
DSTATUS disk_status ( BYTE pdrv /* [IN] hCuԍ */ @@ -25,20 +25,20 @@ DSTATUS disk_status (
hCȕԂ̃tȎgݍ킹lŕԂ܂B
+Xg[WEfoCX̏Ԃ̃tȎgݍ킹lŕԂ܂B
fBXNɃf[^݂܂B
+Xg[WEfoCXɃf[^݂܂B
DRESULT disk_write ( BYTE pdrv, /* [IN] hCuԍ */ @@ -28,13 +28,13 @@ DRESULT disk_write (
[hEI[\ł͕͂̊KvƂ܂B
-FatFs̎gp̓AvP[V͂̊ĂяoĂ͂Ȃ܂BȂƁAFAT{[j܂BG[ɂďKvȂƂ́Af_mount()gpĂBFatFsW[́A}EgɂAKvɉĂ̊Ăяo܂B
+buffɎw肳AhXɃ[hEACgĂƂ͌܂Bڍׂ́Adisk_read()̉QƂĂB
+ʓIɁAZN^̓]v́AfoCXɑĉ\Ȍ}`EZN^]ȂȂ܂B̃VOEZN^݂ɕꂽꍇAX[vbgቺ邱Ƃ܂B
+FatFs̓fBXNx@\Ƃz肵Ă܂B̊߂ƂAfoCXݒƂLbVɏ܂ꂽȂǁAKf[^݂̏ĂKv͂܂BAbuff̃f[^́Å߂ƖƂȂ܂B̗݊v́Adisk_ioctl()CTRL_SYNCR}hɂčs܂B̂悤Ȓx@\ꂽꍇAX[vbgɌコ邱Ƃł܂B
+AvP[V͂̊ĂяoĂ͂Ȃ܂BȂƁAFAT{[j\܂B
+[hEI[\(_FS_READONLY == 1)ł͕͂̊KvƂ܂B
݂̃[JE^CDWORDlɃpbNĕԂ܂BrbgEtB[h͎Ɏ悤ɂȂ܂B
+݂̃[JE^CDWORDlɃpbNĕԂ܂BrbgEtB[h͎Ɏ悤ɂȂ܂B
RTCT|[gȂVXełA炩̓tƂėLȒlԂȂȂ܂B0ԂꍇÃt@C͓t܂B[hEI[\ł͕͂̊KvƂ܂B
+RTCT|[gȂVXełA_~[Ƃĉ炩̓tƂėLȒlԂׂłB0ȂǂԂꍇÃt@C̃^CX^v͖ɂȂ܂B
+[hEI[\(_FS_READONLY == 1)ł͕͂̊KvƂ܂B
ファイル関数の入出力のうちファイル名やパス名を指定する引数の型は、TCHARで定義されていますが、これは通常はcharのエリアスになっています。そして、_CODE_PAGEで指定されるANSI/OEMコード(SBCSまたはDBCS)の文字列として扱われます。ファイル名入出力をUnicodeとする構成(_LFN_UNICODE == 1)にしたときは、TCHARはワイド文字(WCHAR, unsigned short)に切り替わり、パス名の入出力にUnicodeを使用するようになります。これによりLFN規格に完全対応となり、ANSI/OEMコードにない文字(たとえば ✝☪✡☸☭など)も使用できます。この設定は文字列入出力関数のデータ型とエンコーディングにも影響を与えます。リテラル文字列を定義するとき、次に示すように_T(s)および_TEXT(s)マクロを使ってANSI/OEMとUnicodeを自動切り替えすることができます。
+ファイル関数の入出力のうちファイル名やパス名を指定する引数の型は、TCHARで定義されていますが、これは通常はcharのエリアスになっています。そして、_CODE_PAGEで指定されるANSI/OEMコード(SBCSまたはDBCS)の文字列として扱われます。ファイル名入出力をUnicodeとする構成(_LFN_UNICODE == 1)にしたときは、TCHARはワイド文字(WCHAR, unsigned short)に切り替わり、パス名の入出力にUnicodeを使用するようになります。これによりLFN規格に完全対応となり、ANSI/OEMコードにない文字(たとえば ✝☪✡☸☭など)も使用できます。この設定は文字列入出力関数のデータ型とファイル上のエンコーディングにも影響を与えます。リテラル文字列を定義するとき、次に示すように_T(s)および_TEXT(s)マクロを使ってANSI/OEMとUnicodeを自動切り替えすることができます。
f_open(fp, "filename.txt", FA_READ); /* ANSI/OEM専用コード */ f_open(fp, L"filename.txt", FA_READ); /* Unicode専用コード */ @@ -50,7 +50,7 @@
diff --git a/doc/ja/gets.html b/doc/ja/gets.html index 8432353..2babef0 100644 --- a/doc/ja/gets.html +++ b/doc/ja/gets.html @@ -38,14 +38,14 @@ TCHAR* f_gets (ボリューム管理
-デフォルトの構成では、それぞれの論理ドライブは同じ番号の物理ドライブに1:1で結びつけられていて、自動検出機能によりその物理ドライブ上の一つのFATボリュームがマウントされます。FATボリュームの検出は、セクタ0、第一区画、第二区画、第三区画、第四区画の順に行われます。
+デフォルトの構成では、それぞれの論理ドライブは同じ番号の物理ドライブに1:1で結びつけられていて、自動検出機能によりその物理ドライブ上の一つのFATボリュームがマウントされます。FATボリュームの検出は、セクタ0、第一区画~第四区画の順に行われます。
_MULTI_PARTITIONに1を指定すると、それぞれの論理ドライブに対して個別に物理ドライブ番号と区画を指定できるようになります。この構成では、論理ドライブと区画の対応を解決するためのテーブルを次に示すように定義する必要があります。
例:論理ドライブ0~2を物理ドライブ0(非リムーバブル)の3つの基本区画に割り当て、 diff --git a/doc/ja/getcwd.html b/doc/ja/getcwd.html index bbc14ab..b48f3fc 100644 --- a/doc/ja/getcwd.html +++ b/doc/ja/getcwd.html @@ -13,7 +13,7 @@@@ -50,7 +50,7 @@ FRESULT f_getcwd (f_getcwd
-JgEfBNg܂
+JgEfBNg܂B
FRESULT f_getcwd ( TCHAR* buff, /* [OUT] obt@ */ @@ -26,9 +26,9 @@ FRESULT f_getcwd (
- buff
-- JgEfBNg̕i[obt@
+- JgEfBNg̃pXi[obt@
- len
-- TCHARPʂ̃obt@ETCY
+- TCHARPʂ̃obt@ETCY
-diff --git a/doc/ja/getfree.html b/doc/ja/getfree.html index b1d71b0..4de40de 100644 --- a/doc/ja/getfree.html +++ b/doc/ja/getfree.html @@ -13,7 +13,7 @@JgEhCũJgEfBNg̃tEpX擾܂B_VOLUMES2ȏ̂Ƃ́A_hCuԍ̕tꂽtEpXƂȂ܂B
+JgEhCũJgEfBNg̃tEpX擾܂B_VOLUMES2ȏ̂Ƃ́A_hCuԍ̕tꂽpXƂȂ܂B
@@ -28,10 +28,10 @@ FRESULT f_getlabel (f_getfree
-_hCu̖gpNX^擾܂B
+{[̋̈̃TCY擾܂B
FRESULT f_getfree ( const TCHAR* path, /* [IN] ΏۃhCuw肵܂ */ @@ -29,7 +29,7 @@ FRESULT f_getfree (- path
- ׂΏۂ̘_hCupXk'\0'I[̕ւ̃|C^w肵܂Bk̓JgEhCuӖ܂B
- nclst
-- NX^i[DWORDϐւ̃|C^w肵܂B
+- NX^i[DWORD^ϐւ̃|C^w肵܂B
- fatfs
- ΏۃhCũt@CEVXeEIuWFNgw|C^Ԃ܂B
@@ -53,7 +53,7 @@ FRESULT f_getfree (-diff --git a/doc/ja/getlabel.html b/doc/ja/getlabel.html index e2df997..957d212 100644 --- a/doc/ja/getlabel.html +++ b/doc/ja/getlabel.html @@ -17,8 +17,8 @@_hCűNX^擾܂BԂꂽt@CEVXeEIuWFNgcsizeoNX^̃ZN^Ă̂ŁAɎۂ̋TCYvZł܂BFAT32{[ɂẮAFSINFOۂ̏ԂƓĂȂꍇAsmȋTCYԂ\܂B̖邽߁A_FS_NOFSINFOIvVFSINFOď̓tFATXL悤ɐݒ肷邱Ƃł܂B
+_hCű̈̃TCYNX^PʂŎ擾܂BԂꂽt@CEVXeEIuWFNgcsizeoNX^̃ZN^Ă̂ŁAɃZN^Pʂ̋TCYvZł܂BFAT32{[ɂẮAFSINFȌۂ̋NX^ƓĂȂꍇAsmȒlԂ\܂B̖邽߁A_FS_NOFSINFOIvVŃ}Eg͕̏KtFATXL悤ɍ\邱Ƃł܂B
FRESULT f_getlabel ( const TCHAR* path, /* [IN] ΏۃhCu */ - TCHAR* name, /* [OUT] {[i[obt@ */ - DWORD* sn /* [OUT] {[EVAԍi[ϐ */ + TCHAR* label, /* [OUT] {[i[obt@ */ + DWORD* vsn /* [OUT] {[EVAԍi[ϐ */ );
- path
- ΏۂƂȂ_hCupXk'\0'I[̕ւ̃|C^w肵܂Bk̏ꍇ́AftHgEhCuw肵ƂɂȂ܂B
-- name
+- label
- {[i[zւ̃|C^w肵܂BȂƂ12vf̃TCYKvłB{[Ȃꍇ̓kԂ܂B̏svȂƂ̓kE|C^w肵ĂB
-- sn
-- {[EVAԍi[DWORDϐւ̃|C^w肵܂B̏svȂƂ̓kE|C^w肵ĂB
+- vsn
+- {[EVAԍi[DWORD^ϐւ̃|C^w肵܂B̏svȂƂ̓kE|C^w肵ĂB
߂l
-buffԂ܂B
+buffԂ܂B
-diff --git a/doc/ja/mkfs.html b/doc/ja/mkfs.html index f882dd2..7e09696 100644 --- a/doc/ja/mkfs.html +++ b/doc/ja/mkfs.html @@ -31,7 +31,7 @@ FRESULT f_mkfs (̊f_read()̃bp[łBǂݏóAŏ'\n'ǂݍނAt@CI[ɒB邩Alen - 1ǂݏo܂ő܂Bǂݍ܂ꂽ̏I[ɂ'\0't܂BɃt@CI[1ǂݍ܂ȂƂA܂͉炩̃G[Ƃ͎͊skE|C^Ԃ܂Bt@CI[G[f_eof(),f_error()}NŒׂ܂B
-APIUnicodeI(_LFN_UNICODE1)ĂƂ́AbuffUTF-16ɂȂ܂At@C̃GR[h́A_STRF_ENCODEIvVőIł܂BȊO͖̎ϊ(1oCg/1)œǂݏo܂B
+̊f_read()̃bp[łBǂݏóAŏ'\n'ǂݍނAt@CI[ɒB邩Alen - 1ǂݏo܂ő܂Bǂݍ܂ꂽ̏I[ɂ'\0't܂BɃt@CI[1ǂݍ܂ȂƂA܂͉炩̃G[Ƃ͎͊skE|C^Ԃ܂Bt@CI[G[f_eof(),f_error()}NŒׂ܂B
+Unicode API\(_LFN_UNICODE == 1)IĂƂ́AbuffUTF-16ɂȂ܂At@C̃GR[h́A_STRF_ENCODEIvVőIł܂BȊO͖̎ϊ(1oCg/1)œǂݏo܂B
hCuFAT{[쐬܂BFDISK`w肳ꂽꍇ́AhCuŜ߂{(p[e[V)쐬A̒FAT{[쐬܂BSFD`ł́AFAT{[͕hCu̐擪ZN^x^ō쐬܂B
-}`p[e[V@\(_MULTI_PARTITION)ɂAw肳ꂽ_hCű(1`4)ɌѕtĂꍇA̋̒FAT{[쐬܂B̏ꍇAsfd͖A܂Ή镨hCu͂ɐ旧Af_fdisk()܂͑̃c[œKɋݒ肳ĂKv܂B
-p[e[V`ɂ́AFDISK`SFD`̓ʂ肠܂BFDISK`́An[hfBXNAMMCASDCACFCAU DiskȂǂŕWIɎgp܂BFDISK`ł͈̕hCuɈ܂͕̋쐬邱Ƃł܂BǗMBR(hCu̐擪ZN^)ɋL^܂BSFD`͒Pɉ̕sȂ`ŁA{[͕hCu̐擪ZN^Jn܂BSFD`́Atbs[fBXNA}CNhCuAwfBXNAт̑X[p[tbs[fBAŕWIɎgpĂ܂B
-FAT^Cv(FAT12/FAT16/FAT32)́A̘_hCuNX^ɂĂ̂錈܂[FATdl]ɂȂĂāAȊO̗v͂܂BāAǂFAT^CvɂȂ邩̓hCuETCYƃNX^ETCYɈˑ܂BNX^ETCY͑傫قǐ\オAfBXNp͗܂B
+hCuFAT{[쐬܂BFDISK`w肳ꂽꍇ́AhCuŜ߂{(p[e[V)쐬A̒FAT{[쐬܂BSFD`ł́AFAT{[hCu̐擪ZN^x^ō쐬܂B
+tH[}bg_hCu}`Ep[e[V@\(_MULTI_PARTITION)ɂē̋(1`4)ɌѕtĂꍇ́A̋̒FAT{[쐬܂Bsfd͖A܂Ή镨hCu͂ɐ旧Af_fdisk()܂͑̃c[œKɋݒ肳ĂKv܂B
+p[e[V`ɂ́AFDISK`SFD`̓ʂ肠܂BFDISK`́An[hfBXNAMMCASDCACFCAU DiskȂǂŕWIɎgp܂BFDISK`ł͈̕hCuɈ܂͕̋쐬邱Ƃł܂BǗMBR(hCu̐擪ZN^)ɋL^܂BSFD`͒Pɉ̕sȂ`ŁA{[͕hCu̐擪ZN^Jn܂BSFD`́Atbs[EfBXNA}CNhCuAwfBXNAт̑X[p[Etbs[EfBAŕWIɎgpĂ܂B
+FAT^Cv(FAT12/FAT16/FAT32)́Ã{[NX^ɂĂ̂錈܂[FATdl]ɂȂĂāAȊO̗v͂܂BāAǂFAT^CvɂȂ邩̓{[ETCYƃNX^ETCYɈˑ܂BNX^ETCY͑傫قǐ\オ܂B
NX^FAT^Cv̋Eɋ߂ȂƂ́AFR_MKFS_ABORTEDŊs\܂B
_hCuɃt@CEVXeEIuWFNgo^E܂B
FRESULT f_mount ( - FATFS* fatfs, /* [IN] t@CEVXeEIuWFNg */ + FATFS* fs, /* [IN] t@CEVXeEIuWFNg */ const TCHAR* path, /* [IN] _hCuԍ */ BYTE opt /* [IN] IvV */ ); @@ -26,7 +26,7 @@ FRESULT f_mount (-
- fatfs
+- fs
- o^t@CEVXeEIuWFNgւ̃|C^B
- path
- ΏۂƂȂ_hCupXk'\0'I[̕ւ̃|C^w肵܂BhCuԍ܂܂Ȃꍇ́AftHgEhCuw肵ƂɂȂ܂B
@@ -49,11 +49,11 @@ FRESULT f_mount (-FatFsW[ł́Aꂼ̘_hCut@CEVXeEIuWFNgƂ[NEGAKvłB̊͘_hCuɃt@CEVXeEIuWFNgo^薕肵܂B炩̃t@CgpOɁÅł̘_hCũt@CEVXeEIuWFNg^ĂȂȂ܂BfatfsɃkE|C^w肷ƁA̘_hCũt@CEVXeEIuWFNg̓o^͖邾łBo^ꂽt@CEVXeEIuWFNg͉̃ł܂BΏۂ̘_hCuɊJĂt@CfBNgꍇA͑SĖɂȂ܂B͎̊̓̂悤ȏɍs܂B
+FatFsW[ł́Aꂼ̘_hCut@CEVXeEIuWFNgƂ[NEGAKvłB̊͘_hCuɃt@CEVXeEIuWFNgo^薕肵܂B炩̃t@CgpOɁÅł̘_hCũt@CEVXeEIuWFNg^ĂȂȂ܂BfsɃkE|C^w肷ƁA̘_hCũt@CEVXeEIuWFNg̓o^͖邾łBo^ꂽt@CEVXeEIuWFNg͉̃ł܂BΏۂ̘_hCuɊJĂt@CfBNgꍇA͑SĖɂȂ܂B͎̊̓̂悤ȏɍs܂B
- Ώۂ̘_hCupath瓾B
- ɓo^Ăt@CEVXeEIuWFNg̓NAAo^B
-- fatfsLȃ|C^̂Ƃ́Ãt@CEVXeEIuWFNgNAo^B
+- fsLȃ|C^̂Ƃ́Ãt@CEVXeEIuWFNgNAo^B
- }Eg삪w肳ĂƂ́AsB
opt0w肷ƁA}Eg(hCȕAFAT{[̌ABPB͂t@CEVXeEIuWFNg)͍sꂸA͕hCȕԂɊւ炸ɐ܂Bł͉ʃCւ̃ANZX͔Aw肳ꂽt@CEVXeEIuWFNgNA()ÃAhXzɓo^邾łBPɓo^ς݂̃t@CEVXeEIuWFNgNAړIɂg܂BāAă{[ւ̃ANZXsꂽƂ̂ꂩł^̏ꍇ́Aۂ̃}Eg삪s܂B
diff --git a/doc/ja/open.html b/doc/ja/open.html index a89a178..a4c4a18 100644 --- a/doc/ja/open.html +++ b/doc/ja/open.html @@ -17,7 +17,7 @@FRESULT f_open ( FIL* fp, /* [OUT] ̃t@CEIuWFNg\̂ւ̃|C^ */ - const TCHAR* path, /* [IN] t@C̃tpXւ̃|C^ */ + const TCHAR* path, /* [IN] t@Cւ̃|C^ */ BYTE mode /* [IN] [htO */ );@@ -29,7 +29,7 @@ FRESULT f_open (- fp
- V쐬t@CEIuWFNg\̂ւ̃|C^w肵܂Bȍ~Ãt@C܂ł̃t@CEIuWFNggpăt@C܂B
- path
-- J(܂͍쐬)t@C t@Ck'\0'I[̕ւ̃|C^w肵܂B
+- Jt@Ct@Ck'\0'I[̕ւ̃|C^w肵܂B
- mode
- t@C̃ANZX@I[v@߂tOłB̃p[^ɂ͎̑gݍ킹w肵܂B
@@ -103,15 +103,15 @@ int main (void) f_mount(&FatFs, "", 0); /* eLXgEt@CJ */ - fr = f_open(&fil, "message.txt", FA_READ); + fr = f_open(&fil, "message.txt", FA_READ); if (fr) return (int)fr; /* 1sǂݏoĕ\ */ - while (f_gets(line, sizeof line, &fil)) + while (f_gets(line, sizeof line, &fil)) printf(line); /* t@C */ - f_close(&fil); + f_close(&fil); return 0; } diff --git a/doc/ja/printf.html b/doc/ja/printf.html index 2f5f730..b5c22e0 100644 --- a/doc/ja/printf.html +++ b/doc/ja/printf.html @@ -56,8 +56,8 @@ int f_printf (
@@ -66,14 +66,17 @@ int f_printf (Ή
-_FS_READONLY == 0ŁA_USE_STRFUNC 1܂ 2̂Ƃgp\ɂȂ܂B2̎́Ao͂Ɋ܂܂'\n'"\r\n"ɓWJăt@Cɏ܂܂B
-APIUnicodeI(_LFN_UNICODE1)ĂƂ́AfmtUnicodeɂȂ܂At@C̃GR[h́A_STRF_ENCODEIvVőIł܂BȊO͖̎ϊ(1oCg/1)ŏ݂܂B
+_FS_READONLY == 0ŁA_USE_STRFUNC1܂2̂Ƃgp\ɂȂ܂B2̎́Ao͂Ɋ܂܂'\n''\r'+'\n'ɓWJăt@Cɏ܂܂B
+APIUnicodeI(_LFN_UNICODE1)ĂƂ́AfmtUnicodeɂȂ܂At@C̃GR[h́A_STRF_ENCODEIvVőIł܂BȊO͖̎ϊ(1oCg/1)ŏ݂܂B
f_printf(&fil, "%d", 1234); /* "1234" */ f_printf(&fil, "%6d,%3d%%", -200, 5); /* " -200, 5%" */ - f_printf(&fil, "%-6u", 100); /* "100 " */ - f_printf(&fil, "%ld", 12345678L); /* "12345678" */ - f_printf(&fil, "%04x", 0xAB); /* "00ab" */ + f_printf(&fil, "%ld", 12345L); /* "12345" */ + f_printf(&fil, "%06d", 25); /* "000025" */ + f_printf(&fil, "%06d", -25); /* "000-25" */ + f_printf(&fil, "%-6d", 25); /* "25 " */ + f_printf(&fil, "%u", -1); /* "65535" or "4294967295" */ + f_printf(&fil, "%04x", 0xAB3); /* "0ab3" */ f_printf(&fil, "%08LX", 0x123ABCL); /* "00123ABC" */ f_printf(&fil, "%016b", 0x550F); /* "0101010100001111" */ f_printf(&fil, "%s", "String"); /* "String" */ - f_printf(&fil, "%5s", "abc"); /* " abc" */ - f_printf(&fil, "%-5s", "abc"); /* "abc " */ + f_printf(&fil, "%8s", "abc"); /* " abc" */ + f_printf(&fil, "%-8s", "abc"); /* "abc " */ f_printf(&fil, "%c", 'a'); /* "a" */ f_printf(&fil, "%f", 10.0); /* _͖T|[g */diff --git a/doc/ja/putc.html b/doc/ja/putc.html index f74c073..724f4c2 100644 --- a/doc/ja/putc.html +++ b/doc/ja/putc.html @@ -36,7 +36,7 @@ int f_putc (@@ -48,7 +48,7 @@ int f_putc (߂l
ɏ܂ƏԂ܂BfBXNt܂̓G[ɂ菑܂ȂƂEOF (-1)Ԃ܂B
-APIUnicodeI(_LFN_UNICODE1)ĂƂ́AchrUTF-16ɂȂ܂At@C̃GR[h́A_STRF_ENCODEIvVőIł܂BȊO͖̎ϊ(1oCg/1)ŏ݂܂B
+APIUnicodeI(_LFN_UNICODE1)ĂƂ́AchrUTF-16ɂȂ܂At@C̃GR[h́A_STRF_ENCODEIvVőIł܂BȊO͖̎ϊ(1oCg/1)ŏ݂܂B
diff --git a/doc/ja/puts.html b/doc/ja/puts.html index 59ef96d..d815311 100644 --- a/doc/ja/puts.html +++ b/doc/ja/puts.html @@ -36,7 +36,7 @@ int f_puts (Ή
-_FS_READONLY == 0ŁA_USE_STRFUNC 1܂ 2̂Ƃgp\łB2w肷ƁA'\n'"\r\n"ɓWJăt@Cɏ܂܂B
+_FS_READONLY == 0ŁA_USE_STRFUNC 1܂ 2̂Ƃgp\łB2w肷ƁA'\n''\r'+'\n'ɓWJăt@Cɏ܂܂B
@@ -48,7 +48,7 @@ int f_puts (߂l
ɏ܂ƁA܂ꂽԂ܂BfBXNt܂̓G[ɂ菑݂fꂽƂEOF (-1)Ԃ܂B
-APIUnicodeI(_LFN_UNICODE1)ĂƂ́AstrUTF-16ɂȂ܂At@C̃GR[h́A_STRF_ENCODEIvVőIł܂BȊO͖̎ϊ(1oCg/1)ŏ݂܂B
+APIUnicodeI(_LFN_UNICODE1)ĂƂ́AstrUTF-16ɂȂ܂At@C̃GR[h́A_STRF_ENCODEIvVőIł܂BȊO͖̎ϊ(1oCg/1)ŏ݂܂B
diff --git a/doc/ja/rc.html b/doc/ja/rc.html index eaed5a0..8bcfb24 100644 --- a/doc/ja/rc.html +++ b/doc/ja/rc.html @@ -17,15 +17,14 @@Ή
-_FS_READONLY == 0ŁA_USE_STRFUNC 1܂ 2̂Ƃgp\łB2w肷ƁAɊ܂܂'\n'"\r\n"ɓWJăt@Cɏ܂܂B
+_FS_READONLY == 0ŁA_USE_STRFUNC1܂2̂Ƃgp\łB2w肷ƁAɊ܂܂'\n''\r'+'\n'ɓWJăt@Cɏ܂܂B
- FR_OK (0)
- 関数は成功した。
- FR_DISK_ERR
-- 下位レイヤ(disk_read(), disk_write(), disk_ioctl()関数)で回復不能なエラーが発生した。
+- 下位レイヤ(disk_read(), disk_write(), disk_ioctl()関数)で回復不能なエラーが発生した。
※開かれたファイルの操作においてこのエラーが発生すると、そのファイル・オブジェクトはアボート状態となり、クローズ以外のの操作ができなくなります。- FR_INT_ERR
- 内部処理の健全性に異常が検出された。原因としては次のようなことが考えられます。
+※開かれたファイルの操作においてこのエラーが発生すると、そのファイル・オブジェクトはアボート状態となり、クローズ以外の操作ができなくなります。-
- ボリューム上のFAT構造にエラーがある。
-- スタック不足や他のタスク等によるワーク・エリア(ファイル・システム・オブジェクトやファイル・オブジェクト)の破壊。多くはこれが原因。
-- そのファイルオブジェクトでは過去にFR_DISK_ERRが発生している。
+- スタック不足や不正なメモリ操作等によるワーク・エリアの破壊。多くはこれが原因。
- FR_NOT_READY
- 物理ドライブが動作可能な状態にない。または、ドライブの初期化に失敗した。
- FR_NO_FILE
@@ -40,20 +39,19 @@- 書き込み禁止属性(AM_RDO)を持つファイルを書き込みモードで開こうとした。
- 書き込み禁止属性を持つファイルやディレクトリを削除しようとした。
- 空でないディレクトリまたはカレント・ディレクトリを削除しようとした。
-- FA_READを付けずに開いたファイルに対して読み出しを行った。
-- FA_WRITEを付けずに開いたファイルに対して変更操作を行った。
-- ディレクトリ・テーブルが満杯でファイルやディレクトリを作成できなかった。
-- ボリュームが満杯でディレクトリを作成できなかった。
+- FA_READフラグを付けずに開いたファイルに対して読み出しを行った。
+- FA_WRITEフラグを付けずに開いたファイルに対して書き込みまたはそれに類する操作を行った。
+- ボリュームまたはディレクトリ・テーブルが満杯でファイルやディレクトリを作成できなかった。
- FR_EXIST
- 新しく作成しようとしたオブジェクトと同じ名前のオブジェクトが既に存在する。
- FR_INVALID_OBJECT
-- 指定されたファイル・オブジェクトやディレクトリ・オブジェクトが無効(オープンされていない、既に閉じられた、破損しているなど)、またはヌル・ポインタが渡された。また、開かれたままのオブジェクトは、そのボリュームのマウント動作により無効となります。
+- 指定されたファイル・オブジェクトやディレクトリ・オブジェクトが無効(オープンされていない、既に閉じられた、破損しているなど)、またはヌル・ポインタが渡された。また、開かれたままのオブジェクトは、それの属するボリュームのマウント動作により無効となります。
- FR_WRITE_PROTECTED
-- 物理ドライブが書き込み禁止状態のとき、書き込み系の操作を行おうとした。
+- 物理ドライブが書き込み禁止状態のとき、書き込みを伴う操作を行おうとした。
- FR_INVALID_DRIVE
-- パス名で指定されたドライブ番号が無効、またはパス名にヌル・ポインタが渡された。(関連オプション: _VOLUMES)
+- パス名中に指定されたドライブ番号が無効、またはパス名にヌル・ポインタが渡された。(関連オプション: _VOLUMES)
- FR_NOT_ENABLED
- そのボリュームの操作に必要なワーク・エリア(ファイル・システム・オブジェクト構造体)が与えられていない。
- FR_NO_FILESYSTEM
@@ -63,13 +61,13 @@
- ボリュームが小さすぎる。
- FATタイプの計算に矛盾が見つかった。クラスタ数がFATタイプの境界付近になるときに発生する場合があります。
-- 論理ドライブに対応する区画が見つからなかった。(関連オプション: _MULTI_PARTITION)
+- その論理ドライブに対応する区画が見つからなかった。(関連オプション: _MULTI_PARTITION)
- FR_TIMEOUT
- 再入制御による待ち時間が定義された時間を越えたため、関数は実行されなかった。(関連オプション: _TIMEOUT)
- FR_LOCKED
-- 多重アクセス排他機能により、そのファイルに対して行おうとしたアクセスが拒否された。(関連オプション: _FS_LOCK)
+- 多重アクセス排他機能により、そのファイルやディレクトリに対して行おうとしたアクセスが拒否された。(関連オプション: _FS_LOCK)
- FR_NOT_ENOUGH_CORE
- メモリ不足による失敗。原因としては次のようなことが考えられます。
diff --git a/doc/ja/readdir.html b/doc/ja/readdir.html index 3844809..bd1c34e 100644 --- a/doc/ja/readdir.html +++ b/doc/ja/readdir.html @@ -13,7 +13,7 @@
f_readdir
-fBNgڂǂݏo܂
+fBNgڂǂݏo܂B
FRESULT f_readdir ( DIR* dp, /* [IN] fBNgEuWFNg\̂ւ̃|C^ */ @@ -49,8 +49,9 @@ FRESULT f_readdir (-fBNg̍(t@CƃfBNg)ǂݏo܂B̊JԂs邱Ƃɂ肻̃fBNg̑SĂ̍ڂǂݏoƂł܂BSĂ̍ڂǂݏoAǂݏoڂƂ́Afname[]oɃkԂ܂BhbgEGg("."A"..")́ApXLȂƂ(_FS_RPATH >= 1)ɂ̂܂Bt@C̏ڍׂɂĂ FILINFO\̂QƂĂBfnoɃkE|C^w肷ƁÃfBNg̃[hECfbNX擪Ɋ߂܂B
-LFN@\LȎ́Af_readdir()̌Ăяoɐ旧FILINFO\̂lfnamelfsizeLȒlŏĂȂȂ܂BlfnameLFNi[obt@ŁAlfsize͂̃obt@̗vfłBLFNǂݏoKvȂƂ́AlfnameɃkE|C^ZbgĂB̏ɈłYꍇ́ALFNi[obt@ɃkԂ܂B
+fBNg̍(t@CƃfBNg)ǂݏo܂B̊JԂs邱Ƃɂ肻̃fBNg̑SĂ̍ڂǂݏoƂł܂Bt@C̏ڍׂɂĂ FILINFO\̂QƂĂBSĂ̍ڂǂݏoAǂݏoڂƂ́Afname[]oɃkԂ܂BfnoɃkE|C^w肷ƁÃfBNg̃[hECfbNX擪Ɋ߂܂B܂Å͎Ɏ悤Ɋ֘A\IvVɂ蓮삪ς܂B
+hbgEGg("."A"..")́ApXLȂƂ(_FS_RPATH >= 1)ɂ̂ݏo͂Ɍ܂B
+LFN@\LȎ́Å̌Ăяoɐ旧FILINFO\̂lfnamelfsizeLȒlŏĂȂȂ܂BlfnameLFNi[obt@ŁAlfsize͂̃obt@̗vfłBLFNǂݏoKvȂƂ́AlfnameɃkE|C^ZbgĂB̏ɈłYꍇ́ALFNi[obt@ɃkԂ܂B
- fBNgڂLFN݂ȂB
- LFN̒ɑLFNi[obt@܂LFNobt@̃TCYs\B
diff --git a/doc/ja/rename.html b/doc/ja/rename.html index 03e3aff..0eafa49 100644 --- a/doc/ja/rename.html +++ b/doc/ja/rename.html @@ -13,7 +13,7 @@f_rename
-t@C܂̓TuEfBNg̖O̕ύX܂͈ړB
+t@C܂̓TuEfBNg̖O̕ύX܂͈ړ܂B
FRESULT f_rename ( const TCHAR* old_name, /* [IN] ÂIuWFNg */ diff --git a/doc/ja/sdir.html b/doc/ja/sdir.html index e241b72..3e6f712 100644 --- a/doc/ja/sdir.html +++ b/doc/ja/sdir.html @@ -28,8 +28,8 @@ UINT lockid; /* bNID */ #endif #if _USE_LFN - WCHAR* lfn; /* LFNobt@ւ̃|C^ */ - WORD lfn_idx; /* ŌɃ}b`LFNGg̐擪CfbNX (0xFFFF:) */ + WCHAR* lfn; /* LFNobt@ւ̃|C^ (in/out) */ + WORD lfn_idx; /* LFNGg̐擪CfbNX (0xFFFF:) */ #endif } DIR;diff --git a/doc/ja/setlabel.html b/doc/ja/setlabel.html index 5adc57b..af4a243 100644 --- a/doc/ja/setlabel.html +++ b/doc/ja/setlabel.html @@ -13,10 +13,10 @@@@ -24,8 +24,8 @@ FRESULT f_setlabel (f_setlabel
-{[Ex݂܂B
+{[Ƀ{[Exݒ肵܂B
FRESULT f_setlabel ( - const TCHAR* name /* [IN] ݒ肷{[ւ̃|C^ */ + const TCHAR* label /* [IN] ݒ肷{[Exւ̃|C^ */ );@@ -49,11 +49,11 @@ FRESULT f_setlabel (-
- name
-- ݒ肷{[k'\0'I[̕ւ̃|C^w肵܂B
+- label
+- ݒ肷{[Exk'\0'I[̕ւ̃|C^w肵܂B
-@@ -66,13 +66,13 @@ FRESULT f_setlabel (̐擪ɃhCuԍ܂ޏꍇ́A̘_hCuɐݒ肳܂B܂܂Ȃꍇ́AftHgEhCuɐݒ肳܂B{[폜Ƃ́Akw肵܂BÕtH[}bǵAZt@CƂقړłA̓_قȂ܂B
+̐擪ɃhCuԍ܂ޏꍇ́A̘_hCuɑĐݒ肳܂B܂܂Ȃꍇ́AftHgEhCuɐݒ肳܂B{[Ex폜Ƃ́Akw肵܂B{[Ex̃tH[}bǵAt@C(SFN)ƂقړłA̓_قȂ܂B
-
- [JER[hZ11oCgȉB
+- [JR[hZ11oCgȉBLFNg͓Kp܂B
- sIh܂ނƂ͂łȂB
-- Cӂ̈ʒuɃXy[XuƂłBAŌ̃Xy[X͏B
+- Cӂ̈ʒuɃXy[XuƂłBAŌƂȂXy[X͏B
diff --git a/doc/ja/sfatfs.html b/doc/ja/sfatfs.html index 1411190..ed5ac87 100644 --- a/doc/ja/sfatfs.html +++ b/doc/ja/sfatfs.html @@ -13,7 +13,7 @@gp
- /* ftHgEhCuɃ{[ݒ */ + /* ftHgEhCuɃ{[Exݒ */ f_setlabel("DATA DISK"); - /* hCu2Ƀ{[ݒ */ + /* hCu2Ƀ{[Exݒ */ f_setlabel("2:DISK 3 OF 4"); - /* hCu2̃{[폜 */ + /* hCu2̃{[Ex폜 */ f_setlabel("2:");FATFS
-FATFS\(t@CEVXeEIuWFNg)́AX̘_hCũ_Ci~bNE[NEGAێAf_mount()FatFsW[ɓo^܂Bs^C~ÓAf_mount()܂̓fBǍ̍ŏ̃t@CEANZX̎łBAvP[V́A̍\̂̃oĂ͂Ȃ܂B
+FATFS\(t@CEVXeEIuWFNg)́AX̘_hCũ_Ci~bNE[NEGAێAf_mount()FatFsW[ɓo^܂Bs^C~ÓAf_mount()(}Egw)̎s܂̓fBǍ̍ŏ̃t@CEANZX̎łBAvP[V́A̍\̂̃oĂ͂Ȃ܂B
typedef struct { @@ -25,7 +25,7 @@ BYTE fsi_flag; /* FSINFOtO (b7:Disabled, b0:Dirty)*/ WORD id; /* t@CEVXeE}EgID */ WORD n_rootdir; /* [gEfBNg̃Gg (FAT12/16) */ -#if _MAX_SS != 512 +#if _MAX_SS != _MIN_SS WORD ssize; /* ZN^ETCY (512, 1024, 2048 or 4096) */ #endif #if _FS_REENTRANT diff --git a/doc/ja/stat.html b/doc/ja/stat.html index c441c64..5337f34 100644 --- a/doc/ja/stat.html +++ b/doc/ja/stat.html @@ -54,7 +54,7 @@ FRESULT f_stat (-diff --git a/doc/ja/sync.html b/doc/ja/sync.html index e082808..74f7910 100644 --- a/doc/ja/sync.html +++ b/doc/ja/sync.html @@ -46,7 +46,7 @@ FRESULT f_sync (w肳ꂽt@C܂̓TuEfBNgׁ݂̑Aւ(TCYA^CX^vё)܂B݂ꍇFR_OKAAt@C\̂ɂ̏XgA܂B݂Ȃꍇ́AFR_NO_FILEA܂B
+w肳ꂽt@C܂̓TuEfBNgׂ݂̑܂B݂Ȃꍇ́AFR_NO_FILEA܂B݂ꍇFR_OKAAt@C\̂ɂւ(TCYA^CX^vAђZt@C)XgA܂B
diff --git a/doc/ja/unlink.html b/doc/ja/unlink.html index c7f8962..7cfb703 100644 --- a/doc/ja/unlink.html +++ b/doc/ja/unlink.html @@ -54,11 +54,11 @@ FRESULT f_unlink (̊f_close()Ɠs܂At@C͈Jꂽ܂܂ɂȂAǂݏsł܂BMOȂǁA݃[hŒԃt@CJĂAvP[VɂāAI܂̗͋ǂƂł̊gp邱ƂɂAsӂ̓dffBA̎Oɂ莸f[^ŏɂ邱Ƃł܂B̔wiɂẮAAvP[VEm[gQƂĂB
-ۂ̂ƂAf_close()ł͂̊Ăяot@CEIuWFNgĂ邾Ȃ̂ŁAf_close()Of_sync()͈Ӗ܂B
+ۂ̂ƂAf_close()ł͂̊Ăяot@CEIuWFNgĂ邾Ȃ̂ŁAf_close()Of_sync()uƂ͖ӖłB
-diff --git a/doc/updates.txt b/doc/updates.txt index 96e8d93..f3054ed 100644 --- a/doc/updates.txt +++ b/doc/updates.txt @@ -1,33 +1,37 @@ -R0.10a, Jan 15,'14 - Added arbitrary strings as drive number in the path name. (_STR_VOLUME_ID) - Added a configuration option of minimum sector size. (_MIN_SS) - 2nd argument of f_rename() can have a drive number and it will be ignored. - Fixed f_mount() with forced mount fails when drive number is >= 1. - Fixed f_close() invalidates the file object without volume lock. - Fixed f_closedir() returns but the volume lock is left acquired. - Fixed creation of an entry with LFN fails on too many SFN collisions. +R0.10b, May 19, 2014 + Fixed a hard error in the disk I/O layer can collapse the directory entry. + Fixed LFN entry is not deleted on delete/rename an object with its lossy converted SFN. -R0.10, Oct 02,'13 - Added selection of character encoding on the file. (_STRF_ENCODE) +R0.10a, Jan 15, 2014 + Added arbitrary strings as drive number in the path name. (_STR_VOLUME_ID) + Added an option for minimum sector size. (_MIN_SS) + 2nd argument of f_rename() can have a drive number and it will be ignored. + Fixed f_mount() with forced mount fails when drive number is larger than 0. + Fixed f_close() invalidates the file object without volume lock. + Fixed volume lock is left acquired after return from f_closedir(). + Fixed creation of a directory entry with LFN fails on too many SFN collisions. + +R0.10, Oct 02, 2013 + Added an option for character encoding on the file. (_STRF_ENCODE) Added f_closedir(). - Added forced full FAT scan for f_getfree(). (_FS_NOFSINFO) + Added forced full FAT scan option for f_getfree(). (_FS_NOFSINFO) Added forced mount feature with changes of f_mount(). Improved behavior of volume auto detection. Improved write throughput of f_puts() and f_printf(). Changed argument of f_chdrive(), f_mkfs(), disk_read() and disk_write(). Fixed f_write() can be truncated when the file size is close to 4GB. - Fixed f_open(), f_mkdir() and f_setlabel() can return incorrect error code. + Fixed f_open(), f_mkdir() and f_setlabel() can return incorrect result code on error. R0.09b, Jan 24, 2013 Added f_getlabel() and f_setlabel(). (_USE_LABEL = 1) R0.09a, Aug 27, 2012 - Fixed assertion failure due to OS/2 EA on FAT12/16. - Changed API rejects null object pointer to avoid crash. + Fixed assertion failure due to OS/2 EA on FAT12/16 volume. + Changed file functions reject null object pointer to avoid crash. Changed option name _FS_SHARE to _FS_LOCK. R0.09, Sep 06, 2011 - f_mkfs() supports multiple partition to finish the multiple partition feature. + f_mkfs() supports multiple partition to complete the multiple partition feature. Added f_fdisk(). (_MULTI_PARTITION = 2) R0.08b, Jan 15, 2011 diff --git a/src/00readme.txt b/src/00readme.txt index 4555b1a..7285d33 100644 --- a/src/00readme.txt +++ b/src/00readme.txt @@ -1,4 +1,4 @@ -FatFs Module Source Files R0.10a (C)ChaN, 2014 +FatFs Module Source Files R0.10b (C)ChaN, 2014 FILES @@ -153,3 +153,6 @@ REVISION HISTORY Fixed f_close() invalidates the file object without volume lock. Fixed f_closedir() returns but the volume lock is left acquired. Fixed creation of an entry with LFN fails on too many SFN collisions. + + Mar 19,'14 R0.10b Fixed a hard error in the disk I/O layer can collapse the directory entry. + Fixed LFN entry is not deleted on delete/rename an object with lossy converted SFN. diff --git a/src/diskio.c b/src/diskio.c index 64194eb..169ae95 100644 --- a/src/diskio.c +++ b/src/diskio.c @@ -1,10 +1,10 @@ /*-----------------------------------------------------------------------*/ -/* Low level disk I/O module skeleton for FatFs (C)ChaN, 2013 */ +/* Low level disk I/O module skeleton for FatFs (C)ChaN, 2014 */ /*-----------------------------------------------------------------------*/ /* If a working storage control module is available, it should be */ /* attached to the FatFs via a glue function rather than modifying it. */ /* This is an example of glue functions to attach various exsisting */ -/* storage control module to the FatFs module with a defined API. */ +/* storage control modules to the FatFs module with a defined API. */ /*-----------------------------------------------------------------------*/ #include "diskio.h" /* FatFs lower layer API */ @@ -12,56 +12,18 @@ #include "atadrive.h" /* Example: ATA drive control */ #include "sdcard.h" /* Example: MMC/SDC contorl */ -/* Definitions of physical drive number for each media */ -#define ATA 0 -#define MMC 1 -#define USB 2 +/* Definitions of physical drive number for each drive */ +#define ATA 0 /* Example: Map ATA drive to drive number 0 */ +#define MMC 1 /* Example: Map MMC/SD card to drive number 1 */ +#define USB 2 /* Example: Map USB drive to drive number 2 */ /*-----------------------------------------------------------------------*/ -/* Inidialize a Drive */ -/*-----------------------------------------------------------------------*/ - -DSTATUS disk_initialize ( - BYTE pdrv /* Physical drive nmuber (0..) */ -) -{ - DSTATUS stat; - int result; - - switch (pdrv) { - case ATA : - result = ATA_disk_initialize(); - - // translate the reslut code here - - return stat; - - case MMC : - result = MMC_disk_initialize(); - - // translate the reslut code here - - return stat; - - case USB : - result = USB_disk_initialize(); - - // translate the reslut code here - - return stat; - } - return STA_NOINIT; -} - - - -/*-----------------------------------------------------------------------*/ -/* Get Disk Status */ +/* Get Drive Status */ /*-----------------------------------------------------------------------*/ DSTATUS disk_status ( - BYTE pdrv /* Physical drive nmuber (0..) */ + BYTE pdrv /* Physical drive nmuber to identify the drive */ ) { DSTATUS stat; @@ -94,15 +56,53 @@ DSTATUS disk_status ( +/*-----------------------------------------------------------------------*/ +/* Inidialize a Drive */ +/*-----------------------------------------------------------------------*/ + +DSTATUS disk_initialize ( + BYTE pdrv /* Physical drive nmuber to identify the drive */ +) +{ + DSTATUS stat; + int result; + + switch (pdrv) { + case ATA : + result = ATA_disk_initialize(); + + // translate the reslut code here + + return stat; + + case MMC : + result = MMC_disk_initialize(); + + // translate the reslut code here + + return stat; + + case USB : + result = USB_disk_initialize(); + + // translate the reslut code here + + return stat; + } + return STA_NOINIT; +} + + + /*-----------------------------------------------------------------------*/ /* Read Sector(s) */ /*-----------------------------------------------------------------------*/ DRESULT disk_read ( - BYTE pdrv, /* Physical drive nmuber (0..) */ + BYTE pdrv, /* Physical drive nmuber to identify the drive */ BYTE *buff, /* Data buffer to store read data */ - DWORD sector, /* Sector address (LBA) */ - UINT count /* Number of sectors to read (1..128) */ + DWORD sector, /* Sector address in LBA */ + UINT count /* Number of sectors to read */ ) { DRESULT res; @@ -136,6 +136,7 @@ DRESULT disk_read ( return res; } + return RES_PARERR; } @@ -147,10 +148,10 @@ DRESULT disk_read ( #if _USE_WRITE DRESULT disk_write ( - BYTE pdrv, /* Physical drive nmuber (0..) */ + BYTE pdrv, /* Physical drive nmuber to identify the drive */ const BYTE *buff, /* Data to be written */ - DWORD sector, /* Sector address (LBA) */ - UINT count /* Number of sectors to write (1..128) */ + DWORD sector, /* Sector address in LBA */ + UINT count /* Number of sectors to write */ ) { DRESULT res; @@ -184,6 +185,7 @@ DRESULT disk_write ( return res; } + return RES_PARERR; } #endif @@ -205,32 +207,24 @@ DRESULT disk_ioctl ( switch (pdrv) { case ATA : - // pre-process here - result = ATA_disk_ioctl(cmd, buff); - - // post-process here + // Process of the command for the ATA drive return res; case MMC : - // pre-process here - result = MMC_disk_ioctl(cmd, buff); - - // post-process here + // Process of the command for the MMC/SD card return res; case USB : - // pre-process here - result = USB_disk_ioctl(cmd, buff); - - // post-process here + // Process of the command the USB drive return res; } + return RES_PARERR; } #endif diff --git a/src/ff.c b/src/ff.c index d8e1f07..2edbe32 100644 --- a/src/ff.c +++ b/src/ff.c @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------/ -/ FatFs - FAT file system module R0.10a (C)ChaN, 2014 +/ FatFs - FAT file system module R0.10b (C)ChaN, 2014 /-----------------------------------------------------------------------------/ / FatFs module is a generic FAT file system module for small embedded systems. / This is a free software that opened for education, research and commercial @@ -111,6 +111,8 @@ / Fixed f_close() invalidates the file object without volume lock. / Fixed f_closedir() returns but the volume lock is left acquired. / Fixed creation of an entry with LFN fails on too many SFN collisions. +/ May 19,'14 R0.10b Fixed a hard error in the disk I/O layer can collapse the directory entry. +/ Fixed LFN entry is not deleted on delete/rename an object with lossy converted SFN. /---------------------------------------------------------------------------*/ #include "ff.h" /* Declarations of FatFs API */ @@ -125,7 +127,7 @@ ---------------------------------------------------------------------------*/ -#if _FATFS != 29000 /* Revision ID */ +#if _FATFS != 8051 /* Revision ID */ #error Wrong include file (ff.h). #endif @@ -150,7 +152,7 @@ #error Wrong sector size configuration. #endif #if _MAX_SS == _MIN_SS -#define SS(fs) ((UINT)_MIN_SS) /* Fixed sector size */ +#define SS(fs) ((UINT)_MAX_SS) /* Fixed sector size */ #else #define SS(fs) ((fs)->ssize) /* Variable sector size */ #endif @@ -162,10 +164,10 @@ #error _FS_LOCK must be 0 at read-only cfg. #endif typedef struct { - FATFS *fs; /* Object ID 1, volume (NULL:blank entry) */ - DWORD clu; /* Object ID 2, directory */ - WORD idx; /* Object ID 3, directory index */ - WORD ctr; /* Object open counter, 0:none, 0x01..0xFF:read mode open count, 0x100:write mode */ + FATFS *fs; /* Object ID 1, volume (NULL:blank entry) */ + DWORD clu; /* Object ID 2, directory (0:root) */ + WORD idx; /* Object ID 3, directory index */ + WORD ctr; /* Object open counter, 0:none, 0x01..0xFF:read mode open count, 0x100:write mode */ } FILESEM; #endif @@ -414,61 +416,61 @@ typedef struct { / structure member because the structure is not binary compatible between / different platforms */ -#define BS_jmpBoot 0 /* Jump instruction (3) */ -#define BS_OEMName 3 /* OEM name (8) */ -#define BPB_BytsPerSec 11 /* Sector size [byte] (2) */ -#define BPB_SecPerClus 13 /* Cluster size [sector] (1) */ -#define BPB_RsvdSecCnt 14 /* Size of reserved area [sector] (2) */ -#define BPB_NumFATs 16 /* Number of FAT copies (1) */ -#define BPB_RootEntCnt 17 /* Number of root directory entries for FAT12/16 (2) */ -#define BPB_TotSec16 19 /* Volume size [sector] (2) */ -#define BPB_Media 21 /* Media descriptor (1) */ -#define BPB_FATSz16 22 /* FAT size [sector] (2) */ -#define BPB_SecPerTrk 24 /* Track size [sector] (2) */ -#define BPB_NumHeads 26 /* Number of heads (2) */ -#define BPB_HiddSec 28 /* Number of special hidden sectors (4) */ -#define BPB_TotSec32 32 /* Volume size [sector] (4) */ -#define BS_DrvNum 36 /* Physical drive number (2) */ -#define BS_BootSig 38 /* Extended boot signature (1) */ -#define BS_VolID 39 /* Volume serial number (4) */ -#define BS_VolLab 43 /* Volume label (8) */ -#define BS_FilSysType 54 /* File system type (1) */ -#define BPB_FATSz32 36 /* FAT size [sector] (4) */ -#define BPB_ExtFlags 40 /* Extended flags (2) */ -#define BPB_FSVer 42 /* File system version (2) */ -#define BPB_RootClus 44 /* Root directory first cluster (4) */ -#define BPB_FSInfo 48 /* Offset of FSINFO sector (2) */ -#define BPB_BkBootSec 50 /* Offset of backup boot sector (2) */ -#define BS_DrvNum32 64 /* Physical drive number (2) */ -#define BS_BootSig32 66 /* Extended boot signature (1) */ -#define BS_VolID32 67 /* Volume serial number (4) */ -#define BS_VolLab32 71 /* Volume label (8) */ -#define BS_FilSysType32 82 /* File system type (1) */ -#define FSI_LeadSig 0 /* FSI: Leading signature (4) */ -#define FSI_StrucSig 484 /* FSI: Structure signature (4) */ -#define FSI_Free_Count 488 /* FSI: Number of free clusters (4) */ -#define FSI_Nxt_Free 492 /* FSI: Last allocated cluster (4) */ -#define MBR_Table 446 /* MBR: Partition table offset (2) */ -#define SZ_PTE 16 /* MBR: Size of a partition table entry */ -#define BS_55AA 510 /* Boot sector signature (2) */ +#define BS_jmpBoot 0 /* Jump instruction (3) */ +#define BS_OEMName 3 /* OEM name (8) */ +#define BPB_BytsPerSec 11 /* Sector size [byte] (2) */ +#define BPB_SecPerClus 13 /* Cluster size [sector] (1) */ +#define BPB_RsvdSecCnt 14 /* Size of reserved area [sector] (2) */ +#define BPB_NumFATs 16 /* Number of FAT copies (1) */ +#define BPB_RootEntCnt 17 /* Number of root directory entries for FAT12/16 (2) */ +#define BPB_TotSec16 19 /* Volume size [sector] (2) */ +#define BPB_Media 21 /* Media descriptor (1) */ +#define BPB_FATSz16 22 /* FAT size [sector] (2) */ +#define BPB_SecPerTrk 24 /* Track size [sector] (2) */ +#define BPB_NumHeads 26 /* Number of heads (2) */ +#define BPB_HiddSec 28 /* Number of special hidden sectors (4) */ +#define BPB_TotSec32 32 /* Volume size [sector] (4) */ +#define BS_DrvNum 36 /* Physical drive number (2) */ +#define BS_BootSig 38 /* Extended boot signature (1) */ +#define BS_VolID 39 /* Volume serial number (4) */ +#define BS_VolLab 43 /* Volume label (8) */ +#define BS_FilSysType 54 /* File system type (1) */ +#define BPB_FATSz32 36 /* FAT size [sector] (4) */ +#define BPB_ExtFlags 40 /* Extended flags (2) */ +#define BPB_FSVer 42 /* File system version (2) */ +#define BPB_RootClus 44 /* Root directory first cluster (4) */ +#define BPB_FSInfo 48 /* Offset of FSINFO sector (2) */ +#define BPB_BkBootSec 50 /* Offset of backup boot sector (2) */ +#define BS_DrvNum32 64 /* Physical drive number (2) */ +#define BS_BootSig32 66 /* Extended boot signature (1) */ +#define BS_VolID32 67 /* Volume serial number (4) */ +#define BS_VolLab32 71 /* Volume label (8) */ +#define BS_FilSysType32 82 /* File system type (1) */ +#define FSI_LeadSig 0 /* FSI: Leading signature (4) */ +#define FSI_StrucSig 484 /* FSI: Structure signature (4) */ +#define FSI_Free_Count 488 /* FSI: Number of free clusters (4) */ +#define FSI_Nxt_Free 492 /* FSI: Last allocated cluster (4) */ +#define MBR_Table 446 /* MBR: Partition table offset (2) */ +#define SZ_PTE 16 /* MBR: Size of a partition table entry */ +#define BS_55AA 510 /* Signature word (2) */ -#define DIR_Name 0 /* Short file name (11) */ -#define DIR_Attr 11 /* Attribute (1) */ -#define DIR_NTres 12 /* NT flag (1) */ -#define DIR_CrtTimeTenth 13 /* Created time sub-second (1) */ -#define DIR_CrtTime 14 /* Created time (2) */ -#define DIR_CrtDate 16 /* Created date (2) */ -#define DIR_LstAccDate 18 /* Last accessed date (2) */ -#define DIR_FstClusHI 20 /* Higher 16-bit of first cluster (2) */ -#define DIR_WrtTime 22 /* Modified time (2) */ -#define DIR_WrtDate 24 /* Modified date (2) */ -#define DIR_FstClusLO 26 /* Lower 16-bit of first cluster (2) */ -#define DIR_FileSize 28 /* File size (4) */ -#define LDIR_Ord 0 /* LFN entry order and LLE flag (1) */ -#define LDIR_Attr 11 /* LFN attribute (1) */ -#define LDIR_Type 12 /* LFN type (1) */ -#define LDIR_Chksum 13 /* Sum of corresponding SFN entry */ -#define LDIR_FstClusLO 26 /* Filled by zero (0) */ +#define DIR_Name 0 /* Short file name (11) */ +#define DIR_Attr 11 /* Attribute (1) */ +#define DIR_NTres 12 /* NT flag (1) */ +#define DIR_CrtTimeTenth 13 /* Created time sub-second (1) */ +#define DIR_CrtTime 14 /* Created time (2) */ +#define DIR_CrtDate 16 /* Created date (2) */ +#define DIR_LstAccDate 18 /* Last accessed date (2) */ +#define DIR_FstClusHI 20 /* Higher 16-bit of first cluster (2) */ +#define DIR_WrtTime 22 /* Modified time (2) */ +#define DIR_WrtDate 24 /* Modified date (2) */ +#define DIR_FstClusLO 26 /* Lower 16-bit of first cluster (2) */ +#define DIR_FileSize 28 /* File size (4) */ +#define LDIR_Ord 0 /* LFN entry order and LLE flag (1) */ +#define LDIR_Attr 11 /* LFN attribute (1) */ +#define LDIR_Type 12 /* LFN type (1) */ +#define LDIR_Chksum 13 /* Sum of corresponding SFN entry */ +#define LDIR_FstClusLO 26 /* Filled by zero (0) */ #define SZ_DIR 32 /* Size of a directory entry */ #define LLE 0x40 /* Last long entry flag in LDIR_Ord */ #define DDE 0xE5 /* Deleted directory entry mark in DIR_Name[0] */ @@ -482,7 +484,7 @@ typedef struct { /*------------------------------------------------------------*/ /* Note that uninitialized variables with static duration are / guaranteed zero/null as initial value. If not, either the -/ compiler or start-up routine is out of ANSI-C standard. +/ linker or start-up routine is out of ANSI-C standard. */ #if _VOLUMES >= 1 || _VOLUMES <= 10 @@ -641,7 +643,7 @@ void unlock_fs ( static FRESULT chk_lock ( /* Check if the file can be accessed */ DIR* dp, /* Directory object pointing the file to be checked */ - int acc /* Desired access (0:Read, 1:Write, 2:Delete/Rename) */ + int acc /* Desired access type (0:Read, 1:Write, 2:Delete/Rename) */ ) { UINT i, be; @@ -1499,7 +1501,7 @@ FRESULT dir_find ( if (res != FR_OK) return res; #if _USE_LFN - ord = sum = 0xFF; + ord = sum = 0xFF; dp->lfn_idx = 0xFFFF; /* Reset LFN sequence */ #endif do { res = move_window(dp->fs, dp->sect); @@ -1510,22 +1512,22 @@ FRESULT dir_find ( #if _USE_LFN /* LFN configuration */ a = dir[DIR_Attr] & AM_MASK; if (c == DDE || ((a & AM_VOL) && a != AM_LFN)) { /* An entry without valid data */ - ord = 0xFF; + ord = 0xFF; dp->lfn_idx = 0xFFFF; /* Reset LFN sequence */ } else { if (a == AM_LFN) { /* An LFN entry is found */ if (dp->lfn) { if (c & LLE) { /* Is it start of LFN sequence? */ sum = dir[LDIR_Chksum]; c &= ~LLE; ord = c; /* LFN start order */ - dp->lfn_idx = dp->index; + dp->lfn_idx = dp->index; /* Start index of LFN */ } /* Check validity of the LFN entry and compare it with given name */ ord = (c == ord && sum == dir[LDIR_Chksum] && cmp_lfn(dp->lfn, dir)) ? ord - 1 : 0xFF; } } else { /* An SFN entry is found */ if (!ord && sum == sum_sfn(dir)) break; /* LFN matched? */ - ord = 0xFF; dp->lfn_idx = 0xFFFF; /* Reset LFN sequence */ if (!(dp->fn[NS] & NS_LOSS) && !mem_cmp(dir, dp->fn, 11)) break; /* SFN matched? */ + ord = 0xFF; dp->lfn_idx = 0xFFFF; /* Reset LFN sequence */ } } #else /* Non LFN configuration */ @@ -2678,7 +2680,7 @@ FRESULT f_write ( if (fp->fptr == 0) { /* On the top of the file? */ clst = fp->sclust; /* Follow from the origin */ if (clst == 0) /* When no cluster is allocated, */ - fp->sclust = clst = create_chain(fp->fs, 0); /* Create a new cluster chain */ + clst = create_chain(fp->fs, 0); /* Create a new cluster chain */ } else { /* Middle or end of the file */ #if _USE_FASTSEEK if (fp->cltbl) @@ -2691,6 +2693,7 @@ FRESULT f_write ( if (clst == 1) ABORT(fp->fs, FR_INT_ERR); if (clst == 0xFFFFFFFF) ABORT(fp->fs, FR_DISK_ERR); fp->clust = clst; /* Update current cluster */ + if (fp->sclust == 0) fp->sclust = clst; /* Set start cluster if the first write */ } #if _FS_TINY if (fp->fs->winsect == fp->dsect && sync_window(fp->fs)) /* Write-back sector cache */ @@ -3750,7 +3753,7 @@ FRESULT f_rename ( FRESULT f_getlabel ( const TCHAR* path, /* Path name of the logical drive number */ TCHAR* label, /* Pointer to a buffer to return the volume label */ - DWORD* sn /* Pointer to a variable to return the volume serial number */ + DWORD* vsn /* Pointer to a variable to return the volume serial number */ ) { FRESULT res; @@ -3794,11 +3797,11 @@ FRESULT f_getlabel ( } /* Get volume serial number */ - if (res == FR_OK && sn) { + if (res == FR_OK && vsn) { res = move_window(dj.fs, dj.fs->volbase); if (res == FR_OK) { i = dj.fs->fs_type == FS_FAT32 ? BS_VolID32 : BS_VolID; - *sn = LD_DWORD(&dj.fs->win[i]); + *vsn = LD_DWORD(&dj.fs->win[i]); } } diff --git a/src/ff.h b/src/ff.h index 97f4c20..9894921 100644 --- a/src/ff.h +++ b/src/ff.h @@ -1,5 +1,5 @@ /*---------------------------------------------------------------------------/ -/ FatFs - FAT file system module include file R0.10a (C)ChaN, 2014 +/ FatFs - FAT file system module include file R0.10b (C)ChaN, 2014 /----------------------------------------------------------------------------/ / FatFs module is a generic FAT file system module for small embedded systems. / This is a free software that opened for education, research and commercial @@ -15,7 +15,7 @@ /----------------------------------------------------------------------------*/ #ifndef _FATFS -#define _FATFS 29000 /* Revision ID */ +#define _FATFS 8051 /* Revision ID */ #ifdef __cplusplus extern "C" { @@ -53,7 +53,7 @@ extern PARTITION VolToPart[]; /* Volume - Partition resolution table */ #if _LFN_UNICODE /* Unicode string */ #if !_USE_LFN -#error _LFN_UNICODE must be 0 in non-LFN cfg. +#error _LFN_UNICODE must be 0 at non-LFN cfg. #endif #ifndef _INC_TCHAR typedef WCHAR TCHAR; @@ -96,7 +96,7 @@ typedef struct { #if _FS_RPATH DWORD cdir; /* Current directory start cluster (0:root) */ #endif - DWORD n_fatent; /* Number of FAT entries (= number of clusters + 2) */ + DWORD n_fatent; /* Number of FAT entries, = number of clusters + 2 */ DWORD fsize; /* Sectors per FAT */ DWORD volbase; /* Volume start sector */ DWORD fatbase; /* FAT start sector */ @@ -113,25 +113,25 @@ typedef struct { typedef struct { FATFS* fs; /* Pointer to the related file system object (**do not change order**) */ WORD id; /* Owner file system mount ID (**do not change order**) */ - BYTE flag; /* File status flags */ + BYTE flag; /* Status flags */ BYTE err; /* Abort flag (error code) */ DWORD fptr; /* File read/write pointer (Zeroed on file open) */ DWORD fsize; /* File size */ - DWORD sclust; /* File data start cluster (0:no data cluster, always 0 when fsize is 0) */ - DWORD clust; /* Current cluster of fpter */ - DWORD dsect; /* Current data sector of fpter */ + DWORD sclust; /* File start cluster (0:no cluster chain, always 0 when fsize is 0) */ + DWORD clust; /* Current cluster of fpter (not valid when fprt is 0) */ + DWORD dsect; /* Sector number appearing in buf[] (0:invalid) */ #if !_FS_READONLY - DWORD dir_sect; /* Sector containing the directory entry */ - BYTE* dir_ptr; /* Pointer to the directory entry in the window */ + DWORD dir_sect; /* Sector number containing the directory entry */ + BYTE* dir_ptr; /* Pointer to the directory entry in the win[] */ #endif #if _USE_FASTSEEK DWORD* cltbl; /* Pointer to the cluster link map table (Nulled on file open) */ #endif #if _FS_LOCK - UINT lockid; /* File lock ID (index of file semaphore table Files[]) */ + UINT lockid; /* File lock ID origin from 1 (index of file semaphore table Files[]) */ #endif #if !_FS_TINY - BYTE buf[_MAX_SS]; /* File data read/write buffer */ + BYTE buf[_MAX_SS]; /* File private data read/write window */ #endif } FIL; @@ -226,7 +226,7 @@ FRESULT f_chdir (const TCHAR* path); /* Change current directory */ FRESULT f_chdrive (const TCHAR* path); /* Change current drive */ FRESULT f_getcwd (TCHAR* buff, UINT len); /* Get current directory */ FRESULT f_getfree (const TCHAR* path, DWORD* nclst, FATFS** fatfs); /* Get number of free clusters on the drive */ -FRESULT f_getlabel (const TCHAR* path, TCHAR* label, DWORD* sn); /* Get volume label */ +FRESULT f_getlabel (const TCHAR* path, TCHAR* label, DWORD* vsn); /* Get volume label */ FRESULT f_setlabel (const TCHAR* label); /* Set volume label */ FRESULT f_mount (FATFS* fs, const TCHAR* path, BYTE opt); /* Mount/Unmount a logical drive */ FRESULT f_mkfs (const TCHAR* path, BYTE sfd, UINT au); /* Create a file system on the volume */ diff --git a/src/ffconf.h b/src/ffconf.h index 4c273ef..d883c14 100644 --- a/src/ffconf.h +++ b/src/ffconf.h @@ -1,9 +1,9 @@ /*---------------------------------------------------------------------------/ -/ FatFs - FAT file system module configuration file R0.10a (C)ChaN, 2014 +/ FatFs - FAT file system module configuration file R0.10b (C)ChaN, 2014 /---------------------------------------------------------------------------*/ #ifndef _FFCONF -#define _FFCONF 29000 /* Revision ID */ +#define _FFCONF 8051 /* Revision ID */ /*---------------------------------------------------------------------------/ @@ -33,11 +33,11 @@ / 3: f_lseek() function is removed in addition to 2. */ -#define _USE_STRFUNC 2 /* 0:Disable or 1-2:Enable */ +#define _USE_STRFUNC 0 /* 0:Disable or 1-2:Enable */ /* To enable string functions, set _USE_STRFUNC to 1 or 2. */ -#define _USE_MKFS 1 /* 0:Disable or 1:Enable */ +#define _USE_MKFS 0 /* 0:Disable or 1:Enable */ /* To enable f_mkfs() function, set _USE_MKFS to 1 and set _FS_READONLY to 0 */ @@ -45,7 +45,7 @@ /* To enable fast seek feature, set _USE_FASTSEEK to 1. */ -#define _USE_LABEL 1 /* 0:Disable or 1:Enable */ +#define _USE_LABEL 0 /* 0:Disable or 1:Enable */ /* To enable volume label functions, set _USE_LAVEL to 1 */ @@ -61,7 +61,7 @@ /* The _CODE_PAGE specifies the OEM code page to be used on the target system. / Incorrect setting of the code page can cause a file open failure. / -/ 932 - Japanese Shift-JIS (DBCS, OEM, Windows) +/ 932 - Japanese Shift_JIS (DBCS, OEM, Windows) / 936 - Simplified Chinese GBK (DBCS, OEM, Windows) / 949 - Korean (DBCS, OEM, Windows) / 950 - Traditional Chinese Big5 (DBCS, OEM, Windows) @@ -86,14 +86,14 @@ / 857 - Turkish (OEM) / 862 - Hebrew (OEM) / 874 - Thai (OEM, Windows) -/ 1 - ASCII (Valid for only non-LFN cfg.) */ +/ 1 - ASCII (Valid for only non-LFN configuration) */ -#define _USE_LFN 1 /* 0 to 3 */ +#define _USE_LFN 0 /* 0 to 3 */ #define _MAX_LFN 255 /* Maximum LFN length to handle (12 to 255) */ /* The _USE_LFN option switches the LFN feature. / -/ 0: Disable LFN feature. _MAX_LFN and _LFN_UNICODE have no effect. +/ 0: Disable LFN feature. _MAX_LFN has no effect. / 1: Enable LFN with static working buffer on the BSS. Always NOT thread-safe. / 2: Enable LFN with dynamic working buffer on the STACK. / 3: Enable LFN with dynamic working buffer on the HEAP. @@ -109,16 +109,17 @@ #define _LFN_UNICODE 0 /* 0:ANSI/OEM or 1:Unicode */ /* To switch the character encoding on the FatFs API (TCHAR) to Unicode, enable LFN / feature and set _LFN_UNICODE to 1. This option affects behavior of string I/O -/ functions. */ +/ functions. This option must be 0 when LFN feature is not enabled. */ #define _STRF_ENCODE 3 /* 0:ANSI/OEM, 1:UTF-16LE, 2:UTF-16BE, 3:UTF-8 */ /* When Unicode API is enabled by _LFN_UNICODE option, this option selects the character / encoding on the file to be read/written via string I/O functions, f_gets(), f_putc(), -/ f_puts and f_printf(). This option has no effect when Unicode API is not enabled. */ +/ f_puts and f_printf(). This option has no effect when _LFN_UNICODE == 0. Note that +/ FatFs supports only BMP. */ -#define _FS_RPATH 2 /* 0 to 2 */ +#define _FS_RPATH 0 /* 0 to 2 */ /* The _FS_RPATH option configures relative path feature. / / 0: Disable relative path feature and remove related functions. @@ -132,16 +133,16 @@ / Drive/Volume Configurations /---------------------------------------------------------------------------*/ -#define _VOLUMES 8 +#define _VOLUMES 1 /* Number of volumes (logical drives) to be used. */ -#define _STR_VOLUME_ID 1 /* 0:Use only 0-9 for drive ID, 1:Use strings for drive ID */ +#define _STR_VOLUME_ID 0 /* 0:Use only 0-9 for drive ID, 1:Use strings for drive ID */ #define _VOLUME_STRS "RAM","NAND","CF","SD1","SD2","USB1","USB2","USB3" -/* When _STR_VOLUME_ID is set to 1, also pre-defined string can be used as drive number -/ in the path name. _VOLUME_STRS defines the drive ID strings for each logical drives. -/ Number of items must be equal to _VOLUMES. Valid characters for the drive ID strings -/ are: 0-9 and A-Z. */ +/* When _STR_VOLUME_ID is set to 1, also pre-defined strings can be used as drive +/ number in the path name. _VOLUME_STRS defines the drive ID strings for each logical +/ drives. Number of items must be equal to _VOLUMES. Valid characters for the drive ID +/ strings are: 0-9 and A-Z. */ #define _MULTI_PARTITION 0 /* 0:Single partition, 1:Enable multiple partition */ @@ -152,11 +153,11 @@ #define _MIN_SS 512 -#define _MAX_SS 2048 -/* These options configure the sector size to be supported. (512, 1024, 2048 or 4096) -/ Always set both 512 for most systems, all memory card and hard disk. But a larger +#define _MAX_SS 512 +/* These options configure the range of sector size to be supported. (512, 1024, 2048 or +/ 4096) Always set both 512 for most systems, all memory card and harddisk. But a larger / value may be required for on-board flash memory and some type of optical media. -/ When _MIN_SS != _MAX_SS, FatFs is configured to multiple sector size and +/ When _MAX_SS is larger than _MIN_SS, FatFs is configured to variable sector size and / GET_SECTOR_SIZE command must be implemented to the disk_ioctl() function. */ @@ -166,9 +167,9 @@ #define _FS_NOFSINFO 0 /* 0 to 3 */ -/* If you need to know correct free space on the FAT32 volume, set bit 0 of this -/ option and f_getfree() function at first time after volume mount will force -/ a full FAT scan. Bit 1 controls the last allocated cluster number as bit 0. +/* If you need to know correct free space on the FAT32 volume, set bit 0 of this option +/ and f_getfree() function at first time after volume mount will force a full FAT scan. +/ Bit 1 controls the last allocated cluster number as bit 0. / / bit0=0: Use free cluster count in the FSINFO if available. / bit0=1: Do not trust free cluster count in the FSINFO. @@ -182,35 +183,16 @@ / System Configurations /---------------------------------------------------------------------------*/ -#define _WORD_ACCESS 1 /* 0 or 1 */ -/* The _WORD_ACCESS option is an only platform dependent option. It defines -/ which access method is used to the word data on the FAT volume. -/ -/ 0: Byte-by-byte access. Always compatible with all platforms. -/ 1: Word access. Do not choose this unless under both the following conditions. -/ -/ * Address misaligned memory access is always allowed for all instructions. -/ * Byte order on the memory is little-endian. -/ -/ If it is the case, _WORD_ACCESS can also be set to 1 to improve performance -/ and reduce code size. -*/ - - #define _FS_LOCK 0 /* 0:Disable or >=1:Enable */ -/* To enable file lock control feature, set _FS_LOCK to 1 or greater. -/ The value defines how many files/sub-directories can be opened simultaneously. -/ This feature consumes _FS_LOCK * 12 bytes of bss area. */ +/* To enable file lock control feature, set _FS_LOCK to non-zero value. +/ The value defines how many files/sub-directories can be opened simultaneously +/ with file lock control. This feature uses bss _FS_LOCK * 12 bytes. */ #define _FS_REENTRANT 0 /* 0:Disable or 1:Enable */ -#define _FS_TIMEOUT 1000 /* Timeout period in unit of time ticks */ -#define _SYNC_t HANDLE /* O/S dependent sync object type. e.g. HANDLE, OS_EVENT*, ID and etc.. */ -/*#include폜Ώۂ̃IuWFNg̏ɓĂ͂܂ꍇÃANZX͋(FR_DENIED܂FR_LOCKED)͎s܂B +
폜Ώۂ̃IuWFNg̏ɓĂ͂܂ꍇÃANZX͋ۂ͎s܂B
*/ - -/* A header file that defines sync object types on the O/S, such as windows.h, -/ ucos_ii.h and semphr.h, should be included here when enable this option. -/ The _FS_REENTRANT option switches the re-entrancy (thread safe) of the FatFs module. +#define _FS_TIMEOUT 1000 /* Timeout period in unit of time tick */ +#define _SYNC_t HANDLE /* O/S dependent sync object type. e.g. HANDLE, OS_EVENT*, ID, SemaphoreHandle_t and etc.. */ +/* The _FS_REENTRANT option switches the re-entrancy (thread safe) of the FatFs module. / / 0: Disable re-entrancy. _FS_TIMEOUT and _SYNC_t have no effect. / 1: Enable re-entrancy. Also user provided synchronization handlers, @@ -219,4 +201,28 @@ */ -#endif /* _FFCONFIG */ +#define _WORD_ACCESS 0 /* 0 or 1 */ +/* The _WORD_ACCESS option is an only platform dependent option. It defines +/ which access method is used to the word data on the FAT volume. +/ +/ 0: Byte-by-byte access. Always compatible with all platforms. +/ 1: Word access. Do not choose this unless under both the following conditions. +/ +/ * Address misaligned memory access is always allowed for ALL instructions. +/ * Byte order on the memory is little-endian. +/ +/ If it is the case, _WORD_ACCESS can also be set to 1 to improve performance and +/ reduce code size. Following table shows an example of some processor types. +/ +/ ARM7TDMI 0 ColdFire 0 V850E 0 +/ Cortex-M3 0 Z80 0/1 V850ES 0/1 +/ Cortex-M0 0 RX600(LE) 0/1 TLCS-870 0/1 +/ AVR 0/1 RX600(BE) 0 TLCS-900 0/1 +/ AVR32 0 RL78 0 R32C 0 +/ PIC18 0/1 SH-2 0 M16C 0/1 +/ PIC24 0 H8S 0 MSP430 0 +/ PIC32 0 H8/300H 0 x86 0/1 +*/ + + +#endif /* _FFCONF */ diff --git a/src/option/unicode.c b/src/option/unicode.c index 16a8d96..22e0320 100644 --- a/src/option/unicode.c +++ b/src/option/unicode.c @@ -2,15 +2,15 @@ #if _USE_LFN != 0 -#if _CODE_PAGE == 932 +#if _CODE_PAGE == 932 /* Japanese Shift_JIS */ #include "cc932.c" -#elif _CODE_PAGE == 936 +#elif _CODE_PAGE == 936 /* Simplified Chinese GBK */ #include "cc936.c" -#elif _CODE_PAGE == 949 +#elif _CODE_PAGE == 949 /* Korean */ #include "cc949.c" -#elif _CODE_PAGE == 950 +#elif _CODE_PAGE == 950 /* Traditional Chinese Big5 */ #include "cc950.c" -#else +#else /* Small character-set */ #include "ccsbcs.c" #endif