From efa13a879df590ce0043a5b4f97597484bf264e1 Mon Sep 17 00:00:00 2001 From: inmarket Date: Wed, 13 Aug 2014 15:48:16 +1000 Subject: Move 3rd Party source to a new directory. Rationalise Fatfs code and fix a couple of configuration issues. --- 3rdparty/fatfs-0.10b/doc/en/appnote.html | 275 +++++++++++++++++++++++++++++ 3rdparty/fatfs-0.10b/doc/en/chdir.html | 81 +++++++++ 3rdparty/fatfs-0.10b/doc/en/chdrive.html | 60 +++++++ 3rdparty/fatfs-0.10b/doc/en/chmod.html | 89 ++++++++++ 3rdparty/fatfs-0.10b/doc/en/close.html | 66 +++++++ 3rdparty/fatfs-0.10b/doc/en/closedir.html | 64 +++++++ 3rdparty/fatfs-0.10b/doc/en/dinit.html | 46 +++++ 3rdparty/fatfs-0.10b/doc/en/dioctl.html | 90 ++++++++++ 3rdparty/fatfs-0.10b/doc/en/dread.html | 71 ++++++++ 3rdparty/fatfs-0.10b/doc/en/dstat.html | 48 +++++ 3rdparty/fatfs-0.10b/doc/en/dwrite.html | 76 ++++++++ 3rdparty/fatfs-0.10b/doc/en/eof.html | 62 +++++++ 3rdparty/fatfs-0.10b/doc/en/error.html | 62 +++++++ 3rdparty/fatfs-0.10b/doc/en/fattime.html | 57 ++++++ 3rdparty/fatfs-0.10b/doc/en/fdisk.html | 97 ++++++++++ 3rdparty/fatfs-0.10b/doc/en/filename.html | 78 ++++++++ 3rdparty/fatfs-0.10b/doc/en/forward.html | 139 +++++++++++++++ 3rdparty/fatfs-0.10b/doc/en/getcwd.html | 70 ++++++++ 3rdparty/fatfs-0.10b/doc/en/getfree.html | 95 ++++++++++ 3rdparty/fatfs-0.10b/doc/en/getlabel.html | 82 +++++++++ 3rdparty/fatfs-0.10b/doc/en/gets.html | 65 +++++++ 3rdparty/fatfs-0.10b/doc/en/lseek.html | 129 ++++++++++++++ 3rdparty/fatfs-0.10b/doc/en/mkdir.html | 80 +++++++++ 3rdparty/fatfs-0.10b/doc/en/mkfs.html | 73 ++++++++ 3rdparty/fatfs-0.10b/doc/en/mount.html | 83 +++++++++ 3rdparty/fatfs-0.10b/doc/en/open.html | 173 ++++++++++++++++++ 3rdparty/fatfs-0.10b/doc/en/opendir.html | 75 ++++++++ 3rdparty/fatfs-0.10b/doc/en/printf.html | 93 ++++++++++ 3rdparty/fatfs-0.10b/doc/en/putc.html | 62 +++++++ 3rdparty/fatfs-0.10b/doc/en/puts.html | 62 +++++++ 3rdparty/fatfs-0.10b/doc/en/rc.html | 87 +++++++++ 3rdparty/fatfs-0.10b/doc/en/read.html | 74 ++++++++ 3rdparty/fatfs-0.10b/doc/en/readdir.html | 125 +++++++++++++ 3rdparty/fatfs-0.10b/doc/en/rename.html | 85 +++++++++ 3rdparty/fatfs-0.10b/doc/en/sdir.html | 40 +++++ 3rdparty/fatfs-0.10b/doc/en/setlabel.html | 89 ++++++++++ 3rdparty/fatfs-0.10b/doc/en/sfatfs.html | 54 ++++++ 3rdparty/fatfs-0.10b/doc/en/sfile.html | 49 +++++ 3rdparty/fatfs-0.10b/doc/en/sfileinfo.html | 70 ++++++++ 3rdparty/fatfs-0.10b/doc/en/size.html | 62 +++++++ 3rdparty/fatfs-0.10b/doc/en/stat.html | 74 ++++++++ 3rdparty/fatfs-0.10b/doc/en/sync.html | 66 +++++++ 3rdparty/fatfs-0.10b/doc/en/tell.html | 62 +++++++ 3rdparty/fatfs-0.10b/doc/en/truncate.html | 66 +++++++ 3rdparty/fatfs-0.10b/doc/en/unlink.html | 75 ++++++++ 3rdparty/fatfs-0.10b/doc/en/utime.html | 99 +++++++++++ 3rdparty/fatfs-0.10b/doc/en/write.html | 74 ++++++++ 47 files changed, 3854 insertions(+) create mode 100644 3rdparty/fatfs-0.10b/doc/en/appnote.html create mode 100644 3rdparty/fatfs-0.10b/doc/en/chdir.html create mode 100644 3rdparty/fatfs-0.10b/doc/en/chdrive.html create mode 100644 3rdparty/fatfs-0.10b/doc/en/chmod.html create mode 100644 3rdparty/fatfs-0.10b/doc/en/close.html create mode 100644 3rdparty/fatfs-0.10b/doc/en/closedir.html create mode 100644 3rdparty/fatfs-0.10b/doc/en/dinit.html create mode 100644 3rdparty/fatfs-0.10b/doc/en/dioctl.html create mode 100644 3rdparty/fatfs-0.10b/doc/en/dread.html create mode 100644 3rdparty/fatfs-0.10b/doc/en/dstat.html create mode 100644 3rdparty/fatfs-0.10b/doc/en/dwrite.html create mode 100644 3rdparty/fatfs-0.10b/doc/en/eof.html create mode 100644 3rdparty/fatfs-0.10b/doc/en/error.html create mode 100644 3rdparty/fatfs-0.10b/doc/en/fattime.html create mode 100644 3rdparty/fatfs-0.10b/doc/en/fdisk.html create mode 100644 3rdparty/fatfs-0.10b/doc/en/filename.html create mode 100644 3rdparty/fatfs-0.10b/doc/en/forward.html create mode 100644 3rdparty/fatfs-0.10b/doc/en/getcwd.html create mode 100644 3rdparty/fatfs-0.10b/doc/en/getfree.html create mode 100644 3rdparty/fatfs-0.10b/doc/en/getlabel.html create mode 100644 3rdparty/fatfs-0.10b/doc/en/gets.html create mode 100644 3rdparty/fatfs-0.10b/doc/en/lseek.html create mode 100644 3rdparty/fatfs-0.10b/doc/en/mkdir.html create mode 100644 3rdparty/fatfs-0.10b/doc/en/mkfs.html create mode 100644 3rdparty/fatfs-0.10b/doc/en/mount.html create mode 100644 3rdparty/fatfs-0.10b/doc/en/open.html create mode 100644 3rdparty/fatfs-0.10b/doc/en/opendir.html create mode 100644 3rdparty/fatfs-0.10b/doc/en/printf.html create mode 100644 3rdparty/fatfs-0.10b/doc/en/putc.html create mode 100644 3rdparty/fatfs-0.10b/doc/en/puts.html create mode 100644 3rdparty/fatfs-0.10b/doc/en/rc.html create mode 100644 3rdparty/fatfs-0.10b/doc/en/read.html create mode 100644 3rdparty/fatfs-0.10b/doc/en/readdir.html create mode 100644 3rdparty/fatfs-0.10b/doc/en/rename.html create mode 100644 3rdparty/fatfs-0.10b/doc/en/sdir.html create mode 100644 3rdparty/fatfs-0.10b/doc/en/setlabel.html create mode 100644 3rdparty/fatfs-0.10b/doc/en/sfatfs.html create mode 100644 3rdparty/fatfs-0.10b/doc/en/sfile.html create mode 100644 3rdparty/fatfs-0.10b/doc/en/sfileinfo.html create mode 100644 3rdparty/fatfs-0.10b/doc/en/size.html create mode 100644 3rdparty/fatfs-0.10b/doc/en/stat.html create mode 100644 3rdparty/fatfs-0.10b/doc/en/sync.html create mode 100644 3rdparty/fatfs-0.10b/doc/en/tell.html create mode 100644 3rdparty/fatfs-0.10b/doc/en/truncate.html create mode 100644 3rdparty/fatfs-0.10b/doc/en/unlink.html create mode 100644 3rdparty/fatfs-0.10b/doc/en/utime.html create mode 100644 3rdparty/fatfs-0.10b/doc/en/write.html (limited to '3rdparty/fatfs-0.10b/doc/en') diff --git a/3rdparty/fatfs-0.10b/doc/en/appnote.html b/3rdparty/fatfs-0.10b/doc/en/appnote.html new file mode 100644 index 00000000..f7974e23 --- /dev/null +++ b/3rdparty/fatfs-0.10b/doc/en/appnote.html @@ -0,0 +1,275 @@ + + + + + + + + +FatFs Module Application Note + + + +

FatFs Module Application Note

+
    +
  1. How to Port
  2. +
  3. Limits
  4. +
  5. Memory Usage
  6. +
  7. Module Size Reduction
  8. +
  9. Long File Name
  10. +
  11. Unicode API
  12. +
  13. Re-entrancy
  14. +
  15. Duplicated File Access
  16. +
  17. Performance Effective File Access
  18. +
  19. Considerations on Flash Memory Media
  20. +
  21. Critical Section
  22. +
  23. Extended Use of FatFs API
  24. +
  25. About FatFs License
  26. +
+
+ +
+

How to Port

+ +

Basic considerations

+

The FatFs module is assuming following conditions on portability.

+ + +

System organizations

+

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

+

dependency diagram

+

(a) If a working disk module with FatFs API is provided, no additional function is needed. (b) To attach existing disk drivers with different API, glue functions are needed to translate the APIs between FatFs and the drivers.

+

functional diagram

+ +

Which function is required?

+

You need to provide only low level disk I/O functions that required by FatFs module and nothing else. If a working disk module for the target is already existing, you need to write only glue functions to attach it to the FatFs module. If not, you need to port any other disk module or write it from scratch. Most of defined functions are not that always required. For example, disk write function is not required in read-only configuration. Following table shows which function is required depends on configuration options.

+ + + + + + + + + + +
FunctionRequired when:Note
disk_status
disk_initialize
disk_read
AlwaysDisk I/O functions.
Samples available in ffsample.zip.
There are many implementations on the web.
disk_write
get_fattime
disk_ioctl (CTRL_SYNC)
_FS_READONLY == 0
disk_ioctl (GET_SECTOR_COUNT)
disk_ioctl (GET_BLOCK_SIZE)
_USE_MKFS == 1
disk_ioctl (GET_SECTOR_SIZE)_MAX_SS != _MIN_SS
disk_ioctl (CTRL_ERASE_SECTOR)_USE_ERASE == 1
ff_convert
ff_wtoupper
_USE_LFN >= 1Unicode support functions.
Available in option/unicode.c.
ff_cre_syncobj
ff_del_syncobj
ff_req_grant
ff_rel_grant
_FS_REENTRANT == 1O/S dependent functions.
Samples available in option/syscall.c.
ff_mem_alloc
ff_mem_free
_USE_LFN == 3
+
+ +
+

Limits

+ +
+ +
+

Memory Usage

+ + + + + + + + + + + + +
ARM7
32bit
ARM7
Thumb
CM3
Thumb-2
AVRH8/300HPIC24RL78V850ESSH-2ARX600IA-32
CompilerGCCGCCGCCGCCCH38C30CC78K0RCA850SHCRXCVC6
_WORD_ACCESS00010001011
text (Full, R/W)1067571716617133551094011722132628113904860327952
text (Min, R/W) 672746314331 8569 7262 7720 90885287580039485183
text (Full, R/O) 473131472889 6235 5170 5497 64823833397228623719
text (Min, R/O) 355924852295 4575 4064 4240 50192993310422142889
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*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
+

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

+
+FatFs R0.10a options:
+_FS_READONLY     0 (R/W) or 1 (R/O)
+_FS_MINIMIZE     0 (Full function) or 3 (Minimized function)
+_USE_STRFUNC     0 (Disable string functions)
+_USE_MKFS        0 (Disable f_mkfs function)
+_USE_FORWARD     0 (Disable f_forward function)
+_USE_FASTSEEK    0 (Disable fast seek feature)
+_CODE_PAGE       932 (Japanese Shift-JIS)
+_USE_LFN         0 (Disable LFN feature)
+_MAX_SS          512 (Fixed sector size)
+_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 thread safe)
+_FS_LOCK         0 (Disable file lock control)
+
+
+ +
+

Module Size Reduction

+

Follwing table shows which API function is removed by configuration options for the module size reduction.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Function_FS_MINIMIZE_FS_READONLY_USE_STRFUNC_FS_RPATH_FS_LABEL_USE_MKFS_USE_FORWARD_MULTI_PARTITION
0123010  1/201201010101
f_mount
f_open
f_close
f_read
f_writex
f_syncx
f_lseekx
f_opendirxx
f_closedirxx
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
+
+ +
+

Long File Name

+

FatFs module supports LFN (long file name). The two different file names, SFN (short file name) and LFN, of a file is transparent on the API except for f_readdir() function. The LFN feature is disabled by default. To enable it, set _USE_LFN to 1, 2 or 3, and add option/unicode.c to the project. The LFN feature requiers a certain working buffer in addition. The buffer size can be configured by _MAX_LFN according to the available memory. The length of an LFN will reach up to 255 characters, so that the _MAX_LFN should be set to 255 for full featured LFN operation. If the size of working buffer is insufficient for the input file name, the file function fails with FR_INVALID_NAME. When enable the LFN feature with re-entrant configuration, _USE_LFN must be set to 2 or 3. In this case, the file function allocates the working buffer on the stack or heap. The working buffer occupies (_MAX_LFN + 1) * 2 bytes.

+ + + + + + + + +
LFN cfg on ARM7TDMI
Code pageProgram size
SBCS+3.7K
932(Shift-JIS)+62K
936(GBK)+177K
949(Korean)+139K
950(Big5)+111K
+

When the LFN feature is enabled, the module size will be increased depends on the selected code page. Right table shows 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

+

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

+
+ +
+

Re-entrancy

+

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

+

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

+

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

+

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

+
+ +
+

Duplicated File Access

+

FatFs module does not support the read/write collision control of duplicated open to a file. The duplicated open is permitted only when each of open method to a file is read mode. The duplicated open with one or more write mode to a file is always prohibited, and also open file must not be renamed and deleted. A violation of these rules can cause data colluption.

+

The file lock control can also be available by _FS_LOCK option. The value defines the number of open objects to manage simultaneously. In this case, if any open, rename or remove that violating the file shareing rule that described above is attempted, the file function will fail with FR_LOCKED. If number of open objects, files and sub-directories, gets larger than _FS_LOCK, the f_open(), f_optndir() function will fail with FR_TOO_MANY_OPEN_FILES.

+
+ +
+

Performance Effective File Access

+

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

+

Figure 1. Sector misaligned read (short)
+ +

+

Figure 2. Sector misaligned read (long)
+ +

+

Figure 3. Fully sector aligned read
+ +

+

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

+

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

+

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

+
+ +
+

Considerations on Flash Memory Media

+

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

+

Using Mutiple-Sector Write

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

The write throughput of the flash memory media becomes the worst at single sector write transaction. The write throughput increases as the number of sectors per a write transaction. This effect more appers at faster interface speed and the performance ratio often becomes grater than ten. This graph is clearly explaining how fast is multiple block write (W:16K, 32 sectors) than single block write (W:100, 1 sector), and also larger card tends to be slow at single block write. The number of write transactions also affects the life time of the flash memory media. Therefore the application program should write the data in large block as possible. The ideal write chunk size and alighment is size of sector, and size of cluster is the best. Of course all layers between the application and the storage device must have consideration on multiple sector write, however most of open-source disk drivers lack it. Do not split a multiple sector write request into single sector write transactions or the write throughput gets poor. Note that FatFs module and its sample disk drivers supprt multiple sector read/write feature.

+

Forcing Memory Erase

+

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

+
+ +
+

Critical Section

+

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 broken. Following images shows the critical section of the FatFs module.

+
+Figure 4. Long critical section
+fig.4 +
+
+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 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 opened in write mode. To minimize risk of data loss, the critical section can be minimized by minimizing the time that file is opened in write mode or using f_sync() function as shown in Figure 5.

+
+ +
+

Extended Use of FatFs API

+

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. +
  7. Function/Compatible checker for low level disk I/O module
  8. +
  9. FAT image creator
  10. +
+
+ +
+

About FatFs License

+

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

+
/*----------------------------------------------------------------------------/
+/  FatFs - FAT file system module  R0.10b                    (C)ChaN, 2014
+/-----------------------------------------------------------------------------/
+/ FatFs module is a generic FAT file system module for small embedded systems.
+/ This is a free software that opened for education, research and commercial
+/ developments under license policy of following trems.
+/
+/  Copyright (C) 2014, ChaN, all right reserved.
+/
+/ * The FatFs module is a free software and there is NO WARRANTY.
+/ * No restriction on use. You can use, modify and redistribute it for
+/   personal, non-profit or commercial products UNDER YOUR RESPONSIBILITY.
+/ * Redistributions of source code must retain the above copyright notice.
+/
+/-----------------------------------------------------------------------------/
+

Therefore FatFs license is one of the BSD-style licenses but there is a significant feature. Because FatFs is for embedded projects, the conditions of redistributions in binary form, such as embedded code, hex file, binary library or any forms without source code, are not specified in order to extend usability for commercial products. The documentation of the distributions need not include about FatFs and its license document, and it may also. This is equivalent to the BSD 1-Clause License. Of course FatFs is compatible with the projects under GNU GPL. When redistribute the FatFs with any modification or branch it as a folk, the license can also be changed to GNU GPL or BSD-style license.

+
+ +

Return

+ + diff --git a/3rdparty/fatfs-0.10b/doc/en/chdir.html b/3rdparty/fatfs-0.10b/doc/en/chdir.html new file mode 100644 index 00000000..64317707 --- /dev/null +++ b/3rdparty/fatfs-0.10b/doc/en/chdir.html @@ -0,0 +1,81 @@ + + + + + + + + +FatFs - f_chdir + + + + +
+

f_chdir

+

The f_chdir function changes the current directory of a drive.

+
+FRESULT f_chdir (
+  const TCHAR* path /* [IN] Path name */
+);
+
+
+ +
+

Parameters

+
+
path
+
Pointer to the null-terminated string that specifies a directory to go.
+
+
+ + +
+

Return Values

+

+FR_OK, +FR_DISK_ERR, +FR_INT_ERR, +FR_NOT_READY, +FR_NO_PATH, +FR_INVALID_NAME, +FR_INVALID_DRIVE, +FR_NOT_ENABLED, +FR_NO_FILESYSTEM, +FR_TIMEOUT, +FR_NOT_ENOUGH_CORE +

+
+ + +
+

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

+
+ + +
+

QuickInfo

+

Available when _FS_RPATH >= 1.

+
+ + +
+

Example

+
+    /* Change current direcoty of the current drive (dir1 under root dir) */
+    f_chdir("/dir1");
+
+    /* Change current direcoty of drive 2 (parent dir) */
+    f_chdir("2:..");
+
+
+ +
+

See Also

+

f_chdrive, f_getcwd

+
+ +

Return

+ + diff --git a/3rdparty/fatfs-0.10b/doc/en/chdrive.html b/3rdparty/fatfs-0.10b/doc/en/chdrive.html new file mode 100644 index 00000000..fdc15774 --- /dev/null +++ b/3rdparty/fatfs-0.10b/doc/en/chdrive.html @@ -0,0 +1,60 @@ + + + + + + + + +FatFs - f_chdrive + + + + +
+

f_chdrive

+

The f_chdrive function changes the current drive.

+
+FRESULT f_chdrive (
+  const TCHAR* path  /* [IN] Logical drive number */
+);
+
+
+ +
+

Parameters

+
+
path
+
Specifies the logical drive number to be set as the current drive.
+
+
+ + +
+

Return Values

+

+FR_OK, +FR_INVALID_DRIVE +

+
+ + +
+

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.

+
+ +
+

QuickInfo

+

Available when _FS_RPATH >= 1 and _VOLUMES >= 2.

+
+ + +
+

See Also

+

f_chdir, f_getcwd

+
+ +

Return

+ + diff --git a/3rdparty/fatfs-0.10b/doc/en/chmod.html b/3rdparty/fatfs-0.10b/doc/en/chmod.html new file mode 100644 index 00000000..755ff318 --- /dev/null +++ b/3rdparty/fatfs-0.10b/doc/en/chmod.html @@ -0,0 +1,89 @@ + + + + + + + + +FatFs - f_chmod + + + + +
+

f_chmod

+

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

+
+FRESULT f_chmod (
+  const TCHAR* path, /* [IN] Object name */
+  BYTE attr,         /* [IN] Attribute flags */
+  BYTE mask          /* [IN] Attribute masks */
+);
+
+
+ +
+

Parameters

+
+
path
+
Pointer to the null-terminated string that specifies an object to be changed
+
attr
+
Attribute flags to be set in one or more combination of the following flags. The specified flags are set and others are cleard.
+ + + + + + +
AttributeDescription
AM_RDORead only
AM_ARCArchive
AM_SYSSystem
AM_HIDHidden
+
+
mask
+
Attribute mask that specifies which attribute is changed. The specified attributes are set or cleard and others are left unchanged.
+
+
+ + +
+

Return Values

+

+FR_OK, +FR_DISK_ERR, +FR_INT_ERR, +FR_NOT_READY, +FR_NO_FILE, +FR_NO_PATH, +FR_INVALID_NAME, +FR_WRITE_PROTECTED, +FR_INVALID_DRIVE, +FR_NOT_ENABLED, +FR_NO_FILESYSTEM, +FR_TIMEOUT, +FR_NOT_ENOUGH_CORE +

+
+ + +
+

Description

+

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

+
+ + +
+

QuickInfo

+

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

+
+ + +
+

Example

+
+    /* Set read-only flag, clear archive flag and others are left unchanged. */
+    f_chmod("file.txt", AR_RDO, AR_RDO | AR_ARC);
+
+
+ +

Return

+ + diff --git a/3rdparty/fatfs-0.10b/doc/en/close.html b/3rdparty/fatfs-0.10b/doc/en/close.html new file mode 100644 index 00000000..0746700b --- /dev/null +++ b/3rdparty/fatfs-0.10b/doc/en/close.html @@ -0,0 +1,66 @@ + + + + + + + + +FatFs - f_close + + + + +
+

f_close

+

The f_close function closes an open file.

+
+FRESULT f_close (
+  FIL* fp     /* [IN] Pointer to the file object */
+);
+
+
+ +
+

Parameter

+
+
fp
+
Pointer to the open file object structure to be closed.
+
+
+ + +
+

Return Values

+

+FR_OK, +FR_DISK_ERR, +FR_INT_ERR, +FR_NOT_READY, +FR_INVALID_OBJECT, +FR_TIMEOUT +

+
+ + +
+

Description

+

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

+

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

+
+ + +
+

QuickInfo

+

Always available.

+
+ + +
+

See Also

+

f_open, f_read, f_write, f_sync, FIL, FATFS

+
+ +

Return

+ + diff --git a/3rdparty/fatfs-0.10b/doc/en/closedir.html b/3rdparty/fatfs-0.10b/doc/en/closedir.html new file mode 100644 index 00000000..05ef6f69 --- /dev/null +++ b/3rdparty/fatfs-0.10b/doc/en/closedir.html @@ -0,0 +1,64 @@ + + + + + + + + +FatFs - f_closedir + + + + +
+

f_closedir

+

The f_closedir function closes an open directory.

+
+FRESULT f_closedir (
+  DIR* dp     /* [IN] Pointer to the directory object */
+);
+
+
+ +
+

Parameter

+
+
dp
+
Pointer to the open directory object structure to be closed.
+
+
+ + +
+

Return Values

+

+FR_OK, +FR_INT_ERR, +FR_INVALID_OBJECT, +FR_TIMEOUT +

+
+ + +
+

Description

+

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

+

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

+
+ + +
+

QuickInfo

+

Available when _FS_MINIMIZE <= 1.

+
+ + +
+

See Also

+

f_opendir, f_readdir, DIR

+
+ +

Return

+ + diff --git a/3rdparty/fatfs-0.10b/doc/en/dinit.html b/3rdparty/fatfs-0.10b/doc/en/dinit.html new file mode 100644 index 00000000..4675dd9b --- /dev/null +++ b/3rdparty/fatfs-0.10b/doc/en/dinit.html @@ -0,0 +1,46 @@ + + + + + + + + +FatFs - disk_initialize + + + + +
+

disk_initialize

+

The disk_initialize function initializes the storage device.

+
+DSTATUS disk_initialize (
+  BYTE pdrv           /* [IN] Physical drive number */
+);
+
+
+ +
+

Parameter

+
+
pdrv
+
Physical drive number to identify the target device.
+
+
+ + +
+

Return Values

+

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

+
+ +
+

Description

+

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

+

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

+
+ +

Return

+ + diff --git a/3rdparty/fatfs-0.10b/doc/en/dioctl.html b/3rdparty/fatfs-0.10b/doc/en/dioctl.html new file mode 100644 index 00000000..fec70c8b --- /dev/null +++ b/3rdparty/fatfs-0.10b/doc/en/dioctl.html @@ -0,0 +1,90 @@ + + + + + + + + +FatFs - disk_ioctl + + + + +
+

disk_ioctl

+

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

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

Parameters

+
+
pdrv
+
Physical drive number to identify the target device.
+
cmd
+
Command code.
+
buff
+
Pointer to the parameter depends on the command code. Do not care if no parameter to be passed.
+
+
+ + +
+

Return Value

+
+
RES_OK (0)
+
The function succeeded.
+
RES_ERROR
+
An error occured.
+
RES_PARERR
+
The command code or parameter is invalid.
+
RES_NOTRDY
+
The device has not been initialized.
+
+
+ + +
+

Description

+

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

+ + + + + + + + +
Standard ioctl command used by FatFs
CommandDescription
CTRL_SYNCMake sure that the device has finished pending write process. If the disk I/O module has a write back cache, the dirty buffers must be written back to the media immediately. Nothing to do for this command if each write operation to the media is completed within the disk_write() function. Required at _FS_READONLY == 0.
GET_SECTOR_COUNTReturns number of available sectors on the drive into the DWORD variable pointed by buff. This command is used by only f_mkfs() and f_fdisk() function to determine the volume/partition size to be created. Required at _USE_MKFS == 1 or _MULTI_PARTITION == 1.
GET_SECTOR_SIZEReturns sector size of the media into the WORD variable pointed by buff. Valid return values of this command are 512, 1024, 2048 or 4096. This command is required at variable sector size configuration, _MAX_SS > _MIN_SS. Never used at fixed sector size configuration, _MAX_SS == _MIN_SS, and it must work at that sector size.
GET_BLOCK_SIZEReturns erase block size of the flash memory in unit of sector into the DWORD variable pointed by buff. The allowable value is from 1 to 32768 in power of 2. Return 1 if the erase block size is unknown or disk media. This command is used by only f_mkfs() function and it attempts to align data area to the erase block boundary. Required at _USE_MKFS == 1.
CTRL_ERASE_SECTORInforms device that the data on the block of sectors specified by a DWORD array {<start sector>, <end sector>} pointed by buff is no longer needed and may be erased. The device would force erased the memory block. This is a command similar to Trim command of ATA device. When this feature is not supported or not a flash memory media, nothing to do for this command. The FatFs does not check the result code and the file function is not affected even if the sectors ware not erased well. This command is called on removing a cluster chain and f_mkfs() function. Required at _USE_ERASE == 1.
+ +

FatFs never uses any device dependent command and user defined command. Following table shows an example of non-standard commands usable for some applications.

+ + + + + + + + + + + + + + + + + +
Example of optional ioctl command
CommandDescription
CTRL_FORMATCreate a physical format on the media. If buff is not null, it is pointer to the call-back function for progress notification.
CTRL_POWER_IDLEPut the device idle state. STA_NOINIT in status flag may not be set if the device would go active state by generic read/write function.
CTRL_POWER_OFFPut the device off state. Shut-down the power to the device and deinitialize the device interface if needed. STA_NOINIT in status flag must be set. The device goes active state by disk_initialize() function.
CTRL_LOCKLock media eject mechanism.
CTRL_UNLOCKUnlock media eject mechanism.
CTRL_EJECTEject media cartridge. STA_NOINIT and STA_NODISK in status flag are set after the function succeeded.
MMC_GET_TYPEGet card type. The type flags, bit0:MMCv3, bit1:SDv1, bit2:SDv2+ and bit3:LBA, is stored to a BYTE variable pointed by buff. (MMC/SDC specific command)
MMC_GET_CSDGet CSD register into a 16-byte buffer pointed by buff. (MMC/SDC specific command)
MMC_GET_CIDGet CID register into a 16-byte buffer pointed by buff. (MMC/SDC specific command)
MMC_GET_OCRGet OCR register into a 4-byte buffer pointed by buff. (MMC/SDC specific command)
MMC_GET_SDSTATGet SDSTATUS register into a 64-byte buffer pointed by buff. (SDC specific command)
ATA_GET_REVGet the revision string into a 16-byte buffer pointed by buff. (ATA/CFC specific command)
ATA_GET_MODELGet the model string into a 40-byte buffer pointed by buff. (ATA/CFC specific command)
ATA_GET_SNGet the serial number string into a 20-byte buffer pointed by buff. (ATA/CFC specific command)
+
+ +

Return

+ + diff --git a/3rdparty/fatfs-0.10b/doc/en/dread.html b/3rdparty/fatfs-0.10b/doc/en/dread.html new file mode 100644 index 00000000..3f9bc039 --- /dev/null +++ b/3rdparty/fatfs-0.10b/doc/en/dread.html @@ -0,0 +1,71 @@ + + + + + + + + +FatFs - disk_read + + + + +
+

disk_read

+

The disk_read function reads sector(s) from the storage device.

+
+DRESULT disk_read (
+  BYTE pdrv,     /* [IN] Physical drive number */
+  BYTE* buff,    /* [OUT] Pointer to the read data buffer */
+  DWORD sector,  /* [IN] Start sector number */
+  UINT count     /* [IN] Number of sectros to read */
+);
+
+
+ +
+

Parameters

+
+
pdrv
+
Physical drive number to identify the target device.
+
buff
+
Pointer to the byte array to store the read data.
+
sector
+
Start sector number in logical block address (LBA).
+
count
+
Number of sectors to read. FatFs specifis it in range of from 1 to 128.
+
+
+ + +
+

Return Value

+
+
RES_OK (0)
+
The function succeeded.
+
RES_ERROR
+
Any hard error occured during the read operation and could not recover it.
+
RES_PARERR
+
Invalid parameter.
+
RES_NOTRDY
+
The device has not been initialized.
+
+
+ + +
+

Description

+

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.

+ +

Generally, a multiple sector transfer request must not be split into single sector transactions to the storage device, or you will not get good read throughput.

+
+ + +

Return

+ + diff --git a/3rdparty/fatfs-0.10b/doc/en/dstat.html b/3rdparty/fatfs-0.10b/doc/en/dstat.html new file mode 100644 index 00000000..d2b0242b --- /dev/null +++ b/3rdparty/fatfs-0.10b/doc/en/dstat.html @@ -0,0 +1,48 @@ + + + + + + + + +FatFs - disk_status + + + + +
+

disk_status

+

The disk_status function returns the current disk status.

+
+DSTATUS disk_status (
+  BYTE pdrv     /* [IN] Physical drive number */
+);
+
+
+ +
+

Parameter

+
+
pdrv
+
Physical drive number to identify the target device.
+
+
+ + +
+

Return Values

+

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

+
+
STA_NOINIT
+
Indicates that the device 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. Note that FatFs does not refer this flag.
+
STA_PROTECT
+
Indicates that the medium is write protected. This is always cleared on the drives without write protect feature. Not valid while no medium in the drive.
+
+
+ +

Return

+ + diff --git a/3rdparty/fatfs-0.10b/doc/en/dwrite.html b/3rdparty/fatfs-0.10b/doc/en/dwrite.html new file mode 100644 index 00000000..616acf68 --- /dev/null +++ b/3rdparty/fatfs-0.10b/doc/en/dwrite.html @@ -0,0 +1,76 @@ + + + + + + + + +FatFs - disk_write + + + + +
+

disk_write

+

The disk_write writes sector(s) to the storage device.

+
+DRESULT disk_write (
+  BYTE drv,         /* [IN] Physical drive number */
+  const BYTE* buff, /* [IN] Pointer to the data to be written */
+  DWORD sector,     /* [IN] Sector number to write from */
+  UINT count        /* [IN] Number of sectors to write */
+);
+
+
+ +
+

Parameters

+
+
pdrv
+
Physical drive number to identify the target device.
+
buff
+
Pointer to the byte array to be written. The size of data to be written is sector size * count bytes.
+
sector
+
Start sector number in logical block address (LBA).
+
count
+
Number of sectors to write. FatFs specifis it in range of from 1 to 128.
+
+
+ + +
+

Return Values

+
+
RES_OK (0)
+
The function succeeded.
+
RES_ERROR
+
Any hard error occured during the write operation and could not recover it.
+
RES_WRPRT
+
The medium is write protected.
+
RES_PARERR
+
Invalid parameter.
+
RES_NOTRDY
+
The device has not been initialized.
+
+
+ + +
+

Description

+

The specified memory address is not that always aligned to word boundary because the type of pointer is defined as BYTE*. For more information, refer to the description of disk_read() function.

+

Generally, a multiple sector transfer request must not be split into single sector transactions to the storage device, or you will never get good write throughput.

+

FatFs expects delayed write feature of the disk functions. The write operation to the media need not to be completed due to write operation is in progress or only stored it into the cache buffer when return from this function. But data on the buff is invalid after return from this function. The write completion request is done by CTRL_SYNC command of disk_ioctl() function. Therefore, if delayed write feature is implemented, the write throughput may be improved.

+

Application program MUST NOT call this function, or FAT structure on the volume can be collapsed.

+
+ + +
+

QuickInfo

+

This function is not needed when _FS_READONLY == 1.

+
+ + +

Return

+ + diff --git a/3rdparty/fatfs-0.10b/doc/en/eof.html b/3rdparty/fatfs-0.10b/doc/en/eof.html new file mode 100644 index 00000000..9501b094 --- /dev/null +++ b/3rdparty/fatfs-0.10b/doc/en/eof.html @@ -0,0 +1,62 @@ + + + + + + + + +FatFs - f_eof + + + + +
+

f_eof

+

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

+
+int f_eof (
+  FIL* fp   /* [IN] File object */
+);
+
+
+ + +
+

Parameters

+
+
fp
+
Pointer to the open file object structure.
+
+
+ + +
+

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.

+
+ + +
+

Description

+

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

+
+#define f_eof(fp) (((fp)->fptr) == ((fp)->fsize) ? 1 : 0)
+
+
+ + +
+

QuickInfo

+

Always available.

+
+ + +
+

See Also

+

f_open, f_lseek, FIL

+
+ +

Return

+ + diff --git a/3rdparty/fatfs-0.10b/doc/en/error.html b/3rdparty/fatfs-0.10b/doc/en/error.html new file mode 100644 index 00000000..2a875189 --- /dev/null +++ b/3rdparty/fatfs-0.10b/doc/en/error.html @@ -0,0 +1,62 @@ + + + + + + + + +FatFs - f_error + + + + +
+

f_error

+

The f_error tests for an error on a file.

+
+int f_error (
+  FIL* fp   /* [IN] File object */
+);
+
+
+ + +
+

Parameters

+
+
fp
+
Pointer to the open file object structure.
+
+
+ + +
+

Return Values

+

Returns a non-zero value if a hard error has occured; otherwise it returns a zero.

+
+ + +
+

Description

+

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

+
+#define f_error(fp) (((fp)->flag & FA__ERROR) ? 1 : 0)
+
+
+ + +
+

QuickInfo

+

Always available.

+
+ + +
+

See Also

+

f_open, FIL

+
+ +

Return

+ + diff --git a/3rdparty/fatfs-0.10b/doc/en/fattime.html b/3rdparty/fatfs-0.10b/doc/en/fattime.html new file mode 100644 index 00000000..1736e87f --- /dev/null +++ b/3rdparty/fatfs-0.10b/doc/en/fattime.html @@ -0,0 +1,57 @@ + + + + + + + + +FatFs - get_fattime + + + + +
+

get_fattime

+

The get_fattime function gets current time.

+
+DWORD get_fattime (void);
+
+
+ + +
+

Return Value

+

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

+
+
bit31:25
+
Year origin from the 1980 (0..127)
+
bit24:21
+
Month (1..12)
+
bit20:16
+
Day of the month(1..31)
+
bit15:11
+
Hour (0..23)
+
bit10:5
+
Minute (0..59)
+
bit4:0
+
Second / 2 (0..29)
+
+
+ + +
+

Description

+

The get_fattime() function shall return any valid time even if the system does not support a real time clock. If a zero is returned, the file will not have a valid timestamp.

+
+ + +
+

QuickInfo

+

This function is not needed when _FS_READONLY == 1.

+
+ + +

Return

+ + diff --git a/3rdparty/fatfs-0.10b/doc/en/fdisk.html b/3rdparty/fatfs-0.10b/doc/en/fdisk.html new file mode 100644 index 00000000..40e5e4b3 --- /dev/null +++ b/3rdparty/fatfs-0.10b/doc/en/fdisk.html @@ -0,0 +1,97 @@ + + + + + + + + +FatFs - f_fdisk + + + + +
+

f_fdisk

+

The f_fdisk fucntion divides a physical drive.

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

Parameters

+
+
pdrv
+
Specifies the physical drive to be divided.
+
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.
+
+
+ +
+

Return Values

+

+FR_OK, +FR_DISK_ERR, +FR_NOT_READY, +FR_WRITE_PROTECTED, +FR_INVALID_PARAMETER +

+
+ +
+

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. Logical volumes in the extended partition is not supported. The part[] with four items specifies how to divide the physical drive. The first item specifies the size of first primary partition and fourth item specifies the fourth primary partition. If the value is less than or equal to 100, it specifies percentage of the partition in the entire disk space. If it is larger than 100, it specifies the partition size in unit of sector.

+
+ +
+

QuickInfo

+

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

+
+ +
+

Example

+
+    /* Volume management table defined by user (required when _MULTI_PARTITION == 1) */
+
+    PARTITION VolToPart[] = {
+        {0, 1},    /* Logical drive 0 ==> Physical drive 0, 1st partition */
+        {0, 2},    /* Logical drive 1 ==> Physical drive 0, 2nd partition */
+        {1, 0}     /* Logical drive 2 ==> Physical drive 1, auto detection */
+    };
+
+
+    /* Initialize a brand-new disk drive mapped to physical drive 0 */
+
+    FATFS fs;
+    DWORD plist[] = {50, 50, 0, 0};  /* Divide drive into two partitions */
+    BYTE work[_MAX_SS];
+
+    f_fdisk(0, plist, work);    /* Divide physical drive 0 */
+
+    f_mount(&fs, "0:", 0);      /* Register work area to the logical drive 0 */
+    f_mkfs("0:", 0, 0);         /* Create FAT volume on the logical drive 0. 2nd argument is ignored. */
+    f_mount(0, "0:", 0);        /* Unregister work area from the logical drive 0 */
+
+    f_mount(&fs, "1:", 0);      /* Register a work area to the logical drive 1 */
+    f_mkfs("1:", 0, 0);         /* Create FAT volume on the logical drive 1. 2nd argument is ignored. */
+    f_mount(0, "1:", 0);        /* Unregister work area from the logical drive 1 */
+
+
+
+ +
+

See Also

+

Volume management, f_mkfs

+
+ +

Return

+ + diff --git a/3rdparty/fatfs-0.10b/doc/en/filename.html b/3rdparty/fatfs-0.10b/doc/en/filename.html new file mode 100644 index 00000000..22c87988 --- /dev/null +++ b/3rdparty/fatfs-0.10b/doc/en/filename.html @@ -0,0 +1,78 @@ + + + + + + + + +FatFs - Path Names + + + +

Path Names

+ +
+

Format of the path names

+

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

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

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

+

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

+

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

+

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

+ + + + + + + + + + + + + + +
Path name_FS_RPATH == 0_FS_RPATH == 1
file.txtA file in the root directory of the drive 0A file in the current directory of the current drive
/file.txtA file in the root directory of the drive 0A file in the root directory of the current drive
The root directory of the drive 0The current directory of the current drive
/The root directory of the drive 0The root directory of the current drive
2:The root directory of the drive 2The current directory of the drive 2
2:/The root directory of the drive 2The root directory of the drive 2
2:file.txtA file in the root directory of the drive 2A file in the current directory of the drive 2
../file.txtInvalid nameA file in the parent directory
.Invalid nameThis directory
..Invalid nameParent directory of the current directory
dir1/..Invalid nameThe current directory
/..Invalid nameThe root directory (sticks the top level)
+

When option _STR_VOLUME_ID is specified, also pre-defined strings can be used as drive identifier in the path name instead of a numeral.

+
+ +


+
+

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 which specify the file names are defined as TCHAR. It is an alias of char in default. The code set used to the file name string is ANSI/OEM specifid by _CODE_PAGE. When _LFN_UNICODE is set to 1, the type of the TCHAR is switched to WCHAR to support Unicode (UTF-16 encoding). 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 string */
+ f_open(fp, L"filename.txt", FA_READ);     /* Unicode string */
+ f_open(fp, _T("filename.txt"), FA_READ);  /* Changed by configuration */
+
+
+ +


+
+

Volume Management

+

The FatFs module needs dynamic work area called file system object for each volume (logical drive). It is registered to the FatFs module by f_mount() function. By default, each logical drive is bound to the physical drive with the same drive number and an FAT volume on the drive is serched by auto detect feature. It loads boot sectors and checks it if it is an FAT boot sector in order of sector 0 as SFD format, 1st partition, 2nd partition, 3rd partition and 4th partition as FDISK format.

+

When _MULTI_PARTITION == 1 is specified by configuration option, each individual logical drive is bound to the partition on the physical drive specified by volume management table. The volume management table must be defined by user to resolve relationship between logical drives and partitions. Following code is an example of a volume management table.

+
+Example: Logical drive 0-2 are tied to three pri-partitions on the physical drive 0 (fixed disk)
+         Logical drive 3 is tied to an FAT volume on the physical drive 1 (removable disk)
+
+PARTITION VolToPart[] = {
+    {0, 1},     /* Logical drive 0 ==> Physical drive 0, 1st partition */
+    {0, 2},     /* Logical drive 1 ==> Physical drive 0, 2nd partition */
+    {0, 3},     /* Logical drive 2 ==> Physical drive 0, 3rd partition */
+    {1, 0}      /* Logical drive 3 ==> Physical drive 1 (auto detection) */
+};
+
+relationship between logical drive and physical drive
+
+

There are some considerations on using _MULTI_PARTITION configuration.

+ +
+ + + diff --git a/3rdparty/fatfs-0.10b/doc/en/forward.html b/3rdparty/fatfs-0.10b/doc/en/forward.html new file mode 100644 index 00000000..68b84e63 --- /dev/null +++ b/3rdparty/fatfs-0.10b/doc/en/forward.html @@ -0,0 +1,139 @@ + + + + + + + + +FatFs - f_forward + + + + +
+

f_forward

+

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

+
+FRESULT f_forward (
+  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 */
+);
+
+
+ +
+

Parameters

+
+
fp
+
Pointer to the open file object.
+
func
+
Pointer to the user-defined data streaming function. For details, refer to the sample code.
+
btf
+
Number of bytes to forward in range of UINT.
+
bf
+
Pointer to the UINT variable to return number of bytes forwarded.
+
+
+ + +
+

Return Values

+

+FR_OK, +FR_DISK_ERR, +FR_INT_ERR, +FR_NOT_READY, +FR_INVALID_OBJECT, +FR_TIMEOUT +

+
+ + +
+

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

+
+ + +
+

QuickInfo

+

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

+
+ + +
+

Example (Audio playback)

+
+/*------------------------------------------------------------------------*/
+/* Sample code of data transfer function to be called back from f_forward */
+/*------------------------------------------------------------------------*/
+
+UINT out_stream (   /* Returns number of bytes sent or stream status */
+    const BYTE *p,  /* Pointer to the data block to be sent */
+    UINT btf        /* >0: Transfer call (Number of bytes to be sent). 0: Sense call */
+)
+{
+    UINT cnt = 0;
+
+
+    if (btf == 0) {     /* Sense call */
+        /* Return stream status (0: Busy, 1: Ready) */
+        /* When once it returned ready to sense call, it must accept a byte at least */
+        /* at subsequent transfer call, or f_forward will fail with FR_INT_ERR. */
+        if (FIFO_READY) cnt = 1;
+    }
+    else {              /* Transfer call */
+        do {    /* Repeat while there is any data to be sent and the stream is ready */
+            FIFO_PORT = *p++;
+            cnt++;
+        } while (cnt < btf && FIFO_READY);
+    }
+
+    return cnt;
+}
+
+
+/*------------------------------------------------------------------------*/
+/* Sample code using f_forward function                                   */
+/*------------------------------------------------------------------------*/
+
+FRESULT play_file (
+    char *fn        /* Pointer to the audio file name to be played */
+)
+{
+    FRESULT rc;
+    FIL fil;
+    UINT dmy;
+
+    /* Open the audio file in read only mode */
+    rc = f_open(&fil, fn, FA_READ);
+    if (rc) return rc;
+
+    /* Repeat until the file pointer reaches end of the file */
+    while (rc == FR_OK && fil.fptr < fil.fsize) {
+
+        /* any other processes... */
+
+        /* Fill output stream periodicaly or on-demand */
+        rc = f_forward(&fil, out_stream, 1000, &dmy);
+    }
+
+    /* Close the file and return */
+    f_close(&fil);
+    return rc;
+}
+
+
+ + +
+

See Also

+

f_open, fgets, f_write, f_close, FIL

+
+ +

Return

+ + diff --git a/3rdparty/fatfs-0.10b/doc/en/getcwd.html b/3rdparty/fatfs-0.10b/doc/en/getcwd.html new file mode 100644 index 00000000..34848b7b --- /dev/null +++ b/3rdparty/fatfs-0.10b/doc/en/getcwd.html @@ -0,0 +1,70 @@ + + + + + + + + +FatFs - f_getcwd + + + + +
+

f_getcwd

+

The f_getcwd function retrieves the current directory.

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

Parameters

+
+
buff
+
Pointer to the buffer to receive the current directory string.
+
len
+
Size of the buffer in unit of TCHAR.
+
+
+ + +
+

Return Values

+

+FR_OK, +FR_DISK_ERR, +FR_INT_ERR, +FR_NOT_READY, +FR_NOT_ENABLED, +FR_NO_FILESYSTEM, +FR_TIMEOUT, +FR_NOT_ENOUGH_CORE +

+
+ + +
+

Description

+

The f_getcwd() function retrieves full path name of the current directory of the current drive. When _VOLUMES is larger than 1, a logical drive number is added to top of the path name.

+
+ + +
+

QuickInfo

+

Available when _FS_RPATH == 2.

+
+ + +
+

See Also

+

f_chdrive, f_chdir

+
+ +

Return

+ + diff --git a/3rdparty/fatfs-0.10b/doc/en/getfree.html b/3rdparty/fatfs-0.10b/doc/en/getfree.html new file mode 100644 index 00000000..9f169b07 --- /dev/null +++ b/3rdparty/fatfs-0.10b/doc/en/getfree.html @@ -0,0 +1,95 @@ + + + + + + + + +FatFs - f_getfree + + + + +
+

f_getfree

+

The f_getfree function gets number of the free clusters on the volume.

+
+FRESULT f_getfree (
+  const TCHAR* path,  /* [IN] Logical drive number */
+  DWORD* nclst,       /* [OUT] Number of free clusters */
+  FATFS** fatfs       /* [OUT] Corresponding file system object */
+);
+
+
+ +
+

Parameters

+
+
path
+
Pinter to the null-terminated string that specifies the logical drive. A null-string means the default 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.
+
+
+ + +
+

Return Values

+

+FR_OK, +FR_DISK_ERR, +FR_INT_ERR, +FR_NOT_READY, +FR_INVALID_DRIVE, +FR_NOT_ENABLED, +FR_NO_FILESYSTEM, +FR_TIMEOUT +

+
+ + +
+

Descriptions

+

The f_getfree() function gets number of free clusters on the volume. The member csize in the file system object indicates number of sectors per cluster, so that the free space in unit of sector can be calcurated with this information. When FSINFO structure on the FAT32 volume is not in sync, this function can return an incorrect free cluster count. To avoid this problem, FatFs can be forced full FAT scan by _FS_NOFSINFO option.

+
+ + +
+

QuickInfo

+

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

+
+ + +
+

Example

+
+    FATFS *fs;
+    DWORD fre_clust, fre_sect, tot_sect;
+
+
+    /* Get volume information and free clusters of drive 1 */
+    res = f_getfree("1:", &fre_clust, &fs);
+    if (res) die(res);
+
+    /* Get total sectors and free sectors */
+    tot_sect = (fs->n_fatent - 2) * fs->csize;
+    fre_sect = fre_clust * fs->csize;
+
+    /* Print the free space (assuming 512 bytes/sector) */
+    printf("%10lu KiB total drive space.\n%10lu KiB available.\n",
+           tot_sect / 2, fre_sect / 2);
+
+
+ + +
+

See Also

+

FATFS

+
+ +

Return

+ + diff --git a/3rdparty/fatfs-0.10b/doc/en/getlabel.html b/3rdparty/fatfs-0.10b/doc/en/getlabel.html new file mode 100644 index 00000000..81b27368 --- /dev/null +++ b/3rdparty/fatfs-0.10b/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] Drive number */
+  TCHAR* label,       /* [OUT] Volume label */
+  DWORD* vsn          /* [OUT] Volume serial number */
+);
+
+
+ +
+

Parameters

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

Return Values

+

+FR_OK, +FR_DISK_ERR, +FR_INT_ERR, +FR_NOT_READY, +FR_INVALID_DRIVE, +FR_NOT_ENABLED, +FR_NO_FILESYSTEM, +FR_TIMEOUT +

+
+ + +
+

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/3rdparty/fatfs-0.10b/doc/en/gets.html b/3rdparty/fatfs-0.10b/doc/en/gets.html new file mode 100644 index 00000000..f4474a62 --- /dev/null +++ b/3rdparty/fatfs-0.10b/doc/en/gets.html @@ -0,0 +1,65 @@ + + + + + + + + +FatFs - f_gets + + + + +
+

f_gets

+

The f_gets reads a string from the file.

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

Parameters

+
+
buff
+
Pointer to read buffer to store the read string.
+
len
+
Size of the read buffer in unit of character.
+
fp
+
Pointer to the open file object structure.
+
+
+ + +
+

Return Values

+

When the function succeeded, buff will be returuned.

+
+ + +
+

Description

+

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

+
+ + +
+

QuickInfo

+

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

+
+ + +
+

See Also

+

f_open, f_read, f_putc, f_puts, f_printf, f_close, FIL

+
+ +

Return

+ + diff --git a/3rdparty/fatfs-0.10b/doc/en/lseek.html b/3rdparty/fatfs-0.10b/doc/en/lseek.html new file mode 100644 index 00000000..fa59aa9d --- /dev/null +++ b/3rdparty/fatfs-0.10b/doc/en/lseek.html @@ -0,0 +1,129 @@ + + + + + + + + +FatFs - f_lseek + + + + +
+

f_lseek

+

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

+ +
+FRESULT f_lseek (
+  FIL* fp,   /* [IN] File object */
+  DWORD ofs  /* [IN] File read/write pointer */
+);
+
+
+ +
+

Parameters

+
+
fp
+
Pointer to the open file object.
+
ofs
+
Byte offset from top of the file.
+
+
+ + +
+

Return Values

+

+FR_OK, +FR_DISK_ERR, +FR_INT_ERR, +FR_NOT_READY, +FR_INVALID_OBJECT, +FR_TIMEOUT +

+
+ + +
+

Description

+

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

+ +

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

+

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

+
+ + +
+

QuickInfo

+

Available when _FS_MINIMIZE <= 2.

+
+ + +
+

Example

+
+    /* Open file */
+    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(fp, 5000);
+
+    /* Move to end of the file to append data */
+    res = f_lseek(fp, f_size(fp));
+
+    /* Forward 3000 bytes */
+    res = f_lseek(fp, f_tell(fp) + 3000);
+
+    /* Rewind 2000 bytes (take care on wraparound) */
+    res = f_lseek(fp, f_tell(fp) - 2000);
+
+
+/* Cluster pre-allocation (to prevent buffer overrun on streaming write) */
+
+    res = f_open(fp, recfile, FA_CREATE_NEW | FA_WRITE);   /* Create a file */
+
+    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(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(fp);                    /* Truncate unused area */
+    res = f_lseek(fp, 0);                    /* Put file header */
+    ...
+
+    res = f_close(fp);
+
+
+/* Using fast seek feature */
+
+    DWORD clmt[SZ_TBL];                    /* Cluster link map table buffer */
+
+    res = f_lseek(fp, ofs1);               /* This is normal seek (cltbl is nulled on file open) */
+
+    fp->cltbl = clmt;                      /* Enable fast seek feature (cltbl != NULL) */
+    clmt[0] = SZ_TBL;                      /* Set table size */
+    res = f_lseek(fp, CREATE_LINKMAP);     /* Create CLMT */
+    ...
+
+    res = f_lseek(fp, ofs2);               /* This is fast seek */
+
+
+ + +
+

See Also

+

f_open, f_truncate, FIL

+
+ +

Return

+ + diff --git a/3rdparty/fatfs-0.10b/doc/en/mkdir.html b/3rdparty/fatfs-0.10b/doc/en/mkdir.html new file mode 100644 index 00000000..34f83e86 --- /dev/null +++ b/3rdparty/fatfs-0.10b/doc/en/mkdir.html @@ -0,0 +1,80 @@ + + + + + + + + +FatFs - f_mkdir + + + + +
+

f_mkdir

+

The f_mkdir function creates a new directory.

+
+FRESULT f_mkdir (
+  const TCHAR* path /* [IN] Directory name */
+);
+
+
+ +
+

Parameter

+
+
path
+
Pointer to the null-terminated string that specifies the directory name to create.
+
+
+ + +
+

Return Value

+

+FR_OK, +FR_DISK_ERR, +FR_INT_ERR, +FR_NOT_READY, +FR_NO_PATH, +FR_INVALID_NAME, +FR_DENIED, +FR_EXIST, +FR_WRITE_PROTECTED, +FR_INVALID_DRIVE, +FR_NOT_ENABLED, +FR_NO_FILESYSTEM, +FR_TIMEOUT, +FR_NOT_ENOUGH_CORE +

+
+ + +
+

Description

+

This function creates a new directory.

+
+ + +
+

QuickInfo

+

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

+
+ + +
+

Example

+
+    res = f_mkdir("sub1");
+    if (res) die(res);
+    res = f_mkdir("sub1/sub2");
+    if (res) die(res);
+    res = f_mkdir("sub1/sub2/sub3");
+    if (res) die(res);
+
+
+ +

Return

+ + diff --git a/3rdparty/fatfs-0.10b/doc/en/mkfs.html b/3rdparty/fatfs-0.10b/doc/en/mkfs.html new file mode 100644 index 00000000..58e63750 --- /dev/null +++ b/3rdparty/fatfs-0.10b/doc/en/mkfs.html @@ -0,0 +1,73 @@ + + + + + + + + +FatFs - f_mkfs + + + + +
+

f_mkfs

+

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

+
+FRESULT f_mkfs (
+  const TCHAR* path,  /* [IN] Logical drive number */
+  BYTE  sfd,          /* [IN] Partitioning rule */
+  UINT  au            /* [IN] Size of the allocation unit */
+);
+
+
+ +
+

Parameters

+
+
path
+
Pinter to the null-terminated string that specifies the logical drive to be formatted. If there is no drive number, it means the default drive.
+
sfd
+
Specifies partitioning rule (FDISK(0) or SFD(1)). This argument will be ignored on some case.
+
au
+
Specifies size of the allocation unit (cluter) in unit of byte. The value must be sector size * n (n is 1 to 128 and power of 2). When a zero is given, the cluster size is determined depends on the volume size.
+
+
+ +
+

Return Values

+

+FR_OK, +FR_DISK_ERR, +FR_NOT_READY, +FR_WRITE_PROTECTED, +FR_INVALID_DRIVE, +FR_NOT_ENABLED, +FR_MKFS_ABORTED, +FR_INVALID_PARAMETER +

+
+ +
+

Description

+

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 has been 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, CFC and U Disk. 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 usually 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.

+
+ +
+

QuickInfo

+

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

+
+ +
+

See Also

+

Volume management, f_fdisk

+
+ +

Return

+ + diff --git a/3rdparty/fatfs-0.10b/doc/en/mount.html b/3rdparty/fatfs-0.10b/doc/en/mount.html new file mode 100644 index 00000000..f96b2fe4 --- /dev/null +++ b/3rdparty/fatfs-0.10b/doc/en/mount.html @@ -0,0 +1,83 @@ + + + + + + + + +FatFs - f_mount + + + + +
+

f_mount

+

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

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

Parameters

+
+
fs
+
Pointer to the new file system object to be registered. Null pointer unregisters the registered file system object.
+
path
+
Pointer to the null-terminated string that specifies the logical drive. The string with no drive number means the default drive.
+
opt
+
Initialization option. 0: Do not mount now (to be mounted later), 1: Force mounted the volume to check if the FAT volume is available.
+
+
+ +
+

Return Values

+

+FR_OK, +FR_INVALID_DRIVE, +FR_DISK_ERR, +FR_NOT_READY, +FR_NO_FILESYSTEM +

+
+ + +
+

Description

+

The f_mount() function registers/unregisters a file system object used for the logical drive to the FatFs module as follows:

+
    +
  1. Determines the logical drive which specified by path.
  2. +
  3. Clears and unregisters the regsitered work area of the drive.
  4. +
  5. Clears and registers the new work area to the drive if fs is not NULL.
  6. +
  7. Performs volume mount process to the drive if forced mount is specified.
  8. +
+

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

+

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

+ +

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

+

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

+
+ + +
+

QuickInfo

+

Always available.

+
+ + +
+

See Also

+

f_open, FATFS

+
+ +

Return

+ + diff --git a/3rdparty/fatfs-0.10b/doc/en/open.html b/3rdparty/fatfs-0.10b/doc/en/open.html new file mode 100644 index 00000000..8fb30a35 --- /dev/null +++ b/3rdparty/fatfs-0.10b/doc/en/open.html @@ -0,0 +1,173 @@ + + + + + + + + +FatFs - f_open + + + + +
+

f_open

+

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

+
+FRESULT f_open (
+  FIL* fp,           /* [OUT] Pointer to the file object structure */
+  const TCHAR* path, /* [IN] File name */
+  BYTE mode          /* [IN] Mode flags */
+);
+
+
+ +
+

Parameters

+
+
fp
+
Pointer to the blank file object structure to be created.
+
path
+
Pointer to a null-terminated string that specifies the file name to open or create.
+
mode
+
Mode flags that specifies the type of access and open method for the file. It is specified by a combination of following flags.
+ + + + + + + + +
ValueDescription
FA_READSpecifies read access to the object. Data can be read from the file. Combine with FA_WRITE for read-write access.
FA_WRITESpecifies write access to the object. Data can be written to the file. Combine with FA_READ for read-write access.
FA_OPEN_EXISTINGOpens the file. The function fails if the file is not existing. (Default)
FA_OPEN_ALWAYSOpens the file if it is existing. If not, 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 will be truncated and overwritten.
+
+
+
+ + +
+

Return Values

+

+FR_OK, +FR_DISK_ERR, +FR_INT_ERR, +FR_NOT_READY, +FR_NO_FILE, +FR_NO_PATH, +FR_INVALID_NAME, +FR_DENIED, +FR_EXIST, +FR_INVALID_OBJECT, +FR_WRITE_PROTECTED, +FR_INVALID_DRIVE, +FR_NOT_ENABLED, +FR_NO_FILESYSTEM, +FR_TIMEOUT, +FR_LOCKED, +FR_NOT_ENOUGH_CORE, +FR_TOO_MANY_OPEN_FILES +

+
+ + +
+

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. To close an open file, use f_close() function. If the file is modified and not closed properly, the file data will be collapsed.

+

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.

+
+ + +
+

QuickInfo

+

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

+
+ + +
+

Example

+
+/* Read a text file and display it */
+
+FATFS FatFs;   /* Work area (file system object) for logical drive */
+
+int main (void)
+{
+    FIL fil;       /* File object */
+    char line[82]; /* Line buffer */
+    FRESULT fr;    /* FatFs return code */
+
+
+    /* Register work area to the default drive */
+    f_mount(&FatFs, "", 0);
+
+    /* Open a text file */
+    fr = f_open(&fil, "message.txt", FA_READ);
+    if (fr) return (int)fr;
+
+    /* Read all lines and display it */
+    while (f_gets(line, sizeof line, &fil))
+        printf(line);
+
+    /* Close the file */
+    f_close(&fil);
+
+    return 0;
+}
+
+
+/* Copy a file "file.bin" on the drive 1 to drive 0 */
+
+int main (void)
+{
+    FATFS fs[2];         /* Work area (file system object) for logical drives */
+    FIL fsrc, fdst;      /* File objects */
+    BYTE buffer[4096];   /* File copy buffer */
+    FRESULT fr;          /* FatFs function common result code */
+    UINT br, bw;         /* File read/write count */
+
+
+    /* Register work area for each logical drive */
+    f_mount(&fs[0], "0:", 0);
+    f_mount(&fs[1], "1:", 0);
+
+    /* Open source file on the drive 1 */
+    fr = f_open(&fsrc, "1:file.bin", FA_OPEN_EXISTING | FA_READ);
+    if (fr) return (int)fr;
+
+    /* Create destination file on the drive 0 */
+    fr = f_open(&fdst, "0:file.bin", FA_CREATE_ALWAYS | FA_WRITE);
+    if (fr) return (int)fr;
+
+    /* Copy source to destination */
+    for (;;) {
+        fr = f_read(&fsrc, buffer, sizeof buffer, &br);  /* Read a chunk of source file */
+        if (fr || br == 0) break; /* error or eof */
+        fr = f_write(&fdst, buffer, br, &bw);            /* Write it to the destination file */
+        if (fr || bw < br) break; /* error or disk full */
+    }
+
+    /* Close open files */
+    f_close(&fsrc);
+    f_close(&fdst);
+
+    /* Unregister work area prior to discard it */
+    f_mount(NULL, "0:", 0);
+    f_mount(NULL, "1:", 0);
+
+    return (int)fr;
+}
+
+
+ + +
+

See Also

+

f_read, f_write, f_close, FIL, FATFS

+
+ +

Return

+ + diff --git a/3rdparty/fatfs-0.10b/doc/en/opendir.html b/3rdparty/fatfs-0.10b/doc/en/opendir.html new file mode 100644 index 00000000..77442ef9 --- /dev/null +++ b/3rdparty/fatfs-0.10b/doc/en/opendir.html @@ -0,0 +1,75 @@ + + + + + + + + +FatFs - f_opendir + + + + +
+

f_opendir

+

The f_opendir function opens a directory.

+
+FRESULT f_opendir (
+  DIR* dp,           /* [OUT] Pointer to the directory object structure */
+  const TCHAR* path  /* [IN] Directory name */
+);
+
+
+ +
+

Parameters

+
+
dp
+
Pointer to the blank directory object to create a new one.
+
path
+
Pinter to the null-terminated string that specifies the directory name to be opened.
+
+
+ + +
+

Return Values

+

+FR_OK, +FR_DISK_ERR, +FR_INT_ERR, +FR_NOT_READY, +FR_NO_PATH, +FR_INVALID_NAME, +FR_INVALID_OBJECT, +FR_INVALID_DRIVE, +FR_NOT_ENABLED, +FR_NO_FILESYSTEM, +FR_TIMEOUT, +FR_NOT_ENOUGH_CORE, +FR_TOO_MANY_OPEN_FILES +

+
+ + +
+

Description

+

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

+
+ + +
+

QuickInfo

+

Available when _FS_MINIMIZE <= 1.

+
+ + +
+

See Also

+

f_readdir, f_closedir, DIR

+
+ +

Return

+ + diff --git a/3rdparty/fatfs-0.10b/doc/en/printf.html b/3rdparty/fatfs-0.10b/doc/en/printf.html new file mode 100644 index 00000000..96a84b81 --- /dev/null +++ b/3rdparty/fatfs-0.10b/doc/en/printf.html @@ -0,0 +1,93 @@ + + + + + + + + +FatFs - f_printf + + + + +
+

f_printf

+

The f_printf function writes formatted string to the file.

+
+int f_printf (
+  FIL* fp,          /* [IN] File object */
+  const TCHAR* fmt, /* [IN] Format stirng */
+  ...
+);
+
+
+ +
+

Parameters

+
+
fp
+
Pointer to the open file object structure.
+
fmt
+
Pointer to the null terminated format string. The terminator charactor will not be written.
+
...
+
Optional arguments...
+ +
+
+ + +
+

Return Values

+

When the function succeeded, it returns number of characters written. When the function failed due to disk full or any error, an EOF (-1) will be returned.

+
+ + +
+

Description

+

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

+ +
+ + +
+

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

+
+ + +
+

Example

+
+    f_printf(&fil, "%d", 1234);            /* "1234" */
+    f_printf(&fil, "%6d,%3d%%", -200, 5);  /* "  -200,  5%" */
+    f_printf(&fil, "%ld", 12345L);         /* "12345" */
+    f_printf(&fil, "%06d", 25);            /* "000025" */
+    f_printf(&fil, "%06d", -25);           /* "000-25" */
+    f_printf(&fil, "%-6d", 25);            /* "25    " */
+    f_printf(&fil, "%u", -1);              /* "65535" or "4294967295" */
+    f_printf(&fil, "%04x", 0xAB3);         /* "0ab3" */
+    f_printf(&fil, "%08LX", 0x123ABCL);    /* "00123ABC" */
+    f_printf(&fil, "%016b", 0x550F);       /* "0101010100001111" */
+    f_printf(&fil, "%s", "String");        /* "String" */
+    f_printf(&fil, "%8s", "abc");          /* "     abc" */
+    f_printf(&fil, "%-8s", "abc");         /* "abc     " */
+    f_printf(&fil, "%c", 'a');             /* "a" */
+    f_printf(&fil, "%f", 10.0);            /* f_printf lacks floating point support */
+
+
+ + +
+

See Also

+

f_open, f_putc, f_puts, f_gets, f_close, FIL

+
+ +

Return

+ + diff --git a/3rdparty/fatfs-0.10b/doc/en/putc.html b/3rdparty/fatfs-0.10b/doc/en/putc.html new file mode 100644 index 00000000..797c6a37 --- /dev/null +++ b/3rdparty/fatfs-0.10b/doc/en/putc.html @@ -0,0 +1,62 @@ + + + + + + + + +FatFs - f_putc + + + + +
+

f_putc

+

The f_putc funciton puts a character to the file.

+
+int f_putc (
+  TCHAR chr,  /* [IN] A character to put */
+  FIL* fp     /* [IN] File object */
+);
+
+
+ +
+

Parameters

+
+
chr
+
A character to be put.
+
fp
+
Pointer to the open file object structuer.
+
+
+ + +
+

Return Values

+

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

+

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

+
+ + +
+

Description

+

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

+
+ + +
+

QuickInfo

+

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

+
+ + +
+

See Also

+

f_open, f_puts, f_printf, f_gets, f_close, FIL

+
+ +

Return

+ + diff --git a/3rdparty/fatfs-0.10b/doc/en/puts.html b/3rdparty/fatfs-0.10b/doc/en/puts.html new file mode 100644 index 00000000..6550b576 --- /dev/null +++ b/3rdparty/fatfs-0.10b/doc/en/puts.html @@ -0,0 +1,62 @@ + + + + + + + + +FatFs - f_puts + + + + +
+

f_puts

+

The f_puts function writes a string to the file.

+
+int f_puts (
+  const TCHAR* str, /* [IN] String */
+  FIL* fp           /* [IN] File object */
+);
+
+
+ +
+

Parameters

+
+
str
+
Pointer to the null terminated string to be written. The terminator character will not be written.
+
fp
+
Pointer to the open file object structure.
+
+
+ + +
+

Return Value

+

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

+

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

+
+ + +
+

Description

+

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

+
+ + +
+

QuickInfo

+

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

+
+ + +
+

See Also

+

f_open, f_putc, f_printf, f_gets, f_close, FIL

+
+ +

Return

+ + diff --git a/3rdparty/fatfs-0.10b/doc/en/rc.html b/3rdparty/fatfs-0.10b/doc/en/rc.html new file mode 100644 index 00000000..86c066eb --- /dev/null +++ b/3rdparty/fatfs-0.10b/doc/en/rc.html @@ -0,0 +1,87 @@ + + + + + + + + +FatFs - Return Codes + + + +

Return Code of the File Functions

+

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 hard error occured in the lower layer, disk_read(), disk_write() or disk_ioctl() function.
Note that if once this error occured at any operation to an open file, the file object is aborted and all operations to the file except for close will be rejected.
+
FR_INT_ERR
+
Assertion failed. An insanity is detected in the internal process. One of the following possibilities is suspected. +
    +
  • Work area (file system object, file object or etc...) is broken by stack overflow or any other application. This is the reason in most case.
  • +
  • There is any error of the FAT structure on the volume.
  • +
+Note that if once this error occured at any operation to an open file, the file object is aborted and all operations to the file except for close will be rejected. +
+
FR_NOT_READY
+
The disk drive cannot work due to incorrect medium removal or disk_initialize() function failed.
+
FR_NO_FILE
+
Could not find the file.
+
FR_NO_PATH
+
Could not find the path.
+
FR_INVALID_NAME
+
The given string is invalid as the path name.
+
FR_DENIED
+
The required access was denied due to one of the following reasons: +
    +
  • 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.
  • +
  • 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
+
Name collision. Any object that has the same name is already existing.
+
FR_INVALID_OBJECT
+
The file/directory object structure is invalid or a null pointer is given. All open objects of the logical drive are invalidated by the voulme mount process.
+
FR_WRITE_PROTECTED
+
Any write mode action against the write-protected media.
+
FR_INVALID_DRIVE
+
Invalid drive number is specified in the path name. A null pointer is given as the path name. (Related option: _VOLUMES)
+
FR_NOT_ENABLED
+
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 disk/partition size is too small.
  • +
  • Not allowable cluster size for this disk. This can occure when number of clusters gets near the boundaries of FAT sub-types.
  • +
  • There is no partition related to the logical drive. (Related option: _MULTI_PARTITION)
  • +
+
+
FR_TIMEOUT
+
The function was canceled due to a timeout of thread-safe control. (Related option: _TIMEOUT)
+
FR_LOCKED
+
The operation to the object was rejected by file sharing control. (Related option: _FS_LOCK)
+
FR_NOT_ENOUGH_CORE
+
Not enough memory for the operation. There is one of the following reasons: +
    +
  • Could not allocate a memory for LFN working buffer. (Related option: _USE_LFN)
  • +
  • Size of the given CLMT buffer is insufficient for the file fragments.
  • +
+
+
FR_TOO_MANY_OPEN_FILES
+
Number of open objects has been reached maximum value and no more object can be opened. (Related option: _FS_LOCK)
+
FR_INVALID_PARAMETER
+
The given parameter is invalid or there is any inconsistent.
+
+ + + diff --git a/3rdparty/fatfs-0.10b/doc/en/read.html b/3rdparty/fatfs-0.10b/doc/en/read.html new file mode 100644 index 00000000..348bada6 --- /dev/null +++ b/3rdparty/fatfs-0.10b/doc/en/read.html @@ -0,0 +1,74 @@ + + + + + + + + +FatFs - f_read + + + + +
+

f_read

+

The f_read function reads data from a file.

+
+FRESULT f_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 */
+);
+
+
+ +
+

Parameters

+
+
fp
+
Pointer to the open file object.
+
buff
+
Pointer to the buffer to store read data.
+
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.
+
+
+ + +
+

Return Values

+

+FR_OK, +FR_DISK_ERR, +FR_INT_ERR, +FR_NOT_READY, +FR_INVALID_OBJECT, +FR_TIMEOUT +

+
+ + +
+

Description

+

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

+
+ + +
+

QuickInfo

+

Always available.

+
+ + +
+

See Also

+

f_open, fgets, f_write, f_close, FIL

+
+ +

Return

+ + diff --git a/3rdparty/fatfs-0.10b/doc/en/readdir.html b/3rdparty/fatfs-0.10b/doc/en/readdir.html new file mode 100644 index 00000000..32c221ba --- /dev/null +++ b/3rdparty/fatfs-0.10b/doc/en/readdir.html @@ -0,0 +1,125 @@ + + + + + + + + +FatFs - f_readdir + + + + +
+

f_readdir

+

The f_readdir function reads directory entries.

+
+FRESULT f_readdir (
+  DIR* dp,      /* [IN] Directory object */
+  FILINFO* fno  /* [OUT] File information structure */
+);
+
+
+ +
+

Parameters

+
+
dp
+
Pointer to the open directory object.
+
fno
+
Pointer to the file information structure to store the read item.
+
+
+ + +
+

Return Values

+

+FR_OK, +FR_DISK_ERR, +FR_INT_ERR, +FR_NOT_READY, +FR_INVALID_OBJECT, +FR_TIMEOUT, +FR_NOT_ENOUGH_CORE +

+
+ + +
+

Description

+

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 relative path feature is enabled (_FS_RPATH >= 1), dot entries ("." and "..") are not filtered out and they will appear in the read items. When all directory items have been read and no item to read, a null string is returned into the fname[] without any error. When a null pointer is given to the fno, the read index of the directory object is 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 LFN read buffer. The lfsize is size of the LFN read buffer in unit of TCHAR. If the LFN is not needed, set a null pointer to the lfname and the LFN is not returned. A null string will be returned into the LFN read buffer in case of following conditions.

+ +

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

+
+ + +
+

QuickInfo

+

Available when _FS_MINIMIZE <= 1.

+
+ + +
+

Sample Code

+
+FRESULT scan_files (
+    char* path        /* Start node to be scanned (also used as work area) */
+)
+{
+    FRESULT res;
+    FILINFO fno;
+    DIR dir;
+    int i;
+    char *fn;   /* This function is assuming non-Unicode cfg. */
+#if _USE_LFN
+    static char lfn[_MAX_LFN + 1];   /* Buffer to store the LFN */
+    fno.lfname = lfn;
+    fno.lfsize = sizeof lfn;
+#endif
+
+
+    res = f_opendir(&dir, path);                       /* Open the directory */
+    if (res == FR_OK) {
+        i = strlen(path);
+        for (;;) {
+            res = f_readdir(&dir, &fno);                   /* Read a directory item */
+            if (res != FR_OK || fno.fname[0] == 0) break;  /* Break on error or end of dir */
+            if (fno.fname[0] == '.') continue;             /* Ignore dot entry */
+#if _USE_LFN
+            fn = *fno.lfname ? fno.lfname : fno.fname;
+#else
+            fn = fno.fname;
+#endif
+            if (fno.fattrib & AM_DIR) {                    /* It is a directory */
+                sprintf(&path[i], "/%s", fn);
+                res = scan_files(path);
+                if (res != FR_OK) break;
+                path[i] = 0;
+            } else {                                       /* It is a file. */
+                printf("%s/%s\n", path, fn);
+            }
+        }
+        f_closedir(&dir)
+    }
+
+    return res;
+}
+
+
+ + +
+

See Also

+

f_opendir, f_closedir, f_stat, FILINFO, DIR

+
+ +

Return

+ + diff --git a/3rdparty/fatfs-0.10b/doc/en/rename.html b/3rdparty/fatfs-0.10b/doc/en/rename.html new file mode 100644 index 00000000..e6f05232 --- /dev/null +++ b/3rdparty/fatfs-0.10b/doc/en/rename.html @@ -0,0 +1,85 @@ + + + + + + + + +FatFs - f_rename + + + + +
+

f_rename

+

Renames a file or sub-directory.

+
+FRESULT f_rename (
+  const TCHAR* old_name, /* [IN] Old object name */
+  const TCHAR* new_name  /* [IN] New object name */
+);
+
+
+ +
+

Parameters

+
+
old_name
+
Pointer to a null-terminated string that specifies an existing file or sub-directory to be renamed.
+
new_name
+
Pointer to a null-terminated string that specifies the new object name. The drive number specified in this string is ignored and one determined by old_name is used instead.
+
+
+ + +
+

Return Values

+

+FR_OK, +FR_DISK_ERR, +FR_INT_ERR, +FR_NOT_READY, +FR_NO_FILE, +FR_NO_PATH, +FR_INVALID_NAME, +FR_DENIED, +FR_EXIST, +FR_WRITE_PROTECTED, +FR_INVALID_DRIVE, +FR_NOT_ENABLED, +FR_NO_FILESYSTEM, +FR_TIMEOUT, +FR_LOCKED, +FR_NOT_ENOUGH_CORE +

+
+ + +
+

Description

+

Renames a file or sub-directory and can also move it to other directory within the same logical drive. Do not rename open objects or directry table can be broken.

+
+ + +
+

QuickInfo

+

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

+
+ + +
+

Example

+
+    /* Rename an object */
+    f_rename("oldname.txt", "newname.txt");
+
+    /* Rename and move an object to other directory */
+    f_rename("oldname.txt", "dir1/newname.txt");
+
+
+ + +

Return

+ + diff --git a/3rdparty/fatfs-0.10b/doc/en/sdir.html b/3rdparty/fatfs-0.10b/doc/en/sdir.html new file mode 100644 index 00000000..785d0982 --- /dev/null +++ b/3rdparty/fatfs-0.10b/doc/en/sdir.html @@ -0,0 +1,40 @@ + + + + + + + + +FatFs - DIR + + + + +
+

DIR

+

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 */
+    WORD    id;         /* Owner file system mount ID */
+    WORD    index;      /* Index of directory entry to start to search next */
+    DWORD   sclust;     /* Table start cluster (0:Root directory) */
+    DWORD   clust;      /* Current cluster */
+    DWORD   sect;       /* Current sector */
+    BYTE*   dir;        /* Pointer to the current SFN entry in the win[] */
+    BYTE*   fn;         /* Pointer to the SFN buffer (in/out) {file[8],ext[3],status[1]} */
+#if _FS_LOCK
+    UINT    lockid;     /* Sub-directory lock ID (0:Root directory) */
+#endif
+#if _USE_LFN
+    WCHAR*  lfn;        /* Pointer to the LFN buffer (in/out) */
+    WORD    lfn_idx;    /* Index of the LFN entris (0xFFFF:No LFN) */
+#endif
+} DIR;
+
+
+ +

Return

+ + diff --git a/3rdparty/fatfs-0.10b/doc/en/setlabel.html b/3rdparty/fatfs-0.10b/doc/en/setlabel.html new file mode 100644 index 00000000..a8ac977a --- /dev/null +++ b/3rdparty/fatfs-0.10b/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* label  /* [IN] Volume label to be set */
+);
+
+
+ +
+

Parameters

+
+
label
+
Pointer to the null-terminated string that specifies the volume label to be set.
+
+
+ + +
+

Return Values

+

+FR_OK, +FR_DISK_ERR, +FR_INT_ERR, +FR_NOT_READY, +FR_INVALID_NAME, +FR_WRITE_PROTECTED, +FR_INVALID_DRIVE, +FR_NOT_ENABLED, +FR_NO_FILESYSTEM, +FR_TIMEOUT +

+
+ + +
+

Description

+

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

+ +
+ +
+

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/3rdparty/fatfs-0.10b/doc/en/sfatfs.html b/3rdparty/fatfs-0.10b/doc/en/sfatfs.html new file mode 100644 index 00000000..d81e84b2 --- /dev/null +++ b/3rdparty/fatfs-0.10b/doc/en/sfatfs.html @@ -0,0 +1,54 @@ + + + + + + + + +FatFs - FATFS + + + + +
+

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 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) */
+    BYTE    drv;          /* Physical drive number */
+    BYTE    csize;        /* Sectors per cluster (1,2,4,...,128) */
+    BYTE    n_fats;       /* Number of FAT copies (1,2) */
+    BYTE    wflag;        /* win[] flag (b0:win[] is dirty) */
+    BYTE    fsi_flag;     /* FSINFO flags (b7:Disabled, b0:Dirty) */
+    WORD    id;           /* File system mount ID */
+    WORD    n_rootdir;    /* Number of root directory entries (FAT12/16) */
+#if _MAX_SS != _MIN_SS
+    WORD    ssize;        /* Sector size (512,1024,2048 or 4096) */
+#endif
+#if _FS_REENTRANT
+    _SYNC_t sobj;         /* Identifier of sync object */
+#endif
+#if !_FS_READONLY
+    DWORD   last_clust;   /* FSINFO: Last allocated cluster */
+    DWORD   free_clust;   /* FSINFO: Number of free clusters */
+#endif
+#if _FS_RPATH
+    DWORD   cdir;         /* Current directory start cluster (0:root) */
+#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 */
+    DWORD   winsect;      /* Current sector appearing in the win[] */
+    BYTE    win[_MAX_SS]; /* Disk access window for directory, FAT (and file data at tiny cfg) */
+} FATFS;
+
+
+ +

Return

+ + diff --git a/3rdparty/fatfs-0.10b/doc/en/sfile.html b/3rdparty/fatfs-0.10b/doc/en/sfile.html new file mode 100644 index 00000000..930573e8 --- /dev/null +++ b/3rdparty/fatfs-0.10b/doc/en/sfile.html @@ -0,0 +1,49 @@ + + + + + + + + +FatFs - FIL + + + + +
+

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. Application program must not modify any member in this structure except for cltbl. Note that a sector buffer is defined in this structure at non-tiny configuration, so that the FIL structures should not be defined as auto variable.

+ +
+typedef struct {
+    FATFS*  fs;           /* Pointer to the owner file system object */
+    WORD    id;           /* Owner file system mount ID */
+    BYTE    flag;         /* File object status flags */
+    BYTE    err;          /* Abort flag (error code) */
+    DWORD   fptr;         /* File read/write pointer (Byte offset origin from top of the file) */
+    DWORD   fsize;        /* File size in unit of byte */
+    DWORD   sclust;       /* File start cluster */
+    DWORD   clust;        /* Current cluster */
+    DWORD   dsect;        /* Current data sector */
+#if !_FS_READONLY
+    DWORD   dir_sect;     /* Sector containing the directory entry */
+    BYTE*   dir_ptr;      /* Ponter to the directory entry in the window */
+#endif
+#if _USE_FASTSEEK
+    DWORD*  cltbl;        /* Pointer to the cluster link map table (Nulled on file open) */
+#endif
+#if _FS_LOCK
+    UINT    lockid;       /* Fle lock ID */
+#endif
+#if !_FS_TINY
+    BYTE    buf[_MAX_SS]; /* File private data transfer buffer */
+#endif
+} FIL;
+
+ +
+ +

Return

+ + diff --git a/3rdparty/fatfs-0.10b/doc/en/sfileinfo.html b/3rdparty/fatfs-0.10b/doc/en/sfileinfo.html new file mode 100644 index 00000000..a862a813 --- /dev/null +++ b/3rdparty/fatfs-0.10b/doc/en/sfileinfo.html @@ -0,0 +1,70 @@ + + + + + + + + +FatFs - FILINFO + + + + +
+

FILINFO

+

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

+
+typedef struct {
+    DWORD fsize;      /* File size */
+    WORD  fdate;      /* Last modified date */
+    WORD  ftime;      /* Last modified time */
+    BYTE  fattrib;    /* Attribute */
+    TCHAR fname[13];  /* Short file name (8.3 format) */
+#if _USE_LFN
+    TCHAR* lfname;    /* Pointer to the LFN buffer */
+    int   lfsize;     /* Size of the LFN buffer in unit of TCHAR */
+#endif
+} FILINFO;
+
+
+ +

Members

+
+
fsize
+
Indicates size of the file in unit of byte. Always zero for directories.
+
fdate
+
Indicates the date that the file was modified or the directory was created.
+
+
bit15:9
+
Year origin from 1980 (0..127)
+
bit8:5
+
Month (1..12)
+
bit4:0
+
Day (1..31)
+
+
+
ftime
+
Indicates the time that the file was modified or the directory was created.
+
+
bit15:11
+
Hour (0..23)
+
bit10:5
+
Minute (0..59)
+
bit4:0
+
Second / 2 (0..29)
+
+
+
fattrib
+
Indicates the file/directory attribute in combination of AM_DIR, AM_RDO, AM_HID, AM_SYS and AM_ARC.
+
fname[]
+
Indicates the file/directory name in 8.3 format null-terminated string. It is always returnd with upper case in non-LFN configuration but it can be returned with lower case in LFN configuration.
+
lfname
+
Pointer to the LFN buffer to store the read LFN. This member must be initialized by application prior to use this structure. Set null pointer if LFN is not needed. Not available in non-LFN configuration.
+
lfsize
+
Size of the LFN buffer in unit of TCHAR. This member must be initialized by application prior to use this structure. Not available in non-LFN configuration.
+
+ +

Return

+ + diff --git a/3rdparty/fatfs-0.10b/doc/en/size.html b/3rdparty/fatfs-0.10b/doc/en/size.html new file mode 100644 index 00000000..f297d20c --- /dev/null +++ b/3rdparty/fatfs-0.10b/doc/en/size.html @@ -0,0 +1,62 @@ + + + + + + + + +FatFs - f_size + + + + +
+

f_size

+

The f_size function gets the size of a file.

+
+DWORD f_size (
+  FIL* fp   /* [IN] File object */
+);
+
+
+ + +
+

Parameters

+
+
fp
+
Pointer to the open file object structure.
+
+
+ + +
+

Return Values

+

Returns the size of the file in unit of byte.

+
+ + +
+

Description

+

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

+
+#define f_size(fp) ((fp)->fsize)
+
+
+ + +
+

QuickInfo

+

Always available.

+
+ + +
+

See Also

+

f_open, f_lseek, FIL

+
+ +

Return

+ + diff --git a/3rdparty/fatfs-0.10b/doc/en/stat.html b/3rdparty/fatfs-0.10b/doc/en/stat.html new file mode 100644 index 00000000..fb0d94a1 --- /dev/null +++ b/3rdparty/fatfs-0.10b/doc/en/stat.html @@ -0,0 +1,74 @@ + + + + + + + + +FatFs - f_stat + + + + +
+

f_stat

+

The f_stat function checks the existence of a file or sub-directory.

+
+FRESULT f_stat (
+  const TCHAR* path,  /* [IN] Object name */
+  FILINFO* fno        /* [OUT] FILINFO structure */
+);
+
+
+ +
+

Parameters

+
+
path
+
Pointer to the null-terminated string that specifies the object to get its information.
+
fno
+
Pointer to the blank FILINFO structure to store the information of the object. Set null pointer if it is not needed.
+
+
+ + +
+

Return Values

+

+FR_OK, +FR_DISK_ERR, +FR_INT_ERR, +FR_NOT_READY, +FR_NO_FILE, +FR_NO_PATH, +FR_INVALID_NAME, +FR_INVALID_DRIVE, +FR_NOT_ENABLED, +FR_NO_FILESYSTEM, +FR_TIMEOUT, +FR_NOT_ENOUGH_CORE +

+
+ + +
+

Description

+

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

+
+ + +
+

QuickInfo

+

Available when _FS_MINIMIZE == 0.

+
+ + +
+

References

+

f_opendir, f_readdir, FILINFO

+
+ +

Return

+ + diff --git a/3rdparty/fatfs-0.10b/doc/en/sync.html b/3rdparty/fatfs-0.10b/doc/en/sync.html new file mode 100644 index 00000000..09bab3d9 --- /dev/null +++ b/3rdparty/fatfs-0.10b/doc/en/sync.html @@ -0,0 +1,66 @@ + + + + + + + + +FatFs - f_sync + + + + +
+

f_sync

+

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

+
+FRESULT f_sync (
+  FIL* fp     /* [IN] File object */
+);
+
+
+ +
+

Parameter

+
+
fp
+
Pointer to the open file object to be flushed.
+
+
+ + +
+

Return Values

+

+FR_OK, +FR_DISK_ERR, +FR_INT_ERR, +FR_NOT_READY, +FR_INVALID_OBJECT, +FR_TIMEOUT +

+
+ + +
+

Description

+

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

+

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

+
+ + +
+

QuickInfo

+

Available when _FS_READONLY == 0.

+
+ + +
+

See Also

+

f_close

+
+ +

Return

+ + diff --git a/3rdparty/fatfs-0.10b/doc/en/tell.html b/3rdparty/fatfs-0.10b/doc/en/tell.html new file mode 100644 index 00000000..2ad86ae9 --- /dev/null +++ b/3rdparty/fatfs-0.10b/doc/en/tell.html @@ -0,0 +1,62 @@ + + + + + + + + +FatFs - f_tell + + + + +
+

f_tell

+

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

+
+DWORD f_tell (
+  FIL* fp   /* [IN] File object */
+);
+
+
+ + +
+

Parameters

+
+
fp
+
Pointer to the open file object structure.
+
+
+ + +
+

Return Values

+

Returns current read/write pointer of the file.

+
+ + +
+

Description

+

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

+
+#define f_tell(fp) ((fp)->fptr)
+
+
+ + +
+

QuickInfo

+

Always available.

+
+ + +
+

See Also

+

f_open, f_lseek, FIL

+
+ +

Return

+ + diff --git a/3rdparty/fatfs-0.10b/doc/en/truncate.html b/3rdparty/fatfs-0.10b/doc/en/truncate.html new file mode 100644 index 00000000..eb0989ec --- /dev/null +++ b/3rdparty/fatfs-0.10b/doc/en/truncate.html @@ -0,0 +1,66 @@ + + + + + + + + +FatFs - f_truncate + + + + +
+

f_truncate

+

The f_truncate function truncates the file size.

+
+FRESULT f_truncate (
+  FIL* fp     /* [IN] File object */
+);
+
+
+ +
+

Parameter

+
+
fp
+
Pointer to the open file object to be truncated.
+
+
+ + +
+

Return Values

+

+FR_OK, +FR_DISK_ERR, +FR_INT_ERR, +FR_NOT_READY, +FR_INVALID_OBJECT, +FR_TIMEOUT +

+
+ + +
+

Description

+

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.

+
+ + +
+

QuickInfo

+

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

+
+ + +
+

See Also

+

f_open, f_lseek, FIL

+
+ + +

Return

+ + diff --git a/3rdparty/fatfs-0.10b/doc/en/unlink.html b/3rdparty/fatfs-0.10b/doc/en/unlink.html new file mode 100644 index 00000000..deb96b98 --- /dev/null +++ b/3rdparty/fatfs-0.10b/doc/en/unlink.html @@ -0,0 +1,75 @@ + + + + + + + + +FatFs - f_unlink + + + + +
+

f_unlink

+

The f_unlink function removes a file or sub-directory.

+
+FRESULT f_unlink (
+  const TCHAR* path  /* [IN] Object name */
+);
+
+
+ +
+

Parameter

+
+
path
+
Pointer to the null-terminated string that specifies an object to be removed.
+
+
+ + +
+

Return Values

+

+FR_OK, +FR_DISK_ERR, +FR_INT_ERR, +FR_NOT_READY, +FR_NO_FILE, +FR_NO_PATH, +FR_INVALID_NAME, +FR_DENIED, +FR_EXIST, +FR_WRITE_PROTECTED, +FR_INVALID_DRIVE, +FR_NOT_ENABLED, +FR_NO_FILESYSTEM, +FR_TIMEOUT, +FR_LOCKED, +FR_NOT_ENOUGH_CORE +

+
+ + +
+

Description

+

+If condition of the object to be removed is applicable to the following terms, the function will be rejected.

+
+ + +
+

QuickInfo

+

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

+
+ + +

Return

+ + diff --git a/3rdparty/fatfs-0.10b/doc/en/utime.html b/3rdparty/fatfs-0.10b/doc/en/utime.html new file mode 100644 index 00000000..2174a05d --- /dev/null +++ b/3rdparty/fatfs-0.10b/doc/en/utime.html @@ -0,0 +1,99 @@ + + + + + + + + +FatFs - f_utime + + + + +
+

f_utime

+

The f_utime function changes the timestamp of a file or sub-directory.

+
+FRESULT f_utime (
+  const TCHAR* path,  /* [IN] Object name */
+  const FILINFO* fno  /* [IN] Time and data to be set */
+);
+
+
+ +
+

Parameters

+
+
path
+
Pointer to the null-terminated string that specifies an object to be changed.
+
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.
+
+
+ + +
+

Return Values

+

+FR_OK, +FR_DISK_ERR, +FR_INT_ERR, +FR_NOT_READY, +FR_NO_FILE, +FR_NO_PATH, +FR_INVALID_NAME, +FR_WRITE_PROTECTED, +FR_INVALID_DRIVE, +FR_NOT_ENABLED, +FR_NO_FILESYSTEM, +FR_TIMEOUT, +FR_NOT_ENOUGH_CORE +

+
+ + +
+

Description

+

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

+
+ + +
+

Example

+
+FRESULT set_timestamp (
+    char *obj,     /* Pointer to the file name */
+    int year,
+    int month,
+    int mday,
+    int hour,
+    int min,
+    int sec
+)
+{
+    FILINFO fno;
+
+    fno.fdate = (WORD)(((year - 1980) * 512U) | month * 32U | mday);
+    fno.ftime = (WORD)(hour * 2048U | min * 32U | sec / 2U);
+
+    return f_utime(obj, &fno);
+}
+
+
+ + +
+

QuickInfo

+

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

+
+ + +
+

See Also

+

f_stat, FILINFO

+
+ +

Return

+ + diff --git a/3rdparty/fatfs-0.10b/doc/en/write.html b/3rdparty/fatfs-0.10b/doc/en/write.html new file mode 100644 index 00000000..a12af694 --- /dev/null +++ b/3rdparty/fatfs-0.10b/doc/en/write.html @@ -0,0 +1,74 @@ + + + + + + + + +FatFs - f_write + + + + +
+

f_write

+

The f_write writes data to a file.

+
+FRESULT f_write (
+  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 */
+);
+
+
+ +
+

Parameters

+
+
fp
+
Pointer to the open file object structure.
+
buff
+
Pointer to the data to be written.
+
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.
+
+
+ + +
+

Return Values

+

+FR_OK, +FR_DISK_ERR, +FR_INT_ERR, +FR_NOT_READY, +FR_INVALID_OBJECT, +FR_TIMEOUT +

+
+ + +
+

Description

+

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.

+
+ + +
+

QuickInfo

+

Available when _FS_READONLY == 0.

+
+ + +
+

See Also

+

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

+
+ +

Return

+ + -- cgit v1.2.3