From e6cd91ca0b64800d365745cb0b767eff85feaf0f Mon Sep 17 00:00:00 2001 From: savelij13 Date: Thu, 11 Sep 2025 09:36:45 +0300 Subject: [PATCH] fatfs v0.07e Nov 03,2009: - Separated out configuration options from ff.h to ffconf.h. - Added a configuration option, _LFN_UNICODE. - Fixed f_unlink() fails to remove a sub-dir on _FS_RPATH. - Fixed name matching error on the 13 char boundary. - Changed f_readdir() to return the SFN with always upper case on non-LFN cfg. --- doc/00index_e.html | 30 +++-- doc/00index_j.html | 27 ++--- doc/css_e.css | 2 +- doc/css_j.css | 2 +- doc/en/appnote.html | 96 +++++++++++---- doc/en/chdir.html | 12 +- doc/en/chdrive.html | 10 +- doc/en/chmod.html | 10 +- doc/en/close.html | 8 +- doc/en/dinit.html | 2 +- doc/en/dioctl.html | 7 +- doc/en/dread.html | 2 +- doc/en/dwrite.html | 2 +- doc/en/fattime.html | 2 +- doc/en/filename.html | 14 +-- doc/en/forward.html | 9 +- doc/en/getfree.html | 15 ++- doc/en/gets.html | 9 +- doc/en/lseek.html | 50 ++++---- doc/en/mkdir.html | 10 +- doc/en/mkfs.html | 15 ++- doc/en/mount.html | 12 +- doc/en/open.html | 43 ++++--- doc/en/opendir.html | 12 +- doc/en/printf.html | 28 +++-- doc/en/putc.html | 10 +- doc/en/puts.html | 12 +- doc/en/read.html | 12 +- doc/en/readdir.html | 15 ++- doc/en/rename.html | 26 +++-- doc/en/sfatfs.html | 2 +- doc/en/sfileinfo.html | 2 +- doc/en/stat.html | 2 +- doc/en/sync.html | 10 +- doc/en/truncate.html | 10 +- doc/en/unlink.html | 18 ++- doc/en/utime.html | 12 +- doc/en/write.html | 13 ++- doc/ja/appnote.html | 89 +++++++++++--- doc/ja/chdir.html | 12 +- doc/ja/chdrive.html | 9 +- doc/ja/chmod.html | 14 ++- doc/ja/close.html | 8 +- doc/ja/dinit.html | 2 +- doc/ja/fattime.html | 2 +- doc/ja/filename.html | 14 +-- doc/ja/forward.html | 9 +- doc/ja/getfree.html | 15 ++- doc/ja/gets.html | 7 +- doc/ja/lseek.html | 31 ++--- doc/ja/mkdir.html | 12 +- doc/ja/mkfs.html | 7 +- doc/ja/mount.html | 6 + doc/ja/open.html | 39 ++++--- doc/ja/opendir.html | 14 ++- doc/ja/printf.html | 13 ++- doc/ja/putc.html | 8 +- doc/ja/puts.html | 8 +- doc/ja/read.html | 10 +- doc/ja/readdir.html | 21 +++- doc/ja/rename.html | 20 ++-- doc/ja/sfatfs.html | 2 +- doc/ja/sfileinfo.html | 6 +- doc/ja/stat.html | 12 +- doc/ja/sync.html | 9 +- doc/ja/truncate.html | 8 +- doc/ja/unlink.html | 16 ++- doc/ja/utime.html | 16 ++- doc/ja/write.html | 11 +- doc/patches.html | 18 --- doc/updates.txt | 13 ++- src/00readme.txt | 10 +- src/diskio.h | 2 +- src/ff.c | 264 ++++++++++++++++++++++-------------------- src/ff.h | 172 ++++----------------------- src/option/syncobj.c | 52 +++++---- 76 files changed, 918 insertions(+), 636 deletions(-) delete mode 100644 doc/patches.html diff --git a/doc/00index_e.html b/doc/00index_e.html index c32b9da..7eb4cd0 100644 --- a/doc/00index_e.html +++ b/doc/00index_e.html @@ -3,8 +3,7 @@ - - + ELM - FAT File System Module @@ -16,20 +15,21 @@
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 cheap microcontrollers, such as 8051, PIC, AVR, SH, Z80, H8, ARM 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 low cost microcontrollers, such as AVR, 8051, PIC, ARM, Z80 and etc..., without any change. Petit FatFs module is also available here.

Features

@@ -38,7 +38,7 @@

Application Interface

-

FatFs module provides following functions.

+

FatFs module provides following functions to access the FAT volumes.

  • f_mount - Register/Unregister a Work Area
  • f_open - Open/Create a File
  • @@ -71,7 +71,7 @@

    Disk I/O Interface

    -

    Since the FatFs module is completely separated from disk I/O layer, it requires following functions to lower layer to read/write the physical disk and to get current time. The low level disk I/O module is not a part of FatFs module and it must be provided by user. The sample drivers are also available in the resources.

    +

    Since the FatFs module is completely separated from disk I/O layer, it requires following functions to lower layer to read/write the physical disk and to get current time. The low level disk I/O module is not a part of FatFs module so that it must be provided by user. The sample drivers are also available in the resources.

    • disk_initialize - Initialize disk drive
    • disk_status - Get disk status
    • @@ -85,10 +85,10 @@

      Resources

      -

      The FatFs module is a free software and is opened for education, research and development. You can use, modify and/or republish it for personal, non-profit or commercial use without any restriction under your responsibility.

      +

      The FatFs module is a free software opened for education, research and development. You can use, modify and/or redistribute it for personal, non-profit use or commercial products without any restriction under your responsibility. For further information, refer to the application note.

      -
      -

      Return

      diff --git a/doc/00index_j.html b/doc/00index_j.html index 7c64b97..dca9e4e 100644 --- a/doc/00index_j.html +++ b/doc/00index_j.html @@ -3,8 +3,7 @@ - - + ELM - 汎用FATファイルシステム・モジュール @@ -16,19 +15,20 @@
      layer -

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

      +

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

      FatFsモジュールの特徴

        -
      • FAT12, FAT16, FAT32に対応
      • -
      • 複数のボリューム(物理ドライブ・区画)に対応
      • -
      • 2種類の区画フォーマット(FDISKとSuper-floppy)に対応
      • +
      • Windows互換 FATファイル・システム
      • +
      • プラットフォーム非依存
      • +
      • コンパクトなコード・サイズとRAM使用量
      • 多くの構成オプション:
          -
        • 長いファイル名(LFN)
        • -
        • 複数のコード・ページ
        • +
        • 複数のボリューム(物理ドライブ・区画)
        • +
        • DBCSを含む複数のOEMコード・ページ
        • +
        • 長いファイル名(LFN)対応 (Unicode APIも選択可)
        • マルチタスク対応
        • マルチ・セクタ・サイズ対応
        • -
        • リードオンリー、一部機能の削除、バッファ構成等...
        • +
        • リード・オンリー、一部APIの削除、バッファ構成、その他…
      @@ -70,7 +70,7 @@

      下位レイヤI/F

      -

      FatFsモジュールは、物理ドライブへのアクセスや現在時刻を得るため、下位レイヤに次のインターフェースを要求します。これらのインターフェースを持つそれぞれの記録メディアに対応したディスクI/Oモジュールは、ユーザにより用意する必要があります。資料にサンプル・ドライバあり。

      +

      FatFsモジュールは、物理ドライブ等へのアクセスのため、下位レイヤに次のインターフェースを要求します。それぞれの記録メディアに対応したディスクI/Oモジュールは、ユーザによって用意される必要があります。資料にドライバを含むサンプル・プロジェクトあり。

      • disk_initialize - ディスク・ドライブの初期化
      • disk_status - ディスク・ドライブの状態取得
      • @@ -84,10 +84,10 @@

        資料

        -

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

        +

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

        - -
        -

        戻る

        diff --git a/doc/css_e.css b/doc/css_e.css index 0b2b300..abcf90d 100644 --- a/doc/css_e.css +++ b/doc/css_e.css @@ -12,7 +12,7 @@ pre em {font-style: italic; font-weight: normal;} strong {} pre {margin: 0.5em 1em; padding: 0.5em; line-height: 1.2em; background-color: white;} tt {margin: 0 0.2em;} -ol {margin: 0 2em;} +ol {margin: 0 2.5em;} ul {margin: 0 2em;} dl {margin: 0 1em;} dt {font-family: monospace;} diff --git a/doc/css_j.css b/doc/css_j.css index 15da42c..216bea7 100644 --- a/doc/css_j.css +++ b/doc/css_j.css @@ -15,7 +15,7 @@ pre em {font-style: italic; font-weight: normal;} strong {} pre {margin: 0.5em 1em; padding: 0.5em; line-height: 1.2em; letter-spacing: 0; background-color: white;} tt {margin: 0 0.2em; letter-spacing: 0;} -ol {margin: 0 2em;} +ol {margin: 0 2.5em;} ul {margin: 0 2em;} dl {margin: 0 1em;} dt {font-family: monospace;} diff --git a/doc/en/appnote.html b/doc/en/appnote.html index 70f4113..5ab9e46 100644 --- a/doc/en/appnote.html +++ b/doc/en/appnote.html @@ -13,29 +13,59 @@
        -

        Considerations on porting to various platform

        +

        Basic considerations on porting

        The FatFs module is assuming following terms on portability.

        • ANSI C
          The FatFs module is a middleware that written in ANSI C. There is no platform dependence, so long as the compiler is in compliance with ANSI C.
        • Size of integer types
          -The FatFs module assumes that size of char/short/long are 8/16/32-bit and int is 16 or 32 bit. These correspondence are defined in integer.h. This will not be a problem on most compilers. When any conflict with existing definitions is occured, you must resolve it with care.
        • +The FatFs module assumes that size of char/short/long are 8/16/32 bit and int is 16 or 32 bit. These correspondence are defined in integer.h. This will not be a problem on most compilers. When any conflict with existing definitions is occured, you must resolve it with care.
        -

        Memory Usage (R0.07c)

        +

        How to port

        +

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

        - - + + + + + + + + + + +
        AVRH8/300HPICTLCS-870/CV850ESSH2ARM7TDMIIA-32
        CompilerWinAVR(gcc)CH38C30(gcc)CC870CCA850SHCWinARM(gcc)MSC
        FunctionRequired when:
        disk_initializeAlways
        disk_statusAlways
        disk_readAlways
        disk_write_FS_READONLY == 0
        disk_ioctl (CTRL_SYNC)_FS_READONLY == 0
        disk_ioctl (GET_SECTOR_COUNT)_USE_MKFS == 1
        disk_ioctl (GET_SECTOR_SIZE)_MAX_SS >= 1024
        disk_ioctl (GET_BLOCK_SIZE)_USE_MKFS == 1
        get_fattime_FS_READONLY == 0
        +
        + +
        +

        Limits

        +
          +
        • 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 (4G-1 bytes).
        • +
        • Volume size: Depends on FAT specs (upto 2T,4T or 8T bytes).
        • +
        • Cluster size: Upto 64K bytes. Upto 32K bytes for f_mkfs().
        • +
        • Sector size: Depends on FAT specs (upto 4K bytes).
        • +
        +
        + +
        +

        Memory Usage (R0.07e)

        + + + - - - - - - - + + + + + + +
        AVRH8/300HPICTLCS-870/CV850ESSH2ARM7TDMIx86
        CompilerWinAVR(gcc)CH38C30(gcc)CC870CCA850SHCWinARM(gcc)VC6
        _WORD_ACCESS10011001
        ROM (Full, R/W)1196210433107531515377478707105847337
        ROM (Min, R/W)74666799677299064901559965484787
        ROM (Full, R/O)54004687480467443539379946763380
        ROM (Min, R/O)38043527342150402561286732762533
        RAM (Static)D*2 + 2D*4 + 2D*2 + 2D*2 + 2D*4 + 2D*4 + 2D*4 + 2D*4 + 2
        RAM (Dynamic)
        (_FS_TINY == 0)
        D*560 +
        F*544
        D*560 +
        F*550
        D*560 +
        F*544
        D*560 +
        F*550
        D*560 +
        F*550
        D*560 +
        F*550
        D*560 +
        F*550
        RAM (Dynamic)
        (_FS_TINY == 1)
        D*560 +
        F*32
        D*560 +
        F*36
        D*560 +
        F*32
        D*560 +
        F*32
        D*560 +
        F*36
        D*560 +
        F*36
        D*560 +
        F*36
        D*560 +
        F*36
        text (Full, R/W)1219410559109241522976868727105647342
        text (Min, R/W)79886903710899604884565165444764
        text (Full, R/O)55324753502067603462377746243316
        text (Min, R/O)40403631373650832556290732842510
        bssD*2 + 2D*4 + 2D*2 + 2D*2 + 2D*4 + 2D*4 + 2D*4 + 2D*4 + 2
        Work area
        (_FS_TINY == 0)
        D*560 +
        F*544
        D*560 +
        F*550
        D*560 +
        F*544
        D*560 +
        F*550
        D*560 +
        F*550
        D*560 +
        F*550
        D*560 +
        F*550
        Work area
        (_FS_TINY == 1)
        D*560 +
        F*32
        D*560 +
        F*36
        D*560 +
        F*32
        D*560 +
        F*32
        D*560 +
        F*36
        D*560 +
        F*36
        D*560 +
        F*36
        D*560 +
        F*36

        These are the memory usage on some target systems with following condition. The memory sizes are in unit of byte, D means number of volumes and F means number of open files. All samples are optimezed in code size.

        @@ -89,17 +119,17 @@ _FS_REENTRANT    0 (Disable reentrancy)
         
         

        Long File Name

        -

        The FatFs module supports long file name (LFN) from 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 or 2, and add a Unicode code conversion function ff_convert and ff_wtoupper to the project. This function is available in cc*.c. 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. When the size of working buffer is insufficient for the given file name, the file function will fail with FR_INVALID_NAME. When enable the LFN feature with re-entrant feature, _USE_LFN must be set to 2. In this case, the file funciton allocates the working buffer on the stack. The working buffer occupies (_MAX_LFN + 1) * 2 bytes so that the caller's stack must be a sufficient size considering the working buffer.

        +

        The FatFs module supports long file name (LFN) from 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 or 2, and add a Unicode code conversion function ff_convert and ff_wtoupper to the project. This function is available in cc*.c. 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. In this case, the file function allocates the working buffer on the stack. The working buffer occupies (_MAX_LFN + 1) * 2 bytes so that the caller's stack must be a sufficient size considering the working buffer.

        - - - - - - + + + + + +
        LFN cfg on ARM7
        Code pageROM size [bytes]
        SBCS+3721
        932(Shift-JIS)+62609
        936(GBK)+177797
        949(Korean)+139857
        950(Big5)+111497
        Code pageProgram size
        SBCS+3.7K
        932(Shift-JIS)+62K
        936(GBK)+177K
        949(Korean)+139K
        950(Big5)+111K
        -

        When the LFN feature is enabled, the module size will be increased depends on the selected code page. Right table shows the difference in module size when LFN is enabled with some code pages. We are the Japanese, Chinese and Korean have tens of thousands of characters. Unfortunately, it requires a huge OEM-Unicode bidirectional conversion table and the module size will be drastically increased that shown in the table. As the result, the FatFs with LFN will not able to be implemented to most 8-bit microcontrollers including AVR. This is the reason why I had not been interested in implementing the LFN feature for a long time :-)

        +

        When the LFN feature is enabled, the module size will be increased depends on the selected code page. Right table shows how many bytes increased when LFN feature is enabled with some code pages. We are the Japanese, Chinese and Korean have tens of thousands of characters. Unfortunately, it requires a huge OEM-Unicode bidirectional conversion table and the module size will be drastically increased that shown in the table. As the result, the FatFs with LFN will not able to be implemented to most 8-bit microcontrollers including AVR. This is the reason why I had not been interested in implementing the LFN feature for a long time :-)

        Note that the LFN feature on the FAT file system is a patent of Microsoft Corporation. When enable it on the commercial products, a license from Microsoft may be required depends on the final destination.

        @@ -135,7 +165,7 @@ _FS_REENTRANT 0 (Disable reentrancy)

        Critical Section

        -

        When write operation to the FAT file system is interrupted due to any accidental failure, such as sudden blackout, incorrect disk removal and unrecoverable disk error, the FAT structure can be collapted. Following images shows the critical section on the FatFs module.

        +

        When write operation to the FAT file system is interrupted due to any accidental failure, such as sudden blackout, incorrect disk removal and unrecoverable disk error, the FAT structure can be collapted. Following images shows the critical section on the FatFs application.

        Figure 4. Long critical section
        fig.4 @@ -158,7 +188,29 @@ Figure 5. Minimized critical section

        Unicode API

        -

        FatFs supports to switch the character encoding to Unicode on the API. For more information, refer to the description in the file name.

        +

        FatFs supports OEM code set on the API in default but FatFs can also switch the code set to Unicode. For more information, refer to the description in the file name.

        +
        + + +
        +

        About FatFs License

        +

        This is a copy of the FatFs license document that included in the source codes.

        +
        /*----------------------------------------------------------------------------/
        +/  FatFs - FAT file system module  R0.07e                    (C)ChaN, 2009
        +/-----------------------------------------------------------------------------/
        +/ 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
        +/ developments under license policy of following trems.
        +/
        +/  Copyright (C) 2009, ChaN, all right reserved.
        +/
        +/ * The FatFs module is a free software and there is NO WARRANTY.
        +/ * No restriction on use. You can use, modify and redistribute it for
        +/   personal, non-profit or commercial products UNDER YOUR RESPONSIBILITY.
        +/ * Redistributions of source code must retain the above copyright notice.
        +/
        +/-----------------------------------------------------------------------------/
        +

        Therefore FatFs license is one of the BSD-style license but there is a big difference. Because FatFs is for embedded projects, the conditions for redistributions in binary form, such as embedded code, hex file and binary library, are not specified to increase its usability. The documentation of the distributions need not include about FatFs and its license document, and it may also. Of course FatFs is compatible with the projects under GNU GPL. When redistribute it with any modification, the license can also be changed to GNU GPL or BSD license.

        Return

        diff --git a/doc/en/chdir.html b/doc/en/chdir.html index 0c7b2b8..a4f9489 100644 --- a/doc/en/chdir.html +++ b/doc/en/chdir.html @@ -49,14 +49,20 @@ FRESULT f_chdir (
        FR_NOT_ENABLED
        The logical drive has no work area.
        FR_NO_FILESYSTEM
        -
        There is no valid FAT partition on the disk.
        +
        There is no valid FAT volume on the disk.

        Description

        -

        The f_chdir function changes the current directory of the logical drive. The current directory of a drive is initialized to the root directory when the drive is auto-mounted. Note that the current directory is retained in the each file system object so that it also affects other tasks that using the drive. This function is available when _FS_RPATH == 1.

        +

        The f_chdir function changes the current directory of the logical drive. The current directory of a drive is initialized to the root directory when the drive is auto-mounted. Note that the current directory is retained in the each file system object so that it also affects other tasks that using the drive.

        +
        + + +
        +

        QuickInfo

        +

        Available when _FS_RPATH == 1.

        @@ -72,7 +78,7 @@ FRESULT f_chdir (
        -

        References

        +

        See Also

        f_chdrive

        diff --git a/doc/en/chdrive.html b/doc/en/chdrive.html index 4d70e89..3e0c177 100644 --- a/doc/en/chdrive.html +++ b/doc/en/chdrive.html @@ -42,11 +42,17 @@ FRESULT f_chdrive (

        Description

        -

        The f_chdrive function changes the current drive. The initial value of the current drive number is 0. Note that the current drive is retained in a static variable so that it also affects other tasks that using the file functions. This function is available when _FS_RPATH == 1.

        +

        The f_chdrive function changes the current drive. The initial value of the current drive number is 0. Note that the current drive is retained in a static variable so that it also affects other tasks that using the file functions.

        -

        References

        +

        QuickInfo

        +

        Available when _FS_RPATH == 1.

        +
        + + +
        +

        See Also

        f_chdir

        diff --git a/doc/en/chmod.html b/doc/en/chmod.html index 76eb187..bc020db 100644 --- a/doc/en/chmod.html +++ b/doc/en/chmod.html @@ -67,14 +67,20 @@ FRESULT f_chmod (
        FR_NOT_ENABLED
        The logical drive has no work area.
        FR_NO_FILESYSTEM
        -
        There is no valid FAT partition on the disk.
        +
        There is no valid FAT volume on the disk.

        Description

        -

        The f_chmod function changes the attribute of a file or directory. This function is not available in read-only configuration and minimization level of >=1.

        +

        The f_chmod function changes the attribute of a file or directory.

        +
        + + +
        +

        QuickInfo

        +

        Available when _FS_READONLY == 0 and _FS_MINIMIZE == 0.

        diff --git a/doc/en/close.html b/doc/en/close.html index 9f43e0b..b933c39 100644 --- a/doc/en/close.html +++ b/doc/en/close.html @@ -53,7 +53,13 @@ FRESULT f_close (
        -

        References

        +

        QuickInfo

        +

        Always available.

        +
        + + +
        +

        See Also

        f_open, f_read, f_write, f_sync, FIL, FATFS

        diff --git a/doc/en/dinit.html b/doc/en/dinit.html index e777500..c8c14d6 100644 --- a/doc/en/dinit.html +++ b/doc/en/dinit.html @@ -32,12 +32,12 @@ DSTATUS disk_initialize (

        Return Values

        This function returns a disk status as the result. For details of the disk status, refer to the disk_status function.

        -

        This function is called from volume mount process in the FatFs module to manage the media change. Application program must not call this function while FatFs module is active, or FAT structure on the drive may be collapted.

        Description

        The disk_initialize function initializes a physical drive. When the function succeeded, STA_NOINIT flag in the return value is cleard.

        +

        This function is called from volume mount process in the FatFs module to manage the media change. Application program must not call this function while FatFs module is active, or FAT structure on the volume can be collapted. To re-initialize the file system, use f_mount function.

        Return

        diff --git a/doc/en/dioctl.html b/doc/en/dioctl.html index 0f3dc4e..269aaa8 100644 --- a/doc/en/dioctl.html +++ b/doc/en/dioctl.html @@ -55,10 +55,9 @@ DRESULT disk_ioctl (

        The FatFs module uses only device independent commands described below. Any device dependent function is not used.

        - - - + + +
        CommandDescription
        CTRL_SYNCMake sure that the disk drive has finished pending write process. When the disk I/O module has a write back cache, flush the dirty sector immediately. This function is not required in read-only configuration.

        -
        GET_SECTOR_SIZEReturns sector size of the drive into the WORD variable pointed by Buffer. This functions is not required in single sector size configuration, _MAX_SS is 512.
        GET_SECTOR_COUNTReturns total sectors on the drive into the DWORD variable pointed by Buffer. This function is used in only f_mkfs function.
        CTRL_SYNCMake sure that the disk drive has finished pending write process. When the disk I/O module has a write back cache, flush the dirty sector immediately. This command is not required in read-only configuration.
        GET_SECTOR_SIZEReturns sector size of the drive into the WORD variable pointed by Buffer. This command is not required in single sector size configuration, _MAX_SS is 512.
        GET_SECTOR_COUNTReturns total sectors on the drive into the DWORD variable pointed by Buffer. This command is used in only f_mkfs function.
        GET_BLOCK_SIZEReturns erase block size of the memory array in unit of sector into the DWORD variable pointed by Buffer. When the erase block size is unknown or magnetic disk device, return 1. This command is used in only f_mkfs function.
      diff --git a/doc/en/dread.html b/doc/en/dread.html index 3dce80a..873ae1b 100644 --- a/doc/en/dread.html +++ b/doc/en/dread.html @@ -29,7 +29,7 @@ DRESULT disk_read (
      Drive
      Specifies the physical drive number.
      Buffer
      -
      Pointer to the byte array to store the read data. The buffer size of number of bytes to be read is required. The start address specified by upper layer may be aligned or non-aligned.
      +
      Pointer to the byte array to store the read data. The buffer size of number of bytes to be read, sector size * sector count, is required. The memory address specified by upper layer may or may not be aligned to word boundary.
      SectorNumber
      Specifies the start sector number in logical block address (LBA).
      SectorCount
      diff --git a/doc/en/dwrite.html b/doc/en/dwrite.html index 18d75f2..bb646ac 100644 --- a/doc/en/dwrite.html +++ b/doc/en/dwrite.html @@ -29,7 +29,7 @@ DRESULT disk_write (
      Drive
      Specifies the physical drive number.
      Buffer
      -
      Pointer to the byte array to be written. The start address specified by upper layer may be aligned or non-aligned.
      +
      Pointer to the byte array to be written. The memory address specified by upper layer may or may not be aligned to word boundary.
      SectorNumber
      Specifies the start sector number in logical block address (LBA).
      SectorCount
      diff --git a/doc/en/fattime.html b/doc/en/fattime.html index 01bda3d..eee3ed5 100644 --- a/doc/en/fattime.html +++ b/doc/en/fattime.html @@ -41,7 +41,7 @@ DWORD get_fattime (void);

      Description

      -

      The get_fattime function must return any valid time even if the system does not support a real time clock. This fucntion is not required in read only configuration.

      +

      The get_fattime function must return any valid time even if the system does not support a real time clock. If a zero is returned, the file will not have a valid time. This fucntion is not required in read only configuration.

      diff --git a/doc/en/filename.html b/doc/en/filename.html index b38bbca..6f6ecc0 100644 --- a/doc/en/filename.html +++ b/doc/en/filename.html @@ -12,13 +12,13 @@

      Format of the path names

      -

      The path name format on the FatFs module is similer to MS-DOS as follows.

      +

      The path name format 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 and 8.3 format file name. The long file name can be handled in LFN configuration (_USE_LFN == 1). The path names are input/output in local code (SBCS/MBCS) or Unicode string depends on the configuration options. The sub directories are separated with a / or \. The logical drive number is specified in a numeral with a colon. When the drive number is omitted, it is assumed as default drive (0 or current drive).

      -

      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 following from the root directory. Dot names are not available. 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, the path is followed from the current directory set with f_chdir function. Dot names are also available for the path name. The default drive number is the current drive number set with f_chdrive function.

      +

      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 differences between DOS/Windows are directory separator and logical drive number. The sub directories are separated with a / or \. The logical drive is specified in a numeral with a colon. When the drive number is omitted, it is assumed as default drive (0 or current drive). Leading/embedded spaces in the given path name are valid as a part of the name on LFN configuration but they are recognized as end of the path name on non-LFN configuration.

      +

      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, the path is followed from the current directory set with f_chdir function. Dot names are also allowed for the directory name. The default drive number is the current drive number set with f_chdrive function.

      @@ -38,7 +38,7 @@


      Unicode API

      -

      The type of arguments that specifies the file names are defined as XCHAR, which is the alias of char in default. The code set of the file name string is the local code set that specifid by _CODE_PAGE. When _LFN_UNICODE is set to 1 with LFN configuration, the type of the XCHAR is switched to unsigned short (wide character) to support Unicode. In this case, the LFN feature is fully supported and the Unicode specific characters, such as 笙・, 笘ュ and 笶カ, can also be used.

      +

      The path names are input/output in either OEM code (SBCS/DBCS) or Unicode depends on the configuration options. The type of arguments that specifies the file names are defined as XCHAR which is an alias of char in default. The code set of the file name string is the OEM code set specifid by _CODE_PAGE. When _LFN_UNICODE is set to 1 under LFN configuration, the type of the XCHAR is switched to unsigned short (wide character) to support Unicode. In this case, the LFN feature is fully supported and the Unicode specific characters, such as 笨昶亂笨。笘ク笘ュ, can also be used for the path name.


      @@ -56,11 +56,11 @@ const PARTITION Drives[] = { {1, 0} /* Logical drive 3 ==> Physical drive 1 */ }; -

      There are some consideration when use _MULTI_PARTITION configuration.

      +

      There are some considerations when use _MULTI_PARTITION configuration.

      • Only pri-partition (0-3) can be mounted.
      • When the physical drive has no partition table (SFD format), the partition number is ignored.
      • -
      • The physical drive that has two or more logical drives must not be removable drive.
      • +
      • The physical drive that has two or more logical drives must be a fixed drive.
      diff --git a/doc/en/forward.html b/doc/en/forward.html index 7f647d8..fec6d6e 100644 --- a/doc/en/forward.html +++ b/doc/en/forward.html @@ -60,7 +60,12 @@ FRESULT f_forward (

      Description

      The f_forward function reads the data from the file and forward it to the outgoing stream without data buffer. This is suitable for small memory system because it does not require any data buffer at application module. The file pointer of the file object increases in number of bytes forwarded. In case of *ByteFwd < ByteToFwd without error, it means the requested bytes could not be transferred due to end of file or stream goes busy during data transfer.

      -

      This function is available on _USE_FORWARD == 1 and _FS_TINY == 1.

      +
      + + +
      +

      QuickInfo

      +

      Available when _USE_FORWARD == 1 and _FS_TINY == 1.

      @@ -128,7 +133,7 @@ FRESULT play_file (
      -

      References

      +

      See Also

      f_open, fgets, f_write, f_close, FIL

      diff --git a/doc/en/getfree.html b/doc/en/getfree.html index 6477097..53bafe3 100644 --- a/doc/en/getfree.html +++ b/doc/en/getfree.html @@ -59,7 +59,12 @@ FRESULT f_getfree (

      Descriptions

      The f_getfree function gets number of free clusters on the drive. The member csize in the file system object is refrecting number of sectors per cluster, so that the free space in unit of sector can be calcurated with this. When FSInfo structure on FAT32 volume is not in sync, this function can return an incorrect free cluster count.

      -

      This function is not supported in read-only configuration and minimization level of >= 1.

      +
      + + +
      +

      QuickInfo

      +

      Available when _FS_READONLY == 0 and _FS_MINIMIZE == 0.

      @@ -70,15 +75,15 @@ FRESULT f_getfree ( DWORD fre_clust, fre_sect, tot_sect; - // Get drive information and free clusters + /* Get drive information and free clusters */ res = f_getfree("/", &fre_clust, &fs); if (res) die(res); - // Get total sectors and free sectors + /* Get total sectors and free sectors */ tot_sect = (fs->max_clust - 2) * fs->csize; fre_sect = fre_clust * fs->csize; - // Print free space in unit of KB (assuming 512B/sector) + /* Print free space in unit of KB (assuming 512B/sector) */ printf("%lu KB total drive space.\n" "%lu KB available.\n", fre_sect / 2, tot_sect / 2); @@ -87,7 +92,7 @@ FRESULT f_getfree (
      -

      References

      +

      See Also

      FATFS

      diff --git a/doc/en/gets.html b/doc/en/gets.html index e0c0c2b..d3f235c 100644 --- a/doc/en/gets.html +++ b/doc/en/gets.html @@ -44,12 +44,17 @@ char* f_gets (

      Description

      The f_gets() is a wrapper function of f_read(). The read operation continues until a '\n' is stored, reached end of file or buffer is filled with Size - 1 characters. The read string is terminated with a '\0'. When the file has reached end of the file or any error occured during read operation, f_gets() returns a NULL. The EOF and error status can be examined with f_eof() and f_error() macro.

      -

      This function is available when _USE_STRFUNC is 1 or 2. When it is set to 2, '\r' contained in the file is stripped.

      -

      References

      +

      QuickInfo

      +

      Available when _USE_STRFUNC is 1 or 2. When it is set to 2, '\r's contained in the file are stripped out.

      +
      + + + diff --git a/doc/en/lseek.html b/doc/en/lseek.html index a7ee1b9..84882bc 100644 --- a/doc/en/lseek.html +++ b/doc/en/lseek.html @@ -12,7 +12,7 @@

      f_lseek

      -

      The f_lseek function moves the file read/write pointer of an open file object. It can also be used to extend the file size (cluster pre-allocation).

      +

      The f_lseek function moves the file read/write pointer of an open file object. It can also be used to increase the file size (cluster pre-allocation).

       FRESULT f_lseek (
      @@ -52,51 +52,57 @@ FRESULT f_lseek (
       
       

      Description

      -

      The f_lseek function moves the file R/W pointer of an open file. The offset can be specified in only origin from top of the file. When an offset above the file size is specified in write mode, the file size is extended to the offset and the data in the extended area is undefined. This is suitable to create a large file quickly, for fast write operation. After the f_lseek function succeeded, member fptr in the file object should be checked in order to make sure the R/W pointer has been moved correctry. In case of fptr is less than expected value, any of the followings has been occured.

      +

      The f_lseek function moves the file R/W pointer of an open file. The offset can be specified in only origin from top of the file. When an offset above the file size is specified in write mode, the file size is increased and the data in the expanded area is undefined. This is suitable to create a large file quickly, for fast write operation. After the f_lseek function succeeded, member fptr in the file object should be checked in order to make sure the R/W pointer has been moved correctry. In case of fptr is not the expected value, either of followings has been occured.

        -
      • In read-only mode, the Offset was clipped in file size.
      • -
      • The drive gets full during the file extending process.
      • +
      • End of file. The specified Offset was clipped at the file size because the file has been opened in read-only mode.
      • +
      • Disk full. There is insufficient free space on the volume to expand the file size.
      -

      This function is not supported in minimization level of >= 3.

      +
      + + +
      +

      QuickInfo

      +

      Available when _FS_MINIMIZE <= 2.

      +

      Example

      -    // Move to offset of 5000 from top of the file.
      -    res = f_lseek(&file, 5000);
      +    /* Move to offset of 5000 from top of the file */
      +    res = f_lseek(file, 5000);
       
      -    // Move to end of the file to append data
      -    res = f_lseek(&file, file.fsize);
      +    /* Move to end of the file to append data */
      +    res = f_lseek(file, file->fsize);
       
      -    // Forward 3000 bytes
      -    res = f_lseek(&file, file.fptr + 3000);
      +    /* Forward 3000 bytes */
      +    res = f_lseek(file, file->fptr + 3000);
       
      -    // Rewind 2000 bytes (take care on overflow)
      -    res = f_lseek(&file, file.fptr - 2000);
      +    /* Rewind 2000 bytes (take care on overflow) */
      +    res = f_lseek(file, file->fptr - 2000);
       
      -    // Cluster pre-allocation (to prevent buffer overrun on streaming write)
      +    /* Cluster pre-allocation (to prevent buffer overrun on streaming write) */
       
      -    res = f_open(&file, recfile, FA_CREATE_NEW | FA_WRITE); // Create a file
      +    res = f_open(file, recfile, FA_CREATE_NEW | FA_WRITE); /* Create a file */
       
      -    res = f_lseek(&file, PRE_SIZE);        // Pre-allocate clusters
      -    if (res || file.fptr != PRE_SIZE) .... // Check if the file is extended corrctly
      +    res = f_lseek(file, PRE_SIZE);         /* Pre-allocate clusters */
      +    if (res || file->fptr != PRE_SIZE) ... /* Check if the file size has been increased correctly */
       
      -    res = f_lseek(&file, DATA_START);      // Record data stream without cluster allocation delay
      +    res = f_lseek(file, DATA_START);       /* Record data stream without cluster allocation delay */
           ...
       
      -    res = f_truncate(&file);               // Truncate unused area
      -    res = f_lseek(&file, 0);               // Put file header
      +    res = f_truncate(file);                /* Truncate unused area */
      +    res = f_lseek(file, 0);                /* Put file header */
           ...
       
      -    res = f_close(&file);
      +    res = f_close(file);
       
      -

      References

      +

      See Also

      f_open, f_truncate, FIL

      diff --git a/doc/en/mkdir.html b/doc/en/mkdir.html index a841b1e..408846a 100644 --- a/doc/en/mkdir.html +++ b/doc/en/mkdir.html @@ -55,14 +55,20 @@ FRESULT f_mkdir (
      FR_NOT_ENABLED
      The logical drive has no work area.
      FR_NO_FILESYSTEM
      -
      There is no valid FAT partition on the disk.
      +
      There is no valid FAT volume on the disk.

      Description

      -

      The f_mkdir function creates a new directory. This function is not supported in read-only configuration and minimization level of >= 1.

      +

      The f_mkdir function creates a new directory.

      +
      + + +
      +

      QuickInfo

      +

      Available when _FS_READONLY == 0 and _FS_MINIMIZE == 0.

      diff --git a/doc/en/mkfs.html b/doc/en/mkfs.html index 7fbbd53..e8a71c8 100644 --- a/doc/en/mkfs.html +++ b/doc/en/mkfs.html @@ -17,7 +17,7 @@ FRESULT f_mkfs ( BYTE Drive, /* Logical drive number */ BYTE PartitioningRule, /* Partitioning rule */ - WORD AllocSize /* Allocation unit size */ + WORD AllocSize /* Size of the allocation unit */ ); @@ -28,9 +28,9 @@ FRESULT f_mkfs (
      Drive
      Logical drive number (0-9) to be formatted.
      PartitioningRule
      -
      When 0 is given, a partition table is created into first sector on the drive and then the file system is created on the partition. This is called FDISK format. When 1 is given, the file system starts from the first sector without partition table. This is often called super floppy (SFD) format.
      +
      When 0 is given, a partition table is created into the first sector on the drive and then the file system is created on the partition. This is called FDISK format and used for harddisk and memory card. When 1 is given, the file system starts from the first sector without partition table. This is often called super floppy disk (SFD) format and used for floppy disk and removable disk.
      AllocSize
      -
      Specifies allocation unit size in number of bytes per cluster. The value must be 0 or power of 2 in range of from 512 to 32768. When 0 is specified, the cluster size is determined by the drive size. FAT64 (64KB/cluster on FAT16) cannot be created by this function.
      +
      Specifies allocation unit size in number of bytes per cluster. The value must be 0 or power of 2 in range of from 512 to 32768. When 0 is specified, the cluster size is determined depends on the volume size. FAT64 (64KB/cluster on FAT16) cannot be created by this function.
      @@ -63,8 +63,13 @@ FRESULT f_mkfs (

      Description

      The f_mkfs function creates a FAT file system on the drive. There are two partitioning rules, FDISK and SFD, for removable media. It can be selected with an argument. The FDISK format is recommended for the most case. This function currently does not support multiple partition, so that existing partitions on the physical dirve will be deleted and re-created a new partition occupies entire disk space.

      -

      The FAT sub-type, FAT12/FAT16/FAT32, is determined by number of clusters on the drive and nothing else, according to the FAT specification issued by Microsoft. Thus which FAT sub-type is selected, is depends on the partition size and the specified cluster size. The cluster size affects performance of the file system and large cluster increases the performance.

      -

      This function is supported on only _USE_MKFS option is selected.

      +

      The FAT sub-type, FAT12/FAT16/FAT32, is determined by number of clusters on the drive and nothing else, according to the FAT specification issued by Microsoft. Thus which FAT sub-type is selected, is depends on the volume size and the specified cluster size. The cluster size affects performance of the file system and large cluster increases the performance.

      +
      + + +
      +

      QuickInfo

      +

      Available when _FS_READOLNY == 0 and _USE_MKFS == 1.

      diff --git a/doc/en/mount.html b/doc/en/mount.html index 71c6212..e82b8fb 100644 --- a/doc/en/mount.html +++ b/doc/en/mount.html @@ -44,13 +44,19 @@ FRESULT f_mount (

      Description

      -

      The f_mount function registers/unregisters a work area to the FatFs module. The work area must be given to the logical drive with this function prior to any other file function. To unregister a work area, specify a NULL to the FileSystemObject, and then the work area can be discarded.

      -

      This function only initializes the given work area and registers its address to the internal table, any access to the disk I/O layer does not occure. The volume mount process is performed on first file access after f_mount or media change.

      +

      The f_mount function registers/unregisters a work area to the FatFs module. The work area must be given to the each volume with this function prior to use any other file function. To unregister a work area, specify a NULL to the FileSystemObject, and then the work area can be discarded.

      +

      This function only initializes the given work area and registers its address to the internal table, any access to the disk I/O layer does not occure. The volume mount process is performed on first file access after f_mount function or media change.

      -

      References

      +

      QuickInfo

      +

      Always available.

      +
      + + +
      +

      See Also

      FATFS

      diff --git a/doc/en/open.html b/doc/en/open.html index c8c22fe..eda266d 100644 --- a/doc/en/open.html +++ b/doc/en/open.html @@ -26,7 +26,7 @@ FRESULT f_open (

      Parameters

      FileObject
      -
      Pointer to the file object structure to be created. After the f_open funciton succeeded, the file can be accessed with the file object structure until it is closed.
      +
      Pointer to the file object structure to be created.
      FileName
      Pointer to a null-terminated string that specifies the file name to create or open.
      ModeFlags
      @@ -36,7 +36,7 @@ FRESULT f_open (
      - +
      Path name_FS_RPATH == 0_FS_RPATH == 1
      file.txtA file in the root directory on the drive 0A file in the current directory on the current drive
      FA_READSpecifies read access to the object. Data can be read from the file.
      Combine with FA_WRITE for read-write access.
      FA_WRITESpecifies write access to the object. Data can be written to the file.
      Combine with FA_READ for read-write access.
      FA_OPEN_EXISTINGOpens the file. The function fails if the file is not existing. (Default)
      FA_OPEN_ALWAYSOpens the file, if it is existing. If not, the function creates the new file.
      FA_OPEN_ALWAYSOpens the file, if it is existing. If not, a new file is created.
      FA_CREATE_NEWCreates a new file. The function fails if the file is already existing.
      FA_CREATE_ALWAYSCreates a new file. If the file is existing, it is truncated and overwritten.
      @@ -76,16 +76,21 @@ FRESULT f_open (
      FR_NOT_ENABLED
      The logical drive has no work area.
      FR_NO_FILESYSTEM
      -
      There is no valid FAT partition on the disk.
      +
      There is no valid FAT volume on the disk.

      Description

      -

      The created file object is used for subsequent calls to refer to the file. When close an open file object, use f_close function. If the modified file is not closed, the file may be collapsed.

      +

      A file object is created when the function succeeded. The file object is used for subsequent read/write functions to refer to the file. When close an open file object, use f_close function. If the modified file is not closed, the file may be collapsed.

      Before using any file function, a work area (file system object) must be given to the logical drive with f_mount function. All file functions can work after this procedure.

      -

      The mode flags, FA_WRITE, FA_CREATE_ALWAYS, FA_CREATE_NEW, FA_OPEN_ALWAYS, are not available in read-only configuration.

      +
      + + +
      +

      QuickInfo

      +

      Always available. The mode flags, FA_WRITE, FA_CREATE_ALWAYS, FA_CREATE_NEW, FA_OPEN_ALWAYS, are not available when _FS_READONLY == 1.

      @@ -94,38 +99,38 @@ FRESULT f_open (
       void main (void)
       {
      -    FATFS fs[2];         // Work area (file system object) for logical drives
      -    FIL fsrc, fdst;      // file objects
      -    BYTE buffer[4096];   // file copy buffer
      -    FRESULT res;         // FatFs function common result code
      -    UINT br, bw;         // File R/W count
      +    FATFS fs[2];         /* Work area (file system object) for logical drives */
      +    FIL fsrc, fdst;      /* file objects */
      +    BYTE buffer[4096];   /* file copy buffer */
      +    FRESULT res;         /* FatFs function common result code */
      +    UINT br, bw;         /* File R/W count */
       
       
      -    // Register work area for logical drives
      +    /* Register work area for logical drives */
           f_mount(0, &fs[0]);
           f_mount(1, &fs[1]);
       
      -    // Open source file on the drive 1
      +    /* Open source file on the drive 1 */
           res = f_open(&fsrc, "1:srcfile.dat", FA_OPEN_EXISTING | FA_READ);
           if (res) die(res);
       
      -    // Create destination file on the drive 0
      +    /* Create destination file on the drive 0 */
           res = f_open(&fdst, "0:dstfile.dat", FA_CREATE_ALWAYS | FA_WRITE);
           if (res) die(res);
       
      -    // Copy source to destination
      +    /* Copy source to destination */
           for (;;) {
               res = f_read(&fsrc, buffer, sizeof(buffer), &br);
      -        if (res || br == 0) break;   // error or eof
      +        if (res || br == 0) break;   /* error or eof */
               res = f_write(&fdst, buffer, br, &bw);
      -        if (res || bw < br) break;   // error or disk full
      +        if (res || bw < br) break;   /* error or disk full */
           }
       
      -    // Close all files
      +    /* Close open files */
           f_close(&fsrc);
           f_close(&fdst);
       
      -    // Unregister work area before discard it
      +    /* Unregister work area prior to discard it */
           f_mount(0, NULL);
           f_mount(1, NULL);
       }
      @@ -134,7 +139,7 @@ void main (void)
       
       
       
      -

      References

      +

      See Also

      f_read, f_write, f_close, FIL, FATFS

      diff --git a/doc/en/opendir.html b/doc/en/opendir.html index a4c0e3e..93cdf2d 100644 --- a/doc/en/opendir.html +++ b/doc/en/opendir.html @@ -52,19 +52,25 @@ FRESULT f_opendir (
      FR_NOT_ENABLED
      The logical drive has no work area.
      FR_NO_FILESYSTEM
      -
      There is no valid FAT partition on the disk.
      +
      There is no valid FAT volume on the disk.

      Description

      -

      The f_opendir function opens an exsisting directory and creates the directory object for subsequent calls. The directory object structure can be discarded at any time without any procedure. This function is not supported in minimization level of >=2.

      +

      The f_opendir function opens an exsisting directory and creates the directory object for subsequent calls. The directory object structure can be discarded at any time without any procedure.

      -

      References

      +

      QuickInfo

      +

      Available when _FS_MINIMIZE <= 1.

      +
      + + +
      +

      See Also

      f_readdir, DIR

      diff --git a/doc/en/printf.html b/doc/en/printf.html index e17703a..bee2ef6 100644 --- a/doc/en/printf.html +++ b/doc/en/printf.html @@ -44,26 +44,36 @@ int f_printf (

      Description

      -

      The f_printf() is a wrapper function of f_putc() and f_puts(). The format control directive is a sub-set of standard library. It supports c s d u X for the data type, l for the precision and 0 for the flags.

      -

      This function is available when read-write configuration and _USE_STRFUNC is 1 or 2.

      +

      The f_printf() is a wrapper function of f_putc() and f_puts(). The format control directive is a sub-set of standard library shown as follos:

      +
        +
      • Type: c s d u X
      • +
      • Size: l
      • +
      • Flag: 0
      • +
      +
      + + +
      +

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

      Example

      -    f_printf(&fil, "%6d", -200);         // "  -200"
      -    f_printf(&fil, "%02u", 5);           // "05"
      -    f_printf(&fil, "%ld", 12345678L);    // "12345678"
      -    f_printf(&fil, "%08lX", 1194684UL);  // "00123ABC"
      -    f_printf(&fil, "%s", "String");      // "String"
      -    f_printf(&fil, "%c", 'a');           // "a"
      +    f_printf(&fil, "%6d", -200);         /* "  -200" */
      +    f_printf(&fil, "%02u", 5);           /* "05" */
      +    f_printf(&fil, "%ld", 12345678L);    /* "12345678" */
      +    f_printf(&fil, "%08lX", 1194684UL);  /* "00123ABC" */
      +    f_printf(&fil, "%s", "String");      /* "String" */
      +    f_printf(&fil, "%c", 'a');           /* "a" */
       
      -

      References

      +

      See Also

      f_open, f_putc, f_puts, f_gets, f_close, FIL

      diff --git a/doc/en/putc.html b/doc/en/putc.html index ee105a0..eac39be 100644 --- a/doc/en/putc.html +++ b/doc/en/putc.html @@ -40,12 +40,18 @@ int f_putc (

      Description

      -

      The f_putc() is a wrapper function of f_write(). This function is available when read-write configuration and _USE_STRFUNC is 1 or 2. When it is set 2, a '\n' is extended to "\r\n".

      +

      The f_putc() is a wrapper function of f_write().

      -

      Reference

      +

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

      +
      + + + diff --git a/doc/en/puts.html b/doc/en/puts.html index fda586a..9061a9b 100644 --- a/doc/en/puts.html +++ b/doc/en/puts.html @@ -34,18 +34,24 @@ int f_puts (

      Return Value

      -

      When the function succeeded, number of characters written (not minus value) is returned. When the function failed due to disk full or any error, an EOF will be returned.

      +

      When the function succeeded, number of characters written that is not minus value is returned. When the function failed due to disk full or any error, an EOF will be returned.

      Description

      -

      The f_puts() is a wrapper function of f_putc(). This function is available when read-write configuration and _USE_STRFUNC is 1 or 2. When it is set 2, a '\n' is extended to "\r\n".

      +

      The f_puts() is a wrapper function of f_putc().

      -

      Reference

      +

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

      +
      + + + diff --git a/doc/en/read.html b/doc/en/read.html index aa37c20..9289103 100644 --- a/doc/en/read.html +++ b/doc/en/read.html @@ -33,7 +33,7 @@ FRESULT f_read (
      ByteToRead
      Number of bytes to read in range of UINT.
      ByteRead
      -
      Pointer to the UINT variable to return number of bytes read. Return value is always valid after the function call.
      +
      Pointer to the UINT variable to return number of bytes read. The value is always valid after the function call regardless of the result.
    @@ -59,12 +59,18 @@ FRESULT f_read (

    Description

    -

    The file pointer of the file object increases in number of bytes read. After the function succeeded, *ByteRead should be checked to detect end of file. In case of *ByteRead < ByteToRead, it means the R/W pointer reached end of file during read operation.

    +

    The file pointer of the file object increases in number of bytes read. After the function succeeded, *ByteRead should be checked to detect the end of file. In case of *ByteRead < ByteToRead, it means the R/W pointer reached end of the file during read operation.

    -

    References

    +

    QuickInfo

    +

    Always available.

    +
    + + +
    +

    See Also

    f_open, fgets, f_write, f_close, FIL

    diff --git a/doc/en/readdir.html b/doc/en/readdir.html index 2e8969b..a5b040c 100644 --- a/doc/en/readdir.html +++ b/doc/en/readdir.html @@ -52,9 +52,14 @@ FRESULT f_readdir (

    Description

    The f_readdir function reads directory entries in sequence. All items in the directory can be read by calling f_readdir function repeatedly. When all directory entries have been read and no item to read, the function returns a null string into f_name[] member without any error. When a null pointer is given to the FileInfo, the read index of the directory object will be rewinded.

    -

    When LFN feature is enabled, lfname and lfsize in the file information structure must be initialized with valid value prior to calling the f_readdir function. The lfname is a pointer to the string buffer to return the long file name. The lfsize is the size of the string buffer. If either the size of read buffer or LFN working buffer is insufficient for the LFN or the entry has no LFN, a null string will be returned to the LFN read buffer. If the LFN contains any charactrer that cannot be converted to OEM code, a null string will be returned but this is not the case on Unicode API configuration. When lfname is a NULL, nothing of the LFN is returned.

    -

    When relative path feature is enabled (_FS_RPATH == 1), "." and ".." entries are not filtered out and it will appear in the read entries.

    -

    This function is not supported in minimization level of >=2.

    +

    When LFN feature is enabled, lfname and lfsize in the file information structure must be initialized with valid value prior to use the f_readdir function. The lfname is a pointer to the string buffer to return the long file name. The lfsize is the size of the string buffer in unit of character. If either the size of read buffer or LFN working buffer is insufficient for the LFN or the object has no LFN, a null string will be returned to the LFN read buffer. If the LFN contains any charactrer that cannot be converted to OEM code, a null string will be returned but this is not the case on Unicode API configuration. When lfname is a NULL, nothing of the LFN is returned. When the object has no LFN, any small capitals can be contained in the SFN.

    +

    When relative path feature is enabled (_FS_RPATH == 1), "." and ".." entries are not filtered out and it will appear in the read entries.

    +
    + + +
    +

    QuickInfo

    +

    Available when _FS_MINIMIZE <= 1.

    @@ -81,12 +86,12 @@ FRESULT scan_files (char* path) for (;;) { res = f_readdir(&dir, &fno); if (res != FR_OK || fno.fname[0] == 0) break; + if (fno.fname[0] == '.') continue; #if _USE_LFN fn = *fno.lfname ? fno.lfname : fno.fname; #else fn = fno.fname; #endif - if (*fn == '.') continue; if (fno.fattrib & AM_DIR) { sprintf(&path[i], "/%s", fn); res = scan_files(path); @@ -105,7 +110,7 @@ FRESULT scan_files (char* path)
    -

    References

    +

    See Also

    f_opendir, f_stat, FILINFO, DIR

    diff --git a/doc/en/rename.html b/doc/en/rename.html index 3b42175..2ddf9c5 100644 --- a/doc/en/rename.html +++ b/doc/en/rename.html @@ -12,11 +12,11 @@

    f_rename

    -

    Rename file or directory.

    +

    Renames an object.

     FRESULT f_rename (
    -  const XCHAR* OldName, /* Pointer to old file/directory name */
    -  const XCHAR* NewName  /* Pointer to new file/directory name */
    +  const XCHAR* OldName, /* Pointer to old object name */
    +  const XCHAR* NewName  /* Pointer to new object name */
     );
     
    @@ -25,9 +25,9 @@ FRESULT f_rename (

    Parameters

    OldName
    -
    Pointer to a null-terminated string specifies the old file/directory name to be renamed.
    +
    Pointer to a null-terminated string specifies the old object name to be renamed.
    NewName
    -
    Pointer to a null-terminated string specifies the new file/directory name without drive number. Existing object nannot be specified.
    +
    Pointer to a null-terminated string specifies the new object name without drive number.
@@ -48,7 +48,7 @@ FRESULT f_rename (
FR_NOT_READY
The disk drive cannot work due to no medium in the drive or any other reason.
FR_EXIST
-
There is an object that have a name equal to new name.
+
The new name is colliding with an existing name.
FR_DENIED
The new name could not be created due to any reason.
FR_WRITE_PROTECTED
@@ -60,24 +60,30 @@ FRESULT f_rename (
FR_NOT_ENABLED
The logical drive has no work area.
FR_NO_FILESYSTEM
-
There is no valid FAT partition on the disk.
+
There is no valid FAT volume on the disk.

Description

-

Rename a file or directory and can move it to other directory. Logical drive number is determined by old name, new name must not contain logical drive number. This function is not supported in read-only configuration or minimization level of >= 1.

+

Renames an object and can also move it to other directory. The logical drive number is determined by old name, new name must not contain a logical drive number. Do not rename open objects.

+
+ + +
+

QuickInfo

+

Available when _FS_READONLY == 0 and _FS_MINIMIZE == 0.

Example

-    // Rename a file or directory
+    /* Rename an object */
     f_rename("oldname.txt", "newname.txt");
 
-    // Rename and move a file or directory to other directory simultaneously
+    /* Rename and move an object to other directory */
     f_rename("oldname.txt", "dir1/newname.txt");
 
diff --git a/doc/en/sfatfs.html b/doc/en/sfatfs.html index 42e24a2..7512ec7 100644 --- a/doc/en/sfatfs.html +++ b/doc/en/sfatfs.html @@ -20,6 +20,7 @@ typedef struct _FATFS_ { BYTE csize; /* Number of sectors per cluster */ BYTE n_fats; /* Number of FAT copies */ BYTE wflag; /* win[] dirty flag (1:must be written back) */ + BYTE fsi_flag; /* fsinfo dirty flag (1:must be written back) */ WORD id; /* File system mount ID */ WORD n_rootdir; /* Number of root directory entries (0 on FAT32) */ #if _FS_REENTRANT @@ -29,7 +30,6 @@ typedef struct _FATFS_ { WORD s_size; /* Sector size */ #endif #if !_FS_READONLY - BYTE fsi_flag; /* fsinfo dirty flag (1:must be written back) */ DWORD last_clust; /* Last allocated cluster */ DWORD free_clust; /* Number of free clusters */ DWORD fsi_sector; /* fsinfo sector */ diff --git a/doc/en/sfileinfo.html b/doc/en/sfileinfo.html index 6ead1e6..42226b9 100644 --- a/doc/en/sfileinfo.html +++ b/doc/en/sfileinfo.html @@ -57,7 +57,7 @@ typedef struct _FILINFO_ {
fattrib
Indicates the file/directory attribute in combination of AM_DIR, AM_RDO, AM_HID, AM_SYS and AM_ARC.
fname[]
-
Indicates the file/directory name in 8.3 format null-terminated string.
+
Indicates the file/directory name in 8.3 format null-terminated string. It is always returnd with upper case on non-LFN configuration but it can be returned with lower case on LFN configuration.
lfname
Pointer to the LFN buffer to store the read LFN. This member must be initialized by application prior to use this structure. Not available on non-LFN configuration.
lfsize
diff --git a/doc/en/stat.html b/doc/en/stat.html index 49eb254..46a886b 100644 --- a/doc/en/stat.html +++ b/doc/en/stat.html @@ -54,7 +54,7 @@ FRESULT f_stat (
FR_NOT_ENABLED
The logical drive has no work area.
FR_NO_FILESYSTEM
-
There is no valid FAT partition on the disk.
+
There is no valid FAT volume on the disk.
diff --git a/doc/en/sync.html b/doc/en/sync.html index 06cdc28..a9a9efc 100644 --- a/doc/en/sync.html +++ b/doc/en/sync.html @@ -48,12 +48,18 @@ 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 applications that open files for a long time in writing mode, such as data logger. Performing f_sync of periodic or immediataly after f_write can minimize risk of data loss due to a sudden blackout or an unintentional disk removal. However f_sync immediataly before f_close has no advantage because f_close performs f_sync in it. This function is not available in read-only configuration.

+

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 of periodic or immediataly after f_write can minimize the risk of data loss due to a sudden blackout or an unintentional disk removal. However f_sync immediataly before f_close has no advantage because f_close performs f_sync in it. In other words, the differnce between those functions is that the file object is invalidated or not.

-

References

+

QuickInfo

+

Available when _FS_READONLY == 0.

+
+ + +
+

See Also

f_close

diff --git a/doc/en/truncate.html b/doc/en/truncate.html index 611986e..006fcaf 100644 --- a/doc/en/truncate.html +++ b/doc/en/truncate.html @@ -50,12 +50,18 @@ FRESULT f_truncate (

Description

-

The f_truncate function truncates the file size to the current file R/W point. When the file R/W pointer is already pointing end of the file, this function has no effect. This function is not available in read-only configuration or minimization level of >=1.

+

The f_truncate function truncates the file size to the current file R/W point. When the file R/W pointer is already pointing end of the file, this function has no effect.

-

References

+

QuickInfo

+

Available when _FS_READONLY == 0 and _FS_MINIMIZE == 0.

+
+ + +
+

See Also

f_open, f_lseek, FIL

diff --git a/doc/en/unlink.html b/doc/en/unlink.html index 955a24c..ac81760 100644 --- a/doc/en/unlink.html +++ b/doc/en/unlink.html @@ -12,10 +12,10 @@

f_unlink

-

The f_unlink removes file or directory.

+

The f_unlink removes an object.

 FRESULT f_unlink (
-  const XCHAR* FileName  /* Pointer to the file or directory name */
+  const XCHAR* FileName  /* Pointer to the object name */
 );
 
@@ -24,7 +24,7 @@ FRESULT f_unlink (

Parameter

FileName
-
Pointer to the null-terminated string that specifies a file or directory to be removed.
+
Pointer to the null-terminated string that specifies an object to be removed.
@@ -44,7 +44,7 @@ FRESULT f_unlink (
The drive number is invalid.
FR_DENIED
The function was denied due to either of following reasons: -
+
FR_NOT_READY
The disk drive cannot work due to no medium in the drive or any other reason.
FR_WRITE_PROTECTED
@@ -56,14 +56,20 @@ FRESULT f_unlink (
FR_NOT_ENABLED
The logical drive has no work area.
FR_NO_FILESYSTEM
-
There is no valid FAT partition on the disk.
+
There is no valid FAT volume on the disk.

Description

-

The f_unlink function removes a file or directory. In read-only configuration or minimization level is >= 1, this function is not available.

+

The f_unlink function removes an object. Do not remove open objects and current directory.

+
+ + +
+

QuickInfo

+

Available when _FS_READONLY == 0 and _FS_MINIMIZE == 0.

diff --git a/doc/en/utime.html b/doc/en/utime.html index b940c71..6fddefd 100644 --- a/doc/en/utime.html +++ b/doc/en/utime.html @@ -56,19 +56,25 @@ FRESULT f_utime (
FR_NOT_ENABLED
The logical drive has no work area.
FR_NO_FILESYSTEM
-
There is no valid FAT partition on the disk.
+
There is no valid FAT volume on the disk.

Description

-

The f_utime function changes the timestamp of a file or directory. This function is not supported in read-only configuration and minimization level of >=1.

+

The f_utime function changes the timestamp of a file or directory

-

References

+

QuickInfo

+

Available when _FS_READONLY == 0 and _FS_MINIMIZE == 0.

+
+ + +
+

See Also

f_stat, FILINFO

diff --git a/doc/en/write.html b/doc/en/write.html index a7f9d7b..46cde01 100644 --- a/doc/en/write.html +++ b/doc/en/write.html @@ -33,7 +33,7 @@ FRESULT f_write (
ByteToWrite
Specifies number of bytes to write in range of UINT.
ByteWritten
-
Pointer to the UINT variable to return number of bytes written. Return value is always valid after the function call.
+
Pointer to the UINT variable to return the number of bytes written. The value is always valid after the function call regardless of the result.
@@ -59,13 +59,18 @@ FRESULT f_write (

Description

-

The read/write pointer in the file object is increased in number of bytes written. After the function succeeded, *ByteWritten should be checked to detect disk full. In case of *ByteWritten < ByteToWrite, it means the disk got full during write operation.

-

This function is not available in read-only configuration.

+

The R/W pointer in the file object is increased in number of bytes written. After the function succeeded, *ByteWritten should be checked to detect the disk full. In case of *ByteWritten < ByteToWrite, it means the volume got full during the write operation.

-

References

+

QuickInfo

+

Available when _FS_READONLY == 0.

+
+ + +
+

See Also

f_open, f_read, fputc, fputs, fprintf, f_close, FIL

diff --git a/doc/ja/appnote.html b/doc/ja/appnote.html index 7379f8c..488744a 100644 --- a/doc/ja/appnote.html +++ b/doc/ja/appnote.html @@ -19,23 +19,53 @@
  • 蜃ヲ逅邉サ縺ッANSI C貅匁侠縺ァ縺ゅk縺薙→縲
    FatFs繝「繧ク繝・繝シ繝ォ縺ッANSI C貅匁侠縺ァ險倩ソー縺輔l縺ヲ縺繧九ョ縺ァ縲、NSI C貅匁侠縺ョ繧ウ繝ウ繝代う繝ゥ縺ェ繧臥音縺ォ蜃ヲ逅邉サ萓晏ュ倥↑轤ケ縺ッ縺ゅj縺セ縺帙s縲
  • char/short/long縺ョ繧オ繧、繧コ縺ッ縲√◎繧後◇繧8/16/32繝薙ャ繝医〒縲(nt縺ッ16縺セ縺溘ッ32繝薙ャ繝医〒縺ゅk縺薙→縲
    -菴ソ逕ィ縺輔l繧区紛謨ー縺ョ蝙九ッ integer.h 蜀縺ァ typedef 縺輔l縺ヲ縺縺セ縺吶よ紛謨ー縺ョ蝙九→繧オ繧、繧コ縺ォ髢「縺励※縺ッ縲√∪縺」縺ィ縺縺ェ蜃ヲ逅邉サ縺ェ繧牙撫鬘後↑縺縺ッ縺壹〒縺吶′縲∵里蟄倥ョ螳夂セゥ縺ィ陦晉ェ√@縺溷エ蜷医ッ繝ヲ繝シ繧カ縺ォ繧医▲縺ヲ隗」豎コ縺輔l縺ェ縺代l縺ー縺ェ繧翫∪縺帙s縲
  • +繧オ繧、繧コ繧呈守、コ縺吶k謨エ謨ー縺ョ蝙九′ integer.h 蜀縺ァ螳夂セゥ縺輔l縺ヲ縺縺セ縺吶よ紛謨ー縺ョ蝙九→繧オ繧、繧コ縺ォ髢「縺励※縺ッ縲√∪縺」縺ィ縺縺ェ蜃ヲ逅邉サ縺ェ繧牙撫鬘後↑縺縺ッ縺壹〒縺吶′縲∵里蟄倥ョ螳夂セゥ縺ィ陦晉ェ√@縺溷エ蜷医ッ繝ヲ繝シ繧カ縺ォ繧医▲縺ヲ隗」豎コ縺輔l縺ェ縺代l縺ー縺ェ繧翫∪縺帙s縲
    -

    繝。繝「繝ェ菴ソ逕ィ驥 (R0.07c)

    +

    繝昴シ繝繧」繝ウ繧ー縺ョ縺励°縺

    +

    蠢隕√↑縺ョ縺ッ FatFs繝「繧ク繝・繝シ繝ォ縺ョ隕∵アゅ☆繧九ョ繧」繧ケ繧ッ髢「謨ー繧堤畑諢上☆繧九%縺ィ縺縺代〒縲√◎繧御サ・螟悶↓縺吶k縺薙→縺ッ縺ゅj縺セ縺帙s縲よ里縺ォ蜍穂ス懊@縺ヲ縺繧九ョ繧」繧ケ繧ッ髢「謨ー縺後≠繧九↑繧峨◎縺ョ API繧 FatFs縺ォ蜷医o縺帙k縺縺代〒貂医∩縺セ縺吶′縲∫┌縺蝣エ蜷医ッ縺サ縺九°繧臥ァサ讀阪☆繧九°縲∵怙蛻昴°繧画嶌縺上°縺吶k蠢隕√′縺ゅj縺セ縺吶ょョ夂セゥ縺輔l縺ヲ縺繧句ィ縺ヲ縺ョ髢「謨ー縺悟クク縺ォ蠢隕√↑繧上¢縺ァ縺ッ縺ゅj縺セ縺帙s縲ゆセ九∴縺ー縲√Μ繝シ繝峨サ繧ェ繝ウ繝ェ繝シ讒区舌〒縺ッ譖ク縺崎セシ縺ソ邉サ髢「謨ー縺ッ蠢隕√≠繧翫∪縺帙s縲よャ。縺ョ陦ィ縺ォ讒区舌が繝励す繝ァ繝ウ縺ィ隕∵アゅ&繧後k髢「謨ー縺ョ蟇セ蠢懊r遉コ縺励∪縺吶

    - - + + + + + + + + + + +
    AVRH8/300HPICTLCS-870/CV850ESSH2ARM7TDMIIA-32
    CompilerWinAVR(gcc)CH38C30(gcc)CC870CCA850SHCWinARM(gcc)MSC
    繝ヲ繝シ繧カ菴懈宣未謨ー蠢隕√→縺ェ繧区擅莉カ
    disk_initialize蟶ク譎
    disk_status蟶ク譎
    disk_read蟶ク譎
    disk_write_FS_READONLY == 0
    disk_ioctl (CTRL_SYNC)_FS_READONLY == 0
    disk_ioctl (GET_SECTOR_COUNT)_USE_MKFS == 1
    disk_ioctl (GET_SECTOR_SIZE)_MAX_SS >= 1024
    disk_ioctl (GET_BLOCK_SIZE)_USE_MKFS == 1
    get_fattime_FS_READONLY == 0
    +
    + +
    +

    髯千阜蛟、

    + +
    + +
    +

    繝。繝「繝ェ菴ソ逕ィ驥 (R0.07e)

    + + + - - - - - - - + + + + + + +
    AVRH8/300HPICTLCS-870/CV850ESSH2ARM7TDMIx86
    CompilerWinAVR(gcc)CH38C30(gcc)CC870CCA850SHCWinARM(gcc)VC6
    _WORD_ACCESS10011001
    ROM (Full, R/W)1196210433107531515377478707105847337
    ROM (Min, R/W)74666799677299064901559965484787
    ROM (Full, R/O)54004687480467443539379946763380
    ROM (Min, R/O)38043527342150402561286732762533
    RAM (Static)D*2 + 2D*4 + 2D*2 + 2D*2 + 2D*4 + 2D*4 + 2D*4 + 2D*4 + 2
    RAM (Dynamic)
    (_FS_TINY == 0)
    D*560 +
    F*544
    D*560 +
    F*550
    D*560 +
    F*544
    D*560 +
    F*550
    D*560 +
    F*550
    D*560 +
    F*550
    D*560 +
    F*550
    RAM (Dynamic)
    (_FS_TINY == 1)
    D*560 +
    F*32
    D*560 +
    F*36
    D*560 +
    F*32
    D*560 +
    F*32
    D*560 +
    F*36
    D*560 +
    F*36
    D*560 +
    F*36
    D*560 +
    F*36
    text (Full, R/W)1219410559109241522976868727105647342
    text (Min, R/W)79886903710899604884565165444764
    text (Full, R/O)55324753502067603462377746243316
    text (Min, R/O)40403631373650832556290732842510
    bssD*2 + 2D*4 + 2D*2 + 2D*2 + 2D*4 + 2D*4 + 2D*4 + 2D*4 + 2
    Work area
    (_FS_TINY == 0)
    D*560 +
    F*544
    D*560 +
    F*550
    D*560 +
    F*544
    D*560 +
    F*550
    D*560 +
    F*550
    D*560 +
    F*550
    D*560 +
    F*550
    Work area
    (_FS_TINY == 1)
    D*560 +
    F*32
    D*560 +
    F*36
    D*560 +
    F*32
    D*560 +
    F*32
    D*560 +
    F*36
    D*560 +
    F*36
    D*560 +
    F*36
    D*560 +
    F*36

    荳翫ョ陦ィ縺ォ縺縺上▽縺九ョ繧ソ繝シ繧イ繝繝医↓縺翫¢繧九Γ繝「繝ェ菴ソ逕ィ驥上ョ萓九r遉コ縺励∪縺吶ゅユ繧ケ繝域凾縺ョ讒区舌が繝励す繝ァ繝ウ縺ッ谺。縺ョ騾壹j縺ァ縺吶よ焚蛟、縺ョ蜊倅ス阪ッ繝舌う繝医〒縲D縺ッ隲也炊繝峨Λ繧、繝匁焚縲F縺ッ蜷梧凾繧ェ繝シ繝励Φ繝サ繝輔ぃ繧、繝ォ謨ー繧堤、コ縺励∪縺吶ゅさ繝ウ繝代う繝ゥ縺ョ譛驕ゥ蛹悶が繝励す繝ァ繝ウ縺ッ繧ウ繝シ繝峨サ繧オ繧、繧コ縺ィ縺励※縺縺セ縺吶

    @@ -106,15 +136,15 @@ _FS_REENTRANT    0 (Disable reentrancy)
     
     

    繝ェ繧ィ繝ウ繝医Λ繝ウ繧キ繝シ

    -

    逡ー縺ェ繧九懊Μ繝・繝シ繝(隲也炊繝峨Λ繧、繝)縺ォ蟇セ縺吶k繝輔ぃ繧、繝ォ謫堺ス懊ッ縲√Μ繧ィ繝ウ繝医Λ繝ウ繝郁ィュ螳壹↓繧医i縺壼クク縺ォ蜷梧凾蟷ウ陦後↓蜍穂ス懊〒縺阪∪縺吶ょ酔縺倥懊Μ繝・繝シ繝縺ォ蟇セ縺吶k繝ェ繧ィ繝ウ繝医Λ繝ウ繧キ繝シ縺ッ_FS_REENTRANT繧ェ繝励す繝ァ繝ウ縺ァ譛牙柑縺ォ縺輔l繧九%縺ィ縺後〒縺阪∪縺吶ゅ%縺ョ蝣エ蜷医^S萓晏ュ倥ョ蜷梧悄繧ェ繝悶ず繧ァ繧ッ繝域桃菴憺未謨ー ff_cre_syncobj, ff_del_syncobj, ff_req_grant 縺ィ ff_rel_grant 繧ゅ∪縺溘励Ο繧ク繧ァ繧ッ繝医↓霑ス蜉縺輔l縺ェ縺代l縺ー縺ェ繧翫∪縺帙s縲ゅし繝ウ繝励Ν繝サ繧ウ繝シ繝峨→隗」隱ャ縺ッsyncobj.c縺ォ縺ゅj縺セ縺吶

    -

    莉悶ョ繧ソ繧ケ繧ッ縺後◎縺ョ繝懊Μ繝・繝シ繝繧剃スソ逕ィ荳ュ縺ォ繝輔ぃ繧、繝ォ髢「謨ー縺悟他縺ウ蜃コ縺輔l繧九→縲√◎縺ョ繧「繧ッ繧サ繧ケ縺ッ縺昴ョ繧ソ繧ケ繧ッ縺後ヵ繧。繧、繝ォ髢「謨ー繧呈栢縺代k縺セ縺ァ繝悶Ο繝繧ッ縺輔l縺セ縺吶ゅb縺励∝セ縺。譎る俣縺_TIMEOUT縺ァ謖螳壹&繧後◆譛滄俣繧定カ翫☆縺ィ縲√◎縺ョ髢「謨ー縺ッFR_TIMEOUT縺ァ繧「繝懊シ繝医@縺セ縺吶ゅ>縺上▽縺九ョRTOS縺ァ縺ッ繧ソ繧、繝繧「繧ヲ繝域ゥ溯ス縺ッ繧オ繝昴シ繝医&繧後↑縺縺九b遏・繧後∪縺帙s縲

    -

    縺イ縺ィ縺、縺ョ萓句、悶′f_mount縺ィf_mkfs髢「謨ー縺ォ縺ゅj縺セ縺吶ゅ%繧後i縺ョ髢「謨ー縺ッ蜷後§繝懊Μ繝・繝シ繝縺ォ蟇セ縺励※繝ェ繧ィ繝ウ繝医Λ繝ウ繝医〒縺ッ縺ゅj縺セ縺帙s縲ゅ%繧後i縺ョ髢「謨ー繧剃スソ逕ィ縺吶k縺ィ縺阪ッ縲∽サ悶ョ繧ケ繝ャ繝繝峨ッ髢「騾」縺吶k繝輔ぃ繧、繝ォ繧帝哩縺倥√◎縺ョ繝懊Μ繝・繝シ繝縺ク縺ョ繧「繧ッ繧サ繧ケ繧帝∩縺代↑縺代l縺ー縺ェ繧翫∪縺帙s縲

    +

    莠偵>縺ォ逡ー縺ェ繧九懊Μ繝・繝シ繝(隲也炊繝峨Λ繧、繝)縺ォ蟇セ縺吶k繝輔ぃ繧、繝ォ謫堺ス懊ッ縲∝クク縺ォ蜷梧凾蟷ウ陦後↓蜍穂ス懊〒縺阪∪縺吶ょ酔縺倥懊Μ繝・繝シ繝縺ォ蟇セ縺励※縺ッ繝繝輔か繝ォ繝医〒縺ッ繝ェ繧ィ繝ウ繝医Λ繝ウ繝医〒縺ッ縺ゅj縺セ縺帙s縺後_FS_REENTRANT繧ェ繝励す繝ァ繝ウ縺ァ繝ェ繧ィ繝ウ繝医Λ繝ウ繝医↓縺吶k縺薙→繧ゅ〒縺阪∪縺吶ゅ%縺ョ蝣エ蜷医^S萓晏ュ倥ョ蜷梧悄繧ェ繝悶ず繧ァ繧ッ繝域桃菴憺未謨ー ff_cre_syncobj, ff_del_syncobj, ff_req_grant 縺ィ ff_rel_grant 繧ゅ∪縺溘励Ο繧ク繧ァ繧ッ繝医↓霑ス蜉縺輔l縺ェ縺代l縺ー縺ェ繧翫∪縺帙s縲ゅし繝ウ繝励Ν繝サ繧ウ繝シ繝峨→隗」隱ャ縺ッsyncobj.c縺ォ縺ゅj縺セ縺吶

    +

    縺ゅk繧ソ繧ケ繧ッ縺後懊Μ繝・繝シ繝繧剃スソ逕ィ荳ュ縺ォ莉悶ョ繧ソ繧ケ繧ッ縺九i縺昴ョ繝懊Μ繝・繝シ繝縺ォ蟇セ縺吶k繝輔ぃ繧、繝ォ髢「謨ー縺悟他縺ウ蜃コ縺輔l繧九→縲√◎縺ョ繧「繧ッ繧サ繧ケ縺ッ蜈医ョ繧ソ繧ケ繧ッ縺後ヵ繧。繧、繝ォ髢「謨ー繧呈栢縺代k縺セ縺ァ繝悶Ο繝繧ッ縺輔l縺セ縺吶ゅb縺励∝セ縺。譎る俣縺_TIMEOUT縺ァ謖螳壹&繧後◆譛滄俣繧定カ翫☆縺ィ縲√◎縺ョ髢「謨ー縺ッFR_TIMEOUT縺ァ繧「繝懊シ繝医@縺セ縺吶ゅ>縺上▽縺九ョRTOS縺ァ縺ッ繧ソ繧、繝繧「繧ヲ繝域ゥ溯ス縺ッ繧オ繝昴シ繝医&繧後↑縺縺九b遏・繧後∪縺帙s縲

    +

    縺イ縺ィ縺、縺ョ萓句、悶′f_mount縺ィf_mkfs髢「謨ー縺ォ縺ゅj縺セ縺吶ゅ%繧後i縺ョ髢「謨ー縺ッ蜷後§繝懊Μ繝・繝シ繝縺ォ蟇セ縺励※繝ェ繧ィ繝ウ繝医Λ繝ウ繝医〒縺ッ縺ゅj縺セ縺帙s縲ゅ%繧後i縺ョ髢「謨ー繧剃スソ逕ィ縺吶k縺ィ縺阪ッ縲√い繝励Μ繧ア繝シ繧キ繝ァ繝ウ繝サ繝ャ繝吶Ν縺ァ謗剃サ門宛蠕。縺励↑縺代l縺ー縺ェ繧翫∪縺帙s縲

    豕ィ: 縺薙ョ繧サ繧ッ繧キ繝ァ繝ウ縺ッFatFs繝「繧ク繝・繝シ繝ォ縺昴l閾ェ菴薙ョ繝ェ繧ィ繝ウ繝医Λ繝ウ繧キ繝シ縺ォ縺、縺縺ヲ隱ャ譏弱@縺ヲ縺縺セ縺吶ゅョ繧」繧ケ繧ッI/O繝「繧ク繝・繝シ繝ォ縺ョ繝ェ繧ィ繝ウ繝医Λ繝ウ繧キ繝シ縺ォ髢「縺励※縺ッ菴輔ョ蜑肴署繧ゅ≠繧翫∪縺帙s縲

    螟夐阪ヵ繧。繧、繝ォ繝サ繧「繧ッ繧サ繧ケ

    -

    FatFs繝「繧ク繝・繝シ繝ォ縺ァ縺ッ螟夐阪い繧ッ繧サ繧ケ讖溯ス縺ッ繧オ繝昴シ繝医&繧後∪縺帙s縲ゅヵ繧。繧、繝ォ縺ォ蟇セ縺吶k螟夐阪い繧ッ繧サ繧ケ縺ッ縲√◎縺ョ繧「繧ッ繧サ繧ケ繝サ繝「繝シ繝峨↓繧医▲縺ヲ蛻カ髯舌&繧後∪縺吶ゆク縺、縺ョ繝輔ぃ繧、繝ォ縺ォ蟇セ縺吶k螟夐阪が繝シ繝励Φ縺ッ縲√◎繧後i縺悟ィ縺ヲ繝ェ繝シ繝峨サ繝「繝シ繝峨ョ縺ィ縺崎ィア蜿ッ縺輔l縺セ縺吶よ嶌縺崎セシ縺ソ繝「繝シ繝峨r蜷ォ繧螟夐阪が繝シ繝励Φ縲√∪縺滄幕縺九l縺ヲ縺繧九ヵ繧。繧、繝ォ縺ォ蟇セ縺吶k繝ェ繝阪シ繝繧豸亥悉繧定。後▲縺ヲ縺ッ縺ェ繧翫∪縺帙s縲ゅ&繧ゅ↑縺縺ィ縲√◎縺ョ繝懊Μ繝・繝シ繝縺ョFAT讒矩縺檎エ螢翫&繧後k蜿ッ閭ス諤ァ縺後≠繧翫∪縺吶

    +

    FatFs繝「繧ク繝・繝シ繝ォ縺ァ縺ッ螟夐阪い繧ッ繧サ繧ケ讖溯ス縺ッ繧オ繝昴シ繝医&繧後∪縺帙s縲ゅヵ繧。繧、繝ォ縺ォ蟇セ縺吶k螟夐阪い繧ッ繧サ繧ケ縺ッ縲√◎縺ョ繧「繧ッ繧サ繧ケ繝サ繝「繝シ繝峨↓繧医▲縺ヲ蛻カ髯舌&繧後∪縺吶ゆク縺、縺ョ繝輔ぃ繧、繝ォ縺ォ蟇セ縺吶k螟夐阪が繝シ繝励Φ縺ッ縲√◎繧後i縺悟ィ縺ヲ繝ェ繝シ繝峨サ繝「繝シ繝峨ョ縺ィ縺阪↓髯舌▲縺ヲ險ア蜿ッ縺輔l縺セ縺吶よ嶌縺崎セシ縺ソ繝「繝シ繝峨r蜷ォ繧螟夐阪が繝シ繝励Φ縲√∪縺滄幕縺九l縺ヲ縺繧九ヵ繧。繧、繝ォ縺ォ蟇セ縺吶k繝ェ繝阪シ繝繧豸亥悉繧定。後▲縺ヲ縺ッ縺ェ繧翫∪縺帙s縲ゅ&繧ゅ↑縺縺ィ縲√◎縺ョ繝懊Μ繝・繝シ繝縺ョFAT讒矩縺檎エ螢翫&繧後k蜿ッ閭ス諤ァ縺後≠繧翫∪縺吶

    @@ -148,7 +178,7 @@ _FS_REENTRANT 0 (Disable reentrancy)

    襍、縺ァ遉コ縺励◆繧サ繧ッ繧キ繝ァ繝ウ繧貞ョ溯。御クュ縺ォ髫懷ョウ縺檎匱逕溘@縺溷エ蜷医√け繝ュ繧ケ繝サ繝ェ繝ウ繧ッ縺檎匱逕溘@縺ヲ謫堺ス懷ッセ雎。縺ョ繝輔ぃ繧、繝ォ繝サ繝繧」繝ャ繧ッ繝医Μ縺悟、ア繧上l繧句庄閭ス諤ァ縺後≠繧翫∪縺吶るサ濶イ縺ァ遉コ縺励◆繧サ繧ッ繧キ繝ァ繝ウ繧貞ョ溯。御クュ縺ォ髫懷ョウ縺檎匱逕溘@縺溷エ蜷医√▽縺弱ョ縺縺。縺縺壹l縺九∪縺溘ッ隍謨ー縺ョ邨先棡縺檎函縺倥k蜿ッ閭ス諤ァ縺後≠繧翫∪縺吶

      -
    • 譖ク縺肴鋤縺井クュ縺ョ繝輔ぃ繧、繝ォ縺ョ蜀螳ケ縺檎エ螢翫&繧後k縲
    • +
    • 譖ク縺肴鋤縺井クュ縺ョ繝輔ぃ繧、繝ォ縺ョ繝繝シ繧ソ縺檎エ螢翫&繧後k縲
    • 霑ス險倅クュ縺ョ繝輔ぃ繧、繝ォ縺後が繝シ繝励Φ蜑阪ョ迥カ諷九↓謌サ繧九
    • 譁ー隕上↓菴懈舌&繧後◆繝輔ぃ繧、繝ォ縺梧カ医∴繧九
    • 譁ー隕上∪縺溘ッ荳頑嶌縺阪〒菴懈舌&繧後◆繝輔ぃ繧、繝ォ縺ョ髟キ縺輔′繧シ繝ュ縺ォ縺ェ縺」縺ヲ谿九k縲
    • @@ -158,13 +188,34 @@ _FS_REENTRANT 0 (Disable reentrancy)
    -

    繝輔ぃ繧、繝ォ蜷阪ョ螟ァ譁蟄怜、画鋤

    -

    CP932(Shift_JIS)縺ァ縺九▽髱朖FN讒区舌ョ縺ィ縺阪ッ縲∵僑蠑オ譁蟄(2繝舌う繝医ョ闍ア蟄励サ繧ュ繝ェ繝ォ譁蟄励サ繧ョ繝ェ繧キ繝」譁蟄)縺ォ蟇セ縺励※螟ァ譁蟄怜、画鋤繧定。後o縺壹∝ー乗枚蟄励ッ蟆乗枚蟄励〒繝繧」繝ャ繧ッ繝医Μ縺ォ險倬鹸繝サ豈碑シ縺輔l縺セ縺吶ゅ%繧後ッ譌・譛ャ隱朞SDOS縺ィ蜷後§莉墓ァ倥→縺ェ繧翫∪縺吶ゅ%縺ョ縺溘a縲∝ィ隗貞ー乗枚蟄励r蜷ォ繧繝輔ぃ繧、繝ォ繧剃ス懈舌☆繧九→縲仝indows迺ー蠅縺ァ縺昴ョ繝輔ぃ繧、繝ォ繧帝幕縺代↑縺上↑繧翫∪縺吶LFN讒区舌〒縺ッ螟ァ譁蟄怜、画鋤繧定。後>縺セ縺(Windows莉墓ァ)縲

    +

    譌・譛ャ隱槭ヵ繧。繧、繝ォ蜷阪ョ螟ァ譁蟄怜、画鋤

    +

    CP932(Shift_JIS)縺ァ縺九▽髱朖FN讒区舌ョ縺ィ縺阪ッ縲∵僑蠑オ譁蟄励ョ蟆乗枚蟄(2繝舌う繝郁恭蟄励サ繧ュ繝ェ繝ォ譁蟄励サ繧ョ繝ェ繧キ繝」譁蟄)縺ォ蟇セ縺励※螟ァ譁蟄怜、画鋤繧定。後o縺壹∝ー乗枚蟄励ョ縺セ縺セSFN繧ィ繝ウ繝医Μ縺ォ險倬鹸繝サ讀懃エ「縺輔l縺セ縺吶ゅ%繧後ッ譌・譛ャ隱朞SDOS縺ィ蜷後§莉墓ァ倥→縺ェ繧翫∪縺吶ゅ%縺ョ縺溘a縲∝ィ隗貞ー乗枚蟄励r蜷ォ繧繝輔ぃ繧、繝ォ繧剃ス懈舌☆繧九→縲¨T邉サWindows縺ァ縺昴ョ繝輔ぃ繧、繝ォ繧帝幕縺代↑縺上↑繧翫∪縺吶LFN讒区舌〒縺ッ螟ァ譁蟄怜、画鋤繧定。後>縺セ縺(NT邉サWindows莉墓ァ)縲

    Unicode蜈・蜃コ蜉帙∈縺ョ蟇セ蠢

    -

    繝輔ぃ繧、繝ォ髢「謨ー縺ョ繝輔ぃ繧、繝ォ蜷榊・蜃コ蜉帙rUnicode縺ォ蛻繧頑崛縺医k縺薙→縺後〒縺阪∪縺吶りゥウ邏ー縺ッ縲繝輔ぃ繧、繝ォ蜷繧貞盾辣ァ縺励※縺上□縺輔>縲

    +

    繝輔ぃ繧、繝ォ髢「謨ー縺ョ繝輔ぃ繧、繝ォ蜷榊・蜃コ蜉帙ッ繝繝輔か繝ォ繝医〒縺ッ OEM繧ウ繝シ繝峨〒縺吶′縲√%繧後rUnicode縺ォ蛻繧頑崛縺医k縺薙→繧ゅ〒縺阪∪縺吶りゥウ邏ー縺ッ縲繝輔ぃ繧、繝ォ蜷繧貞盾辣ァ縺励※縺上□縺輔>縲

    +
    + +
    +

    FatFs縺ョ繝ゥ繧、繧サ繝ウ繧ケ縺ォ縺、縺縺ヲ

    +

    繧ス繝シ繧ケ繝サ繝輔ぃ繧、繝ォ縺ョ繝倥ャ繝縺ォ繝ゥ繧、繧サ繝ウ繧ケ譚。莉カ縺瑚ィ倩ソー縺輔l縺ヲ縺繧九ョ縺ァ縲∝茜逕ィ縺ョ髫帙ッ縺昴l縺ォ蠕薙≧縺薙→縲り恭隱槭r隱ュ繧√↑縺譁ケ縺ョ縺溘a縺ォ莉・荳九↓譌・譛ャ隱櫁ィウ繧堤、コ縺励※縺翫″縺セ縺吶

    +
    /*----------------------------------------------------------------------------/
    +/  FatFs - FAT file system module  R0.07e                    (C)ChaN, 2009
    +/-----------------------------------------------------------------------------/
    +/ FatFs繝「繧ク繝・繝シ繝ォ縺ッ縲∝ー剰ヲ乗ィ。縺ェ邨縺ソ霎シ縺ソ繧キ繧ケ繝繝蜷代¢縺ョ豎守畑FAT繝輔ぃ繧、繝ォ繧キ繧ケ繝繝繝サ
    +/ 繝「繧ク繝・繝シ繝ォ縺ァ縺吶ゅ%繧後ッ繝輔Μ繝シ繝サ繧ス繝輔ヨ繧ヲ繧ァ繧「縺ィ縺励※縲∵蕗閧イ繝サ遐皮ゥカ繝サ髢狗匱縺ョ縺溘a縺ォ
    +/ 莉・荳九ョ繝ゥ繧、繧サ繝ウ繧ケ繝サ繝昴Μ繧キ繝シ縺ョ荳九〒蜈ャ髢九&繧後※縺縺セ縺吶
    +/
    +/  Copyright (C) 2009, ChaN, all right reserved.
    +/
    +/ * FatFs繝「繧ク繝・繝シ繝ォ縺ッ繝輔Μ繝シ繝サ繧ス繝輔ヨ繧ヲ繧ァ繧「縺ァ縺ゅj縲√∪縺辟。菫晁ィシ縺ァ縺縲
    +/ * 逕ィ騾斐↓蛻カ髯舌ッ縺ゅj縺セ縺帙s縲縺ゅ↑縺溘ョ雋ャ莉サ縺ョ荳九↓縺翫>縺ヲ縲∝倶ココ逧繝サ髱槫霧蛻ゥ逧縺ェ
    +/   繧ゅョ縺九i蝠逕ィ陬ス蜩√ョ髢狗匱縺ォ蜿翫カ逶ョ逧縺ォ菴ソ逕ィ繝サ謾ケ螟峨サ蜀埼榊ク縺吶k縺薙→縺後〒縺阪∪縺吶
    +/ * 繧ス繝シ繧ケ繝サ繧ウ繝シ繝峨r蜀埼榊ク縺吶k縺ィ縺阪ッ縲∽ク願ィ倥ョ闡嶺ス懈ィゥ陦ィ遉コ繧剃ソ晄戟縺励↑縺代l縺ー縺ェ繧翫∪縺帙s縲
    +/
    +/-----------------------------------------------------------------------------/
    +

    隕√☆繧九↓FatFs縺ッ繧ソ繝縺ァ閾ェ逕ア縺ォ菴ソ縺医k縺ィ縺縺縺薙→縺ァ縺吶ゅた繝シ繧ケ繝サ繧ウ繝シ繝峨r蜀埼榊ク縺吶k縺ィ縺阪ッ縲√%縺ョ繝悶Ο繝繧ッ繧偵◎縺ョ縺セ縺セ菫晄戟縺励※縺翫¥縺薙→縲ゅ%縺ョ繧医≧縺ォFatFs縺ッBSD繝ゥ繧、繧ッ縺ェ繝ゥ繧、繧サ繝ウ繧ケ縺ィ縺励※縺縺セ縺吶′縲∽ク縺、螟ァ縺阪↑驕輔>縺後≠繧翫∪縺吶ら音縺ォ邨縺ソ霎シ縺ソ逕ィ騾斐〒縺ョ蛻ゥ逕ィ萓。蛟、繧帝ォ倥a繧九◆繧√√ヰ繧、繝翫Μ蠖「蠑(繧ス繝シ繧ケ繝サ繧ウ繝シ繝峨r蜷ォ縺セ縺ェ縺蠖「蠑丞ィ縺ヲ)縺ァ縺ョ蜀埼榊ク縺ォ縺、縺縺ヲ縺ッ縲∵擅莉カ縺ッ險ュ縺代※縺縺セ縺帙s縲ゅ◎縺ョ蝣エ蜷医ッ縲:atFs縺翫h縺ウ縺昴ョ繝ゥ繧、繧サ繝ウ繧ケ譁譖ク縺ォ縺、縺縺ヲ縺ッ繝峨く繝・繝。繝ウ繝医↓譏手ィ倥@縺ヲ繧ゅ@縺ェ縺上※繧ゅ°縺セ縺縺セ縺帙s縲ゅb縺。繧阪sGNU GPL繝励Ο繧ク繧ァ繧ッ繝医→繧ょア蟄伜庄閭ス縺ァ縺吶ゆス輔i縺九ョ螟画峩繧貞刈縺医※蜀埼榊ク縺吶k髫帙ッ縲∽サ悶ョ繝ゥ繧、繧サ繝ウ繧ケ(GNU GPL縺毅SD繝ゥ繧、繧サ繝ウ繧ケ)縺ォ螟画峩縺吶k縺薙→繧ょ庄閭ス縺ァ縺吶

    謌サ繧

    diff --git a/doc/ja/chdir.html b/doc/ja/chdir.html index 5970fb9..ad0e751 100644 --- a/doc/ja/chdir.html +++ b/doc/ja/chdir.html @@ -43,7 +43,7 @@ FRESULT f_chdir (
    FR_INVALID_DRIVE
    ドライブ番号が不正。
    FR_NOT_READY
    -
    メディアがセットされていないなど、ディスク・ドライブが動作不能状態。
    +
    メディアがセットされていないなど、物理ドライブが動作不能状態。
    FR_WRITE_PROTECTED
    メディアが書き込み禁止状態。
    FR_DISK_ERR
    @@ -53,14 +53,20 @@ FRESULT f_chdir (
    FR_NOT_ENABLED
    その論理ドライブにワーク・エリアが与えられていない。
    FR_NO_FILESYSTEM
    -
    ディスク上に有効なFATパーテーションが見つからない。
    +
    ディスク上に有効なFATボリュームが見つからない。

    解説

    -

    f_chdir関数は各ボリュームのカレント・ディレクトリを変更します。カレント・ディレクトリはファイル・システム・オブジェクトの初期化が行われたとき、ルート・ディレクトリに設定されます。カレント・ディレクトリは、ファイル・システム・オブジェクトに記録されるため、そのボリュームを使用する全てのタスクに対して影響を与えます。この関数は相対パスが有効なとき(_FS_RPATH == 1)に使用可能となります。

    +

    f_chdir関数は各ボリュームのカレント・ディレクトリを変更します。カレント・ディレクトリはファイル・システム・オブジェクトの初期化が行われたとき、ルート・ディレクトリに設定されます。カレント・ディレクトリは、ファイル・システム・オブジェクトに記録されるため、そのボリュームを使用する全てのタスクに対して影響を与えます。

    +
    + + +
    +

    対応情報

    +

    _FS_RPATH == 1のときに使用可能となります。

    diff --git a/doc/ja/chdrive.html b/doc/ja/chdrive.html index 121ee39..33343ff 100644 --- a/doc/ja/chdrive.html +++ b/doc/ja/chdrive.html @@ -42,9 +42,16 @@ FRESULT f_chdrive (

    解説

    -

    f_chdrive関数はカレント・ドライブを変更します。システム起動時の初期値は0です。この設定はFatFsモジュールの静的変数に記録されるため、全てのタスクに対して影響を与えます。この関数は相対パスが有効なとき(_FS_RPATH == 1)に使用可能となります。

    +

    f_chdrive関数はカレント・ドライブを変更します。システム起動時の初期値は0です。この設定はFatFsモジュールの静的変数に記録されるため、全てのタスクに対して影響を与えます。

    + +
    +

    対応情報

    +

    _FS_RPATH == 1のときに使用可能となります。

    +
    + +

    参照

    f_chdir

    diff --git a/doc/ja/chmod.html b/doc/ja/chmod.html index 6bb8388..f14ceb8 100644 --- a/doc/ja/chmod.html +++ b/doc/ja/chmod.html @@ -57,7 +57,7 @@ FRESULT f_chmod (
    FR_INVALID_DRIVE
    ドライブ番号が不正。
    FR_NOT_READY
    -
    メディアがセットされていないなど、ディスク・ドライブが動作不能状態。
    +
    メディアがセットされていないなど、物理ドライブが動作不能状態。
    FR_WRITE_PROTECTED
    メディアが書き込み禁止状態。
    FR_DISK_ERR
    @@ -67,21 +67,27 @@ FRESULT f_chmod (
    FR_NOT_ENABLED
    その論理ドライブにワーク・エリアが与えられていない。
    FR_NO_FILESYSTEM
    -
    ディスク上に有効なFATパーテーションが見つからない。
    +
    ディスク上に有効なFATボリュームが見つからない。

    解説

    -

    ファイルまたはディレクトリの属性を変更します。リード・オンリー構成および_FS_MINIMIZE >= 1ではこの関数はサポートされません。

    +

    ファイルまたはディレクトリの属性を変更します。

    +
    + + +
    +

    対応情報

    +

    _FS_READONLY == 0で、且つ_FS_MINIMIZE == 0のとき使用可能です。

    使用例

    -    // Set read-only flag , clear archive flag and others are left unchanged.
    +    /* リードオンリーをセット、アーカイブをクリア、その他は変更しない */
         f_chmod("file.txt", AM_RDO, AM_RDO | AM_ARC);
     
    diff --git a/doc/ja/close.html b/doc/ja/close.html index 22cdf28..7fa4b0f 100644 --- a/doc/ja/close.html +++ b/doc/ja/close.html @@ -39,7 +39,7 @@ FRESULT f_close (
    FR_INT_ERR
    不正なFAT構造または内部エラーによる失敗。
    FR_NOT_READY
    -
    メディアがセットされていないなど、ディスク・ドライブが動作不能状態。
    +
    メディアがセットされていないなど、物理ドライブが動作不能状態。
    FR_INVALID_OBJECT
    無効なファイル・オブジェクト。
    @@ -52,6 +52,12 @@ FRESULT f_close ( +
    +

    対応情報

    +

    全ての構成で使用可能です。

    +
    + +

    参照

    f_open, f_read, f_write, f_sync, FIL, FATFS diff --git a/doc/ja/dinit.html b/doc/ja/dinit.html index 18fa43f..c04b829 100644 --- a/doc/ja/dinit.html +++ b/doc/ja/dinit.html @@ -32,12 +32,12 @@ DSTATUS disk_initialize (

    戻り値

    この関数は戻り値としてディスク・ステータスを返します。ディスク・ステータスの詳細に関してはdisk_status()を参照してください。

    -

    FatFsモジュールは、自動マウント動作で必要に応じてこの関数を呼び出します。FatFsモジュール使用中はアプリケーションからこの関数を呼び出してはなりません。さもないとFAT構造が破壊される可能性があります。

    解説

    ディスク・ドライブを初期化します。関数が成功すると、戻り値のSTA_NOINITフラグがクリアされます。

    +

    FatFsモジュールは、自動マウント動作により必要に応じてこの関数を呼び出します。FatFsモジュール使用中はアプリケーションからこの関数を呼び出してはなりません。さもないとFAT構造が破壊される可能性があります。エラー等により再初期化が必要なときは、f_mount()を使用します。

    戻る

    diff --git a/doc/ja/fattime.html b/doc/ja/fattime.html index 1dce3d5..9a790b4 100644 --- a/doc/ja/fattime.html +++ b/doc/ja/fattime.html @@ -41,7 +41,7 @@ DWORD get_fattime (void);

    解説

    -

    RTCをサポートしないシステムでも、何らかの日付として有効な値を返さなければなりません。リード・オンリー構成ではこの関数は必要とされません。

    +

    RTCをサポートしないシステムでも、何らかの日付として有効な値を返さなければなりません。0を返した場合、そのファイルは日付を持ちません。リード・オンリー構成ではこの関数は必要とされません。

    diff --git a/doc/ja/filename.html b/doc/ja/filename.html index b6eeed4..93703e1 100644 --- a/doc/ja/filename.html +++ b/doc/ja/filename.html @@ -11,13 +11,13 @@

    繝輔ぃ繧、繝ォ繝サ繝繧」繝ャ繧ッ繝医Μ縺ョ謖螳壽婿豕

    -

    FatFs繝「繧ク繝・繝シ繝ォ縺ァ縺ョ繝輔ぃ繧、繝ォ縲√ョ繧」繝ャ繧ッ繝医Μ縲√ラ繝ゥ繧、繝悶ョ謖螳壽婿豕輔ッMS-DOS縺ィ縺サ縺シ蜷後§縺ァ縺吶ゅヱ繧ケ蜷阪ョ繝輔か繝シ繝槭ャ繝医ッ谺。縺ョ騾壹j縺ァ縺吶

    +

    FatFs繝「繧ク繝・繝シ繝ォ縺ァ縺ョ繝輔ぃ繧、繝ォ縲√ョ繧」繝ャ繧ッ繝医Μ縲√ラ繝ゥ繧、繝悶ョ謖螳壽婿豕輔ッDOS/Windows縺ィ縺サ縺シ蜷後§縺ァ縺吶ゅヱ繧ケ蜷阪ョ繝輔か繝シ繝槭ャ繝医ッ谺。縺ョ騾壹j縺ァ縺吶

      "[隲也炊繝峨Λ繧、繝也分蜿キ:][/]繝繧」繝ャ繧ッ繝医Μ蜷/繝輔ぃ繧、繝ォ蜷"
     
    -

    FatFs繝「繧ク繝・繝シ繝ォ縺ッ髟キ縺繝輔ぃ繧、繝ォ蜷阪♀繧医ウ8.3蠖「蠑上ヵ繧。繧、繝ォ蜷阪↓蟇セ蠢懊@縺ヲ縺縺セ縺吶る聞縺繝輔ぃ繧、繝ォ蜷阪ッ縲_USE_LFN == 1縺ョ縺ィ縺堺スソ逕ィ蜿ッ閭ス縺ォ縺ェ繧翫∪縺吶ゅョ繧」繝ャ繧ッ繝医Μ繝サ繧サ繝代Ξ繝シ繧ソ縺ォ縺ッ / 縺セ縺溘ッ \ 繧剃スソ逕ィ縺励∪縺吶りォ也炊繝峨Λ繧、繝也分蜿キ縺ッ縲'0'ス'9'縺ョ荳譁蟄励ョ謨ー蟄励→繧ウ繝ュ繝ウ縺ァ謖螳壹@縺セ縺吶ら怐逡・縺励◆蝣エ蜷医ッ縲√ョ繝輔か繝ォ繝医サ繝峨Λ繧、繝(0縺セ縺溘ッ繧ォ繝ャ繝ウ繝医サ繝峨Λ繧、繝)縺碁∈謚槭&繧後∪縺

    -

    讓呎コ匁ァ区(_FS_RPATH == 0)縺ョ縺ィ縺阪ッ縲∝ィ縺ヲ縺ョ繧ェ繝悶ず繧ァ繧ッ繝医′繝ォ繝シ繝医サ繝繧」繝ャ繧ッ繝医Μ縺九i霎ソ繧狗オカ蟇セ繝代せ縺ァ謖螳壹&繧後∪縺吶0S謖蜷代↑繧ォ繝ャ繝ウ繝医サ繝繧」繝ャ繧ッ繝医Μ縺ィ縺縺讎ょソオ縺ッ辟。縺上√∪縺溘ラ繝繝亥錐("."繧"..")縺ッ菴ソ逕ィ縺ァ縺阪∪縺帙s縲ゅヱ繧ケ蜷榊磯ュ縺ョ繧サ繝代Ξ繝シ繧ソ縺ッ辟。隕悶&繧後∪縺吶ゅョ繝輔か繝ォ繝医サ繝峨Λ繧、繝也分蜿キ縺ッ蟶ク縺ォ0縺ォ縺ェ繧翫∪縺吶

    -

    逶ク蟇セ繝代せ繧呈怏蜉ケ(_FS_RPATH == 1)縺ォ縺励◆縺ィ縺阪ッ縲∝郁。後☆繧九そ繝代Ξ繝シ繧ソ縺ョ譛臥┌縺ォ繧医▲縺ヲ讀懃エ「髢句ァ九ョ繧」繝ャ繧ッ繝医Μ縺悟、峨o繧翫√そ繝代Ξ繝シ繧ソ縺後≠繧句エ蜷医ッ繝ォ繝シ繝医サ繝繧」繝ャ繧ッ繝医Μ縺九i縲∫┌縺蝣エ蜷医ッf_chdir髢「謨ー縺ァ險ュ螳壹&繧後k繧ォ繝ャ繝ウ繝医サ繝繧」繝ャ繧ッ繝医Μ縺九i縺ォ縺ェ繧翫∪縺吶ゅ∪縺溘ヱ繧ケ蜷阪ョ謖螳壹↓繝峨ャ繝亥錐縺御スソ逕ィ縺ァ縺阪∪縺吶ゅョ繝輔か繝ォ繝医サ繝峨Λ繧、繝也分蜿キ縺ッf_chdrive髢「謨ー縺ァ險ュ螳壹&繧後◆蛟、縺ィ縺ェ繧翫∪縺吶

    +

    FatFs繝「繧ク繝・繝シ繝ォ縺ッ髟キ縺繝輔ぃ繧、繝ォ蜷(LFN)縺翫h縺ウ8.3蠖「蠑上ヵ繧。繧、繝ォ蜷(SFN)縺ォ蟇セ蠢懊@縺ヲ縺縺セ縺吶LFN縺ッ縲(_USE_LFN > 0)縺ョ縺ィ縺堺スソ逕ィ蜿ッ閭ス縺ォ縺ェ繧翫∪縺吶DOS/Windows縺ィ縺ョ驕輔>縺ッ縲√ョ繧」繝ャ繧ッ繝医Μ繝サ繧サ繝代Ξ繝シ繧ソ縺ィ隲也炊繝峨Λ繧、繝也分蜿キ縺ョ謖螳壹〒縺吶ゅョ繧」繝ャ繧ッ繝医Μ繝サ繧サ繝代Ξ繝シ繧ソ縺ォ縺ッ / 縺セ縺溘ッ \ 繧剃スソ逕ィ縺励∪縺吶りォ也炊繝峨Λ繧、繝也分蜿キ縺ッ縲'0'ス'9'縺ョ荳譁蟄励ョ謨ー蟄励→繧ウ繝ュ繝ウ縺ァ謖螳壹@縲∫怐逡・縺励◆蝣エ蜷医ッ繝繝輔か繝ォ繝医サ繝峨Λ繧、繝(0縺セ縺溘ッ繧ォ繝ャ繝ウ繝医サ繝峨Λ繧、繝)縺碁∈謚槭&繧後∪縺吶ゅヱ繧ケ蜷阪↓蜈郁。後≠繧九>縺ッ荳ュ縺ォ蜷ォ縺セ繧後k繧ケ繝壹シ繧ケ縺ッ縲´FN讒区舌〒縺ッ蜷榊燕縺ョ荳驛ィ縺ィ縺励※譛牙柑縺ァ縺吶′縲髱朖FN讒区舌〒縺ッ繝代せ蜷阪ョ邨らォッ縺ィ縺励※隱崎ュ倥&繧後∪縺吶

    +

    讓呎コ匁ァ区(_FS_RPATH == 0)縺ョ縺ィ縺阪ッ縲∝ィ縺ヲ縺ョ繧ェ繝悶ず繧ァ繧ッ繝医′繝ォ繝シ繝医サ繝繧」繝ャ繧ッ繝医Μ縺九i霎ソ繧狗オカ蟇セ繝代せ縺ァ謖螳壹&繧後∪縺吶0S謖蜷代↑繧ォ繝ャ繝ウ繝医サ繝繧」繝ャ繧ッ繝医Μ縺ィ縺縺讎ょソオ縺ッ辟。縺上√∪縺溘ラ繝繝医サ繝繧」繝ャ繧ッ繝医Μ("."繧"..")縺ッ菴ソ逕ィ縺ァ縺阪∪縺帙s縲ゅヱ繧ケ蜷榊磯ュ縺ョ繧サ繝代Ξ繝シ繧ソ縺ッ辟。隕悶&繧後∪縺吶ゅョ繝輔か繝ォ繝医サ繝峨Λ繧、繝也分蜿キ縺ッ蟶ク縺ォ0縺ォ縺ェ繧翫∪縺吶

    +

    逶ク蟇セ繝代せ繧呈怏蜉ケ(_FS_RPATH == 1)縺ォ縺励◆縺ィ縺阪ッ縲∝郁。後☆繧九そ繝代Ξ繝シ繧ソ縺ョ譛臥┌縺ォ繧医▲縺ヲ讀懃エ「髢句ァ九ョ繧」繝ャ繧ッ繝医Μ縺悟、峨o繧翫√そ繝代Ξ繝シ繧ソ縺後≠繧句エ蜷医ッ繝ォ繝シ繝医サ繝繧」繝ャ繧ッ繝医Μ縺九i縲∫┌縺蝣エ蜷医ッf_chdir髢「謨ー縺ァ險ュ螳壹&繧後k繧ォ繝ャ繝ウ繝医サ繝繧」繝ャ繧ッ繝医Μ縺九i縺ォ縺ェ繧翫∪縺吶ゅ∪縺溘ヱ繧ケ蜷阪↓繝峨ャ繝医サ繝繧」繝ャ繧ッ繝医Μ縺御スソ逕ィ縺ァ縺阪∪縺吶ゅョ繝輔か繝ォ繝医サ繝峨Λ繧、繝也分蜿キ縺ッf_chdrive髢「謨ー縺ァ險ュ螳壹&繧後◆蛟、縺ィ縺ェ繧翫∪縺吶

    @@ -37,13 +37,13 @@


    Unicode API

    -

    繝輔ぃ繧、繝ォ髢「謨ー縺ョ蜈・蜃コ蜉帙ョ縺縺。繝輔ぃ繧、繝ォ蜷阪d繝代せ蜷阪r謖螳壹☆繧句シ墓焚縺ョ蝙九ッ縲XCHAR縺ァ螳夂セゥ縺輔l縺ヲ縺縺セ縺吶′縲√%繧後i縺ッchar縺ァtypedef縺輔l縺ヲ縺縺セ縺吶ゅ◎縺励※縲_CODE_PAGE縺ァ謖螳壹&繧後k繝ュ繝シ繧ォ繝ォ繝サ繧ウ繝シ繝(SBCS縺セ縺溘ッDBCS)縺ョ譁蟄怜励→縺励※謇ア繧上l縺セ縺吶ゅヵ繧。繧、繝ォ蜷榊・蜃コ蜉帙rUnicode縺ィ縺吶k讒区(_USE_LFN != 0縺ァ縲√°縺、_LFN_UNICODE == 1)縺ォ縺励◆縺ィ縺阪ッ縲XCHAR縺ッ繝ッ繧、繝画枚蟄(unsigned short)縺ォ蛻繧頑崛繧上j縺セ縺吶ゅ%繧後↓繧医jLFN繝輔Ν蟇セ蠢懊→縺ェ繧翫√Ο繝シ繧ォ繝ォ繝サ繧ウ繝シ繝峨↓縺ェ縺譁蟄(笙・笘ュ笶カ縺ェ縺ゥ)繧ゆスソ逕ィ縺ァ縺阪∪縺吶

    +

    繝輔ぃ繧、繝ォ髢「謨ー縺ョ蜈・蜃コ蜉帙ョ縺縺。繝輔ぃ繧、繝ォ蜷阪d繝代せ蜷阪r謖螳壹☆繧句シ墓焚縺ョ蝙九ッ縲XCHAR縺ァ螳夂セゥ縺輔l縺ヲ縺縺セ縺吶′縲√%繧後ッchar縺ョ繧ィ繝ェ繧「繧ケ縺ォ縺ェ縺」縺ヲ縺縺セ縺吶ゅ◎縺励※縲_CODE_PAGE縺ァ謖螳壹&繧後k OEM繧ウ繝シ繝(SBCS縺セ縺溘ッDBCS)縺ョ譁蟄怜励→縺励※謇ア繧上l縺セ縺吶ゅヵ繧。繧、繝ォ蜷榊・蜃コ蜉帙rUnicode縺ィ縺吶k讒区(LFN讒区舌〒縲√°縺、_LFN_UNICODE繧 1)縺ォ縺励◆縺ィ縺阪ッ縲XCHAR縺ッ繝ッ繧、繝画枚蟄(unsigned short)縺ォ蛻繧頑崛繧上j縲√ヱ繧ケ蜷阪↓Unicode繧剃スソ逕ィ縺吶k繧医≧縺ォ縺ェ繧翫∪縺吶ゅ%繧後↓繧医j LFN繝輔Ν蟇セ蠢懊→縺ェ繧翫^EM繧ウ繝シ繝峨↓縺ェ縺譁蟄(縺溘→縺医ー 笨昶亂笨。笘ク笘ュ縺ェ縺ゥ)繧ゆスソ逕ィ縺ァ縺阪∪縺吶


    -

    隲也炊繝峨Λ繧、繝悶→迚ゥ逅繝峨Λ繧、繝悶ョ蟇セ蠢

    -

    讓呎コ匁ァ区舌〒縺ッ縲√◎繧後◇繧後ョ隲也炊繝峨Λ繧、繝悶ッ蜷後§逡ェ蜿キ縺ョ迚ゥ逅繝峨Λ繧、繝悶↓1:1縺ァ邨舌ウ縺、縺代i繧後※縺縺ヲ縲∫黄逅繝峨Λ繧、繝悶ョ蜈磯ュ縺ョ蛹コ逕サ縺後槭え繝ウ繝医&繧後∪縺吶_MULTI_PARTITION == 1繧呈欠螳壹☆繧九→縲∬ォ也炊繝峨Λ繧、繝悶↓蟇セ縺励※蛟句挨縺ォ迚ゥ逅繝峨Λ繧、繝也分蜿キ繝サ蛹コ逕サ繧呈欠螳壹〒縺阪k繧医≧縺ォ縺ェ繧翫∪縺吶ゅ%縺ョ讒区舌〒縺ッ縲∬ォ也炊繝峨Λ繧、繝悶→蛹コ逕サ縺ョ蟇セ蠢懊r隗」豎コ縺吶k縺溘a縺ョ繝繝シ繝悶Ν繧呈ャ。縺ォ遉コ縺吶h縺縺ォ螳夂セゥ縺吶k蠢隕√′縺ゅj縺セ縺吶

    +

    隲也炊繝峨Λ繧、繝(繝懊Μ繝・繝シ繝)縺ィ迚ゥ逅繝峨Λ繧、繝(繝繧」繧ケ繧ッ陬鄂ョ)縺ョ蟇セ蠢

    +

    繝繝輔か繝ォ繝医ョ讒区舌〒縺ッ縲√◎繧後◇繧後ョ隲也炊繝峨Λ繧、繝悶ッ蜷後§逡ェ蜿キ縺ョ迚ゥ逅繝峨Λ繧、繝悶↓1:1縺ァ邨舌ウ縺、縺代i繧後※縺縺ヲ縲∫黄逅繝峨Λ繧、繝悶ョ蜈磯ュ縺ョ蛹コ逕サ縺後槭え繝ウ繝医&繧後∪縺吶_MULTI_PARTITION縺ォ 1繧呈欠螳壹☆繧九→縲∬ォ也炊繝峨Λ繧、繝悶↓蟇セ縺励※蛟句挨縺ォ迚ゥ逅繝峨Λ繧、繝也分蜿キ繝サ蛹コ逕サ繧呈欠螳壹〒縺阪k繧医≧縺ォ縺ェ繧翫∪縺吶ゅ%縺ョ讒区舌〒縺ッ縲∬ォ也炊繝峨Λ繧、繝悶→蛹コ逕サ縺ョ蟇セ蠢懊r隗」豎コ縺吶k縺溘a縺ョ繝繝シ繝悶Ν繧呈ャ。縺ォ遉コ縺吶h縺縺ォ螳夂セゥ縺吶k蠢隕√′縺ゅj縺セ縺吶

     萓:隲也炊繝峨Λ繧、繝0ス2繧堤黄逅繝峨Λ繧、繝0(蝗コ螳壹ョ繧」繧ケ繧ッ)縺ョ3縺、縺ョ蝓コ譛ャ蛹コ逕サ縺ォ蜑イ繧雁ス薙※縲
        隲也炊繝峨Λ繧、繝3繧堤黄逅繝峨Λ繧、繝1(繝ェ繝繝シ繝舌ヶ繝ォ繝サ繝繧」繧ケ繧ッ)縺ォ蜑イ繧雁ス薙※繧句エ蜷医
    diff --git a/doc/ja/forward.html b/doc/ja/forward.html
    index 352ce37..b49f470 100644
    --- a/doc/ja/forward.html
    +++ b/doc/ja/forward.html
    @@ -50,7 +50,7 @@ FRESULT f_forward (
     
    FR_INT_ERR
    不正なFAT構造または内部エラーによる失敗。
    FR_NOT_READY
    -
    メディアがセットされていないなど、ディスク・ドライブが動作不能状態。
    +
    メディアがセットされていないなど、物理ドライブが動作不能状態。
    FR_INVALID_OBJECT
    無効なファイル・オブジェクト。
    @@ -60,7 +60,12 @@ FRESULT f_forward (

    解説

    ファイルのデータをバッファに読み出さずに送信ストリームに直接転送します。アプリケーション側でデータ・バッファを必要としないので、メモリの限られた環境で有効です。転送開始位置は、現在のファイルR/Wポインタからになります。ファイルR/Wポインタは転送されたバイト数だけ進みます。指定されたバイト数の転送中にファイルの終端に達した場合や送信ストリームがビジーになった場合、*ByteFwdByteToFwdよりも小さくなります。

    -

    この関数は、_USE_FORWARD == 1で、且つ_FS_TINY == 1のときにサポートされます。

    +
    + + +
    +

    対応情報

    +

    _USE_FORWARD == 1で、且つ_FS_TINY == 1のときに使用可能です。

    diff --git a/doc/ja/getfree.html b/doc/ja/getfree.html index 03c165b..2286e21 100644 --- a/doc/ja/getfree.html +++ b/doc/ja/getfree.html @@ -43,7 +43,7 @@ FRESULT f_getfree (
    FR_INVALID_DRIVE
    ドライブ番号が不正。
    FR_NOT_READY
    -
    メディアがセットされていないなど、ディスクドライブが動作不能状態。
    +
    メディアがセットされていないなど、物理ドライブが動作不能状態。
    FR_DISK_ERR
    ディスク・エラーによる失敗。
    FR_INT_ERR
    @@ -59,7 +59,12 @@ FRESULT f_getfree (

    解説

    論理ドライブ上の空きクラスタ数を取得します。返されたファイル・システム・オブジェクトのcsizeメンバがクラスタあたりのセクタ数を示しているので、これを元に実際の空きサイズが計算できます。FAT32ボリュームにおいては、FSINFOの状態によっては不正確な値を返したり、処理に時間がかかったりする可能性があります。

    -

    リードオンリー構成および_FS_MINIMIZE >= 1ではこの関数はサポートされません。

    +
    + + +
    +

    対応情報

    +

    _FS_READONLY == 0で、且つ_FS_MINIMIZE == 0のとき使用可能です。

    @@ -70,15 +75,15 @@ FRESULT f_getfree ( DWORD fre_clust, fre_sect, tot_sect; - // Get drive information and free clusters + /* Get drive information and free clusters */ res = f_getfree("/", &fre_clust, &fs); if (res) die(res); - // Get total sectors and free sectors + /* Get total sectors and free sectors */ tot_sect = (fs->max_clust - 2) * fs->csize; fre_sect = fre_clust * fs->csize; - // Print free space in unit of KB (assuming 512B/sector) + /* Print free space in unit of KB (assuming 512B/sector) */ printf("%lu KB total drive space.\n" "%lu KB available.\n", fre_sect / 2, tot_sect / 2); diff --git a/doc/ja/gets.html b/doc/ja/gets.html index e82a5d6..d0c8b57 100644 --- a/doc/ja/gets.html +++ b/doc/ja/gets.html @@ -44,7 +44,12 @@ char* f_gets (

    解説

    この関数はf_read()のラッパー関数です。読み出し動作は、最初の'\n'を読み込むか、ファイル終端に達するか、Size - 1文字を読み出すまで続きます。読み込まれた文字列の終端には'\0'が付加されます。既にファイル終端で1文字も読み込まれなかったとき、または何らかのエラーが発生したときはNULLを返します。ファイル終端かエラーかはf_eof(),f_error()マクロで調べられます。

    -

    _USE_STRFUNCが1または2のときこの関数がサポートされます。2のときは、ファイルに含まれる'\r'が取り除かれてバッファに読み込まれます。

    +
    + + +
    +

    対応情報

    +

    _USE_STRFUNCが 1または 2のとき使用可能です。2のときは、ファイルに含まれる'\r'が取り除かれてバッファに読み込まれます。

    diff --git a/doc/ja/lseek.html b/doc/ja/lseek.html index 8d336ca..9cb9f50 100644 --- a/doc/ja/lseek.html +++ b/doc/ja/lseek.html @@ -42,7 +42,7 @@ FRESULT f_lseek (
    FR_INT_ERR
    不正なFAT構造または内部エラーによる失敗。
    FR_NOT_READY
    -
    メディアがセットされていないなど、ディスク・ドライブが動作不能状態。
    +
    メディアがセットされていないなど、物理ドライブが動作不能状態。
    FR_INVALID_OBJECT
    無効なファイル・オブジェクト。
    @@ -56,38 +56,43 @@ FRESULT f_lseek (
  • 非書き込みモードのため、ファイル・サイズでクリップされた。
  • ファイル拡張中にディスクが満杯になった。
  • -

    _FS_MINIMIZE >= 3ではこの関数はサポートされません。

    +
    + + +
    +

    対応情報

    +

    _FS_MINIMIZE < 3のとき使用可能です。

    使用例

    -    // ファイル・オフセット5000へ移動
    +    /* オフセット5000へ移動 */
         res = f_lseek(&file, 5000);
     
    -    // ファイル追記の準備 (ファイル終端へ移動)
    +    /* ファイル追記の準備 (ファイル終端へ移動) */
         res = f_lseek(&file, file.fsize);
     
    -    // 3000バイト進める
    +    /* 3000バイト進める */
         res = f_lseek(&file, file.fptr + 3000);
     
    -    // 2000バイト戻す (オーバーフローに注意)
    +    /* 2000バイト戻す (オーバーフローに注意) */
         res = f_lseek(&file, file.fptr - 2000);
     
    -    // クラスタ先行割り当て (ストリーミング・ライト時のバッファ・オーバーラン防止)
    +    /* クラスタ先行割り当て (ストリーミング・ライト時のバッファ・オーバーラン防止) */
     
    -    res = f_open(&file, "record.wav", FA_CREATE_NEW | FA_WRITE); // ファイル作成
    +    res = f_open(&file, "record.wav", FA_CREATE_NEW | FA_WRITE); /* ファイル作成 */
     
    -    res = f_lseek(&file, MAX_SIZE);        // 十分なクラスタの先行割り当て
    -    if (res || file.fptr != PRE_SIZE) .... // 正しくファイルが拡張されたかチェック
    +    res = f_lseek(&file, MAX_SIZE);        /* 十分なクラスタの先行割り当て */
    +    if (res || file.fptr != PRE_SIZE) .... /* 正しくファイルが拡張されたかチェック */
     
    -    res = f_lseek(&file, DATA_START);      // データ・ストリームの記録(アロケーションディレイ無し)
    +    res = f_lseek(&file, DATA_START);      /* データ・ストリームの記録(アロケーションディレイ無し) */
         ...
     
    -    res = f_truncate(&file);              // 不要領域の切り捨て
    -    res = f_lseek(&file, 0);              // ヘッダの記録
    +    res = f_truncate(&file);              /* 不要領域の切り捨て */
    +    res = f_lseek(&file, 0);              /* ヘッダの記録 */
         ...
     
         res = f_close(&file);
    diff --git a/doc/ja/mkdir.html b/doc/ja/mkdir.html
    index 57ae209..d30e396 100644
    --- a/doc/ja/mkdir.html
    +++ b/doc/ja/mkdir.html
    @@ -45,7 +45,7 @@ FRESULT f_mkdir (
     
    FR_EXIST
    同名のディレクトリやファイルが存在する。
    FR_NOT_READY
    -
    メディアがセットされていないなど、ディスク・ドライブが動作不能状態。
    +
    メディアがセットされていないなど、物理ドライブが動作不能状態。
    FR_WRITE_PROTECTED
    メディアが書き込み禁止状態。
    FR_DISK_ERR
    @@ -55,14 +55,20 @@ FRESULT f_mkdir (
    FR_NOT_ENABLED
    その論理ドライブにワーク・エリアが与えられていない。
    FR_NO_FILESYSTEM
    -
    ディスク上に有効なFATパーテーションが見つからない。
    +
    ディスク上に有効なFATボリュームが見つからない。

    解説

    -

    空のディレクトリを作成します。リード・オンリー構成および_FS_MINIMIZE >= 1ではこの関数はサポートされません。

    +

    空のディレクトリを作成します。

    +
    + + +
    +

    対応情報

    +

    _FS_READONLY == 0で、且つ_FS_MINIMIZE == 0のとき使用可能です。

    diff --git a/doc/ja/mkfs.html b/doc/ja/mkfs.html index 552925d..2a63055 100644 --- a/doc/ja/mkfs.html +++ b/doc/ja/mkfs.html @@ -64,7 +64,12 @@ FRESULT f_mkfs (

    説明

    f_mkfs関数はFATファイル・システムをドライブ上に作成します。リムーバブル・メディアのパーテーショニング・ルールとしてはFDISK形式とSFD形式があり、メモリ・カードではFDISK形式が普通です。この関数は複数区画には対応していないので、その物理ドライブの既存の区画は全て削除され、全体が一つの区画になります。

    FATタイプ(FAT12/FAT16/FAT32)は、その論理ドライブ上のクラスタ数によってのみ決定される[FAT仕様書より]決まりになっていて、それ以外の要因はありません。したがって、どのFATタイプになるかはドライブ・サイズと指定されたクラスタ・サイズに依存します。クラスタ・サイズは大きくするほど性能が上がり、逆にディスク利用効率は落ちます。

    -

    この関数は、構成オプション_USE_MKFSを選択したときにサポートされます。

    + + + +
    +

    対応情報

    +

    _FS_READONLY == 0で、且つ_USE_MKFS == 1のとき使用可能です。

    diff --git a/doc/ja/mount.html b/doc/ja/mount.html index 034123c..250f798 100644 --- a/doc/ja/mount.html +++ b/doc/ja/mount.html @@ -49,6 +49,12 @@ FRESULT f_mount ( +
    +

    対応情報

    +

    全ての構成で使用可能です。

    +
    + +

    参照

    FATFS

    diff --git a/doc/ja/open.html b/doc/ja/open.html index 5829d0f..f9b25e6 100644 --- a/doc/ja/open.html +++ b/doc/ja/open.html @@ -63,7 +63,7 @@ FRESULT f_open (
    FR_DENIED
    アクセスが拒否された。リード・オンリー・ファイルの書き込みモード・オープン、同名のディレクトリまたはリード・オンリー・ファイルがある状態でのファイル作成、ディスクまたはディレクトリ・テーブルが満杯でファイルを作成できないなど。
    FR_NOT_READY
    -
    メディアがセットされていないなど、ディスク・ドライブが動作不能状態。
    +
    メディアがセットされていないなど、物理ドライブが動作不能状態。
    FR_WRITE_PROTECTED
    メディアが書き込み禁止状態で書き込み系オープンをした。
    FR_DISK_ERR
    @@ -73,16 +73,21 @@ FRESULT f_open (
    FR_NOT_ENABLED
    その論理ドライブにワーク・エリアが割り当てられていない。
    FR_NO_FILESYSTEM
    -
    ディスク上に有効なFATパーテーションが見つからない。
    +
    ディスク上に有効なFATボリュームが見つからない。

    解説

    -

    作成されたファイル・オブジェクトは、以降そのファイルに対するアクセスに使用します。ファイルを閉じるときは、f_close()を使用します。何らかの変更が行われたファイルが正しく閉じられなかった場合、そのファイルが破損する場合があります。

    +

    既存のファイルを開いたり、新しいファイルを作成します。関数が成功するとファイル・オブジェクトが作成され、以降そのファイルに対するアクセスに使用します。ファイルを閉じるときは、f_close()を使用します。何らかの変更が行われたファイルがその後正しく閉じられなかった場合、そのファイルが破損する場合があります。

    ファイル・アクセスを開始する前に、f_mount()を使ってそれぞれの論理ドライブにワーク・エリア(ファイル・システム・オブジェクト)を与える必要があります。この初期化の後、その論理ドライブに対して全てのファイル関数が使えるようになります。

    -

    リードオンリー構成では、FA_WRITE, FA_CREATE_ALWAYS, FA_CREATE_NEW, FA_OPEN_ALWAYSの各フラグはサポートされません。

    +
    + + +
    +

    対応情報

    +

    全ての構成で使用可能です。_FS_READONLY == 1のときは、FA_WRITE, FA_CREATE_ALWAYS, FA_CREATE_NEW, FA_OPEN_ALWAYSの各フラグはサポートされません。

    @@ -91,37 +96,37 @@ FRESULT f_open (
     void main (void)
     {
    -    FATFS fs[2];         // 論理ドライブのワーク・エリア(ファイル・システム・オブジェクト)
    -    FIL fsrc, fdst;      // ファイル・オブジェクト
    -    BYTE buffer[4096];   // file copy buffer
    -    FRESULT res;         // FatFs function common result code
    -    UINT br, bw;         // File R/W count
    +    FATFS fs[2];         /* 論理ドライブのワーク・エリア(ファイル・システム・オブジェクト) */
    +    FIL fsrc, fdst;      /* ファイル・オブジェクト */
    +    BYTE buffer[4096];   /* file copy buffer */
    +    FRESULT res;         /* FatFs function common result code */
    +    UINT br, bw;         /* File R/W count */
     
    -    // ドライブ0,1にワーク・エリアを与える
    +    /* ドライブ0,1にワーク・エリアを与える */
         f_mount(0, &fs[0]);
         f_mount(1, &fs[1]);
     
    -    // ドライブ1のソース・ファイルを開く
    +    /* ドライブ1のソース・ファイルを開く */
         res = f_open(&fsrc, "1:srcfile.dat", FA_OPEN_EXISTING | FA_READ);
         if (res) die(res);
     
    -    // ドライブ0にデスティネーション・ファイルを作成する
    +    /* ドライブ0にデスティネーション・ファイルを作成する */
         res = f_open(&fdst, "0:dstfile.dat", FA_CREATE_ALWAYS | FA_WRITE);
         if (res) die(res);
     
    -    // ソースからデスティネーションにコピーする
    +    /* ソースからデスティネーションにコピーする */
         for (;;) {
             res = f_read(&fsrc, buffer, sizeof(buffer), &br);
    -        if (res || br == 0) break;   // error or eof
    +        if (res || br == 0) break;   /* エラーかファイル終端 */
             res = f_write(&fdst, buffer, br, &bw);
    -        if (res || bw < br) break;   // error or disk full
    +        if (res || bw < br) break;   /* エラーかディスク満杯 */
         }
     
    -    // 全てのファイルを閉じる
    +    /* 全てのファイルを閉じる */
         f_close(&fsrc);
         f_close(&fdst);
     
    -    // ワーク・エリアを開放する
    +    /* ワーク・エリアを開放する */
         f_mount(0, NULL);
         f_mount(1, NULL);
     }
    diff --git a/doc/ja/opendir.html b/doc/ja/opendir.html
    index 809b9e4..60dfdf4 100644
    --- a/doc/ja/opendir.html
    +++ b/doc/ja/opendir.html
    @@ -12,7 +12,7 @@
     
     

    f_opendir

    -

    ディレクトリをオープンします。

    +

    ディレクトリを開きます。

     FRESULT f_opendir (
       DIR* DirObject,       /* ディレクトリ・ブジェクト構造体へのポインタ */
    @@ -44,7 +44,7 @@ FRESULT f_opendir (
     
    FR_INVALID_DRIVE
    ドライブ番号が不正。
    FR_NOT_READY
    -
    メディアがセットされていないなど、ディスク・ドライブが動作不能状態。
    +
    メディアがセットされていないなど、物理ドライブが動作不能状態。
    FR_DISK_ERR
    ディスク・エラーによる失敗。
    FR_INT_ERR
    @@ -52,14 +52,20 @@ FRESULT f_opendir (
    FR_NOT_ENABLED
    論理ドライブにワーク・エリアが与えられていない。
    FR_NO_FILESYSTEM
    -
    ディスク上に有効なFATパーテーションが見つからない。
    +
    ディスク上に有効なFATボリュームが見つからない。

    解説

    -

    ディレクトリをオープンします。正常終了したら、DirObject構造体を使ってこのディレクトリの項目を順次読み出せます。DirObject構造体は使用後は任意の時点で破棄できます。_FS_MINIMIZE >= 2ではこの関数はサポートされません。

    +

    ディレクトリを開きます。正常終了したら、DirObject構造体を使ってこのディレクトリの項目を順次読み出せます。DirObject構造体は使用後は任意の時点で破棄できます。

    +
    + + +
    +

    対応情報

    +

    _FS_MINIMIZE <= 1のとき使用可能になります。

    diff --git a/doc/ja/printf.html b/doc/ja/printf.html index 8bae4f3..911be13 100644 --- a/doc/ja/printf.html +++ b/doc/ja/printf.html @@ -44,7 +44,18 @@ int f_printf (

    解説

    -

    この関数はf_putc()およびf_puts()のラッパー関数です。書式制御機能はサブセットとなっていて、使用可能はタイプはc s d u X、精度指定はl、フラグは0となっています。リード・ライト構成で_USE_STRFUNCが1または2のときこの関数がサポートされます。

    +

    この関数はf_putc()およびf_puts()のラッパー関数です。書式制御機能はサブセットとなっていて、書式制御文字は次に示すものが使用可能です。

    +
      +
    • タイプ: c s d u X
    • +
    • 精度指定: l
    • +
    • フラグ: 0
    • +
    +
    + + +
    +

    対応情報

    +

    _FS_READONLY == 0で、且つ_USE_STRFUNCが 1または 2のとき使用可能になります。2の時は、出力に含まれる'\n'"\r\n"に展開されてファイルに書き込まれます。

    diff --git a/doc/ja/putc.html b/doc/ja/putc.html index ba77a7e..53f8935 100644 --- a/doc/ja/putc.html +++ b/doc/ja/putc.html @@ -40,7 +40,13 @@ int f_putc (

    解説

    -

    この関数はf_write()のラッパー関数です。リード・ライト構成で、_USE_STRFUNCが1または2のときこの関数がサポートされます。2を指定すると、'\n'"\r\n"に変換されて書き込まれます。

    +

    1文字をファイルに書き込みます。この関数はf_write()のラッパー関数です。

    +
    + + +
    +

    対応情報

    +

    _FS_READONLY == 0で、且つ_USE_STRFUNCが 1または 2のとき使用可能です。2を指定すると、'\n'"\r\n"に展開されてファイルに書き込まれます。

    diff --git a/doc/ja/puts.html b/doc/ja/puts.html index d48bc09..b7f4d75 100644 --- a/doc/ja/puts.html +++ b/doc/ja/puts.html @@ -40,7 +40,13 @@ int f_puts (

    解説

    -

    この関数はf_putc()のラッパー関数です。リード・ライト構成で、_USE_STRFUNCが1または2のときこの関数がサポートされます。2を指定すると、文字列中の'\n'"\r\n"に変換されて書き込まれます。

    +

    文字列をファイルに書き込みます。この関数はf_putc()のラッパー関数です。

    +
    + + +
    +

    対応情報

    +

    _FS_READONLY == 0で、且つ_USE_STRFUNCが 1または 2のとき使用可能です。2を指定すると、文字列に含まれる'\n'"\r\n"に展開されてファイルに書き込まれます。

    diff --git a/doc/ja/read.html b/doc/ja/read.html index c37fddb..dc8553e 100644 --- a/doc/ja/read.html +++ b/doc/ja/read.html @@ -33,7 +33,7 @@ FRESULT f_read (
    ByteToRead
    読み出すバイト数(0〜UINTの最大値)を指定します。
    ByteRead
    -
    実際に読み出されたバイト数を格納する変数を指すポインタを指定します。戻り値は常に有効です。
    +
    実際に読み出されたバイト数を格納する変数を指すポインタを指定します。戻り値は関数の成否にかかわらず常に有効です。
    @@ -50,7 +50,7 @@ FRESULT f_read (
    FR_INT_ERR
    不正なFAT構造または内部エラーによる失敗。
    FR_NOT_READY
    -
    メディアがセットされていないなど、ディスク・ドライブが動作不能状態。
    +
    メディアがセットされていないなど、物理ドライブが動作不能状態。
    FR_INVALID_OBJECT
    無効なファイル・オブジェクト。
    @@ -63,6 +63,12 @@ FRESULT f_read ( +
    +

    対応情報

    +

    全ての構成で使用可能です。

    +
    + +

    参照

    f_open, fgets, f_write, f_close, FIL

    diff --git a/doc/ja/readdir.html b/doc/ja/readdir.html index a76e24a..0ac5b2c 100644 --- a/doc/ja/readdir.html +++ b/doc/ja/readdir.html @@ -38,7 +38,7 @@ FRESULT f_readdir (
    FR_OK (0)
    正常終了。
    FR_NOT_READY
    -
    メディアがセットされていないなど、ディスク・ドライブが動作不能状態。
    +
    メディアがセットされていないなど、物理ドライブが動作不能状態。
    FR_DISK_ERR
    ディスク・エラーによる失敗。
    FR_INT_ERR
    @@ -51,9 +51,20 @@ FRESULT f_readdir (

    解説

    -

    ディレクトリ項目を順次読み出します。この関数を繰り返し実行することによりディレクトリの全ての項目を読み出すことができます。全ての項目を読み出し、読み出す項目がもう無いときは、f_name[]メンバにヌル文字列が返されます。ボリューム名は読み出すときに棄てられ、現れることはありません。"."、".."は、相対パスが有効なとき(_FS_RPATH == 1)のみ現れます。得られるファイル情報の詳細については FILINFO構造体を参照してください。FileInfoにヌル・ポインタを指定すると、そのディレクトリのリード・インデックスを巻き戻します。

    -

    LFN機能が有効な時は、f_readdir関数の呼び出しに先立ってFILINFO構造体のlfnamelfsizeが有効な値で初期化されていなければなりません。lfnameはLFNを格納するバッファで、lfsizeはそのバッファ・サイズです。LFN格納バッファまたはLFN操作バッファどちらかのサイズがそのLFNのサイズに対して不十分だった場合またはLFNが存在しない場合は、LFN格納バッファにヌル文字列が返されます。LFNにローカル・コードに存在しない文字が含まれている場合も同様ですが、Unicode APIが指定されている場合は文字コードの制約はありません。lfnameにヌル・ポインタを指定した場合は、LFNに関して何も返されません。

    -

    _FS_MINIMIZE >= 2ではこの関数はサポートされません。

    +

    ディレクトリ項目を順次読み出します。この関数を繰り返し実行することによりディレクトリの全ての項目を読み出すことができます。全ての項目を読み出し、読み出す項目がもう無いときは、f_name[]メンバにヌル文字列が返されます。ボリューム名は読み出すときに棄てられ、現れることはありません。"."、".."は、相対パスが有効なとき(_FS_RPATH == 1)にのみ現れます。得られるファイル情報の詳細については FILINFO構造体を参照してください。FileInfoにヌル・ポインタを指定すると、そのディレクトリのリード・インデックスを巻き戻します。

    +

    LFN機能が有効な時は、f_readdir関数の呼び出しに先立ってFILINFO構造体のlfnamelfsizeが有効な値で初期化されていなければなりません。lfnameはLFNを格納するバッファで、lfsizeはそのバッファ・サイズ(文字数)です。次の条件に一つでも該当する場合は、LFN格納バッファにヌル文字列が返されます。

    +
      +
    • そのディレクトリ項目にLFNが存在しない。
    • +
    • LFNの長さに対してLFN格納バッファまたはLFN操作バッファのサイズが不十分。
    • +
    • LFNにOEMコードに存在しない文字が含まれている。(Unicode APIではないとき)
    • +
    +

    また、lfnameにヌル・ポインタを指定した場合は、LFNに関して何も返されません。LFNが存在しないときは、f_name[]メンバのSFNにASCII英小文字が含まれる場合があります。

    +
    + + +
    +

    対応情報

    +

    _FS_MINIMIZE <= 1のときに使用可能です。

    @@ -80,12 +91,12 @@ FRESULT scan_files (char* path) for (;;) { res = f_readdir(&dir, &fno); if (res != FR_OK || fno.fname[0] == 0) break; + if (fno.fname[0] == '.') continue; #if _USE_LFN fn = *fno.lfname ? fno.lfname : fno.fname; #else fn = fno.fname; #endif - if (*fn == '.') continue; if (fno.fattrib & AM_DIR) { sprintf(&path[i], "/%s", fn); res = scan_files(path); diff --git a/doc/ja/rename.html b/doc/ja/rename.html index 587c058..f3d19e4 100644 --- a/doc/ja/rename.html +++ b/doc/ja/rename.html @@ -27,7 +27,7 @@ FRESULT f_rename (
    OldName
    変更対象のオブジェクト(ファイルまたはディレクトリ)へのパス名の入った'\0'で終わる文字列へのポインタを指定します。
    NewName
    -
    新しいファイルまたはディレクトリのフルパス名の入った'\0'で終わる文字列へのポインタを指定します。既に存在するものと同じ名前は使えません。また、ドライブ番号は指定できず、OldNameで指定されたドライブ上のオブジェクトとして扱われます。
    +
    新しいファイルまたはディレクトリのフルパス名の入った'\0'で終わる文字列へのポインタを指定します。既に存在する名前は使えません。また、ドライブ番号は指定できず、OldNameで指定されたボリューム上のオブジェクトとして扱われます。
    @@ -48,9 +48,9 @@ FRESULT f_rename (
    FR_DENIED
    ドライブ容量の不足等の理由で新しい名前のオブジェクトが作れない。
    FR_EXIST
    -
    NewNameと同じオブジェクトが既に存在する。
    +
    NewNameと同じ名前が既に存在する。
    FR_NOT_READY
    -
    メディアがセットされていないなど、ディスク・ドライブが動作不能状態。
    +
    メディアがセットされていないなど、物理ドライブが動作不能状態。
    FR_WRITE_PROTECTED
    メディアが書き込み禁止状態。
    FR_DISK_ERR
    @@ -60,24 +60,30 @@ FRESULT f_rename (
    FR_NOT_ENABLED
    論理ドライブにワークエリアが割り当てられていない。
    FR_NO_FILESYSTEM
    -
    ディスク上に有効なFATパーテーションが見つからない。
    +
    ディスク上に有効なFATボリュームが見つからない。

    解説

    -

    ファイルまたはディレクトリの名前を変更します。また、別のディレクトリへの移動(同じドライブ内のみ)も可能です。リード・オンリー構成および_FS_MINIMIZE >= 1ではこの関数はサポートされません。

    +

    オブジェクトの名前を変更します。また、別のディレクトリへの移動(同じドライブ内のみ)も可能です。開かれているオブジェクトに対して使用してはなりません

    +
    + + +
    +

    対応情報

    +

    _FS_READONLY == 0で、且つ_FS_MINIMIZE == 0のときに使用可能です。

    使用例

    -    // ファイルまたはサブディレクトリの名前を変更する
    +    /* ファイルまたはサブディレクトリの名前を変更する */
         f_rename("oldname.txt", "newname.txt");
     
    -    // ファイルまたはサブディレクトリの名前を変更すると同時に別のディレクトリへ移動する
    +    /* ファイルまたはサブディレクトリの名前の変更と別のディレクトリへの移動 */
         f_rename("oldname.txt", "dir1/newname.txt");
     
    diff --git a/doc/ja/sfatfs.html b/doc/ja/sfatfs.html index 2cedc67..d5cfa97 100644 --- a/doc/ja/sfatfs.html +++ b/doc/ja/sfatfs.html @@ -21,6 +21,7 @@ typedef struct _FATFS_ { BYTE csize; /* Number of sectors per cluster */ BYTE n_fats; /* Number of FAT copies */ BYTE wflag; /* win[] dirty flag (1:must be written back) */ + BYTE fsi_flag; /* fsinfo dirty flag (1:must be written back) */ WORD id; /* File system mount ID */ WORD n_rootdir; /* Number of root directory entries (0 on FAT32) */ #if _FS_REENTRANT @@ -30,7 +31,6 @@ typedef struct _FATFS_ { WORD s_size; /* Sector size */ #endif #if !_FS_READONLY - BYTE fsi_flag; /* fsinfo dirty flag (1:must be written back) */ DWORD last_clust; /* Last allocated cluster */ DWORD free_clust; /* Number of free clusters */ DWORD fsi_sector; /* fsinfo sector */ diff --git a/doc/ja/sfileinfo.html b/doc/ja/sfileinfo.html index e37e39c..9efffe8 100644 --- a/doc/ja/sfileinfo.html +++ b/doc/ja/sfileinfo.html @@ -57,11 +57,11 @@ typedef struct _FILINFO_ {
    fattrib
    属性フラグが格納されます。フラグはAM_DIR, AM_RDO, AM_HID, AM_SYS, AM_ARCの組み合わせとなります。
    fname[]
    -
    8.3形式の名前が'\0'で終わる文字列として格納されます。
    +
    8.3形式の名前が'\0'で終わる文字列として格納されます。非LFN構成のときは、常に大文字で返されます。LFN構成のときは短い名前が返されますが、ASCII英字が小文字になる場合があります。
    lfname
    -
    返される長いファイル名を格納するバッファへのポインタ。この構造体を使用する前にアプリケーションにより初期化されなければなりません。非LFN構成のときは存在しません。
    +
    返される長いファイル名を格納するバッファへのポインタ。この構造体を使用する前にアプリケーションにより初期化されなければなりません。非LFN構成のときはこのメンバは存在しません。
    lfsize
    -
    長いファイル名を格納するバッファのサイズ(文字数)。この構造体を使用する前にアプリケーションにより初期化されなければなりません。非LFN構成のときは存在しません。
    +
    長いファイル名を格納するバッファのサイズ(文字数)。この構造体を使用する前にアプリケーションにより初期化されなければなりません。非LFN構成のときはこのメンバは存在しません。

    戻る

    diff --git a/doc/ja/stat.html b/doc/ja/stat.html index 1a79ab8..f24193c 100644 --- a/doc/ja/stat.html +++ b/doc/ja/stat.html @@ -45,7 +45,7 @@ FRESULT f_stat (
    FR_INVALID_DRIVE
    ドライブ番号が不正。
    FR_NOT_READY
    -
    メディアがセットされていないなど、ディスク・ドライブが動作不能状態。
    +
    メディアがセットされていないなど、物理ドライブが動作不能状態。
    FR_DISK_ERR
    ディスク・エラーによる失敗。
    FR_INT_ERR
    @@ -53,14 +53,20 @@ FRESULT f_stat (
    FR_NOT_ENABLED
    論理ドライブにワークエリアが割り当てられていない。
    FR_NO_FILESYSTEM
    -
    ディスク上に有効なFATパーテーションが見つからない。
    +
    ディスク上に有効なFATボリュームが見つからない。

    解説

    -

    ファイルまたはディレクトリに関する情報を得ます。得られるファイル情報の詳細については FILINFO構造体を参照してください。_FS_MINIMIZE >= 1ではこの関数はサポートされません。

    +

    ファイルまたはディレクトリに関する情報を得ます。得られるファイル情報の詳細については FILINFO構造体を参照してください。

    +
    + + +
    +

    対応情報

    +

    _FS_MINIMIZE == 0のときに使用可能です。

    diff --git a/doc/ja/sync.html b/doc/ja/sync.html index bc979fd..f3a6088 100644 --- a/doc/ja/sync.html +++ b/doc/ja/sync.html @@ -39,7 +39,7 @@ FRESULT f_sync (
    FR_INT_ERR
    不正なFAT構造または内部エラーによる失敗。
    FR_NOT_READY
    -
    メディアがセットされていないなど、ディスク・ドライブが動作不能状態。
    +
    メディアがセットされていないなど、物理ドライブが動作不能状態。
    FR_INVALID_OBJECT
    ファイル・オブジェクトが無効。
    @@ -49,7 +49,12 @@ FRESULT f_sync (

    解説

    この関数はf_close()と同じ処理を実行しますが、ファイルは引き続き開かれたままになり、読み書きを続行できます。ロギングなど、書き込みモードで長時間ファイルが開かれているアプリケーションにおいて、定期的または区切りの良いところでsyncすることにより、不意の電源断やメディアの取り外しにより失われるデータを最小にすることができます。実際のところ、f_closeではsyncしたあとファイル・オブジェクトを破棄しているだけなので、f_close直前のsyncは意味がありません。

    -

    リード・オンリー構成ではこの関数はサポートされません。

    +
    + + +
    +

    対応情報

    +

    _FS_READONLY == 0のときに使用可能です。

    diff --git a/doc/ja/truncate.html b/doc/ja/truncate.html index bf22aa0..49b9f03 100644 --- a/doc/ja/truncate.html +++ b/doc/ja/truncate.html @@ -50,7 +50,13 @@ FRESULT f_truncate (

    解説

    -

    ファイルの長さが現在のファイルR/Wポインタに切り詰められます。ファイルR/Wポインタがファイルの終端を指しているときは、この関数は何の効果も持ちません。リード・オンリー構成および_FS_MINIMIZE >= 1ではこの関数はサポートされません。

    +

    ファイルの長さが現在のファイルR/Wポインタに切り詰められます。ファイルR/Wポインタがファイルの終端を指しているときは、この関数は何の効果も持ちません。

    +
    + + +
    +

    対応情報

    +

    _FS_READONLY == 0で、且つ_FS_MINIMIZE == 0のときに使用可能です。

    diff --git a/doc/ja/unlink.html b/doc/ja/unlink.html index 1e36b45..7867d3a 100644 --- a/doc/ja/unlink.html +++ b/doc/ja/unlink.html @@ -12,10 +12,10 @@

    f_unlink

    -

    ファイルまたはディレクトリを削除します。

    +

    オブジェクトを削除します。

     FRESULT f_unlink (
    -  const XCHAR* FileName  /* ファイルまたはディレクトリ名へのポインタ */
    +  const XCHAR* FileName  /* オブジェクト名へのポインタ */
     );
     
    @@ -43,7 +43,7 @@ FRESULT f_unlink (
    FR_INVALID_DRIVE
    ドライブ番号が不正。
    FR_DENIED
    -
    対象ファイル・ディレクトリがリード・オンリー状態、対象ディレクトリが空でない場合など。
    +
    対象オブジェクトがリード・オンリー属性、ディレクトリの場合は空でない場合など。
    FR_NOT_READY
    メディアがセットされていないなど、物理ドライブが動作不能状態。
    FR_WRITE_PROTECTED
    @@ -55,16 +55,22 @@ FRESULT f_unlink (
    FR_NOT_ENABLED
    論理ドライブにワーク・エリアが割り当てられていない。
    FR_NO_FILESYSTEM
    -
    ディスク上に有効なFATパーテーションが見つからない。
    +
    ディスク上に有効なFATボリュームが見つからない。

    解説

    -

    ファイルまたはディレクトリを削除します。リード・オンリー構成や_FS_MINIMIZE >= 1ではこの関数はサポートされません。

    +

    オブジェクトを削除します。開かれているオブジェクトやカレント・ディレクトリは削除してはなりません

    +
    +

    対応情報

    +

    _FS_READONLY == 0で、且つ_FS_MINIMIZE == 0のときに使用可能です。

    +
    + +

    戻る

    diff --git a/doc/ja/utime.html b/doc/ja/utime.html index c47c50f..ff5c66f 100644 --- a/doc/ja/utime.html +++ b/doc/ja/utime.html @@ -12,10 +12,10 @@

    f_utime

    -

    ファイルまたはディレクトリのタイムスタンプを変更します。

    +

    オブジェクトのタイムスタンプを変更します。

     FRESULT f_utime (
    -  const XCHAR* FileName,   /* ファイルまたはディレクトリ名へのポインタ */
    +  const XCHAR* FileName,   /* オブジェクト名へのポインタ */
       const FILINFO* TimeDate  /* 設定する日付 */
     );
     
    @@ -46,7 +46,7 @@ FRESULT f_utime (
    FR_INVALID_NAME
    ドライブ番号が不正。
    FR_NOT_READY
    -
    メディアがセットされていないなど、ディスク・ドライブが動作不能状態。
    +
    メディアがセットされていないなど、物理ドライブが動作不能状態。
    FR_WRITE_PROTECTED
    メディアが書き込み禁止状態。
    FR_DISK_ERR
    @@ -56,14 +56,20 @@ FRESULT f_utime (
    FR_NOT_ENABLED
    その論理ドライブにワーク・エリアが与えられていない。
    FR_NO_FILESYSTEM
    -
    ディスク上に有効なFATパーテーションが見つからない。
    +
    ディスク上に有効なFATボリュームが見つからない。

    解説

    -

    ファイルまたはディレクトリのタイムスタンプを変更します。リード・オンリー構成および_FS_MINIMIZE >= 1ではこの関数はサポートされません。

    +

    オブジェクトのタイムスタンプを変更します。

    +
    + + +
    +

    対応情報

    +

    _FS_READONLY == 0で、且つ_FS_MINIMIZE == 0のときに使用可能です。

    diff --git a/doc/ja/write.html b/doc/ja/write.html index 696375d..d98ee51 100644 --- a/doc/ja/write.html +++ b/doc/ja/write.html @@ -33,7 +33,7 @@ FRESULT f_write (
    ByteToWrite
    書き込むバイト数(0〜UINTの最大値)を指定します。
    ByteWritten
    -
    書き込まれたバイト数を格納する変数を指すポインタを指定します。戻り値は常に有効です。
    +
    書き込まれたバイト数を格納する変数を指すポインタを指定します。戻り値は関数の成否にかかわらず常に有効です。
    @@ -50,7 +50,7 @@ FRESULT f_write (
    FR_INT_ERR
    不正なFAT構造または内部エラーによる失敗。
    FR_NOT_READY
    -
    メディアがセットされていないなど、ディスク・ドライブが動作不能状態。
    +
    メディアがセットされていないなど、物理ドライブが動作不能状態。
    FR_INVALID_OBJECT
    無効なファイルオブジェクト。
    @@ -60,7 +60,12 @@ FRESULT f_write (

    解説

    書き込み開始位置は、ファイルR/Wポインタの位置からになります。ファイルR/Wポインタは実際に書き込まれたバイト数だけ進みます。関数が正常終了した後、要求したバイト数が書き込まれたかどうか*ByteWrittenをチェックすべきです。*ByteWritten < ByteToWriteのときは、ディスク・フルを意味します。

    -

    リード・オンリー構成ではこの関数はサポートされません。

    +
    + + +
    +

    対応情報

    +

    _FS_READONLY == 0のときに使用可能です。

    diff --git a/doc/patches.html b/doc/patches.html deleted file mode 100644 index 9f49e0f..0000000 --- a/doc/patches.html +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - -Patches for FatFs R0.07b - - -

    Patches for FatFs R0.07b

    -
    -Jun 21, 2009
    -------------------------------------------------------------------------------
    -Currently no known problem.
    -
    - - diff --git a/doc/updates.txt b/doc/updates.txt index 42e6ae3..df4314b 100644 --- a/doc/updates.txt +++ b/doc/updates.txt @@ -1,17 +1,24 @@ -R0.07b, Jun 21, 2009 +R0.07e, Nov 3, 2009 + Separated out configuration options from ff.h to ffconf.h. + Added a configuration option, _LFN_UNICODE. + Fixed f_unlink() fails to remove a sub-dir on _FS_RPATH. + Fixed name matching error on the 13 char boundary. + Changed f_readdir() to return the SFN with always upper case on non-LFN cfg. + +R0.07c, Jun 21, 2009 Fixed f_unlink() may return FR_OK on error. Fixed wrong cache control in f_lseek(). Added relative path feature. Added f_chdir(). Added f_chdrive(). - Added proper case conversion to extended char. + Added proper case conversion to extended characters. R0.07a, Apr 14, 2009 Separated out OS dependent code on re-entrant configuration. Added multiple sector size support. R0.07, Apr 01, 2009 - Merged Tiny-FatFs as a buffer configuration option. + Merged Tiny-FatFs into FatFs as a buffer configuration option. Added long file name support. Added multiple code page support. Added re-entrancy for multitask operation. diff --git a/src/00readme.txt b/src/00readme.txt index 741b979..689e973 100644 --- a/src/00readme.txt +++ b/src/00readme.txt @@ -1,8 +1,9 @@ -FatFs Module Source Files R0.07c (C)ChaN, 2009 +FatFs Module Source Files R0.07e (C)ChaN, 2009 FILES + ffconf.h Configuration file for FatFs module. ff.h Common include file for FatFs and application module. ff.c FatFs module. diskio.h Common include file for FatFs and disk I/O module. @@ -100,5 +101,10 @@ REVISION HISTORY Added relative path feature. Added f_chdir(). Added f_chdrive(). - Added proper case conversion to extended char. + Added proper case conversion for extended characters. + Nov 03,'2009 R0.07e Separated out configuration options from ff.h to ffconf.h. + Added a configuration option, _LFN_UNICODE. + Fixed f_unlink() fails to remove a sub-dir on _FS_RPATH. + Fixed name matching error on the 13 char boundary. + Changed f_readdir() to return the SFN with always upper case on non-LFN cfg. diff --git a/src/diskio.h b/src/diskio.h index 6fde2dd..49562d5 100644 --- a/src/diskio.h +++ b/src/diskio.h @@ -49,7 +49,7 @@ DRESULT disk_ioctl (BYTE, BYTE, void*); /* Generic command */ #define CTRL_SYNC 0 /* Mandatory for write functions */ #define GET_SECTOR_COUNT 1 /* Mandatory for only f_mkfs() */ -#define GET_SECTOR_SIZE 2 +#define GET_SECTOR_SIZE 2 /* Mandatory for multiple sector size cfg */ #define GET_BLOCK_SIZE 3 /* Mandatory for only f_mkfs() */ #define CTRL_POWER 4 #define CTRL_LOCK 5 diff --git a/src/ff.c b/src/ff.c index 0d2606e..cc25722 100644 --- a/src/ff.c +++ b/src/ff.c @@ -1,9 +1,9 @@ /*----------------------------------------------------------------------------/ -/ FatFs - FAT file system module R0.07c (C)ChaN, 2009 +/ FatFs - FAT file system module R0.07e (C)ChaN, 2009 /-----------------------------------------------------------------------------/ -/ FatFs module is an open source software to implement FAT file system to -/ small embedded systems. This is a free software and is opened for education, -/ research and commercial use under license policy of following trems. +/ 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 +/ developments under license policy of following trems. / / Copyright (C) 2009, ChaN, all right reserved. / @@ -63,11 +63,17 @@ / Renamed string functions to avoid name collision. / Apr 14,'09 R0.07a Separated out OS dependent code on reentrant cfg. / Added multiple sector size support. -/ Jun 21,'09 R0.07c Fixed f_unlink() may return FR_OK on error. +/ Jun 21,'09 R0.07c Fixed f_unlink() can return FR_OK on error. / Fixed wrong cache control in f_lseek(). / Added relative path feature. / Added f_chdir() and f_chdrive(). / Added proper case conversion to extended char. +/ Nov 03,'09 R0.07e Separated out configuration options from ff.h to ffconf.h. +/ Fixed f_unlink() fails to remove a sub-dir on _FS_RPATH. +/ Fixed name matching error on the 13 char boundary. +/ Added a configuration option, _LFN_UNICODE. +/ Changed f_readdir() to return the SFN with always upper +/ case on non-LFN cfg. /---------------------------------------------------------------------------*/ #include "ff.h" /* FatFs configurations and declarations */ @@ -79,6 +85,10 @@ ---------------------------------------------------------------------------*/ +#if _FATFS != 0x007E +#error Wrong include file (ff.h). +#endif + #if _FS_REENTRANT #if _USE_LFN == 1 #error Static LFN work area must not be used in re-entrant configuration. @@ -99,7 +109,8 @@ #endif /* Name status flags */ -#define NS_LOSS 0x01 /* Lossy conversion */ +#define NS 11 /* Offset of name status byte */ +#define NS_LOSS 0x01 /* Out of 8.3 format */ #define NS_LFN 0x02 /* Force to create LFN entry */ #define NS_LAST 0x04 /* Last segment */ #define NS_BODY 0x08 /* Lower case flag (body) */ @@ -115,6 +126,9 @@ ---------------------------------------------------------------------------*/ +#if _DRIVES < 1 || _DRIVES > 9 +#error Number of drives must be 1-9. +#endif static FATFS *FatFs[_DRIVES]; /* Pointer to the file system objects (logical drives) */ @@ -129,7 +143,7 @@ BYTE Drive; /* Current drive */ #if _USE_LFN == 1 /* LFN with static LFN working buffer */ static -WORD LfnBuf[_MAX_LFN + 1]; +WCHAR LfnBuf[_MAX_LFN + 1]; #define NAMEBUF(sp,lp) BYTE sp[12]; WCHAR *lp = LfnBuf #define INITBUF(dj,sp,lp) dj.fn = sp; dj.lfn = lp @@ -148,7 +162,7 @@ WORD LfnBuf[_MAX_LFN + 1]; /*-------------------------------------------------------------------------- - Private Functions + Module Private Functions ---------------------------------------------------------------------------*/ @@ -305,7 +319,7 @@ FRESULT sync ( /* FR_OK: successful, FR_DISK_ERR: failed */ /* FAT access - Read value of a FAT entry */ /*-----------------------------------------------------------------------*/ -static + DWORD get_fat ( /* 0xFFFFFFFF:Disk error, 1:Interal error, Else:Cluster status */ FATFS *fs, /* File system object */ DWORD clst /* Cluster# to get the link information */ @@ -347,7 +361,7 @@ DWORD get_fat ( /* 0xFFFFFFFF:Disk error, 1:Interal error, Else:Cluster status * /* FAT access - Change value of a FAT entry */ /*-----------------------------------------------------------------------*/ #if !_FS_READONLY -static + FRESULT put_fat ( FATFS *fs, /* File system object */ DWORD clst, /* Cluster# to be changed in range of 2 to fs->max_clust - 1 */ @@ -509,7 +523,7 @@ DWORD create_chain ( /* 0:No free cluster, 1:Internal error, 0xFFFFFFFF:Disk err /* Get sector# from cluster# */ /*-----------------------------------------------------------------------*/ -static + DWORD clust2sect ( /* !=0: Sector number, 0: Failed - invalid cluster# */ FATFS *fs, /* File system object */ DWORD clst /* Cluster# to be converted */ @@ -653,18 +667,26 @@ BOOL cmp_lfn ( /* TRUE:Matched, FALSE:Not matched */ ) { int i, s; - WCHAR wc; + WCHAR wc, uc; i = ((dir[LDIR_Ord] & 0xBF) - 1) * 13; /* Get offset in the LFN buffer */ - s = 0; + s = 0; wc = 1; do { - wc = ff_wtoupper(LD_WORD(dir+LfnOfs[s])); /* Get an LFN character */ - if (i >= _MAX_LFN || wc != ff_wtoupper(lfnbuf[i++])) /* Compare it with the reference character */ - return FALSE; - } while (++s < 13 && wc); /* Repeat until all chars in the entry or a NUL char is processed */ + uc = LD_WORD(dir+LfnOfs[s]); /* Pick an LFN character from the entry */ + if (wc) { /* Last char has not been processed */ + wc = ff_wtoupper(uc); /* Convert it to upper case */ + if (i >= _MAX_LFN || wc != ff_wtoupper(lfnbuf[i++])) /* Compare it */ + return FALSE; /* Not matched */ + } else { + if (uc != 0xFFFF) return FALSE; /* Check filler */ + } + } while (++s < 13); /* Repeat until all chars in the entry are checked */ - return TRUE; /* The LFN entry matched */ + if ((dir[LDIR_Ord] & 0x40) && wc && lfnbuf[i]) /* Last segment matched but different length */ + return FALSE; + + return TRUE; /* The part of LFN matched */ } @@ -676,18 +698,21 @@ BOOL pick_lfn ( /* TRUE:Succeeded, FALSE:Buffer overflow */ ) { int i, s; - WCHAR wc; + WCHAR wc, uc; i = ((dir[LDIR_Ord] & 0x3F) - 1) * 13; /* Offset in the LFN buffer */ - s = 0; + s = 0; wc = 1; do { - if (i >= _MAX_LFN) return FALSE; /* Buffer overflow? */ - wc = LD_WORD(dir+LfnOfs[s]); /* Get an LFN char */ - if (!wc) break; /* End of LFN? */ - lfnbuf[i++] = wc; /* Store it */ - } while (++s < 13); /* Repeat until last char is copied */ + uc = LD_WORD(dir+LfnOfs[s]); /* Pick an LFN character from the entry */ + if (wc) { /* Last char has not been processed */ + if (i >= _MAX_LFN) return FALSE; /* Buffer overflow? */ + lfnbuf[i++] = wc = uc; /* Store it */ + } else { + if (uc != 0xFFFF) return FALSE; /* Check filler */ + } + } while (++s < 13); /* Read all character in the entry */ if (dir[LDIR_Ord] & 0x40) { /* Put terminator if it is the last LFN part */ if (i >= _MAX_LFN) return FALSE; /* Buffer overflow? */ @@ -809,14 +834,14 @@ FRESULT dir_find ( FRESULT res; BYTE c, *dir; #if _USE_LFN - BYTE a, lfen, ord, sum; + BYTE a, ord, sum; #endif res = dir_seek(dj, 0); /* Rewind directory object */ if (res != FR_OK) return res; #if _USE_LFN - ord = sum = 0xFF; lfen = *(dj->fn+11) & NS_LOSS; + ord = sum = 0xFF; #endif do { res = move_window(dj->fs, dj->sect); @@ -833,28 +858,23 @@ FRESULT dir_find ( if (dj->lfn) { if (c & 0x40) { /* Is it start of LFN sequence? */ sum = dir[LDIR_Chksum]; - c &= 0xBF; ord = c; /* LFN start order */ + c &= 0xBF; ord = c; /* LFN start order */ dj->lfn_idx = dj->index; } - /* Check LFN validity. Compare LFN if it is out of 8.3 format */ - ord = (c == ord && sum == dir[LDIR_Chksum] && (!lfen || cmp_lfn(dj->lfn, dir))) ? ord - 1 : 0xFF; + /* Check validity of the LFN entry and compare it with given name */ + ord = (c == ord && sum == dir[LDIR_Chksum] && cmp_lfn(dj->lfn, dir)) ? ord - 1 : 0xFF; } } else { /* An SFN entry is found */ - if (ord || sum != sum_sfn(dir)) /* Did not LFN match? */ - dj->lfn_idx = 0xFFFF; - if (lfen) { /* Match LFN if it is out of 8.3 format */ - if (ord == 0) break; - } else { /* Match SFN if LFN is in 8.3 format */ - if (!mem_cmp(dir, dj->fn, 11)) break; - } - ord = 0xFF; + if (!ord && sum == sum_sfn(dir)) break; /* LFN matched? */ + ord = 0xFF; dj->lfn_idx = 0xFFFF; /* Reset LFN sequence */ + if (!(dj->fn[NS] & NS_LOSS) && !mem_cmp(dir, dj->fn, 11)) break; /* SFN matched? */ } } #else /* Non LFN configuration */ if (!(dir[DIR_Attr] & AM_VOL) && !mem_cmp(dir, dj->fn, 11)) /* Is it a valid entry? */ break; #endif - res = dir_next(dj, FALSE); /* Next entry */ + res = dir_next(dj, FALSE); /* Next entry */ } while (res == FR_OK); return res; @@ -899,8 +919,8 @@ FRESULT dir_read ( /* Check LFN validity and capture it */ ord = (c == ord && sum == dir[LDIR_Chksum] && pick_lfn(dj->lfn, dir)) ? ord - 1 : 0xFF; } else { /* An SFN entry is found */ - if (ord || sum != sum_sfn(dir)) /* Is there a valid LFN entry? */ - dj->lfn_idx = 0xFFFF; /* No LFN. */ + if (ord || sum != sum_sfn(dir)) /* Is there a valid LFN? */ + dj->lfn_idx = 0xFFFF; /* It has no LFN. */ break; } } @@ -940,10 +960,10 @@ FRESULT dir_register ( /* FR_OK:Successful, FR_DENIED:No free entry or too many fn = dj->fn; lfn = dj->lfn; mem_cpy(sn, fn, 12); - if (_FS_RPATH && (sn[11] & NS_DOT)) return FR_INVALID_NAME; /* Cannot create dot entry */ + if (_FS_RPATH && (sn[NS] & NS_DOT)) return FR_INVALID_NAME; /* Cannot create dot entry */ - if (sn[11] & NS_LOSS) { /* When LFN is out of 8.3 format, generate a numbered name */ - fn[11] = 0; dj->lfn = NULL; /* Find only SFN */ + if (sn[NS] & NS_LOSS) { /* When LFN is out of 8.3 format, generate a numbered name */ + fn[NS] = 0; dj->lfn = NULL; /* Find only SFN */ for (n = 1; n < 100; n++) { gen_numname(fn, sn, lfn, n); /* Generate a numbered name */ res = dir_find(dj); /* Check if the name collides with existing SFN */ @@ -951,10 +971,10 @@ FRESULT dir_register ( /* FR_OK:Successful, FR_DENIED:No free entry or too many } if (n == 100) return FR_DENIED; /* Abort if too many collisions */ if (res != FR_NO_FILE) return res; /* Abort if the result is other than 'not collided' */ - fn[11] = sn[11]; dj->lfn = lfn; + fn[NS] = sn[NS]; dj->lfn = lfn; } - if (sn[11] & NS_LFN) { /* When LFN is to be created, reserve reserve an SFN + LFN entries. */ + if (sn[NS] & NS_LFN) { /* When LFN is to be created, reserve reserve an SFN + LFN entries. */ for (ne = 0; lfn[ne]; ne++) ; ne = (ne + 25) / 13; } else { /* Otherwise reserve only an SFN entry. */ @@ -1012,7 +1032,7 @@ FRESULT dir_register ( /* FR_OK:Successful, FR_DENIED:No free entry or too many dir = dj->dir; mem_set(dir, 0, 32); /* Clean the entry */ mem_cpy(dir, dj->fn, 11); /* Put SFN */ - dir[DIR_NTres] = *(dj->fn+11) & 0x18; /* Put NT flag */ + dir[DIR_NTres] = *(dj->fn+NS) & (NS_BODY | NS_EXT); /* Put NT flag */ dj->fs->wflag = 1; } } @@ -1073,7 +1093,6 @@ FRESULT dir_remove ( /* FR_OK: Successful, FR_DISK_ERR: A disk error */ /* Pick a segment and create the object name in directory form */ /*-----------------------------------------------------------------------*/ - static FRESULT create_name ( DIR *dj, /* Pointer to the directory object */ @@ -1083,6 +1102,7 @@ FRESULT create_name ( #ifdef _EXCVT static const BYTE cvt[] = _EXCVT; #endif + #if _USE_LFN /* LFN configuration */ BYTE b, cf; WCHAR w, *lfn; @@ -1095,29 +1115,29 @@ FRESULT create_name ( lfn = dj->lfn; for (;;) { w = p[si++]; /* Get a character */ - if (w < L' ' || w == L'/' || w == L'\\') break; /* Break on end of segment */ + if (w < ' ' || w == '/' || w == '\\') break; /* Break on end of segment */ if (di >= _MAX_LFN) /* Reject too long name */ return FR_INVALID_NAME; #if !_LFN_UNICODE w &= 0xFF; if (IsDBCS1(w)) { /* If it is a DBC 1st byte */ - BYTE c = p[si++]; /* Get 2nd byte */ - if (!IsDBCS2(c)) /* Reject invalid code for DBC */ + b = p[si++]; /* Get 2nd byte */ + if (!IsDBCS2(b)) /* Reject invalid code for DBC */ return FR_INVALID_NAME; - w = (w << 8) + c; + w = (w << 8) + b; } w = ff_convert(w, 1); /* Convert OEM to Unicode */ if (!w) return FR_INVALID_NAME; /* Reject invalid code */ #endif - if (w < 0x80 && chk_chr("\"*:<>\?|\x7F", w)) /* Reject unallowable chars for LFN */ + if (w < 0x80 && chk_chr("\"*:<>\?|\x7F", w)) /* Reject illegal chars for LFN */ return FR_INVALID_NAME; lfn[di++] = w; /* Store the Unicode char */ } *path = &p[si]; /* Rerurn pointer to the next segment */ - cf = (w < L' ') ? NS_LAST : 0; /* Set last segment flag if end of path */ + cf = (w < ' ') ? NS_LAST : 0; /* Set last segment flag if end of path */ #if _FS_RPATH - if ((di == 1 && lfn[di - 1] == L'.') || /* Is this a dot entry? */ - (di == 2 && lfn[di - 1] == L'.' && lfn[di - 2] == L'.')) { + if ((di == 1 && lfn[di - 1] == '.') || /* Is this a dot entry? */ + (di == 2 && lfn[di - 1] == '.' && lfn[di - 2] == '.')) { lfn[di] = 0; for (i = 0; i < 11; i++) dj->fn[i] = (i < di) ? '.' : ' '; @@ -1127,7 +1147,7 @@ FRESULT create_name ( #endif while (di) { /* Strip trailing spaces and dots */ w = lfn[di - 1]; - if (w != L' ' && w != L'.') break; + if (w != ' ' && w != '.') break; di--; } if (!di) return FR_INVALID_NAME; /* Reject null string */ @@ -1136,15 +1156,15 @@ FRESULT create_name ( /* Create SFN in directory form */ mem_set(dj->fn, ' ', 11); - for (si = 0; lfn[si] == L' ' || lfn[si] == L'.'; si++) ; /* Strip leading spaces and dots */ + for (si = 0; lfn[si] == ' ' || lfn[si] == '.'; si++) ; /* Strip leading spaces and dots */ if (si) cf |= NS_LOSS | NS_LFN; while (di && lfn[di - 1] != '.') di--; /* Find extension (di<=si: no extension) */ b = i = 0; ni = 8; for (;;) { w = lfn[si++]; /* Get an LFN char */ - if (!w) break; /* Break when enf of the LFN */ - if (w == L' ' || (w == L'.' && si != di)) { /* Remove spaces and dots */ + if (!w) break; /* Break on enf of the LFN */ + if (w == ' ' || (w == '.' && si != di)) { /* Remove spaces and dots */ cf |= NS_LOSS | NS_LFN; continue; } @@ -1152,7 +1172,7 @@ FRESULT create_name ( if (ni == 11) { /* Long extension */ cf |= NS_LOSS | NS_LFN; break; } - if (si != di) cf |= NS_LOSS | NS_LFN; /* File name is longer than 8 bytes */ + if (si != di) cf |= NS_LOSS | NS_LFN; /* Out of 8.3 format */ if (si > di) break; /* No extension */ si = di; i = 8; ni = 11; /* Enter extension section */ b <<= 2; continue; @@ -1161,11 +1181,11 @@ FRESULT create_name ( if (w >= 0x80) { /* Non ASCII char */ #ifdef _EXCVT w = ff_convert(w, 0); /* Unicode -> OEM code */ - if (w) w = cvt[w - 0x80]; /* Convert extend char (SBCS) */ + if (w) w = cvt[w - 0x80]; /* Convert extended char to upper (SBCS) */ #else - w = ff_convert(ff_wtoupper(w), 0); /* Unicode (Caps) -> OEM code */ + w = ff_convert(ff_wtoupper(w), 0); /* Upper converted Unicode -> OEM code */ #endif - cf |= NS_LFN; /* Force create an LFN */ + cf |= NS_LFN; /* Force create LFN entry */ } if (_DF1S && w >= 0x100) { /* Double byte char */ @@ -1174,13 +1194,13 @@ FRESULT create_name ( } dj->fn[i++] = (BYTE)(w >> 8); } else { /* Single byte char */ - if (!w || chk_chr("+,;[=]", w)) { /* Replace unallowable chars for SFN */ + if (!w || chk_chr("+,;[=]", w)) { /* Replace illegal chars for SFN */ w = '_'; cf |= NS_LOSS | NS_LFN; /* Lossy conversion */ } else { - if (IsUpper(w)) { /* Large capital */ + if (IsUpper(w)) { /* ASCII large capital */ b |= 2; } else { - if (IsLower(w)) { /* Small capital */ + if (IsLower(w)) { /* ASCII small capital */ b |= 1; w -= 0x20; } } @@ -1189,7 +1209,7 @@ FRESULT create_name ( dj->fn[i++] = (BYTE)w; } - if (dj->fn[0] == 0xE5) dj->fn[0] = 0x05; /* If the first char collides with 0xE5, replace it with 0x05 */ + if (dj->fn[0] == 0xE5) dj->fn[0] = 0x05; /* If the first char collides with deleted mark, replace it with 0x05 */ if (ni == 8) b <<= 2; if ((b & 0x0C) == 0x0C || (b & 0x03) == 0x03) /* Create LFN entry when there are composite capitals */ @@ -1199,7 +1219,9 @@ FRESULT create_name ( if ((b & 0x0C) == 0x04) cf |= NS_BODY; /* NT flag (Filename has only small capital) */ } - dj->fn[11] = cf; /* SFN is created */ + dj->fn[NS] = cf; /* SFN is created */ + + return FR_OK; #else /* Non-LFN configuration */ @@ -1219,15 +1241,15 @@ FRESULT create_name ( if (c != '.' || si >= 3) break; sfn[i++] = c; } - if (c != '/' && c != '\\' && c >= ' ') return FR_INVALID_NAME; + if (c != '/' && c != '\\' && c > ' ') return FR_INVALID_NAME; *path = &p[si]; /* Rerurn pointer to the next segment */ - sfn[11] = (c < ' ') ? NS_LAST|NS_DOT : NS_DOT; /* Set last segment flag if end of path */ + sfn[NS] = (c <= ' ') ? NS_LAST | NS_DOT : NS_DOT; /* Set last segment flag if end of path */ return FR_OK; } #endif for (;;) { c = p[si++]; - if (c < ' ' || c == '/' || c == '\\') break; /* Break on end of segment */ + if (c <= ' ' || c == '/' || c == '\\') break; /* Break on end of segment */ if (c == '.' || i >= ni) { if (ni != 8 || c != '.') return FR_INVALID_NAME; i = 8; ni = 11; @@ -1243,19 +1265,19 @@ FRESULT create_name ( #endif #endif } - if (IsDBCS1(c)) { /* If it is DBC 1st byte */ + if (IsDBCS1(c)) { /* DBC 1st byte? */ d = p[si++]; /* Get 2nd byte */ if (!IsDBCS2(d) || i >= ni - 1) /* Reject invalid DBC */ return FR_INVALID_NAME; sfn[i++] = c; sfn[i++] = d; - } else { - if (chk_chr(" \"*+,[=]|\x7F", c)) /* Reject unallowable chrs for SFN */ + } else { /* Single byte code */ + if (chk_chr(" \"*+,[=]|\x7F", c)) /* Reject illegal chrs for SFN */ return FR_INVALID_NAME; - if (IsUpper(c)) { + if (IsUpper(c)) { /* ASCII large capital? */ b |= 2; } else { - if (IsLower(c)) { + if (IsLower(c)) { /* ASCII small capital? */ b |= 1; c -= 0x20; } } @@ -1263,7 +1285,7 @@ FRESULT create_name ( } } *path = &p[si]; /* Rerurn pointer to the next segment */ - c = (c < ' ') ? NS_LAST : 0; /* Set last segment flag if end of path */ + c = (c <= ' ') ? NS_LAST : 0; /* Set last segment flag if end of path */ if (!i) return FR_INVALID_NAME; /* Reject null string */ if (sfn[0] == 0xE5) sfn[0] = 0x05; /* When first char collides with 0xE5, replace it with 0x05 */ @@ -1272,10 +1294,10 @@ FRESULT create_name ( if ((b & 0x03) == 0x01) c |= NS_EXT; /* NT flag (Extension has only small capital) */ if ((b & 0x0C) == 0x04) c |= NS_BODY; /* NT flag (Filename has only small capital) */ - sfn[11] = c; /* Store NT flag, File name is created */ -#endif + sfn[NS] = c; /* Store NT flag, File name is created */ return FR_OK; +#endif } @@ -1288,15 +1310,12 @@ FRESULT create_name ( static void get_fileinfo ( /* No return code */ DIR *dj, /* Pointer to the directory object */ - FILINFO *fno /* Pointer to store the file information */ + FILINFO *fno /* Pointer to the file information to be filled */ ) { int i; BYTE c, nt, *dir; char *p; -#if _USE_LFN - XCHAR *tp; -#endif p = fno->fname; @@ -1307,7 +1326,7 @@ void get_fileinfo ( /* No return code */ c = dir[i]; if (c == ' ') break; if (c == 0x05) c = 0xE5; - if ((nt & 0x08) && IsUpper(c)) c += 0x20; + if (_USE_LFN && (nt & NS_BODY) && IsUpper(c)) c += 0x20; *p++ = c; } if (dir[8] != ' ') { /* Copy name extension */ @@ -1315,7 +1334,7 @@ void get_fileinfo ( /* No return code */ for (i = 8; i < 11; i++) { c = dir[i]; if (c == ' ') break; - if ((nt & 0x10) && IsUpper(c)) c += 0x20; + if (_USE_LFN && (nt & NS_EXT) && IsUpper(c)) c += 0x20; *p++ = c; } } @@ -1327,8 +1346,8 @@ void get_fileinfo ( /* No return code */ *p = 0; #if _USE_LFN - tp = fno->lfname; - if (tp) { + if (fno->lfname) { + XCHAR *tp = fno->lfname; WCHAR w, *lfn; i = 0; @@ -1340,8 +1359,8 @@ void get_fileinfo ( /* No return code */ if (!w) { i = 0; break; } /* Could not convert, no LFN */ if (_DF1S && w >= 0x100) /* Put 1st byte if it is a DBC */ tp[i++] = (XCHAR)(w >> 8); - if (i >= fno->lfsize - 1) { i = 0; break; } /* Buffer overrun, no LFN */ #endif + if (i >= fno->lfsize - 1) { i = 0; break; } /* Buffer overrun, no LFN */ tp[i++] = (XCHAR)w; } } @@ -1368,6 +1387,7 @@ FRESULT follow_path ( /* FR_OK(0): successful, !=0: error code */ BYTE *dir, last; + while (!_USE_LFN && *path == ' ') path++; /* Skip leading spaces */ #if _FS_RPATH if (*path == '/' || *path == '\\') { /* There is a heading separator */ path++; dj->sclust = 0; /* Strip it and start from the root dir */ @@ -1389,7 +1409,7 @@ FRESULT follow_path ( /* FR_OK(0): successful, !=0: error code */ res = create_name(dj, &path); /* Get a segment */ if (res != FR_OK) break; res = dir_find(dj); /* Find it */ - last = *(dj->fn+11) & NS_LAST; + last = *(dj->fn+NS) & NS_LAST; if (res != FR_OK) { /* Could not find the object */ if (res == FR_NO_FILE && !last) res = FR_NO_PATH; @@ -1420,17 +1440,14 @@ BYTE check_fs ( /* 0:The FAT boot record, 1:Valid boot record but not an FAT, 2: DWORD sect /* Sector# (lba) to check if it is an FAT boot record or not */ ) { - static const char fatstr[] = "FAT"; - - if (disk_read(fs->drive, fs->win, sect, 1) != RES_OK) /* Load boot record */ return 3; if (LD_WORD(&fs->win[BS_55AA]) != 0xAA55) /* Check record signature (always placed at offset 510 even if the sector size is >512) */ return 2; - if (!mem_cmp(&fs->win[BS_FilSysType], fatstr, 3)) /* Check FAT signature */ + if ((LD_DWORD(&fs->win[BS_FilSysType]) & 0xFFFFFF) == 0x544146) /* Check "FAT" string */ return 0; - if (!mem_cmp(&fs->win[BS_FilSysType32], fatstr, 3) && !(fs->win[BPB_ExtFlags] & 0x80)) + if ((LD_DWORD(&fs->win[BS_FilSysType32]) & 0xFFFFFF) == 0x544146) return 0; return 1; @@ -1443,14 +1460,13 @@ BYTE check_fs ( /* 0:The FAT boot record, 1:Valid boot record but not an FAT, 2: /* Make sure that the file system is valid */ /*-----------------------------------------------------------------------*/ -static -FRESULT auto_mount ( /* FR_OK(0): successful, !=0: any error occured */ + +FRESULT chk_mounted ( /* FR_OK(0): successful, !=0: any error occured */ const XCHAR **path, /* Pointer to pointer to the path name (drive number) */ FATFS **rfs, /* Pointer to pointer to the found file system object */ BYTE chk_wp /* !=0: Check media write protection for write access */ ) { - FRESULT res; BYTE fmt, *tbl; UINT vol; DSTATUS stat; @@ -1458,7 +1474,6 @@ FRESULT auto_mount ( /* FR_OK(0): successful, !=0: any error occured */ const XCHAR *p = *path; FATFS *fs; - /* Get logical drive number from the path name */ vol = p[0] - '0'; /* Is there a drive number? */ if (vol <= 9 && p[1] == ':') { /* Found a drive number, get and strip it */ @@ -1475,7 +1490,7 @@ FRESULT auto_mount ( /* FR_OK(0): successful, !=0: any error occured */ if (vol >= _DRIVES) /* Is the drive number valid? */ return FR_INVALID_DRIVE; *rfs = fs = FatFs[vol]; /* Returen pointer to the corresponding file system object */ - if (!fs) return FR_NOT_ENABLED; /* Is the file system object registered? */ + if (!fs) return FR_NOT_ENABLED; /* Is the file system object available? */ ENTER_FF(fs); /* Lock file system */ @@ -1528,9 +1543,9 @@ FRESULT auto_mount ( /* FR_OK(0): successful, !=0: any error occured */ fs->fatbase = bsect + LD_WORD(fs->win+BPB_RsvdSecCnt); /* FAT start sector (lba) */ fs->csize = fs->win[BPB_SecPerClus]; /* Number of sectors per cluster */ fs->n_rootdir = LD_WORD(fs->win+BPB_RootEntCnt); /* Nmuber of root directory entries */ - tsect = LD_WORD(fs->win+BPB_TotSec16); /* Number of sectors on the file system */ + tsect = LD_WORD(fs->win+BPB_TotSec16); /* Number of sectors on the volume */ if (!tsect) tsect = LD_DWORD(fs->win+BPB_TotSec32); - fs->max_clust = mclst = (tsect /* Last cluster# + 1 */ + fs->max_clust = mclst = (tsect /* Last cluster# + 1 (Number of clusters + 2) */ - LD_WORD(fs->win+BPB_RsvdSecCnt) - fsize - fs->n_rootdir / (SS(fs)/32) ) / fs->csize + 2; @@ -1567,9 +1582,8 @@ FRESULT auto_mount ( /* FR_OK(0): successful, !=0: any error occured */ fs->cdir = 0; /* Current directory (root dir) */ #endif fs->id = ++Fsid; /* File system mount ID */ - res = FR_OK; - return res; + return FR_OK; } @@ -1663,10 +1677,10 @@ FRESULT f_open ( fp->fs = NULL; /* Clear file object */ #if !_FS_READONLY mode &= (FA_READ | FA_WRITE | FA_CREATE_ALWAYS | FA_OPEN_ALWAYS | FA_CREATE_NEW); - res = auto_mount(&path, &dj.fs, (BYTE)(mode & (FA_WRITE | FA_CREATE_ALWAYS | FA_OPEN_ALWAYS | FA_CREATE_NEW))); + res = chk_mounted(&path, &dj.fs, (BYTE)(mode & (FA_WRITE | FA_CREATE_ALWAYS | FA_OPEN_ALWAYS | FA_CREATE_NEW))); #else mode &= FA_READ; - res = auto_mount(&path, &dj.fs, 0); + res = chk_mounted(&path, &dj.fs, 0); #endif if (res != FR_OK) LEAVE_FF(dj.fs, res); INITBUF(dj, sfn, lfn); @@ -1759,7 +1773,7 @@ FRESULT f_read ( BYTE *rbuff = buff; - *br = 0; + *br = 0; /* Initialize bytes read */ res = validate(fp->fs, fp->id); /* Check validity of the object */ if (res != FR_OK) LEAVE_FF(fp->fs, res); @@ -1854,7 +1868,7 @@ FRESULT f_write ( const BYTE *wbuff = buff; - *bw = 0; + *bw = 0; /* Initialize bytes written */ res = validate(fp->fs, fp->id); /* Check validity of the object */ if (res != FR_OK) LEAVE_FF(fp->fs, res); @@ -2055,7 +2069,7 @@ FRESULT f_chdir ( BYTE *dir; - res = auto_mount(&path, &dj.fs, 0); + res = chk_mounted(&path, &dj.fs, 0); if (res == FR_OK) { INITBUF(dj, sfn, lfn); res = follow_path(&dj, path); /* Follow the file path */ @@ -2194,7 +2208,7 @@ FRESULT f_opendir ( BYTE *dir; - res = auto_mount(&path, &dj->fs, 0); + res = chk_mounted(&path, &dj->fs, 0); if (res == FR_OK) { INITBUF((*dj), sfn, lfn); res = follow_path(dj, path); /* Follow the path to the directory */ @@ -2276,7 +2290,7 @@ FRESULT f_stat ( NAMEBUF(sfn, lfn); - res = auto_mount(&path, &dj.fs, 0); + res = chk_mounted(&path, &dj.fs, 0); if (res == FR_OK) { INITBUF(dj, sfn, lfn); res = follow_path(&dj, path); /* Follow the file path */ @@ -2311,7 +2325,7 @@ FRESULT f_getfree ( /* Get drive number */ - res = auto_mount(&path, fatfs, 0); + res = chk_mounted(&path, fatfs, 0); if (res != FR_OK) LEAVE_FF(*fatfs, res); /* If number of free cluster is valid, return it without cluster scan. */ @@ -2347,7 +2361,7 @@ FRESULT f_getfree ( if (LD_WORD(p) == 0) n++; p += 2; i -= 2; } else { - if (LD_DWORD(p) == 0) n++; + if ((LD_DWORD(p) & 0x0FFFFFFF) == 0) n++; p += 4; i -= 4; } } while (--clst); @@ -2421,12 +2435,12 @@ FRESULT f_unlink ( DWORD dclst; - res = auto_mount(&path, &dj.fs, 1); + res = chk_mounted(&path, &dj.fs, 1); if (res != FR_OK) LEAVE_FF(dj.fs, res); INITBUF(dj, sfn, lfn); res = follow_path(&dj, path); /* Follow the file path */ - if (_FS_RPATH && res == FR_OK && (dj.fn[11] & NS_DOT)) + if (_FS_RPATH && res == FR_OK && (dj.fn[NS] & NS_DOT)) res = FR_INVALID_NAME; if (res != FR_OK) LEAVE_FF(dj.fs, res); /* Follow failed */ @@ -2439,9 +2453,9 @@ FRESULT f_unlink ( if (dir[DIR_Attr] & AM_DIR) { /* It is a sub-directory */ if (dclst < 2) LEAVE_FF(dj.fs, FR_INT_ERR); - mem_cpy(&sdj, &dj, sizeof(DIR)); /* Check if the sub-dir is empty or not */ + mem_cpy(&sdj, &dj, sizeof(DIR)); /* Check if the sub-dir is empty or not */ sdj.sclust = dclst; - res = dir_seek(&sdj, 0); + res = dir_seek(&sdj, 2); if (res != FR_OK) LEAVE_FF(dj.fs, res); res = dir_read(&sdj); if (res == FR_OK) res = FR_DENIED; /* Not empty sub-dir */ @@ -2476,13 +2490,13 @@ FRESULT f_mkdir ( DWORD dsect, dclst, pclst, tim; - res = auto_mount(&path, &dj.fs, 1); + res = chk_mounted(&path, &dj.fs, 1); if (res != FR_OK) LEAVE_FF(dj.fs, res); INITBUF(dj, sfn, lfn); res = follow_path(&dj, path); /* Follow the file path */ if (res == FR_OK) res = FR_EXIST; /* Any file or directory is already existing */ - if (_FS_RPATH && res == FR_NO_FILE && (dj.fn[11] & NS_DOT)) + if (_FS_RPATH && res == FR_NO_FILE && (dj.fn[NS] & NS_DOT)) res = FR_INVALID_NAME; if (res != FR_NO_FILE) /* Any error occured */ LEAVE_FF(dj.fs, res); @@ -2556,11 +2570,11 @@ FRESULT f_chmod ( BYTE *dir; - res = auto_mount(&path, &dj.fs, 1); + res = chk_mounted(&path, &dj.fs, 1); if (res == FR_OK) { INITBUF(dj, sfn, lfn); res = follow_path(&dj, path); /* Follow the file path */ - if (_FS_RPATH && res == FR_OK && (dj.fn[11] & NS_DOT)) + if (_FS_RPATH && res == FR_OK && (dj.fn[NS] & NS_DOT)) res = FR_INVALID_NAME; if (res == FR_OK) { dir = dj.dir; @@ -2596,11 +2610,11 @@ FRESULT f_utime ( BYTE *dir; - res = auto_mount(&path, &dj.fs, 1); + res = chk_mounted(&path, &dj.fs, 1); if (res == FR_OK) { INITBUF(dj, sfn, lfn); res = follow_path(&dj, path); /* Follow the file path */ - if (_FS_RPATH && res == FR_OK && (dj.fn[11] & NS_DOT)) + if (_FS_RPATH && res == FR_OK && (dj.fn[NS] & NS_DOT)) res = FR_INVALID_NAME; if (res == FR_OK) { dir = dj.dir; @@ -2638,11 +2652,11 @@ FRESULT f_rename ( INITBUF(dj_old, sfn, lfn); - res = auto_mount(&path_old, &dj_old.fs, 1); + res = chk_mounted(&path_old, &dj_old.fs, 1); if (res == FR_OK) { dj_new.fs = dj_old.fs; res = follow_path(&dj_old, path_old); /* Check old object */ - if (_FS_RPATH && res == FR_OK && (dj_old.fn[11] & NS_DOT)) + if (_FS_RPATH && res == FR_OK && (dj_old.fn[NS] & NS_DOT)) res = FR_INVALID_NAME; } if (res != FR_OK) LEAVE_FF(dj_old.fs, res); /* The old object is not found */ diff --git a/src/ff.h b/src/ff.h index 694233f..ebebfd9 100644 --- a/src/ff.h +++ b/src/ff.h @@ -1,9 +1,9 @@ /*---------------------------------------------------------------------------/ -/ FatFs - FAT file system module include file R0.07c (C)ChaN, 2009 +/ FatFs - FAT file system module include file R0.07e (C)ChaN, 2009 /----------------------------------------------------------------------------/ -/ FatFs module is an open source software to implement FAT file system to -/ small embedded systems. This is a free software and is opened for education, -/ research and commercial developments under license policy of following trems. +/ 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 +/ developments under license policy of following trems. / / Copyright (C) 2009, ChaN, all right reserved. / @@ -13,144 +13,15 @@ / * Redistributions of source code must retain the above copyright notice. /----------------------------------------------------------------------------*/ -#include "integer.h" - -/*---------------------------------------------------------------------------/ -/ FatFs Configuration Options -/ -/ CAUTION! Do not forget to make clean the project after any changes to -/ the configuration options. -/ -/----------------------------------------------------------------------------*/ #ifndef _FATFS -#define _FATFS 0x007C +#define _FATFS 0x007E -#define _WORD_ACCESS 0 -/* The _WORD_ACCESS option defines which access method is used to the word -/ data in the FAT structure. -/ -/ 0: Byte-by-byte access. Always compatible with all platforms. -/ 1: Word access. Do not choose this unless following condition is met. -/ -/ When the byte order on the memory is big-endian or address miss-aligned -/ word access results incorrect behavior, the _WORD_ACCESS must be set to 0. -/ If it is not the case, the value can also be set to 1 to improve the -/ performance and code efficiency. */ - - -#define _FS_READONLY 0 -/* Setting _FS_READONLY to 1 defines read only configuration. This removes -/ writing functions, f_write, f_sync, f_unlink, f_mkdir, f_chmod, f_rename, -/ f_truncate and useless f_getfree. */ - - -#define _FS_MINIMIZE 0 -/* The _FS_MINIMIZE option defines minimization level to remove some functions. -/ -/ 0: Full function. -/ 1: f_stat, f_getfree, f_unlink, f_mkdir, f_chmod, f_truncate and f_rename -/ are removed. -/ 2: f_opendir and f_readdir are removed in addition to level 1. -/ 3: f_lseek is removed in addition to level 2. */ - - -#define _FS_TINY 0 -/* When _FS_TINY is set to 1, FatFs uses the sector buffer in the file system -/ object instead of the sector buffer in the individual file object for file -/ data transfer. This reduces memory consumption 512 bytes each file object. */ - - -#define _USE_STRFUNC 0 -/* To enable string functions, set _USE_STRFUNC to 1 or 2. */ - - -#define _USE_MKFS 0 -/* To enable f_mkfs function, set _USE_MKFS to 1 and set _FS_READONLY to 0 */ - - -#define _USE_FORWARD 0 -/* To enable f_forward function, set _USE_FORWARD to 1 and set _FS_TINY to 1. */ - - -#define _CODE_PAGE 932 -/* The _CODE_PAGE specifies the OEM code page to be used on the target system. -/ -/ 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) -/ 1250 - Central Europe (Windows) -/ 1251 - Cyrillic (Windows) -/ 1252 - Latin 1 (Windows) -/ 1253 - Greek (Windows) -/ 1254 - Turkish (Windows) -/ 1255 - Hebrew (Windows) -/ 1256 - Arabic (Windows) -/ 1257 - Baltic (Windows) -/ 1258 - Vietnam (OEM, Windows) -/ 437 - U.S. (OEM) -/ 720 - Arabic (OEM) -/ 737 - Greek (OEM) -/ 775 - Baltic (OEM) -/ 850 - Multilingual Latin 1 (OEM) -/ 858 - Multilingual Latin 1 + Euro (OEM) -/ 852 - Latin 2 (OEM) -/ 855 - Cyrillic (OEM) -/ 866 - Russian (OEM) -/ 857 - Turkish (OEM) -/ 862 - Hebrew (OEM) -/ 874 - Thai (OEM, Windows) -/ 1 - ASCII (Valid for only non LFN cfg.) -*/ - - -#define _USE_LFN 0 -#define _MAX_LFN 255 /* Maximum LFN length to handle (max:255) */ -/* The _USE_LFN option switches the LFN support. -/ -/ 0: Disable LFN. -/ 1: Enable LFN with static working buffer on the bss. NOT REENTRANT. -/ 2: Enable LFN with dynamic working buffer on the caller's STACK. -/ -/ The working buffer occupies (_MAX_LFN + 1) * 2 bytes. When enable LFN, -/ a Unicode handling functions ff_convert() and ff_wtoupper() must be added -/ to the project. */ - - -#define _FS_RPATH 0 -/* When _FS_RPATH is set to 1, relative path feature is enabled and f_chdir, -/ f_chdrive function are available. -/ Note that output of the f_readdir fnction is affected by this option. */ - - -#define _FS_REENTRANT 0 -#define _TIMEOUT 1000 /* Timeout period in unit of time ticks of the OS */ -#define _SYNC_t HANDLE /* Type of sync object used on the OS. e.g. HANDLE, OS_EVENT*, ID and etc.. */ -/* To make the FatFs module re-entrant, set _FS_REENTRANT to 1 and add user -/ provided synchronization handlers, ff_req_grant, ff_rel_grant, ff_del_syncobj -/ and ff_cre_syncobj function to the project. */ - - -#define _DRIVES 1 -/* Number of volumes (logical drives) to be used. */ - - -#define _MAX_SS 512 -/* Maximum sector size to be handled. (512/1024/2048/4096) */ -/* Usually set 512 for memory card and hard disk but 1024 for floppy disk, 2048 for MO disk */ -/* When _MAX_SS > 512, GET_SECTOR_SIZE must be implememted to disk_ioctl() */ - - -#define _MULTI_PARTITION 0 -/* When _MULTI_PARTITION is set to 0, each volume is bound to the same physical -/ drive number and can mount only first primaly partition. When it is set to 1, -/ each volume is tied to the partitions listed in Drives[]. */ - - - -/* End of configuration options. Do not change followings without care. */ -/*--------------------------------------------------------------------------*/ +#include "integer.h" /* Basic integer types */ +#include "ffconf.h" /* FatFs configuration options */ +#if _FATFS != _FFCONFIG +#error Wrong configuration file (ffconf.h). +#endif /* DBCS code ranges and SBCS extend char conversion table */ @@ -352,23 +223,22 @@ #define IsUpper(c) (((c)>='A')&&((c)<='Z')) #define IsLower(c) (((c)>='a')&&((c)<='z')) -#define IsDigit(c) (((c)>='0')&&((c)<='9')) -#if _DF1S /* DBCS configuration */ +#if _DF1S /* DBCS configuration */ -#if _DF2S /* Two 1st byte areas */ +#ifdef _DF2S /* Two 1st byte areas */ #define IsDBCS1(c) (((BYTE)(c) >= _DF1S && (BYTE)(c) <= _DF1E) || ((BYTE)(c) >= _DF2S && (BYTE)(c) <= _DF2E)) -#else /* One 1st byte area */ +#else /* One 1st byte area */ #define IsDBCS1(c) ((BYTE)(c) >= _DF1S && (BYTE)(c) <= _DF1E) #endif -#if _DS3S /* Three 2nd byte areas */ +#ifdef _DS3S /* Three 2nd byte areas */ #define IsDBCS2(c) (((BYTE)(c) >= _DS1S && (BYTE)(c) <= _DS1E) || ((BYTE)(c) >= _DS2S && (BYTE)(c) <= _DS2E) || ((BYTE)(c) >= _DS3S && (BYTE)(c) <= _DS3E)) -#else /* Two 2nd byte areas */ +#else /* Two 2nd byte areas */ #define IsDBCS2(c) (((BYTE)(c) >= _DS1S && (BYTE)(c) <= _DS1E) || ((BYTE)(c) >= _DS2S && (BYTE)(c) <= _DS2E)) #endif -#else /* SBCS configuration */ +#else /* SBCS configuration */ #define IsDBCS1(c) 0 #define IsDBCS2(c) 0 @@ -402,10 +272,10 @@ const PARTITION Drives[]; /* Logical drive# to physical location conversion ta /* Definitions corresponds to multiple sector size */ -#if _MAX_SS == 512 +#if _MAX_SS == 512 /* Single sector size */ #define SS(fs) 512U -#elif _MAX_SS == 1024 || _MAX_SS == 2048 || _MAX_SS == 4096 +#elif _MAX_SS == 1024 || _MAX_SS == 2048 || _MAX_SS == 4096 /* Multiple sector size */ #define SS(fs) ((fs)->s_size) #else @@ -433,6 +303,7 @@ typedef struct _FATFS_ { BYTE csize; /* Number of sectors per cluster */ BYTE n_fats; /* Number of FAT copies */ BYTE wflag; /* win[] dirty flag (1:must be written back) */ + BYTE fsi_flag; /* fsinfo dirty flag (1:must be written back) */ WORD id; /* File system mount ID */ WORD n_rootdir; /* Number of root directory entries (0 on FAT32) */ #if _FS_REENTRANT @@ -442,7 +313,6 @@ typedef struct _FATFS_ { WORD s_size; /* Sector size */ #endif #if !_FS_READONLY - BYTE fsi_flag; /* fsinfo dirty flag (1:must be written back) */ DWORD last_clust; /* Last allocated cluster */ DWORD free_clust; /* Number of free clusters */ DWORD fsi_sector; /* fsinfo sector */ @@ -553,11 +423,11 @@ FRESULT f_lseek (FIL*, DWORD); /* Move file pointer of a file object */ FRESULT f_close (FIL*); /* Close an open file object */ FRESULT f_opendir (DIR*, const XCHAR*); /* Open an existing directory */ FRESULT f_readdir (DIR*, FILINFO*); /* Read a directory item */ -FRESULT f_stat (const XCHAR*, FILINFO*); /* Get file status */ +FRESULT f_stat (const XCHAR*, FILINFO*); /* Get file status */ FRESULT f_getfree (const XCHAR*, DWORD*, FATFS**); /* Get number of free clusters on the drive */ FRESULT f_truncate (FIL*); /* Truncate file */ FRESULT f_sync (FIL*); /* Flush cached data of a writing file */ -FRESULT f_unlink (const XCHAR*); /* Delete an existing file or directory */ +FRESULT f_unlink (const XCHAR*); /* Delete an existing file or directory */ FRESULT f_mkdir (const XCHAR*); /* Create a new directory */ FRESULT f_chmod (const XCHAR*, BYTE, BYTE); /* Change attriburte of the file/dir */ FRESULT f_utime (const XCHAR*, const FILINFO*); /* Change timestamp of the file/dir */ diff --git a/src/option/syncobj.c b/src/option/syncobj.c index d507592..b4f4930 100644 --- a/src/option/syncobj.c +++ b/src/option/syncobj.c @@ -1,10 +1,12 @@ /*------------------------------------------------------------------------*/ /* Sample code of OS dependent synchronization object controls */ -/* for FatFs R0.07a (C)ChaN, 2009 */ +/* for FatFs R0.07c (C)ChaN, 2009 */ /*------------------------------------------------------------------------*/ -#include // Win32 -//#include // uC/OS-II +#include /* Win32 */ +//#include /* uC/OS-II */ +//#include /* FreeRTOS */ + #include "../ff.h" @@ -25,14 +27,17 @@ BOOL ff_cre_syncobj ( /* TRUE:Function succeeded, FALSE:Could not create due to { BOOL ret; - *sobj = CreateMutex(NULL, FALSE, NULL); // Win32 - ret = (*sobj != INVALID_HANDLE_VALUE) ? TRUE : FALSE; // + *sobj = CreateMutex(NULL, FALSE, NULL); /* Win32 */ + ret = (*sobj != INVALID_HANDLE_VALUE) ? TRUE : FALSE; -// *sobj = VolumeSemId[vol]; // uITRON (give a static created sync object) -// ret = TRUE; // The initial value of the semaphore must be 1. +// *sobj = VolumeSemId[vol]; /* uITRON (give a static created sync object) */ +// ret = TRUE; /* The initial value of the semaphore must be 1. */ -// *sobj = OSMutexCreate(0, &err); // uC/OS-II -// ret = (err == OS_NO_ERR) ? TRUE : FALSE; // +// *sobj = OSMutexCreate(0, &err); /* uC/OS-II */ +// ret = (err == OS_NO_ERR) ? TRUE : FALSE; + +// *sobj = xSemaphoreCreateMutex(); /* FreeRTOS */ +// ret = (*sobj != NULL) ? TRUE : FALSE; return ret; } @@ -53,12 +58,14 @@ BOOL ff_del_syncobj ( /* TRUE:Function succeeded, FALSE:Could not delete due to { BOOL ret; - ret = CloseHandle(sobj); // Win32 + ret = CloseHandle(sobj); /* Win32 * -// ret = TRUE; // uITRON (nothing to do) +// ret = TRUE; /* uITRON (nothing to do) * -// OSMutexDel(sobj, OS_DEL_ALWAYS, &err); // uC/OS-II -// ret = (err == OS_NO_ERR) ? TRUE : FALSE; // +// OSMutexDel(sobj, OS_DEL_ALWAYS, &err); /* uC/OS-II */ +// ret = (err == OS_NO_ERR) ? TRUE : FALSE; + +// ret = TRUE; /* FreeRTOS (nothing to do) */ return ret; } @@ -78,12 +85,14 @@ BOOL ff_req_grant ( /* TRUE:Got a grant to access the volume, FALSE:Could not ge { BOOL ret; - ret = (WaitForSingleObject(sobj, _TIMEOUT) == WAIT_OBJECT_0) ? TRUE : FALSE; // Win32 + ret = (WaitForSingleObject(sobj, _TIMEOUT) == WAIT_OBJECT_0) ? TRUE : FALSE; /* Win32 */ -// ret = (wai_sem(sobj) == E_OK) ? TRUE : FALSE; // uITRON +// ret = (wai_sem(sobj) == E_OK) ? TRUE : FALSE; /* uITRON */ -// OSMutexPend(sobj, _TIMEOUT, &err)); // uC/OS-II -// ret = (err == OS_NO_ERR) ? TRUE : FALSE; // +// OSMutexPend(sobj, _TIMEOUT, &err)); /* uC/OS-II */ +// ret = (err == OS_NO_ERR) ? TRUE : FALSE; + +// ret = (xSemaphoreTake(sobj, _TIMEOUT) == pdTRUE) ? TRUE : FALSE; /* FreeRTOS */ return ret; } @@ -100,11 +109,14 @@ void ff_rel_grant ( _SYNC_t sobj /* Sync object to be signaled */ ) { - ReleaseMutex(sobj); // Win32 + ReleaseMutex(sobj); /* Win32 */ -// sig_sem(sobj); // uITRON +// sig_sem(sobj); /* uITRON */ + +// OSMutexPost(sobj); /* uC/OS-II */ + +// xSemaphoreGive(sobj); /* FreeRTOS */ -// OSMutexPost(sobj); // uC/OS-II }
    繝代せ蜷_FS_RPATH == 0_FS_RPATH == 1
    file.txt繝峨Λ繧、繝0縺ョ繝ォ繝シ繝医サ繝繧」繝ャ繧ッ繝医Μ荳九ョ繝輔ぃ繧、繝ォ繧ォ繝ャ繝ウ繝医サ繝峨Λ繧、繝悶ョ繧ォ繝ャ繝ウ繝医サ繝繧」繝ャ繧ッ繝医Μ荳九ョ繝輔ぃ繧、繝ォ