diff --git a/doc/00index_e.html b/doc/00index_e.html index 90f8db9..1bdedbf 100644 --- a/doc/00index_e.html +++ b/doc/00index_e.html @@ -3,14 +3,16 @@ - + + + -ELM - FatFs Generic FAT File System Module +FatFs - Generic FAT File System Module -

FatFs Generic FAT File System Module

+

FatFs - Generic FAT File System Module


@@ -60,6 +62,8 @@
  • f_chdir - Change current directory
  • f_chdrive - Change current drive
  • f_getcwd - Retrieve the current directory
  • +
  • f_getlabel - Get volume label
  • +
  • f_setlabel - Set volume label
  • f_forward - Forward file data to the stream directly
  • f_mkfs - Create a file system on the drive
  • f_fdisk - Divide a physical drive
  • @@ -77,7 +81,7 @@

    Disk I/O Interface

    -

    Since the FatFs module is completely separated from disk I/O layer, it requires following functions at least to access the physical media. When O/S related feature is enabled, it will require process/memory functions in addition. However the low level disk I/O module is not a part of FatFs module so that it must be provided by user. The sample drivers are also available in the resources.

    +

    Since the FatFs module is completely separated from disk I/O layer, it requires following functions at least to access the physical media. When O/S related feature is enabled, it will require process/memory functions in addition. However the low level disk I/O module is not a part of FatFs module, so that it must be provided by user. The sample drivers are also available in the resources.

    + diff --git a/doc/00index_j.html b/doc/00index_j.html index 1b7a5bf..8acebcc 100644 --- a/doc/00index_j.html +++ b/doc/00index_j.html @@ -3,7 +3,9 @@ - + + + ELM - FatFs 汎用FATファイルシステム・モジュール @@ -37,7 +39,7 @@

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

    -

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

    +

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

    Long File Name

    -

    The FatFs module has started to support long file name (LFN) at revision 0.07. The two different file names, SFN and LFN, of a file is transparent in the file functions except for f_readdir function. To enable LFN feature, set _USE_LFN to 1, 2 or 3, and add a Unicode code conversion function ff_convert() and ff_wtoupper() to the project. The LFN feature requiers a certain working buffer in addition. The buffer size can be configured by _MAX_LFN corresponding to the available memory size. The size of long file name will reach up to 255 characters so that the _MAX_LFN should be set to 255 for full featured LFN operation. If the size of working buffer is insufficient for the given file name, the file function fails with FR_INVALID_NAME. When enable the LFN feature with re-entrant feature, _USE_LFN must be set to 2 or 3. In this case, the file function allocates the working buffer on the stack or heap. The working buffer occupies (_MAX_LFN + 1) * 2 bytes.

    +

    The FatFs module has started to support long file name (LFN) at revision 0.07. The two different file names, SFN and LFN, of a file is transparent in the file functions except for f_readdir function. To enable LFN feature, set _USE_LFN to 1, 2 or 3, and add a Unicode code conversion function ff_convert() and ff_wtoupper() to the project. The LFN feature requiers a certain working buffer in addition. The buffer size can be configured by _MAX_LFN corresponding to the available memory size. The size of long file name will reach up to 255 characters, so that the _MAX_LFN should be set to 255 for full featured LFN operation. If the size of working buffer is insufficient for the given file name, the file function fails with FR_INVALID_NAME. When enable the LFN feature with re-entrant feature, _USE_LFN must be set to 2 or 3. In this case, the file function allocates the working buffer on the stack or heap. The working buffer occupies (_MAX_LFN + 1) * 2 bytes.

    @@ -152,32 +158,32 @@ _FS_LOCK 0 (Disable shareing control)
    LFN cfg on ARM7
    Code pageProgram size
    949(Korean)+139K
    950(Big5)+111K
    -

    When the LFN feature is enabled, the module size will be increased depends on the selected code page. Right table shows how many bytes increased when LFN feature is enabled with some code pages. We are the East-Asians 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 feature with DBCS will not able to be implemented to most 8-bit microcontrollers. 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. This is not the case on FAT32 but most FAT32 drivers include the LFN feature. FatFs can swich the LFN feature by configuration option. When enable LFN feature on the commercial products, a license from Microsoft may be required depends on the final destination.

    +

    When the LFN feature is enabled, the module size will be increased depends on the selected code page. Right table shows how many bytes increased when LFN feature is enabled with some code pages. Especially, in the CJK region, tens of thousands of characters are being used. Unfortunately, it requires a huge OEM-Unicode bidirectional conversion table and the module size will be drastically increased that shown in the table. As the result, the FatFs with LFN feature with those code pages will not able to be implemented to most 8-bit microcontrollers.

    +

    Note that the LFN feature on the FAT file system is a patent of Microsoft Corporation. This is not the case on FAT32 but most FAT32 drivers come with the LFN feature. FatFs can swich the LFN feature off by configuration option. When enable LFN feature on the commercial products, a license from Microsoft may be required depends on the final destination.

    Unicode API

    -

    FatFs supports ANSI/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.

    +

    In default, FatFs supports ANSI/OEM code set on the API but FatFs can also switch the code set to Unicode. This means the FatFs supports the True LFN feature. For more information, refer to the description in the file name.

    Re-entrancy

    -

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

    +

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

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

    -

    There is an exception on f_mount and f_mkfs function. These functions are not re-entrant to the same volume. When use these functions, all other task must close the corresponding file on the volume and avoid to access the volume.

    +

    There is an exception on f_mount() and f_mkfs() function. These functions are not re-entrant to the same volume. When use these functions, all other task must close the corresponding file on the volume and avoid to access the volume.

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

    Duplicated File Access

    FatFs module does not support the shareing controls of duplicated file access in default. It is permitted when open method to a file is only read mode. The duplicated open in write mode to a file is always prohibited and open file must not be renamed, deleted, or the FAT structure on the volume can be collapted.

    -

    The file shareing control can also be available when _FS_LOCK is set to 1 or grater. The value specifies the number of files to manage simultaneously. In this case, if any open, rename or remove that violating the file shareing rule that described above is attempted, the file function will fail with FR_LOCKED. If number of open files gets larger than _FS_LOCK, the f_open function will fail with FR_TOO_MANY_OPEN_FILES.

    +

    The file shareing control can also be available when _FS_LOCK is set to 1 or grater. The value specifies the number of files to manage simultaneously. In this case, if any open, rename or remove that violating the file shareing rule that described above is attempted, the file function will fail with FR_LOCKED. If number of open files gets larger than _FS_LOCK, the f_open() function will fail with FR_TOO_MANY_OPEN_FILES.

    Performance Effective File Access

    -

    For good performance on reading/writing files on the small embedded system, application programmer should consider what process is done in the FatFs module. The file data on the disk is transferred in following sequence by f_read function.

    +

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

    Figure 1. Sector miss-aligned read (short)

    @@ -187,8 +193,8 @@ _FS_LOCK 0 (Disable shareing control)

    Figure 3. Sector aligned read

    -

    The file I/O buffer means a sector buffer to read/write a partial data on the sector. The sector buffer is either file private sector buffer on each file object or shared sector buffer on the file system object. The buffer configuration option _FS_TINY determins which sector buffer is used for the file data transfer. When tiny buffer (1) is selected, data memory consumption is reduced 512 bytes each file object. In this case, FatFs module uses only a sector buffer on the file system object for file data transfer and FAT/directory access. The disadvantage of the tiny buffer configuration is: the FAT data cached in the sector buffer will be lost by file data transfer and it must be reloaded at every cluster boundary. However it will be suitable for most application from view point of the decent performance and low memory comsumption.

    -

    Figure 1 shows that partial sector data is transferred via the file I/O buffer. On long data transfer shown in Figure 2, middle of transfer data that covers one or more sector is transferred to application buffer directly. Figure 3 shows that the case of entier transfer data is aligned to the sector boundary. In this case, file I/O buffer is not used. On the direct transfer, the maximum extent of sectors are read with disk_read function at a time but the multi sector transfer never across the cluster boundary even if it is contiguous.

    +

    The file I/O buffer is a sector buffer to read/write a partial data on the sector. The sector buffer is either file private sector buffer on each file object or shared sector buffer on the file system object. The buffer configuration option _FS_TINY determins which sector buffer is used for the file data transfer. When tiny buffer (1) is selected, data memory consumption is reduced 512 bytes each file object. In this case, FatFs module uses only a sector buffer on the file system object for file data transfer and FAT/directory access. The disadvantage of the tiny buffer configuration is: the FAT data cached in the sector buffer will be lost by file data transfer and it must be reloaded at every cluster boundary. However it will be suitable for most application from view point of the decent performance and low memory comsumption.

    +

    Figure 1 shows that a partial sector is transferred via the file I/O buffer. On long data transfer shown in Figure 2, middle of transfer data that covers one or more sector is transferred to application buffer directly. Figure 3 shows that the case of entier transfer data is aligned to the sector boundary. In this case, file I/O buffer is not used. On the direct transfer, the maximum extent of sectors are read with disk_read() function at a time but the multiple sector transfer never across the cluster boundary even if it is contiguous.

    Therefore taking effort to sector aligned read/write accesss avoids buffered data transfer and the read/write performance will be improved. Besides the effect, cached FAT data will not be flushed by file data transfer on the tiny configuration so that it can achieve same performance as non-tiny configuration with small memory footprint.

    @@ -202,12 +208,12 @@ Figure 6. Comparison between Multiple/Single Sector Write

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

    Forcing Memory Erase

    -

    When remove a file with f_remove function, the data clusters occupied by the file are marked 'free' on the FAT. But the data sectors containing the file data are not that applied any process, so that the file data left occupies a part of the flash memory array as live blocks. If the file data is forced erased on removing the file, the number of free blocks on the flash memory will be increased. This may skip internal block erase operation to the data block on next write. As the result the write performance might be improved. To enable this feature, set _USE_ERASE to 1. Note that this is a feature with expectation of internal process of the flash memory media. It may not always effective and f_remove function will take a time on removing a large file.

    +

    When remove a file with f_remove() function, the data clusters occupied by the file are marked 'free' on the FAT. But the data sectors containing the file data are not that applied any process, so that the file data left occupies a part of the flash memory array as 'live block'. If the file data is forced erased on removing the file, the number of free blocks on the flash memory will be increased. This may skip internal block erase operation to the data block on next write. As the result the write performance might be improved. To enable this feature, set _USE_ERASE to 1. Note that this is a feature with expectation of internal process of the flash memory media. It may not always effective and f_remove() function will take a time to remove a large file. Most applications will not need this feature.

    Critical Section

    -

    If a 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.

    +

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

    Figure 4. Long critical section
    fig.4 @@ -217,28 +223,38 @@ Figure 5. Minimized critical section
    fig.5

    -

    An interruption in the red section can cause a cross link; as a result, the object being changed may be lost. There is one or more possibility listed below when an interruption in the yellow section is occured.

    +

    An interruption in the red section can cause a cross link; as a result, the object being changed can be lost. If an interruption in the yellow section is occured, there is one or more possibility listed below.

    -

    Each case does not affect the files that not in write mode open. To minimize risk of data loss, the critical section can be minimized like shown in Figure 5 by minimizing the time that file is opened in write mode or using f_sync function properly.

    +

    Each case does not affect the files that not opened in write mode. To minimize risk of data loss, the critical section can be minimized like shown in Figure 5 by minimizing the time that file is opened in write mode or using f_sync() function properly.

    +
    + +
    +

    Extended Use of APIs

    +

    These are examples of extended use of FatFs APIs. New item will be added whenever a useful code is found.

    +
      +
    1. Open or create a file for append
    2. +
    3. Empty a directory
    4. +
    5. Allocate contiguous area to the file
    6. +

    About FatFs License

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

    /*----------------------------------------------------------------------------/
    -/  FatFs - FAT file system module  R0.09                     (C)ChaN, 2011
    +/  FatFs - FAT file system module  R0.09b                    (C)ChaN, 2013
     /-----------------------------------------------------------------------------/
     / 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) 2011, ChaN, all right reserved.
    +/  Copyright (C) 2013, 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
    @@ -246,7 +262,7 @@ Figure 5. Minimized critical section
    / * Redistributions of source code must retain the above copyright notice. / /-----------------------------------------------------------------------------/
    -

    Therefore FatFs license is one of the BSD-style 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-style license.

    +

    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, is 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-style license.

    Return

    diff --git a/doc/en/chdir.html b/doc/en/chdir.html index f94199e..6431770 100644 --- a/doc/en/chdir.html +++ b/doc/en/chdir.html @@ -16,7 +16,7 @@

    The f_chdir function changes the current directory of a drive.

     FRESULT f_chdir (
    -  const TCHAR* Path /* Pointer to the path name */
    +  const TCHAR* path /* [IN] Path name */
     );
     
    @@ -24,7 +24,7 @@ FRESULT f_chdir (

    Parameters

    -
    Path
    +
    path
    Pointer to the null-terminated string that specifies a directory to go.
    @@ -50,7 +50,7 @@ FRESULT f_chdir (

    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.

    +

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

    diff --git a/doc/en/chdrive.html b/doc/en/chdrive.html index c5d81b2..b226647 100644 --- a/doc/en/chdrive.html +++ b/doc/en/chdrive.html @@ -16,7 +16,7 @@

    The f_chdrive function changes the current drive.

     FRESULT f_chdrive (
    -  BYTE Drive /* Logical drive number */
    +  BYTE vol /* [IN] Logical drive number */
     );
     
    @@ -24,7 +24,7 @@ FRESULT f_chdrive (

    Parameters

    -
    Drive
    +
    vol
    Specifies the logical drive number to be set as the current drive.
    @@ -41,7 +41,7 @@ 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.

    +

    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.

    diff --git a/doc/en/chmod.html b/doc/en/chmod.html index 8c05044..ebb8d72 100644 --- a/doc/en/chmod.html +++ b/doc/en/chmod.html @@ -16,9 +16,9 @@

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

     FRESULT f_chmod (
    -  const TCHAR* FileName, /* Pointer to the file or directory */
    -  BYTE Attribute,        /* Attribute flags */
    -  BYTE AttributeMask     /* Attribute masks */
    +  const TCHAR* path, /* [IN] Object name */
    +  BYTE attr,         /* [IN] Attribute flags */
    +  BYTE mask          /* [IN] Attribute masks */
     );
     
    @@ -26,9 +26,9 @@ FRESULT f_chmod (

    Parameters

    -
    FileName
    +
    path
    Pointer to the null-terminated string that specifies a file or directory to be changed
    -
    Attribute
    +
    attr
    Attribute flags to be set in one or more combination of the following flags. The specified flags are set and others are cleard.
    @@ -38,7 +38,7 @@ FRESULT f_chmod (
    AttributeDescription
    AM_HIDHidden
    -
    AttributeMask
    +
    mask
    Attribute mask that specifies which attribute is changed. The specified aattributes are set or cleard.
    @@ -66,7 +66,7 @@ FRESULT f_chmod (

    Description

    -

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

    +

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

    diff --git a/doc/en/close.html b/doc/en/close.html index 49c62b5..0d687ee 100644 --- a/doc/en/close.html +++ b/doc/en/close.html @@ -16,7 +16,7 @@

    The f_close function closes an open file.

     FRESULT f_close (
    -  FIL* FileObject     /* Pointer to the file object structure */
    +  FIL* fp     /* [IN] Pointer to the file object */
     );
     
    @@ -24,7 +24,7 @@ FRESULT f_close (

    Parameter

    -
    FileObject
    +
    fp
    Pointer to the open file object structure to be closed.
    @@ -45,7 +45,7 @@ FRESULT f_close (

    Description

    -

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

    +

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

    diff --git a/doc/en/dinit.html b/doc/en/dinit.html index c02adc3..c06f5aa 100644 --- a/doc/en/dinit.html +++ b/doc/en/dinit.html @@ -16,7 +16,7 @@

    The disk_initialize function initializes the disk drive.

     DSTATUS disk_initialize (
    -  BYTE Drive           /* Physical drive number */
    +  BYTE pdrv           /* [IN] Physical drive number */
     );
     
    @@ -24,7 +24,7 @@ DSTATUS disk_initialize (

    Parameter

    -
    Drive
    +
    pdrv
    Specifies the physical drive number to initialize.
    @@ -37,8 +37,8 @@ DSTATUS disk_initialize (

    Description

    -

    The disk_initialize function initializes a physical drive and put it ready to read/write. When the function succeeded, STA_NOINIT flag in the return value is cleard.

    -

    Application program MUST NOT call this function, or FAT structure on the volume can be corrapted. To re-initialize the file system, use f_mount function instead.This function is called on volume mount process in the FatFs module to manage the media change.

    +

    This function initializes a physical drive and put it ready to generic read/write data. When the function succeeded, STA_NOINIT flag in the return value is cleared.

    +

    Application program MUST NOT call this function while FatFs is in use, or FAT structure on the volume can be corrapted. To re-initialize the file system, use f_mount() function instead. This function is called on volume mount process by FatFs module to manage the media change.

    Return

    diff --git a/doc/en/dioctl.html b/doc/en/dioctl.html index 4365166..0debdba 100644 --- a/doc/en/dioctl.html +++ b/doc/en/dioctl.html @@ -13,12 +13,12 @@

    disk_ioctl

    -

    The disk_ioctl function cntrols device specified features and miscellaneous functions other than disk read/write.

    +

    The disk_ioctl function cntrols device specific features and miscellaneous functions other than generic read/write.

     DRESULT disk_ioctl (
    -  BYTE Drive,      /* Drive number */
    -  BYTE Command,    /* Control command code */
    -  void* Buffer     /* Parameter and data buffer */
    +  BYTE pdrv,     /* [IN] Drive number */
    +  BYTE cmd,      /* [IN] Control command code */
    +  void* buff     /* [I/O] Parameter and data buffer */
     );
     
    @@ -26,12 +26,12 @@ DRESULT disk_ioctl (

    Parameters

    -
    Drive
    +
    pdrv
    Specifies the drive number (0-9).
    -
    Command
    +
    cmd
    Specifies the command code.
    -
    Buffer
    -
    Pointer to the parameter buffer depends on the command code. When it is not used, specify a NULL pointer.
    +
    buff
    +
    Pointer to the parameter buffer depends on the command code. Set NULL if not used.
    @@ -44,7 +44,7 @@ DRESULT disk_ioctl (
    RES_ERROR
    Any error occured.
    RES_PARERR
    -
    Invalid command code.
    +
    Invalid command code or parameter.
    RES_NOTRDY
    The disk drive has not been initialized.
    @@ -57,10 +57,10 @@ DRESULT disk_ioctl ( - - - - + + + +
    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 command is not used in read-only configuration.
    GET_SECTOR_SIZEReturns sector size of the drive into the WORD variable pointed by Buffer. This command is not used in fixed sector size configuration, _MAX_SS is 512.
    GET_SECTOR_COUNTReturns number of available sectors on the drive into the DWORD variable pointed by Buffer. This command is used by only f_mkfs function to determine the volume size to be created.
    GET_BLOCK_SIZEReturns erase block size of the flash memory in unit of sector into the DWORD variable pointed by Buffer. The allowable value is 1 to 32768 in power of 2. Return 1 if the erase block size is unknown or disk devices. This command is used by only f_mkfs function and it attempts to align data area to the erase block boundary.
    CTRL_ERASE_SECTORErases a part of the flash memory specified by a DWORD array {<start sector>, <end sector>} pointed by Buffer. When this feature is not supported or not a flash memory media, this command has no effect. The FatFs does not check the result code and the file function is not affected even if the sectors are not erased well. This command is called on removing a cluster chain when _USE_ERASE is 1.
    GET_SECTOR_SIZEReturns sector size of the drive into the WORD variable pointed by buff. This command is not used in fixed sector size configuration, _MAX_SS is 512.
    GET_SECTOR_COUNTReturns number of available sectors on the drive into the DWORD variable pointed by buff. This command is used by only f_mkfs() function to determine the volume size to be created.
    GET_BLOCK_SIZEReturns erase block size of the flash memory in unit of sector into the DWORD variable pointed by buff. The allowable value is 1 to 32768 in power of 2. Return 1 if the erase block size is unknown or disk devices. This command is used by only f_mkfs() function and it attempts to align data area to the erase block boundary.
    CTRL_ERASE_SECTORErases a part of the flash memory specified by a DWORD array {<start sector>, <end sector>} pointed by buff. This is similar command to Trim command of ATA command set. When this feature is not supported or not a flash memory media, this command has no effect. The FatFs does not check the result code and the file function is not affected even if the sectors are not erased well. This command is called on removing a cluster chain when _USE_ERASE is 1.
    diff --git a/doc/en/dread.html b/doc/en/dread.html index 8708456..c8f1f88 100644 --- a/doc/en/dread.html +++ b/doc/en/dread.html @@ -16,10 +16,10 @@

    The disk_read function reads sector(s) from the disk drive.

     DRESULT disk_read (
    -  BYTE Drive,          /* Physical drive number */
    -  BYTE* Buffer,        /* Pointer to the read data buffer */
    -  DWORD SectorNumber,  /* Start sector number */
    -  BYTE SectorCount     /* Number of sectros to read */
    +  BYTE pdrv,     /* [IN] Physical drive number */
    +  BYTE* buff,    /* [OUT] Pointer to the read data buffer */
    +  DWORD sector,  /* [IN] Start sector number */
    +  BYTE count     /* [IN] Number of sectros to read */
     );
     
    @@ -27,13 +27,13 @@ DRESULT disk_read (

    Parameters

    -
    Drive
    +
    pdrv
    Specifies the physical drive number.
    -
    Buffer
    +
    buff
    Pointer to the byte array to store the read data. The size of buffer must be in sector size * sector count.
    -
    SectorNumber
    +
    sector
    Specifies the start sector number in logical block address (LBA).
    -
    SectorCount
    +
    count
    Specifies number of sectors to read. The value can be 1 to 128. Generally, a multiple sector transfer request must not be split into single sector transactions to the device, or you may not get good read performance.
    @@ -56,11 +56,11 @@ DRESULT disk_read (

    Description

    -

    The specified memory address is not that always aligned to word boundary because the type of pointer is defined as BYTE. The misaligned read/write request can occure at direct transfer. If the bus architecture, especially DMA controller, does not allow misaligned memory access, it should be solved in this function. There are some workarounds below to avoid this problem.

    +

    The memory address specified by buff is not that always aligned to word boundary because the type of argument is defined as BYTE*. The misaligned read/write request can occure at direct transfer. If the bus architecture, especially DMA controller, does not allow misaligned memory access, it should be solved in this function. There are some workarounds described below to avoid this issue.

    diff --git a/doc/en/dstat.html b/doc/en/dstat.html index 759c386..0adda96 100644 --- a/doc/en/dstat.html +++ b/doc/en/dstat.html @@ -16,7 +16,7 @@

    The disk_status function returns the current disk status.

     DSTATUS disk_status (
    -  BYTE Drive     /* Physical drive number */
    +  BYTE pdrv     /* [IN] Physical drive number */
     );
     
    @@ -24,7 +24,7 @@ DSTATUS disk_status (

    Parameter

    -
    Drive
    +
    pdrv
    Specifies the physical drive number to be confirmed.
    @@ -35,11 +35,11 @@ DSTATUS disk_status (

    The disk status is returned in combination of following flags. FatFs refers only STA_NOINIT and STA_PROTECTED.

    STA_NOINIT
    -
    Indicates that the disk drive is not initialized. This flag is set on system reset, media removal, media change and disk_initialize function failed. The flag is cleared on disk_initialize function succeeded. Media change that occurs asynchronously must be captured and reflect it to the status flags, or auto-mount feature will not work correctly. When media change detection is not supported, application program should clear the file system object with f_mount function after the media change.
    +
    Indicates that the disk drive is not initialized. This flag is set on system reset, media removal or failure of disk_initialize() function. It is cleared on disk_initialize() function succeeded. Media change that occurs asynchronously must be captured and reflect it to the status flags, or auto-mount feature will not work correctly. When media change detection feature is not supported, application program needs to de-initialize the file system object with f_mount() function after the media change.
    STA_NODISK
    -
    Indicates that no medium in the drive. This is always cleared on fixed disk drive.
    +
    Indicates that no medium in the drive. This is always cleared on fixed disk drive. Note that FatFs does not refer this flag.
    STA_PROTECTED
    -
    Indicates that the medium is write protected. This is always cleared on the drive that does not support write protect notch. Not valid while STA_NODISK is set.
    +
    Indicates that the medium is write protected. This is always cleared on the drive that does not support write protect notch. Not valid while no medium in the drive.
    diff --git a/doc/en/dwrite.html b/doc/en/dwrite.html index af80048..cb5fa93 100644 --- a/doc/en/dwrite.html +++ b/doc/en/dwrite.html @@ -16,10 +16,10 @@

    The disk_write writes sector(s) to the disk.

     DRESULT disk_write (
    -  BYTE Drive,          /* Physical drive number */
    -  const BYTE* Buffer,  /* Pointer to the write data (may be non aligned) */
    -  DWORD SectorNumber,  /* Sector number to write */
    -  BYTE SectorCount     /* Number of sectors to write */
    +  BYTE drv,         /* [IN] Physical drive number */
    +  const BYTE* buff, /* [IN] Write data (may be non aligned) */
    +  DWORD sector,     /* [IN] Sector number to write */
    +  BYTE count        /* [IN] Number of sectors to write */
     );
     
    @@ -27,13 +27,13 @@ DRESULT disk_write (

    Parameters

    -
    Drive
    +
    pdrv
    Specifies the physical drive number.
    -
    Buffer
    +
    buff
    Pointer to the byte array to be written.
    -
    SectorNumber
    +
    sector
    Specifies the start sector number in logical block address (LBA).
    -
    SectorCount
    +
    count
    Specifies the number of sectors to write. The value can be 1 to 128. Generally, a multiple sector transfer request must not be split into single sector transactions to the device, or you will never get good write performance.
    @@ -58,7 +58,8 @@ DRESULT disk_write (

    Description

    -

    This function is not required in read only configuration. The specified memory address is not that always aligned to word boundary because the type of pointer is defined as BYTE. For more information, read description in disk_read function.

    +

    This function is not required in read only configuration. The specified memory address is not that always aligned to word boundary because the type of pointer is defined as BYTE. For more information, read description in disk_read function.

    +

    Application program MUST NOT call this function while FatFs is in use, or FAT structure on the volume can be corrapted.

    diff --git a/doc/en/eof.html b/doc/en/eof.html index 8560757..9501b09 100644 --- a/doc/en/eof.html +++ b/doc/en/eof.html @@ -16,7 +16,7 @@

    The f_eof function tests for end-of-file on a file.

     int f_eof (
    -  FIL* FileObject   /* File object */
    +  FIL* fp   /* [IN] File object */
     );
     
    @@ -25,7 +25,7 @@ int f_eof (

    Parameters

    -
    FileObject
    +
    fp
    Pointer to the open file object structure.
    @@ -33,13 +33,13 @@ int f_eof (

    Return Values

    -

    The f_eof function returns a non-zero value if the read/write pointer has reached end of the file; otherwise it returns a zero.

    +

    The f_eof() function returns a non-zero value if the read/write pointer has reached end of the file; otherwise it returns a zero.

    Description

    -

    In this revision, the f_eof function is implemented as a macro.

    +

    In this revision, this function is implemented as a macro.

     #define f_eof(fp) (((fp)->fptr) == ((fp)->fsize) ? 1 : 0)
     
    diff --git a/doc/en/error.html b/doc/en/error.html index e7d25a7..a346ee1 100644 --- a/doc/en/error.html +++ b/doc/en/error.html @@ -16,7 +16,7 @@

    The f_error tests for an error on a file.

     int f_error (
    -  FIL* FileObject   /* File object */
    +  FIL* fp   /* [IN] File object */
     );
     
    @@ -25,7 +25,7 @@ int f_error (

    Parameters

    -
    FileObject
    +
    fp
    Pointer to the open file object structure.
    @@ -39,7 +39,7 @@ int f_error (

    Description

    -

    In this revision, the f_error function is implemented as a macro.

    +

    In this revision, this function is implemented as a macro.

     #define f_error(fp) (((fp)->flag & FA__ERROR) ? 1 : 0)
     
    diff --git a/doc/en/fattime.html b/doc/en/fattime.html index 0a996c9..b69d08a 100644 --- a/doc/en/fattime.html +++ b/doc/en/fattime.html @@ -22,7 +22,7 @@ DWORD get_fattime (void);

    Return Value

    -

    Currnet time is returned with packed into a DWORD value. The bit field is as follows:

    +

    Currnet time is returned with packed into a DWORD value. The bit field is as follows:

    bit31:25
    Year from 1980 (0..127)
    @@ -42,7 +42,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. If a zero is returned, the file will not have a valid time. This fucntion is not required in read only configuration.

    +

    The get_fattime() function 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/fdisk.html b/doc/en/fdisk.html index 1adf943..57324d9 100644 --- a/doc/en/fdisk.html +++ b/doc/en/fdisk.html @@ -16,9 +16,9 @@

    The f_fdisk fucntion divides a physical drive.

     FRESULT f_fdisk (
    -  BYTE  Drive,              /* Physical drive number */
    -  const DWORD Partitions[], /* Partition size */
    -  void* Work                /* Work area */
    +  BYTE  pdrv,         /* [IN] Physical drive number */
    +  const DWORD part[], /* [IN] Partition size */
    +  void* work          /* [IN] Work area */
     );
     
    @@ -26,12 +26,12 @@ FRESULT f_fdisk (

    Parameters

    -
    Drive
    +
    pdrv
    Specifies the physical drive to be divided.
    -
    Partitions[]
    +
    part[]
    Partition map table. It must have four items.
    -
    Work
    -
    Pointer to the function work area. The size must be at least _MAX_SS bytes.
    +
    work
    +
    Pointer to the function work area. The size must be at least _MAX_SS bytes.
    @@ -48,18 +48,18 @@ FRESULT f_fdisk (

    Description

    -

    The f_fdisk function creates a partition table into the MBR of the physical drive. The partitioning rule is in generic FDISK format so that it can create upto four primary partitions. Extended partition is not supported. The Partitions[] specifies how to divide the physical drive. The first item specifies the size of first primary partition and fourth item specifies the fourth primary partition. If the value is less than or equal to 100, it means percentage of the partition in the entire disk space. If it is larger than 100, it means partition size in unit of sector.

    +

    The f_fdisk() function creates a partition table into the MBR of the physical drive. The partitioning rule is in generic FDISK format so that it can create upto four primary partitions. Extended partition is not supported. The part[] array with four items specifies how to divide the physical drive. The first item specifies the size of first primary partition and fourth item specifies the fourth primary partition. If the value is less than or equal to 100, it means percentage of the partition in the entire disk space. If it is larger than 100, it means partition size in unit of sector.

    QuickInfo

    -

    Available when _FS_READOLNY == 0, _USE_MKFS == 1 and _MULTI_PARTITION == 2.

    +

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

    Example

    -    /* Volume management table defined by user (required when _MULTI_PARTITION != 0) */
    +    /* Volume management table defined by user (required when _MULTI_PARTITION == 1) */
     
         PARTITION VolToPart[] = {
             {0, 1},    /* Logical drive 0 ==> Physical drive 0, 1st partition */
    @@ -89,7 +89,7 @@ FRESULT f_fdisk (
     
     
     
     

    Return

    diff --git a/doc/en/filename.html b/doc/en/filename.html index a60bb1c..89b7d7d 100644 --- a/doc/en/filename.html +++ b/doc/en/filename.html @@ -14,12 +14,12 @@

    Format of the path names

    -

    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 (LFN) and 8.3 format file name (SFN). The LFN can be used when LFN feature is enabled (_USE_LFN > 0). The sub directories are separated with a \ or / in the same way as DOS/Windows API. Duplicated separators are skipped and ignored. Only a difference is that the logical drive is specified in a numeral with a colon. When the drive number is omitted, it is assumed as default drive (0 or current drive).

    -

    Control characters (\0 to \x1F) are recognized as end of the path name. Leading/embedded spaces in the path name are valid as a part of the name on LFN configuration but they are recognized as end of the path name on non-LFN configuration. Trailing spaces and dots are ignored.

    -

    In default configuration (_FS_RPATH == 0), it does not have a concept of current directory like OS oriented file system. All objects on the volume are always specified in full path name that follows from the root directory. Dot directory names are not allowed. Heading separator is ignored and it can be exist or omitted. The default drive number is fixed to 0.

    -

    When relative path feature is enabled (_FS_RPATH == 1), specified path is followed from the root directory if a heading separator is exist. If not, it is followed from the current directory set with f_chdir function. Dot names are also allowed for the path name. The default drive is the current drive set with f_chdrive function.

    +

    The format of path name on the FatFs module is similer to the filename specs of DOS/Windos as follows:

    +
    "[drive#:][/]directory/file"
    +

    The FatFs module supports long file name (LFN) and 8.3 format file name (SFN). The LFN can be used when LFN feature is enabled (_USE_LFN > 0). The sub directories are separated with a \ or / in the same way as DOS/Windows API. Duplicated separators are skipped and ignored. Only a difference is that the logical drive is specified in a numeral with a colon. When the drive number is omitted, it is assumed as default drive (drive 0 or current drive).

    +

    Control characters ('\0' to '\x1F') are recognized as end of the path name. Leading/embedded spaces in the path name are valid as a part of the name on LFN configuration but they are recognized as end of the path name on non-LFN configuration. Trailing spaces and dots are ignored.

    +

    In default configuration (_FS_RPATH == 0), it does not have a concept of current directory like OS oriented file system. All objects on the volume are always specified in full path name that follows from the root directory. Dot directory names are not allowed. Heading separator is ignored and it can be exist or omitted. The default drive number is fixed to 0.

    +

    When relative path feature is enabled (_FS_RPATH == 1), specified path is followed from the root directory if a heading separator is exist. If not, it is followed from the current directory set with f_chdir function. Dot names are also allowed for the path name. The default drive is the current drive set with f_chdrive function.

    @@ -40,11 +40,11 @@


    Unicode API

    -

    The path names are input/output in either ANSI/OEM code (SBCS/DBCS) or Unicode depends on the configuration options. The type of arguments that specifies the file names are defined as TCHAR which is an alias of char in default. The code set of the file name string is the ANSI/OEM code set specifid by _CODE_PAGE. When _LFN_UNICODE is set to 1 under LFN configuration, the type of the TCHAR is switched to unsigned short (UCS-2 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. It also affects data types and encoding of the string I/O functions. To define literal strings, _T(s) and _TEXT(s) macro are available to select either ANSI/OEM or Unicode automatically. The code shown below is an example to define the literal strings.

    +

    The path names are input/output in either ANSI/OEM code (SBCS/DBCS) or Unicode depends on the configuration options. The type of arguments that specifies the file names are defined as TCHAR which is an alias of char in default. The code set of the file name string is the ANSI/OEM code set specifid by _CODE_PAGE. When _LFN_UNICODE is set to 1, the type of the TCHAR is switched to WCHAR, unsigned short (UCS-2 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. It also affects data types and encoding of the string I/O functions. To define literal strings, _T(s) and _TEXT(s) macro are available to select either ANSI/OEM or Unicode automatically. The code shown below is an example to define the literal strings.

      f_open(fp, "filename.txt", FA_READ);      /* ANSI/OEM only */
      f_open(fp, L"filename.txt", FA_READ);     /* Unicode only */
    - f_open(fp, _T("filename.txt"), FA_READ);  /* Changed automatically */
    + f_open(fp, _T("filename.txt"), FA_READ);  /* Changed by configuration */
     
    @@ -63,6 +63,7 @@ PARTITION VolToPart[] = { {1, 0} /* Logical drive 3 ==> Physical drive 1 (auto detection) */ }; +relationship between logical drive and physical drive

    There are some considerations when use _MULTI_PARTITION configuration.

    • Only four pri-partitions can be mounted. Extended partition is not supported.
    • diff --git a/doc/en/forward.html b/doc/en/forward.html index 01fb0e9..68b84e6 100644 --- a/doc/en/forward.html +++ b/doc/en/forward.html @@ -16,10 +16,10 @@

      The f_forward function reads the file data and forward it to the data streaming device.

       FRESULT f_forward (
      -  FIL* FileObject,                 /* File object */
      -  UINT (*Func)(const BYTE*,UINT),  /* Data streaming function */
      -  UINT ByteToFwd,                  /* Number of bytes to forward */
      -  UINT* ByteFwd                    /* Number of bytes forwarded */
      +  FIL* fp,                        /* [IN] File object */
      +  UINT (*func)(const BYTE*,UINT), /* [IN] Data streaming function */
      +  UINT btf,                       /* [IN] Number of bytes to forward */
      +  UINT* bf                        /* [OUT] Number of bytes forwarded */
       );
       
      @@ -27,14 +27,14 @@ FRESULT f_forward (

      Parameters

      -
      FileObject
      +
      fp
      Pointer to the open file object.
      -
      Func
      +
      func
      Pointer to the user-defined data streaming function. For details, refer to the sample code.
      -
      ByteToFwd
      -
      Number of bytes to forward in range of UINT.
      -
      ByteFwd
      -
      Pointer to the UINT variable to return number of bytes forwarded.
      +
      btf
      +
      Number of bytes to forward in range of UINT.
      +
      bf
      +
      Pointer to the UINT variable to return number of bytes forwarded.
      @@ -54,7 +54,7 @@ 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.

      +

      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 *bf is less than btf without error, it means the requested bytes could not be transferred due to end of file or stream goes busy during data transfer.

      diff --git a/doc/en/getcwd.html b/doc/en/getcwd.html index eaec9b9..4f798a0 100644 --- a/doc/en/getcwd.html +++ b/doc/en/getcwd.html @@ -16,8 +16,8 @@

      The f_getcwd function retrieves the current directory.

       FRESULT f_getcwd (
      -  TCHAR* Buffer,  /* Pointer to the buffer */
      -  UINT BufferLen  /* The length of the buffer */
      +  TCHAR* buff, /* [OUT] Buffer to return path name */
      +  UINT len     /* [IN] The length of the buffer */
       );
       
      @@ -25,9 +25,9 @@ FRESULT f_getcwd (

      Parameters

      -
      Buffer
      +
      buff
      Pointer to the buffer to receive the current directory string.
      -
      BufferLen
      +
      len
      Size of the buffer in unit of TCHAR.
      @@ -50,7 +50,7 @@ FRESULT f_getcwd (

      Description

      -

      The f_getcwd function retrieves the current directory of the current drive in full path string including drive number.

      +

      The f_getcwd() function retrieves the current directory of the current drive in full path string including drive number.

      diff --git a/doc/en/getfree.html b/doc/en/getfree.html index 8876ec1..ce09736 100644 --- a/doc/en/getfree.html +++ b/doc/en/getfree.html @@ -16,9 +16,9 @@

      The f_getfree function gets number of the free clusters.

       FRESULT f_getfree (
      -  const TCHAR* Path,        /* Logical drive number */
      -  DWORD* Clusters,          /* Pointer to the variable to store number of free clusters */
      -  FATFS** FileSystemObject  /* Pointer to pointer to file system object */
      +  const TCHAR* path,  /* [IN] Logical drive number */
      +  DWORD* nclst,       /* [OUT] Number of free clusters */
      +  FATFS** fatfs       /* [OUT] Corresponding file system object */
       );
       
      @@ -26,11 +26,11 @@ FRESULT f_getfree (

      Parameters

      -
      Path
      -
      Pinter to the null-terminated string that specifies the logical drive.
      -
      Clusters
      -
      Pointer to the DWORD variable to store number of free clusters.
      -
      FileSystemObject
      +
      path
      +
      Pinter to the null-terminated string that specifies the logical drive. A null-string means the current drive.
      +
      nclst
      +
      Pointer to the DWORD variable to store number of free clusters.
      +
      fatfs
      Pointer to pointer that to store a pointer to the corresponding file system object.
      @@ -53,7 +53,7 @@ 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.

      +

      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.

      @@ -78,10 +78,9 @@ FRESULT f_getfree ( tot_sect = (fs->n_fatent - 2) * fs->csize; fre_sect = fre_clust * fs->csize; - /* Print free space in unit of KB (assuming 512 bytes/sector) */ - printf("%lu KB total drive space.\n" - "%lu KB available.\n", - fre_sect / 2, tot_sect / 2); + /* Print free space in unit of KiB (assuming 512 bytes/sector) */ + printf("%lu KB total drive space.\n%lu KB available.\n", + tot_sect / 2, fre_sect / 2); diff --git a/doc/en/getlabel.html b/doc/en/getlabel.html new file mode 100644 index 0000000..9c3e8d7 --- /dev/null +++ b/doc/en/getlabel.html @@ -0,0 +1,82 @@ + + + + + + + + +FatFs - f_getlabel + + + + +
      +

      f_getlabel

      +

      The f_getlabel function returns volume label and volume serial number of a drive.

      +
      +FRESULT f_getlabel (
      +  const TCHAR* path,  /* [IN] Path name */
      +  TCHAR* buff,        /* [OUT] Volume label */
      +  DWORD* sn           /* [OUT] Volume serial number */
      +);
      +
      +
      + +
      +

      Parameters

      +
      +
      path
      +
      Pointer to the nul-terminated string specifying the logical drive. Null-string specifies the default drive.
      +
      buff
      +
      Pointer to the buffer to store the volume label. The buffer size must be at least 12 items. If no volume label, a nul-string will be returned. Set null pointer if this information is not needed.
      +
      sn
      +
      Pointer to the DWORD variable to store the volume serial number. Set null pointer if this information is not needed.
      +
      +
      + + + + + +
      +

      QuickInfo

      +

      Available when _USE_LABEL == 1.

      +
      + + +
      +

      Example

      +
      +    char str[12];
      +
      +    /* Get volume label of the default drive */
      +    f_getlabel("", str, 0);
      +
      +    /* Get volume label of the drive 2 */
      +    f_getlabel("2:", str, 0);
      +
      +
      + + +
      +

      See Also

      +f_setlabel +
      + + +

      Return

      + + diff --git a/doc/en/gets.html b/doc/en/gets.html index f0864a5..fd01a64 100644 --- a/doc/en/gets.html +++ b/doc/en/gets.html @@ -16,9 +16,9 @@

      The f_gets reads a string from the file.

       TCHAR* f_gets (
      -  TCHAR* Str,       /* Read buffer */
      -  int Size,         /* Size of the read buffer */
      -  FIL* FileObject   /* File object */
      +  TCHAR* buff, /* [OUT] Read buffer */
      +  int len,     /* [IN] Size of the read buffer */
      +  FIL* fp      /* [IN] File object */
       );
       
      @@ -26,11 +26,11 @@ TCHAR* f_gets (

      Parameters

      -
      Str
      +
      buff
      Pointer to read buffer to store the read string.
      -
      Size
      +
      len
      Size of the read buffer in unit of character.
      -
      FileObject
      +
      fp
      Pointer to the open file object structure.
      @@ -38,14 +38,14 @@ TCHAR* f_gets (

      Return Values

      -

      When the function succeeded, Str will be returuned.

      +

      When the function succeeded, buff will be returuned.

      Description

      -

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

      -

      When the FatFs is configured to Unicode API (_LFN_UNICODE == 1), the file is read in UTF-8 encoding and stored it to the buffer in UCS-2. If not the case, the file will be read in one byte per character without any code conversion.

      +

      The f_gets() function is a wrapper function of f_read() function. The read operation continues until a '\n' is stored, reached end of the file or the buffer is filled with len - 1 characters. The read string is terminated with a '\0'. When no character to read or any error occured during read operation, it returns a null pointer. The status of eof and error can be examined with f_eof() and f_error() macros.

      +

      When the FatFs is configured to Unicode API (_LFN_UNICODE == 1), the file is read in assumption of UTF-8 encoding and stored it to the buffer in UCS-2. If not the case, the file will be read in one byte per character without any code conversion.

      diff --git a/doc/en/lseek.html b/doc/en/lseek.html index a75f8f4..6ef089d 100644 --- a/doc/en/lseek.html +++ b/doc/en/lseek.html @@ -17,8 +17,8 @@
       FRESULT f_lseek (
      -  FIL* FileObject,   /* Pointer to the file object structure */
      -  DWORD Offset       /* File offset in unit of byte */
      +  FIL* fp,   /* [IN] File object */
      +  DWORD ofs  /* [IN] File read/write pointer */
       );
       
      @@ -26,10 +26,10 @@ FRESULT f_lseek (

      Parameters

      -
      FileObject
      +
      fp
      Pointer to the open file object.
      -
      Offset
      -
      Number of bytes where from start of the file
      +
      ofs
      +
      Byte offset from top of the file.
      @@ -49,13 +49,13 @@ FRESULT f_lseek (

      Description

      -

      The f_lseek function moves the file read/write pointer of an open file. The offset can be specified in only origin from top of the file. When an offset above the file size is specified in write mode, the file size is increased to the offset 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, current read/write pointer should be checked in order to make sure the read/write pointer has been moved correctry. In case of the current read/write pointer is not the expected value, either of followings has been occured.

      +

      The f_lseek() function moves the file read/write pointer of an open file. The offset can be specified in only origin from top of the file. When an offset above the file size is specified in write mode, the file size is increased to the offset 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, the current read/write pointer should be checked in order to make sure the read/write pointer was moved correctry. In case of the current read/write pointer is not the expected value, either of followings has been occured.

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

      Fast seek feature is enabled when _USE_FASTSEEK is set to 1 and the member cltbl in the file object is not NULL. This feature enables fast backward/long seek operations without FAT access by cluster link map table (CLMT) stored in the user defined table. It is also applied to f_read/f_write functions. In this mode, the file size cannot be increased by f_write/f_lseek functions.

      -

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

      +

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

      +

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

      @@ -69,53 +69,52 @@ FRESULT f_lseek (

      Example

           /* Open file */
      -    file = malloc(sizeof (FIL));
      -    if (!file) ...
      -    res = f_open(file, "file.dat", FA_READ|FA_WRITE);
      +    fp = malloc(sizeof (FIL));
      +    res = f_open(fp, "file.dat", FA_READ|FA_WRITE);
           if (res) ...
       
           /* Move to offset of 5000 from top of the file */
      -    res = f_lseek(file, 5000);
      +    res = f_lseek(fp, 5000);
       
           /* Move to end of the file to append data */
      -    res = f_lseek(file, f_size(file));
      +    res = f_lseek(fp, f_size(fp));
       
           /* Forward 3000 bytes */
      -    res = f_lseek(file, f_tell(file) + 3000);
      +    res = f_lseek(fp, f_tell(fp) + 3000);
       
           /* Rewind 2000 bytes (take care on overflow) */
      -    res = f_lseek(file, f_tell(file) - 2000);
      +    res = f_lseek(fp, f_tell(fp) - 2000);
       
           /* 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(fp, recfile, FA_CREATE_NEW | FA_WRITE);   /* Create a file */
       
      -    res = f_lseek(file, PRE_SIZE);           /* Expand file size (cluster pre-allocation) */
      -    if (res || f_tell(file) != PRE_SIZE) ... /* Check if the file has been expanded */
      +    res = f_lseek(fp, PRE_SIZE);             /* Expand file size (cluster pre-allocation) */
      +    if (res || f_tell(fp) != PRE_SIZE) ...   /* Check if the file has been expanded */
       
      -    res = f_lseek(file, DATA_START);         /* Record data stream WITHOUT cluster allocation delay */
      +    res = f_lseek(fp, DATA_START);           /* Record data stream WITHOUT cluster allocation delay */
           ...                                      /* DATA_START and write block size should be aligned to sector boundary */
       
      -    res = f_truncate(file);                  /* Truncate unused area */
      -    res = f_lseek(file, 0);                  /* Put file header */
      +    res = f_truncate(fp);                    /* Truncate unused area */
      +    res = f_lseek(fp, 0);                    /* Put file header */
           ...
       
      -    res = f_close(file);
      +    res = f_close(fp);
       
           /* Using fast seek feature */
       
           DWORD lktbl[SZ_TBL];                   /* Link map table buffer */
       
      -    res = f_lseek(file, ofs1);             /* This is normal seek (file.cltbl is nulled on file open) */
      +    res = f_lseek(fp, ofs1);               /* This is normal seek (cltbl member is nulled on file open) */
       
      -    file.cltbl = lktbl;                    /* Enable fast seek feature */
      +    fp->cltbl = lktbl;                     /* Enable fast seek feature (cltbl != NULL) */
           lktbl[0] = SZ_TBL;                     /* Set table size */
      -    res = f_lseek(file, CREATE_LINKMAP);   /* Create CLMT */
      +    res = f_lseek(fp, CREATE_LINKMAP);     /* Create CLMT */
           ...
       
      -    res = f_lseek(file, ofs2);             /* This is fast seek (file.cltbl != NULL) */
      +    res = f_lseek(fp, ofs2);               /* This is fast seek */
       
      diff --git a/doc/en/mkdir.html b/doc/en/mkdir.html index bd9d435..34f83e8 100644 --- a/doc/en/mkdir.html +++ b/doc/en/mkdir.html @@ -16,7 +16,7 @@

      The f_mkdir function creates a new directory.

       FRESULT f_mkdir (
      -  const TCHAR* DirName /* Pointer to the directory name */
      +  const TCHAR* path /* [IN] Directory name */
       );
       
      @@ -24,7 +24,7 @@ FRESULT f_mkdir (

      Parameter

      -
      DirName
      +
      path
      Pointer to the null-terminated string that specifies the directory name to create.
      @@ -53,7 +53,7 @@ FRESULT f_mkdir (

      Description

      -

      The f_mkdir function creates a new directory.

      +

      This function creates a new directory.

      diff --git a/doc/en/mkfs.html b/doc/en/mkfs.html index 86753a2..54c6ced 100644 --- a/doc/en/mkfs.html +++ b/doc/en/mkfs.html @@ -16,9 +16,9 @@

      The f_mkfs fucntion creates an FAT file system on the logical drive.

       FRESULT f_mkfs (
      -  BYTE  Drive,            /* Logical drive number */
      -  BYTE  PartitioningRule, /* Partitioning rule */
      -  UINT  AllocSize         /* Size of the allocation unit */
      +  BYTE  vol,   /* [IN] Logical drive number */
      +  BYTE  sfd,   /* [IN] Partitioning rule */
      +  UINT  au     /* [IN] Size of the allocation unit */
       );
       
      @@ -26,12 +26,12 @@ FRESULT f_mkfs (

      Parameters

      -
      Drive
      -
      Logical drive number (0-9) to be formatted.
      -
      PartitioningRule
      -
      Specifies partitioning rule, FDISK(0) or SFD(1). This argument is ignored on some case.
      -
      AllocSize
      -
      Force the allocation unit (cluter) size in unit of byte. The value must be power of 2 and between the sector size and 128 * sector size. When a zero is given, the cluster size is determined depends on the volume size.
      +
      vol
      +
      Logical drive number to be formatted. (0 to _VOLUMES - 1)
      +
      sfd
      +
      Specifies partitioning rule (FDISK(0) or SFD(1)). This argument is ignored on some case.
      +
      au
      +
      Force the size of allocation unit (cluter) in unit of byte. The value must be sector size * n (n = 1 to 128 and power of 2). When a zero is given, the cluster size is determined depends on the volume size.
      @@ -51,11 +51,11 @@ FRESULT f_mkfs (

      Description

      -

      The f_mkfs function creates an FAT volume on the logical drive. When FDISK is specified, a primary partition occupies the entire disk space is created and then an FAT volume is created on the partition. When SFD is specified, the FAT volume starts from the first sector of the physical drive.

      -

      If the logical drive is being bound to any partition (1-4) by multiple partition feature (_MULTI_PARTITION), the FAT volume is created into the specified partition. In this case, the second argument is ignored. The physical drive must be partitioned with f_fdisk function or any other partitioning tool prior to use this function.

      -

      Note that there are two partitioning rules, FDISK and SFD. The FDISK format is usually used for harddisk, MMC, SDC and CFC. It can divide a physical drive into one or more partitions with a partition table on the MBR. The SFD format is non-partitioned method. The FAT volume starts from the first sector on the physical drive without partition table. It is used for floppy disk, Microdrive, optical disk and super-floppy media.

      +

      The f_mkfs() function creates an FAT volume on the logical drive. When FDISK format is specified, a primary partition occupies the entire disk space is created and then an FAT volume is created on the partition. When SFD format is specified, the FAT volume starts from the first sector of the physical drive.

      +

      If the logical drive is being bound to any partition (1-4) by multiple partition feature (_MULTI_PARTITION), the FAT volume is created into the specified partition. In this case, the second argument sfd is ignored. The physical drive must have been partitioned with f_fdisk function or any other partitioning tool prior to use this function.

      +

      Note that there are two partitioning rules, FDISK and SFD. The FDISK partitioning is usually used for harddisk, MMC, SDC and CFC. It can divide a physical drive into one or more partitions with a partition table on the MBR. However Windows does not support multiple partition on the removable media. The SFD is non-partitioned method. The FAT volume starts from the first sector on the physical drive without partition table. It is used for floppy disk, Microdrive, optical disk and super-floppy media.

      The FAT sub-type, FAT12/FAT16/FAT32, is determined by number of clusters on the volume 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.

      -

      When the number of clusters gets near the FAT sub-type boundaries, the function can fail with FR_MKFS_ABORTED.

      +

      When the number of clusters gets near the FAT sub-type boundaries, the function can fail with FR_MKFS_ABORTED.

      diff --git a/doc/en/mount.html b/doc/en/mount.html index 18cef8b..a931d67 100644 --- a/doc/en/mount.html +++ b/doc/en/mount.html @@ -13,11 +13,11 @@

      f_mount

      -

      The f_mount fucntion registers/unregisters a work area to the FatFs module.

      +

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

       FRESULT f_mount (
      -  BYTE  Drive,              /* Logical drive number */
      -  FATFS*  FileSystemObject  /* Pointer to the work area */
      +  BYTE  vol,     /* [IN] Logical drive number */
      +  FATFS*  fatfs  /* [IN] File system object */
       );
       
      @@ -25,10 +25,10 @@ FRESULT f_mount (

      Parameters

      -
      Drive
      -
      Logical drive number (0-9) to register/unregister the work area.
      -
      FileSystemObject
      -
      Pointer to the work area (file system object) to be registered.
      +
      vol
      +
      Logical drive number to register/unregister file system object. (0 to _VOLUMES - 1)
      +
      fatfs
      +
      Pointer to the file system object to be registered. Null pointer unregisters the registered file system object.
      @@ -43,8 +43,13 @@ 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 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 always succeeds regardless of the drive status. No media access is occured in this function. It only clears the given work area and registers its address to the internal table. The volume mount process is performed on first file access after f_mount function or media change.

      +

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

      +

      This function always succeeds regardless of the physical drive status. No media access is occured in this function. It only de-initializes the given work area and registers its address to the internal table. It can also be used to force de-initialized the registered work area of a logical drive. The volume mount process, initialize the corresponding physical drive, find the FAT volume in it and initialize the work area, is performed when either or both of following condition is true:

      +
        +
      • File system object is not initialized. (by f_mount())
      • +
      • Physical drive is not initialized. (by system reset or media removal)
      • +
      +

      If the disk I/O layer does not detect media change, application program needs to perform f_mount() every media change.

      diff --git a/doc/en/open.html b/doc/en/open.html index 0b14e56..ccc5ac6 100644 --- a/doc/en/open.html +++ b/doc/en/open.html @@ -16,9 +16,9 @@

      The f_open function creates a file object to be used to access the file.

       FRESULT f_open (
      -  FIL* FileObject,       /* Pointer to the blank file object structure */
      -  const TCHAR* FileName, /* Pointer to the file neme */
      -  BYTE ModeFlags         /* Mode flags */
      +  FIL* fp,           /* [OUT] File object structure */
      +  const TCHAR* path, /* [IN] File name */
      +  BYTE mode          /* [IN] Mode flags */
       );
       
      @@ -26,11 +26,11 @@ FRESULT f_open (

      Parameters

      -
      FileObject
      +
      fp
      Pointer to the file object structure to be created.
      -
      FileName
      +
      path
      Pointer to a null-terminated string that specifies the file name to create or open.
      -
      ModeFlags
      +
      mode
      Specifies the type of access and open method for the file. It is specified by a combination of following flags.
    Path name_FS_RPATH == 0_FS_RPATH == 1
    file.txtA file in the root directory of the drive 0A file in the current directory of the current drive
    @@ -38,7 +38,7 @@ FRESULT f_open ( +To append data to the file, use f_lseek() function after file open in this method.
    ValueDescription
    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, a new file is created.
    -To append data to the file, use f_lseek function after file open in this method.
    FA_CREATE_NEWCreates a new file. The function fails with FR_EXIST if the file is existing.
    FA_CREATE_ALWAYSCreates a new file. If the file is existing, it is truncated and overwritten.
    @@ -59,6 +59,7 @@ To append data to the file, use f_lseek function after FR_INVALID_NAME, FR_DENIED, FR_EXIST, +FR_INVALID_OBJECT, FR_WRITE_PROTECTED, FR_INVALID_DRIVE, FR_NOT_ENABLED, @@ -73,9 +74,9 @@ To append data to the file, use f_lseek function after

    Description

    -

    After f_open function succeeded, the file object is valid. The file object is used for subsequent read/write functions to identify the file. When close an open file object, use f_close function. If the modified file is not closed, the file data can be collapsed.

    -

    If duplicated file open is needed, read here carefully. However duplicated open of a file with write mode flags is always prohibited.

    -

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

    +

    After f_open() function succeeded, the file object is valid. The file object is used for subsequent read/write functions to identify the file. To close an open file, use f_close() function. If the file is modified and not closed properly, the file data will be collapted.

    +

    If duplicated file open is needed, read here carefully. However duplicated open of a file with write mode flag is always prohibited.

    +

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

    diff --git a/doc/en/opendir.html b/doc/en/opendir.html index ed68cfc..238d686 100644 --- a/doc/en/opendir.html +++ b/doc/en/opendir.html @@ -16,8 +16,8 @@

    The f_opendir function opens a directory.

     FRESULT f_opendir (
    -  DIR* DirObject,       /* Pointer to the blank directory object structure */
    -  const TCHAR* DirName  /* Pointer to the directory name */
    +  DIR* dj,           /* [OUT] Blank directory object */
    +  const TCHAR* path  /* [IN] Directory name */
     );
     
    @@ -25,9 +25,9 @@ FRESULT f_opendir (

    Parameters

    -
    DirObject
    +
    dj
    Pointer to the blank directory object to be created.
    -
    DirName
    +
    path
    Pinter to the null-terminated string that specifies the directory name to be opened.
    @@ -53,7 +53,7 @@ FRESULT f_opendir (

    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.

    +

    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.

    diff --git a/doc/en/printf.html b/doc/en/printf.html index 5d15326..230ccfb 100644 --- a/doc/en/printf.html +++ b/doc/en/printf.html @@ -16,8 +16,8 @@

    The f_printf function writes formatted string to the file.

     int f_printf (
    -  FIL* FileObject,      /* File object */
    -  const TCHAR* Foramt,  /* Format stirng */
    +  FIL* fp,          /* [IN] File object */
    +  const TCHAR* fmt, /* [IN] Format stirng */
       ...
     );
     
    @@ -26,9 +26,9 @@ int f_printf (

    Parameters

    -
    FileObject
    +
    fp
    Pointer to the open file object structure.
    -
    Format
    +
    fmt
    Pointer to the null terminated format string.
    ...
    Optional arguments.
    @@ -45,7 +45,7 @@ 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 shown as follos:

    +

    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 C s S d D u U x X b B
    • Size: l L
    • @@ -57,7 +57,7 @@ int f_printf (

      QuickInfo

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

      -

      When the FatFs is configured to Unicode API (_LFN_UNICODE == 1), the generated UCS-2 characters are written to the file in UTF-8 encoding. If not the case, the byte characters will be written directly.

      +

      When the FatFs is configured to Unicode API (_LFN_UNICODE == 1), the generated UCS-2 string is written to the file in UTF-8 encoding. If not the case, the byte characters will be written directly.

      diff --git a/doc/en/putc.html b/doc/en/putc.html index 4cabcb0..9042cdb 100644 --- a/doc/en/putc.html +++ b/doc/en/putc.html @@ -16,8 +16,8 @@

      The f_putc funciton puts a character to the file.

       int f_putc (
      -  TCHAR Chr,        /* A character to put */
      -  FIL* FileObject   /* File object */
      +  TCHAR chr,  /* [IN] A character to put */
      +  FIL* fp     /* [IN] File object */
       );
       
    @@ -25,9 +25,9 @@ int f_putc (

    Parameters

    -
    Chr
    +
    chr
    A character to be put.
    -
    FileObject
    +
    fp
    Pointer to the open file object structuer.
    @@ -36,13 +36,13 @@ int f_putc (

    Return Values

    When the character was written successfuly, the function returns 1. When the function failed due to disk full or any error, an EOF (-1) will be returned.

    -

    When the FatFs is configured to Unicode API (_LFN_UNICODE == 1), the UTF-16 character is written to the file in UTF-8 encoding. If not the case, the byte will be written directly.

    +

    When the FatFs is configured to Unicode API (_LFN_UNICODE == 1), the UCS-2 character is written to the file in UTF-8 encoding. If not the case, the byte will be written directly.

    Description

    -

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

    +

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

    diff --git a/doc/en/puts.html b/doc/en/puts.html index 6fa733f..7feb0c4 100644 --- a/doc/en/puts.html +++ b/doc/en/puts.html @@ -16,8 +16,8 @@

    The f_puts function writes a string to the file.

     int f_puts (
    -  const TCHAR* Str,  /* String */
    -  FIL* FileObject    /* File object */
    +  const TCHAR* str, /* [IN] String */
    +  FIL* fp           /* [IN] File object */
     );
     
    @@ -25,9 +25,9 @@ int f_puts (

    Parameters

    -
    Str
    +
    str
    Pointer to the null terminated string to be written. The null character will not be written.
    -
    FileObject
    +
    fp
    Pointer to the open file object structure.
    @@ -36,13 +36,13 @@ int f_puts (

    Return Value

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

    -

    When the FatFs is configured to Unicode API (_LFN_UNICODE == 1), the UTF-16 string is written to the file in UTF-8 encoding. If not the case, the byte stream will be written directly.

    +

    When the FatFs is configured to Unicode API (_LFN_UNICODE == 1), the UCS-2 string is written to the file in UTF-8 encoding. If not the case, the byte stream will be written directly.

    Description

    -

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

    +

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

    diff --git a/doc/en/rc.html b/doc/en/rc.html index 9c4881c..845b23d 100644 --- a/doc/en/rc.html +++ b/doc/en/rc.html @@ -11,13 +11,13 @@

    Return Code of the File Functions

    -

    On the FatFs API, most of file functions return common result code as enum type. When a function succeeded, it returns zero, otherwise returns non-zero value that indicates type of error.

    +

    On the FatFs API, most of file functions return common result code as enum type FRESULT. When a function succeeded, it returns zero, otherwise returns non-zero value that indicates type of error.

    FR_OK (0)
    The function succeeded.
    FR_DISK_ERR
    -
    An unrecoverable error occured in the lower layer (disk I/O functions).
    +
    An unrecoverable error occured in the lower layer, disk_read(), disk_write() or disk_ioctl() function.
    FR_INT_ERR
    Assertion failed. An insanity is detected in the internal process. One of the following possibilities are suspected.
      @@ -27,7 +27,7 @@
    FR_NOT_READY
    -
    The disk drive cannot work due to incorrect medium removal or disk_initialize function failed.
    +
    The disk drive cannot work due to incorrect medium removal or disk_initialize() function failed.
    FR_NO_FILE
    Could not find the file.
    FR_NO_PATH
    @@ -37,47 +37,48 @@
    FR_DENIED
    The required access was denied due to one of the following reasons:
      -
    • Write mode open against the file with read-only attribute.
    • -
    • Deleting the file or directory with read-only attribute.
    • +
    • Write mode open against the read-only file.
    • +
    • Deleting the read-only file or directory.
    • Deleting the non-empty directory or current directory.
    • -
    • Reading the file opened without FA_READ flag.
    • -
    • Any modification to the file opened without FA_WRITE flag.
    • +
    • Reading the file opened without FA_READ flag.
    • +
    • Any modification to the file opened without FA_WRITE flag.
    • Could not create the file or directory due to the directory table is full.
    • Could not create the directory due to the volume is full.
    FR_EXIST
    -
    Any object that has the same name is already existing.
    +
    Any file or directory that has the same name is already existing.
    FR_INVALID_OBJECT
    -
    The given file/directory object structure is invalid.
    +
    The file/directory object is invalid or a null pointer is given.
    FR_WRITE_PROTECTED
    -
    Any write mode action against write-protected media.
    +
    Any write mode action against the write-protected media.
    FR_INVALID_DRIVE
    -
    Invalid drive number is specified. (Related option: _VOLUMES)
    +
    Invalid drive number is specified. (Related option: _VOLUMES)
    FR_NOT_ENABLED
    -
    Work area for the logical drive has not been registered by f_mount function.
    +
    Work area for the logical drive has not been registered by f_mount() function.
    FR_NO_FILESYSTEM
    There is no valid FAT volume on the drive.
    FR_MKFS_ABORTED
    -
    The f_mkfs function aborted before start in format due to a reason as follows: +
    The f_mkfs() function aborted before start in format due to a reason as follows:
    • The disk size is too small.
    • Not allowable cluster size for this disk. This can occure when number of clusters gets near the 0xFF7 and 0xFFF7.
    • +
    • There is no partition related to the logical drive. (Related option: _MULTI_PARTITION)
    FR_TIMEOUT
    -
    The function canceled due to a timeout of thread-safe control. (Related option: _TIMEOUT)
    +
    The function canceled due to a timeout of thread-safe control. (Related option: _TIMEOUT)
    FR_LOCKED
    -
    The file access is rejected by file sharing control. (Related option: _FS_LOCK)
    +
    The file access is rejected by file sharing control. (Related option: _FS_LOCK)
    FR_NOT_ENOUGH_CORE
    Not enough memory for the operation. There is one of the following reasons:
      -
    • Could not allocate a memory for LFN working buffer. (Related option: _USE_LFN)
    • -
    • Given table size is insufficient for the required size.
    • +
    • Could not allocate a memory for LFN working buffer. (Related option: _USE_LFN)
    • +
    • Given CLMT is insufficient size for the required size.
    FR_TOO_MANY_OPEN_FILES
    -
    Number of open files has been reached maximum value and no more file can be opened. (Related option: _FS_LOCK)
    +
    Number of open files has been reached maximum value and no more file can be opened. (Related option: _FS_LOCK)
    FR_INVALID_PARAMETER
    The given parameter is invalid or there is any inconsistent.
    diff --git a/doc/en/read.html b/doc/en/read.html index 399dd27..85bfeff 100644 --- a/doc/en/read.html +++ b/doc/en/read.html @@ -16,10 +16,10 @@

    The f_read function reads data from a file.

     FRESULT f_read (
    -  FIL* FileObject,    /* Pointer to the file object structure */
    -  void* Buffer,       /* Pointer to the buffer to store read data */
    -  UINT ByteToRead,    /* Number of bytes to read */
    -  UINT* ByteRead      /* Pointer to the variable to return number of bytes read */
    +  FIL* fp,     /* [IN] File object */
    +  void* buff,  /* [OUT] Buffer to store read data */
    +  UINT btr,    /* [IN] Number of bytes to read */
    +  UINT* br     /* [OUT] Number of bytes read */
     );
     
    @@ -27,14 +27,14 @@ FRESULT f_read (

    Parameters

    -
    FileObject
    +
    fp
    Pointer to the open file object.
    -
    Buffer
    +
    buff
    Pointer to the buffer to store read data
    -
    ByteToRead
    -
    Number of bytes to read in range of UINT.
    -
    ByteRead
    -
    Pointer to the UINT variable to return number of bytes read. The value is always valid after the function call regardless of the result.
    +
    btr
    +
    Number of bytes to read in range of UINT type.
    +
    br
    +
    Pointer to the UINT variable to return number of bytes read. The value is always valid after the function call regardless of the result.
    @@ -54,7 +54,7 @@ FRESULT f_read (

    Description

    -

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

    +

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

    diff --git a/doc/en/readdir.html b/doc/en/readdir.html index 0a5aeb7..6e4e10d 100644 --- a/doc/en/readdir.html +++ b/doc/en/readdir.html @@ -16,8 +16,8 @@

    The f_readdir function reads directory entries.

     FRESULT f_readdir (
    -  DIR* DirObject,    /* Pointer to the open directory object */
    -  FILINFO* FileInfo  /* Pointer to the file information structure */
    +  DIR* dj,      /* [IN] Directory object */
    +  FILINFO* fno  /* [OUT] File information structure */
     );
     
    @@ -25,9 +25,9 @@ FRESULT f_readdir (

    Parameters

    -
    DirObject
    +
    dj
    Pointer to the open directory object.
    -
    FileInfo
    +
    fno
    Pointer to the file information structure to store the read item.
    @@ -49,9 +49,9 @@ 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 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 TCHAR. 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, some 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.

    +

    The f_readdir() function reads directory items, file and directory, in sequence. All items in the directory can be read by calling f_readdir() function repeatedly. When all directory items have been read and no item to read, the function returns a null string into fname[] member without any error. When a null pointer is given to the fno, 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 use it. 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 TCHAR. 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, some small capitals can be contained in the SFN in the fname[].

    +

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

    @@ -74,7 +74,7 @@ FRESULT scan_files ( int i; char *fn; /* This function is assuming non-Unicode cfg. */ #if _USE_LFN - static char lfn[_MAX_LFN + 1]; + static char lfn[_MAX_LFN + 1]; /* Buffer to store the LFN */ fno.lfname = lfn; fno.lfsize = sizeof lfn; #endif diff --git a/doc/en/rename.html b/doc/en/rename.html index cc07ef9..ce921dc 100644 --- a/doc/en/rename.html +++ b/doc/en/rename.html @@ -16,8 +16,8 @@

    Renames an object.

     FRESULT f_rename (
    -  const TCHAR* OldName, /* Pointer to old object name */
    -  const TCHAR* NewName  /* Pointer to new object name */
    +  const TCHAR* old_name, /* [IN] Old object name */
    +  const TCHAR* new_name  /* [IN] New object name */
     );
     
    @@ -25,9 +25,9 @@ FRESULT f_rename (

    Parameters

    -
    OldName
    +
    old_name
    Pointer to a null-terminated string specifies the old object name to be renamed.
    -
    NewName
    +
    new_name
    Pointer to a null-terminated string specifies the new object name without drive number.
    @@ -58,7 +58,7 @@ FRESULT f_rename (

    Description

    -

    Renames an object (file or directory) 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.

    +

    Renames an object (file or directory) 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 or directry table can be collapted.

    @@ -79,6 +79,7 @@ FRESULT f_rename ( +

    Return

    diff --git a/doc/en/sdir.html b/doc/en/sdir.html index b1e0cd4..7609576 100644 --- a/doc/en/sdir.html +++ b/doc/en/sdir.html @@ -13,7 +13,7 @@

    DIR

    -

    The DIR structure is used for the work area to read a directory by f_oepndir, f_readdir function. There is no member that can be changed by application program.

    +

    The DIR structure is used for the work area to read a directory by f_oepndir()/f_readdir() function. Application program must not modify any member in this structure.

     typedef struct {
         FATFS*  fs;         /* Pointer to the owner file system object */
    diff --git a/doc/en/setlabel.html b/doc/en/setlabel.html
    new file mode 100644
    index 0000000..dfc6692
    --- /dev/null
    +++ b/doc/en/setlabel.html
    @@ -0,0 +1,89 @@
    +
    +
    +
    +
    +
    +
    +
    +
    +FatFs - f_setlabel
    +
    +
    +
    +
    +
    +

    f_setlabel

    +

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

    +
    +FRESULT f_setlabel (
    +  const TCHAR* name  /* [IN] Volume label to be set */
    +);
    +
    +
    + +
    +

    Parameters

    +
    +
    name
    +
    Pointer to the nul-terminated string specifying the volume label to be set.
    +
    +
    + + + + + +
    +

    Description

    +

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

    +
      +
    • 11 bytes or less in length as local character code.
    • +
    • Cannot contain period.
    • +
    • Can contain spaces anywhere in the name.
    • +
    +
    + +
    +

    QuickInfo

    +

    Available when _FS_READONLY == 0 and _USE_LABEL == 1.

    +
    + + +
    +

    Example

    +
    +    /* Set volume label to the default drive */
    +    f_setlabel("DATA DISK");
    +
    +    /* Set volume label to the drive 2 */
    +    f_setlabel("2:DISK 3 OF 4");
    +
    +    /* Remove volume label of the drive 2 */
    +    f_setlabel("2:");
    +
    +
    + + +
    +

    See Also

    +f_getlabel +
    + + +

    Return

    + + diff --git a/doc/en/sfatfs.html b/doc/en/sfatfs.html index 39eed91..92d5a89 100644 --- a/doc/en/sfatfs.html +++ b/doc/en/sfatfs.html @@ -13,7 +13,7 @@

    FATFS

    -

    The FATFS structure (file system object) holds dynamic work area of individual logical drives. It is given by application program and registerd/unregisterd to the FatFs module with f_mount function. Initialization is done on first file access after f_mount or media change. There is no member that can be changed from the application program.

    +

    The FATFS structure (file system object) holds dynamic work area of individual logical drives. It is given by application program and registerd/unregisterd to the FatFs module with f_mount() function. Initialization is done on first API call after f_mount() function or media change. Application program must not modify any member in this structure.

     typedef struct {
         BYTE    fs_type;      /* FAT sub-type (0:Not mounted) */
    @@ -40,6 +40,7 @@
     #endif
         DWORD   n_fatent;     /* Number of FAT entries (== Number of clusters + 2) */
         DWORD   fsize;        /* Sectors per FAT */
    +    DWORD   volbase;      /* Volume start sector */
         DWORD   fatbase;      /* FAT area start sector */
         DWORD   dirbase;      /* Root directory area start sector (FAT32: Cluster#) */
         DWORD   database;     /* Data area start sector */
    diff --git a/doc/en/sfile.html b/doc/en/sfile.html
    index 0a29ddc..727e153 100644
    --- a/doc/en/sfile.html
    +++ b/doc/en/sfile.html
    @@ -13,7 +13,7 @@
     
     

    FIL

    -

    The FIL structure (file object) holds state of an open file. It is created by f_open function and discarded by f_close function. There is no member that can be changed by the application program except for cltbl. Note that a sector buffer is defined in this structure under non-tiny configuration so that the FIL structures should not be defined as auto variable.

    +

    The FIL structure (file object) holds state of an open file. It is created by f_open() function and discarded by f_close() function. Application program must not modify any member in this structure except for cltbl. Note that a sector buffer is defined in this structure under non-tiny configuration, so that the FIL structures should not be defined as auto variable.

     typedef struct {
    diff --git a/doc/en/sfileinfo.html b/doc/en/sfileinfo.html
    index ef1752d..58eba2e 100644
    --- a/doc/en/sfileinfo.html
    +++ b/doc/en/sfileinfo.html
    @@ -13,7 +13,7 @@
     
     

    FILINFO

    -

    The FILINFO structure holds a file information returned by f_stat and f_readdir function.

    +

    The FILINFO structure holds a file information returned by f_readdir() and f_stat() function.

     typedef struct {
         DWORD fsize;      /* File size */
    diff --git a/doc/en/size.html b/doc/en/size.html
    index 9325c9b..f297d20 100644
    --- a/doc/en/size.html
    +++ b/doc/en/size.html
    @@ -16,7 +16,7 @@
     

    The f_size function gets the size of a file.

     DWORD f_size (
    -  FIL* FileObject   /* File object */
    +  FIL* fp   /* [IN] File object */
     );
     
    @@ -25,7 +25,7 @@ DWORD f_size (

    Parameters

    -
    FileObject
    +
    fp
    Pointer to the open file object structure.
    @@ -39,7 +39,7 @@ DWORD f_size (

    Description

    -

    In this revision, the f_size function is implemented as a macro.

    +

    In this revision, the f_size() function is implemented as a macro.

     #define f_size(fp) ((fp)->fsize)
     
    diff --git a/doc/en/stat.html b/doc/en/stat.html index 9c7d226..bfff48d 100644 --- a/doc/en/stat.html +++ b/doc/en/stat.html @@ -16,8 +16,8 @@

    The f_stat gets the file status.

     FRESULT f_stat (
    -  const TCHAR* FileName,  /* Pointer to the file or directory name */
    -  FILINFO* FileInfo       /* Pointer to the FILINFO structure */
    +  const TCHAR* path,  /* [IN] Object name */
    +  FILINFO* fno        /* [OUT] FILINFO structure */
     );
     
    @@ -25,9 +25,9 @@ FRESULT f_stat (

    Parameters

    -
    FileName
    +
    path
    Pointer to the null-terminated string that specifies the file or directory to get its information.
    -
    FileInfo
    +
    fno
    Pointer to the blank FILINFO structure to store the information.
    @@ -54,7 +54,13 @@ FRESULT f_stat (

    Description

    -

    The f_stat gets the size, timestamp and attribute of a file or directory. For details of the infomation, refer to the FILINFO structure and f_readdir function. This function is not supported in minimization level of >= 1.

    +

    The f_stat() function gets the size, timestamp and attribute of a file or directory. For details of the infomation, refer to the FILINFO structure and f_readdir() function.

    +
    + + +
    +

    QuickInfo

    +

    Available when _FS_MINIMIZE == 0.

    diff --git a/doc/en/sync.html b/doc/en/sync.html index a7594fa..9636bd2 100644 --- a/doc/en/sync.html +++ b/doc/en/sync.html @@ -16,7 +16,7 @@

    The f_sync function flushes the cached information of a writing file.

     FRESULT f_sync (
    -  FIL* FileObject     /* Pointer to the file object */
    +  FIL* fp     /* [IN] File object */
     );
     
    @@ -24,7 +24,7 @@ FRESULT f_sync (

    Parameter

    -
    FileObject
    +
    fp
    Pointer to the open file object to be flushed.
    @@ -45,7 +45,7 @@ FRESULT f_sync (

    Description

    -

    The f_sync function performs the same process as f_close function but the file is left opened and can continue read/write/seek operations to the file. This is suitable for the applications that open files for a long time in write mode, such as data logger. Performing f_sync of periodic or immediataly after f_write can minimize the risk of data loss due to a sudden blackout or an unintentional media 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.

    +

    The f_sync() function performs the same process as f_close() function but the file is left opened and can continue read/write/seek operations to the file. This is suitable for the applications that open files for a long time in write mode, such as data logger. Performing f_sync() function of periodic or immediataly after f_write() function can minimize the risk of data loss due to a sudden blackout or an unintentional media removal. However the f_sync() function immediataly before f_close() function has no advantage because it performs f_sync() function in it. In other words, the differnce between those functions is that the file object is invalidated or not.

    diff --git a/doc/en/tell.html b/doc/en/tell.html index acf4fce..2ad86ae 100644 --- a/doc/en/tell.html +++ b/doc/en/tell.html @@ -16,7 +16,7 @@

    The f_tell function gets the current read/write pointer of a file.

     DWORD f_tell (
    -  FIL* FileObject   /* File object */
    +  FIL* fp   /* [IN] File object */
     );
     
    @@ -25,7 +25,7 @@ DWORD f_tell (

    Parameters

    -
    FileObject
    +
    fp
    Pointer to the open file object structure.
    @@ -39,7 +39,7 @@ DWORD f_tell (

    Description

    -

    In this revision, the f_tell function is implemented as a macro.

    +

    In this revision, the f_tell() function is implemented as a macro.

     #define f_tell(fp) ((fp)->fptr)
     
    diff --git a/doc/en/truncate.html b/doc/en/truncate.html index 65fc524..eb0989e 100644 --- a/doc/en/truncate.html +++ b/doc/en/truncate.html @@ -16,7 +16,7 @@

    The f_truncate function truncates the file size.

     FRESULT f_truncate (
    -  FIL* FileObject     /* Pointer to the file object */
    +  FIL* fp     /* [IN] File object */
     );
     
    @@ -24,7 +24,7 @@ FRESULT f_truncate (

    Parameter

    -
    FileObject
    +
    fp
    Pointer to the open file object to be truncated.
    @@ -45,7 +45,7 @@ FRESULT f_truncate (

    Description

    -

    The f_truncate function truncates the file size to the current file read/write point. This function has no effect if the file read/write pointer is already pointing end of the file.

    +

    The f_truncate() function truncates the file size to the current file read/write pointer. This function has no effect if the file read/write pointer is already pointing end of the file.

    diff --git a/doc/en/unlink.html b/doc/en/unlink.html index 86929dd..b693395 100644 --- a/doc/en/unlink.html +++ b/doc/en/unlink.html @@ -16,7 +16,7 @@

    The f_unlink function removes a file or directory.

     FRESULT f_unlink (
    -  const TCHAR* FileName  /* Pointer to the object name */
    +  const TCHAR* path  /* [IN] Object name */
     );
     
    @@ -24,7 +24,7 @@ FRESULT f_unlink (

    Parameter

    -
    FileName
    +
    path
    Pointer to the null-terminated string that specifies an object to be removed.
    @@ -56,9 +56,8 @@ FRESULT f_unlink (

    Description

    -If condition of the object to be removed is applicable to the following terms, the function will fail with error. -

    @@ -25,9 +25,9 @@ FRESULT f_utime (

    Parameters

    -
    FileName
    +
    path
    Pointer to the null-terminated string that specifies a file or directory to be changed.
    -
    TimeDate
    +
    fno
    Pointer to the file information structure that has a timestamp to be set in member fdate and ftime. Do not care any other members.
    @@ -55,7 +55,7 @@ FRESULT f_utime (

    Description

    -

    The f_utime function changes the timestamp of a file or directory

    +

    The f_utime() function changes the timestamp of a file or directory

    diff --git a/doc/en/write.html b/doc/en/write.html index eb5e847..a12af69 100644 --- a/doc/en/write.html +++ b/doc/en/write.html @@ -16,10 +16,10 @@

    The f_write writes data to a file.

     FRESULT f_write (
    -  FIL* FileObject,     /* Pointer to the file object structure */
    -  const void* Buffer,  /* Pointer to the data to be written */
    -  UINT ByteToWrite,    /* Number of bytes to write */
    -  UINT* ByteWritten    /* Pointer to the variable to return number of bytes written */
    +  FIL* fp,          /* [IN] Pointer to the file object structure */
    +  const void* buff, /* [IN] Pointer to the data to be written */
    +  UINT btw,         /* [IN] Number of bytes to write */
    +  UINT* bw          /* [OUT] Pointer to the variable to return number of bytes written */
     );
     
    @@ -27,14 +27,14 @@ FRESULT f_write (

    Parameters

    -
    FileObject
    +
    fp
    Pointer to the open file object structure.
    -
    Buffer
    +
    buff
    Pointer to the data to be written.
    -
    ByteToWrite
    -
    Specifies number of bytes to write in range of UINT.
    -
    ByteWritten
    -
    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.
    +
    btw
    +
    Specifies number of bytes to write in range of UINT type.
    +
    bw
    +
    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.
    @@ -54,7 +54,7 @@ FRESULT f_write (

    Description

    -

    The read/write pointer of the file object advances 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. The function can take a time when the volume is full or close to full.

    +

    The read/write pointer of the file object advances number of bytes written. After the function succeeded, *bw should be checked to detect the disk full. In case of *bw is less than btw, it means the volume got full during the write operation. The function can take a time when the volume is full or close to full.

    diff --git a/doc/img/app1.c b/doc/img/app1.c new file mode 100644 index 0000000..d654cdb --- /dev/null +++ b/doc/img/app1.c @@ -0,0 +1,44 @@ +/*------------------------------------------------------------/ +/ Open or create a file in append mode +/------------------------------------------------------------*/ + +FRESULT open_append ( + FIL* fp, /* [OUT] File object to create */ + const char* path /* [IN] File name to be opened */ +) +{ + FRESULT fr; + + /* Opens an existing file. If not exist, creates a new file. */ + fr = f_open(fp, path, FA_WRITE | FA_OPEN_ALWAYS); + if (fr == FR_OK) { + /* Seek to end of the file to append data */ + fr = f_lseek(fp, f_size(fp)); + if (fr != FR_OK) + f_close(fp); + } + return fr; +} + + +int main (void) +{ + FRESULT fr; + FIL fil; + + + f_mount(0, &Fatfs); + + /* Open or create a log file and ready to append */ + fr = open_append(&fil, "logfile.txt"); + if (fr != FR_OK) return 1; + + /* Append a line */ + f_printf(&fil, "%02u/%02u/%u, %2u:%02u\n", Mday, Mon, Year, Hour, Min); + + /* Close the file */ + f_close(&fil); + + return 0; +} + diff --git a/doc/img/app2.c b/doc/img/app2.c new file mode 100644 index 0000000..3072d10 --- /dev/null +++ b/doc/img/app2.c @@ -0,0 +1,67 @@ +/*------------------------------------------------------------/ +/ Remove all contents of a directory +/ This function works regardless of _FS_RPATH. +/------------------------------------------------------------*/ + + +FRESULT empty_directory ( + char* path /* Working buffer filled with start directory */ +) +{ + UINT i, j; + FRESULT fr; + DIR dir; + FILINFO fno; + +#if _USE_LFN + fno.lfname = 0; /* Set null pointer because LFN is not needed */ +#endif + fr = f_opendir(&dir, path); + if (fr == FR_OK) { + for (i = 0; path[i]; i++) ; + path[i++] = '/'; + for (;;) { + fr = f_readdir(&dir, &fno); + if (fr != FR_OK || !fno.fname[0]) break; + if (fno.fname[0] == '.') continue; + j = 0; + do + path[i+j] = fno.fname[j]; + while (fno.fname[j++]); + if (fno.fattrib & AM_DIR) { + fr = empty_directory(path); + if (fr != FR_OK) break; + } + fr = f_unlink(path); + if (fr != FR_OK) break; + } + path[--i] = '\0'; + } + + return fr; +} + + + +int main (void) +{ + FRESULT fr; + char buff[64]; /* Working buffer */ + + + f_mount(0, &Fatfs); + + strcpy(buff, "/"); /* Directory to be emptied */ + fr = empty_directory(buff); + + if (fr) { + printf("Function failed. (%u)\n", fr); + return 1; + } else { + printf("All contents in the %s are successfully removed.\n", buff); + return 0; + } +} + + + diff --git a/doc/img/app3.c b/doc/img/app3.c new file mode 100644 index 0000000..22e3cea --- /dev/null +++ b/doc/img/app3.c @@ -0,0 +1,98 @@ +/*------------------------------------------------------------/ +/ Allocate a contiguous area to the file +/------------------------------------------------------------*/ + +/* Declarations of FatFs internal functions accessible from applications. +/ This is intended to be used by disk checking/fixing or dirty hacks :-) */ +DWORD clust2sect (FATFS *fs, DWORD clst); +DWORD get_fat (FATFS *fs, DWORD clst); +FRESULT put_fat (FATFS *fs, DWORD clst, DWORD val); + + +DWORD allocate_contiguous_clusters ( /* Returns file start sector number */ + FIL* fp, /* Pointer to the open file object */ + DWORD len /* Number of bytes to allocate */ +) +{ + DWORD csz, tcl, ncl, ccl, cl; +#if _FATFS != 82786 /* Check if R0.09b */ +#error This function may not be compatible with this revision of FatFs module. +#endif + + if (f_lseek(fp, 0) || !len) /* Check if the given parameters are valid */ + return 0; + csz = 512UL * fp->fs->csize; /* Cluster size in unit of byte (assuming 512 bytes/sector) */ + tcl = (len + csz - 1) / csz; /* Total number of clusters required */ + len = tcl * csz; /* Round-up file size to the cluster boundary */ + + /* Check if the existing cluster chain is contiguous */ + if (len == fp->fsize) { + ncl = 0; ccl = fp->sclust; + do { + cl = get_fat(fp->fs, ccl); /* Get the cluster status */ + if (cl + 1 < 3) return 0; /* Hard error? */ + if (cl != ccl + 1 &&; cl < fp->fs->n_fatent) break; /* Not contiguous? */ + ccl = cl; + } while (++ncl < tcl); + if (ncl == tcl) /* Is the file contiguous? */ + return clust2sect(fp->fs, fp->sclust); /* Return file start sector */ + } + + if (f_truncate(fp)) return 0; /* Remove the existing chain */ + + /* Find a free contiguous area */ + ccl = cl = 2; ncl = 0; + do { + if (cl >= fp->fs->n_fatent) return 0; /* No contiguous area is found. */ + if (get_fat(fp->fs, cl)) { /* Encounterd a cluster in use */ + do { /* Skip the block of used clusters */ + cl++; + if (cl >= fp->fs->n_fatent) return 0; /* No contiguous area is found. */ + } while (get_fat(fp->fs, cl)); + ccl = cl; ncl = 0; + } + cl++; ncl++; + } while (ncl < tcl); + + /* Create a contiguous cluster chain */ + fp->fs->last_clust = ccl - 1; + if (f_lseek(fp, len)) return 0; + + return clust2sect(fp->fs, fp->sclust); /* Return file start sector */ +} + + +int main (void) +{ + FRESULT fr; + DRESULT dr; + FIL fil; + DWORD org; + + + f_mount(0, &Fatfs); + + /* Open or create a file */ + fr = f_open(&fil, "pagefile.dat", FA_READ | FA_WRITE | FA_OPEN_ALWAYS); + if (fr) return 1; + + /* Check if the file is 64MB in size and occupies a contiguous area. + / If not, a contiguous area is re-allocated to the file. */ + org = allocate_contiguous_clusters(&fil, 0x4000000); + if (!org) { + printf("Function failed due to any error or insufficient contiguous area.\n"); + f_close(&fil); + return 1; + } + + /* Now you can read/write the file with disk functions bypassing the file system layer. + / Note that 4th argument of the disk read/write function is BYTE, so that you may need + / to bypass the disk functions for large number of multiple sector transfer. */ + + dr = disk_write(fil.fs->drv, Buff, org, 128); /* Write 64K bytes from top of the file */ + + ... + + f_close(&fil); + return 0; +} diff --git a/doc/img/f7.png b/doc/img/f7.png new file mode 100644 index 0000000..392e8b8 Binary files /dev/null and b/doc/img/f7.png differ diff --git a/doc/img/modules.png b/doc/img/modules.png index f89d831..c82d124 100644 Binary files a/doc/img/modules.png and b/doc/img/modules.png differ diff --git a/doc/ja/appnote.html b/doc/ja/appnote.html index cadd0aa..56c21be 100644 --- a/doc/ja/appnote.html +++ b/doc/ja/appnote.html @@ -24,6 +24,7 @@
  • 蜉ケ邇逧縺ェ繝輔ぃ繧、繝ォ繝サ繧「繧ッ繧サ繧ケ
  • 繝輔Λ繝繧キ繝・繝サ繝。繝「繝ェ縺ョ迚ケ諤ァ縺ク縺ョ驟肴ョ
  • 繧ッ繝ェ繝√き繝ォ繝サ繧サ繧ッ繧キ繝ァ繝ウ
  • +
  • API縺ョ諡。蠑オ逧菴ソ逕ィ萓
  • FatFs縺ョ繝ゥ繧、繧サ繝ウ繧ケ縺ォ縺、縺縺ヲ

  • @@ -35,9 +36,9 @@

    FatFs繝「繧ク繝・繝シ繝ォ縺ッ遘サ讀肴ァ縺ォ髢「縺励※谺。縺ョ轤ケ繧貞燕謠舌→縺励※縺縺セ縺吶

    繧キ繧ケ繝繝讒区

    @@ -45,7 +46,7 @@ FatFs繝「繧ク繝・繝シ繝ォ縺ッANSI C(C89)貅匁侠縺ァ險倩ソー縺輔l縺ヲ縺繧九ョ縺ァ縲、NSI C

    繧キ繧ケ繝繝讒区仙峙

    繝ヲ繝シ繧カ縺ョ菴懈舌☆繧矩未謨ー

    -

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

    +

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

    @@ -74,21 +75,22 @@ FatFs繝「繧ク繝・繝シ繝ォ縺ッANSI C(C89)貅匁侠縺ァ險倩ソー縺輔l縺ヲ縺繧九ョ縺ァ縲、NSI C

    繝。繝「繝ェ菴ソ逕ィ驥

    -

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

    +

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

    繝ヲ繝シ繧カ菴懈宣未謨ー蠢隕√→縺ェ繧区擅莉カ蛯呵
    disk_initialize
    disk_status
    disk_read
    蟶ク譎ffsample.zip (繧オ繝ウ繝励Ν)
    縺昴ョ莉殆eb荳翫↓螟壽焚
    - - - - - - - + + + + + + + +
    ARM7
    32bit
    ARM7
    Thumb
    CM3
    Thumb-2
    AVRH8/300HPIC24RL78V850ESSH-2ARX600IA-32
    CompilerGCCGCCGCCGCCCH38C30CC78K0RCA850SHCRXCVC6
    _WORD_ACCESS00010001011
    text (Full, R/W)1037570196561132671052511205128127783871557827615
    text (Min, R/W) 648747274283 8521 6967 7398 88005019563537845003
    text (Full, R/O) 455131252895 6219 4895 5268 61233629384326993527
    text (Min, R/O) 332124572197 4527 3797 3999 46632773299920642736
    bssD*4 + 2D*4 + 2D*4 + 2D*2 + 2D*4 + 2D*2 + 2D*2 + 2D*4 + 2D*4 + 2D*4 + 2D*4 + 2
    Work area
    (_FS_TINY == 0)
    V*560 +
    F*550
    V*560 +
    F*550
    V*560 +
    F*550
    V*560 +
    F*544
    V*560 +
    F*550
    V*560 +
    F*544
    V*560 +
    F*544
    V*560 +
    F*544
    V*560 +
    F*550
    V*560 +
    F*550
    V*560 +
    F*550
    Work area
    (_FS_TINY == 1)
    V*560 +
    F*36
    V*560 +
    F*36
    V*560 +
    F*36
    V*560 +
    F*32
    V*560 +
    F*36
    V*560 +
    F*32
    V*560 +
    F*32
    V*560 +
    F*36
    V*560 +
    F*36
    V*560 +
    F*36
    V*560 +
    F*36
    text (Full, R/W)1039570376555133621060911364128847814878358267659
    text (Min, R/W) 651947474315 8608 7043 7539 88605070572338215038
    text (Full, R/O) 456331472911 6174 4925 5340 61363628386327213534
    text (Min, R/O) 331124632209 4610 3817 4029 46412762300320682722
    bssV*4 + 2V*4 + 2V*4 + 2V*2 + 2V*4 + 2V*2 + 2V*2 + 2V*4 + 2V*4 + 2V*4 + 2V*4 + 2
    Work area
    (_FS_TINY == 0)
    V*564 +
    F*550
    V*564 +
    F*550
    V*564 +
    F*550
    V*564 +
    F*544
    V*564 +
    F*550
    V*564 +
    F*544
    V*564 +
    F*544
    V*564 +
    F*544
    V*564 +
    F*550
    V*564 +
    F*550
    V*564 +
    F*550
    Work area
    (_FS_TINY == 1)
    V*564 +
    F*36
    V*564 +
    F*36
    V*564 +
    F*36
    V*564 +
    F*32
    V*564 +
    F*36
    V*564 +
    F*32
    V*564 +
    F*32
    V*564 +
    F*36
    V*564 +
    F*36
    V*564 +
    F*36
    V*564 +
    F*36
    -FatFs R0.09a options:
    +FatFs R0.09b options:
     _FS_READONLY     0 (R/W), 1 (R/O)
     _FS_MINIMIZE     0 (Full function), 3 (Minimized function)
     _USE_STRFUNC     0 (Disable string functions)
    @@ -98,8 +100,9 @@ _USE_FASTSEEK    0 (Disable fast seek feature)
     _CODE_PAGE       932 (Japanese Shift-JIS)
     _USE_LFN         0 (Disable LFN)
     _MAX_SS          512 (Fixed sector size)
    -_FS_RPATH        0 (Disable relative path)
    -_VOLUMES         D (Number of logical drives to be used)
    +_FS_RPATH        0 (Disable relative path feature)
    +_FS_LABEL        0 (Disable volume label functions)
    +_VOLUMES         V (Number of logical drives to be used)
     _MULTI_PARTITION 0 (Single partition per drive)
     _FS_REENTRANT    0 (Disable reentrancy)
     _FS_LOCK         0 (Disable file lock control)
    @@ -110,41 +113,43 @@ _FS_LOCK         0 (Disable file lock control)
     

    繝「繧ク繝・繝シ繝ォ繝サ繧オ繧、繧コ縺ョ邵ョ蟆

    谺。縺ョ陦ィ縺ッ讒区舌が繝励す繝ァ繝ウ縺ョ險ュ螳壼、縺ォ繧医j縺ゥ縺ョ讖溯ス縺悟炎髯、縺輔l繧九°繧堤、コ縺励∪縺吶

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Function_FS_MINIMIZE_FS_READONLY_USE_STRFUNC_FS_RPATH_USE_MKFS_USE_FORWARD_MULTI_PARTITION
    0123010  1/201201010/12
    f_mount
    f_open
    f_close
    f_read
    f_writex
    f_syncx
    f_lseekx
    f_opendirxx
    f_readdirxx
    f_statxxx
    f_getfreexxxx
    f_truncatexxxx
    f_unlinkxxxx
    f_mkdirxxxx
    f_chmodxxxx
    f_utimexxxx
    f_renamexxxx
    f_chdirx
    f_chdrivex
    f_getcwdxx
    f_mkfsxx
    f_fdiskxxx
    f_forwardx
    f_putcxx
    f_putsxx
    f_printfxx
    f_getsx
    Function_FS_MINIMIZE_FS_READONLY_USE_STRFUNC_FS_RPATH_FS_LABEL_USE_MKFS_USE_FORWARD_MULTI_PARTITION
    0123010  1/20120101010/12
    f_mount
    f_open
    f_close
    f_read
    f_writex
    f_syncx
    f_lseekx
    f_opendirxx
    f_readdirxx
    f_statxxx
    f_getfreexxxx
    f_truncatexxxx
    f_unlinkxxxx
    f_mkdirxxxx
    f_chmodxxxx
    f_utimexxxx
    f_renamexxxx
    f_chdirx
    f_chdrivex
    f_getcwdxx
    f_getlabelx
    f_setlabelxx
    f_forwardx
    f_mkfsxx
    f_fdiskxxx
    f_putcxx
    f_putsxx
    f_printfxx
    f_getsx

    髟キ縺繝輔ぃ繧、繝ォ蜷

    -

    FatFs繝「繧ク繝・繝シ繝ォ縺ッR0.07縺九i髟キ縺繝輔ぃ繧、繝ォ蜷(LFN)繧偵し繝昴シ繝医@縺セ縺励◆縲ゅヵ繧。繧、繝ォ縺ォ莉倥¢繧峨l縺2縺、縺ョ逡ー縺ェ繧句錐蜑(遏ュ縺繝輔ぃ繝ォ蜷阪→髟キ縺繝輔ぃ繧、繝ォ蜷)縺ッ縲’_readdir髢「謨ー繧帝勁縺上ヵ繧。繧、繝ォ謫堺ス憺未謨ー縺ォ縺翫>縺ヲ騾城℃縺ァ縺吶LFN讖溯ス繧呈怏蜉ケ縺ォ縺吶k縺ォ縺ッ縲_USE_LFN繧1,2縺セ縺溘ッ3縺ォ險ュ螳壹@縲ゞnicode螟画鋤髢「謨ーff_convert(), ff_wtoupper()繧偵励Ο繧ク繧ァ繧ッ繝医↓霑ス蜉縺励∪縺吶ゅ%繧後i縺ョ髢「謨ー縺ッ縲option/cc*.c縺ォ蜷ォ縺セ繧後※縺縺セ縺吶LFN讖溯ス縺ッ縲∝刈縺医※縺ゅk遞句コヲ縺ョ繝ッ繝シ繧ッ繝サ繧ィ繝ェ繧「(LFN謫堺ス懊ヰ繝繝輔ぃ)繧貞ソ隕√→縺励∪縺吶ゅヰ繝繝輔ぃ髟キ縺ッ菴ソ逕ィ縺ァ縺阪k繝。繝「繝ェ縺ォ蠢懊§縺ヲ_MAX_LFN繧ェ繝励す繝ァ繝ウ縺ァ讒区舌&繧後k縺薙→縺後〒縺阪∪縺吶LFN縺ョ髟キ縺輔ッ譛螟ァ255譁蟄励↓驕斐☆繧九ョ縺ァ縲´FN螳悟ィ蟇セ蠢懊ョ縺溘a縺ォ縺ッ_MAX_LFN縺ッ255縺ォ險ュ螳壹&繧後k縺ケ縺阪〒縺吶ゆク弱∴繧峨l縺溘ヵ繧。繧、繝ォ蜷阪↓蟇セ縺励※繝舌ャ繝輔ぃ髟キ縺御ク崎カウ縺励◆蝣エ蜷医√ヵ繧。繧、繝ォ髢「謨ー縺ッFR_INVALID_NAME縺ァ螟ア謨励@縺セ縺吶

    +

    FatFs繝「繧ク繝・繝シ繝ォ縺ッR0.07縺九i髟キ縺繝輔ぃ繧、繝ォ蜷(LFN)繧偵し繝昴シ繝医@縺セ縺励◆縲ゅヵ繧。繧、繝ォ縺ォ莉倥¢繧峨l縺2縺、縺ョ逡ー縺ェ繧句錐蜑(遏ュ縺繝輔ぃ繝ォ蜷阪→髟キ縺繝輔ぃ繧、繝ォ蜷)縺ッ縲f_readdir()繧帝勁縺上ヵ繧。繧、繝ォ謫堺ス憺未謨ー縺ォ縺翫>縺ヲ騾城℃縺ァ縺吶LFN讖溯ス繧呈怏蜉ケ縺ォ縺吶k縺ォ縺ッ縲_USE_LFN繧1,2縺セ縺溘ッ3縺ォ險ュ螳壹@縲ゞnicode螟画鋤髢「謨ーff_convert(), ff_wtoupper()繧偵励Ο繧ク繧ァ繧ッ繝医↓霑ス蜉縺励∪縺吶ゅ%繧後i縺ョ髢「謨ー縺ッ縲option/cc*.c縺ォ蜷ォ縺セ繧後※縺縺セ縺吶LFN讖溯ス縺ッ縲∝刈縺医※縺ゅk遞句コヲ縺ョ繝ッ繝シ繧ッ繝サ繧ィ繝ェ繧「(LFN謫堺ス懊ヰ繝繝輔ぃ)繧貞ソ隕√→縺励∪縺吶ゅヰ繝繝輔ぃ髟キ縺ッ菴ソ逕ィ縺ァ縺阪k繝。繝「繝ェ縺ォ蠢懊§縺ヲ_MAX_LFN繧ェ繝励す繝ァ繝ウ縺ァ讒区舌&繧後k縺薙→縺後〒縺阪∪縺吶LFN縺ョ髟キ縺輔ッ譛螟ァ255譁蟄励↓驕斐☆繧九ョ縺ァ縲´FN螳悟ィ蟇セ蠢懊ョ縺溘a縺ォ縺ッ_MAX_LFN縺ッ255縺ォ險ュ螳壹&繧後k縺ケ縺阪〒縺吶ゆク弱∴繧峨l縺溘ヵ繧。繧、繝ォ蜷阪↓蟇セ縺励※繝舌ャ繝輔ぃ髟キ縺御ク崎カウ縺励◆蝣エ蜷医√ヵ繧。繧、繝ォ髢「謨ー縺ッFR_INVALID_NAME縺ァ螟ア謨励@縺セ縺吶

    菴輔i縺九ョ繝ェ繧ィ繝ウ繝医Λ繝ウ繝育憾諷九ョ荳九〒LFN讖溯ス繧剃スソ逕ィ縺吶k蝣エ蜷医ッ縲_USE_LFN縺ッ2縺セ縺溘ッ3縺ォ險ュ螳壹&繧後↑縺代l縺ー縺ェ繧翫∪縺帙s縲ゅ%縺ョ蝣エ蜷医√ヵ繧。繧、繝ォ髢「謨ー縺ッ繝舌ャ繝輔ぃ繧偵せ繧ソ繝繧ッ繧繝偵シ繝励↓遒コ菫昴@縺セ縺吶ゅヰ繝繝輔ぃ繝サ繧オ繧、繧コ縺ッ縲(_MAX_LFN + 1) * 2繝舌う繝医↓縺ェ繧九ョ縺ァ縲√せ繧ソ繝繧ッ遲峨ョ繧オ繧、繧コ縺ッ縺昴l繧定諷ョ縺励◆蜊∝縺ェ繧オ繧、繧コ縺ァ縺ェ縺代l縺ー縺ェ繧翫∪縺帙s縲

    @@ -155,7 +160,7 @@ _FS_LOCK 0 (Disable file lock control)
    LFN cfg on ARM7
    949(Korean)+139857
    950(Big5)+111497
    -

    LFN讖溯ス縺ョ荳頑焔縺ェ菴ソ縺譁ケ縺ッ縲√◎繧後r菴ソ繧上↑縺縺ィ縺縺縺薙→縺ァ縺吶ょョ滄圀縲∫オ縺ソ霎シ縺ソ逕ィ騾斐〒縺ッLFN讖溯ス縺後←縺縺励※繧ょソ隕√↓縺ェ繧九→縺縺縺薙→縺ッ縺サ縺ィ繧薙←辟。縺縺ッ縺壹〒縺吶LFN繧呈怏蜉ケ縺ォ縺吶k縺ィ縲驕ク謚槭&繧後◆繧ウ繝シ繝峨サ繝壹シ繧ク縺ォ蠢懊§縺ヲ繝「繧ク繝・繝シ繝ォ繝サ繧オ繧、繧コ縺悟「怜、ァ縺輔l縺セ縺吶ょ承縺ョ陦ィ縺ォ蜷繧ウ繝シ繝峨サ繝壹シ繧ク縺ォ縺翫¢繧記FN繧呈怏蜉ケ縺ォ縺励◆縺ィ縺阪ョ繝「繧ク繝・繝シ繝ォ繝サ繧オ繧、繧コ縺ョ驕輔>繧堤、コ縺励∪縺吶らァ√◆縺。譌・譛ャ莠コ縲∽クュ蝗ス莠コ縺翫h縺ウ髻灘嵜莠コ縺ッ謨ー荳縺ョ譁蟄励r謖√■縺セ縺吶ゆク榊ケク縺ェ縺薙→縺ォ縲√◎繧後ッ蟾ィ螟ァ縺ェOEMシ攻nicode逶ク莠貞、画鋤繝繝シ繝悶Ν繧定ヲ∵アゅ@縲√Δ繧ク繝・繝シ繝ォ繝サ繧オ繧、繧コ縺ッ蜉逧縺ォ蠅怜、ァ縺輔l縺セ縺吶ゅ◎縺ョ邨先棡縲´FN繧呈怏蜉ケ縺ォ縺励◆FatFs繝「繧ク繝・繝シ繝ォ縺ッ縲、VR繧貞性繧谿縺ゥ縺ョ8繝薙ャ繝医サ繝槭う繧ウ繝ウ縺ォ繧、繝ウ繝励Μ繝。繝ウ繝医&繧後k縺薙→縺後〒縺阪∪縺帙s縲縺薙l縺ッ髟キ縺髢鍋ァ√′LFN繧偵う繝ウ繝励Μ繝。繝ウ繝医☆繧九%縺ィ縺ォ闊亥袖繧呈戟縺」縺ヲ縺薙↑縺九▲縺溽炊逕ア縺ァ縺吶

    +

    LFN讖溯ス縺ョ荳頑焔縺ェ菴ソ縺譁ケ縺ッ縲√◎繧後r菴ソ繧上↑縺縺ィ縺縺縺薙→縺ァ縺吶ょョ滄圀縲∫オ縺ソ霎シ縺ソ逕ィ騾斐〒縺ッLFN讖溯ス縺後←縺縺励※繧ょソ隕√↓縺ェ繧九→縺縺縺薙→縺ッ縺サ縺ィ繧薙←辟。縺縺ッ縺壹〒縺吶LFN繧呈怏蜉ケ縺ォ縺吶k縺ィ縲驕ク謚槭&繧後◆繧ウ繝シ繝峨サ繝壹シ繧ク縺ォ蠢懊§縺ヲ繝「繧ク繝・繝シ繝ォ繝サ繧オ繧、繧コ縺悟「怜、ァ縺輔l縺セ縺吶ょ承縺ョ陦ィ縺ォ蜷繧ウ繝シ繝峨サ繝壹シ繧ク縺ォ縺翫¢繧記FN繧呈怏蜉ケ縺ォ縺励◆縺ィ縺阪ョ繝「繧ク繝・繝シ繝ォ繝サ繧オ繧、繧コ縺ョ驕輔>繧堤、コ縺励∪縺吶ら音縺ォ縲,JK蝨ー蝓溘〒縺ッ謨ー荳縺ョ譁蟄励′菴ソ繧上l縺ヲ縺縺セ縺吶′縲∽ク榊ケク縺ェ縺薙→縺ォ縺昴l縺ッ蟾ィ螟ァ縺ェOEMシ攻nicode逶ク莠貞、画鋤繝繝シ繝悶Ν繧定ヲ∵アゅ@縲√Δ繧ク繝・繝シ繝ォ繝サ繧オ繧、繧コ縺ッ蜉逧縺ォ蠅怜、ァ縺輔l縺セ縺吶ゅ◎縺ョ邨先棡縲√◎繧後i縺ョ繧ウ繝シ繝峨サ繝壹シ繧ク縺ォ縺翫>縺ヲLFN繧呈怏蜉ケ縺ォ縺励◆FatFs繝「繧ク繝・繝シ繝ォ縺ッ縲、VR繧貞性繧谿縺ゥ縺ョ8繝薙ャ繝医サ繝槭う繧ウ繝ウ縺ォ繧、繝ウ繝励Μ繝。繝ウ繝医&繧後k縺薙→縺後〒縺阪∪縺帙s縲

    豕ィ: 繝槭う繧ッ繝ュ繧ス繝輔ヨ遉セ縺ッFAT繝輔ぃ繧、繝ォ繝サ繧キ繧ケ繝繝縺ォ縺、縺縺ヲ縺縺上▽縺九ョ迚ケ險ア繧剃ソ晄怏縺励※縺縺セ縺吶ゅ>縺壹l繧LFN縺ョ螳溯」縺ォ髢「縺吶k繧ゅョ縺ァ縲´FN讖溯ス縺ォ蟇セ縺励※$0.25/unit縺ョ繝ゥ繧、繧サ繝ウ繧ケ譁吶r隕∵アゅ@縺ヲ縺縺セ縺吶よ怙霑代ョFAT32繝峨Λ繧、繝舌ョ螟壹¥縺ッLFN讖溯ス繧貞性繧薙〒縺繧九◆繧√√◎繧後i縺ョ菴ソ逕ィ縺ォ蠖薙◆縺」縺ヲ繝ゥ繧、繧サ繝ウ繧ケ縺悟ソ隕√↓縺ェ繧翫∪縺吶′縲:atFs縺ァ縺ッLFN讖溯ス縺ョ譛牙柑繝サ辟。蜉ケ繧剃ササ諢上↓讒区舌〒縺阪∪縺吶ゅ%縺ョ縺溘a縲∝膚逕ィ陬ス蜩√〒LFN讖溯ス繧呈怏蜉ケ縺ォ縺吶k縺ィ縺阪ッ縲∵怙邨ゆサ募髄蝨ー縺ォ繧医▲縺ヲ縺ッ繝ゥ繧、繧サ繝ウ繧ケ縺悟ソ隕√°繧ら衍繧後∪縺帙s縲

    @@ -166,7 +171,7 @@ _FS_LOCK 0 (Disable file lock control)

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

    -

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

    +

    API荳翫↓縺翫¢繧九ヵ繧。繧、繝ォ蜷阪ョ蜈・蜃コ蜉帙ッ繝繝輔か繝ォ繝医〒縺ッANSI/OEM繧ウ繝シ繝峨〒陦後o繧後∪縺吶′縲√%繧後rUnicode縺ォ蛻繧頑崛縺医k縺薙→繧ゅ〒縺阪∪縺吶ゅ▽縺セ繧翫√%繧後ッFatFs縺鍬FN讖溯ス縺ォ螳悟ィ蟇セ蠢懊@縺ヲ縺繧九%縺ィ繧呈э蜻ウ縺励∪縺吶6nicode縺ョ繝輔ぃ繧、繝ォ蜷阪↓髢「縺吶k隧ウ邏ー縺ッ縲繝輔ぃ繧、繝ォ蜷繧貞盾辣ァ縺励※縺上□縺輔>縲

    @@ -185,7 +190,7 @@ _FS_LOCK 0 (Disable file lock control)

    蜉ケ邇逧縺ェ繝輔ぃ繧、繝ォ繝サ繧「繧ッ繧サ繧ケ

    -

    蟆剰ヲ乗ィ。縺ェ邨霎シ繧キ繧ケ繝繝縺ァ縺ョ繝輔ぃ繧、繝ォ縺ョ隱ュ縺ソ譖ク縺阪↓縺翫¢繧句柑邇縺ョ濶ッ縺繧「繧ッ繧サ繧ケ縺ョ縺溘a縲√い繝励Μ繧ア繝シ繧キ繝ァ繝ウ繝サ繝励Ο繧ー繝ゥ繝槭ッFatFs繝「繧ク繝・繝シ繝ォ縺ョ荳ュ縺ァ縺ゥ縺ョ繧医≧縺ェ蜃ヲ逅縺瑚。後o繧後※縺繧九°閠諷ョ縺吶∋縺阪〒縺吶ゅせ繝医Ξ繝シ繧ク荳翫ョ繝繝シ繧ソ縺ッf_read髢「謨ー縺ォ繧医j谺。縺ョ繧キ繝シ繧ア繝ウ繧ケ縺ァ霆「騾√&繧後∪縺吶

    +

    蟆剰ヲ乗ィ。縺ェ邨霎シ繧キ繧ケ繝繝縺ァ縺ョ繝輔ぃ繧、繝ォ縺ョ隱ュ縺ソ譖ク縺阪↓縺翫¢繧句柑邇縺ョ濶ッ縺繧「繧ッ繧サ繧ケ縺ョ縺溘a縲√い繝励Μ繧ア繝シ繧キ繝ァ繝ウ繝サ繝励Ο繧ー繝ゥ繝槭ッFatFs繝「繧ク繝・繝シ繝ォ縺ョ荳ュ縺ァ縺ゥ縺ョ繧医≧縺ェ蜃ヲ逅縺瑚。後o繧後※縺繧九°閠諷ョ縺吶∋縺阪〒縺吶ゅせ繝医Ξ繝シ繧ク荳翫ョ繝繝シ繧ソ縺ッf_read()縺ォ繧医j谺。縺ョ繧キ繝シ繧ア繝ウ繧ケ縺ァ霆「騾√&繧後∪縺吶

    蝗ウ1. 繧サ繧ッ繧ソ繝サ繝溘せ繧「繝ゥ繧、繝ウ繝峨サ繝ェ繝シ繝 (繧キ繝ァ繝シ繝)
    fig.1

    @@ -196,7 +201,7 @@ _FS_LOCK 0 (Disable file lock control) fig.3

    繝輔ぃ繧、繝ォI/O繝舌ャ繝輔ぃ縺ッ繧サ繧ッ繧ソ縺ョ荳驛ィ縺ョ繝繝シ繧ソ繧定ェュ縺ソ譖ク縺阪☆繧九◆繧√ョ繧サ繧ッ繧ソ繝サ繝舌ャ繝輔ぃ繧呈э蜻ウ縺励∪縺吶ゅそ繧ッ繧ソ繝サ繝舌ャ繝輔ぃ縺ッ縲√◎繧後◇繧後ョ繝輔ぃ繧、繝ォ繝サ繧ェ繝悶ず繧ァ繧ッ繝亥縺ョ繝励Λ繧、繝吶シ繝医サ繧サ繧ッ繧ソ繝サ繝舌ャ繝輔ぃ縺セ縺溘ッ繝輔ぃ繧、繝ォ繝サ繧キ繧ケ繝繝繝サ繧ェ繝悶ず繧ァ繧ッ繝亥縺ョ蜈ア譛峨そ繧ッ繧ソ繝サ繝舌ャ繝輔ぃ縺ョ縺ゥ縺。繧峨°縺ァ縺吶ゅヰ繝繝輔ぃ讒区舌が繝励す繝ァ繝ウ縺ョ_FS_TINY縺ッ縲√ョ繝シ繧ソ霆「騾√↓縺ゥ縺。繧峨r菴ソ縺縺九r豎コ螳壹@縺セ縺吶ゅち繧、繝九シ繝サ繝舌ャ繝輔ぃ(1)縺碁∈謚槭&繧後k縺ィ繝繝シ繧ソ繝サ繝。繝「繝ェ縺ョ豸郁イサ縺ッ縺昴l縺槭l縺ョ繝輔ぃ繧、繝ォ繝サ繧ェ繝悶ず繧ァ繧ッ繝医〒512繝舌う繝域ク帛ー代&繧後∪縺吶ゅ%縺ョ蝣エ蜷医:atFs繝「繧ク繝・繝シ繝ォ縺ッ繝輔ぃ繧、繝ォ繝サ繝繝シ繧ソ縺ョ霆「騾√→FAT/繝繧」繝ャ繧ッ繝医Μ繝サ繧「繧ッ繧サ繧ケ縺ォ繝輔ぃ繧、繝ォ繝サ繧キ繧ケ繝繝繝サ繧ェ繝悶ず繧ァ繧ッ繝亥縺ョ繧サ繧ッ繧ソ繝サ繝舌ャ繝輔ぃ縺縺代r菴ソ逕ィ縺励∪縺吶ゅち繧、繝九シ繝サ繝舌ャ繝輔ぃ縺ョ谺轤ケ縺ッ縲√そ繧ッ繧ソ繝サ繝舌ャ繝輔ぃ縺ォ繧ュ繝」繝繧キ繝・縺輔l縺檳AT繝繝シ繧ソ縺後ヵ繧。繧、繝ォ繝サ繝繝シ繧ソ縺ョ霆「騾√↓繧医j螟ア繧上l縲√け繝ゥ繧ケ繧ソ蠅逡後ョ豈弱↓繝ェ繝ュ繝シ繝峨&繧後↑縺代l縺ー縺ェ繧峨↑縺縺薙→縺ァ縺吶ゅ〒繧ゅ∵が縺上↑縺諤ァ閭ス縺ィ蟆代↑縺繝。繝「繝ェ豸郁イサ縺ョ隕也せ縺九i螟壹¥縺ョ繧「繝励Μ繧ア繝シ繧キ繝ァ繝ウ縺ォ驕ゥ縺吶k縺ァ縺励g縺縲

    -

    蝗ウ1縺ッ繧サ繧ッ繧ソ縺ョ荳驛ィ縺ョ繝繝シ繧ソ縺後ヵ繧。繧、繝ォI/O繝舌ャ繝輔ぃ繧堤オ檎罰縺ァ霆「騾√&繧後k縺薙→繧堤、コ縺励∪縺吶ょ峙2縺ォ遉コ縺輔l繧矩聞縺繝繝シ繧ソ縺ョ霆「騾√〒縺ッ縲∬サ「騾√ョ繝シ繧ソ縺ョ荳ュ髢薙ョ1繧サ繧ッ繧ソ縺セ縺溘ッ縺昴l莉・荳翫ョ繧サ繧ッ繧ソ縺ォ縺セ縺溘′繧玖サ「騾√ョ繝シ繧ソ縺後い繝励Μ繧ア繝シ繧キ繝ァ繝ウ繝サ繝舌ャ繝輔ぃ縺ォ逶エ謗・霆「騾√&繧後※縺縺セ縺吶ょ峙3縺ッ霆「騾√ョ繝シ繧ソ蜈ィ菴薙′繧サ繧ッ繧ソ蠅逡後↓繧「繝ゥ繧、繝。繝ウ繝医&繧後※縺繧句エ蜷医r遉コ縺励※縺縺セ縺吶ゅ%縺ョ蝣エ蜷医√ヵ繧。繧、繝ォI/O繝舌ャ繝輔ぃ縺ッ菴ソ逕ィ縺輔l縺セ縺帙s縲ら峩謗・霆「騾√↓縺翫>縺ヲ縺ッ譛螟ァ縺ョ遽蝗イ縺ョ繧サ繧ッ繧ソ縺慧isk_read髢「謨ー縺ァ荳蠎ヲ縺ォ隱ュ縺ソ霎シ縺セ繧後∪縺吶′縲√け繝ゥ繧ケ繧ソ蠅逡後r雜翫∴繧九槭Ν繝√サ繧サ繧ッ繧ソ霆「騾√ッ縺昴l縺碁團謗・縺ァ縺ゅ▲縺ヲ繧り。後o繧後∪縺帙s縲

    +

    蝗ウ1縺ッ繧サ繧ッ繧ソ縺ョ荳驛ィ縺ョ繝繝シ繧ソ縺後ヵ繧。繧、繝ォI/O繝舌ャ繝輔ぃ繧堤オ檎罰縺ァ霆「騾√&繧後k縺薙→繧堤、コ縺励∪縺吶ょ峙2縺ォ遉コ縺輔l繧矩聞縺繝繝シ繧ソ縺ョ霆「騾√〒縺ッ縲∬サ「騾√ョ繝シ繧ソ縺ョ荳ュ髢薙ョ1繧サ繧ッ繧ソ縺セ縺溘ッ縺昴l莉・荳翫ョ繧サ繧ッ繧ソ縺ォ縺セ縺溘′繧玖サ「騾√ョ繝シ繧ソ縺後い繝励Μ繧ア繝シ繧キ繝ァ繝ウ繝サ繝舌ャ繝輔ぃ縺ォ逶エ謗・霆「騾√&繧後※縺縺セ縺吶ょ峙3縺ッ霆「騾√ョ繝シ繧ソ蜈ィ菴薙′繧サ繧ッ繧ソ蠅逡後↓繧「繝ゥ繧、繝。繝ウ繝医&繧後※縺繧句エ蜷医r遉コ縺励※縺縺セ縺吶ゅ%縺ョ蝣エ蜷医√ヵ繧。繧、繝ォI/O繝舌ャ繝輔ぃ縺ッ菴ソ逕ィ縺輔l縺セ縺帙s縲ら峩謗・霆「騾√↓縺翫>縺ヲ縺ッ譛螟ァ縺ョ遽蝗イ縺ョ繧サ繧ッ繧ソ縺disk_read()縺ァ荳蠎ヲ縺ォ隱ュ縺ソ霎シ縺セ繧後∪縺吶′縲√け繝ゥ繧ケ繧ソ蠅逡後r雜翫∴繧九槭Ν繝√サ繧サ繧ッ繧ソ霆「騾√ッ縺昴l縺碁團謗・縺ァ縺ゅ▲縺ヲ繧り。後o繧後∪縺帙s縲

    縺薙ョ繧医≧縺ォ縲√そ繧ッ繧ソ縺ォ繧「繝ゥ繧、繝。繝ウ繝医@縺溘ヵ繧。繧、繝ォ縺ョ隱ュ縺ソ譖ク縺阪∈縺ョ驟肴ョ縺ッ繝舌ャ繝輔ぃ邨檎罰縺ョ繝繝シ繧ソ霆「騾√r驕ソ縺代∬ェュ縺ソ譖ク縺肴ァ閭ス縺ッ謾ケ蝟縺輔l繧九〒縺励g縺縲ゅ◎縺ョ蜉ケ譫懊↓蜉縺医√ち繧、繝九シ讒区舌〒繧ュ繝」繝繧キ繝・縺輔l縺檳AT繝繝シ繧ソ縺後ヵ繧。繧、繝ォ繝サ繝繝シ繧ソ縺ョ霆「騾√↓繧医j繝輔Λ繝繧キ繝・縺輔l縺壹髱槭ち繧、繝九シ讒区舌→蜷後§諤ァ閭ス繧貞ー上&縺ェ繝。繝「繝ェ繝サ繝輔ャ繝医励Μ繝ウ繝医〒驕疲舌〒縺阪∪縺吶

    @@ -215,7 +220,7 @@ _FS_LOCK 0 (Disable file lock control)

    繧ッ繝ェ繝√き繝ォ繝サ繧サ繧ッ繧キ繝ァ繝ウ

    -

    繧ケ繝医Ξ繝シ繧ク荳翫ョFAT讒矩繧呈桃菴懊@縺ヲ縺繧矩比クュ縺ァ縲∝●髮サ縲∽ク肴ュ」縺ェ繝。繝繧」繧「縺ョ蜿悶j螟悶@縲∝屓蠕ゥ荳崎ス縺ェ繝繝シ繧ソ繝サ繧ィ繝ゥ繝シ遲峨ョ髫懷ョウ縺檎匱逕溘☆繧九→縲∝ヲ逅縺御クュ騾泌濠遶ッ縺ェ迥カ諷九〒荳ュ譁ュ縺輔l縲√◎縺ョ邨先棡縺ィ縺励※FAT讒矩縺檎エ螢翫&繧後k蜿ッ閭ス諤ァ縺後≠繧翫∪縺吶よャ。縺ォFatFs繝「繧ク繝・繝シ繝ォ縺ォ縺翫¢繧九け繝ェ繝√き繝ォ繝サ繧サ繧ッ繧キ繝ァ繝ウ縺ィ縲√◎縺ョ髢薙ョ髫懷ョウ縺ォ繧医j襍キ縺阪≧繧九お繝ゥ繝シ縺ョ迥カ諷九r遉コ縺励∪縺吶

    +

    繧ケ繝医Ξ繝シ繧ク荳翫ョFAT讒矩繧呈桃菴懊@縺ヲ縺繧矩比クュ縺ァ縲∝●髮サ縲∽ク肴ュ」縺ェ繝。繝繧」繧「縺ョ蜿悶j螟悶@縲∝屓蠕ゥ荳崎ス縺ェ繝繝シ繧ソ繝サ繧ィ繝ゥ繝シ遲峨ョ髫懷ョウ縺檎匱逕溘☆繧九→縲∝ヲ逅縺御クュ騾泌濠遶ッ縺ェ迥カ諷九〒荳ュ譁ュ縺輔l縲√◎縺ョ邨先棡縺ィ縺励※FAT繝懊Μ繝・繝シ繝縺ョ讒矩縺檎エ螢翫&繧後k蜿ッ閭ス諤ァ縺後≠繧翫∪縺吶よャ。縺ォFatFs繝「繧ク繝・繝シ繝ォ縺ォ縺翫¢繧九け繝ェ繝√き繝ォ繝サ繧サ繧ッ繧キ繝ァ繝ウ縺ィ縲√◎縺ョ髢薙ョ髫懷ョウ縺ォ繧医j襍キ縺阪≧繧九お繝ゥ繝シ縺ョ迥カ諷九r遉コ縺励∪縺吶

    蝗ウ4. 髟キ縺繧ッ繝ェ繝√き繝ォ繝サ繧サ繧ッ繧キ繝ァ繝ウ
    fig.4 @@ -233,20 +238,30 @@ _FS_LOCK 0 (Disable file lock control)
  • 譁ー隕上∪縺溘ッ荳頑嶌縺阪〒菴懈舌&繧後◆繝輔ぃ繧、繝ォ縺ョ髟キ縺輔′繧シ繝ュ縺ォ縺ェ縺」縺ヲ谿九k縲
  • 繝ュ繧ケ繝医メ繧ァ繝シ繝ウ縺ョ逋コ逕溘↓繧医j繝懊Μ繝・繝シ繝縺ョ蛻ゥ逕ィ蜉ケ邇縺梧が蛹悶☆繧九
  • -

    縺縺壹l繧よ嶌縺崎セシ縺ソ荳ュ繧謫堺ス懷ッセ雎。縺ァ縺ェ縺繝輔ぃ繧、繝ォ縺ォ縺ッ蠖ア髻ソ縺ッ縺ゅj縺セ縺帙s縲ゅ%繧後i縺ョ繧ッ繝ェ繝√き繝ォ繝サ繧サ繧ッ繧キ繝ァ繝ウ縺ッ縲√ヵ繧。繧、繝ォ繧呈嶌縺崎セシ縺ソ繝「繝シ繝峨〒髢九>縺ヲ縺繧区凾髢薙r譛蟆城剞縺ォ縺吶k縺九’_sync()繧帝←螳應スソ逕ィ縺吶k縺薙→縺ァ蝗ウ5縺ョ繧医≧縺ォ繝ェ繧ケ繧ッ繧呈怙蟆丞喧縺吶k縺薙→縺後〒縺阪∪縺吶

    +

    縺縺壹l繧よ嶌縺崎セシ縺ソ荳ュ繧謫堺ス懊ョ蟇セ雎。縺ァ縺ェ縺繝輔ぃ繧、繝ォ縺ォ縺ッ蠖ア髻ソ縺ッ縺ゅj縺セ縺帙s縲ゅ%繧後i縺ョ繧ッ繝ェ繝√き繝ォ繝サ繧サ繧ッ繧キ繝ァ繝ウ縺ッ縲√ヵ繧。繧、繝ォ繧呈嶌縺崎セシ縺ソ繝「繝シ繝峨〒髢九>縺ヲ縺繧区凾髢薙r譛蟆城剞縺ォ縺吶k縺九f_sync()繧帝←螳應スソ逕ィ縺吶k縺薙→縺ァ蝗ウ5縺ョ繧医≧縺ォ繝ェ繧ケ繧ッ繧呈怙蟆丞喧縺吶k縺薙→縺後〒縺阪∪縺吶

    +
    + +
    +

    API縺ョ諡。蠑オ逧菴ソ逕ィ萓

    +

    FatFs API縺ョ諡。蠑オ逧菴ソ逕ィ萓九〒縺吶よ怏逕ィ縺ェ繧ウ繝シ繝峨′縺ゅ▲縺溷エ蜷医ッ縲髫乗凾霑ス蜉縺励※縺縺阪∪縺吶ゅ

    +
      +
    1. 霑ス險倥Δ繝シ繝峨〒縺ョ繧ェ繝シ繝励Φ/譁ー隕丈ス懈
    2. +
    3. 繝繧」繝ャ繧ッ繝医Μ繧堤ゥコ縺ォ縺吶k
    4. +
    5. 繝輔ぃ繧、繝ォ縺ォ騾」邯夐伜沺繧貞牡繧雁ス薙※繧
    6. +

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

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

    /*----------------------------------------------------------------------------/
    -/  FatFs - FAT file system module  R0.09                    (C)ChaN, 2011
    +/  FatFs - FAT file system module  R0.09b                   (C)ChaN, 2013
     /-----------------------------------------------------------------------------/
     / FatFs繝「繧ク繝・繝シ繝ォ縺ッ縲∝ー剰ヲ乗ィ。縺ェ邨縺ソ霎シ縺ソ繧キ繧ケ繝繝蜷代¢縺ョ豎守畑FAT繝輔ぃ繧、繝ォ繧キ繧ケ繝繝繝サ
     / 繝「繧ク繝・繝シ繝ォ縺ァ縺吶ゅ%繧後ッ繝輔Μ繝シ繝サ繧ス繝輔ヨ繧ヲ繧ァ繧「縺ィ縺励※縲∵蕗閧イ繝サ遐皮ゥカ繝サ髢狗匱縺ョ縺溘a縺ォ
     / 莉・荳九ョ繝ゥ繧、繧サ繝ウ繧ケ繝サ繝昴Μ繧キ繝シ縺ョ荳九〒蜈ャ髢九&繧後※縺縺セ縺吶
     /
    -/  Copyright (C) 2011, ChaN, all right reserved.
    +/  Copyright (C) 2013, ChaN, all right reserved.
     /
     / * FatFs繝「繧ク繝・繝シ繝ォ縺ッ繝輔Μ繝シ繝サ繧ス繝輔ヨ繧ヲ繧ァ繧「縺ァ縺ゅj縲√∪縺辟。菫晁ィシ縺ァ縺縲
     / * 逕ィ騾斐↓蛻カ髯舌ッ縺ゅj縺セ縺帙s縲縺ゅ↑縺溘ョ雋ャ莉サ縺ョ荳九↓縺翫>縺ヲ縲∝倶ココ逧繝サ髱槫霧蛻ゥ逧縺ェ
    diff --git a/doc/ja/chdir.html b/doc/ja/chdir.html
    index 09ff901..5155f16 100644
    --- a/doc/ja/chdir.html
    +++ b/doc/ja/chdir.html
    @@ -16,7 +16,7 @@
     

    カレント・ディレクトリを変更します。

     FRESULT f_chdir (
    -  const XCHAR* Path /* ディレクトリ名へのポインタ */
    +  const TCHAR* path /* [IN] ディレクトリ名へのポインタ */
     );
     
    @@ -24,8 +24,8 @@ FRESULT f_chdir (

    引数

    -
    Path
    -
    移動対象のディレクトリのパス名の入った'\0'で終わる文字列を指定します。
    +
    path
    +
    移動対象のディレクトリのパス名を示すヌル文字'\0'終端の文字列を指定します。
    @@ -50,7 +50,7 @@ FRESULT f_chdir (

    解説

    -

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

    +

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

    @@ -63,10 +63,10 @@ FRESULT f_chdir (

    使用例

    -    // カレント・ドライブのカレント・ディレクトリを変更 (ルート下のdir1へ)
    +    /* カレント・ドライブのカレント・ディレクトリを変更 (ルート下のdir1へ) */
         f_chdir("/dir1");
     
    -    // ドライブ2のカレント・ディレクトリを変更 (親ディレクトリへ)
    +    /* ドライブ2のカレント・ディレクトリを変更 (親ディレクトリへ) */
         f_chdir("2:..");
     
    diff --git a/doc/ja/chdrive.html b/doc/ja/chdrive.html index 9c8fccf..d0e1ce7 100644 --- a/doc/ja/chdrive.html +++ b/doc/ja/chdrive.html @@ -16,7 +16,7 @@

    カレント・ドライブを変更します。

     FRESULT f_chdrive (
    -  BYTE Drive /* 論理ドライブ番号 */
    +  BYTE vol /* [IN] 論理ドライブ番号 */
     );
     
    @@ -24,7 +24,7 @@ FRESULT f_chdrive (

    引数

    -
    Drive
    +
    vol
    カレント・ドライブに設定する論理ドライブ番号を指定します。
    @@ -41,7 +41,7 @@ FRESULT f_chdrive (

    解説

    -

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

    +

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

    diff --git a/doc/ja/chmod.html b/doc/ja/chmod.html index fe489e5..f8ee6f2 100644 --- a/doc/ja/chmod.html +++ b/doc/ja/chmod.html @@ -16,9 +16,9 @@

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

     FRESULT f_chmod (
    -  const TCHAR* FileName, /* ファイルまたはディレクトリ名へのポインタ */
    -  BYTE Attribute,        /* 設定値 */
    -  BYTE AttributeMask     /* 変更マスク */
    +  const TCHAR* path, /* [IN] ファイルまたはディレクトリ名へのポインタ */
    +  BYTE attr,         /* [IN] 設定値 */
    +  BYTE mask          /* [IN] 変更マスク */
     );
     
    @@ -26,9 +26,9 @@ FRESULT f_chmod (

    引数

    -
    FileName
    -
    属性変更対象のファイルまたはディレクトリのパス名の入った'\0'で終わる文字列を指定します。
    -
    Attribute
    +
    path
    +
    属性変更対象のファイルまたはディレクトリパス名を示すヌル文字'\0'終端の文字列を指定します。
    +
    attr
    設定する属性。指定可能な属性は次の通りで、これらの組み合わせで指定します。指定されなかった属性は解除されます。
    @@ -38,8 +38,8 @@ FRESULT f_chmod (
    意味
    AM_HIDヒドゥン
    -
    AttributeMask
    -
    変更する属性のマスク。指定した属性が設定または解除され、指定されなかった属性は状態が保持されます。Attributeと同じ値を使います。
    +
    mask
    +
    変更する属性のマスク。指定した属性が設定または解除され、指定されなかった属性は状態が保持されます。attrと同じ値を使います。
    diff --git a/doc/ja/close.html b/doc/ja/close.html index 1e9c19d..3ad65bc 100644 --- a/doc/ja/close.html +++ b/doc/ja/close.html @@ -16,7 +16,7 @@

    ファイルを閉じます。

     FRESULT f_close (
    -  FIL* FileObject     /* ファイル・オブジェクトへのポインタ */
    +  FIL* fp     /* [IN] ファイル・オブジェクトへのポインタ */
     );
     
    @@ -24,7 +24,7 @@ FRESULT f_close (

    引数

    -
    FileObject
    +
    fp
    閉じようとするファイルのファイル・オブジェクト構造体へのポインタを指定します。
    diff --git a/doc/ja/dinit.html b/doc/ja/dinit.html index 5cf3f23..78233c0 100644 --- a/doc/ja/dinit.html +++ b/doc/ja/dinit.html @@ -16,7 +16,7 @@

    ディスク・ドライブを初期化します。

     DSTATUS disk_initialize (
    -  BYTE Drive      /* 物理ドライブ番号 */
    +  BYTE pdrv      /* [IN] 物理ドライブ番号 */
     );
     
    @@ -24,8 +24,8 @@ DSTATUS disk_initialize (

    引数

    -
    Drive
    -
    初期化する物理ドライブ番号(0-9)を指定します。
    +
    pdrv
    +
    初期化する物理ドライブ番号(0-9)が指定されます。
    @@ -38,7 +38,7 @@ DSTATUS disk_initialize (

    解説

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

    -

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

    +

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

    戻る

    diff --git a/doc/ja/dioctl.html b/doc/ja/dioctl.html index 52a3a15..d582fde 100644 --- a/doc/ja/dioctl.html +++ b/doc/ja/dioctl.html @@ -16,9 +16,9 @@

    セクタの読み書き以外のディスク・ドライブ自体に対する様々な制御をします。

     DRESULT disk_ioctl (
    -  BYTE Drive,      /* 物理ドライブ番号 */
    -  BYTE Command,    /* 制御コマンド */
    -  void* Buffer     /* データ受け渡しバッファ */
    +  BYTE pdrv,    /* [IN] 物理ドライブ番号 */
    +  BYTE cmd,     /* [IN] 制御コマンド */
    +  void* buff    /* [I/O] データ受け渡しバッファ */
     );
     
    @@ -26,12 +26,12 @@ DRESULT disk_ioctl (

    引数

    -
    Drive
    -
    物理ドライブ番号(0-9)を指定します。
    -
    Command
    -
    制御コマンド・コードを指定します。
    -
    Buffer
    -
    制御コマンドに依存したパラメータを授受するバッファを指すポインタを指定します。データの授受のないコマンドの場合は、NULLを指定します。
    +
    pdrv
    +
    物理ドライブ番号(0-9)が指定されます。
    +
    cmd
    +
    制御コマンド・コードが指定されます。
    +
    buff
    +
    制御コマンドに依存したパラメータを授受するバッファを指すポインタが指定されます。データの授受のないコマンドの場合は、値に意味はありません。
    @@ -55,10 +55,10 @@ DRESULT disk_ioctl ( - - - - + + + +
    コマンド解説
    CTRL_SYNCドライブがデータの書き込み処理を完了するのを待ちます。また、ライト・バック・キャッシュが存在する場合は、書き込まれていないデータを即時書き戻します。リード・オンリー構成では使用されません。
    GET_SECTOR_SIZEBufferの指すWORD変数にドライブのセクタ・サイズを返します。セクタ・サイズが固定(_MAX_SSが512)のときはこのコマンドは使われません。
    GET_SECTOR_COUNTBufferの指すDWORD変数にドライブ上の総セクタ数を返します。f_mkfs関数内で作成するボリュームのサイズを決定するために使用されます。
    GET_BLOCK_SIZEフラッシュ・メモリの消去ブロック・サイズをBufferの指すDWORD変数にセクタ単位で返します。1から32768でかつ2の累乗の値でなければなりません。不明な場合またはフラッシュ・メモリ以外のメディアでは1を返します。f_mkfs関数内でのみ使用され、ボリュームのデータ領域はこの境界にアライメントされます。
    CTRL_ERASE_SECTORフラッシュ・メモリの一部の領域を消去します。Bufferの指すDWORD配列には消去する領域 {開始セクタ,終了セクタ} を指定して呼び出します。この機能をサポートしない場合やフラッシュ・メモリ以外のメディアでは何もしません。この機能の戻り値はチェックされず、また、指定領域の消去が完全に行われなかったとしてもファイル・システムの動作には影響ありません。_USE_ERASEが1のとき、クラスタが解放されるときに呼び出されます。
    GET_SECTOR_SIZEbuffの指すWORD変数にドライブのセクタ・サイズを返します。セクタ・サイズが固定(_MAX_SSが512)のときはこのコマンドは使われません。
    GET_SECTOR_COUNTbuffの指すDWORD変数にドライブ上の総セクタ数を返します。f_mkfs()内で作成するボリュームのサイズを決定するために使用されます。
    GET_BLOCK_SIZEフラッシュ・メモリの消去ブロック・サイズをbuffの指すDWORD変数にセクタ単位で返します。1から32768でかつ2の累乗の値でなければなりません。不明な場合またはフラッシュ・メモリ以外のメディアでは1を返します。f_mkfs()内でのみ使用され、ボリュームのデータ領域はこの境界にアライメントされます。
    CTRL_ERASE_SECTORフラッシュ・メモリの一部の領域を消去します。buffの指すDWORD配列には消去する領域 {開始セクタ,終了セクタ} を指定して呼び出します。これは、ATAコマンド・セットのTrimコマンドと等価で、_USE_ERASEが1のとき、クラスタが解放されるときに呼び出されます。この機能をサポートしない場合やフラッシュ・メモリ以外のメディアでは何もしません。この機能の戻り値はチェックされず、また、指定領域の消去が完全に行われなかったとしてもFatFsの動作には影響ありません。
    diff --git a/doc/ja/dread.html b/doc/ja/dread.html index 9271649..7f4eee3 100644 --- a/doc/ja/dread.html +++ b/doc/ja/dread.html @@ -16,10 +16,10 @@

    ディスクからセクタを読み出します。

     DRESULT disk_read (
    -  BYTE Drive,          /* 物理ドライブ番号 */
    -  BYTE* Buffer,        /* 読み出しバッファへのポインタ */
    -  DWORD SectorNumber,  /* 読み出し開始セクタ番号 */
    -  BYTE SectorCount     /* 読み出しセクタ数 */
    +  BYTE pdrv,     /* [IN] 物理ドライブ番号 */
    +  BYTE* buff,    /* [OUT] 読み出しバッファへのポインタ */
    +  DWORD sector,  /* [IN] 読み出し開始セクタ番号 */
    +  BYTE count     /* [IN] 読み出しセクタ数 */
     );
     
    @@ -27,14 +27,14 @@ DRESULT disk_read (

    引数

    -
    Drive
    -
    物理ドライブ番号(0-9)を指定します。
    -
    Buffer
    -
    ディスクから読み出したデータを格納するバイト配列で、読み出されるバイト数分のサイズが必要です。指定されるアドレスはワード・アライメントされているとは限りません。
    -
    SectorNumber
    -
    読み出しを開始するセクタ番号。LBAで指定します。
    -
    SectorCount
    -
    読み出すセクタ数。 1〜128の範囲で指定します。一般的に、複数セクタの転送要求はデバイスに対して可能な限りマルチ・セクタ転送しなければなりません。複数のシングル・セクタ転送に分解した場合、読み出し速度が低下します。
    +
    pdrv
    +
    物理ドライブ番号(0-9)が指定されます。
    +
    buff
    +
    ディスクから読み出したデータを格納するバイト配列で、読み出されるバイト数分のサイズが必要です。指定されるアドレスは常にワード・アライメントされているとは限りません
    +
    sector
    +
    読み出しを開始するセクタ番号。LBAで指定されます。
    +
    count
    +
    読み出すセクタ数。 1〜128の範囲で指定されます。一般的に、複数セクタの転送要求はデバイスに対して可能な限りマルチ・セクタ転送しなければなりません。複数のシングル・セクタ読み出しに分解した場合、スループットが低下することがあります。
    diff --git a/doc/ja/dstat.html b/doc/ja/dstat.html index 0641478..920e2ef 100644 --- a/doc/ja/dstat.html +++ b/doc/ja/dstat.html @@ -16,7 +16,7 @@

    ディスク・ドライブの状態を取得します。

     DSTATUS disk_status (
    -  BYTE Drive           /* 物理ドライブ番号 */
    +  BYTE pdrv           /* [IN] 物理ドライブ番号 */
     );
     
    @@ -24,18 +24,18 @@ DSTATUS disk_status (

    引数

    -
    Drive
    -
    ステータスを取得する物理ドライブ番号を指定します。
    +
    pdrv
    +
    ステータスを取得する物理ドライブ番号が指定されます。

    戻り値

    -

    物理ドライブの状態が次のフラグの組み合わせの値で返されます。

    +

    物理ドライブの状態を次のフラグの組み合わせ値で返します。

    STA_NOINIT
    -
    ドライブが初期化されていないことを示すフラグ。システム・リセットやメディアの取り外し等でセットされ、disk_initialize() の正常終了でクリア、失敗でセットされます。
    +
    ドライブが初期化されていないことを示すフラグ。システム・リセットやメディアの取り外し等でセットされ、disk_initialize()の正常終了でクリア、失敗でセットされます。
    STA_NODISK
    メディアがセットされていないことを示すフラグ。メディアが取り外されている間はセットされ、メディアがセットされている間はクリアされます。固定ディスクでは常にクリアされています。
    STA_PROTECTED
    diff --git a/doc/ja/dwrite.html b/doc/ja/dwrite.html index 1192f47..716632b 100644 --- a/doc/ja/dwrite.html +++ b/doc/ja/dwrite.html @@ -16,10 +16,10 @@

    ディスクにデータを書き込みます。

     DRESULT disk_write (
    -  BYTE Drive,          /* 物理ドライブ番号 */
    -  const BYTE* Buffer,  /* 書き込むデータへのポインタ */
    -  DWORD SectorNumber,  /* 書き込み開始セクタ番号 */
    -  BYTE SectorCount     /* 書き込みセクタ数 */
    +  BYTE pdrv,        /* [IN] 物理ドライブ番号 */
    +  const BYTE* buff, /* [IN] 書き込むデータへのポインタ */
    +  DWORD sector,     /* [IN] 書き込み開始セクタ番号 */
    +  BYTE count        /* [IN] 書き込みセクタ数 */
     );
     
    @@ -27,14 +27,14 @@ DRESULT disk_write (

    引数

    -
    Drive
    -
    物理ドライブ番号(0-9)を指定します。
    -
    Buffer
    -
    ディスクに書き込むバイト配列を指定します。指定されるアドレスはワード・アライメントされているとは限りません。
    -
    SectorNumber
    -
    書き込みを開始するセクタ番号。LBAで指定します。
    -
    SectorCount
    -
    書き込むセクタ数。 1〜128で指定します。一般的に、複数セクタの転送要求はデバイスに対して可能な限りマルチ・セクタ転送しなければなりません。複数のシングル・セクタ転送に分解した場合、書き込み速度は極端に低下します。
    +
    pdrv
    +
    物理ドライブ番号(0-9)が指定されます。
    +
    buff
    +
    ディスクに書き込むバイト配列が指定されます。アドレスは常にワード・アライメントされているとは限りません
    +
    sector
    +
    書き込みを開始するセクタ番号。LBAで指定されます。
    +
    count
    +
    書き込むセクタ数。 1〜128の範囲で指定されます。一般的に、複数セクタの転送要求はデバイスに対して可能な限りマルチ・セクタ転送しなければなりません。複数のシングル・セクタ書き込みに分解した場合、スループットが極端に低下することがあります。
    @@ -59,6 +59,7 @@ DRESULT disk_write (

    解説

    リード・オンリー構成ではこの関数は必要とされません。

    +

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

    diff --git a/doc/ja/eof.html b/doc/ja/eof.html index 44e130c..3a84054 100644 --- a/doc/ja/eof.html +++ b/doc/ja/eof.html @@ -16,7 +16,7 @@

    リード/ライト・ポインタがファイル終端に達しているかどうか調べます。.

     int f_eof (
    -  FIL* FileObject   /* ファイル・オブジェクト */
    +  FIL* fp   /* [IN] ファイル・オブジェクト */
     );
     
    @@ -25,7 +25,7 @@ int f_eof (

    引数

    -
    FileObject
    +
    fp
    ファイル・オブジェクト構造体へのポインタを指定します。
    diff --git a/doc/ja/error.html b/doc/ja/error.html index e902ce1..070d8a7 100644 --- a/doc/ja/error.html +++ b/doc/ja/error.html @@ -16,7 +16,7 @@

    エラー発生の有無を調べます。

     int f_error (
    -  FIL* FileObject   /* ファイル・オブジェクト */
    +  FIL* fp   /* [IN] ファイル・オブジェクト */
     );
     
    @@ -25,7 +25,7 @@ int f_error (

    引数

    -
    FileObject
    +
    fp
    ファイル・オブジェクト構造体へのポインタを指定します。
    diff --git a/doc/ja/fdisk.html b/doc/ja/fdisk.html index 062fa42..ef6a75a 100644 --- a/doc/ja/fdisk.html +++ b/doc/ja/fdisk.html @@ -16,9 +16,9 @@

    物理ドライブを分割します。

     FRESULT f_fdisk (
    -  BYTE  Drive,              /* 物理ドライブ番号 */
    -  const DWORD Partitions[], /* 区画マップ・テーブル */
    -  void* Work                /* ワークエリア */
    +  BYTE  pdrv,         /* [IN] 物理ドライブ番号 */
    +  const DWORD part[], /* [IN] 区画マップ・テーブル */
    +  void* work          /* [-] ワークエリア */
     );
     
    @@ -26,11 +26,11 @@ FRESULT f_fdisk (

    引数

    -
    Drive
    +
    pdrv
    分割する物理ドライブを指定します。
    -
    Partitions[]
    +
    part[]
    区画マップ・テーブルへのポインタを指定します。
    -
    Work
    +
    work
    ワークエリアへのポインタを指定します。サイズは_MAX_SSバイト必要です。
    @@ -48,18 +48,18 @@ FRESULT f_fdisk (

    説明

    -

    f_fdisk関数は、指定された物理ドライブのMBRに区画テーブルを作成します。区画分けは一般的なFDISK形式で行うため、最大4つの基本区画を作成することができます。拡張区画には対応していません。区画マップテーブル Partitions[] にはドライブをどのように分割するか指定して渡します。この配列は4つの項目から成り、先頭の項目が1番目の、最後の項目が4番目の区画のサイズを示します。値が100以下の場合、ドライブの総容量に対する割合をパーセント単位で指定します。100を超える値の場合はセクタ数の直接指定になります。

    +

    この関数は、指定された物理ドライブのMBRに区画テーブルを作成します。区画分けは一般的なFDISK形式で行うため、最大4つの基本区画を作成することができます。拡張区画には対応していません。区画マップテーブルpart[]にはドライブをどのように分割するか指定して渡します。この配列は4つの項目から成り、先頭の項目が1番目の、最後の項目が4番目の区画のサイズを示します。値が100以下の場合、ドライブの総容量に対する割合をパーセント単位で指定します。100を超える値の場合はセクタ数の直接指定になります。

    対応情報

    -

    _FS_READOLNY == 0_USE_MKFS == 1_MULTI_PARTITION == 2 のとき使用可能です。

    +

    _FS_READOLNY == 0_USE_MKFS == 1_MULTI_PARTITION == 1 のとき使用可能です。

    使用例

    -    /* ユーザ定義のボリューム管理テーブル (_MULTI_PARTITION != 0 のとき必要) */
    +    /* ユーザ定義のボリューム管理テーブル (_MULTI_PARTITION == 1 のとき必要) */
     
         PARTITION VolToPart[] = {
             {0, 1},    /* 論理ドライブ 0 ==> 物理ドライブ 0, 第1区画 */
    diff --git a/doc/ja/filename.html b/doc/ja/filename.html
    index 888db03..41a28d1 100644
    --- a/doc/ja/filename.html
    +++ b/doc/ja/filename.html
    @@ -14,13 +14,13 @@
     

    繝輔ぃ繧、繝ォ繝サ繝繧」繝ャ繧ッ繝医Μ蜷

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

    -

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

    -

    FatFs繝「繧ク繝・繝シ繝ォ縺ッ髟キ縺繝輔ぃ繧、繝ォ蜷(LFN)縺翫h縺ウ8.3蠖「蠑上ヵ繧。繧、繝ォ蜷(SFN)縺ォ蟇セ蠢懊@縺ヲ縺縺セ縺吶LFN縺ッ縲(_USE_LFN > 0)縺ョ縺ィ縺堺スソ逕ィ蜿ッ閭ス縺ォ縺ェ繧翫∪縺吶ゅョ繧」繝ャ繧ッ繝医Μ繝サ繧サ繝代Ξ繝シ繧ソ縺ォ縺ッDOS/Windows API縺ィ蜷後§縺 / 縺ィ \ 繧剃スソ逕ィ縺励∪縺吶る」邯壹@縺溘そ繝代Ξ繝シ繧ソ縺ッ辟。隕悶&繧1蛟九→縺励※謇ア繧上l縺セ縺吶ょ髪荳縺ョ驕輔>縺ッ縲∬ォ也炊繝峨Λ繧、繝悶ョ謖螳壹□縺代〒縺吶りォ也炊繝峨Λ繧、繝也分蜿キ縺ッ縲'0'ス'9'縺ョ荳譁蟄励ョ謨ー蟄励→繧ウ繝ュ繝ウ縺ァ謖螳壹@縲∫怐逡・縺励◆蝣エ蜷医ッ繝繝輔か繝ォ繝医サ繝峨Λ繧、繝(0縺セ縺溘ッ繧ォ繝ャ繝ウ繝医サ繝峨Λ繧、繝)縺碁∈謚槭&繧後∪縺吶

    -

    Nul譁蟄励→蛻カ蠕。譁蟄(\0ス杤x1F)縺ッ縲√ヱ繧ケ蜷阪ョ邨らォッ縺ィ縺励※隱崎ュ倥&繧後∪縺吶ゅヱ繧ケ蜷阪↓蜈郁。後≠繧九>縺ッ荳ュ縺ォ蜷ォ縺セ繧後k繧ケ繝壹シ繧ケ縺ッ縲´FN讒区舌〒縺ッ蜷榊燕縺ョ荳驛ィ縺ィ縺励※譛牙柑縺ァ縺吶′縲髱朖FN讒区舌〒縺ッ繧ケ繝壹シ繧ケ縺ッ繝代せ蜷阪ョ邨らォッ縺ィ縺励※隱崎ュ倥&繧後∪縺吶

    -

    讓呎コ匁ァ区(_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 API縺ィ蜷後§縺'/'縺ィ'\'繧剃スソ逕ィ縺励∪縺吶る」邯壹@縺溘そ繝代Ξ繝シ繧ソ縺ッ辟。隕悶&繧1蛟九→縺励※謇ア繧上l縺セ縺吶ょ髪荳縺ョ驕輔>縺ッ縲∬ォ也炊繝峨Λ繧、繝悶ョ謖螳壹□縺代〒縺吶りォ也炊繝峨Λ繧、繝也分蜿キ縺ッ縲'0''9'縺ョ荳譁蟄励ョ謨ー蟄励→繧ウ繝ュ繝ウ縺ァ謖螳壹@縲∫怐逡・縺励◆蝣エ蜷医ッ繝繝輔か繝ォ繝医サ繝峨Λ繧、繝(0縺セ縺溘ッ繧ォ繝ャ繝ウ繝医サ繝峨Λ繧、繝)縺碁∈謚槭&繧後∪縺吶

    +

    繝後Ν譁蟄励→蛻カ蠕。譁蟄('\0''\x1F')縺ッ縲√ヱ繧ケ蜷阪ョ邨らォッ縺ィ縺励※隱崎ュ倥&繧後∪縺吶ゅヱ繧ケ蜷阪↓蜈郁。後≠繧九>縺ッ荳ュ縺ォ蜷ォ縺セ繧後k繧ケ繝壹シ繧ケ縺ッ縲´FN讒区舌〒縺ッ蜷榊燕縺ョ荳驛ィ縺ィ縺励※譛牙柑縺ァ縺吶′縲髱朖FN讒区舌〒縺ッ繧ケ繝壹シ繧ケ縺ッ繝代せ蜷阪ョ邨らォッ縺ィ縺励※隱崎ュ倥&繧後∪縺吶

    +

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

    +

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

    - + @@ -38,11 +38,11 @@


    Unicode API

    -

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

    +

    繝輔ぃ繧、繝ォ髢「謨ー縺ョ蜈・蜃コ蜉帙ョ縺縺。繝輔ぃ繧、繝ォ蜷阪d繝代せ蜷阪r謖螳壹☆繧句シ墓焚縺ョ蝙九ッ縲TCHAR縺ァ螳夂セゥ縺輔l縺ヲ縺縺セ縺吶′縲√%繧後ッ騾壼クク縺ッchar縺ョ繧ィ繝ェ繧「繧ケ縺ォ縺ェ縺」縺ヲ縺縺セ縺吶ゅ◎縺励※縲_CODE_PAGE縺ァ謖螳壹&繧後kANSI/OEM繧ウ繝シ繝(SBCS縺セ縺溘ッDBCS)縺ョ譁蟄怜励→縺励※謇ア繧上l縺セ縺吶ゅヵ繧。繧、繝ォ蜷榊・蜃コ蜉帙rUnicode縺ィ縺吶k讒区(_LFN_UNICODE == 1)縺ォ縺励◆縺ィ縺阪ッ縲TCHAR縺ッ繝ッ繧、繝画枚蟄(WCHAR, unsigned short)縺ォ蛻繧頑崛繧上j縲√ヱ繧ケ蜷阪ョ蜈・蜃コ蜉帙↓Unicode繧剃スソ逕ィ縺吶k繧医≧縺ォ縺ェ繧翫∪縺吶ゅ%繧後↓繧医jLFN隕乗シ縺ォ螳悟ィ蟇セ蠢懊→縺ェ繧翫、NSI/OEM繧ウ繝シ繝峨↓縺ェ縺譁蟄(縺溘→縺医ー 笨昶亂笨。笘ク笘ュ縺ェ縺ゥ)繧ゆスソ逕ィ縺ァ縺阪∪縺吶ゅ%縺ョ險ュ螳壹ッ譁蟄怜怜・蜃コ蜉幃未謨ー縺ョ繝繝シ繧ソ蝙九→繧ィ繝ウ繧ウ繝シ繝繧」繝ウ繧ー縺ォ繧ょスア髻ソ繧剃ク弱∴縺セ縺吶ゅΜ繝繝ゥ繝ォ譁蟄怜励r螳夂セゥ縺吶k縺ィ縺阪∵ャ。縺ォ遉コ縺吶h縺縺ォ_T(s)縺翫h縺ウ_TEXT(s)繝槭け繝ュ繧剃スソ縺」縺ヲANSI/OEM縺ィUnicode繧定ェ蜍募繧頑崛縺医☆繧九%縺ィ縺後〒縺阪∪縺吶

      f_open(fp, "filename.txt", FA_READ);      /* ANSI/OEM蟆ら畑繧ウ繝シ繝 */
      f_open(fp, L"filename.txt", FA_READ);     /* Unicode蟆ら畑繧ウ繝シ繝 */
    - f_open(fp, _T("filename.txt"), FA_READ);  /* 荳。逕ィ繧ウ繝シ繝 */
    + f_open(fp, _T("filename.txt"), FA_READ);  /* 荳。逕ィ繧ウ繝シ繝(閾ェ蜍募繧頑崛縺) */
     
    @@ -66,6 +66,8 @@ PARTITION VolToPart[] = {
  • 繝槭え繝ウ繝亥庄閭ス縺ェ蛹コ逕サ縺ッ蝓コ譛ャ蛹コ逕サ縺ョ縺ソ縺ァ縲∵僑蠑オ蛹コ逕サ蜀縺ォ縺ッ蟇セ蠢懊@縺ェ縺縲
  • 隍謨ー縺ョ蛹コ逕サ繧呈戟縺、迚ゥ逅繝峨Λ繧、繝悶ッ縲髱槭Μ繝繝シ繝舌ヶ繝ォ縺ァ縺ェ縺代l縺ー縺ェ繧峨↑縺縲
  • + +隲也炊繝峨Λ繧、繝悶→迚ゥ逅繝峨Λ繧、繝悶ョ髢「菫 diff --git a/doc/ja/forward.html b/doc/ja/forward.html index fd40730..a5191c5 100644 --- a/doc/ja/forward.html +++ b/doc/ja/forward.html @@ -16,10 +16,10 @@

    ファイルからデータを読み出し、送信ストリームに直接転送します。

     FRESULT f_forward (
    -  FIL* FileObject,                 /* ファイル・オブジェクト構造体 */
    -  UINT (*Func)(const BYTE*,UINT),  /* データ転送関数 */
    -  UINT ByteToFwd,                  /* 転送するバイト数 */
    -  UINT* ByteFwd                    /* 転送されたバイト数 */
    +  FIL* fp,                         /* [IN] ファイル・オブジェクト構造体 */
    +  UINT (*func)(const BYTE*,UINT),  /* [IN] データ転送関数 */
    +  UINT btf,                        /* [IN] 転送するバイト数 */
    +  UINT* bf                         /* [OUT] 転送されたバイト数 */
     );
     
    @@ -27,13 +27,13 @@ FRESULT f_forward (

    引数

    -
    FileObject
    +
    fp
    ファイル・オブジェクト構造体へのポインタを指定します。
    -
    Func
    +
    func
    データを渡すユーザ定義関数へのポインタを指定します。この関数の仕様はサンプルを参照してください。
    -
    ByteToRead
    +
    btf
    転送するバイト数(0〜UINTの最大値)を指定します。
    -
    ByteRead
    +
    bf
    実際に転送されたバイト数を格納する変数を指すポインタを指定します。
    @@ -55,7 +55,7 @@ FRESULT f_forward (

    解説

    -

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

    +

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

    diff --git a/doc/ja/getcwd.html b/doc/ja/getcwd.html index 1f42df3..f7d0385 100644 --- a/doc/ja/getcwd.html +++ b/doc/ja/getcwd.html @@ -16,8 +16,8 @@

    カレント・ディレクトリを得ます

     FRESULT f_getcwd (
    -  TCHAR* Buffer,  /* バッファ */
    -  UINT BufferLen  /* バッファ・サイズ */
    +  TCHAR* buff, /* [OUT] バッファ */
    +  UINT len     /* [IN] バッファ・サイズ */
     );
     
    @@ -25,9 +25,9 @@ FRESULT f_getcwd (

    引数

    -
    Buffer
    +
    buff
    カレント・ディレクトリの文字列を格納するバッファ
    -
    BufferLen
    +
    len
    TCHAR単位のバッファ・サイズ
    @@ -50,7 +50,7 @@ FRESULT f_getcwd (

    解説

    -

    f_getcwd関数は、カレント・ドライブのカレント・ディレクトリのパス文字列を取得します。パス文字列は、ドライブ番号を含んだフル・パス名です。

    +

    カレント・ドライブのカレント・ディレクトリのパス文字列を取得します。パス文字列は、ドライブ番号を含んだフル・パス名です。

    diff --git a/doc/ja/getfree.html b/doc/ja/getfree.html index 53c6339..a2a4c5e 100644 --- a/doc/ja/getfree.html +++ b/doc/ja/getfree.html @@ -16,9 +16,9 @@

    論理ドライブ上の未使用クラスタ数を得ます。

     FRESULT f_getfree (
    -  const TCHAR* Path,       /* 対象ドライブを指定します */
    -  DWORD* Clusters,         /* 空きクラスタ数を格納する変数へのポインタ */
    -  FATFS** FileSystemObject /* ファイル・システム・オブジェクトを指すポインタへのポインタ */
    +  const TCHAR* path,  /* [IN] 対象ドライブを指定します */
    +  DWORD* nclst,       /* [OUT] 空きクラスタ数を格納する変数へのポインタ */
    +  FATFS** fatfs       /* [OUT] ファイル・システム・オブジェクトを指すポインタへのポインタ */
     );
     
    @@ -26,11 +26,11 @@ FRESULT f_getfree (

    引数

    -
    Path
    -
    調べる対象の論理ドライブを示すパス名が入った'\0'で終わる文字列へのポインタを指定します。
    -
    Clusters
    +
    path
    +
    調べる対象の論理ドライブを示すパス名を示すヌル文字'\0'終端の文字列へのポインタを指定します。ヌル文字列はカレント・ドライブを意味します。
    +
    nclst
    空きクラスタ数を格納するDWORD変数へのポインタを指定します。
    -
    FileSystemObject
    +
    fatfs
    対象ドライブのファイル・システム・オブジェクトを指すポインタが返されます。
    @@ -78,10 +78,9 @@ FRESULT f_getfree ( tot_sect = (fs->n_fatent - 2) * fs->csize; fre_sect = fre_clust * fs->csize; - /* ドライブサイズと空きサイズの表示 (512バイト/セクタと仮定) */ - printf("%lu KB total drive space.\n" - "%lu KB available.\n", - fre_sect / 2, tot_sect / 2); + /* ボリュームとと空きのサイズをKiB単位で表示 (512バイト/セクタと仮定) */ + printf("%lu KB total drive space.\n%lu KB available.\n", + tot_sect / 2, fre_sect / 2); diff --git a/doc/ja/getlabel.html b/doc/ja/getlabel.html new file mode 100644 index 0000000..1b5e710 --- /dev/null +++ b/doc/ja/getlabel.html @@ -0,0 +1,82 @@ + + + + + + + + +FatFs - f_getlabel + + + + +
    +

    f_getlabel

    +

    ボリューム・ラベルを取得します。

    +
    +FRESULT f_getlabel (
    +  const TCHAR* path,  /* [IN] 対象ドライブ */
    +  TCHAR* name,        /* [OUT] ボリューム名を格納するバッファ */
    +  DWORD* sn           /* [OUT] ボリューム・シリアル番号を格納する変数 */
    +);
    +
    +
    + +
    +

    引数

    +
    +
    path
    +
    対象となる論理ドライブのパス名を示すヌル文字'\0'終端の文字列へのポインタを指定します。ヌル文字列の場合は、デフォルト・ドライブを指定したことになります。
    +
    name
    +
    ボリューム名を格納する配列へのポインタを指定します。少なくとも12要素のサイズが必要です。ボリューム名がない場合はヌル文字列が返されます。この情報が不要なときはヌル・ポインタを指定してください。
    +
    sn
    +
    ボリューム・シリアル番号を格納するDWORD変数へのポインタを指定します。この情報が不要なときはヌル・ポインタを指定してください。
    +
    +
    + + + + + +
    +

    対応情報

    +

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

    +
    + + +
    +

    使用例

    +
    +    char str[12];
    +
    +    /* デフォルト・ドライブのボリューム名を得る */
    +    f_getlabel("", str, 0);
    +
    +    /* ドライブ2のボリューム名を得る */
    +    f_getlabel("2:", str, 0);
    +
    +
    + + +
    +

    参照

    +f_setlabel +
    + + +

    戻る

    + + diff --git a/doc/ja/gets.html b/doc/ja/gets.html index 7a603dd..f915c02 100644 --- a/doc/ja/gets.html +++ b/doc/ja/gets.html @@ -16,9 +16,9 @@

    ファイルから文字列を読み出します。

     TCHAR* f_gets (
    -  TCHAR* Str,       /* バッファ */
    -  int Size,         /* バッファのサイズ */
    -  FIL* FileObject   /* ファイル・オブジェクト */
    +  TCHAR* buff, /* [OUT] バッファ */
    +  int len,     /* [IN] バッファのサイズ */
    +  FIL* fp      /* [IN] ファイル・オブジェクト */
     );
     
    @@ -26,11 +26,11 @@ TCHAR* f_gets (

    引数

    -
    Str
    +
    buff
    文字列を読み出すバッファを指すポインタを指定します。
    -
    Size
    +
    len
    バッファのサイズを要素数で指定します。
    -
    FileObject
    +
    fp
    ファイル・オブジェクト構造体へのポインタを指定します。
    @@ -38,20 +38,20 @@ TCHAR* f_gets (

    戻り値

    -

    関数が成功するとStrが返されます。

    +

    関数が成功するとbuffが返されます。

    解説

    -

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

    +

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

    APIにUnicodeが選択されている(_LFN_UNICODEが1)ときは、UTF-8エンコードのテキスト・ファイルとしてUCS-2に変換してバッファに読み込みます。それ以外の時は無変換(1文字1バイト)で読み込みます。

    対応情報

    -

    _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 5db5cbf..d00f3f0 100644 --- a/doc/ja/lseek.html +++ b/doc/ja/lseek.html @@ -16,8 +16,8 @@

    ファイルのリード/ライト・ポインタを移動します。また、高速シーク機能使用時にはCLMT(後述)の作成にも使用します。

     FRESULT f_lseek (
    -  FIL* FileObject,    /* ファイル・オブジェクト構造体へのポインタ */
    -  DWORD Offset        /* 移動先オフセット */
    +  FIL* fp,    /* [IN] ファイル・オブジェクト構造体へのポインタ */
    +  DWORD ofs   /* [IN] 移動先オフセット */
     );
     
    @@ -25,10 +25,10 @@ FRESULT f_lseek (

    引数

    -
    FileObject
    +
    fp
    対象となるファイル・オブジェクト構造体へのポインタを指定します。
    -
    Offset
    -
    移動先のオフセット(リード/ライト・ポインタ)値。ファイル先頭からのオフセットをバイト単位で指定します。
    +
    ofs
    +
    移動先のオフセット(リード/ライト・ポインタ)値。ファイル先頭からのオフセットをバイト単位で指定します。
    @@ -49,13 +49,13 @@ FRESULT f_lseek (

    解説

    -

    ファイルのリード/ライト・ポインタ(次に読み出し・書き込みされるバイトのオフセット)を移動します。オフセットの原点はファイル先頭です。書き込みモードでファイル・サイズより大きな値を指定すると、そこまでファイル・サイズが拡張され、拡張された部分のデータは未定義となります。データを遅延無く高速に書き込みたいときは、予めこの関数で必要なサイズまでファイル・サイズを拡張しておくと良いでしょう。f_lseek関数が正常終了したあとは、リード/ライト・ポインタが正しく移動したかチェックするべきです。リード/ライト・ポインタが指定より小さいときは、次の原因が考えられます。

    +

    ファイルのリード/ライト・ポインタ(次に読み出し・書き込みされるバイトのオフセット)を移動します。オフセットの原点はファイル先頭です。書き込みモードでファイル・サイズより大きな値を指定すると、そこまでファイル・サイズが拡張され、拡張された部分のデータは未定義となります。データを遅延無く高速に書き込みたいときは、予めこの関数で必要なサイズまでファイル・サイズを拡張しておくと良いでしょう。f_lseek()が正常終了したあとは、リード/ライト・ポインタが正しく移動したかチェックするべきです。リード/ライト・ポインタが指定より小さいときは、次の原因が考えられます。

    • 非書き込みモードまたは高速シーク・モードのため、ファイル・サイズでクリップされた。
    • ファイル拡張中にディスクが満杯になった。
    -

    _USE_FASTSEEKが1で、且つファイル・オブジェクトのcltblメンバがNULL以外(f_open()でNULLに設定される)のとき、高速シーク・モードになります。これはファイルのクラスタ配置情報(CLMT)をメモリ上に保持しておくことにより、FATにアクセスすることなく後方シークやロング・シークを高速に行う機能です。高速シーク・モードは、f_read/f_wtite関数の動作にも適用されます。高速シーク・モードではf_wtite/f_lseek関数によるファイル・サイズの拡張はできません。

    -

    高速シーク動作を行う前に、CLMTを作成しておく必要があります。これを作成するには、まずCLMT格納バッファ(DWORD配列)を準備し、cltblメンバにそのポインタをセットします。そして、配列の先頭要素にその配列のサイズ(要素数)を入れ、f_lseek関数をOffsetCREATE_LINKMAPを指定して呼び出します。関数が成功するとCLMTが作成され、以降のf_read/f_write/f_lseek関数ではFATへのアクセスは発生しません。FR_NOT_ENOUGH_COREで失敗したときは配列サイズが不足で、先頭要素には実際に必要となる要素数が返されます。必要な要素数は、(ファイルの分割数 + 1) * 2 です。たとえば、ファイルが5つのフラグメントに分断されているときに必要な要素数は、12となります。

    +

    _USE_FASTSEEKが1で、且つファイル・オブジェクトのcltblメンバがNULL以外(f_open()でNULLに設定される)のとき、高速シーク・モードになります。これはファイルのクラスタ配置情報(CLMT)をメモリ上に保持しておくことにより、FATにアクセスすることなく後方シークやロング・シークを高速に行う機能です。高速シーク・モードは、f_read()/f_wtite()の動作にも適用されます。高速シーク・モードではf_wtite()/f_lseek()によるファイル・サイズの拡張はできません。

    +

    高速シーク動作を行う前に、CLMTを作成しておく必要があります。これを作成するには、まずCLMT格納バッファ(DWORD型配列)を準備し、cltblメンバにそのポインタをセットします。そして、配列の先頭要素にその配列のサイズ(要素数)を入れ、f_lseek()ofsCREATE_LINKMAPを指定して呼び出します。関数が成功するとCLMTが作成され、以降のf_read()/f_write()/f_lseek()ではFATへのアクセスは発生しません。FR_NOT_ENOUGH_COREで失敗したときは配列サイズが不足で、先頭要素には実際に必要となる要素数が返されます。必要な要素数は、(ファイルの分割数 + 1) * 2 です。たとえば、ファイルが5つのフラグメントに分断されているときに必要な要素数は、12となります。

    @@ -69,53 +69,52 @@ FRESULT f_lseek (

    使用例

         /* ファイルを開く */
    -    file = malloc(sizeof(FIL));
    -    if (!file) ...
    -    res = f_open(file, "file.dat", FA_READ|FA_WRITE);
    +    fp = malloc(sizeof(FIL));
    +    res = f_open(fp, "file.dat", FA_READ|FA_WRITE);
         if (res) ...
     
         /* ファイル・オフセット5000へ移動 */
    -    res = f_lseek(file, 5000);
    +    res = f_lseek(fp, 5000);
     
         /* ファイル終端へ移動(ファイル追記の準備) */
    -    res = f_lseek(file, f_size(file));
    +    res = f_lseek(fp, f_size(fp));
     
         /* 3000バイト進める */
    -    res = f_lseek(file, f_tell(file) + 3000);
    +    res = f_lseek(fp, f_tell(fp) + 3000);
     
         /* 2000バイト戻す (オーバーフローに注意) */
    -    res = f_lseek(file, f_tell(file) - 2000);
    +    res = f_lseek(fp, f_tell(fp) - 2000);
     
         /* クラスタ先行割り当て (ストリーミング・ライト時のバッファ・オーバーラン防止) */
     
    -    res = f_open(file, "record.wav", FA_CREATE_NEW | FA_WRITE);  /* ファイル作成 */
    +    res = f_open(fp, "record.wav", FA_CREATE_NEW | FA_WRITE);    /* ファイル作成 */
     
    -    res = f_lseek(file, MAX_SIZE);           /* 十分なクラスタの先行割り当て */
    -    if (res || f_tell(file) != PRE_SIZE) ... /* 正しくファイルが拡張されたかチェック */
    +    res = f_lseek(fp, MAX_SIZE);             /* 十分なクラスタの先行割り当て */
    +    if (res || f_tell(fp) != PRE_SIZE) ...   /* 正しくファイルが拡張されたかチェック */
     
    -    res = f_lseek(file, DATA_START);         /* データ・ストリームの記録(アロケーションディレイ無し) */
    +    res = f_lseek(fp, DATA_START);           /* データ・ストリームの記録(アロケーションディレイ無し) */
         ...
     
    -    res = f_truncate(file);                  /* 不要領域の切り捨て */
    -    res = f_lseek(file, 0);                  /* ヘッダの記録 */
    +    res = f_truncate(fp);                    /* 不要領域の切り捨て */
    +    res = f_lseek(fp, 0);                    /* ヘッダの記録 */
         ...
     
    -    res = f_close(file);
    +    res = f_close(fp);
     
         /* 高速シーク機能を使う */
     
         DWORD lktbl[SZ_TBL];                   /* リンク・マップ・テーブル格納バッファ */
     
    -    res = f_lseek(file, ofs1);             /* 通常シーク (オープン時、file.cltbl == NULL) */
    +    res = f_lseek(fp, ofs1);               /* 通常シーク (オープン時、cltblはNULLに初期化される) */
     
    -    file.cltbl = lktbl;                    /* 高速シーク機能の有効化 */
    +    fp->cltbl = lktbl;                     /* 高速シーク機能の有効化 (cltbl != NULL) */
         lktbl[0] = SZ_TBL;                     /* 先頭要素に配列要素数をセット */
    -    res = f_lseek(file, CREATE_LINKMAP);   /* CLMTの作成 */
    +    res = f_lseek(fp, CREATE_LINKMAP);     /* CLMTの作成 */
         ...
     
    -    res = f_lseek(file, ofs2);             /* 以降、f_read/f_write/f_lseekでFATアクセスが発生しない */
    +    res = f_lseek(fp, ofs2);               /* 以降、f_read/f_write/f_lseekでFATアクセスが発生しない */
     
    diff --git a/doc/ja/mkdir.html b/doc/ja/mkdir.html index c08f212..a0f7158 100644 --- a/doc/ja/mkdir.html +++ b/doc/ja/mkdir.html @@ -16,7 +16,7 @@

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

     FRESULT f_mkdir (
    -  const TCHAR* DirName /* 作成するディレクトリ名へのポインタ */
    +  const TCHAR* path /* [IN] 作成するディレクトリ名へのポインタ */
     );
     
    @@ -24,8 +24,8 @@ FRESULT f_mkdir (

    引数

    -
    DirName
    -
    作成するディレクトリのパス名が入った'\0'で終わる文字列へのポインタを指定します。
    +
    path
    +
    作成するディレクトリのパス名を示すヌル文字'\0'終端の文字列へのポインタを指定します。
    diff --git a/doc/ja/mkfs.html b/doc/ja/mkfs.html index a9eb80d..130cd9f 100644 --- a/doc/ja/mkfs.html +++ b/doc/ja/mkfs.html @@ -16,9 +16,9 @@

    論理ドライブ上にFATボリュームを作成(フォーマット)します。

     FRESULT f_mkfs (
    -  BYTE  Drive,              /* 論理ドライブ番号 */
    -  BYTE  PartitioningRule,   /* 区画作成方法 */
    -  UINT  AllocSize           /* クラス・タサイズ */
    +  BYTE  vol,   /* [IN] 論理ドライブ番号 */
    +  BYTE  sfd,   /* [IN] 区画作成方法 */
    +  UINT  au     /* [IN] クラス・タサイズ */
     );
     
    @@ -26,12 +26,12 @@ FRESULT f_mkfs (

    引数

    -
    Drive
    -
    フォーマットする論理ドライブ(0-9)。
    -
    PartitioningRule
    -
    パーテーション形式(0(FDISK) または1(SFD))を指定します。
    -
    AllocSize
    -
    クラスタ・サイズをバイト単位で指定します。2の累乗、且つセクタ・サイズ以上、且つセクタ・サイズの128倍以下でなければなりません。0を指定した場合、ボリュームのサイズに応じたデフォルトのクラスタ・サイズが選択されます。
    +
    vol
    +
    フォーマットする論理ドライブ。(0 〜 _VOLUMES - 1)
    +
    sfd
    +
    パーテーション形式。(0(FDISK) or 1(SFD))
    +
    au
    +
    クラスタ・サイズをバイト単位で指定します。対象ドライブのセクタ・サイズのn倍(n = 1〜128で、2の累乗)でなければなりません。0を指定した場合、ボリュームのサイズに応じたデフォルトのクラスタ・サイズが選択されます。
    @@ -49,11 +49,11 @@ FRESULT f_mkfs (

    説明

    -

    f_mkfs関数は物理ドライブ上にFATボリュームを作成します。第二引数でFDISK形式が指定された場合は、物理ドライブ全体を占める基本区画(パーテーション)が作成され、その中にFATボリュームが作成されます。SFD形式では、FATボリュームは物理ドライブの先頭からベタで作成されます。

    -

    マルチパーテーション機能(_MULTI_PARTITION)により、指定された論理ドライブが特定の区画(1〜4)に結び付けられている場合、その区画の中にFATボリュームが作成されます。この場合、第二引数は無視され、また対応する物理ドライブはこれに先立ち、f_fdisk関数または他のツールで適切に区画設定されている必要があります。

    -

    パーテーション形式には、FDISK形式とSFD形式の二通りありがあります。FDISK形式は、ハードディスク、MMC、SDC、CFCなどで使用されます。FDISK形式では一台の物理ドライブ上に一つまたは複数の区画を作成することができます。管理情報はMBR(物理ドライブの先頭セクタ)に記録されます。SFD形式は単に何の分割も行わない形式で、ボリュームは物理ドライブの先頭セクタから開始します。SFD形式は、フロッピーディスク、マイクロドライブ、光学ディスク、およびその他スーパーフロッピーメディアで使用されています。

    +

    物理ドライブ上にFATボリュームを作成します。FDISK形式が指定された場合は、物理ドライブ全体を占める基本区画(パーテーション)が作成され、その中にFATボリュームが作成されます。SFD形式では、FATボリュームは物理ドライブの先頭セクタからベタで作成されます。

    +

    マルチパーテーション機能(_MULTI_PARTITION)により、指定された論理ドライブが特定の区画(1〜4)に結び付けられている場合、その区画の中にFATボリュームが作成されます。この場合、sfdは無視され、また対応する物理ドライブはこれに先立ち、f_fdisk()または他のツールで適切に区画設定されている必要があります。

    +

    パーテーション形式には、FDISK形式とSFD形式の二通りあります。FDISK形式は、ハードディスク、MMC、SDC、CFCなどで使用されます。FDISK形式では一台の物理ドライブ上に一つまたは複数の区画を作成することができます。管理情報はMBR(物理ドライブの先頭セクタ)に記録されます。SFD形式は単に何の分割も行わない形式で、ボリュームは物理ドライブの先頭セクタから開始します。SFD形式は、フロッピーディスク、マイクロドライブ、光学ディスク、およびその他スーパーフロッピーメディアで使用されています。

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

    -

    クラスタ数がFATタイプの境界に近くなるときは、FR_MKFS_ABORTEDで関数が失敗する可能性があります。

    +

    クラスタ数がFATタイプの境界に近くなるときは、FR_MKFS_ABORTEDで関数が失敗する可能性があります。

    diff --git a/doc/ja/mount.html b/doc/ja/mount.html index 5a14820..e057d5b 100644 --- a/doc/ja/mount.html +++ b/doc/ja/mount.html @@ -13,11 +13,11 @@

    f_mount

    -

    論理ドライブのワーク・エリアを登録・抹消します。

    +

    論理ドライブにファイル・システム・オブジェクトを登録・抹消します。

     FRESULT f_mount (
    -  BYTE  Drive,               /* 論理ドライブ番号 */
    -  FATFS*  FileSystemObject   /* ワーク・エリアへのポインタ */
    +  BYTE  vol,      /* [IN] 論理ドライブ番号 */
    +  FATFS*  fatfs   /* [IN] ワーク・エリアへのポインタ */
     );
     
    @@ -25,10 +25,10 @@ FRESULT f_mount (

    引数

    -
    Drive
    -
    論理ドライブ番号(0-9)。
    -
    FileSystemObject
    -
    登録するワーク・エリア(ファイル・システム・オブジェクト)へのポインタ。
    +
    vol
    +
    論理ドライブ番号(0 〜 _VOLUMES - 1)。
    +
    fatfs
    +
    登録するファイル・システム・オブジェクトへのポインタ。
    @@ -43,8 +43,13 @@ FRESULT f_mount (

    解説

    -

    FatFsモジュールではそれぞれの論理ドライブにファイル・システム・オブジェクトというワーク・エリアが必要です。この関数は論理ドライブにそのワーク・エリアを登録したり抹消したりします。何らかのファイル関数を使用する前にこの関数でその論理ドライブのワーク・エリアを与えておかなければなりません。FileSystemObjectにヌル・ポインタを指定するとその論理ドライブのワーク・エリアの登録は抹消され、登録されていたワーク・エリアは破棄できます。操作対象のドライブに対して開かれているファイルやディレクトリがあった場合、それらは全て無効になります。

    -

    この関数は、ドライブの状態に関わらず常に成功します。関数内では下位レイヤ(物理ドライブ)へのアクセスは発生せず、ワーク・エリアを初期化して内部配列にそのアドレスを登録するだけです。実際のマウント動作は、この関数の実行またはメディア交換発生の後、最初のファイル・アクセスのときに行われます。

    +

    FatFsモジュールでは、それぞれの論理ドライブにファイル・システム・オブジェクトというワーク・エリアが必要です。この関数は論理ドライブにそのワーク・エリアを登録したり抹消したりします。何らかのファイル関数を使用する前に、この関数でその論理ドライブのワーク・エリアを与えておかなければなりません。fatfsにヌル・ポインタを指定するとワーク・エリアの登録は抹消され、登録されていたワーク・エリアは破棄できます。操作対象のドライブに対して開かれているファイルやディレクトリがあった場合、それらは全て無効になります。

    +

    この関数は、物理ドライブの状態に関わらず常に成功します。関数内では下位レイヤへのアクセスは発生せず、指定されたワーク・エリアをクリア(無効化)し、そのアドレスを内部配列に登録するだけです。単に登録済みのワーク・エリアをクリアする目的にも使えます。ボリュームへのアクセス開始のとき次のうちいずれかまたは両方の条件が真のとき、実際のマウント動作(物理ドライブの初期化、FATボリュームの検索、BPBに従いワーク・エリアを初期化)が行われます。

    +
      +
    • ファイル・システム・オブジェクトが未初期化(f_mount()による)
    • +
    • 物理ドライブが未初期化(システム・リセットやメディアの取り外しによる)
    • +
    +

    下位レイヤがメディア交換の検出をサポートしないときは、アプリケーションはメディア交換のたびにf_mount()を実行する必要があります。

    diff --git a/doc/ja/open.html b/doc/ja/open.html index 7cfe243..d03eeb7 100644 --- a/doc/ja/open.html +++ b/doc/ja/open.html @@ -16,9 +16,9 @@

    ファイルをオープンまたは作成します。

     FRESULT f_open (
    -  FIL* FileObject,       /* 空のファイル・オブジェクト構造体へのポインタ */
    -  const TCHAR* FileName, /* ファイルのフルパス名へのポインタ */
    -  BYTE ModeFlags         /* モードフラグ */
    +  FIL* fp,           /* [OUT] 空のファイル・オブジェクト構造体へのポインタ */
    +  const TCHAR* path, /* [IN] ファイルのフルパス名へのポインタ */
    +  BYTE mode          /* [IN] モードフラグ */
     );
     
    @@ -26,18 +26,18 @@ FRESULT f_open (

    引数

    -
    FileObject
    +
    fp
    新しく作成するファイル・オブジェクト構造体へのポインタを指定します。以降、そのファイルを閉じるまでこのファイル・オブジェクトを使用してファイル操作をします。
    -
    FileName
    -
    開く(または作成する)ファイルの ファイル名が入った'\0'で終わる文字列へのポインタを指定します。
    -
    ModeFlags
    +
    path
    +
    開く(または作成する)ファイルの ファイル名を示すヌル文字'\0'終端の文字列へのポインタを指定します。
    +
    mode
    ファイルのアクセス方法やオープン方法を決めるフラグです。このパラメータには次の組み合わせを指定します。
    繝代せ蜷_FS_RPATH == 0_FS_RPATH == 1
    繝代せ蜷阪ョ萓_FS_RPATH == 0_FS_RPATH == 1
    file.txt繝峨Λ繧、繝0縺ョ繝ォ繝シ繝医サ繝繧」繝ャ繧ッ繝医Μ荳九ョ繝輔ぃ繧、繝ォ繧ォ繝ャ繝ウ繝医サ繝峨Λ繧、繝悶ョ繧ォ繝ャ繝ウ繝医サ繝繧」繝ャ繧ッ繝医Μ荳九ョ繝輔ぃ繧、繝ォ
    /file.txt繝峨Λ繧、繝0縺ョ繝ォ繝シ繝医サ繝繧」繝ャ繧ッ繝医Μ荳九ョ繝輔ぃ繧、繝ォ繧ォ繝ャ繝ウ繝医サ繝峨Λ繧、繝悶ョ繝ォ繝シ繝医サ繝繧」繝ャ繧ッ繝医Μ荳九ョ繝輔ぃ繧、繝ォ
    繝峨Λ繧、繝0縺ョ繝ォ繝シ繝医サ繝繧」繝ャ繧ッ繝医Μ繧ォ繝ャ繝ウ繝医サ繝峨Λ繧、繝悶ョ繧ォ繝ャ繝ウ繝医サ繝繧」繝ャ繧ッ繝医Μ
    - +
    意味
    FA_READ読み出しモードで開きます。読み書きする場合はFA_WRITEと共に指定します。
    FA_WRITE書き込みモードで開きます。読み書きする場合はFA_READと共に指定します。
    FA_OPEN_EXISTING既存のファイルを開きます。ファイルが無いときはエラーになります。(デフォルト)
    FA_OPEN_ALWAYS既存のファイルを開きます。ファイルが無いときはファイルを作成します。追記の場合は、この方法でオープンした後、f_lseek()でファイルの最後尾に移動してください。
    FA_OPEN_ALWAYS既存のファイルを開きます。ファイルが無いときはファイルを作成します。追記の場合は、この方法でオープンした後、f_lseek()でファイルの最後尾に移動してください。
    FA_CREATE_NEWファイルを作成します。同名のファイルがある場合は、FR_EXISTで失敗します。
    FA_CREATE_ALWAYSファイルを作成します。同名のファイルがある場合は、サイズを0にしてから開きます。
    @@ -58,6 +58,7 @@ FRESULT f_open ( FR_INVALID_NAME, FR_DENIED, FR_EXIST, +FR_INVALID_OBJECT, FR_WRITE_PROTECTED, FR_INVALID_DRIVE, FR_NOT_ENABLED, @@ -72,9 +73,9 @@ FRESULT f_open (

    解説

    -

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

    +

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

    既に開かれているファイルを開く必要がある場合は、多重アクセス制御を参照してください。しかし、一つのファイルに対する書き込みモードを含む重複オープンは常に禁止です。

    -

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

    +

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

    diff --git a/doc/ja/opendir.html b/doc/ja/opendir.html index 91f591f..cdddec2 100644 --- a/doc/ja/opendir.html +++ b/doc/ja/opendir.html @@ -16,8 +16,8 @@

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

     FRESULT f_opendir (
    -  DIR* DirObject,       /* ディレクトリ・ブジェクト構造体へのポインタ */
    -  const TCHAR* DirName  /* ディレクトリ名へのポインタ */
    +  DIR* dj,           /* [OUT] ディレクトリ・ブジェクト構造体へのポインタ */
    +  const TCHAR* path  /* [IN] ディレクトリ名へのポインタ */
     );
     
    @@ -25,10 +25,10 @@ FRESULT f_opendir (

    引数

    -
    DirObject
    +
    dj
    初期化するディレクトリ・オブジェクト構造体へのポインタを指定します。
    -
    DirName
    -
    オープンするディレクトリへのパス名が入った'\0'で終わる文字列へのポインタを指定します。
    +
    path
    +
    オープンするディレクトリのパス名を示すヌル文字'\0'終端の文字列へのポインタを指定します。
    @@ -53,7 +53,7 @@ FRESULT f_opendir (

    解説

    -

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

    +

    ディレクトリを開きます。正常終了したら、作成されたDIR構造体を使ってこのディレクトリの項目を順次読み出せます。作成されたディレクトリ・オブジェクトは、不要になったら任意の時点で破棄できます。

    diff --git a/doc/ja/printf.html b/doc/ja/printf.html index 9aecf5c..51c28a3 100644 --- a/doc/ja/printf.html +++ b/doc/ja/printf.html @@ -16,8 +16,8 @@

    ファイルに書式化文字列を書き込みます。

     int f_printf (
    -  FIL* FileObject,      /* ファイル・オブジェクト */
    -  const TCHAR* Foramt,  /* 書式制御文字列 */
    +  FIL* fp,           /* [IN] ファイル・オブジェクト */
    +  const TCHAR* fmt,  /* [IN] 書式制御文字列 */
       ...
     );
     
    @@ -26,10 +26,10 @@ int f_printf (

    引数

    -
    FileObject
    +
    fp
    ファイル・オブジェクト構造体へのポインタを指定します。
    -
    Format
    -
    '\0'で終わる書式制御文字列を指すポインタを指定します。'\0'は書き込まれません。
    +
    fmt
    +
    ヌル文字'\0'終端の書式制御文字列を指すポインタを指定します。ヌル文字は書き込まれません。
    ...
    オプションの引数。
    @@ -39,13 +39,13 @@ int f_printf (

    戻り値

    -

    文字列が正常に書き込まれると書き込まれた文字数が返されます。ディスクが満杯またはその他エラーにより正常に書き込まれなかったときは関数は失敗しEOF (-1)が返されます。

    +

    文字列が正常に書き込まれると、書き込まれた文字数が返されます。ディスクが満杯またはその他エラーにより正常に書き込まれなかったときは、関数は失敗しEOF (-1)が返されます。

    解説

    -

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

    +

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

    • タイプ: c C s S d D u U x X b B
    • 精度指定: l L
    • diff --git a/doc/ja/putc.html b/doc/ja/putc.html index 074e17d..b04babc 100644 --- a/doc/ja/putc.html +++ b/doc/ja/putc.html @@ -16,8 +16,8 @@

      ファイルに文字を書き込みます。

       int f_putc (
      -  TCHAR Chr,        /* 書き込む文字 */
      -  FIL* FileObject   /* ファイル・オブジェクト */
      +  TCHAR chr,  /* [IN] 書き込む文字 */
      +  FIL* fp     /* [IN] ファイル・オブジェクト */
       );
       
    @@ -25,9 +25,9 @@ int f_putc (

    引数

    -
    Chr
    +
    chr
    書き込む文字を指定します。
    -
    FileObject
    +
    fp
    ファイル・オブジェクト構造体へのポインタを指定します。
    @@ -42,7 +42,7 @@ int f_putc (

    解説

    -

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

    +

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

    diff --git a/doc/ja/puts.html b/doc/ja/puts.html index 4ac82a9..9955796 100644 --- a/doc/ja/puts.html +++ b/doc/ja/puts.html @@ -16,8 +16,8 @@

    ファイルに文字列を書き込みます。

     int f_puts (
    -  const TCHAR* Str,  /* 書き込む文字列 */
    -  FIL* FileObject    /* ファイル・オブジェクト */
    +  const TCHAR* str,  /* [IN] 書き込む文字列 */
    +  FIL* fp            /* [IN] ファイル・オブジェクト */
     );
     
    @@ -25,9 +25,9 @@ int f_puts (

    引数

    -
    Str
    -
    書き込む'\0'で終わる文字列を指すポインタを指定します。'\0'は書き込まれません。
    -
    FileObject
    +
    str
    +
    書き込むヌル文字'\0'終端の文字列を指すポインタを指定します。ヌル文字は書き込まれません。
    +
    fp
    ファイル・オブジェクト構造体へのポインタを指定します。
    @@ -42,7 +42,7 @@ int f_puts (

    解説

    -

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

    +

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

    diff --git a/doc/ja/rc.html b/doc/ja/rc.html index 3c03cce..81fc996 100644 --- a/doc/ja/rc.html +++ b/doc/ja/rc.html @@ -11,13 +11,13 @@

    繝輔ぃ繧、繝ォ髢「謨ー縺ョ謌サ繧雁、

    -

    FatFs縺ョAPI縺ァ縺ッ縲∽ク驛ィ縺ョ髢「謨ー繧帝勁縺咲オ先棡縺ォ蠢懊§縺溷ア騾壹ョ繝ェ繧カ繝ォ繝医サ繧ウ繝シ繝(enum蝙)繧定ソ斐@縺セ縺吶る未謨ー縺梧仙粥縺励◆蝣エ蜷医ッ0繧定ソ斐@縺セ縺吶ょ、ア謨励@縺溷エ蜷医ッ0莉・螟悶ョ蛟、繧定ソ斐@縲∝、縺ッ繧ィ繝ゥ繝シ縺ョ遞ョ鬘槭r遉コ縺励∪縺吶

    +

    FatFs縺ョAPI縺ァ縺ッ縲∽ク驛ィ縺ョ髢「謨ー繧帝勁縺咲オ先棡縺ォ蠢懊§縺溷ア騾壹ョ繝ェ繧カ繝ォ繝医サ繧ウ繝シ繝(FRESULT蝙(enum))繧定ソ斐@縺セ縺吶る未謨ー縺梧仙粥縺励◆蝣エ蜷医ッ0繧定ソ斐@縺セ縺吶ょ、ア謨励@縺溷エ蜷医ッ0莉・螟悶ョ蛟、繧定ソ斐@縲∝、縺ッ繧ィ繝ゥ繝シ縺ョ遞ョ鬘槭r遉コ縺励∪縺吶

    FR_OK (0)
    髢「謨ー縺ッ謌仙粥縺励◆縲
    FR_DISK_ERR
    -
    荳倶ス阪Ξ繧、繝、(繝繧」繧ケ繧ッI/O髢「謨ー)縺ァ蝗槫セゥ荳崎ス縺ェ繧ィ繝ゥ繝シ縺檎匱逕溘@縺溘
    +
    荳倶ス阪Ξ繧、繝、(disk_read(), disk_write(), disk_ioctl()髢「謨ー)縺ァ蝗槫セゥ荳崎ス縺ェ繧ィ繝ゥ繝シ縺檎匱逕溘@縺溘
    FR_INT_ERR
    蜀驛ィ蜃ヲ逅縺ョ蛛・蜈ィ諤ァ縺ォ逡ー蟶ク縺梧、懷コ縺輔l縺溘ょ次蝗縺ィ縺励※縺ッ谺。縺ョ繧医≧縺ェ縺薙→縺瑚縺医i繧後∪縺吶
      @@ -37,11 +37,11 @@
      FR_DENIED
      縺昴ョ繧ェ繝悶ず繧ァ繧ッ繝医↓蟇セ縺吶k謫堺ス懊ョ諡貞凄縲ょ次蝗縺ィ縺励※縺ッ谺。縺ョ繧医≧縺ェ縺薙→縺瑚縺医i繧後∪縺吶
        -
      • 譖ク縺崎セシ縺ソ遖∵ュ「螻樊ァ(AM_RDO)繧呈戟縺、繝輔ぃ繧、繝ォ繧呈嶌縺崎セシ縺ソ繝「繝シ繝峨〒髢九%縺縺ィ縺励◆縲
      • +
      • 譖ク縺崎セシ縺ソ遖∵ュ「螻樊ァ(AM_RDO)繧呈戟縺、繝輔ぃ繧、繝ォ繧呈嶌縺崎セシ縺ソ繝「繝シ繝峨〒髢九%縺縺ィ縺励◆縲
      • 譖ク縺崎セシ縺ソ遖∵ュ「螻樊ァ繧呈戟縺、繝輔ぃ繧、繝ォ繧繝繧」繝ャ繧ッ繝医Μ繧貞炎髯、縺励h縺縺ィ縺励◆縲
      • 遨コ縺ァ縺ェ縺繝繧」繝ャ繧ッ繝医Μ縺セ縺溘ッ繧ォ繝ャ繝ウ繝医サ繝繧」繝ャ繧ッ繝医Μ繧貞炎髯、縺励h縺縺ィ縺励◆縲
      • -
      • FA_READ繧剃サ倥¢縺壹↓髢九>縺溘ヵ繧。繧、繝ォ縺ォ蟇セ縺励※隱ュ縺ソ蜃コ縺励r陦後▲縺溘
      • -
      • FA_WRITE繧剃サ倥¢縺壹↓髢九>縺溘ヵ繧。繧、繝ォ縺ォ蟇セ縺励※螟画峩謫堺ス懊r陦後▲縺溘
      • +
      • FA_READ繧剃サ倥¢縺壹↓髢九>縺溘ヵ繧。繧、繝ォ縺ォ蟇セ縺励※隱ュ縺ソ蜃コ縺励r陦後▲縺溘
      • +
      • FA_WRITE繧剃サ倥¢縺壹↓髢九>縺溘ヵ繧。繧、繝ォ縺ォ蟇セ縺励※螟画峩謫堺ス懊r陦後▲縺溘
      • 繝繧」繝ャ繧ッ繝医Μ繝サ繝繝シ繝悶Ν縺梧コ譚ッ縺ァ繝輔ぃ繧、繝ォ繧繝繧」繝ャ繧ッ繝医Μ繧剃ス懈舌〒縺阪↑縺九▲縺溘
      • 繝懊Μ繝・繝シ繝縺梧コ譚ッ縺ァ繝繧」繝ャ繧ッ繝医Μ繧剃ス懈舌〒縺阪↑縺九▲縺溘
      @@ -49,35 +49,36 @@
      FR_EXIST
      譁ー縺励¥菴懈舌@繧医≧縺ィ縺励◆繧ェ繝悶ず繧ァ繧ッ繝医→蜷後§蜷榊燕縺ョ繧ェ繝悶ず繧ァ繧ッ繝医′譌「縺ォ蟄伜惠縺吶k縲
      FR_INVALID_OBJECT
      -
      謖螳壹&繧後◆繝輔ぃ繧、繝ォ繝サ繧ェ繝悶ず繧ァ繧ッ繝医d繝繧」繝ャ繧ッ繝医Μ繝サ繧ェ繝悶ず繧ァ繧ッ繝医′辟。蜉ケ縲
      +
      謖螳壹&繧後◆繝輔ぃ繧、繝ォ繝サ繧ェ繝悶ず繧ァ繧ッ繝医d繝繧」繝ャ繧ッ繝医Μ繝サ繧ェ繝悶ず繧ァ繧ッ繝医′辟。蜉ケ(繧ェ繝シ繝励Φ縺輔l縺ヲ縺縺ェ縺縲∫エ謳阪@縺ヲ縺繧九↑縺ゥ)縲√∪縺溘ッ繝後Ν繝サ繝昴う繝ウ繧ソ縺梧ク。縺輔l縺溘
      FR_WRITE_PROTECTED
      -
      迚ゥ逅繝峨Λ繧、繝悶′譖ク縺崎セシ縺ソ遖∵ュ「迥カ諷九ョ縺ィ縺阪∵嶌縺崎セシ縺ソ繧剃シエ縺謫堺ス懊r陦後♀縺縺ィ縺励◆縲
      +
      迚ゥ逅繝峨Λ繧、繝悶′譖ク縺崎セシ縺ソ遖∵ュ「迥カ諷九ョ縺ィ縺阪∵嶌縺崎セシ縺ソ邉サ縺ョ謫堺ス懊r陦後♀縺縺ィ縺励◆縲
      FR_INVALID_DRIVE
      -
      謖螳壹&繧後◆繝峨Λ繧、繝也分蜿キ縺檎┌蜉ケ縲(髢「騾」繧ェ繝励す繝ァ繝ウ: _VOLUMES)
      +
      謖螳壹&繧後◆繝峨Λ繧、繝也分蜿キ縺檎┌蜉ケ縲(髢「騾」繧ェ繝励す繝ァ繝ウ: _VOLUMES)
      FR_NOT_ENABLED
      縺昴ョ繝懊Μ繝・繝シ繝縺ョ謫堺ス懊↓蠢隕√↑繝ッ繝シ繧ッ繝サ繧ィ繝ェ繧「(繝輔ぃ繧、繝ォ繝サ繧キ繧ケ繝繝繝サ繧ェ繝悶ず繧ァ繧ッ繝域ァ矩菴)縺御ク弱∴繧峨l縺ヲ縺縺ェ縺縲
      FR_NO_FILESYSTEM
      迚ゥ逅繝峨Λ繧、繝紋ク翫↓譛牙柑縺ェFAT繝懊Μ繝・繝シ繝縺瑚ヲ九▽縺九i縺ェ縺九▲縺溘
      FR_MKFS_ABORTED
      -
      f_mkfs()縺ョ蜃ヲ逅縺碁幕蟋句燕縺ォ荳ュ譁ュ縺輔l縺溘ょ次蝗縺ィ縺励※縺ッ谺。縺ョ繧医≧縺ェ縺薙→縺瑚縺医i繧後∪縺吶 +
      f_mkfs()縺ョ蜃ヲ逅縺碁幕蟋句燕縺ォ荳ュ譁ュ縺輔l縺溘ょ次蝗縺ィ縺励※縺ッ谺。縺ョ繧医≧縺ェ縺薙→縺瑚縺医i繧後∪縺吶
      • 繝懊Μ繝・繝シ繝縺悟ー上&縺吶℃繧九
      • FAT繧ソ繧、繝励ョ險育ョ励↓遏帷崟縺瑚ヲ九▽縺九▲縺溘ゅけ繝ゥ繧ケ繧ソ謨ー縺熊AT繧ソ繧、繝励ョ蠅逡御サ倩ソ代↓縺ェ繧九→縺阪↓逋コ逕溘☆繧句エ蜷医′縺ゅj縺セ縺吶
      • +
      • 隲也炊繝峨Λ繧、繝悶↓蟇セ蠢懊☆繧句玄逕サ縺瑚ヲ九▽縺九i縺ェ縺九▲縺溘(髢「騾」繧ェ繝励す繝ァ繝ウ: _MULTI_PARTITION)
      FR_TIMEOUT
      -
      蜀榊・蛻カ蠕。縺ォ繧医k蠕縺。譎る俣縺悟ョ夂セゥ縺輔l縺滓凾髢薙r雜翫∴縺溘◆繧√髢「謨ー縺ッ螳溯。後&繧後↑縺九▲縺溘(髢「騾」繧ェ繝励す繝ァ繝ウ: _TIMEOUT)
      +
      蜀榊・蛻カ蠕。縺ォ繧医k蠕縺。譎る俣縺悟ョ夂セゥ縺輔l縺滓凾髢薙r雜翫∴縺溘◆繧√髢「謨ー縺ッ螳溯。後&繧後↑縺九▲縺溘(髢「騾」繧ェ繝励す繝ァ繝ウ: _TIMEOUT)
      FR_LOCKED
      -
      螟夐阪い繧ッ繧サ繧ケ謗剃サ匁ゥ溯ス縺ォ繧医j縲√◎縺ョ繝輔ぃ繧、繝ォ縺ォ蟇セ縺励※陦後♀縺縺ィ縺励◆繧「繧ッ繧サ繧ケ縺梧拠蜷ヲ縺輔l縺溘(髢「騾」繧ェ繝励す繝ァ繝ウ: _FS_SHARE)
      +
      螟夐阪い繧ッ繧サ繧ケ謗剃サ匁ゥ溯ス縺ォ繧医j縲√◎縺ョ繝輔ぃ繧、繝ォ縺ォ蟇セ縺励※陦後♀縺縺ィ縺励◆繧「繧ッ繧サ繧ケ縺梧拠蜷ヲ縺輔l縺溘(髢「騾」繧ェ繝励す繝ァ繝ウ: _FS_LOCK)
      FR_NOT_ENOUGH_CORE
      繝。繝「繝ェ荳崎カウ縺ォ繧医k螟ア謨励ょ次蝗縺ィ縺励※縺ッ谺。縺ョ繧医≧縺ェ縺薙→縺瑚縺医i繧後∪縺吶
        -
      • LFN謫堺ス懊ヰ繝繝輔ぃ縺ョ蜍慕噪遒コ菫昴↓螟ア謨励@縺溘(髢「騾」繧ェ繝励す繝ァ繝ウ: _USE_LFN)
      • +
      • LFN謫堺ス懊ヰ繝繝輔ぃ縺ョ蜍慕噪遒コ菫昴↓螟ア謨励@縺溘(髢「騾」繧ェ繝励す繝ァ繝ウ: _USE_LFN)
      • 荳弱∴繧峨l縺滄榊励ョ繧オ繧、繧コ縺悟ョ滄圀縺ォ蠢隕√↑繧オ繧、繧コ縺ォ蟇セ縺励※荳崎カウ縺励※縺繧九
      FR_TOO_MANY_OPEN_FILES
      -
      蜷梧凾繧ェ繝シ繝励Φ蜿ッ閭ス縺ェ繝輔ぃ繧、繝ォ謨ー繧定カ翫∴縺ヲ繝輔ぃ繧、繝ォ繧帝幕縺薙≧縺ィ縺励◆縲(髢「騾」繧ェ繝励す繝ァ繝ウ: _FS_SHARE)
      +
      蜷梧凾繧ェ繝シ繝励Φ蜿ッ閭ス縺ェ繝輔ぃ繧、繝ォ謨ー繧定カ翫∴縺ヲ繝輔ぃ繧、繝ォ繧帝幕縺薙≧縺ィ縺励◆縲(髢「騾」繧ェ繝励す繝ァ繝ウ: _FS_LOCK)
      FR_INVALID_PARAMETER
      荳弱∴繧峨l縺溘ヱ繝ゥ繝。繝シ繧ソ縺檎┌蜉ケ縺セ縺溘ッ遏帷崟縺励※縺繧九
    diff --git a/doc/ja/read.html b/doc/ja/read.html index 2c66f3b..94b8d1e 100644 --- a/doc/ja/read.html +++ b/doc/ja/read.html @@ -16,10 +16,10 @@

    ファイルからデータを読み出します。

     FRESULT f_read (
    -  FIL* FileObject,    /* ファイル・オブジェクト構造体 */
    -  void* Buffer,       /* 読み出したデータを格納するバッファ */
    -  UINT ByteToRead,    /* 読み出すバイト数 */
    -  UINT* ByteRead      /* 読み出されたバイト数 */
    +  FIL* fp,     /* [IN] ファイル・オブジェクト構造体 */
    +  void* buff,  /* [OUT] 読み出したデータを格納するバッファ */
    +  UINT btr,    /* [IN] 読み出すバイト数 */
    +  UINT* br     /* [OUT] 読み出されたバイト数 */
     );
     
    @@ -27,13 +27,13 @@ FRESULT f_read (

    引数

    -
    FileObject
    +
    fp
    ファイル・オブジェクト構造体へのポインタを指定します。
    -
    Buffer
    +
    buff
    読み出したデータを格納するバッファを指すポインタを指定します。
    -
    ByteToRead
    -
    読み出すバイト数(0〜UINTの最大値)を指定します。
    -
    ByteRead
    +
    btr
    +
    読み出すバイト数(0〜UINT型の最大値)を指定します。
    +
    br
    実際に読み出されたバイト数を格納する変数を指すポインタを指定します。戻り値は関数の成否にかかわらず常に有効です。
    @@ -55,7 +55,7 @@ FRESULT f_read (

    解説

    -

    読み込み開始位置は、現在のリード/ライト・ポインタからになります。リード/ライト・ポインタは読み込まれたバイト数だけ進みます。関数が正常終了した後は、*ByteReadの値をチェックすべきです。*ByteReadByteToReadよりも小さいときは、読み込み中にファイルの終端に達したことを示しています。

    +

    読み込み開始位置は、現在のリード/ライト・ポインタからになります。リード/ライト・ポインタは読み込まれたバイト数だけ進みます。関数が正常終了した後は、*brの値をチェックすべきです。*brbtrよりも小さいときは、読み込み中にファイルの終端に達したことを示しています。

    diff --git a/doc/ja/readdir.html b/doc/ja/readdir.html index f1297b2..df04754 100644 --- a/doc/ja/readdir.html +++ b/doc/ja/readdir.html @@ -16,8 +16,8 @@

    ディレクトリ項目を読み出します

     FRESULT f_readdir (
    -  DIR* DirObject,    /* ディレクトリ・ブジェクト構造体へのポインタ */
    -  FILINFO* FileInfo  /* ファイル情報構造体へのポインタ */
    +  DIR* dj,      /* [IN] ディレクトリ・ブジェクト構造体へのポインタ */
    +  FILINFO* fno  /* [OUT] ファイル情報構造体へのポインタ */
     );
     
    @@ -25,9 +25,9 @@ FRESULT f_readdir (

    引数

    -
    DirObject
    +
    dj
    有効なディレクトリ・オブジェクト構造体へのポインタを指定します。
    -
    FileInfo
    +
    fno
    読み出したディレクトリ項目を格納するファイル情報構造体へのポインタを指定します。
    @@ -49,14 +49,14 @@ FRESULT f_readdir (

    解説

    -

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

    -

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

    +

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

    +

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

    -

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

    +

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

    diff --git a/doc/ja/rename.html b/doc/ja/rename.html index e0c0950..70bf5b7 100644 --- a/doc/ja/rename.html +++ b/doc/ja/rename.html @@ -16,8 +16,8 @@

    オブジェクトの名前の変更または移動。

     FRESULT f_rename (
    -  const TCHAR* OldName, /* 古いオブジェクト名 */
    -  const TCHAR* NewName  /* 新しいオブジェクト名 */
    +  const TCHAR* old_name, /* [IN] 古いオブジェクト名 */
    +  const TCHAR* new_name  /* [IN] 新しいオブジェクト名 */
     );
     
    @@ -25,10 +25,10 @@ FRESULT f_rename (

    引数

    -
    OldName
    -
    変更対象のオブジェクト(ファイルまたはディレクトリ)へのパス名の入った'\0'で終わる文字列へのポインタを指定します。
    -
    NewName
    -
    新しいオブジェクトのフルパス名の入った'\0'で終わる文字列へのポインタを指定します。既に存在する名前は使えません。また、ドライブ番号は指定できず、OldNameで指定された論理ドライブ上のオブジェクトとして扱われます。
    +
    old_name
    +
    変更対象のオブジェクト(ファイルまたはディレクトリ)のパス名を示すヌル文字'\0'終端の文字列へのポインタを指定します。
    +
    new_name
    +
    新しいオブジェクトのパス名を示すヌル文字'\0'終端の文字列へのポインタを指定します。既に存在する名前は使えません。また、ドライブ番号は指定できず、old_nameで指定された論理ドライブ上のオブジェクトとして扱われます。
    @@ -56,7 +56,7 @@ FRESULT f_rename (

    解説

    -

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

    +

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

    diff --git a/doc/ja/sdir.html b/doc/ja/sdir.html index e6cb3ae..3039057 100644 --- a/doc/ja/sdir.html +++ b/doc/ja/sdir.html @@ -13,7 +13,7 @@

    DIR

    -

    DIR構造体は、f_opendir(), f_readdir()のワーク・エリアとして使用されます。アプリケーションから変更可能なメンバはありません。

    +

    DIR構造体は、f_opendir(), f_readdir()のワーク・エリアとして使用されます。アプリケーションは、この構造体のメンバを書き換えてはなりません。

     typedef struct {
         FATFS*  fs;        /* 親ファイル・システム・オブジェクトへのポインタ */
    diff --git a/doc/ja/setlabel.html b/doc/ja/setlabel.html
    new file mode 100644
    index 0000000..b40a5cf
    --- /dev/null
    +++ b/doc/ja/setlabel.html
    @@ -0,0 +1,89 @@
    +
    +
    +
    +
    +
    +
    +
    +
    +FatFs - f_setlabel
    +
    +
    +
    +
    +
    +

    f_setlabel

    +

    ボリューム・ラベルを書き込みます。

    +
    +FRESULT f_setlabel (
    +  const TCHAR* name  /* [IN] 設定するボリューム名へのポインタ */
    +);
    +
    +
    + +
    +

    引数

    +
    +
    name
    +
    設定するボリューム名を示すヌル文字'\0'終端の文字列へのポインタを指定します。
    +
    +
    + + + + + +
    +

    解説

    +

    文字列の先頭にドライブ番号を含む場合は、その論理ドライブに設定されます。含まない場合は、デフォルト・ドライブに設定されます。ボリューム名を削除するときは、ヌル文字列を指定します。名前のフォーマットは、短いファイル名とほぼ同じですが、次の点が異なります。

    +
      +
    • ローカル・コード換算で11バイト以下。
    • +
    • ピリオドを含むことはできない。
    • +
    • 任意の位置にスペースを置くことができる。ただし、最後尾のスペースは除去される。
    • +
    +
    + +
    +

    対応情報

    +

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

    +
    + + +
    +

    使用例

    +
    +    /* デフォルト・ドライブにボリューム名を設定 */
    +    f_setlabel("DATA DISK");
    +
    +    /* ドライブ2にボリューム名を設定 */
    +    f_setlabel("2:DISK 3 OF 4");
    +
    +    /* ドライブ2のボリューム名を削除 */
    +    f_setlabel("2:");
    +
    +
    + + +
    +

    参照

    +f_getlabel +
    + + +

    戻る

    + + diff --git a/doc/ja/sfatfs.html b/doc/ja/sfatfs.html index 5156860..b8f2bf1 100644 --- a/doc/ja/sfatfs.html +++ b/doc/ja/sfatfs.html @@ -13,7 +13,7 @@

    FATFS

    -

    FATFS構造体(ファイル・システム・オブジェクト)は、個々の論理ドライブのダイナミック・ワーク・エリアを保持し、f_mount()でFatFsモジュールに登録されます。初期化が行われるタイミングは、f_mount()またはメディア交換の後の最初のファイル・アクセスの時です。アプリケーションから書き換え可能なメンバはありません。

    +

    FATFS構造体(ファイル・システム・オブジェクト)は、個々の論理ドライブのダイナミック・ワーク・エリアを保持し、f_mount()でFatFsモジュールに登録されます。初期化が行われるタイミングは、f_mount()またはメディア交換の後の最初のファイル・アクセスの時です。アプリケーションは、この構造体のメンバを書き換えてはなりません。

     typedef struct {
    @@ -41,9 +41,10 @@
     #endif
         DWORD   n_fatent;     /* FATのエントリ数 (== クラスタ数 + 2) */
         DWORD   fsize;        /* FAT 1個当たりのセクタ数 */
    +    DWORD   volbase;      /* ボリューム開始セクタ */
         DWORD   fatbase;      /* FAT領域開始セクタ */
    -    DWORD   dirbase;      /* ルート・ディレクトリ開始セクタ (FAT32: クラスタ番号) */
    -    DWORD   database;     /* データ領域開始区セクタ */
    +    DWORD   dirbase;      /* ルート・ディレクトリ開始セクタ/クラスタ */
    +    DWORD   database;     /* データ領域開始セクタ */
         DWORD   winsect;      /* win[]に現れているセクタ番号 */
         BYTE    win[_MAX_SS]; /* ディスク・アクセス・ウィンドウ */
     } FATFS;
    diff --git a/doc/ja/sfile.html b/doc/ja/sfile.html
    index b31307b..e4c9dcf 100644
    --- a/doc/ja/sfile.html
    +++ b/doc/ja/sfile.html
    @@ -13,7 +13,7 @@
     
     

    FIL

    -

    FIL構造体(ファイル・オブジェクト)は、f_open関数で初期化され、以後そのファイルの状態を保持します。また、f_close関数でファイルが閉じられると無効化されます。アプリケーションからの書き換えが可能なメンバはcltblのみです。非タイニー構成では内部にセクタ・バッファが確保されるので、サイズに注意が必要です。

    +

    FIL構造体(ファイル・オブジェクト)は、f_open()で初期化され、以後そのファイルの状態を保持します。また、f_close()でファイルが閉じられると無効化されます。アプリケーションは、この構造体のメンバを書き換えてはなりません(cltblは例外)。非タイニー構成では、内部にセクタ・バッファが確保されるので、占有サイズに注意が必要です。

     typedef struct {
    @@ -23,7 +23,7 @@
         BYTE    pad1;
         DWORD   fptr;         /* ファイル読み書きポインタ (ファイル先頭からのバイト・オフセット) */
         DWORD   fsize;        /* ファイル・サイズ(バイト単位) */
    -    DWORD   sclust;       /* ファイル開始クラスタ番号 (0 on fsize==0) */
    +    DWORD   sclust;       /* ファイル開始クラスタ番号 (set 0 if fsize==0) */
         DWORD   clust;        /* 現在のクラスタ */
         DWORD   dsect;        /* 現在のデータ・セクタ */
     #if _FS_READONLY == 0
    diff --git a/doc/ja/size.html b/doc/ja/size.html
    index ecd8c39..959bc46 100644
    --- a/doc/ja/size.html
    +++ b/doc/ja/size.html
    @@ -16,7 +16,7 @@
     

    ファイルのサイズを取得します。

     DWORD f_size (
    -  FIL* FileObject   /* ファイル・オブジェクト */
    +  FIL* fp   /* [IN] ファイル・オブジェクト */
     );
     
    @@ -25,7 +25,7 @@ DWORD f_size (

    引数

    -
    FileObject
    +
    fp
    ファイル・オブジェクト構造体へのポインタを指定します。
    diff --git a/doc/ja/stat.html b/doc/ja/stat.html index e9e0083..5ab92bd 100644 --- a/doc/ja/stat.html +++ b/doc/ja/stat.html @@ -15,8 +15,8 @@

    f_stat

     FRESULT f_stat (
    -  const TCHAR* FileName,  /* ファイルまたはディレクトリ名へのポインタ */
    -  FILINFO* FileInfo       /* ファイル情報構造体へのポインタ */
    +  const TCHAR* path,  /* [IN] ファイルまたはディレクトリ名へのポインタ */
    +  FILINFO* fno        /* [OUT] ファイル情報構造体へのポインタ */
     );
     
    @@ -24,9 +24,9 @@ FRESULT f_stat (

    引数

    -
    FileName
    -
    情報を得るファイルまたはディレクトリ名の'\0'で終わる文字列を指すポインタを指定します。
    -
    FileInfo
    +
    path
    +
    情報を得るファイルまたはディレクトリ名を示すヌル文字'\0'終端の文字列を指すポインタを指定します。
    +
    fno
    読み出したファイル情報を格納するファイル情報構造体へのポインタを指定します。
    @@ -53,7 +53,7 @@ FRESULT f_stat (

    解説

    -

    指定されたファイルまたはディレクトリに関する情報(サイズ、タイムスタンプおよび属性)を得ます。ディレクトリのサイズ情報は常に0です。

    +

    指定されたファイルまたはディレクトリに関する情報(サイズ、タイムスタンプおよび属性)を得ます。ディレクトリのサイズ情報は無効で常に0です。

    diff --git a/doc/ja/sync.html b/doc/ja/sync.html index 242c90a..681186d 100644 --- a/doc/ja/sync.html +++ b/doc/ja/sync.html @@ -16,7 +16,7 @@

    書き込み中のファイルのキャッシュされた情報をフラッシュします。

     FRESULT f_sync (
    -  FIL* FileObject     /* ファイル・オブジェクト構造体へのポインタ */
    +  FIL* fp     /* [IN] ファイル・オブジェクト構造体へのポインタ */
     );
     
    @@ -24,7 +24,7 @@ FRESULT f_sync (

    引数

    -
    FileObject
    +
    fp
    syncするファイルのファイル・オブジェクト構造体へのポインタを指定します。
    diff --git a/doc/ja/tell.html b/doc/ja/tell.html index d59e527..c39505e 100644 --- a/doc/ja/tell.html +++ b/doc/ja/tell.html @@ -16,7 +16,7 @@

    現在のリード/ライト・ポインタを取得します。

     DWORD f_tell (
    -  FIL* FileObject   /* ファイル・オブジェクト */
    +  FIL* fp   /* [IN] ファイル・オブジェクト */
     );
     
    @@ -25,7 +25,7 @@ DWORD f_tell (

    引数

    -
    FileObject
    +
    fp
    ファイル・オブジェクト構造体へのポインタを指定します。
    diff --git a/doc/ja/truncate.html b/doc/ja/truncate.html index 6aefcb6..23ed35e 100644 --- a/doc/ja/truncate.html +++ b/doc/ja/truncate.html @@ -16,7 +16,7 @@

    ファイル長を切り詰めます。

     FRESULT f_truncate (
    -  FIL* FileObject     /* ファイル・オブジェクトへのポインタ */
    +  FIL* fp     /* [IN] ファイル・オブジェクトへのポインタ */
     );
     
    @@ -24,7 +24,7 @@ FRESULT f_truncate (

    引数

    -
    FileObject
    +
    fp
    切り詰め対象ファイルのファイル・オブジェクトへのポインタ
    diff --git a/doc/ja/unlink.html b/doc/ja/unlink.html index 421df94..92763a5 100644 --- a/doc/ja/unlink.html +++ b/doc/ja/unlink.html @@ -16,7 +16,7 @@

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

     FRESULT f_unlink (
    -  const TCHAR* FileName  /* オブジェクト名へのポインタ */
    +  const TCHAR* path  /* [IN] オブジェクト名へのポインタ */
     );
     
    @@ -24,8 +24,8 @@ FRESULT f_unlink (

    引数

    -
    FileName
    -
    削除対象のパス名の入った'\0'で終わる文字列へのポインタを指定します。
    +
    path
    +
    削除対象のパス名を示すヌル文字'\0'終端の文字列へのポインタを指定します。
    @@ -56,9 +56,9 @@ FRESULT f_unlink (

    解説

    削除対象のオブジェクが次の条件に当てはまる場合、そのアクセスは拒否され関数は失敗します。

    diff --git a/doc/ja/utime.html b/doc/ja/utime.html index 7fe2cef..c412e57 100644 --- a/doc/ja/utime.html +++ b/doc/ja/utime.html @@ -16,8 +16,8 @@

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

     FRESULT f_utime (
    -  const TCHAR* FileName,   /* オブジェクト名へのポインタ */
    -  const FILINFO* TimeDate  /* 設定する日付 */
    +  const TCHAR* path,  /* [IN] オブジェクト名へのポインタ */
    +  const FILINFO* fno  /* [IN] 設定する日付 */
     );
     
    @@ -25,10 +25,10 @@ FRESULT f_utime (

    引数

    -
    FileName
    -
    変更対象のファイルまたはディレクトリへのパス名の入った'\0'で終わる文字列を指定します。
    -
    TimeDate
    -
    設定する日付と時間をfdateとftimeメンバに設定されたFILINFO構造体へのポインタ。他のメンバはDon't careです。
    +
    path
    +
    変更対象のファイルまたはディレクトリのパス名を示すヌル文字'\0'終端の文字列を指定します。
    +
    fno
    +
    設定する日付と時間をfdateftimeメンバに設定されたFILINFO構造体へのポインタ。他のメンバはこの関数では意味を持ちません。
    diff --git a/doc/ja/write.html b/doc/ja/write.html index 13c53ac..9156571 100644 --- a/doc/ja/write.html +++ b/doc/ja/write.html @@ -16,10 +16,10 @@

    ファイルにデータを書き込みます。

     FRESULT f_write (
    -  FIL* FileObject,     /* ファイル・オブジェクト */
    -  const void* Buffer,  /* 書き込みデータ */
    -  UINT ByteToWrite,    /* 書き込むバイト数 */
    -  UINT* ByteWritten    /* 書き込まれたバイト数 */
    +  FIL* fp,           /* [IN] ファイル・オブジェクト */
    +  const void* buff,  /* [IN] 書き込みデータ */
    +  UINT btw,          /* [IN] 書き込むバイト数 */
    +  UINT* bw           /* [OUT] 書き込まれたバイト数 */
     );
     
    @@ -27,13 +27,13 @@ FRESULT f_write (

    引数

    -
    FileObject
    +
    fp
    ファイル・オブジェクト構造体へのポインタを指定します。
    -
    Buffer
    +
    buff
    書き込むデータを格納したバッファを指すポインタを指定します。
    -
    ByteToWrite
    -
    書き込むバイト数(0〜UINTの最大値)を指定します。
    -
    ByteWritten
    +
    btw
    +
    書き込むバイト数(0〜UINT型の最大値)を指定します。
    +
    bw
    書き込まれたバイト数を格納する変数を指すポインタを指定します。戻り値は関数の成否にかかわらず常に有効です。
    @@ -55,7 +55,7 @@ FRESULT f_write (

    解説

    -

    書き込み開始位置は、リード/ライト・ポインタの位置からになります。リード/ライト・ポインタは実際に書き込まれたバイト数だけ進みます。関数が正常終了した後、要求したバイト数が書き込まれたかどうか*ByteWrittenをチェックすべきです。*ByteWritten < ByteToWriteのときは、ディスク・フルを意味します。ディスク・フルが発生しているときまたはそれに近いときは、制御が帰るまで時間がかかる場合があります。

    +

    書き込み開始位置は、リード/ライト・ポインタの位置からになります。リード/ライト・ポインタは実際に書き込まれたバイト数だけ進みます。関数が正常終了した後、要求したバイト数が書き込まれたかどうか*bwをチェックすべきです。*bwbtwより小さいときは、ディスク・フルを意味します。ディスク・フルが発生しているときまたはそれに近いときは、制御が帰るまで時間がかかる場合があります。

    diff --git a/doc/updates.txt b/doc/updates.txt index 99a03c6..e773558 100644 --- a/doc/updates.txt +++ b/doc/updates.txt @@ -1,3 +1,6 @@ +R0.09b, Jan 24, 2013 + Added f_getlabel() and f_setlabel(). (_USE_LABEL = 1) + R0.09a, Aug 27, 2012 Fixed assertion failure due to OS/2 EA on FAT12/16. Changed API rejects null object pointer to avoid crash. diff --git a/src/00readme.txt b/src/00readme.txt index 768b40b..f7330e9 100644 --- a/src/00readme.txt +++ b/src/00readme.txt @@ -1,4 +1,4 @@ -FatFs Module Source Files R0.09a (C)ChaN, 2012 +FatFs Module Source Files R0.09b (C)ChaN, 2013 FILES @@ -133,3 +133,6 @@ REVISION HISTORY Aug 27,'12 R0.09a Fixed assertion failure due to OS/2 EA on FAT12/16. Changed f_open() and f_opendir() reject null object pointer to avoid crash. Changed option name _FS_SHARE to _FS_LOCK. + + Jan 23,'13 R0.09b Added f_getlabel() and f_setlabel(). (_USE_LABEL == 1) + diff --git a/src/diskio.c b/src/diskio.c index 60dff08..cce6ee7 100644 --- a/src/diskio.c +++ b/src/diskio.c @@ -1,5 +1,5 @@ /*-----------------------------------------------------------------------*/ -/* Low level disk I/O module skeleton for FatFs (C)ChaN, 2012 */ +/* Low level disk I/O module skeleton for FatFs (C)ChaN, 2013 */ /*-----------------------------------------------------------------------*/ /* If a working storage control module is available, it should be */ /* attached to the FatFs via a glue function rather than modifying it. */ @@ -23,13 +23,13 @@ /*-----------------------------------------------------------------------*/ DSTATUS disk_initialize ( - BYTE drv /* Physical drive nmuber (0..) */ + BYTE pdrv /* Physical drive nmuber (0..) */ ) { DSTATUS stat; int result; - switch (drv) { + switch (pdrv) { case ATA : result = ATA_disk_initialize(); @@ -61,13 +61,13 @@ DSTATUS disk_initialize ( /*-----------------------------------------------------------------------*/ DSTATUS disk_status ( - BYTE drv /* Physical drive nmuber (0..) */ + BYTE pdrv /* Physical drive nmuber (0..) */ ) { DSTATUS stat; int result; - switch (drv) { + switch (pdrv) { case ATA : result = ATA_disk_status(); @@ -99,7 +99,7 @@ DSTATUS disk_status ( /*-----------------------------------------------------------------------*/ DRESULT disk_read ( - BYTE drv, /* Physical drive nmuber (0..) */ + BYTE pdrv, /* Physical drive nmuber (0..) */ BYTE *buff, /* Data buffer to store read data */ DWORD sector, /* Sector address (LBA) */ BYTE count /* Number of sectors to read (1..128) */ @@ -108,7 +108,7 @@ DRESULT disk_read ( DRESULT res; int result; - switch (drv) { + switch (pdrv) { case ATA : // translate the arguments here @@ -147,7 +147,7 @@ DRESULT disk_read ( #if _USE_WRITE DRESULT disk_write ( - BYTE drv, /* Physical drive nmuber (0..) */ + BYTE pdrv, /* Physical drive nmuber (0..) */ const BYTE *buff, /* Data to be written */ DWORD sector, /* Sector address (LBA) */ BYTE count /* Number of sectors to write (1..128) */ @@ -156,7 +156,7 @@ DRESULT disk_write ( DRESULT res; int result; - switch (drv) { + switch (pdrv) { case ATA : // translate the arguments here @@ -195,19 +195,19 @@ DRESULT disk_write ( #if _USE_IOCTL DRESULT disk_ioctl ( - BYTE drv, /* Physical drive nmuber (0..) */ - BYTE ctrl, /* Control code */ + BYTE pdrv, /* Physical drive nmuber (0..) */ + BYTE cmd, /* Control code */ void *buff /* Buffer to send/receive control data */ ) { DRESULT res; int result; - switch (drv) { + switch (pdrv) { case ATA : // pre-process here - result = ATA_disk_ioctl(ctrl, buff); + result = ATA_disk_ioctl(cmd, buff); // post-process here @@ -216,7 +216,7 @@ DRESULT disk_ioctl ( case MMC : // pre-process here - result = MMC_disk_ioctl(ctrl, buff); + result = MMC_disk_ioctl(cmd, buff); // post-process here @@ -225,7 +225,7 @@ DRESULT disk_ioctl ( case USB : // pre-process here - result = USB_disk_ioctl(ctrl, buff); + result = USB_disk_ioctl(cmd, buff); // post-process here diff --git a/src/diskio.h b/src/diskio.h index a6facab..580fbf7 100644 --- a/src/diskio.h +++ b/src/diskio.h @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------- -/ Low level disk interface modlue include file (C)ChaN, 2012 +/ Low level disk interface modlue include file (C)ChaN, 2013 /-----------------------------------------------------------------------*/ #ifndef _DISKIO_DEFINED @@ -32,11 +32,11 @@ typedef enum { /* Prototypes for disk control functions */ -DSTATUS disk_initialize (BYTE); -DSTATUS disk_status (BYTE); -DRESULT disk_read (BYTE, BYTE*, DWORD, BYTE); -DRESULT disk_write (BYTE, const BYTE*, DWORD, BYTE); -DRESULT disk_ioctl (BYTE, BYTE, void*); +DSTATUS disk_initialize (BYTE pdrv); +DSTATUS disk_status (BYTE pdrv); +DRESULT disk_read (BYTE pdrv, BYTE*buff, DWORD sector, BYTE count); +DRESULT disk_write (BYTE pdrv, const BYTE* buff, DWORD sector, BYTE count); +DRESULT disk_ioctl (BYTE pdrv, BYTE cmd, void* buff); /* Disk Status Bits (DSTATUS) */ diff --git a/src/ff.c b/src/ff.c index 059b588..7c9857c 100644 --- a/src/ff.c +++ b/src/ff.c @@ -1,11 +1,11 @@ /*----------------------------------------------------------------------------/ -/ FatFs - FAT file system module R0.09a (C)ChaN, 2012 +/ FatFs - FAT file system module R0.09b (C)ChaN, 2013 /-----------------------------------------------------------------------------/ / 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 terms. / -/ Copyright (C) 2012, ChaN, all right reserved. +/ Copyright (C) 2013, 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 @@ -93,6 +93,7 @@ / Aug 27,'12 R0.09a Fixed assertion failure due to OS/2 EA on FAT12/16 volume. / Changed f_open() and f_opendir reject null object pointer to avoid crash. / Changed option name _FS_SHARE to _FS_LOCK. +/ Jan 24,'13 R0.09b Added f_setlabel() and f_getlabel(). (_USE_LABEL = 1) /---------------------------------------------------------------------------*/ #include "ff.h" /* FatFs configurations and declarations */ @@ -105,7 +106,7 @@ ---------------------------------------------------------------------------*/ -#if _FATFS != 4004 /* Revision ID */ +#if _FATFS != 82786 /* Revision ID */ #error Wrong include file (ff.h). #endif @@ -512,6 +513,14 @@ static WCHAR LfnBuf[_MAX_LFN+1]; #endif +#ifdef _EXCVT +static +const BYTE ExCvt[] = _EXCVT; /* Upper conversion table for extended chars */ +#endif + + + + /*-------------------------------------------------------------------------- @@ -714,39 +723,51 @@ void clear_lock ( /* Clear lock entries of the volume */ /*-----------------------------------------------------------------------*/ -/* Change window offset */ +/* Move/Flush disk access window */ /*-----------------------------------------------------------------------*/ + +#if !_FS_READONLY +static +FRESULT sync_window ( + FATFS *fs /* File system object */ +) +{ + DWORD wsect; + UINT nf; + + + if (fs->wflag) { /* Write back the sector if it is dirty */ + wsect = fs->winsect; /* Current sector number */ + if (disk_write(fs->drv, fs->win, wsect, 1) != RES_OK) + return FR_DISK_ERR; + fs->wflag = 0; + if (wsect >= fs->fatbase && wsect < (fs->fatbase + fs->fsize)) { /* In FAT area? */ + for (nf = fs->n_fats; nf >= 2; nf--) { /* Reflect the change to all FAT copies */ + wsect += fs->fsize; + disk_write(fs->drv, fs->win, wsect, 1); + } + } + } + return FR_OK; +} +#endif + + static FRESULT move_window ( FATFS *fs, /* File system object */ DWORD sector /* Sector number to make appearance in the fs->win[] */ -) /* Move to zero only writes back dirty window */ +) { - DWORD wsect; - - - wsect = fs->winsect; - if (wsect != sector) { /* Changed current window */ + if (sector != fs->winsect) { /* Changed current window */ #if !_FS_READONLY - if (fs->wflag) { /* Write back dirty window if needed */ - if (disk_write(fs->drv, fs->win, wsect, 1) != RES_OK) - return FR_DISK_ERR; - fs->wflag = 0; - if (wsect < (fs->fatbase + fs->fsize)) { /* In FAT area */ - BYTE nf; - for (nf = fs->n_fats; nf > 1; nf--) { /* Reflect the change to all FAT copies */ - wsect += fs->fsize; - disk_write(fs->drv, fs->win, wsect, 1); - } - } - } + if (sync_window(fs) != FR_OK) + return FR_DISK_ERR; #endif - if (sector) { - if (disk_read(fs->drv, fs->win, sector, 1) != RES_OK) - return FR_DISK_ERR; - fs->winsect = sector; - } + if (disk_read(fs->drv, fs->win, sector, 1) != RES_OK) + return FR_DISK_ERR; + fs->winsect = sector; } return FR_OK; @@ -756,18 +777,18 @@ FRESULT move_window ( /*-----------------------------------------------------------------------*/ -/* Clean-up cached data */ +/* Synchronize file system and strage device */ /*-----------------------------------------------------------------------*/ #if !_FS_READONLY static -FRESULT sync ( /* FR_OK: successful, FR_DISK_ERR: failed */ - FATFS *fs /* File system object */ +FRESULT sync_fs ( /* FR_OK: successful, FR_DISK_ERR: failed */ + FATFS *fs /* File system object */ ) { FRESULT res; - res = move_window(fs, 0); + res = sync_window(fs); if (res == FR_OK) { /* Update FSInfo sector if needed */ if (fs->fs_type == FS_FAT32 && fs->fsi_flag) { @@ -1112,8 +1133,8 @@ FRESULT dir_sdi ( /*-----------------------------------------------------------------------*/ static -FRESULT dir_next ( /* FR_OK:Succeeded, FR_NO_FILE:End of table, FR_DENIED:EOT and could not stretch */ - DIR *dj, /* Pointer to directory object */ +FRESULT dir_next ( /* FR_OK:Succeeded, FR_NO_FILE:End of table, FR_DENIED:Could not stretch */ + DIR *dj, /* Pointer to the directory object */ int stretch /* 0: Do not stretch table, 1: Stretch table if needed */ ) { @@ -1147,12 +1168,12 @@ FRESULT dir_next ( /* FR_OK:Succeeded, FR_NO_FILE:End of table, FR_DENIED:EOT an if (clst == 1) return FR_INT_ERR; if (clst == 0xFFFFFFFF) return FR_DISK_ERR; /* Clean-up stretched table */ - if (move_window(dj->fs, 0)) return FR_DISK_ERR; /* Flush active window */ + if (sync_window(dj->fs)) return FR_DISK_ERR; /* Flush active window */ mem_set(dj->fs->win, 0, SS(dj->fs)); /* Clear window buffer */ dj->fs->winsect = clust2sect(dj->fs, clst); /* Cluster start sector */ for (c = 0; c < dj->fs->csize; c++) { /* Fill the new cluster with 0 */ dj->fs->wflag = 1; - if (move_window(dj->fs, 0)) return FR_DISK_ERR; + if (sync_window(dj->fs)) return FR_DISK_ERR; dj->fs->winsect++; } dj->fs->winsect -= c; /* Rewind window address */ @@ -1175,6 +1196,41 @@ FRESULT dir_next ( /* FR_OK:Succeeded, FR_NO_FILE:End of table, FR_DENIED:EOT an +/*-----------------------------------------------------------------------*/ +/* Directory handling - Reserve directory entry */ +/*-----------------------------------------------------------------------*/ + +#if !_FS_READONLY +static +FRESULT dir_alloc ( + DIR* dj, /* Pointer to the directory object */ + UINT nent /* Number of contiguous entries to allocate (1-21) */ +) +{ + FRESULT res; + UINT n; + + + res = dir_sdi(dj, 0); + if (res == FR_OK) { + n = 0; + do { + res = move_window(dj->fs, dj->sect); + if (res != FR_OK) break; + if (dj->dir[0] == DDE || dj->dir[0] == 0) { /* Is it a blank entry? */ + if (++n == nent) break; /* A block of contiguous entry is found */ + } else { + n = 0; /* Not a blank entry. Restart to search */ + } + res = dir_next(dj, 1); /* Next entry with table stretch enabled */ + } while (res == FR_OK); + } + return res; +} +#endif + + + /*-----------------------------------------------------------------------*/ /* Directory handling - Load/Store start cluster number */ /*-----------------------------------------------------------------------*/ @@ -1445,16 +1501,17 @@ FRESULT dir_find ( /*-----------------------------------------------------------------------*/ /* Read an object from the directory */ /*-----------------------------------------------------------------------*/ -#if _FS_MINIMIZE <= 1 +#if _FS_MINIMIZE <= 1 || _USE_LABEL || _FS_RPATH >= 2 static FRESULT dir_read ( - DIR *dj /* Pointer to the directory object that pointing the entry to be read */ + DIR *dj, /* Pointer to the directory object */ + int vol /* Filtered by 0:file/dir or 1:volume label */ ) { FRESULT res; - BYTE c, *dir; + BYTE a, c, *dir; #if _USE_LFN - BYTE a, ord = 0xFF, sum = 0xFF; + BYTE ord = 0xFF, sum = 0xFF; #endif res = FR_NO_FILE; @@ -1464,9 +1521,9 @@ FRESULT dir_read ( dir = dj->dir; /* Ptr to the directory entry of current index */ c = dir[DIR_Name]; if (c == 0) { res = FR_NO_FILE; break; } /* Reached to end of table */ -#if _USE_LFN /* LFN configuration */ a = dir[DIR_Attr] & AM_MASK; - if (c == DDE || (!_FS_RPATH && c == '.') || ((a & AM_VOL) && a != AM_LFN)) { /* An entry without valid data */ +#if _USE_LFN /* LFN configuration */ + if (c == DDE || (!_FS_RPATH && c == '.') || (a == AM_VOL) != vol) { /* An entry without valid data */ ord = 0xFF; } else { if (a == AM_LFN) { /* An LFN entry is found */ @@ -1484,7 +1541,7 @@ FRESULT dir_read ( } } #else /* Non LFN configuration */ - if (c != DDE && (_FS_RPATH || c != '.') && !(dir[DIR_Attr] & AM_VOL)) /* Is it a valid entry? */ + if (c != DDE && (_FS_RPATH || c != '.') && a != AM_LFN && (a == AM_VOL) == vol) /* Is it a valid entry? */ break; #endif res = dir_next(dj, 0); /* Next entry */ @@ -1495,7 +1552,7 @@ FRESULT dir_read ( return res; } -#endif +#endif /* _FS_MINIMIZE <= 1 || _USE_LABEL || _FS_RPATH >= 2 */ @@ -1509,9 +1566,8 @@ FRESULT dir_register ( /* FR_OK:Successful, FR_DENIED:No free entry or too many ) { FRESULT res; - BYTE c, *dir; #if _USE_LFN /* LFN configuration */ - WORD n, ne, is; + WORD n, ne; BYTE sn[12], *fn, sum; WCHAR *lfn; @@ -1534,35 +1590,18 @@ FRESULT dir_register ( /* FR_OK:Successful, FR_DENIED:No free entry or too many fn[NS] = sn[NS]; dj->lfn = lfn; } - if (sn[NS] & NS_LFN) { /* When LFN is to be created, reserve an SFN + LFN entries. */ - for (ne = 0; lfn[ne]; ne++) ; - ne = (ne + 25) / 13; - } else { /* Otherwise reserve only an SFN entry. */ + if (sn[NS] & NS_LFN) { /* When LFN is to be created, allocate entries for an SFN + LFNs. */ + for (n = 0; lfn[n]; n++) ; + ne = (n + 25) / 13; + } else { /* Otherwise allocate an entry for an SFN */ ne = 1; } + res = dir_alloc(dj, ne); /* Allocate entries */ - /* Reserve contiguous entries */ - res = dir_sdi(dj, 0); - if (res != FR_OK) return res; - n = is = 0; - do { - res = move_window(dj->fs, dj->sect); - if (res != FR_OK) break; - c = *dj->dir; /* Check the entry status */ - if (c == DDE || c == 0) { /* Is it a blank entry? */ - if (n == 0) is = dj->index; /* First index of the contiguous entry */ - if (++n == ne) break; /* A contiguous entry that required count is found */ - } else { - n = 0; /* Not a blank entry. Restart to search */ - } - res = dir_next(dj, 1); /* Next entry with table stretch */ - } while (res == FR_OK); - - if (res == FR_OK && ne > 1) { /* Initialize LFN entry if needed */ - res = dir_sdi(dj, is); + if (res == FR_OK && --ne) { /* Set LFN entry if needed */ + res = dir_sdi(dj, (WORD)(dj->index - ne)); if (res == FR_OK) { - sum = sum_sfn(dj->fn); /* Sum of the SFN tied to the LFN */ - ne--; + sum = sum_sfn(dj->fn); /* Sum value of the SFN tied to the LFN */ do { /* Store LFN entries in bottom first */ res = move_window(dj->fs, dj->sect); if (res != FR_OK) break; @@ -1572,28 +1611,17 @@ FRESULT dir_register ( /* FR_OK:Successful, FR_DENIED:No free entry or too many } while (res == FR_OK && --ne); } } - #else /* Non LFN configuration */ - res = dir_sdi(dj, 0); - if (res == FR_OK) { - do { /* Find a blank entry for the SFN */ - res = move_window(dj->fs, dj->sect); - if (res != FR_OK) break; - c = *dj->dir; - if (c == DDE || c == 0) break; /* Is it a blank entry? */ - res = dir_next(dj, 1); /* Next entry with table stretch */ - } while (res == FR_OK); - } + res = dir_alloc(dj, 1); /* Allocate an entry for SFN */ #endif - if (res == FR_OK) { /* Initialize the SFN entry */ + if (res == FR_OK) { /* Set SFN entry */ res = move_window(dj->fs, dj->sect); if (res == FR_OK) { - dir = dj->dir; - mem_set(dir, 0, SZ_DIR); /* Clean the entry */ - mem_cpy(dir, dj->fn, 11); /* Put SFN */ + mem_set(dj->dir, 0, SZ_DIR); /* Clean the entry */ + mem_cpy(dj->dir, dj->fn, 11); /* Put SFN */ #if _USE_LFN - dir[DIR_NTres] = *(dj->fn+NS) & (NS_BODY | NS_EXT); /* Put NT flag */ + dj->dir[DIR_NTres] = *(dj->fn+NS) & (NS_BODY | NS_EXT); /* Put NT flag */ #endif dj->fs->wflag = 1; } @@ -1661,10 +1689,6 @@ FRESULT create_name ( const TCHAR **path /* Pointer to pointer to the segment in the path string */ ) { -#ifdef _EXCVT - static const BYTE excvt[] = _EXCVT; /* Upper conversion table for extended chars */ -#endif - #if _USE_LFN /* LFN configuration */ BYTE b, cf; WCHAR w, *lfn; @@ -1743,7 +1767,7 @@ FRESULT create_name ( if (w >= 0x80) { /* Non ASCII char */ #ifdef _EXCVT w = ff_convert(w, 0); /* Unicode -> OEM code */ - if (w) w = excvt[w - 0x80]; /* Convert extended char to upper (SBCS) */ + if (w) w = ExCvt[w - 0x80]; /* Convert extended char to upper (SBCS) */ #else w = ff_convert(ff_wtoupper(w), 0); /* Upper converted Unicode -> OEM code */ #endif @@ -1820,10 +1844,10 @@ FRESULT create_name ( if (c >= 0x80) { /* Extended char? */ b |= 3; /* Eliminate NT flag */ #ifdef _EXCVT - c = excvt[c - 0x80]; /* Upper conversion (SBCS) */ + c = ExCvt[c - 0x80]; /* To upper extended chars (SBCS cfg) */ #else -#if !_DF1S /* ASCII only cfg */ - return FR_INVALID_NAME; +#if !_DF1S + return FR_INVALID_NAME; /* Reject extended chars (ASCII cfg) */ #endif #endif } @@ -1868,7 +1892,7 @@ FRESULT create_name ( /*-----------------------------------------------------------------------*/ /* Get file information from directory entry */ /*-----------------------------------------------------------------------*/ -#if _FS_MINIMIZE <= 1 +#if _FS_MINIMIZE <= 1 || _FS_RPATH >= 2 static void get_fileinfo ( /* No return code */ DIR *dj, /* Pointer to the directory object */ @@ -1942,7 +1966,7 @@ void get_fileinfo ( /* No return code */ } #endif } -#endif /* _FS_MINIMIZE <= 1 */ +#endif /* _FS_MINIMIZE <= 1 || _FS_RPATH >= 2*/ @@ -2059,7 +2083,7 @@ FRESULT chk_mounted ( /* FR_OK(0): successful, !=0: any error occurred */ vol = p[0] - '0'; /* Is there a drive number? */ if (vol <= 9 && p[1] == ':') { /* Found a drive number, get and strip it */ p += 2; *path = p; /* Return pointer to the path name */ - } else { /* No drive number is given */ + } else { /* No drive number, use default drive */ #if _FS_RPATH vol = CurrVol; /* Use current drive */ #else @@ -2074,7 +2098,7 @@ FRESULT chk_mounted ( /* FR_OK(0): successful, !=0: any error occurred */ fs = FatFs[vol]; /* Get corresponding file system object */ if (!fs) return FR_NOT_ENABLED; /* Is the file system object available? */ - ENTER_FF(fs); /* Lock file system */ + ENTER_FF(fs); /* Lock volume */ *rfs = fs; /* Return pointer to the corresponding file system object */ if (fs->fs_type) { /* If the volume has been mounted */ @@ -2152,8 +2176,9 @@ FRESULT chk_mounted ( /* FR_OK(0): successful, !=0: any error occurred */ /* Boundaries and Limits */ fs->n_fatent = nclst + 2; /* Number of FAT entries */ - fs->database = bsect + sysect; /* Data start sector */ + fs->volbase = bsect; /* Volume start sector */ fs->fatbase = bsect + nrsv; /* FAT start sector */ + fs->database = bsect + sysect; /* Data start sector */ if (fmt == FS_FAT32) { if (fs->n_rootdir) return FR_NO_FILESYSTEM; /* (BPB_RootEntCnt must be 0) */ fs->dirbase = LD_DWORD(fs->win+BPB_RootClus); /* Root directory start cluster */ @@ -2211,11 +2236,10 @@ FRESULT validate ( /* FR_OK(0): The object is valid, !=0: Invalid */ void* obj /* Pointer to the object FIL/DIR to check validity */ ) { - FIL *fil; + FIL *fil = (FIL*)obj; /* Assuming offset of fs and id in the FIL/DIR is identical */ - fil = (FIL*)obj; /* Assuming offset of fs and id in the FIL/DIR is identical */ - if (!fil->fs || !fil->fs->fs_type || fil->fs->id != fil->id) + if (!fil || !fil->fs || !fil->fs->fs_type || fil->fs->id != fil->id) return FR_INVALID_OBJECT; ENTER_FF(fil->fs); /* Lock file system */ @@ -2423,7 +2447,7 @@ FRESULT f_read ( FRESULT res; DWORD clst, sect, remain; UINT rcnt, cc; - BYTE csect, *rbuff = buff; + BYTE csect, *rbuff = (BYTE*)buff; *br = 0; /* Clear read byte counter */ @@ -2524,7 +2548,7 @@ FRESULT f_write ( FRESULT res; DWORD clst, sect; UINT wcnt, cc; - const BYTE *wbuff = buff; + const BYTE *wbuff = (const BYTE*)buff; BYTE csect; @@ -2561,7 +2585,7 @@ FRESULT f_write ( fp->clust = clst; /* Update current cluster */ } #if _FS_TINY - if (fp->fs->winsect == fp->dsect && move_window(fp->fs, 0)) /* Write-back sector cache */ + if (fp->fs->winsect == fp->dsect && sync_window(fp->fs)) /* Write-back sector cache */ ABORT(fp->fs, FR_DISK_ERR); #else if (fp->flag & FA__DIRTY) { /* Write-back sector cache */ @@ -2595,7 +2619,7 @@ FRESULT f_write ( } #if _FS_TINY if (fp->fptr >= fp->fsize) { /* Avoid silly cache filling at growing edge */ - if (move_window(fp->fs, 0)) ABORT(fp->fs, FR_DISK_ERR); + if (sync_window(fp->fs)) ABORT(fp->fs, FR_DISK_ERR); fp->fs->winsect = sect; } #else @@ -2638,7 +2662,7 @@ FRESULT f_sync ( ) { FRESULT res; - DWORD tim; + DWORD tm; BYTE *dir; @@ -2659,12 +2683,12 @@ FRESULT f_sync ( dir[DIR_Attr] |= AM_ARC; /* Set archive bit */ ST_DWORD(dir+DIR_FileSize, fp->fsize); /* Update file size */ st_clust(dir, fp->sclust); /* Update start cluster */ - tim = get_fattime(); /* Update updated time */ - ST_DWORD(dir+DIR_WrtTime, tim); + tm = get_fattime(); /* Update updated time */ + ST_DWORD(dir+DIR_WrtTime, tm); ST_WORD(dir+DIR_LstAccDate, 0); fp->flag &= ~FA__WRITTEN; fp->fs->wflag = 1; - res = sync(fp->fs); + res = sync_fs(fp->fs); } } } @@ -2773,8 +2797,8 @@ FRESULT f_chdir ( #if _FS_RPATH >= 2 FRESULT f_getcwd ( - TCHAR *path, /* Pointer to the directory path */ - UINT sz_path /* Size of path */ + TCHAR *buff, /* Pointer to the directory path */ + UINT len /* Size of path */ ) { FRESULT res; @@ -2786,22 +2810,22 @@ FRESULT f_getcwd ( DEF_NAMEBUF; - *path = 0; - res = chk_mounted((const TCHAR**)&path, &dj.fs, 0); /* Get current volume */ + *buff = 0; + res = chk_mounted((const TCHAR**)&buff, &dj.fs, 0); /* Get current volume */ if (res == FR_OK) { INIT_BUF(dj); - i = sz_path; /* Bottom of buffer (dir stack base) */ + i = len; /* Bottom of buffer (dir stack base) */ dj.sclust = dj.fs->cdir; /* Start to follow upper dir from current dir */ while ((ccl = dj.sclust) != 0) { /* Repeat while current dir is a sub-dir */ res = dir_sdi(&dj, 1); /* Get parent dir */ if (res != FR_OK) break; - res = dir_read(&dj); + res = dir_read(&dj, 0); if (res != FR_OK) break; dj.sclust = ld_clust(dj.fs, dj.dir); /* Goto parent dir */ res = dir_sdi(&dj, 0); if (res != FR_OK) break; do { /* Find the entry links to the child dir */ - res = dir_read(&dj); + res = dir_read(&dj, 0); if (res != FR_OK) break; if (ccl == ld_clust(dj.fs, dj.dir)) break; /* Found the entry */ res = dir_next(&dj, 0); @@ -2809,29 +2833,29 @@ FRESULT f_getcwd ( if (res == FR_NO_FILE) res = FR_INT_ERR;/* It cannot be 'not found'. */ if (res != FR_OK) break; #if _USE_LFN - fno.lfname = path; + fno.lfname = buff; fno.lfsize = i; #endif get_fileinfo(&dj, &fno); /* Get the dir name and push it to the buffer */ tp = fno.fname; - if (_USE_LFN && *path) tp = path; + if (_USE_LFN && *buff) tp = buff; for (n = 0; tp[n]; n++) ; if (i < n + 3) { res = FR_NOT_ENOUGH_CORE; break; } - while (n) path[--i] = tp[--n]; - path[--i] = '/'; + while (n) buff[--i] = tp[--n]; + buff[--i] = '/'; } - tp = path; + tp = buff; if (res == FR_OK) { *tp++ = '0' + CurrVol; /* Put drive number */ *tp++ = ':'; - if (i == sz_path) { /* Root-dir */ + if (i == len) { /* Root-dir */ *tp++ = '/'; } else { /* Sub-dir */ do /* Add stacked path str */ - *tp++ = path[i++]; - while (i < sz_path); + *tp++ = buff[i++]; + while (i < len); } } *tp = 0; @@ -3070,7 +3094,7 @@ FRESULT f_readdir ( res = dir_sdi(dj, 0); /* Rewind the directory object */ } else { INIT_BUF(*dj); - res = dir_read(dj); /* Read an directory item */ + res = dir_read(dj, 0); /* Read an item */ if (res == FR_NO_FILE) { /* Reached end of dir */ dj->sect = 0; res = FR_OK; @@ -3131,9 +3155,9 @@ FRESULT f_stat ( /*-----------------------------------------------------------------------*/ FRESULT f_getfree ( - const TCHAR *path, /* Pointer to the logical drive number (root dir) */ - DWORD *nclst, /* Pointer to the variable to return number of free clusters */ - FATFS **fatfs /* Pointer to pointer to corresponding file system object to return */ + const TCHAR *path, /* Path name of the logical drive number */ + DWORD *nclst, /* Pointer to a variable to return number of free clusters */ + FATFS **fatfs /* Pointer to return pointer to corresponding file system object */ ) { FRESULT res; @@ -3205,8 +3229,6 @@ FRESULT f_truncate ( DWORD ncl; - if (!fp) return FR_INVALID_OBJECT; - res = validate(fp); /* Check validity of the object */ if (res == FR_OK) { if (fp->flag & FA__ERROR) { /* Check abort flag */ @@ -3284,7 +3306,7 @@ FRESULT f_unlink ( sdj.sclust = dclst; res = dir_sdi(&sdj, 2); /* Exclude dot entries */ if (res == FR_OK) { - res = dir_read(&sdj); + res = dir_read(&sdj, 0); /* Read an item */ if (res == FR_OK /* Not empty dir */ #if _FS_RPATH || dclst == dj.fs->cdir /* Current dir */ @@ -3299,12 +3321,13 @@ FRESULT f_unlink ( if (res == FR_OK) { if (dclst) /* Remove the cluster chain if exist */ res = remove_chain(dj.fs, dclst); - if (res == FR_OK) res = sync(dj.fs); + if (res == FR_OK) res = sync_fs(dj.fs); } } } FREE_BUF(); } + LEAVE_FF(dj.fs, res); } @@ -3322,7 +3345,7 @@ FRESULT f_mkdir ( FRESULT res; DIR dj; BYTE *dir, n; - DWORD dsc, dcl, pcl, tim = get_fattime(); + DWORD dsc, dcl, pcl, tm = get_fattime(); DEF_NAMEBUF; @@ -3340,15 +3363,15 @@ FRESULT f_mkdir ( if (dcl == 1) res = FR_INT_ERR; if (dcl == 0xFFFFFFFF) res = FR_DISK_ERR; if (res == FR_OK) /* Flush FAT */ - res = move_window(dj.fs, 0); + res = sync_window(dj.fs); if (res == FR_OK) { /* Initialize the new directory table */ dsc = clust2sect(dj.fs, dcl); dir = dj.fs->win; mem_set(dir, 0, SS(dj.fs)); - mem_set(dir+DIR_Name, ' ', 8+3); /* Create "." entry */ + mem_set(dir+DIR_Name, ' ', 11); /* Create "." entry */ dir[DIR_Name] = '.'; dir[DIR_Attr] = AM_DIR; - ST_DWORD(dir+DIR_WrtTime, tim); + ST_DWORD(dir+DIR_WrtTime, tm); st_clust(dir, dcl); mem_cpy(dir+SZ_DIR, dir, SZ_DIR); /* Create ".." entry */ dir[33] = '.'; pcl = dj.sclust; @@ -3358,7 +3381,7 @@ FRESULT f_mkdir ( for (n = dj.fs->csize; n; n--) { /* Write dot entries and clear following sectors */ dj.fs->winsect = dsc++; dj.fs->wflag = 1; - res = move_window(dj.fs, 0); + res = sync_window(dj.fs); if (res != FR_OK) break; mem_set(dir, 0, SS(dj.fs)); } @@ -3369,10 +3392,10 @@ FRESULT f_mkdir ( } else { dir = dj.dir; dir[DIR_Attr] = AM_DIR; /* Attribute */ - ST_DWORD(dir+DIR_WrtTime, tim); /* Created time */ + ST_DWORD(dir+DIR_WrtTime, tm); /* Created time */ st_clust(dir, dcl); /* Table start cluster */ dj.fs->wflag = 1; - res = sync(dj.fs); + res = sync_fs(dj.fs); } } FREE_BUF(); @@ -3415,7 +3438,7 @@ FRESULT f_chmod ( mask &= AM_RDO|AM_HID|AM_SYS|AM_ARC; /* Valid attribute mask */ dir[DIR_Attr] = (value & mask) | (dir[DIR_Attr] & (BYTE)~mask); /* Apply attribute change */ dj.fs->wflag = 1; - res = sync(dj.fs); + res = sync_fs(dj.fs); } } } @@ -3456,7 +3479,7 @@ FRESULT f_utime ( ST_WORD(dir+DIR_WrtTime, fno->ftime); ST_WORD(dir+DIR_WrtDate, fno->fdate); dj.fs->wflag = 1; - res = sync(dj.fs); + res = sync_fs(dj.fs); } } } @@ -3502,7 +3525,7 @@ FRESULT f_rename ( res = follow_path(&djn, path_new); if (res == FR_OK) res = FR_EXIST; /* The new object name is already existing */ if (res == FR_NO_FILE) { /* Is it a valid path and no name collision? */ -/* Start critical section that an interruption or error can cause cross-link */ +/* Start critical section that any interruption can cause a cross-link */ res = dir_register(&djn); /* Register the new entry */ if (res == FR_OK) { dir = djn.dir; /* Copy object information except for name */ @@ -3526,7 +3549,7 @@ FRESULT f_rename ( if (res == FR_OK) { res = dir_remove(&djo); /* Remove old entry */ if (res == FR_OK) - res = sync(djo.fs); + res = sync_fs(djo.fs); } } /* End critical section */ @@ -3535,6 +3558,7 @@ FRESULT f_rename ( } FREE_BUF(); } + LEAVE_FF(djo.fs, res); } @@ -3545,6 +3569,166 @@ FRESULT f_rename ( +#if _USE_LABEL +/*-----------------------------------------------------------------------*/ +/* Get volume label */ +/*-----------------------------------------------------------------------*/ + +FRESULT f_getlabel ( + const TCHAR* path, /* Path name of the logical drive number */ + TCHAR* label, /* Pointer to a buffer to return the volume label */ + DWORD* sn /* Pointer to a variable to return the volume serial number */ +) +{ + FRESULT res; + DIR dj; + UINT i, j; + + + /* Get logical drive */ + res = chk_mounted(&path, &dj.fs, 0); + + /* Get volume label */ + if (res == FR_OK && label) { + dj.sclust = 0; /* Open root dir */ + res = dir_sdi(&dj, 0); + if (res == FR_OK) { + res = dir_read(&dj, 1); /* Get an entry with AM_VOL */ + if (res == FR_OK) { /* A volume label is exist */ +#if _LFN_UNICODE + WCHAR w; + i = j = 0; + do { + w = (i < 11) ? dj.dir[i++] : ' '; + if (IsDBCS1(w) && i < 11 && IsDBCS2(dj.dir[i])) + w = (w << 8) | dj.dir[i++]; + label[j++] = ff_convert(w, 1); + } while (j < 11); +#else + mem_cpy(label, dj.dir, 11); +#endif + j = 11; + do { + label[j] = 0; + if (!j) break; + } while (label[--j] == ' '); + } + if (res == FR_NO_FILE) { /* No label, return nul string */ + label[0] = 0; + res = FR_OK; + } + } + } + + /* Get volume serial number */ + if (res == FR_OK && sn) { + res = move_window(dj.fs, dj.fs->volbase); + if (res == FR_OK) { + i = dj.fs->fs_type == FS_FAT32 ? BS_VolID32 : BS_VolID; + *sn = LD_DWORD(&dj.fs->win[i]); + } + } + + LEAVE_FF(dj.fs, res); +} + + + +#if !_FS_READONLY +/*-----------------------------------------------------------------------*/ +/* Set volume label */ +/*-----------------------------------------------------------------------*/ + +FRESULT f_setlabel ( + const TCHAR* label /* Pointer to the volume label to set */ +) +{ + FRESULT res; + DIR dj; + BYTE vn[11]; + UINT i, j, sl; + WCHAR w; + DWORD tm; + + + /* Get logical drive */ + res = chk_mounted(&label, &dj.fs, 1); + if (res) LEAVE_FF(dj.fs, res); + + /* Create a volume label in directory form */ + vn[0] = 0; + for (sl = 0; label[sl]; sl++) ; /* Get name length */ + for ( ; sl && label[sl-1] == ' '; sl--) ; /* Remove trailing spaces */ + if (sl) { /* Create volume label in directory form */ + i = j = 0; + do { +#if _LFN_UNICODE + w = ff_convert(ff_wtoupper(label[i++]), 0); +#else + w = (BYTE)label[i++]; + if (IsDBCS1(w)) + w = (j < 10 && i < sl && IsDBCS2(label[i])) ? (w << 8) | (BYTE)label[i++] : 0; +#if _USE_LFN + w = ff_convert(ff_wtoupper(ff_convert(w, 1)), 0); +#else + if (IsLower(w)) w -= 0x20; /* To upper ASCII chars */ +#ifdef _EXCVT + if (w >= 0x80) w = ExCvt[w - 0x80]; /* To upper extended chars (SBCS cfg) */ +#else + if (!_DF1S && w >= 0x80) w = 0; /* Reject extended chars (ASCII cfg) */ +#endif +#endif +#endif + if (!w || chk_chr("\"*+,.:;<=>\?[]|\x7F", w) || j >= (UINT)((w >= 0x100) ? 10 : 11)) /* Reject invalid chars for volume label */ + LEAVE_FF(dj.fs, FR_INVALID_NAME); + if (w >= 0x100) vn[j++] = (BYTE)(w >> 8); + vn[j++] = (BYTE)w; + } while (i < sl); + while (j < 11) vn[j++] = ' '; + } + + /* Set volume label */ + dj.sclust = 0; /* Open root dir */ + res = dir_sdi(&dj, 0); + if (res == FR_OK) { + res = dir_read(&dj, 1); /* Get an entry with AM_VOL */ + if (res == FR_OK) { /* A volume label is found */ + if (vn[0]) { + mem_cpy(dj.dir, vn, 11); /* Change the volume label name */ + tm = get_fattime(); + ST_DWORD(dj.dir+DIR_WrtTime, tm); + } else { + dj.dir[0] = DDE; /* Remove the volume label */ + } + dj.fs->wflag = 1; + res = sync_fs(dj.fs); + } else { /* No volume label is found or error */ + if (res == FR_NO_FILE) { + res = FR_OK; + if (vn[0]) { /* Create volume label as new */ + res = dir_alloc(&dj, 1); /* Allocate an entry for volume label */ + if (res == FR_OK) { + mem_set(dj.dir, 0, SZ_DIR); /* Set volume label */ + mem_cpy(dj.dir, vn, 11); + dj.dir[DIR_Attr] = AM_VOL; + tm = get_fattime(); + ST_DWORD(dj.dir+DIR_WrtTime, tm); + dj.fs->wflag = 1; + res = sync_fs(dj.fs); + } + } + } + } + } + + LEAVE_FF(dj.fs, res); +} + +#endif /* !_FS_READONLY */ +#endif /* _USE_LABEL */ + + + /*-----------------------------------------------------------------------*/ /* Forward data to the stream directly (available on only tiny cfg) */ /*-----------------------------------------------------------------------*/ @@ -3553,7 +3737,7 @@ FRESULT f_rename ( FRESULT f_forward ( FIL *fp, /* Pointer to the file object */ UINT (*func)(const BYTE*,UINT), /* Pointer to the streaming function */ - UINT btr, /* Number of bytes to forward */ + UINT btf, /* Number of bytes to forward */ UINT *bf /* Pointer to number of bytes forwarded */ ) { @@ -3565,8 +3749,6 @@ FRESULT f_forward ( *bf = 0; /* Clear transfer byte counter */ - if (!fp) return FR_INVALID_OBJECT; - res = validate(fp); /* Check validity of the object */ if (res != FR_OK) LEAVE_FF(fp->fs, res); if (fp->flag & FA__ERROR) /* Check error flag */ @@ -3575,10 +3757,10 @@ FRESULT f_forward ( LEAVE_FF(fp->fs, FR_DENIED); remain = fp->fsize - fp->fptr; - if (btr > remain) btr = (UINT)remain; /* Truncate btr by remaining bytes */ + if (btf > remain) btf = (UINT)remain; /* Truncate btf by remaining bytes */ - for ( ; btr && (*func)(0, 0); /* Repeat until all data transferred or stream becomes busy */ - fp->fptr += rcnt, *bf += rcnt, btr -= rcnt) { + for ( ; btf && (*func)(0, 0); /* Repeat until all data transferred or stream becomes busy */ + fp->fptr += rcnt, *bf += rcnt, btf -= rcnt) { csect = (BYTE)(fp->fptr / SS(fp->fs) & (fp->fs->csize - 1)); /* Sector offset in the cluster */ if ((fp->fptr % SS(fp->fs)) == 0) { /* On the sector boundary? */ if (!csect) { /* On the cluster boundary? */ @@ -3596,7 +3778,7 @@ FRESULT f_forward ( ABORT(fp->fs, FR_DISK_ERR); fp->dsect = sect; rcnt = SS(fp->fs) - (WORD)(fp->fptr % SS(fp->fs)); /* Forward data from sector window */ - if (rcnt > btr) rcnt = btr; + if (rcnt > btf) rcnt = btf; rcnt = (*func)(&fp->fs->win[(WORD)fp->fptr % SS(fp->fs)], rcnt); if (!rcnt) ABORT(fp->fs, FR_INT_ERR); } @@ -3616,7 +3798,7 @@ FRESULT f_forward ( FRESULT f_mkfs ( - BYTE drv, /* Logical drive number */ + BYTE vol, /* Logical drive number */ BYTE sfd, /* Partitioning rule 0:FDISK, 1:SFD */ UINT au /* Allocation unit size [bytes] */ ) @@ -3633,14 +3815,14 @@ FRESULT f_mkfs ( /* Check mounted drive and clear work area */ - if (drv >= _VOLUMES) return FR_INVALID_DRIVE; + if (vol >= _VOLUMES) return FR_INVALID_DRIVE; if (sfd > 1) return FR_INVALID_PARAMETER; if (au & (au - 1)) return FR_INVALID_PARAMETER; - fs = FatFs[drv]; + fs = FatFs[vol]; if (!fs) return FR_NOT_ENABLED; fs->fs_type = 0; - pdrv = LD2PD(drv); /* Physical drive */ - part = LD2PT(drv); /* Partition (0:auto detect, 1-4:get from partition table)*/ + pdrv = LD2PD(vol); /* Physical drive */ + part = LD2PT(vol); /* Partition (0:auto detect, 1-4:get from partition table)*/ /* Get disk statics */ stat = disk_initialize(pdrv); @@ -3846,7 +4028,7 @@ FRESULT f_mkfs ( } -#if _MULTI_PARTITION == 2 +#if _MULTI_PARTITION /*-----------------------------------------------------------------------*/ /* Divide Physical Drive */ /*-----------------------------------------------------------------------*/ @@ -3913,7 +4095,7 @@ FRESULT f_fdisk ( } -#endif /* _MULTI_PARTITION == 2 */ +#endif /* _MULTI_PARTITION */ #endif /* _USE_MKFS && !_FS_READONLY */ @@ -3923,10 +4105,11 @@ FRESULT f_fdisk ( /*-----------------------------------------------------------------------*/ /* Get a string from the file */ /*-----------------------------------------------------------------------*/ + TCHAR* f_gets ( TCHAR* buff, /* Pointer to the string buffer to read */ int len, /* Size of string buffer (characters) */ - FIL* fil /* Pointer to the file object */ + FIL* fp /* Pointer to the file object */ ) { int n = 0; @@ -3936,20 +4119,20 @@ TCHAR* f_gets ( while (n < len - 1) { /* Read bytes until buffer gets filled */ - f_read(fil, s, 1, &rc); + f_read(fp, s, 1, &rc); if (rc != 1) break; /* Break on EOF or error */ c = s[0]; #if _LFN_UNICODE /* Read a character in UTF-8 encoding */ if (c >= 0x80) { if (c < 0xC0) continue; /* Skip stray trailer */ if (c < 0xE0) { /* Two-byte sequence */ - f_read(fil, s, 1, &rc); + f_read(fp, s, 1, &rc); if (rc != 1) break; c = ((c & 0x1F) << 6) | (s[0] & 0x3F); if (c < 0x80) c = '?'; } else { if (c < 0xF0) { /* Three-byte sequence */ - f_read(fil, s, 2, &rc); + f_read(fp, s, 2, &rc); if (rc != 2) break; c = (c << 12) | ((s[0] & 0x3F) << 6) | (s[1] & 0x3F); if (c < 0x800) c = '?'; @@ -3977,9 +4160,10 @@ TCHAR* f_gets ( /*-----------------------------------------------------------------------*/ /* Put a character to the file */ /*-----------------------------------------------------------------------*/ + int f_putc ( TCHAR c, /* A character to be output */ - FIL* fil /* Pointer to the file object */ + FIL* fp /* Pointer to the file object */ ) { UINT bw, btw; @@ -3987,7 +4171,7 @@ int f_putc ( #if _USE_STRFUNC >= 2 - if (c == '\n') f_putc ('\r', fil); /* LF -> CRLF conversion */ + if (c == '\n') f_putc ('\r', fp); /* LF -> CRLF conversion */ #endif #if _LFN_UNICODE /* Write the character in UTF-8 encoding */ @@ -4010,7 +4194,7 @@ int f_putc ( s[0] = (BYTE)c; btw = 1; #endif - f_write(fil, s, btw, &bw); /* Write the char to the file */ + f_write(fp, s, btw, &bw); /* Write the char to the file */ return (bw == btw) ? 1 : EOF; /* Return the result */ } @@ -4020,16 +4204,17 @@ int f_putc ( /*-----------------------------------------------------------------------*/ /* Put a string to the file */ /*-----------------------------------------------------------------------*/ + int f_puts ( const TCHAR* str, /* Pointer to the string to be output */ - FIL* fil /* Pointer to the file object */ + FIL* fp /* Pointer to the file object */ ) { int n; for (n = 0; *str; str++, n++) { - if (f_putc(*str, fil) == EOF) return EOF; + if (f_putc(*str, fp) == EOF) return EOF; } return n; } @@ -4040,8 +4225,9 @@ int f_puts ( /*-----------------------------------------------------------------------*/ /* Put a formatted string to the file */ /*-----------------------------------------------------------------------*/ + int f_printf ( - FIL* fil, /* Pointer to the file object */ + FIL* fp, /* Pointer to the file object */ const TCHAR* str, /* Pointer to the format string */ ... /* Optional arguments... */ ) @@ -4060,7 +4246,7 @@ int f_printf ( c = *str++; if (c == 0) break; /* End of string */ if (c != '%') { /* Non escape character */ - cc = f_putc(c, fil); + cc = f_putc(c, fp); if (cc != EOF) cc = 1; continue; } @@ -4089,14 +4275,14 @@ int f_printf ( for (j = 0; p[j]; j++) ; chc = 0; if (!(f & 2)) { - while (j++ < w) chc += (cc = f_putc(' ', fil)); + while (j++ < w) chc += (cc = f_putc(' ', fp)); } - chc += (cc = f_puts(p, fil)); - while (j++ < w) chc += (cc = f_putc(' ', fil)); + chc += (cc = f_puts(p, fp)); + while (j++ < w) chc += (cc = f_putc(' ', fp)); if (cc != EOF) cc = chc; continue; case 'C' : /* Character */ - cc = f_putc((TCHAR)va_arg(arp, int), fil); continue; + cc = f_putc((TCHAR)va_arg(arp, int), fp); continue; case 'B' : /* Binary */ r = 2; break; case 'O' : /* Octal */ @@ -4107,7 +4293,7 @@ int f_printf ( case 'X' : /* Hexdecimal */ r = 16; break; default: /* Unknown type (pass-through) */ - cc = f_putc(c, fil); continue; + cc = f_putc(c, fp); continue; } /* Get an argument and put it in numeral */ @@ -4124,11 +4310,11 @@ int f_printf ( } while (v && i < sizeof s / sizeof s[0]); if (f & 8) s[i++] = '-'; j = i; d = (f & 1) ? '0' : ' '; - res = 0; - while (!(f & 2) && j++ < w) res += (cc = f_putc(d, fil)); - do res += (cc = f_putc(s[--i], fil)); while(i); - while (j++ < w) res += (cc = f_putc(' ', fil)); - if (cc != EOF) cc = res; + chc = 0; + while (!(f & 2) && j++ < w) chc += (cc = f_putc(d, fp)); + do chc += (cc = f_putc(s[--i], fp)); while(i); + while (j++ < w) chc += (cc = f_putc(' ', fp)); + if (cc != EOF) cc = chc; } va_end(arp); diff --git a/src/ff.h b/src/ff.h index 627cbaa..eb60ebf 100644 --- a/src/ff.h +++ b/src/ff.h @@ -1,11 +1,11 @@ /*---------------------------------------------------------------------------/ -/ FatFs - FAT file system module include file R0.09a (C)ChaN, 2012 +/ FatFs - FAT file system module include file R0.09b (C)ChaN, 2013 /----------------------------------------------------------------------------/ / 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 terms. / -/ Copyright (C) 2012, ChaN, all right reserved. +/ Copyright (C) 2013, 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 @@ -15,7 +15,7 @@ /----------------------------------------------------------------------------*/ #ifndef _FATFS -#define _FATFS 4004 /* Revision ID */ +#define _FATFS 82786 /* Revision ID */ #ifdef __cplusplus extern "C" { @@ -99,6 +99,7 @@ typedef struct { #endif DWORD n_fatent; /* Number of FAT entries (= number of clusters + 2) */ DWORD fsize; /* Sectors per FAT */ + DWORD volbase; /* Volume start sector */ DWORD fatbase; /* FAT start sector */ DWORD dirbase; /* Root directory start sector (FAT32:Cluster#) */ DWORD database; /* Data start sector */ @@ -111,8 +112,8 @@ typedef struct { /* File object structure (FIL) */ typedef struct { - FATFS* fs; /* Pointer to the related file system object */ - WORD id; /* File system mount ID of the related file system object */ + FATFS* fs; /* Pointer to the related file system object (**do not change order**) */ + WORD id; /* Owner file system mount ID (**do not change order**) */ BYTE flag; /* File status flags */ BYTE pad1; DWORD fptr; /* File read/write pointer (0ed on file open) */ @@ -140,8 +141,8 @@ typedef struct { /* Directory object structure (DIR) */ typedef struct { - FATFS* fs; /* Pointer to the owner file system object */ - WORD id; /* Owner file system mount ID */ + FATFS* fs; /* Pointer to the owner file system object (**do not change order**) */ + WORD id; /* Owner file system mount ID (**do not change order**) */ WORD index; /* Current read/write index number */ DWORD sclust; /* Table start cluster (0:Root dir) */ DWORD clust; /* Current cluster */ @@ -202,33 +203,35 @@ typedef enum { /*--------------------------------------------------------------*/ /* FatFs module application interface */ -FRESULT f_mount (BYTE, FATFS*); /* Mount/Unmount a logical drive */ -FRESULT f_open (FIL*, const TCHAR*, BYTE); /* Open or create a file */ -FRESULT f_read (FIL*, void*, UINT, UINT*); /* Read data from a file */ -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 TCHAR*); /* Open an existing directory */ -FRESULT f_readdir (DIR*, FILINFO*); /* Read a directory item */ -FRESULT f_stat (const TCHAR*, FILINFO*); /* Get file status */ -FRESULT f_write (FIL*, const void*, UINT, UINT*); /* Write data to a file */ -FRESULT f_getfree (const TCHAR*, 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 TCHAR*); /* Delete an existing file or directory */ -FRESULT f_mkdir (const TCHAR*); /* Create a new directory */ -FRESULT f_chmod (const TCHAR*, BYTE, BYTE); /* Change attribute of the file/dir */ -FRESULT f_utime (const TCHAR*, const FILINFO*); /* Change times-tamp of the file/dir */ -FRESULT f_rename (const TCHAR*, const TCHAR*); /* Rename/Move a file or directory */ -FRESULT f_chdrive (BYTE); /* Change current drive */ -FRESULT f_chdir (const TCHAR*); /* Change current directory */ -FRESULT f_getcwd (TCHAR*, UINT); /* Get current directory */ -FRESULT f_forward (FIL*, UINT(*)(const BYTE*,UINT), UINT, UINT*); /* Forward data to the stream */ -FRESULT f_mkfs (BYTE, BYTE, UINT); /* Create a file system on the drive */ -FRESULT f_fdisk (BYTE, const DWORD[], void*); /* Divide a physical drive into some partitions */ -int f_putc (TCHAR, FIL*); /* Put a character to the file */ -int f_puts (const TCHAR*, FIL*); /* Put a string to the file */ -int f_printf (FIL*, const TCHAR*, ...); /* Put a formatted string to the file */ -TCHAR* f_gets (TCHAR*, int, FIL*); /* Get a string from the file */ +FRESULT f_mount (BYTE vol, FATFS* fs); /* Mount/Unmount a logical drive */ +FRESULT f_open (FIL* fp, const TCHAR* path, BYTE mode); /* Open or create a file */ +FRESULT f_read (FIL* fp, void* buff, UINT btr, UINT* br); /* Read data from a file */ +FRESULT f_lseek (FIL* fp, DWORD ofs); /* Move file pointer of a file object */ +FRESULT f_close (FIL* fp); /* Close an open file object */ +FRESULT f_opendir (DIR* dj, const TCHAR* path); /* Open an existing directory */ +FRESULT f_readdir (DIR* dj, FILINFO* fno); /* Read a directory item */ +FRESULT f_stat (const TCHAR* path, FILINFO* fno); /* Get file status */ +FRESULT f_write (FIL* fp, const void* buff, UINT btw, UINT* bw); /* Write data to a file */ +FRESULT f_getfree (const TCHAR* path, DWORD* nclst, FATFS** fatfs); /* Get number of free clusters on the drive */ +FRESULT f_truncate (FIL* fp); /* Truncate file */ +FRESULT f_sync (FIL* fp); /* Flush cached data of a writing file */ +FRESULT f_unlink (const TCHAR* path); /* Delete an existing file or directory */ +FRESULT f_mkdir (const TCHAR* path); /* Create a new directory */ +FRESULT f_chmod (const TCHAR* path, BYTE value, BYTE mask); /* Change attribute of the file/dir */ +FRESULT f_utime (const TCHAR* path, const FILINFO* fno); /* Change times-tamp of the file/dir */ +FRESULT f_rename (const TCHAR* path_old, const TCHAR* path_new); /* Rename/Move a file or directory */ +FRESULT f_chdrive (BYTE drv); /* Change current drive */ +FRESULT f_chdir (const TCHAR* path); /* Change current directory */ +FRESULT f_getcwd (TCHAR* buff, UINT len); /* Get current directory */ +FRESULT f_getlabel (const TCHAR* path, TCHAR* label, DWORD* sn); /* Get volume label */ +FRESULT f_setlabel (const TCHAR* label); /* Set volume label */ +FRESULT f_forward (FIL* fp, UINT(*func)(const BYTE*,UINT), UINT btf, UINT* bf); /* Forward data to the stream */ +FRESULT f_mkfs (BYTE vol, BYTE sfd, UINT au); /* Create a file system on the drive */ +FRESULT f_fdisk (BYTE pdrv, const DWORD szt[], void* work); /* Divide a physical drive into some partitions */ +int f_putc (TCHAR c, FIL* fp); /* Put a character to the file */ +int f_puts (const TCHAR* str, FIL* cp); /* Put a string to the file */ +int f_printf (FIL* fp, const TCHAR* str, ...); /* Put a formatted string to the file */ +TCHAR* f_gets (TCHAR* buff, int len, FIL* fp); /* Get a string from the file */ #define f_eof(fp) (((fp)->fptr == (fp)->fsize) ? 1 : 0) #define f_error(fp) (((fp)->flag & FA__ERROR) ? 1 : 0) @@ -251,21 +254,21 @@ DWORD get_fattime (void); #endif /* Unicode support functions */ -#if _USE_LFN /* Unicode - OEM code conversion */ -WCHAR ff_convert (WCHAR, UINT); /* OEM-Unicode bidirectional conversion */ -WCHAR ff_wtoupper (WCHAR); /* Unicode upper-case conversion */ -#if _USE_LFN == 3 /* Memory functions */ -void* ff_memalloc (UINT); /* Allocate memory block */ -void ff_memfree (void*); /* Free memory block */ +#if _USE_LFN /* Unicode - OEM code conversion */ +WCHAR ff_convert (WCHAR chr, UINT dir); /* OEM-Unicode bidirectional conversion */ +WCHAR ff_wtoupper (WCHAR chr); /* Unicode upper-case conversion */ +#if _USE_LFN == 3 /* Memory functions */ +void* ff_memalloc (UINT msize); /* Allocate memory block */ +void ff_memfree (void* mblock); /* Free memory block */ #endif #endif /* Sync functions */ #if _FS_REENTRANT -int ff_cre_syncobj (BYTE, _SYNC_t*);/* Create a sync object */ -int ff_req_grant (_SYNC_t); /* Lock sync object */ -void ff_rel_grant (_SYNC_t); /* Unlock sync object */ -int ff_del_syncobj (_SYNC_t); /* Delete a sync object */ +int ff_cre_syncobj (BYTE vol, _SYNC_t* sobj); /* Create a sync object */ +int ff_req_grant (_SYNC_t sobj); /* Lock sync object */ +void ff_rel_grant (_SYNC_t sobj); /* Unlock sync object */ +int ff_del_syncobj (_SYNC_t sobj); /* Delete a sync object */ #endif diff --git a/src/ffconf.h b/src/ffconf.h index 430138c..c5c5872 100644 --- a/src/ffconf.h +++ b/src/ffconf.h @@ -1,5 +1,5 @@ /*---------------------------------------------------------------------------/ -/ FatFs - FAT file system module configuration file R0.09a (C)ChaN, 2012 +/ FatFs - FAT file system module configuration file R0.09b (C)ChaN, 2013 /----------------------------------------------------------------------------/ / / CAUTION! Do not forget to make clean the project after any changes to @@ -7,7 +7,7 @@ / /----------------------------------------------------------------------------*/ #ifndef _FFCONF -#define _FFCONF 4004 /* Revision ID */ +#define _FFCONF 82786 /* Revision ID */ /*---------------------------------------------------------------------------/ @@ -44,14 +44,17 @@ /* To enable f_mkfs function, set _USE_MKFS to 1 and set _FS_READONLY to 0 */ -#define _USE_FORWARD 0 /* 0:Disable or 1:Enable */ -/* To enable f_forward function, set _USE_FORWARD to 1 and set _FS_TINY to 1. */ - - #define _USE_FASTSEEK 0 /* 0:Disable or 1:Enable */ /* To enable fast seek feature, set _USE_FASTSEEK to 1. */ +#define _USE_LABEL 0 /* 0:Disable or 1:Enable */ +/* To enable volume label functions, set _USE_LAVEL to 1 */ + + +#define _USE_FORWARD 0 /* 0:Disable or 1:Enable */ +/* To enable f_forward function, set _USE_FORWARD to 1 and set _FS_TINY to 1. */ + /*---------------------------------------------------------------------------/ / Locale and Namespace Configurations @@ -120,7 +123,6 @@ / Note that output of the f_readdir fnction is affected by this option. */ - /*---------------------------------------------------------------------------/ / Physical Drive Configurations /----------------------------------------------------------------------------*/ @@ -137,7 +139,7 @@ / and GET_SECTOR_SIZE command must be implememted to the disk_ioctl function. */ -#define _MULTI_PARTITION 0 /* 0:Single partition, 1/2:Enable multiple partition */ +#define _MULTI_PARTITION 0 /* 0:Single partition, 1:Enable multiple partition */ /* When set to 0, each volume is bound to the same physical drive number and / it can mount only first primaly partition. When it is set to 1, each volume / is tied to the partitions listed in VolToPart[]. */ diff --git a/src/option/cc932.c b/src/option/cc932.c index b208e11..5b7c5ea 100644 --- a/src/option/cc932.c +++ b/src/option/cc932.c @@ -3724,7 +3724,7 @@ const WCHAR sjis2uni[] = { WCHAR ff_convert ( /* Converted code, 0 means conversion error */ - WCHAR src, /* Character code to be converted */ + WCHAR chr, /* Character code to be converted */ UINT dir /* 0: Unicode to OEMCP, 1: OEMCP to Unicode */ ) { @@ -3733,8 +3733,8 @@ WCHAR ff_convert ( /* Converted code, 0 means conversion error */ int i, n, li, hi; - if (src <= 0x80) { /* ASCII */ - c = src; + if (chr <= 0x80) { /* ASCII */ + c = chr; } else { #if !_TINY_TABLE if (dir) { /* OEMCP to unicode */ @@ -3747,8 +3747,8 @@ WCHAR ff_convert ( /* Converted code, 0 means conversion error */ li = 0; for (n = 16; n; n--) { i = li + (hi - li) / 2; - if (src == p[i * 2]) break; - if (src > p[i * 2]) + if (chr == p[i * 2]) break; + if (chr > p[i * 2]) li = i; else hi = i; @@ -3760,15 +3760,15 @@ WCHAR ff_convert ( /* Converted code, 0 means conversion error */ do { c = *p; p += 2; - } while (c && c != src); + } while (c && c != chr); p -= 3; c = *p; } else { /* Unicode to OEMCP */ li = 0; hi = sizeof(uni2sjis) / 4 - 1; for (n = 16; n; n--) { i = li + (hi - li) / 2; - if (src == uni2sjis[i * 2]) break; - if (src > uni2sjis[i * 2]) + if (chr == uni2sjis[i * 2]) break; + if (chr > uni2sjis[i * 2]) li = i; else hi = i; diff --git a/src/option/cc936.c b/src/option/cc936.c index 5a13e58..1428f79 100644 --- a/src/option/cc936.c +++ b/src/option/cc936.c @@ -10922,7 +10922,7 @@ const WCHAR oem2uni[] = { WCHAR ff_convert ( /* Converted code, 0 means conversion error */ - WCHAR src, /* Character code to be converted */ + WCHAR chr, /* Character code to be converted */ UINT dir /* 0: Unicode to OEMCP, 1: OEMCP to Unicode */ ) { @@ -10931,8 +10931,8 @@ WCHAR ff_convert ( /* Converted code, 0 means conversion error */ int i, n, li, hi; - if (src < 0x80) { /* ASCII */ - c = src; + if (chr < 0x80) { /* ASCII */ + c = chr; } else { if (dir) { /* OEMCP to unicode */ p = oem2uni; @@ -10944,8 +10944,8 @@ WCHAR ff_convert ( /* Converted code, 0 means conversion error */ li = 0; for (n = 16; n; n--) { i = li + (hi - li) / 2; - if (src == p[i * 2]) break; - if (src > p[i * 2]) + if (chr == p[i * 2]) break; + if (chr > p[i * 2]) li = i; else hi = i; diff --git a/src/option/cc949.c b/src/option/cc949.c index bcf5082..95ca8d8 100644 --- a/src/option/cc949.c +++ b/src/option/cc949.c @@ -8551,7 +8551,7 @@ const WCHAR oem2uni[] = { WCHAR ff_convert ( /* Converted code, 0 means conversion error */ - WCHAR src, /* Character code to be converted */ + WCHAR chr, /* Character code to be converted */ UINT dir /* 0: Unicode to OEMCP, 1: OEMCP to Unicode */ ) { @@ -8560,8 +8560,8 @@ WCHAR ff_convert ( /* Converted code, 0 means conversion error */ int i, n, li, hi; - if (src < 0x80) { /* ASCII */ - c = src; + if (chr < 0x80) { /* ASCII */ + c = chr; } else { if (dir) { /* OEMCP to unicode */ p = oem2uni; @@ -8573,8 +8573,8 @@ WCHAR ff_convert ( /* Converted code, 0 means conversion error */ li = 0; for (n = 16; n; n--) { i = li + (hi - li) / 2; - if (src == p[i * 2]) break; - if (src > p[i * 2]) + if (chr == p[i * 2]) break; + if (chr > p[i * 2]) li = i; else hi = i; diff --git a/src/option/cc950.c b/src/option/cc950.c index ace2dfa..f768894 100644 --- a/src/option/cc950.c +++ b/src/option/cc950.c @@ -6777,7 +6777,7 @@ const WCHAR oem2uni[] = { WCHAR ff_convert ( /* Converted code, 0 means conversion error */ - WCHAR src, /* Character code to be converted */ + WCHAR chr, /* Character code to be converted */ UINT dir /* 0: Unicode to OEMCP, 1: OEMCP to Unicode */ ) { @@ -6786,8 +6786,8 @@ WCHAR ff_convert ( /* Converted code, 0 means conversion error */ int i, n, li, hi; - if (src < 0x80) { /* ASCII */ - c = src; + if (chr < 0x80) { /* ASCII */ + c = chr; } else { if (dir) { /* OEMCP to unicode */ p = oem2uni; @@ -6799,8 +6799,8 @@ WCHAR ff_convert ( /* Converted code, 0 means conversion error */ li = 0; for (n = 16; n; n--) { i = li + (hi - li) / 2; - if (src == p[i * 2]) break; - if (src > p[i * 2]) + if (chr == p[i * 2]) break; + if (chr > p[i * 2]) li = i; else hi = i; diff --git a/src/option/ccsbcs.c b/src/option/ccsbcs.c index 2a50589..8aa71b2 100644 --- a/src/option/ccsbcs.c +++ b/src/option/ccsbcs.c @@ -1,5 +1,5 @@ /*------------------------------------------------------------------------*/ -/* Unicode - Local code bidirectional converter (C)ChaN, 2009 */ +/* Unicode - Local code bidirectional converter (C)ChaN, 2012 */ /* (SBCS code pages) */ /*------------------------------------------------------------------------*/ /* 437 U.S. (OEM) @@ -68,7 +68,7 @@ const WCHAR Tbl[] = { /* CP720(0x80-0xFF) to Unicode conversion table */ 0x256A, 0x2518, 0x250C, 0x2588, 0x2584, 0x258C, 0x2590, 0x2580, 0x0636, 0x0637, 0x0638, 0x0639, 0x063A, 0x0641, 0x00B5, 0x0642, 0x0643, 0x0644, 0x0645, 0x0646, 0x0647, 0x0648, 0x0649, 0x064A, - 0x2261, 0x064B, 0x064C, 0x064D, 0x064E, 0x064F, 0xO650, 0x2248, + 0x2261, 0x064B, 0x064C, 0x064D, 0x064E, 0x064F, 0x0650, 0x2248, 0x00B0, 0x2219, 0x00B7, 0x221A, 0x207F, 0x00B2, 0x25A0, 0x00A0 }; @@ -499,23 +499,23 @@ const WCHAR Tbl[] = { /* CP1258(0x80-0xFF) to Unicode conversion table */ WCHAR ff_convert ( /* Converted character, Returns zero on error */ - WCHAR src, /* Character code to be converted */ + WCHAR chr, /* Character code to be converted */ UINT dir /* 0: Unicode to OEMCP, 1: OEMCP to Unicode */ ) { WCHAR c; - if (src < 0x80) { /* ASCII */ - c = src; + if (chr < 0x80) { /* ASCII */ + c = chr; } else { if (dir) { /* OEMCP to Unicode */ - c = (src >= 0x100) ? 0 : Tbl[src - 0x80]; + c = (chr >= 0x100) ? 0 : Tbl[chr - 0x80]; } else { /* Unicode to OEMCP */ for (c = 0; c < 0x80; c++) { - if (src == Tbl[c]) break; + if (chr == Tbl[c]) break; } c = (c + 0x80) & 0xFF; } diff --git a/src/option/syscall.c b/src/option/syscall.c index ad10cbb..c6bb20b 100644 --- a/src/option/syscall.c +++ b/src/option/syscall.c @@ -14,27 +14,31 @@ /* Create a Synchronization Object /*------------------------------------------------------------------------*/ /* This function is called in f_mount function to create a new -/ synchronization object, such as semaphore and mutex. When a zero is +/ synchronization object, such as semaphore and mutex. When a FALSE is / returned, the f_mount function fails with FR_INT_ERR. */ -int ff_cre_syncobj ( /* TRUE:Function succeeded, FALSE:Could not create due to any error */ +int ff_cre_syncobj ( /* 1:Function succeeded, 0:Could not create due to any error */ BYTE vol, /* Corresponding logical drive being processed */ _SYNC_t *sobj /* Pointer to return the created sync object */ ) { int ret; +// static _SYNC_t sem[_VOLUMES]; /* FreeRTOS */ - *sobj = CreateMutex(NULL, FALSE, NULL); /* Win32 */ + + *sobj = CreateMutex(NULL, FALSE, NULL); /* Win32 */ ret = (*sobj != INVALID_HANDLE_VALUE); -// *sobj = SyncObjects[vol]; /* uITRON (give a static sync object) */ -// ret = 1; /* The initial value of the semaphore must be 1. */ +// *sobj = SyncObjects[vol]; /* uITRON (give a static created sync object) */ +// ret = 1; /* The initial value of the semaphore must be 1. */ -// *sobj = OSMutexCreate(0, &err); /* uC/OS-II */ +// *sobj = OSMutexCreate(0, &err); /* uC/OS-II */ // ret = (err == OS_NO_ERR); -// *sobj = xSemaphoreCreateMutex(); /* FreeRTOS */ +// if (!sem[vol]) /* FreeRTOS */ +// sem[vol] = xSemaphoreCreateMutex(); +// *sobj = sem[vol]; // ret = (*sobj != NULL); return ret; @@ -46,15 +50,16 @@ int ff_cre_syncobj ( /* TRUE:Function succeeded, FALSE:Could not create due to a /* Delete a Synchronization Object */ /*------------------------------------------------------------------------*/ /* This function is called in f_mount function to delete a synchronization -/ object that created with ff_cre_syncobj function. When a zero is +/ object that created with ff_cre_syncobj function. When a FALSE is / returned, the f_mount function fails with FR_INT_ERR. */ -int ff_del_syncobj ( /* TRUE:Function succeeded, FALSE:Could not delete due to any error */ +int ff_del_syncobj ( /* 1:Function succeeded, 0:Could not delete due to any error */ _SYNC_t sobj /* Sync object tied to the logical drive to be deleted */ ) { - BOOL ret; + int ret; + ret = CloseHandle(sobj); /* Win32 */ @@ -74,7 +79,7 @@ int ff_del_syncobj ( /* TRUE:Function succeeded, FALSE:Could not delete due to a /* Request Grant to Access the Volume */ /*------------------------------------------------------------------------*/ /* This function is called on entering file functions to lock the volume. -/ When a zero is returned, the file function fails with FR_TIMEOUT. +/ When a FALSE is returned, the file function fails with FR_TIMEOUT. */ int ff_req_grant ( /* TRUE:Got a grant to access the volume, FALSE:Could not get a grant */ @@ -85,9 +90,9 @@ int ff_req_grant ( /* TRUE:Got a grant to access the volume, FALSE:Could not get ret = (WaitForSingleObject(sobj, _FS_TIMEOUT) == WAIT_OBJECT_0); /* Win32 */ -// ret = (wai_sem(sobj) == E_OK); /* uITRON */ +// ret = (wai_sem(sobj) == E_OK); /* uITRON */ -// OSMutexPend(sobj, _FS_TIMEOUT, &err)); /* uC/OS-II */ +// OSMutexPend(sobj, _FS_TIMEOUT, &err)); /* uC/OS-II */ // ret = (err == OS_NO_ERR); // ret = (xSemaphoreTake(sobj, _FS_TIMEOUT) == pdTRUE); /* FreeRTOS */ @@ -114,7 +119,6 @@ void ff_rel_grant ( // OSMutexPost(sobj); /* uC/OS-II */ // xSemaphoreGive(sobj); /* FreeRTOS */ - } #endif @@ -130,10 +134,10 @@ void ff_rel_grant ( */ void* ff_memalloc ( /* Returns pointer to the allocated memory block */ - UINT size /* Number of bytes to allocate */ + UINT msize /* Number of bytes to allocate */ ) { - return malloc(size); + return malloc(msize); } @@ -141,7 +145,7 @@ void* ff_memalloc ( /* Returns pointer to the allocated memory block */ /* Free a memory block */ /*------------------------------------------------------------------------*/ -void ff_memfree( +void ff_memfree ( void* mblock /* Pointer to the memory block to free */ ) {