modified version using external RTC for timestamps

Fork of FATFileSystem by mbed official

Committer:
mbed_official
Date:
Thu Aug 13 10:15:39 2015 +0100
Revision:
5:b3b3370574cf
Parent:
4:3ff2606d5713
Child:
6:a5fcdbf92056
Synchronized with git revision ab6a668ec18ad1530649c4cf1067a42816c6a7f8

Full URL: https://github.com/mbedmicro/mbed/commit/ab6a668ec18ad1530649c4cf1067a42816c6a7f8/

FATFileSystem - Updated FatFs to R0.11

Who changed what in which revision?

UserRevisionLine numberNew contents of line
emilmont 1:46ce1e16c870 1 /*---------------------------------------------------------------------------/
mbed_official 5:b3b3370574cf 2 / FatFs - FAT file system module configuration file R0.11 (C)ChaN, 2015
mbed_official 5:b3b3370574cf 3 /---------------------------------------------------------------------------*/
emilmont 1:46ce1e16c870 4
mbed_official 5:b3b3370574cf 5 #define _FFCONF 32020 /* Revision ID */
mbed_official 5:b3b3370574cf 6
mbed_official 5:b3b3370574cf 7 #define FFS_DBG 0
emilmont 1:46ce1e16c870 8
emilmont 1:46ce1e16c870 9 /*---------------------------------------------------------------------------/
emilmont 1:46ce1e16c870 10 / Functions and Buffer Configurations
mbed_official 5:b3b3370574cf 11 /---------------------------------------------------------------------------*/
emilmont 1:46ce1e16c870 12
mbed_official 5:b3b3370574cf 13 #define _FS_TINY 0
mbed_official 5:b3b3370574cf 14 /* This option switches tiny buffer configuration. (0:Normal or 1:Tiny)
mbed_official 5:b3b3370574cf 15 / At the tiny configuration, size of the file object (FIL) is reduced _MAX_SS
mbed_official 5:b3b3370574cf 16 / bytes. Instead of private sector buffer eliminated from the file object,
mbed_official 5:b3b3370574cf 17 / common sector buffer in the file system object (FATFS) is used for the file
mbed_official 5:b3b3370574cf 18 / data transfer. */
emilmont 1:46ce1e16c870 19
emilmont 1:46ce1e16c870 20
mbed_official 5:b3b3370574cf 21 #define _FS_READONLY 0
mbed_official 5:b3b3370574cf 22 /* This option switches read-only configuration. (0:Read/Write or 1:Read-only)
mbed_official 5:b3b3370574cf 23 / Read-only configuration removes writing API functions, f_write(), f_sync(),
mbed_official 5:b3b3370574cf 24 / f_unlink(), f_mkdir(), f_chmod(), f_rename(), f_truncate(), f_getfree()
mbed_official 5:b3b3370574cf 25 / and optional writing functions as well. */
mbed_official 5:b3b3370574cf 26
mbed_official 5:b3b3370574cf 27
mbed_official 5:b3b3370574cf 28 #define _FS_MINIMIZE 0
mbed_official 5:b3b3370574cf 29 /* This option defines minimization level to remove some basic API functions.
mbed_official 5:b3b3370574cf 30 /
mbed_official 5:b3b3370574cf 31 / 0: All basic functions are enabled.
mbed_official 5:b3b3370574cf 32 / 1: f_stat(), f_getfree(), f_unlink(), f_mkdir(), f_chmod(), f_utime(),
mbed_official 5:b3b3370574cf 33 / f_truncate() and f_rename() function are removed.
mbed_official 5:b3b3370574cf 34 / 2: f_opendir(), f_readdir() and f_closedir() are removed in addition to 1.
mbed_official 5:b3b3370574cf 35 / 3: f_lseek() function is removed in addition to 2. */
emilmont 1:46ce1e16c870 36
emilmont 1:46ce1e16c870 37
mbed_official 5:b3b3370574cf 38 #define _USE_STRFUNC 0
mbed_official 5:b3b3370574cf 39 /* This option switches string functions, f_gets(), f_putc(), f_puts() and
mbed_official 5:b3b3370574cf 40 / f_printf().
emilmont 1:46ce1e16c870 41 /
mbed_official 5:b3b3370574cf 42 / 0: Disable string functions.
mbed_official 5:b3b3370574cf 43 / 1: Enable without LF-CRLF conversion.
mbed_official 5:b3b3370574cf 44 / 2: Enable with LF-CRLF conversion. */
mbed_official 5:b3b3370574cf 45
mbed_official 5:b3b3370574cf 46
mbed_official 5:b3b3370574cf 47 #define _USE_FIND 0
mbed_official 5:b3b3370574cf 48 /* This option switches filtered directory read feature and related functions,
mbed_official 5:b3b3370574cf 49 / f_findfirst() and f_findnext(). (0:Disable or 1:Enable) */
emilmont 1:46ce1e16c870 50
emilmont 1:46ce1e16c870 51
mbed_official 5:b3b3370574cf 52 #define _USE_MKFS 1
mbed_official 5:b3b3370574cf 53 /* This option switches f_mkfs() function. (0:Disable or 1:Enable) */
emilmont 1:46ce1e16c870 54
emilmont 1:46ce1e16c870 55
mbed_official 5:b3b3370574cf 56 #define _USE_FASTSEEK 0
mbed_official 5:b3b3370574cf 57 /* This option switches fast seek feature. (0:Disable or 1:Enable) */
emilmont 1:46ce1e16c870 58
emilmont 1:46ce1e16c870 59
mbed_official 5:b3b3370574cf 60 #define _USE_LABEL 0
mbed_official 5:b3b3370574cf 61 /* This option switches volume label functions, f_getlabel() and f_setlabel().
mbed_official 5:b3b3370574cf 62 / (0:Disable or 1:Enable) */
emilmont 1:46ce1e16c870 63
emilmont 1:46ce1e16c870 64
mbed_official 5:b3b3370574cf 65 #define _USE_FORWARD 0
mbed_official 5:b3b3370574cf 66 /* This option switches f_forward() function. (0:Disable or 1:Enable)
mbed_official 5:b3b3370574cf 67 / To enable it, also _FS_TINY need to be set to 1. */
emilmont 1:46ce1e16c870 68
emilmont 1:46ce1e16c870 69
emilmont 1:46ce1e16c870 70 /*---------------------------------------------------------------------------/
emilmont 1:46ce1e16c870 71 / Locale and Namespace Configurations
mbed_official 5:b3b3370574cf 72 /---------------------------------------------------------------------------*/
emilmont 1:46ce1e16c870 73
mbed_official 5:b3b3370574cf 74 #define _CODE_PAGE 858
mbed_official 5:b3b3370574cf 75 /* This option specifies the OEM code page to be used on the target system.
emilmont 1:46ce1e16c870 76 / Incorrect setting of the code page can cause a file open failure.
emilmont 1:46ce1e16c870 77 /
mbed_official 5:b3b3370574cf 78 / 1 - ASCII (No extended character. Non-LFN cfg. only)
mbed_official 5:b3b3370574cf 79 / 437 - U.S.
mbed_official 5:b3b3370574cf 80 / 720 - Arabic
mbed_official 5:b3b3370574cf 81 / 737 - Greek
mbed_official 5:b3b3370574cf 82 / 775 - Baltic
mbed_official 5:b3b3370574cf 83 / 850 - Multilingual Latin 1
mbed_official 5:b3b3370574cf 84 / 852 - Latin 2
mbed_official 5:b3b3370574cf 85 / 855 - Cyrillic
mbed_official 5:b3b3370574cf 86 / 857 - Turkish
mbed_official 5:b3b3370574cf 87 / 858 - Multilingual Latin 1 + Euro
mbed_official 5:b3b3370574cf 88 / 862 - Hebrew
mbed_official 5:b3b3370574cf 89 / 866 - Russian
mbed_official 5:b3b3370574cf 90 / 874 - Thai
mbed_official 5:b3b3370574cf 91 / 932 - Japanese Shift_JIS (DBCS)
mbed_official 5:b3b3370574cf 92 / 936 - Simplified Chinese GBK (DBCS)
mbed_official 5:b3b3370574cf 93 / 949 - Korean (DBCS)
mbed_official 5:b3b3370574cf 94 / 950 - Traditional Chinese Big5 (DBCS)
emilmont 1:46ce1e16c870 95 */
emilmont 1:46ce1e16c870 96
emilmont 1:46ce1e16c870 97
mbed_official 5:b3b3370574cf 98 #define _USE_LFN 1
mbed_official 5:b3b3370574cf 99 #define _MAX_LFN 255
mbed_official 5:b3b3370574cf 100 /* The _USE_LFN option switches the LFN feature.
emilmont 1:46ce1e16c870 101 /
mbed_official 5:b3b3370574cf 102 / 0: Disable LFN feature. _MAX_LFN has no effect.
mbed_official 5:b3b3370574cf 103 / 1: Enable LFN with static working buffer on the BSS. Always NOT thread-safe.
emilmont 1:46ce1e16c870 104 / 2: Enable LFN with dynamic working buffer on the STACK.
emilmont 1:46ce1e16c870 105 / 3: Enable LFN with dynamic working buffer on the HEAP.
emilmont 1:46ce1e16c870 106 /
mbed_official 5:b3b3370574cf 107 / When enable the LFN feature, Unicode handling functions (option/unicode.c) must
mbed_official 5:b3b3370574cf 108 / be added to the project. The LFN working buffer occupies (_MAX_LFN + 1) * 2 bytes.
mbed_official 5:b3b3370574cf 109 / When use stack for the working buffer, take care on stack overflow. When use heap
mbed_official 5:b3b3370574cf 110 / memory for the working buffer, memory management functions, ff_memalloc() and
mbed_official 5:b3b3370574cf 111 / ff_memfree(), must be added to the project. */
mbed_official 5:b3b3370574cf 112
mbed_official 5:b3b3370574cf 113
mbed_official 5:b3b3370574cf 114 #define _LFN_UNICODE 0
mbed_official 5:b3b3370574cf 115 /* This option switches character encoding on the API. (0:ANSI/OEM or 1:Unicode)
mbed_official 5:b3b3370574cf 116 / To use Unicode string for the path name, enable LFN feature and set _LFN_UNICODE
mbed_official 5:b3b3370574cf 117 / to 1. This option also affects behavior of string I/O functions. */
emilmont 1:46ce1e16c870 118
emilmont 1:46ce1e16c870 119
mbed_official 5:b3b3370574cf 120 #define _STRF_ENCODE 3
mbed_official 5:b3b3370574cf 121 /* When _LFN_UNICODE is 1, this option selects the character encoding on the file to
mbed_official 5:b3b3370574cf 122 / be read/written via string I/O functions, f_gets(), f_putc(), f_puts and f_printf().
mbed_official 5:b3b3370574cf 123 /
mbed_official 5:b3b3370574cf 124 / 0: ANSI/OEM
mbed_official 5:b3b3370574cf 125 / 1: UTF-16LE
mbed_official 5:b3b3370574cf 126 / 2: UTF-16BE
mbed_official 5:b3b3370574cf 127 / 3: UTF-8
mbed_official 5:b3b3370574cf 128 /
mbed_official 5:b3b3370574cf 129 / When _LFN_UNICODE is 0, this option has no effect. */
emilmont 1:46ce1e16c870 130
emilmont 1:46ce1e16c870 131
mbed_official 5:b3b3370574cf 132 #define _FS_RPATH 0
mbed_official 5:b3b3370574cf 133 /* This option configures relative path feature.
emilmont 1:46ce1e16c870 134 /
emilmont 1:46ce1e16c870 135 / 0: Disable relative path feature and remove related functions.
mbed_official 5:b3b3370574cf 136 / 1: Enable relative path feature. f_chdir() and f_chdrive() are available.
mbed_official 5:b3b3370574cf 137 / 2: f_getcwd() function is available in addition to 1.
emilmont 1:46ce1e16c870 138 /
mbed_official 5:b3b3370574cf 139 / Note that directory items read via f_readdir() are affected by this option. */
emilmont 1:46ce1e16c870 140
emilmont 1:46ce1e16c870 141
emilmont 1:46ce1e16c870 142 /*---------------------------------------------------------------------------/
mbed_official 5:b3b3370574cf 143 / Drive/Volume Configurations
mbed_official 5:b3b3370574cf 144 /---------------------------------------------------------------------------*/
emilmont 1:46ce1e16c870 145
mbed_official 5:b3b3370574cf 146 #define _VOLUMES 1
emilmont 1:46ce1e16c870 147 /* Number of volumes (logical drives) to be used. */
emilmont 1:46ce1e16c870 148
emilmont 1:46ce1e16c870 149
mbed_official 5:b3b3370574cf 150 #define _STR_VOLUME_ID 0
mbed_official 5:b3b3370574cf 151 #define _VOLUME_STRS "RAM","NAND","CF","SD1","SD2","USB1","USB2","USB3"
mbed_official 5:b3b3370574cf 152 /* _STR_VOLUME_ID option switches string volume ID feature.
mbed_official 5:b3b3370574cf 153 / When _STR_VOLUME_ID is set to 1, also pre-defined strings can be used as drive
mbed_official 5:b3b3370574cf 154 / number in the path name. _VOLUME_STRS defines the drive ID strings for each
mbed_official 5:b3b3370574cf 155 / logical drives. Number of items must be equal to _VOLUMES. Valid characters for
mbed_official 5:b3b3370574cf 156 / the drive ID strings are: A-Z and 0-9. */
mbed_official 5:b3b3370574cf 157
mbed_official 5:b3b3370574cf 158
mbed_official 5:b3b3370574cf 159 #define _MULTI_PARTITION 0
mbed_official 5:b3b3370574cf 160 /* This option switches multi-partition feature. By default (0), each logical drive
mbed_official 5:b3b3370574cf 161 / number is bound to the same physical drive number and only an FAT volume found on
mbed_official 5:b3b3370574cf 162 / the physical drive will be mounted. When multi-partition feature is enabled (1),
mbed_official 5:b3b3370574cf 163 / each logical drive number is bound to arbitrary physical drive and partition
mbed_official 5:b3b3370574cf 164 / listed in the VolToPart[]. Also f_fdisk() funciton will be available. */
emilmont 1:46ce1e16c870 165
emilmont 1:46ce1e16c870 166
mbed_official 5:b3b3370574cf 167 #define _MIN_SS 512
mbed_official 5:b3b3370574cf 168 #define _MAX_SS 512
mbed_official 5:b3b3370574cf 169 /* These options configure the range of sector size to be supported. (512, 1024,
mbed_official 5:b3b3370574cf 170 / 2048 or 4096) Always set both 512 for most systems, all type of memory cards and
mbed_official 5:b3b3370574cf 171 / harddisk. But a larger value may be required for on-board flash memory and some
mbed_official 5:b3b3370574cf 172 / type of optical media. When _MAX_SS is larger than _MIN_SS, FatFs is configured
mbed_official 5:b3b3370574cf 173 / to variable sector size and GET_SECTOR_SIZE command must be implemented to the
mbed_official 5:b3b3370574cf 174 / disk_ioctl() function. */
emilmont 1:46ce1e16c870 175
emilmont 1:46ce1e16c870 176
mbed_official 5:b3b3370574cf 177 #define _USE_TRIM 0
mbed_official 5:b3b3370574cf 178 /* This option switches ATA-TRIM feature. (0:Disable or 1:Enable)
mbed_official 5:b3b3370574cf 179 / To enable Trim feature, also CTRL_TRIM command should be implemented to the
mbed_official 5:b3b3370574cf 180 / disk_ioctl() function. */
mbed_official 5:b3b3370574cf 181
mbed_official 5:b3b3370574cf 182
mbed_official 5:b3b3370574cf 183 #define _FS_NOFSINFO 0
mbed_official 5:b3b3370574cf 184 /* If you need to know correct free space on the FAT32 volume, set bit 0 of this
mbed_official 5:b3b3370574cf 185 / option, and f_getfree() function at first time after volume mount will force
mbed_official 5:b3b3370574cf 186 / a full FAT scan. Bit 1 controls the use of last allocated cluster number.
mbed_official 5:b3b3370574cf 187 /
mbed_official 5:b3b3370574cf 188 / bit0=0: Use free cluster count in the FSINFO if available.
mbed_official 5:b3b3370574cf 189 / bit0=1: Do not trust free cluster count in the FSINFO.
mbed_official 5:b3b3370574cf 190 / bit1=0: Use last allocated cluster number in the FSINFO if available.
mbed_official 5:b3b3370574cf 191 / bit1=1: Do not trust last allocated cluster number in the FSINFO.
mbed_official 5:b3b3370574cf 192 */
emilmont 1:46ce1e16c870 193
emilmont 1:46ce1e16c870 194
emilmont 1:46ce1e16c870 195
emilmont 1:46ce1e16c870 196 /*---------------------------------------------------------------------------/
emilmont 1:46ce1e16c870 197 / System Configurations
mbed_official 5:b3b3370574cf 198 /---------------------------------------------------------------------------*/
emilmont 1:46ce1e16c870 199
mbed_official 5:b3b3370574cf 200 #define _FS_NORTC 0
mbed_official 5:b3b3370574cf 201 #define _NORTC_MON 2
mbed_official 5:b3b3370574cf 202 #define _NORTC_MDAY 1
mbed_official 5:b3b3370574cf 203 #define _NORTC_YEAR 2015
mbed_official 5:b3b3370574cf 204 /* The _FS_NORTC option switches timestamp feature. If the system does not have
mbed_official 5:b3b3370574cf 205 / an RTC function or valid timestamp is not needed, set _FS_NORTC to 1 to disable
mbed_official 5:b3b3370574cf 206 / the timestamp feature. All objects modified by FatFs will have a fixed timestamp
mbed_official 5:b3b3370574cf 207 / defined by _NORTC_MON, _NORTC_MDAY and _NORTC_YEAR.
mbed_official 5:b3b3370574cf 208 / When timestamp feature is enabled (_FS_NORTC == 0), get_fattime() function need
mbed_official 5:b3b3370574cf 209 / to be added to the project to read current time form RTC. _NORTC_MON,
mbed_official 5:b3b3370574cf 210 / _NORTC_MDAY and _NORTC_YEAR have no effect.
mbed_official 5:b3b3370574cf 211 / These options have no effect at read-only configuration (_FS_READONLY == 1). */
mbed_official 5:b3b3370574cf 212
mbed_official 5:b3b3370574cf 213
mbed_official 5:b3b3370574cf 214 #define _FS_LOCK 0
mbed_official 5:b3b3370574cf 215 /* The _FS_LOCK option switches file lock feature to control duplicated file open
mbed_official 5:b3b3370574cf 216 / and illegal operation to open objects. This option must be 0 when _FS_READONLY
mbed_official 5:b3b3370574cf 217 / is 1.
emilmont 1:46ce1e16c870 218 /
mbed_official 5:b3b3370574cf 219 / 0: Disable file lock feature. To avoid volume corruption, application program
mbed_official 5:b3b3370574cf 220 / should avoid illegal open, remove and rename to the open objects.
mbed_official 5:b3b3370574cf 221 / >0: Enable file lock feature. The value defines how many files/sub-directories
mbed_official 5:b3b3370574cf 222 / can be opened simultaneously under file lock control. Note that the file
mbed_official 5:b3b3370574cf 223 / lock feature is independent of re-entrancy. */
emilmont 1:46ce1e16c870 224
emilmont 1:46ce1e16c870 225
mbed_official 5:b3b3370574cf 226 #define _FS_REENTRANT 0
mbed_official 5:b3b3370574cf 227 #define _FS_TIMEOUT 1000
mbed_official 5:b3b3370574cf 228 #define _SYNC_t HANDLE
mbed_official 5:b3b3370574cf 229 /* The _FS_REENTRANT option switches the re-entrancy (thread safe) of the FatFs
mbed_official 5:b3b3370574cf 230 / module itself. Note that regardless of this option, file access to different
mbed_official 5:b3b3370574cf 231 / volume is always re-entrant and volume control functions, f_mount(), f_mkfs()
mbed_official 5:b3b3370574cf 232 / and f_fdisk() function, are always not re-entrant. Only file/directory access
mbed_official 5:b3b3370574cf 233 / to the same volume is under control of this feature.
emilmont 1:46ce1e16c870 234 /
mbed_official 5:b3b3370574cf 235 / 0: Disable re-entrancy. _FS_TIMEOUT and _SYNC_t have no effect.
mbed_official 5:b3b3370574cf 236 / 1: Enable re-entrancy. Also user provided synchronization handlers,
mbed_official 5:b3b3370574cf 237 / ff_req_grant(), ff_rel_grant(), ff_del_syncobj() and ff_cre_syncobj()
mbed_official 5:b3b3370574cf 238 / function, must be added to the project. Samples are available in
mbed_official 5:b3b3370574cf 239 / option/syscall.c.
mbed_official 5:b3b3370574cf 240 /
mbed_official 5:b3b3370574cf 241 / The _FS_TIMEOUT defines timeout period in unit of time tick.
mbed_official 5:b3b3370574cf 242 / The _SYNC_t defines O/S dependent sync object type. e.g. HANDLE, ID, OS_EVENT*,
mbed_official 5:b3b3370574cf 243 / SemaphoreHandle_t and etc.. A header file for O/S definitions needs to be
mbed_official 5:b3b3370574cf 244 / included somewhere in the scope of ff.c. */
emilmont 1:46ce1e16c870 245
emilmont 1:46ce1e16c870 246
mbed_official 5:b3b3370574cf 247 #define _WORD_ACCESS 0
mbed_official 5:b3b3370574cf 248 /* The _WORD_ACCESS option is an only platform dependent option. It defines
mbed_official 5:b3b3370574cf 249 / which access method is used to the word data on the FAT volume.
mbed_official 5:b3b3370574cf 250 /
mbed_official 5:b3b3370574cf 251 / 0: Byte-by-byte access. Always compatible with all platforms.
mbed_official 5:b3b3370574cf 252 / 1: Word access. Do not choose this unless under both the following conditions.
mbed_official 5:b3b3370574cf 253 /
mbed_official 5:b3b3370574cf 254 / * Address misaligned memory access is always allowed to ALL instructions.
mbed_official 5:b3b3370574cf 255 / * Byte order on the memory is little-endian.
mbed_official 5:b3b3370574cf 256 /
mbed_official 5:b3b3370574cf 257 / If it is the case, _WORD_ACCESS can also be set to 1 to reduce code size.
mbed_official 5:b3b3370574cf 258 / Following table shows allowable settings of some processor types.
mbed_official 5:b3b3370574cf 259 /
mbed_official 5:b3b3370574cf 260 / ARM7TDMI 0 *2 ColdFire 0 *1 V850E 0 *2
mbed_official 5:b3b3370574cf 261 / Cortex-M3 0 *3 Z80 0/1 V850ES 0/1
mbed_official 5:b3b3370574cf 262 / Cortex-M0 0 *2 x86 0/1 TLCS-870 0/1
mbed_official 5:b3b3370574cf 263 / AVR 0/1 RX600(LE) 0/1 TLCS-900 0/1
mbed_official 5:b3b3370574cf 264 / AVR32 0 *1 RL78 0 *2 R32C 0 *2
mbed_official 5:b3b3370574cf 265 / PIC18 0/1 SH-2 0 *1 M16C 0/1
mbed_official 5:b3b3370574cf 266 / PIC24 0 *2 H8S 0 *1 MSP430 0 *2
mbed_official 5:b3b3370574cf 267 / PIC32 0 *1 H8/300H 0 *1 8051 0/1
mbed_official 5:b3b3370574cf 268 /
mbed_official 5:b3b3370574cf 269 / *1:Big-endian.
mbed_official 5:b3b3370574cf 270 / *2:Unaligned memory access is not supported.
mbed_official 5:b3b3370574cf 271 / *3:Some compilers generate LDM/STM for mem_cpy function.
mbed_official 5:b3b3370574cf 272 */
emilmont 1:46ce1e16c870 273
mbed_official 4:3ff2606d5713 274 #define FLUSH_ON_NEW_CLUSTER 0 /* Sync the file on every new cluster */
mbed_official 4:3ff2606d5713 275 #define FLUSH_ON_NEW_SECTOR 1 /* Sync the file on every new sector */
mbed_official 4:3ff2606d5713 276 /* Only one of these two defines needs to be set to 1. If both are set to 0
mbed_official 4:3ff2606d5713 277 the file is only sync when closed.
mbed_official 4:3ff2606d5713 278 Clusters are group of sectors (eg: 8 sectors). Flushing on new cluster means
mbed_official 4:3ff2606d5713 279 it would be less often than flushing on new sector. Sectors are generally
mbed_official 4:3ff2606d5713 280 512 Bytes long. */