Adaptation of the official mbed FATFileSystem repository to allow more than one file system volume

Dependents:   DMSupport DMSupport DMSupport

Fork of DM_FATFileSystem by EmbeddedArtists AB

Committer:
embeddedartists
Date:
Thu Dec 11 11:07:47 2014 +0000
Revision:
7:edfd01fea6d7
Parent:
6:4b97221ac12e
Fixed the implementation of opendir() and mkdir() functions so that they work in multi-volume environments (e.g. when using MCI and USB file systems at the same time)

Who changed what in which revision?

UserRevisionLine numberNew contents of line
emilmont 1:46ce1e16c870 1 /*---------------------------------------------------------------------------/
emilmont 1:46ce1e16c870 2 / FatFs - FAT file system module configuration file R0.09a (C)ChaN, 2012
emilmont 1:46ce1e16c870 3 /----------------------------------------------------------------------------/
emilmont 1:46ce1e16c870 4 /
emilmont 1:46ce1e16c870 5 / CAUTION! Do not forget to make clean the project after any changes to
emilmont 1:46ce1e16c870 6 / the configuration options.
emilmont 1:46ce1e16c870 7 /
emilmont 1:46ce1e16c870 8 /----------------------------------------------------------------------------*/
emilmont 1:46ce1e16c870 9 #ifndef _FFCONF
emilmont 1:46ce1e16c870 10 #define _FFCONF 4004 /* Revision ID */
emilmont 1:46ce1e16c870 11
emilmont 1:46ce1e16c870 12 #define FFS_DBG 0
emilmont 1:46ce1e16c870 13
embeddedartists 6:4b97221ac12e 14 // For syncing
embeddedartists 6:4b97221ac12e 15 #define HANDLE void*
embeddedartists 6:4b97221ac12e 16
emilmont 1:46ce1e16c870 17 /*---------------------------------------------------------------------------/
emilmont 1:46ce1e16c870 18 / Functions and Buffer Configurations
emilmont 1:46ce1e16c870 19 /----------------------------------------------------------------------------*/
emilmont 1:46ce1e16c870 20
emilmont 1:46ce1e16c870 21 #define _FS_TINY 0 /* 0:Normal or 1:Tiny */
emilmont 1:46ce1e16c870 22 /* When _FS_TINY is set to 1, FatFs uses the sector buffer in the file system
emilmont 1:46ce1e16c870 23 / object instead of the sector buffer in the individual file object for file
emilmont 1:46ce1e16c870 24 / data transfer. This reduces memory consumption 512 bytes each file object. */
emilmont 1:46ce1e16c870 25
emilmont 1:46ce1e16c870 26
emilmont 1:46ce1e16c870 27 #define _FS_READONLY 0 /* 0:Read/Write or 1:Read only */
emilmont 1:46ce1e16c870 28 /* Setting _FS_READONLY to 1 defines read only configuration. This removes
emilmont 1:46ce1e16c870 29 / writing functions, f_write, f_sync, f_unlink, f_mkdir, f_chmod, f_rename,
emilmont 1:46ce1e16c870 30 / f_truncate and useless f_getfree. */
emilmont 1:46ce1e16c870 31
emilmont 1:46ce1e16c870 32
emilmont 1:46ce1e16c870 33 #define _FS_MINIMIZE 0 /* 0 to 3 */
emilmont 1:46ce1e16c870 34 /* The _FS_MINIMIZE option defines minimization level to remove some functions.
emilmont 1:46ce1e16c870 35 /
emilmont 1:46ce1e16c870 36 / 0: Full function.
emilmont 1:46ce1e16c870 37 / 1: f_stat, f_getfree, f_unlink, f_mkdir, f_chmod, f_truncate and f_rename
emilmont 1:46ce1e16c870 38 / are removed.
emilmont 1:46ce1e16c870 39 / 2: f_opendir and f_readdir are removed in addition to 1.
emilmont 1:46ce1e16c870 40 / 3: f_lseek is removed in addition to 2. */
emilmont 1:46ce1e16c870 41
emilmont 1:46ce1e16c870 42
emilmont 1:46ce1e16c870 43 #define _USE_STRFUNC 0 /* 0:Disable or 1-2:Enable */
emilmont 1:46ce1e16c870 44 /* To enable string functions, set _USE_STRFUNC to 1 or 2. */
emilmont 1:46ce1e16c870 45
emilmont 1:46ce1e16c870 46
emilmont 1:46ce1e16c870 47 #define _USE_MKFS 1 /* 0:Disable or 1:Enable */
emilmont 1:46ce1e16c870 48 /* To enable f_mkfs function, set _USE_MKFS to 1 and set _FS_READONLY to 0 */
emilmont 1:46ce1e16c870 49
emilmont 1:46ce1e16c870 50
emilmont 1:46ce1e16c870 51 #define _USE_FORWARD 0 /* 0:Disable or 1:Enable */
emilmont 1:46ce1e16c870 52 /* To enable f_forward function, set _USE_FORWARD to 1 and set _FS_TINY to 1. */
emilmont 1:46ce1e16c870 53
emilmont 1:46ce1e16c870 54
emilmont 1:46ce1e16c870 55 #define _USE_FASTSEEK 0 /* 0:Disable or 1:Enable */
emilmont 1:46ce1e16c870 56 /* To enable fast seek feature, set _USE_FASTSEEK to 1. */
emilmont 1:46ce1e16c870 57
emilmont 1:46ce1e16c870 58
emilmont 1:46ce1e16c870 59
emilmont 1:46ce1e16c870 60 /*---------------------------------------------------------------------------/
emilmont 1:46ce1e16c870 61 / Locale and Namespace Configurations
emilmont 1:46ce1e16c870 62 /----------------------------------------------------------------------------*/
emilmont 1:46ce1e16c870 63
emilmont 1:46ce1e16c870 64 #define _CODE_PAGE 858
emilmont 1:46ce1e16c870 65 /* The _CODE_PAGE specifies the OEM code page to be used on the target system.
emilmont 1:46ce1e16c870 66 / Incorrect setting of the code page can cause a file open failure.
emilmont 1:46ce1e16c870 67 /
emilmont 1:46ce1e16c870 68 / 932 - Japanese Shift-JIS (DBCS, OEM, Windows)
emilmont 1:46ce1e16c870 69 / 936 - Simplified Chinese GBK (DBCS, OEM, Windows)
emilmont 1:46ce1e16c870 70 / 949 - Korean (DBCS, OEM, Windows)
emilmont 1:46ce1e16c870 71 / 950 - Traditional Chinese Big5 (DBCS, OEM, Windows)
emilmont 1:46ce1e16c870 72 / 1250 - Central Europe (Windows)
emilmont 1:46ce1e16c870 73 / 1251 - Cyrillic (Windows)
emilmont 1:46ce1e16c870 74 / 1252 - Latin 1 (Windows)
emilmont 1:46ce1e16c870 75 / 1253 - Greek (Windows)
emilmont 1:46ce1e16c870 76 / 1254 - Turkish (Windows)
emilmont 1:46ce1e16c870 77 / 1255 - Hebrew (Windows)
emilmont 1:46ce1e16c870 78 / 1256 - Arabic (Windows)
emilmont 1:46ce1e16c870 79 / 1257 - Baltic (Windows)
emilmont 1:46ce1e16c870 80 / 1258 - Vietnam (OEM, Windows)
emilmont 1:46ce1e16c870 81 / 437 - U.S. (OEM)
emilmont 1:46ce1e16c870 82 / 720 - Arabic (OEM)
emilmont 1:46ce1e16c870 83 / 737 - Greek (OEM)
emilmont 1:46ce1e16c870 84 / 775 - Baltic (OEM)
emilmont 1:46ce1e16c870 85 / 850 - Multilingual Latin 1 (OEM)
emilmont 1:46ce1e16c870 86 / 858 - Multilingual Latin 1 + Euro (OEM)
emilmont 1:46ce1e16c870 87 / 852 - Latin 2 (OEM)
emilmont 1:46ce1e16c870 88 / 855 - Cyrillic (OEM)
emilmont 1:46ce1e16c870 89 / 866 - Russian (OEM)
emilmont 1:46ce1e16c870 90 / 857 - Turkish (OEM)
emilmont 1:46ce1e16c870 91 / 862 - Hebrew (OEM)
emilmont 1:46ce1e16c870 92 / 874 - Thai (OEM, Windows)
emilmont 1:46ce1e16c870 93 / 1 - ASCII only (Valid for non LFN cfg.)
emilmont 1:46ce1e16c870 94 */
emilmont 1:46ce1e16c870 95
emilmont 1:46ce1e16c870 96
embeddedartists 6:4b97221ac12e 97 #define _USE_LFN 3 /* 0 to 3 */
emilmont 1:46ce1e16c870 98 #define _MAX_LFN 255 /* Maximum LFN length to handle (12 to 255) */
emilmont 1:46ce1e16c870 99 /* The _USE_LFN option switches the LFN support.
emilmont 1:46ce1e16c870 100 /
emilmont 1:46ce1e16c870 101 / 0: Disable LFN feature. _MAX_LFN and _LFN_UNICODE have no effect.
emilmont 1:46ce1e16c870 102 / 1: Enable LFN with static working buffer on the BSS. Always NOT reentrant.
emilmont 1:46ce1e16c870 103 / 2: Enable LFN with dynamic working buffer on the STACK.
emilmont 1:46ce1e16c870 104 / 3: Enable LFN with dynamic working buffer on the HEAP.
emilmont 1:46ce1e16c870 105 /
emilmont 1:46ce1e16c870 106 / The LFN working buffer occupies (_MAX_LFN + 1) * 2 bytes. To enable LFN,
emilmont 1:46ce1e16c870 107 / Unicode handling functions ff_convert() and ff_wtoupper() must be added
emilmont 1:46ce1e16c870 108 / to the project. When enable to use heap, memory control functions
emilmont 1:46ce1e16c870 109 / ff_memalloc() and ff_memfree() must be added to the project. */
emilmont 1:46ce1e16c870 110
emilmont 1:46ce1e16c870 111
emilmont 1:46ce1e16c870 112 #define _LFN_UNICODE 0 /* 0:ANSI/OEM or 1:Unicode */
emilmont 1:46ce1e16c870 113 /* To switch the character code set on FatFs API to Unicode,
emilmont 1:46ce1e16c870 114 / enable LFN feature and set _LFN_UNICODE to 1. */
emilmont 1:46ce1e16c870 115
emilmont 1:46ce1e16c870 116
emilmont 1:46ce1e16c870 117 #define _FS_RPATH 0 /* 0 to 2 */
emilmont 1:46ce1e16c870 118 /* The _FS_RPATH option configures relative path feature.
emilmont 1:46ce1e16c870 119 /
emilmont 1:46ce1e16c870 120 / 0: Disable relative path feature and remove related functions.
emilmont 1:46ce1e16c870 121 / 1: Enable relative path. f_chdrive() and f_chdir() are available.
emilmont 1:46ce1e16c870 122 / 2: f_getcwd() is available in addition to 1.
emilmont 1:46ce1e16c870 123 /
emilmont 1:46ce1e16c870 124 / Note that output of the f_readdir fnction is affected by this option. */
emilmont 1:46ce1e16c870 125
emilmont 1:46ce1e16c870 126
emilmont 1:46ce1e16c870 127
emilmont 1:46ce1e16c870 128 /*---------------------------------------------------------------------------/
emilmont 1:46ce1e16c870 129 / Physical Drive Configurations
emilmont 1:46ce1e16c870 130 /----------------------------------------------------------------------------*/
emilmont 1:46ce1e16c870 131
embeddedartists 5:e9018c2396af 132 #define _VOLUMES 3
emilmont 1:46ce1e16c870 133 /* Number of volumes (logical drives) to be used. */
emilmont 1:46ce1e16c870 134
emilmont 1:46ce1e16c870 135
emilmont 1:46ce1e16c870 136 #define _MAX_SS 512 /* 512, 1024, 2048 or 4096 */
emilmont 1:46ce1e16c870 137 /* Maximum sector size to be handled.
emilmont 1:46ce1e16c870 138 / Always set 512 for memory card and hard disk but a larger value may be
emilmont 1:46ce1e16c870 139 / required for on-board flash memory, floppy disk and optical disk.
emilmont 1:46ce1e16c870 140 / When _MAX_SS is larger than 512, it configures FatFs to variable sector size
emilmont 1:46ce1e16c870 141 / and GET_SECTOR_SIZE command must be implememted to the disk_ioctl function. */
emilmont 1:46ce1e16c870 142
emilmont 1:46ce1e16c870 143
emilmont 1:46ce1e16c870 144 #define _MULTI_PARTITION 0 /* 0:Single partition, 1/2:Enable multiple partition */
emilmont 1:46ce1e16c870 145 /* When set to 0, each volume is bound to the same physical drive number and
emilmont 1:46ce1e16c870 146 / it can mount only first primaly partition. When it is set to 1, each volume
emilmont 1:46ce1e16c870 147 / is tied to the partitions listed in VolToPart[]. */
emilmont 1:46ce1e16c870 148
emilmont 1:46ce1e16c870 149
emilmont 1:46ce1e16c870 150 #define _USE_ERASE 0 /* 0:Disable or 1:Enable */
emilmont 1:46ce1e16c870 151 /* To enable sector erase feature, set _USE_ERASE to 1. CTRL_ERASE_SECTOR command
emilmont 1:46ce1e16c870 152 / should be added to the disk_ioctl functio. */
emilmont 1:46ce1e16c870 153
emilmont 1:46ce1e16c870 154
emilmont 1:46ce1e16c870 155
emilmont 1:46ce1e16c870 156 /*---------------------------------------------------------------------------/
emilmont 1:46ce1e16c870 157 / System Configurations
emilmont 1:46ce1e16c870 158 /----------------------------------------------------------------------------*/
emilmont 1:46ce1e16c870 159
emilmont 1:46ce1e16c870 160 #define _WORD_ACCESS 0 /* 0 or 1 */
emilmont 1:46ce1e16c870 161 /* Set 0 first and it is always compatible with all platforms. The _WORD_ACCESS
emilmont 1:46ce1e16c870 162 / option defines which access method is used to the word data on the FAT volume.
emilmont 1:46ce1e16c870 163 /
emilmont 1:46ce1e16c870 164 / 0: Byte-by-byte access.
emilmont 1:46ce1e16c870 165 / 1: Word access. Do not choose this unless following condition is met.
emilmont 1:46ce1e16c870 166 /
emilmont 1:46ce1e16c870 167 / When the byte order on the memory is big-endian or address miss-aligned word
emilmont 1:46ce1e16c870 168 / access results incorrect behavior, the _WORD_ACCESS must be set to 0.
emilmont 1:46ce1e16c870 169 / If it is not the case, the value can also be set to 1 to improve the
emilmont 1:46ce1e16c870 170 / performance and code size.
emilmont 1:46ce1e16c870 171 */
emilmont 1:46ce1e16c870 172
emilmont 1:46ce1e16c870 173
emilmont 1:46ce1e16c870 174 /* A header file that defines sync object types on the O/S, such as
emilmont 1:46ce1e16c870 175 / windows.h, ucos_ii.h and semphr.h, must be included prior to ff.h. */
emilmont 1:46ce1e16c870 176
embeddedartists 6:4b97221ac12e 177 #define _FS_REENTRANT 1 /* 0:Disable or 1:Enable */
emilmont 1:46ce1e16c870 178 #define _FS_TIMEOUT 1000 /* Timeout period in unit of time ticks */
emilmont 1:46ce1e16c870 179 #define _SYNC_t HANDLE /* O/S dependent type of sync object. e.g. HANDLE, OS_EVENT*, ID and etc.. */
emilmont 1:46ce1e16c870 180
emilmont 1:46ce1e16c870 181 /* The _FS_REENTRANT option switches the reentrancy (thread safe) of the FatFs module.
emilmont 1:46ce1e16c870 182 /
emilmont 1:46ce1e16c870 183 / 0: Disable reentrancy. _SYNC_t and _FS_TIMEOUT have no effect.
emilmont 1:46ce1e16c870 184 / 1: Enable reentrancy. Also user provided synchronization handlers,
emilmont 1:46ce1e16c870 185 / ff_req_grant, ff_rel_grant, ff_del_syncobj and ff_cre_syncobj
emilmont 1:46ce1e16c870 186 / function must be added to the project. */
emilmont 1:46ce1e16c870 187
emilmont 1:46ce1e16c870 188
emilmont 1:46ce1e16c870 189 #define _FS_LOCK 0 /* 0:Disable or >=1:Enable */
emilmont 1:46ce1e16c870 190 /* To enable file lock control feature, set _FS_LOCK to 1 or greater.
emilmont 1:46ce1e16c870 191 The value defines how many files can be opened simultaneously. */
emilmont 1:46ce1e16c870 192
mbed_official 4:3ff2606d5713 193 #define FLUSH_ON_NEW_CLUSTER 0 /* Sync the file on every new cluster */
mbed_official 4:3ff2606d5713 194 #define FLUSH_ON_NEW_SECTOR 1 /* Sync the file on every new sector */
mbed_official 4:3ff2606d5713 195 /* Only one of these two defines needs to be set to 1. If both are set to 0
mbed_official 4:3ff2606d5713 196 the file is only sync when closed.
mbed_official 4:3ff2606d5713 197 Clusters are group of sectors (eg: 8 sectors). Flushing on new cluster means
mbed_official 4:3ff2606d5713 198 it would be less often than flushing on new sector. Sectors are generally
mbed_official 4:3ff2606d5713 199 512 Bytes long. */
emilmont 1:46ce1e16c870 200
emilmont 1:46ce1e16c870 201 #endif /* _FFCONFIG */