diff --git a/doc/00index_e.html b/doc/00index_e.html index a2e6649..99ec2a7 100644 --- a/doc/00index_e.html +++ b/doc/00index_e.html @@ -1,11 +1,10 @@ - + + - - FatFs - Generic FAT File System Module @@ -17,7 +16,7 @@
layer -

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.

Features

-

Disk I/O Interface

-

Since the FatFs module is completely separated from disk I/O layer, it requires following functions to access the storage device. 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.

+

Device Control Interface

+

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.

@@ -98,20 +97,22 @@

Resources

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.


-

Go to FatFs home page

+

Return

diff --git a/doc/00index_j.html b/doc/00index_j.html index ff2c999..da94847 100644 --- a/doc/00index_j.html +++ b/doc/00index_j.html @@ -1,36 +1,37 @@ - + - + + - + -FatFs ėpFATt@CVXeEW[ +FatFs 汎用FATファイルシステム・モジュール -

FatFs ėpFATt@CVXeEW[

+

FatFs 汎用FATファイルシステム・モジュール


layer -

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

-

FatFsW[̓

+

FatFsは小規模な組み込みシステム向けの汎用FATファイルシステム・モジュールです。ANSI C準拠でハードウェア・アーキテクチャには依存しないので、必要なワーク・エリアが確保できれば、8051, PIC, AVR, SH, Z80, 68k, H8, ARMなど安価なマイコンでも使用可能です。FatFsをシュリンクしたぷちFatFs↗もあります。

+

FatFsモジュールの特徴

@@ -38,79 +39,80 @@
-

ʃCEC^[tF[X

-

FatFsW[́AAvP[VECɑ΂Ãt@C֐(API)񋟂܂B‚܂ÃXgFatFsɂł邱ƂVvɎĂ܂B

+

上位レイヤ・インターフェース

+

FatFsモジュールは、アプリケーション・レイヤに対し、次のファイル操作関数(API)を提供します。つまり、このリストはFatFsにできることをシンプルに示しています。

-

ʃCEC^[tF[X

-

FatFsW[́APȂt@CEVXeECȂ̂ŁAXg[WEfoCX䃌C͊܂܂܂BgpXg[WɑΉ֐́A[UɂĒ񋟂Kv܂BFatFsW[́AʃCɑ΂ȂƂ̃C^[tF[Xv܂BOS֘A@\LɂƂ́AɉăvZX/֘A֐KvɂȂ܂BTvEvWFNgɉʃC̎܂B

+

下位レイヤ・インターフェース

+

FatFsモジュールは、単なるファイル・システム・レイヤなので、ストレージ・デバイス制御レイヤは含まれません。使用するストレージに対応した制御関数は、ユーザによって提供される必要があります。FatFsモジュールは、下位レイヤに対し少なくとも次のインターフェースを要求します。OS関連機能を有効にしたときは、これに加えてプロセス/メモリ関連関数も必要になります。サンプル・プロジェクトに下位レイヤの実装例を示します。

-

-

FatFsW[̓t[E\tgEFAƂċEEJpɌJĂ܂Bǂ̂悤ȗpړIilp珤p܂ŁjłgpEρEzzɂ‚Ĉ؂̐͂܂񂪁ASėp҂̐ӔC̉ł̗pƂ܂Bڂ̓AvP[VEm[gQƂĂB

+

資料

+

FatFsモジュールはフリー・ソフトウェアとして教育・研究・開発用に公開しています。どのような利用目的(個人利用から商用まで)でも使用・改変・配布について一切の制限はありませんが、全て利用者の責任の下での利用とします。詳しくはアプリケーション・ノートを参照してください。


-

FatFsz[y[W

+

戻る

diff --git a/doc/css_e.css b/doc/css_e.css index 8148721..1b544eb 100644 --- a/doc/css_e.css +++ b/doc/css_e.css @@ -7,6 +7,8 @@ a:active {color: darkmagenta; overflow: hidden; outline:none; position: relative abbr {border-width: 1px;} p {margin: 0 0 0.3em 1em;} +i {margin: 0 0.3em 0 0;} +b {margin: 0 0.1em;} em {font-style: normal; font-weight: bold; margin: 0 0.1em;} strong {} pre {border: 1px dashed gray; margin: 0.5em 1em; padding: 0.5em; line-height: 1.2em; font-size: 85%; font-family: "Consolas", "Courier New", monospace; background-color: white;} @@ -28,8 +30,8 @@ div.para {clear: both; font-family: serif;} div.ret a {font-size: 0.85em; font-family: "Consolas", "Courier New", monospace; } .equ {text-indent: 0; margin: 1em 2em 1em;} .indent {margin-left: 2em;} -.rset {float: right; margin: 0 0 0.5em 0.5em;} -.lset {float: left; margin: 0 0.5em 0.5em 0.5em;} +.rset {float: right; margin: 0.3em 0 0.5em 0.5em;} +.lset {float: left; margin: 0.3em 0.5em 0.5em 0.5em;} ul.flat li {list-style-type: none; margin: 0;} a.imglnk img {border: 1px solid;} .iequ {white-space: nowrap; font-weight: bold;} diff --git a/doc/css_j.css b/doc/css_j.css index a149bb1..3516420 100644 --- a/doc/css_j.css +++ b/doc/css_j.css @@ -10,6 +10,8 @@ a:active {color: darkmagenta; overflow: hidden; outline:none; position: relative abbr {border-width: 1px;} p {text-indent: 1em; margin: 0 0 0.3em 0.5em;} +i {margin: 0 0.3em 0 0;} +b {margin: 0 0.1em;} em {font-style: normal; font-weight: bold; margin: 0 0.1em;} strong {} pre {border: 1px dashed gray; margin: 0.5em 1em; padding: 0.5em; line-height: 1.2em; letter-spacing: 0; font-size: 0.85em; font-family: "Consolas", "Courier New", "lr SVbN", monospace; background-color: white;} @@ -31,8 +33,8 @@ div.para {clear: both; font-family: " div.ret a {font-size: 0.85em; font-family: "Consolas", "Courier New", monospace; } .equ {text-indent: 0; margin: 1em 2em 1em;} .indent {margin-left: 2em;} -.rset {float: right; margin: 0 0 0.5em 0.5em;} -.lset {float: left; margin: 0 0.5em 0.5em 0.5em;} +.rset {float: right; margin: 0.3em 0 0.5em 0.5em;} +.lset {float: left; margin: 0.3em 0.5em 0.5em 0.5em;} ul.flat li {list-style-type: none; margin: 0;} a.imglnk img {border: 1px solid;} .iequ {white-space: nowrap; font-weight: bold;} diff --git a/doc/css_p.css b/doc/css_p.css new file mode 100644 index 0000000..bc7b5b0 --- /dev/null +++ b/doc/css_p.css @@ -0,0 +1 @@ +body {margin: 8px; background-color: #ffecf0; font-color: black; font-family: serif; line-height: 133%; max-width: 1024px;} diff --git a/doc/en/appnote.html b/doc/en/appnote.html index 7521528..59dc98d 100644 --- a/doc/en/appnote.html +++ b/doc/en/appnote.html @@ -44,7 +44,7 @@ The FatFs module assumes that size of char/short/long are 8/16/32 bit and int is

The dependency diagram shown below is a typical configuration of the embedded system with FatFs module.

dependency diagram

(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.

-

functional diagram

+

functional diagram

Which function is required?

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.

@@ -54,8 +54,8 @@ The FatFs module assumes that size of char/short/long are 8/16/32 bit and int is 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 >= 1Unicode support functions.
Available in option/cc*.c. +disk_ioctl (CTRL_TRIM)_USE_TRIM == 1 +ff_convert
ff_wtoupper_USE_LFN >= 1Unicode support functions.
Available in option/unicode.c. ff_cre_syncobj
ff_del_syncobj
ff_req_grant
ff_rel_grant_FS_REENTRANT == 1O/S dependent functions.
Samples available in option/syscall.c. ff_mem_alloc
ff_mem_free_USE_LFN == 3 @@ -67,10 +67,10 @@ The FatFs module assumes that size of char/short/long are 8/16/32 bit and int is
  • FAT sub-types: FAT12, FAT16 and FAT32.
  • Number of open files: Unlimited, depends on available memory.
  • Number of volumes: Upto 10.
  • -
  • File size: Depends on FAT specs. (upto 4G-1 bytes)
  • -
  • Volume size: Depends on FAT specs. (upto 2T bytes at 512 bytes/sector)
  • -
  • Cluster size: Depends on FAT specs. (upto 64K bytes at 512 bytes/sector)
  • -
  • Sector size: Depends on FAT specs. (512..4096 bytes)
  • +
  • File size: Depends on the FAT specs. (upto 4G-1 bytes)
  • +
  • Volume size: Depends on the FAT specs. (upto 2T bytes at 512 bytes/sector)
  • +
  • Cluster size: Depends on the FAT specs. (upto 64K bytes at 512 bytes/sector)
  • +
  • Sector size: Depends on the FAT specs. (512, 1024, 2048 and 4096 bytes)
  • @@ -151,7 +151,7 @@ _FS_LOCK 0 (Disable file lock control)

    Long File Name

    -

    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.

    @@ -167,13 +167,13 @@ _FS_LOCK 0 (Disable file lock control)

    Unicode API

    -

    By default, FatFs uses ANSI/OEM code set on the API under LFN configuration. FatFs can also switch the character encoding to Unicode on the API (_LFN_UNICODE). This means the FatFs supports the True-LFN feature. For more information, refer to the description in the file name.

    +

    By default, FatFs uses ANSI/OEM code set on the API under LFN configuration. FatFs can also switch the character encoding to Unicode on the API by _LFN_UNICODE option. This means that the FatFs supports the True-LFN feature. For more information, refer to the description in the file name.

    Re-entrancy

    -

    The file operations to the different volume is always re-entrant and can work simultaneously. The file operations to the same volume is not re-entrant but it can also be configured to thread-safe with _FS_REENTRANT option. In this case, also the OS dependent synchronization object control functions, ff_cre_syncobj(), ff_del_syncobj(), ff_req_grant() and ff_rel_grant() must be added to the project.

    -

    When a file function is called while the volume is in use by any other task, the file function is suspended until that task leaves file function. If wait time exceeded a period defined by _TIMEOUT, the file function will abort with FR_TIMEOUT. The timeout feature might not be supported by some RTOS.

    +

    The file operations to the different volume is always re-entrant and can work simultaneously. The file operations to the same volume is not re-entrant but it can also be configured to thread-safe by _FS_REENTRANT option. In this case, also the OS dependent synchronization object control functions, ff_cre_syncobj(), ff_del_syncobj(), ff_req_grant() and ff_rel_grant() must be added to the project. There are some examples in the option/syscall.c.

    +

    When a file function is called while the volume is in use by any other task, the file function is suspended until that task leaves the file function. If wait time exceeded a period defined by _TIMEOUT, the file function will abort with FR_TIMEOUT. The timeout feature might not be supported by some RTOS.

    There is an exception for f_mount(), f_mkfs(), f_fdisk() function. These functions are not re-entrant to the same volume or corresponding physical drive. When use these functions, all other tasks must unmount the volume and avoid to access the volume.

    Note that this section describes on the re-entrancy of the FatFs module itself but also the low level disk I/O layer will need to be re-entrant.

    @@ -181,37 +181,37 @@ _FS_LOCK 0 (Disable file lock control)

    Duplicated File Access

    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 files and sub-directories gets larger than _FS_LOCK, the open 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.

    Performance Effective File Access

    -

    For good performance to read/write files on the small embedded system, application programmer should consider what process is done in the FatFs module. The file data on the volume is transferred in following sequence by f_read() function.

    -

    Figure 1. Sector miss-aligned read (short)
    +

    For good read/write throughput on the small embedded systems with limited size of memory, application programmer should consider what process is done in the FatFs module. The file data on the volume is transferred in following sequence by f_read() function.

    +

    Figure 1. Sector misaligned read (short)

    -

    Figure 2. Sector miss-aligned read (long)
    +

    Figure 2. Sector misaligned read (long)

    -

    Figure 3. Sector aligned read
    +

    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.

    -

    Figure 1 shows that a partial sector, sector mis-aligned part of the file, is transferred via the file I/O buffer. On 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 never across the cluster boundary even if it is contiguous.

    -

    Therefore taking effort to sector aligned read/write accesss avoids 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 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.

    Considerations on Flash Memory Media

    -

    To maximize the write performance of flash memory media, such as SDC and CFC, it must be controlled in consideration of its characteristitcs.

    +

    To maximize the write performance of flash memory media, such as SDC, CFC and U Disk, it must be controlled in consideration of its characteristitcs.

    Using Mutiple-Sector Write

    Figure 6. Comparison between Multiple/Single Sector Write
    fig.6
    -

    The write throughput of the flash memory media becomes the worst at single sector write and it increases proportional to the number of sectors per a write transaction. This effect more appers at more fast bus clock and its ratio often becomes grater than ten. The number of write transaction also affects the life time of the media. Therefore the application program should write the data in large block as possible. The ideal block size is cluster size or power of 2 bytes and the byte offset should be aligned to the block. Of course all layers between the application and the media must support multiple sector write feature, however most of open-source disk drivers lack it. Do not split a multiple sector write request into single sector writes or the write throughput gets poor. Note that FatFs module and its sample disk drivers supprt multiple sector read/write feature.

    +

    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.

    Forcing Memory Erase

    -

    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, the number of free blocks on the flash memory will be increased. This may skip internal block erase operation to the data block on next write. As the result the write performance might be improved. To enable this feature, set _USE_ERASE to 1. Note that this is a feature with expectation of internal process of the flash memory media. It may not always effective and f_remove() function will take a time to 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_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.

    @@ -245,6 +245,7 @@ Figure 5. Minimized critical section
  • Empty a directory
  • Allocate contiguous area to the file
  • Function/Compatible checker for low level disk I/O module
  • +
  • FAT image creator
  • @@ -252,7 +253,7 @@ Figure 5. Minimized critical section

    About FatFs License

    FatFs has being developped as a personal project of author, ChaN. It is free from the code anyone else wrote. Following code block shows a copy of the FatFs license document that included in the source files.

    /*----------------------------------------------------------------------------/
    -/  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
    @@ -266,7 +267,7 @@ Figure 5. Minimized critical section
    / * Redistributions of source code must retain the above copyright notice. / /-----------------------------------------------------------------------------/
    -

    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 and any form without source code, are not specified in order to extend usability to commercial use. 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, 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 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 fork, the license can also be changed to GNU GPL, BSD-style license or any free software licenses that not conflict with FatFs license.

    Return

    diff --git a/doc/en/close.html b/doc/en/close.html index 3f8ef52..0746700 100644 --- a/doc/en/close.html +++ b/doc/en/close.html @@ -46,7 +46,7 @@ FRESULT f_close (

    Description

    The f_close() function closes an open file object. If any data has been written to the file, the cached information of the file is written back to the volume. After the function succeeded, the file object is no longer valid and it can be discarded.

    -

    Note that if the file object is in read-only mode and _FS_LOCK option is not enabled, the file object can also be discarded without this process. However it is not recommended for future compatibility.

    +

    Note that if the file object is in read-only mode and _FS_LOCK option is not enabled, the file object can also be discarded without this process. However this is not recommended for future compatibility.

    diff --git a/doc/en/closedir.html b/doc/en/closedir.html index 5186496..05ef6f6 100644 --- a/doc/en/closedir.html +++ b/doc/en/closedir.html @@ -44,7 +44,7 @@ FRESULT f_closedir (

    Description

    The f_closedir() function closes an open directory object. After the function succeeded, the directory object is no longer valid and it can be discarded.

    -

    Note that the directory object can also be discarded without this process if _FS_LOCK option is not enabled. However it is not recommended for future compatibility.

    +

    Note that the directory object can also be discarded without this process if _FS_LOCK option is not enabled. However this is not recommended for future compatibility.

    diff --git a/doc/en/dinit.html b/doc/en/dinit.html index 709c7d0..4675dd9 100644 --- a/doc/en/dinit.html +++ b/doc/en/dinit.html @@ -13,7 +13,7 @@

    disk_initialize

    -

    The disk_initialize function initializes the disk drive.

    +

    The disk_initialize function initializes the storage device.

     DSTATUS disk_initialize (
       BYTE pdrv           /* [IN] Physical drive number */
    @@ -25,7 +25,7 @@ DSTATUS disk_initialize (
     

    Parameter

    pdrv
    -
    Specifies the physical drive number to initialize.
    +
    Physical drive number to identify the target device.
    @@ -37,8 +37,8 @@ DSTATUS disk_initialize (

    Description

    -

    This function initializes a physical drive and put it ready to generic read/write data. 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 on volume mount process by FatFs module to manage the media change.

    +

    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.

    +

    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.

    Return

    diff --git a/doc/en/dioctl.html b/doc/en/dioctl.html index 808a741..fec70c8 100644 --- a/doc/en/dioctl.html +++ b/doc/en/dioctl.html @@ -53,23 +53,38 @@ DRESULT disk_ioctl (

    Description

    -

    The FatFs module uses only device independent commands described below. Any device dependent functions and user defined functions are not used.

    +

    The FatFs module requires only five device independent commands described below.

    LFN cfg on ARM7TDMI
    Code pageProgram size
    + - - - - - + + + + + +
    Standard ioctl command used by FatFs
    CommandDescription
    CTRL_SYNCMake 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. If each write operation to the media is completed within the disk_write() function, nothing to do for this command.
    GET_SECTOR_COUNTReturns 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_SIZEReturns 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_SIZEReturns 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.
    CTRL_ERASE_SECTORErases 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 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 when _USE_ERASE is 1.
    CTRL_SYNCMake 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_COUNTReturns 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_SIZEReturns 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_SIZEReturns 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_SECTORInforms 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.

    + + + + + + + + + + + + + + + + +
    Example of optional ioctl command
    CommandDescription
    CTRL_FORMATCreate a physical format on the media. If buff is not null, it is pointer to the call-back function for progress notification.
    CTRL_POWER_IDLEPut 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_OFFPut 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_LOCKLock media eject mechanism.
    CTRL_UNLOCKUnlock media eject mechanism.
    CTRL_EJECTEject media cartridge. STA_NOINIT and STA_NODISK in status flag are set after the function succeeded.
    MMC_GET_TYPEGet 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_CSDGet CSD register into a 16-byte buffer pointed by buff. (MMC/SDC specific command)
    MMC_GET_CIDGet CID register into a 16-byte buffer pointed by buff. (MMC/SDC specific command)
    MMC_GET_OCRGet OCR register into a 4-byte buffer pointed by buff. (MMC/SDC specific command)
    MMC_GET_SDSTATGet SDSTATUS register into a 64-byte buffer pointed by buff. (SDC specific command)
    ATA_GET_REVGet the revision string into a 16-byte buffer pointed by buff. (ATA/CFC specific command)
    ATA_GET_MODELGet the model string into a 40-byte buffer pointed by buff. (ATA/CFC specific command)
    ATA_GET_SNGet the serial number string into a 20-byte buffer pointed by buff. (ATA/CFC specific command)
    -
    -

    QuickInfo

    -

    This function is not needed when _FS_READONLY == 1 and _MAX_SS == _MIN_SS.

    -
    - -

    Return

    diff --git a/doc/en/dstat.html b/doc/en/dstat.html index c2daf0e..d2b0242 100644 --- a/doc/en/dstat.html +++ b/doc/en/dstat.html @@ -39,7 +39,7 @@ DSTATUS disk_status (
    STA_NODISK
    Indicates that no medium in the drive. This is always cleared on fixed disk drive. Note that FatFs does not refer this flag.
    STA_PROTECT
    -
    Indicates that the medium is write protected. This is always cleared on the drive without write protect feature. Not valid while no medium in the drive.
    +
    Indicates that the medium is write protected. This is always cleared on the drives without write protect feature. Not valid while no medium in the drive.
    diff --git a/doc/en/dwrite.html b/doc/en/dwrite.html index 14130b0..616acf6 100644 --- a/doc/en/dwrite.html +++ b/doc/en/dwrite.html @@ -58,7 +58,7 @@ DRESULT disk_write (

    Description

    -

    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.

    +

    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.

    diff --git a/doc/en/fdisk.html b/doc/en/fdisk.html index 2a4010c..40e5e4b 100644 --- a/doc/en/fdisk.html +++ b/doc/en/fdisk.html @@ -48,7 +48,7 @@ FRESULT f_fdisk (

    Description

    -

    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.

    @@ -76,11 +76,11 @@ FRESULT f_fdisk ( f_fdisk(0, plist, work); /* Divide physical drive 0 */ - f_mount(&fs, "0:", 0); /* Register work area to the logical drive 0 */ + f_mount(&fs, "0:", 0); /* Register work area to the logical drive 0 */ f_mkfs("0:", 0, 0); /* Create FAT volume on the logical drive 0. 2nd argument is ignored. */ f_mount(0, "0:", 0); /* Unregister work area from the logical drive 0 */ - f_mount(&fs, "1:", 0); /* Give a work area to the logical drive 1 */ + f_mount(&fs, "1:", 0); /* Register a work area to the logical drive 1 */ f_mkfs("1:", 0, 0); /* Create FAT volume on the logical drive 1. 2nd argument is ignored. */ f_mount(0, "1:", 0); /* Unregister work area from the logical drive 1 */ diff --git a/doc/en/filename.html b/doc/en/filename.html index db952bd..22c8798 100644 --- a/doc/en/filename.html +++ b/doc/en/filename.html @@ -15,11 +15,11 @@

    Format of the path names

    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.

    diff --git a/doc/en/getlabel.html b/doc/en/getlabel.html index 9373517..81b2736 100644 --- a/doc/en/getlabel.html +++ b/doc/en/getlabel.html @@ -17,8 +17,8 @@
     FRESULT f_getlabel (
       const TCHAR* path,  /* [IN] Drive number */
    -  TCHAR* buff,        /* [OUT] Volume label */
    -  DWORD* sn           /* [OUT] Volume serial number */
    +  TCHAR* label,       /* [OUT] Volume label */
    +  DWORD* vsn          /* [OUT] Volume serial number */
     );
     
    @@ -28,9 +28,9 @@ FRESULT f_getlabel (
    path
    Pointer to the null-terminated string that specifies the logical drive. Null-string specifies the default drive.
    -
    buff
    +
    label
    Pointer to the buffer to store the volume label. The buffer size must be at least 12 items. If the volume has no label, a null-string will be returned. Set null pointer if this information is not needed.
    -
    sn
    +
    vsn
    Pointer to the DWORD variable to store the volume serial number. Set null pointer if this information is not needed.
    diff --git a/doc/en/lseek.html b/doc/en/lseek.html index 92d2aed..fa59aa9 100644 --- a/doc/en/lseek.html +++ b/doc/en/lseek.html @@ -49,13 +49,13 @@ FRESULT f_lseek (

    Description

    -

    The f_lseek() function moves the file read/write pointer of an open file. The offset can be specified in only origin from top of the file. When an offset beyond the file size is specified in write mode, the file size is expanded to the specified offset. The file data in the expanded area is undefined because no data is written to the file. This is suitable to pre-allocate a cluster chain quickly, for fast write operation. After the f_lseek() function succeeded, the current read/write pointer should be checked in order to make sure the read/write pointer has been moved correctry. In case of the current read/write pointer is not the expected value, either of followings has been occured.

    +

    The f_lseek() function moves the file read/write pointer of an open file. The offset can be specified in only origin from top of the file. When an offset beyond the file size is specified at write mode, the file size is expanded to the specified offset. The file data in the expanded area is undefined because no data is written to the file. This is suitable to pre-allocate a cluster chain quickly, for fast write operation. After the f_lseek() function succeeded, the current read/write pointer should be checked in order to make sure the read/write pointer has been moved correctry. In case of the current read/write pointer is not the expected value, either of followings has been occured.

    • End of file. The specified ofs was clipped at end of the file because the file has been opened in read-only mode.
    • Disk full. There is insufficient free space on the volume to expand the file.

    Fast seek feature is enabled when _USE_FASTSEEK is set to 1 and the member cltbl in the file object is not NULL. This feature enables fast backward/long seek operations without FAT access by using CLMT (cluster link map table). The fast seek feature is also applied to f_read()/f_write() function, however, the file size cannot be expanded by f_write()/f_lseek() function.

    -

    The CLMT must be created in the user defined DWORD array prior to use the fast seek feature. To create the CLMT, set address of the DWORD array to the member cltbl in the file object, set the array size in unit of items into the first item and call the f_lseek() function with ofs = CREATE_LINKMAP. After the function succeeded and CLMT is created, no FAT access is occured in subsequent f_read()/f_write()/f_lseek() function to the file. If the function failed with FR_NOT_ENOUGH_CORE, the given array size is insufficient for the file and number of items required is returned into the first item of the array. The required array size is (number of fragments + 1) * 2 items. For example, when the file is fragmented in 5, 12 items will be required for the CLMT.

    +

    The CLMT must be created in the user defined DWORD array prior to use the fast seek feature. To create the CLMT, set address of the DWORD array to the member cltbl in the file object, set the array size in unit of items into the first item and call the f_lseek() function with ofs = CREATE_LINKMAP. After the function succeeded and CLMT is created, no FAT access is occured at subsequent f_read()/f_write()/f_lseek() function to the file. If the function failed with FR_NOT_ENOUGH_CORE, the given array size is insufficient for the file and number of items required is returned into the first item of the array. The required array size is (number of fragments + 1) * 2 items. For example, when the file is fragmented in 5, 12 items will be required for the CLMT.

    diff --git a/doc/en/mount.html b/doc/en/mount.html index 3adea28..f2cd26b 100644 --- a/doc/en/mount.html +++ b/doc/en/mount.html @@ -13,10 +13,10 @@

    f_mount

    -

    The f_mount fucntion registers/unregisters file system object (work area) to the FatFs module.

    +

    The f_mount fucntion registers/unregisters file system object to the FatFs module.

     FRESULT f_mount (
    -  FATFS*       fatfs, /* [IN] File system object */
    +  FATFS*       fs,    /* [IN] File system object */
       const TCHAR* path,  /* [IN] Logical drive number */
       BYTE         opt    /* [IN] Initialization option */
     );
    @@ -26,12 +26,12 @@ FRESULT f_mount (
     

    Parameters

    -
    fatfs
    -
    Pointer to the file system object to be registered. Null pointer unregisters the registered file system object.
    +
    fs
    +
    Pointer to the new file system object to be registered. Null pointer unregisters the registered file system object.
    path
    -
    Pointer to the null-terminated string that specifies the logical drive. If there is no drive number, it means the default drive.
    +
    Pointer to the null-terminated string that specifies the logical drive. The string with no drive number means the default drive.
    opt
    -
    Initialization option. 0: Do not mount now (to be mounted later), 1: Force mounted the volume to check if the volume is available.
    +
    Initialization option. 0: Do not mount now (to be mounted later), 1: Force mounted the volume to check if the FAT volume is available.
    @@ -53,17 +53,17 @@ FRESULT f_mount (
    1. Determines the logical drive which specified by path.
    2. Clears and unregisters the regsitered work area of the drive.
    3. -
    4. Clears and registers the work area to the drive if fatfs is not NULL.
    5. +
    6. Clears and registers the new work area to the drive if fs is not NULL.
    7. Performs volume mount process to the drive if forced mount is specified.
    -

    The file system object is the work area needed for each logical drive. It must be given to the logical drive with this function prior to use any other file functions. To unregister a work area, specify a NULL to the fatfs, and then the work area can be discarded.

    +

    The file system object is the work area needed for each logical drive. It must be given to the logical drive with this function prior to use any other file functions except for f_fdisk() function. To unregister a work area, specify a NULL to the fs, and then the work area can be discarded.

    If forced mount is not specified, this function always succeeds regardless of the physical drive status due to delayed mount feature. It only clears (de-initializes) the given work area and registers its address to the internal table. No activity of the physical drive in this function. It can also be used to force de-initialized the registered work area of a logical drive. The volume mount processes, initialize the corresponding physical drive, find the FAT volume in it and initialize the work area, is performed in the subsequent file access functions when either or both of following condition is true.

    • File system object is not initialized. It is cleared by f_mount().
    • -
    • Physical drive is not initialized. It is de-initialized by system reset or media change.
    • +
    • Physical drive is not initialized. It is de-initialized by system reset or media removal.
    -

    If the function with forced mount failed, it means that the file system object is registered but the volume is currently not available. Mount process will also be attempted in subsequent file access functions.

    -

    If implementation of the disk I/O layer lacks media change detection, application program needs to perform a f_mount() after media change to force cleared the file system object.

    +

    If the function with forced mount failed, it means that the file system object has been registered successfully but the volume is currently not ready to use. Mount process will also be attempted in subsequent file access functions.

    +

    If implementation of the disk I/O layer lacks media change detection, application program needs to perform a f_mount() after each media change to force cleared the file system object.

    diff --git a/doc/en/open.html b/doc/en/open.html index 4205e34..8fb30a3 100644 --- a/doc/en/open.html +++ b/doc/en/open.html @@ -29,7 +29,7 @@ FRESULT f_open (
    fp
    Pointer to the blank file object structure to be created.
    path
    -
    Pointer to a null-terminated string that specifies the file name to create or open.
    +
    Pointer to a null-terminated string that specifies the file name to open or create.
    mode
    Mode flags that specifies the type of access and open method for the file. It is specified by a combination of following flags.
    Path name_FS_RPATH == 0_FS_RPATH == 1
    file.txtA file in the root directory of the drive 0A file in the current directory of the current drive
    diff --git a/doc/en/opendir.html b/doc/en/opendir.html index 3891dc0..77442ef 100644 --- a/doc/en/opendir.html +++ b/doc/en/opendir.html @@ -55,7 +55,7 @@ FRESULT f_opendir (

    Description

    -

    The f_opendir() function opens an exsisting directory and creates the directory object for subsequent calls.

    +

    The f_opendir() function opens an exsisting directory and creates a directory object for subsequent f_readdir() function.

    diff --git a/doc/en/printf.html b/doc/en/printf.html index 2128ce0..96a84b8 100644 --- a/doc/en/printf.html +++ b/doc/en/printf.html @@ -29,9 +29,9 @@ int f_printf (
    fp
    Pointer to the open file object structure.
    fmt
    -
    Pointer to the null terminated format string.
    +
    Pointer to the null terminated format string. The terminator charactor will not be written.
    ...
    -
    Optional arguments.
    +
    Optional arguments...
    @@ -56,7 +56,7 @@ int f_printf (

    QuickInfo

    -

    Available when _FS_READONLY == 0 and _USE_STRFUNC is 1 or 2. When it is set to 2, '\n's contained in the output are converted to "\r\n".

    +

    Available when _FS_READONLY == 0 and _USE_STRFUNC is 1 or 2. When it is set to 2, '\n's contained in the output are converted to '\r'+'\n'.

    When FatFs is configured to Unicode API (_LFN_UNICODE == 1), data types on the srting fuctions, f_putc(), f_puts(), f_printf() and f_gets(), is also switched to Unicode. The character encoding on the file to be read/written via those functions is selected by _STRF_ENCODE option.

    diff --git a/doc/en/putc.html b/doc/en/putc.html index c2db5fe..797c6a3 100644 --- a/doc/en/putc.html +++ b/doc/en/putc.html @@ -48,7 +48,7 @@ int f_putc (

    QuickInfo

    -

    Available when _FS_READONLY == 0 and _USE_STRFUNC is 1 or 2. When it is set to 2, a '\n' is converted to "\r\n".

    +

    Available when _FS_READONLY == 0 and _USE_STRFUNC is 1 or 2. When it is set to 2, a '\n' is converted to '\r'+'\n'.

    diff --git a/doc/en/puts.html b/doc/en/puts.html index a423c5a..6550b57 100644 --- a/doc/en/puts.html +++ b/doc/en/puts.html @@ -26,7 +26,7 @@ int f_puts (

    Parameters

    str
    -
    Pointer to the null terminated string to be written. The null character will not be written.
    +
    Pointer to the null terminated string to be written. The terminator character will not be written.
    fp
    Pointer to the open file object structure.
    @@ -48,7 +48,7 @@ int f_puts (

    QuickInfo

    -

    Available when _FS_READONLY == 0 and _USE_STRFUNC is 1 or 2. When it is set to 2, '\n's contained in the string are converted to "\r\n".

    +

    Available when _FS_READONLY == 0 and _USE_STRFUNC is 1 or 2. When it is set to 2, '\n's contained in the string are converted to '\r'+'\n'.

    diff --git a/doc/en/rc.html b/doc/en/rc.html index 244dba1..86c066e 100644 --- a/doc/en/rc.html +++ b/doc/en/rc.html @@ -17,14 +17,14 @@
    FR_OK (0)
    The function succeeded.
    FR_DISK_ERR
    -
    An unrecoverable hard error occured in the lower layer, disk_read(), disk_write() or disk_ioctl() function.
    +
    An unrecoverable hard error occured in the lower layer, disk_read(), disk_write() or disk_ioctl() function.
    Note that if once this error occured at any operation to an open file, the file object is aborted and all operations to the file except for close will be rejected.
    FR_INT_ERR
    -
    Assertion failed. An insanity is detected in the internal process. One of the following possibilities are suspected. +
    Assertion failed. An insanity is detected in the internal process. One of the following possibilities is suspected.
      -
    • There is any error of the FAT structure on the volume.
    • Work area (file system object, file object or etc...) is broken by stack overflow or any other application. This is the reason in most case.
    • -
    • An FR_DISK_ERR has occured on the file object.
    • +
    • There is any error of the FAT structure on the volume.
    +Note that if once this error occured at any operation to an open file, the file object is aborted and all operations to the file except for close will be rejected.
    FR_NOT_READY
    The disk drive cannot work due to incorrect medium removal or disk_initialize() function failed.
    @@ -69,7 +69,7 @@
    FR_TIMEOUT
    The function was canceled due to a timeout of thread-safe control. (Related option: _TIMEOUT)
    FR_LOCKED
    -
    The function was rejected by file sharing control. (Related option: _FS_LOCK)
    +
    The operation to the object was rejected by file sharing control. (Related option: _FS_LOCK)
    FR_NOT_ENOUGH_CORE
    Not enough memory for the operation. There is one of the following reasons:
      diff --git a/doc/en/read.html b/doc/en/read.html index 52cad5c..348bada 100644 --- a/doc/en/read.html +++ b/doc/en/read.html @@ -54,7 +54,7 @@ FRESULT f_read (

      Description

      -

      The file read/write pointer of the file object advances number of bytes read. After the function succeeded, *br should be checked to detect the end of file. In case of *br is less than btr, it means the read/write pointer reached end of the file during read operation.

      +

      The file read/write pointer of the file object advances number of bytes read. After the function succeeded, *br should be checked to detect end of the file. In case of *br is less than btr, it means the read/write pointer reached end of the file during read operation.

      diff --git a/doc/en/readdir.html b/doc/en/readdir.html index 532e28e..32c221b 100644 --- a/doc/en/readdir.html +++ b/doc/en/readdir.html @@ -54,7 +54,7 @@ FRESULT f_readdir (
      • The directory item has no LFN information.
      • Either the size of read buffer or LFN working buffer is insufficient for the LFN.
      • -
      • The LFN contains any Unicode charactrer that cannot be converted to OEM code. (not the case at Unicode API cfg.)
      • +
      • The LFN contains any Unicode character that cannot be converted to OEM code. (not the case at Unicode API cfg.)

      When the directory item has no LFN information, lower case characters can be contained in the fname[].

      diff --git a/doc/en/sdir.html b/doc/en/sdir.html index 930da2f..785d098 100644 --- a/doc/en/sdir.html +++ b/doc/en/sdir.html @@ -23,13 +23,13 @@ DWORD clust; /* Current cluster */ DWORD sect; /* Current sector */ BYTE* dir; /* Pointer to the current SFN entry in the win[] */ - BYTE* fn; /* Pointer to the SFN (in/out) {file[8],ext[3],status[1]} */ + BYTE* fn; /* Pointer to the SFN buffer (in/out) {file[8],ext[3],status[1]} */ #if _FS_LOCK UINT lockid; /* Sub-directory lock ID (0:Root directory) */ #endif #if _USE_LFN - WCHAR* lfn; /* Pointer to the LFN working buffer */ - WORD lfn_idx; /* Index of top of last matched LFN entris (0xFFFF:No LFN) */ + WCHAR* lfn; /* Pointer to the LFN buffer (in/out) */ + WORD lfn_idx; /* Index of the LFN entris (0xFFFF:No LFN) */ #endif } DIR; diff --git a/doc/en/setlabel.html b/doc/en/setlabel.html index 3cf9197..a8ac977 100644 --- a/doc/en/setlabel.html +++ b/doc/en/setlabel.html @@ -16,7 +16,7 @@

      The f_setlabel function sets/removes the label of a volume.

       FRESULT f_setlabel (
      -  const TCHAR* name  /* [IN] Volume label to be set */
      +  const TCHAR* label  /* [IN] Volume label to be set */
       );
       
      @@ -24,7 +24,7 @@ FRESULT f_setlabel (

      Parameters

      -
      name
      +
      label
      Pointer to the null-terminated string that specifies the volume label to be set.
      @@ -49,11 +49,11 @@ FRESULT f_setlabel (

      Description

      -

      When the string has a drive number, the volume label will be set to the volume specified by the drive number. If the volume label is a null-string, the volume label on the volume will be removed. The format of the volume label is similar to the SFN but there are some differences shown below:

      +

      When the string has a drive number, the volume label will be set to the volume specified by the drive number. If not, the label will be set to the default drive. If the given string is a null-string, the volume label on the volume will be removed. The format of the volume label is similar to the short file name but there are some differences shown below:

        -
      • 11 bytes or less in length as local character code.
      • +
      • 11 bytes or less in length as local character code. LFN extention is not applied to the volume label.
      • Cannot contain period.
      • -
      • Can contain spaces anywhere in the name.
      • +
      • Can contain spaces anywhere in the volume label. Trailing spaces are truncated off.
      diff --git a/doc/en/stat.html b/doc/en/stat.html index 24bf735..fb0d94a 100644 --- a/doc/en/stat.html +++ b/doc/en/stat.html @@ -54,7 +54,7 @@ FRESULT f_stat (

      Description

      -

      The f_stat() function checks the existence of a file or sub-directory. If not exist, the function returns with FR_NO_FILE. If exist, the function returns with FR_OK and the informations of the object, size, timestamp and attribute, are stored to the file information structure. For details, refer to the FILINFO structure and f_readdir() function.

      +

      The f_stat() function checks the existence of a file or sub-directory. If not exist, the function returns with FR_NO_FILE. If exist, the function returns with FR_OK and the informations of the object, file size, timestamp, attribute and SFN, are stored to the file information structure. For details of the file information, refer to the FILINFO structure and f_readdir() function.

      diff --git a/doc/en/sync.html b/doc/en/sync.html index 40be9df..09bab3d 100644 --- a/doc/en/sync.html +++ b/doc/en/sync.html @@ -46,7 +46,7 @@ FRESULT f_sync (

      Description

      The f_sync() function performs the same process as f_close() function but the file is left opened and can continue read/write/seek operations to the file. This is suitable for the applications that open files for a long time in write mode, such as data logger. Performing f_sync() function of periodic or immediataly after f_write() function can minimize the risk of data loss due to a sudden blackout or an unintentional media removal. For more information, refer to application note.

      -

      However the f_sync() function immediataly before f_close() function has no advantage because it performs f_sync() function in it. In other words, the differnce between those functions is that the file object is invalidated or not.

      +

      However there is no sense in f_sync() function immediataly before f_close() function because it performs f_sync() function in it. In other words, the differnce between those functions is that the file object is invalidated or not.

      diff --git a/doc/en/unlink.html b/doc/en/unlink.html index 582cfb6..deb96b9 100644 --- a/doc/en/unlink.html +++ b/doc/en/unlink.html @@ -59,7 +59,7 @@ FRESULT f_unlink ( If condition of the object to be removed is applicable to the following terms, the function will be rejected.
      • The file/sub-directory must not have read-only attribute (AM_RDO), or the function will be rejected with FR_DENIED.
      • The sub-directory must be empty and must not be current directory, or the function will be rejected with FR_DENIED.
      • -
      • The file/sub-directory must not be opened, or the FAT volume can be collapsed. It can also be rejected with FR_LOCKED when file lock feature is enabled.
      • +
      • The file/sub-directory must not be opened, or the FAT volume can be collapsed. It can be rejected with FR_LOCKED when file lock feature is enabled.
      diff --git a/doc/img/app2.c b/doc/img/app2.c index 8802033..b1ecd78 100644 --- a/doc/img/app2.c +++ b/doc/img/app2.c @@ -14,7 +14,7 @@ FRESULT empty_directory ( FILINFO fno; #if _USE_LFN - fno.lfname = 0; /* Eliminate LFN output */ + fno.lfname = 0; /* Disable LFN output */ #endif fr = f_opendir(&dir, path); if (fr == FR_OK) { @@ -23,7 +23,7 @@ FRESULT empty_directory ( for (;;) { fr = f_readdir(&dir, &fno); if (fr != FR_OK || !fno.fname[0]) break; - if (fno.fname[0] == '.') continue; + if (_FS_RPATH && fno.fname[0] == '.') continue; j = 0; do path[i+j] = fno.fname[j]; @@ -59,7 +59,7 @@ int main (void) if (fr) { printf("Function failed. (%u)\n", fr); - return 1; + return fr; } else { printf("All contents in the %s are successfully removed.\n", buff); return 0; diff --git a/doc/img/app3.c b/doc/img/app3.c index 07c12af..32b1423 100644 --- a/doc/img/app3.c +++ b/doc/img/app3.c @@ -6,7 +6,7 @@ / If the file has been opened without FA_WRITE flag, it only checks if / the file is contiguous and returns the resulut. */ -#if _FATFS != 29000 /* Check if R0.10a */ +#if _FATFS != 8051 /* Check if R0.10b */ #error This function may not be compatible with this revision of FatFs module. #endif diff --git a/doc/img/funcs.png b/doc/img/funcs.png index 9355d00..03e7d6d 100644 Binary files a/doc/img/funcs.png and b/doc/img/funcs.png differ diff --git a/doc/ja/appnote.html b/doc/ja/appnote.html index c163a46..b30c713 100644 --- a/doc/ja/appnote.html +++ b/doc/ja/appnote.html @@ -44,19 +44,19 @@ FatFsモジュールはANSI C(C89)準拠で記述されているので、普通

      システム構成

      下に示す依存関係図は、FatFsモジュール利用の組み込みシステムにおける代表的な構成を示します。

      システム構成図

      -

      (a) FatFs用に書かれたディスク・モジュールがある場合は、そのまま接続するだけです。 (b) しかし、多くの既存のディスク・モジュールはそのAPIをFatFsに合わせるため、グルー関数が必要になるでしょう。

      -

      functional diagram

      +

      (a) FatFs用に書かれたディスク・モジュールがある場合は、そのまま追加するだけです。 (b) しかし、多くの既存のディスク・モジュールはそのAPIをFatFsに合わせるため、グルー関数が必要になるでしょう。

      +

      functional diagram

      ユーザの作成する関数

      -

      必要なのは FatFsモジュールの要求するディスク関数を用意することだけで、それ以外にすることはありません。既に動作しているディスク関数があるなら、その APIを FatFsに合わせるかグルー関数でつなぐだけで済みますが、無い場合はほかから移植するか最初から書くかする必要があります。定義されている全ての関数が常に必要なわけではありません。例えば、リード・オンリー構成では書き込み系関数は必要ありません。次の表に構成オプションと要求される関数の対応を示します。

      +

      必要なのはFatFsモジュールの要求するディスク関数を用意することだけで、それ以外にすることはありません。既に動作しているディスク・モジュールがあるなら、そのAPIをFatFsに合わせるかグルー関数を介してつなぐだけで済みますが、無い場合はほかから移植するか最初から書くかする必要があります。定義されている全ての関数が常に必要なわけではありません。例えば、リード・オンリー構成では書き込み系関数は必要ありません。次の表に構成オプションと要求される関数の対応を示します。

    - + - +
    ユーザ作成関数必要となる条件備考
    必要な関数必要となる条件備考
    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 >= 1option/cc*.c
    ff_convert
    ff_wtoupper
    _USE_LFN >= 1option/unicode.c
    ff_cre_syncobj
    ff_rel_grant
    ff_req_grant
    ff_del_syncobj
    _FS_REENTRANT == 1option/syscall.c (サンプル)
    ff_mem_alloc
    ff_mem_free
    _USE_LFN == 3
    @@ -152,8 +152,8 @@ _FS_LOCK 0 (Disable file lock control)

    長いファイル名

    -

    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バイトになるので、スタック等のサイズはそれを考慮した十分なサイズでなければなりません。

    @@ -216,7 +216,7 @@ _FS_LOCK 0 (Disable file lock control) 図6. マルチ/シングル・セクタ・ライトの比較
    fig.6 -

    フラッシュ・メモリ・メディアの書き込み速度はシングル・セクタ書き込みの時に最も低いものになり、一回のトランザクションで転送されるセクタ数が大きくなるほど書き込み速度は向上します。この効果はバス速度が高速になるほど顕著で、10倍以上の差が現れることも珍しくありません。書き込みトランザクションの回数はまた、メディアの寿命にも影響してきます。このため、アプリケーションはなるべく大きなブロック(クラスタ・サイズまたは2の累乗セクタ境界にアライメントした)で読み書きを行う必要があります。もちろん、アプリケーションからメディアに至る全てのレイヤがマルチ・セクタ転送に対応していないと意味がありません。残念ながら、既存のオープン・ソースのドライバの多くはマルチ・セクタ転送に未対応です。なお、FatFsモジュールおよびそれ用のサンプル・ドライバはマルチ・セクタ転送に対応しています。

    +

    フラッシュ・メモリ・メディアの書き込み速度はシングル・セクタ書き込みの時に最も低いものになり、一回のトランザクションで転送されるセクタ数が大きくなるほど書き込み速度は向上します。この効果はバス速度が高速になるほど顕著で、10倍以上の差が現れることも珍しくありません。テスト結果は、マルチ・セクタ書き込み(W:16K, 32 sectors)がシングル・セクタ書き込み(W:100, 1 sector)よりどの程度速いかを明確に示しています。大容量メディアほどシングル・セクタ書き込みが遅くなる点もまた重要です。書き込みトランザクションの回数はまた、メディアの寿命にも影響してきます。このため、アプリケーションはなるべく大きなブロック(クラスタ・サイズまたは2の累乗セクタ境界にアライメントした)で読み書きを行う必要があります。もちろん、アプリケーションからメディアに至る全てのレイヤがマルチ・セクタ転送に対応していないと意味がありません。残念ながら、既存のオープン・ソースのドライバの多くはマルチ・セクタ転送に未対応です。なお、FatFsモジュールおよびサンプル・ドライバはマルチ・セクタ転送に対応しています。

    明示的なメモリ消去

    通常のファイル消去では、記録されたデータに対して何らかの制御が行われるわけではなく、単にFAT上に未使用クラスタとして記録されているだけです。このため、ファイルが消去されたあともそれらは有効なメモリ・ブロックとしてフラッシュ・メモリ上に残ります。そこで、ファイルを消去するとき、占有していたデータ・セクタを明示的に消去(つまり未使用ブロックにする)することにより、メディア内の空きブロックを増やすことができます。これにより、次にそのブロックに書き込むときの消去動作が無くなり、書き込み性能が向上する可能性があります。また、ウェアレベリングに使えるブロックが増え、メディアの耐久性も向上するかも知れません。この機能を有効にするには、構成オプションの_USE_ERASEに1を設定します。これはフラッシュ・メモリ・メディアの内部動作に期待した制御なので、効果があるとは限りません。また、ファイル消去の時間が延びることも考慮に入れるべきです。

    @@ -252,6 +252,7 @@ _FS_LOCK 0 (Disable file lock control)
  • ディレクトリを空にする
  • ファイルに連続領域を割り当てる
  • ディスクI/Oモジュールの機能/互換性チェッカー
  • +
  • FATイメージ作成ツール
  • @@ -259,7 +260,7 @@ _FS_LOCK 0 (Disable file lock control)

    FatFsのライセンスについて

    ソース・ファイルのヘッダにライセンス条件が記述されているので、利用の際はそれに従うこと。英語を読めない方のために以下に日本語訳を示しておきます。

    /*----------------------------------------------------------------------------/
    -/  FatFs - FAT file system module  R0.10a                   (C)ChaN, 2014
    +/  FatFs - FAT file system module  R0.10b                   (C)ChaN, 2014
     /-----------------------------------------------------------------------------/
     / FatFsモジュールは、小規模な組み込みシステム向けの汎用FATファイルシステム・
     / モジュールです。これはフリー・ソフトウェアとして、教育・研究・開発のために
    diff --git a/doc/ja/dioctl.html b/doc/ja/dioctl.html
    index 1e731bc..d1d3eef 100644
    --- a/doc/ja/dioctl.html
    +++ b/doc/ja/dioctl.html
    @@ -13,7 +13,7 @@
     
     

    disk_ioctl

    -

    ʓIȃZN^ǂݏȊÕXg[WEfoCX̂ɑ΂lXȐs܂B

    +

    ʓIȃf[^ǂݏȊÕXg[WEfoCX̂ɑ΂lXȐs܂B

     DRESULT disk_ioctl (
       BYTE pdrv,    /* [IN] hCuԍ */
    @@ -51,15 +51,36 @@ DRESULT disk_ioctl (
     
     

    -

    Xg[WEfoCX̎ނɂT|[gR}h͈قȂ܂AFatFsW[̂́A̔ėpR}ĥݎgpÃfoCXɈˑ͍s܂BAvP[VłȊO̐䂪KvȂƂ́AKvɉă[U`R}hljĂB

    +

    Xg[WEfoCX̎ނɂT|[gR}h͈قȂ܂AFatFsW[̂́A̔ėpR}ĥݎgpÃfoCXɈˑ͍s܂B

    LFN cfg on ARM7
    コードページコードサイズ[bytes]
    + - - + +
    WioctlR}h
    R}h
    CTRL_SYNCXg[WEfoCX̃f[^ݏ܂BCgEobNELbVȂǂ݂ꍇ́A܂ĂȂf[^𑦎݂܂BfBAւ݂̏ꂼdisk_write֐Ŋꍇ́ÃR}hɑ΂Ă邱Ƃ͂܂B
    GET_SECTOR_COUNTbuff̎wDWORD^ϐɃhCȗZN^Ԃ܂Bf_mkfs()ŌĂяoA쐬{[̃TCY肷邽߂Ɏgp܂B
    CTRL_SYNCXg[WEfoCX̃f[^ݏ܂BCgEobNELbVȂǂ݂ꍇ́A܂ĂȂf[^𑦎݂܂BfBAւ݂̏ꂼdisk_write()̓Ŋꍇ́ÃR}hɑ΂Ă邱Ƃ͂܂B
    GET_SECTOR_COUNTbuff̎wDWORD^ϐɃhCȗZN^Ԃ܂Bf_mkfs()f_fdisk()ĂяoA쐬{[̃TCY肷邽߂Ɏgp܂B
    GET_SECTOR_SIZEbuff̎wWORD^ϐɃhCũZN^ETCYԂ܂BLl512A1024A2048܂4096łBZN^ETCYŒ\(_MAX_SS ==_MIN_SS)̂Ƃ͂̃R}h͎g邱Ƃ͂ȂAɂ̃ZN^ETCYœ삵Ȃ΂Ȃ܂B
    GET_BLOCK_SIZEbuff̎wDWORD^ϐɃtbVȄubNETCY(ZN^P)Ԃ܂B132768͈̔͂2̗ݏ̒lłȂ΂Ȃ܂Bsȏꍇ܂̓tbVEȊÕfBAł1Ԃ܂Bf_mkfs()ł̂ݎgpA{[̃f[^̈͂̋EɃACg܂B
    CTRL_ERASE_SECTORtbVË̗̖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

    + + + + + + + + + + + + + + + + + +
    [U`ioctlR}h̗
    R}h
    CTRL_FORMATfBA̕tH[}bgs܂BbuffNULLłȂƂAis\̂߂̃R[obN֐̃AhX܂B
    CTRL_POWER_IDLEfoCXAChԂɂ܂Bʏ̓ǂݏvŃANeBuԂɖ߂ȂASTA_NOINITtOZbgKv͂܂B
    CTRL_POWER_OFFfoCXVbg_EԂɂ܂BSTA_NOINIT̓Zbg܂BfoCXdisk_initialize()ŃANeBuԂɖ߂܂B
    CTRL_LOCK[Uɂ郁fBA̎o֎~܂B
    CTRL_UNLOCK[Uɂ郁fBA̎o‚܂B
    CTRL_EJECTfBAro܂BASTA_NOINITSTA_NODISKtO̓Zbg܂B
    MMC_GET_TYPEJ[hE^CvtO(b0:MMCv3, b1:SDv1, b2:SDv2+, b3:LBA)buff̎BYTEϐɓǂݏo܂B(MMC/SDJ[hp)
    MMC_GET_CSDCSDWX^̓ebuff̎16oCg̃obt@ɓǂݏo܂B(MMC/SDJ[hp)
    MMC_GET_CIDCIDWX^̓ebuff̎16oCg̃obt@ɓǂݏo܂B(MMC/SDJ[hp)
    MMC_GET_OCROCRWX^̓ebuff̎4oCg̃obt@ɓǂݏo܂B(MMC/SDJ[hp)
    MMC_GET_SDSTATSD STATUSWX^̓ebuff̎64oCg̃obt@ɓǂݏo܂B(SDJ[hp)
    ATA_GET_REVrWER[hbuff̎16oCg̃obt@ɓǂݏo܂B(ATA/CFJ[hp)
    ATA_GET_MODELfER[hbuff̎40oCg̃obt@ɓǂݏo܂B(ATA/CFJ[hp)
    ATA_GET_SNVAԍbuff̎20oCg̃obt@ɓǂݏo܂B(ATA/CFJ[hp)
    diff --git a/doc/ja/dread.html b/doc/ja/dread.html index a1b6a53..89ffab4 100644 --- a/doc/ja/dread.html +++ b/doc/ja/dread.html @@ -13,7 +13,7 @@

    disk_read

    -

    Xg[WEfoCXZN^ǂݏo܂B

    +

    Xg[WEfoCXf[^ǂݏo܂B

     DRESULT disk_read (
       BYTE pdrv,     /* [IN] hCuԍ */
    diff --git a/doc/ja/dstat.html b/doc/ja/dstat.html
    index d4cf43c..7e33859 100644
    --- a/doc/ja/dstat.html
    +++ b/doc/ja/dstat.html
    @@ -13,7 +13,7 @@
     
     

    disk_status

    -

    fBXNEhCȕԂ擾܂B

    +

    Xg[WEfoCX̏Ԃ擾܂B

     DSTATUS disk_status (
       BYTE pdrv           /* [IN] hCuԍ */
    @@ -32,10 +32,10 @@ DSTATUS disk_status (
     
     

    ߂l

    -

    hCȕԂ̃tȎgݍ킹lŕԂ܂B

    +

    Xg[WEfoCX̏Ԃ̃tȎgݍ킹lŕԂ܂B

    STA_NOINIT
    -
    hCuĂȂƂtOBVXeEZbg⃁fBA̎OŃZbgAdisk_initialize()̐IŃNAAsŃZbg܂BfBA͔񓯊ɔCxgȂ̂ŁAߋɃfBAꍇ̃tOɔfKv܂BFatFsW[́ÃtOQƂĎ}Egsǂ𔻒f܂B
    +
    foCXĂȂƂtOBVXeEZbg⃁fBA̎OŃZbgAdisk_initialize()̐IŃNAAsŃZbg܂BfBA͔񓯊ɔCxgȂ̂ŁAߋɃfBAꍇ̃tOɔfKv܂BFatFsW[́ÃtOQƂĎ}Egsǂ𔻒f܂B
    STA_NODISK
    fBA݂ȂƂtOBfBAOĂԂ̓ZbgAZbgĂԂ̓NA܂BŒfBXNł͏ɃNA܂BȂÃtOFatFsW[ł͎QƂ܂B
    STA_PROTECT
    diff --git a/doc/ja/dwrite.html b/doc/ja/dwrite.html index 2a4c12e..dae5091 100644 --- a/doc/ja/dwrite.html +++ b/doc/ja/dwrite.html @@ -13,7 +13,7 @@

    disk_write

    -

    Xg[WEfoCX̃ZN^ɏ݂܂B

    +

    Xg[WEfoCXɃf[^݂܂B

     DRESULT disk_write (
       BYTE pdrv,        /* [IN] hCuԍ */
    diff --git a/doc/ja/fattime.html b/doc/ja/fattime.html
    index 2e9d9f3..d9fa28c 100644
    --- a/doc/ja/fattime.html
    +++ b/doc/ja/fattime.html
    @@ -22,7 +22,7 @@ DWORD get_fattime (void);
     
     

    ߂l

    -

    ݂̃[JE^CDWORDlɃpbNĕԂBrbgEtB[h͎Ɏ悤ɂȂ܂B

    +

    ݂̃[JE^CDWORDlɃpbNĕԂ܂BrbgEtB[h͎Ɏ悤ɂȂ܂B

    bit31:25
    1980NN_ƂN 0..127 ŃZbgB
    diff --git a/doc/ja/getcwd.html b/doc/ja/getcwd.html index 95347a0..1324280 100644 --- a/doc/ja/getcwd.html +++ b/doc/ja/getcwd.html @@ -13,7 +13,7 @@

    f_getcwd

    -

    JgEfBNg𓾂܂

    +

    JgEfBNg𓾂܂B

     FRESULT f_getcwd (
       TCHAR* buff, /* [OUT] obt@ */
    @@ -28,7 +28,7 @@ FRESULT f_getcwd (
     
    buff
    JgEfBNg̃pXi[obt@
    len
    -
    TCHARPʂ̃obt@ETCY
    +
    TCHARPʂ̃obt@ETCY
    diff --git a/doc/ja/getfree.html b/doc/ja/getfree.html index 91b76b1..5235ce3 100644 --- a/doc/ja/getfree.html +++ b/doc/ja/getfree.html @@ -13,7 +13,7 @@

    f_getfree

    -

    {[̖gpNX^擾܂B

    +

    {[̋󂫗̈̃TCY擾܂B

     FRESULT f_getfree (
       const TCHAR* path,  /* [IN] ΏۃhCuw肵܂ */
    @@ -53,7 +53,7 @@ FRESULT f_getfree (
     
     

    -

    _hCű󂫃NX^擾܂BԂꂽt@CEVXeEIuWFNgcsizeoNX^̃ZN^Ă̂ŁAɃZN^Pʂ̋󂫃TCYvZł܂BFAT32{[ɂẮAFSINFȌ񂪎ۂ̋󂫃NX^ƓĂȂꍇAsmȒlԂ”\܂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

    diff --git a/doc/ja/getlabel.html b/doc/ja/getlabel.html index cabb37e..0bebbd4 100644 --- a/doc/ja/getlabel.html +++ b/doc/ja/getlabel.html @@ -17,8 +17,8 @@
     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[ϐ */
     );
     
    @@ -28,9 +28,9 @@ FRESULT f_getlabel (
    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
    +
    vsn
    {[EVAԍi[DWORD^ϐւ̃|C^w肵܂B̏񂪕svȂƂ̓kE|C^w肵ĂB
    diff --git a/doc/ja/gets.html b/doc/ja/gets.html index 1a7152a..1efa125 100644 --- a/doc/ja/gets.html +++ b/doc/ja/gets.html @@ -38,13 +38,13 @@ TCHAR* f_gets (

    ߂l

    -

    ֐buffԂ܂B

    +

    ֐buffԂ܂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

    +

    ̊֐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

    diff --git a/doc/ja/mkfs.html b/doc/ja/mkfs.html index 22d60b0..9a7465f 100644 --- a/doc/ja/mkfs.html +++ b/doc/ja/mkfs.html @@ -31,7 +31,7 @@ FRESULT f_mkfs (
    sfd
    p[e[V`B(0(FDISK) ܂ 1(SFD))
    au
    -
    NX^ETCYoCgPʂŎw肵܂BΏۃhCũZN^ETCYn{(n = 1`128ŁA2̗ݏ)łȂ΂Ȃ܂B0w肵ꍇA{[̃TCYɉftHg̃NX^ETCYI܂B
    +
    NX^ETCYoCgPʂŎw肵܂Bl͑ΏۃhCũZN^ETCYn{(n = 1`128ŁA2̗ݏ)łȂ΂Ȃ܂B0Ȃǂ̖lw肵ꍇA{[̃TCYɉftHg̃NX^ETCYI܂B
    diff --git a/doc/ja/mount.html b/doc/ja/mount.html index ab64ccb..0a9bc4e 100644 --- a/doc/ja/mount.html +++ b/doc/ja/mount.html @@ -16,7 +16,7 @@

    _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@C֐gpOɁÅ֐ł̘_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@C֐gpOɁÅ֐ł̘_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

    1. Ώۂ̘_hCupath瓾B
    2. ɓo^Ăt@CEVXeEIuWFNg̓NAAo^B
    3. -
    4. fatfsLȃ|C^̂Ƃ́Ãt@CEVXeEIuWFNgNAo^B
    5. +
    6. fsLȃ|C^̂Ƃ́Ãt@CEVXeEIuWFNgNAo^B
    7. }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 a27cf24..8ee3b2b 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
    diff --git a/doc/ja/printf.html b/doc/ja/printf.html index 686d21d..0250f65 100644 --- a/doc/ja/printf.html +++ b/doc/ja/printf.html @@ -56,8 +56,8 @@ 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

    diff --git a/doc/ja/putc.html b/doc/ja/putc.html index 105992d..d9e2a37 100644 --- a/doc/ja/putc.html +++ b/doc/ja/putc.html @@ -36,7 +36,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

    @@ -48,7 +48,7 @@ int f_putc (

    Ή

    -

    _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

    diff --git a/doc/ja/puts.html b/doc/ja/puts.html index 62b76a6..6f5c463 100644 --- a/doc/ja/puts.html +++ b/doc/ja/puts.html @@ -36,7 +36,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

    @@ -48,7 +48,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_STRFUNC1܂2̂Ƃgp”\łB2w肷ƁAɊ܂܂'\n''\r'+'\n'ɓWJăt@Cɏ܂܂B

    diff --git a/doc/ja/rc.html b/doc/ja/rc.html index bfd8779..1f1140f 100644 --- a/doc/ja/rc.html +++ b/doc/ja/rc.html @@ -17,15 +17,14 @@
    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 189617e..d516b35 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"..")́A΃pXLȂƂ(_FS_RPATH >= 1)ɂ̂݌܂Bt@C̏ڍׂɂ‚Ă FILINFO\̂QƂĂBfnoɃkE|C^w肷ƁÃfBNg̃[hECfbNX擪Ɋ߂܂B

      -

      LFN@\LȎ́Af_readdir()֐̌Ăяoɐ旧FILINFOlfnamelfsizeLȒ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"..")́A΃pXLȂƂ(_FS_RPATH >= 1)ɂ̂ݏo͂Ɍ܂B

      +

      LFN@\LȎ́Å֐̌Ăяoɐ旧FILINFOlfnamelfsizeLȒ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 b43b93f..54d1762 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 246c48f..d305f23 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 b40a5cf..fa0e492 100644 --- a/doc/ja/setlabel.html +++ b/doc/ja/setlabel.html @@ -13,10 +13,10 @@

        f_setlabel

        -

        {[Ex݂܂B

        +

        {[Ƀ{[Exݒ肵܂B

         FRESULT f_setlabel (
        -  const TCHAR* name  /* [IN] ݒ肷{[ւ̃|C^ */
        +  const TCHAR* label  /* [IN] ݒ肷{[Exւ̃|C^ */
         );
         
        @@ -24,8 +24,8 @@ FRESULT f_setlabel (

        -
        name
        -
        ݒ肷{[k'\0'I[̕ւ̃|C^w肵܂B
        +
        label
        +
        ݒ肷{[Exk'\0'I[̕ւ̃|C^w肵܂B
        @@ -49,11 +49,11 @@ 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
        @@ -66,13 +66,13 @@ FRESULT f_setlabel (

        gp

        -    /* ftHgEhCuɃ{[ݒ */
        +    /* ftHgEhCuɃ{[Exݒ */
             f_setlabel("DATA DISK");
         
        -    /* hCu2Ƀ{[ݒ */
        +    /* hCu2Ƀ{[Exݒ */
             f_setlabel("2:DISK 3 OF 4");
         
        -    /* hCu2̃{[폜 */
        +    /* hCu2̃{[Ex폜 */
             f_setlabel("2:");
         
        diff --git a/doc/ja/stat.html b/doc/ja/stat.html index 82a6216..2a88bbf 100644 --- a/doc/ja/stat.html +++ b/doc/ja/stat.html @@ -54,7 +54,7 @@ FRESULT f_stat (

        -

        w肳ꂽt@C܂̓TuEfBNg݂̑𒲂ׂ܂B݂Ȃꍇ́AFR_NO_FILEA܂B݂ꍇFR_OKAAt@C\̂ɂւ(TCYA^CX^vё)XgA܂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/sync.html b/doc/ja/sync.html index f5c42b5..3440327 100644 --- a/doc/ja/sync.html +++ b/doc/ja/sync.html @@ -46,7 +46,7 @@ FRESULT f_sync (

        ̊֐f_close()Ɠs܂At@C͈Jꂽ܂܂ɂȂAǂݏ𑱍sł܂BMOȂǁA݃[hŒԃt@CJĂAvP[VɂāAI܂͋؂̗ǂƂł̊֐gp邱ƂɂAsӂ̓df⃁fBA̎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/ja/unlink.html b/doc/ja/unlink.html index 9a45c8a..ac38552 100644 --- a/doc/ja/unlink.html +++ b/doc/ja/unlink.html @@ -54,11 +54,11 @@ FRESULT f_unlink (

        -

        폜Ώۂ̃IuWFNg̏ɓĂ͂܂ꍇÃANZX͋(FR_DENIED܂FR_LOCKED)֐͎s܂B +

        폜Ώۂ̃IuWFNg̏ɓĂ͂܂ꍇÃANZX͋ۂ֐͎s܂B

          -
        • [hEI[(AM_RDO)ĂB
        • -
        • łȂTuEfBNg܂̓JgEfBNgłB
        • -
        • JĂt@C܂̓TuEfBNgłBdANZXLȂƂ͈Sɋۂ܂AłȂƂ͕sȑƂȂAFAT\j󂳂”\܂B
        • +
        • [hEI[(AM_RDO)Ăꍇ́A(FR_DENIED)B
        • +
        • łȂTuEfBNg܂̓JgEfBNgłꍇ́A(FR_DENIED)B
        • +
        • JĂt@C܂̓TuEfBNgłꍇ́AdANZXLȂSɋ(FR_LOCKED)܂AłȂƂ͕sȑƂȂAFAT\j󂳂”\܂B

        diff --git a/doc/updates.txt b/doc/updates.txt index 66c2b20..a86c01c 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 eef0b64..e769209 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 461e99a..2ed3859 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 03eecbd..d7d690c 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 c26cb78..a93d9a2 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 cdf21c7..4ebb8c6 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 */ /*---------------------------------------------------------------------------/ @@ -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 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,13 +109,14 @@ #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 0 /* 0 to 2 */ @@ -138,10 +139,10 @@ #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 */ @@ -153,10 +154,10 @@ #define _MIN_SS 512 #define _MAX_SS 512 -/* 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 +/* 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 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. -*/ - - #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 */ - -/* 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 7f33b11..8b41fc2 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