Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
ffconf.h
00001 /*---------------------------------------------------------------------------/ 00002 / FatFs - Configuration file 00003 /---------------------------------------------------------------------------*/ 00004 00005 #define FFCONF_DEF 89352 /* Revision ID */ 00006 00007 #define FFS_DBG 0 00008 00009 /*---------------------------------------------------------------------------/ 00010 / Function Configurations 00011 /---------------------------------------------------------------------------*/ 00012 00013 #define FF_FS_READONLY 0 00014 /* This option switches read-only configuration. (0:Read/Write or 1:Read-only) 00015 / Read-only configuration removes writing API functions, f_write(), f_sync(), 00016 / f_unlink(), f_mkdir(), f_chmod(), f_rename(), f_truncate(), f_getfree() 00017 / and optional writing functions as well. */ 00018 00019 00020 #define FF_FS_MINIMIZE 0 00021 /* This option defines minimization level to remove some basic API functions. 00022 / 00023 / 0: Basic functions are fully enabled. 00024 / 1: f_stat(), f_getfree(), f_unlink(), f_mkdir(), f_truncate() and f_rename() 00025 / are removed. 00026 / 2: f_opendir(), f_readdir() and f_closedir() are removed in addition to 1. 00027 / 3: f_lseek() function is removed in addition to 2. */ 00028 00029 00030 #define FF_USE_STRFUNC 0 00031 /* This option switches string functions, f_gets(), f_putc(), f_puts() and f_printf(). 00032 / 00033 / 0: Disable string functions. 00034 / 1: Enable without LF-CRLF conversion. 00035 / 2: Enable with LF-CRLF conversion. */ 00036 00037 00038 #define FF_USE_FIND 0 00039 /* This option switches filtered directory read functions, f_findfirst() and 00040 / f_findnext(). (0:Disable, 1:Enable 2:Enable with matching altname[] too) */ 00041 00042 00043 #define FF_USE_MKFS 1 00044 /* This option switches f_mkfs() function. (0:Disable or 1:Enable) */ 00045 00046 00047 #define FF_USE_FASTSEEK 0 00048 /* This option switches fast seek function. (0:Disable or 1:Enable) */ 00049 00050 00051 #define FF_USE_EXPAND 0 00052 /* This option switches f_expand function. (0:Disable or 1:Enable) */ 00053 00054 00055 #define FF_USE_CHMOD 0 00056 /* This option switches attribute manipulation functions, f_chmod() and f_utime(). 00057 / (0:Disable or 1:Enable) Also FF_FS_READONLY needs to be 0 to enable this option. */ 00058 00059 00060 #define FF_USE_LABEL 0 00061 /* This option switches volume label functions, f_getlabel() and f_setlabel(). 00062 / (0:Disable or 1:Enable) */ 00063 00064 00065 #define FF_USE_FORWARD 0 00066 /* This option switches f_forward() function. (0:Disable or 1:Enable) */ 00067 00068 00069 /*---------------------------------------------------------------------------/ 00070 / Locale and Namespace Configurations 00071 /---------------------------------------------------------------------------*/ 00072 00073 #define FF_CODE_PAGE 437 00074 /* This option specifies the OEM code page to be used on the target system. 00075 / Incorrect code page setting can cause a file open failure. 00076 / 00077 / 437 - U.S. 00078 / 720 - Arabic 00079 / 737 - Greek 00080 / 771 - KBL 00081 / 775 - Baltic 00082 / 850 - Latin 1 00083 / 852 - Latin 2 00084 / 855 - Cyrillic 00085 / 857 - Turkish 00086 / 860 - Portuguese 00087 / 861 - Icelandic 00088 / 862 - Hebrew 00089 / 863 - Canadian French 00090 / 864 - Arabic 00091 / 865 - Nordic 00092 / 866 - Russian 00093 / 869 - Greek 2 00094 / 932 - Japanese (DBCS) 00095 / 936 - Simplified Chinese (DBCS) 00096 / 949 - Korean (DBCS) 00097 / 950 - Traditional Chinese (DBCS) 00098 / 0 - Include all code pages above and configured by f_setcp() 00099 */ 00100 00101 00102 #define FF_USE_LFN 3 00103 #define FF_MAX_LFN 255 00104 /* The FF_USE_LFN switches the support for LFN (long file name). 00105 / 00106 / 0: Disable LFN. FF_MAX_LFN has no effect. 00107 / 1: Enable LFN with static working buffer on the BSS. Always NOT thread-safe. 00108 / 2: Enable LFN with dynamic working buffer on the STACK. 00109 / 3: Enable LFN with dynamic working buffer on the HEAP. 00110 / 00111 / To enable the LFN, ffunicode.c needs to be added to the project. The LFN function 00112 / requiers certain internal working buffer occupies (FF_MAX_LFN + 1) * 2 bytes and 00113 / additional (FF_MAX_LFN + 44) / 15 * 32 bytes when exFAT is enabled. 00114 / The FF_MAX_LFN defines size of the working buffer in UTF-16 code unit and it can 00115 / be in range of 12 to 255. It is recommended to be set 255 to fully support LFN 00116 / specification. 00117 / When use stack for the working buffer, take care on stack overflow. When use heap 00118 / memory for the working buffer, memory management functions, ff_memalloc() and 00119 / ff_memfree() in ffsystem.c, need to be added to the project. */ 00120 00121 00122 #define FF_LFN_UNICODE 0 00123 /* This option switches the character encoding on the API when LFN is enabled. 00124 / 00125 / 0: ANSI/OEM in current CP (TCHAR = char) 00126 / 1: Unicode in UTF-16 (TCHAR = WCHAR) 00127 / 2: Unicode in UTF-8 (TCHAR = char) 00128 / 00129 / Also behavior of string I/O functions will be affected by this option. 00130 / When LFN is not enabled, this option has no effect. */ 00131 00132 00133 #define FF_LFN_BUF 255 00134 #define FF_SFN_BUF 12 00135 /* This set of options defines size of file name members in the FILINFO structure 00136 / which is used to read out directory items. These values should be suffcient for 00137 / the file names to read. The maximum possible length of the read file name depends 00138 / on character encoding. When LFN is not enabled, these options have no effect. */ 00139 00140 00141 #define FF_STRF_ENCODE 3 00142 /* When FF_LFN_UNICODE >= 1 with LFN enabled, string I/O functions, f_gets(), 00143 / f_putc(), f_puts and f_printf() convert the character encoding in it. 00144 / This option selects assumption of character encoding ON THE FILE to be 00145 / read/written via those functions. 00146 / 00147 / 0: ANSI/OEM in current CP 00148 / 1: Unicode in UTF-16LE 00149 / 2: Unicode in UTF-16BE 00150 / 3: Unicode in UTF-8 00151 */ 00152 00153 00154 #define FF_FS_RPATH 1 00155 /* This option configures support for relative path. 00156 / 00157 / 0: Disable relative path and remove related functions. 00158 / 1: Enable relative path. f_chdir() and f_chdrive() are available. 00159 / 2: f_getcwd() function is available in addition to 1. 00160 */ 00161 00162 00163 /*---------------------------------------------------------------------------/ 00164 / Drive/Volume Configurations 00165 /---------------------------------------------------------------------------*/ 00166 00167 #define FF_VOLUMES 4 00168 /* Number of volumes (logical drives) to be used. (1-10) */ 00169 00170 00171 #define FF_STR_VOLUME_ID 0 00172 #define FF_VOLUME_STRS "RAM","NAND","CF","SD","SD2","USB","USB2","USB3" 00173 /* FF_STR_VOLUME_ID switches string support for volume ID. 00174 / When FF_STR_VOLUME_ID is set to 1, also pre-defined strings can be used as drive 00175 / number in the path name. FF_VOLUME_STRS defines the drive ID strings for each 00176 / logical drives. Number of items must be equal to FF_VOLUMES. Valid characters for 00177 / the drive ID strings are: A-Z and 0-9. */ 00178 00179 00180 #define FF_MULTI_PARTITION 0 00181 /* This option switches support for multiple volumes on the physical drive. 00182 / By default (0), each logical drive number is bound to the same physical drive 00183 / number and only an FAT volume found on the physical drive will be mounted. 00184 / When this function is enabled (1), each logical drive number can be bound to 00185 / arbitrary physical drive and partition listed in the VolToPart[]. Also f_fdisk() 00186 / funciton will be available. */ 00187 00188 00189 #define FF_MIN_SS 512 00190 #define FF_MAX_SS 4096 00191 /* This set of options configures the range of sector size to be supported. (512, 00192 / 1024, 2048 or 4096) Always set both 512 for most systems, generic memory card and 00193 / harddisk. But a larger value may be required for on-board flash memory and some 00194 / type of optical media. When FF_MAX_SS is larger than FF_MIN_SS, FatFs is configured 00195 / for variable sector size mode and disk_ioctl() function needs to implement 00196 / GET_SECTOR_SIZE command. */ 00197 00198 00199 #define FF_USE_TRIM 1 00200 /* This option switches support for ATA-TRIM. (0:Disable or 1:Enable) 00201 / To enable Trim function, also CTRL_TRIM command should be implemented to the 00202 / disk_ioctl() function. */ 00203 00204 00205 #define FF_FS_NOFSINFO 0 00206 /* If you need to know correct free space on the FAT32 volume, set bit 0 of this 00207 / option, and f_getfree() function at first time after volume mount will force 00208 / a full FAT scan. Bit 1 controls the use of last allocated cluster number. 00209 / 00210 / bit0=0: Use free cluster count in the FSINFO if available. 00211 / bit0=1: Do not trust free cluster count in the FSINFO. 00212 / bit1=0: Use last allocated cluster number in the FSINFO if available. 00213 / bit1=1: Do not trust last allocated cluster number in the FSINFO. 00214 */ 00215 00216 00217 00218 /*---------------------------------------------------------------------------/ 00219 / System Configurations 00220 /---------------------------------------------------------------------------*/ 00221 00222 #define FF_FS_TINY 1 00223 /* This option switches tiny buffer configuration. (0:Normal or 1:Tiny) 00224 / At the tiny configuration, size of file object (FIL) is shrinked FF_MAX_SS bytes. 00225 / Instead of private sector buffer eliminated from the file object, common sector 00226 / buffer in the filesystem object (FATFS) is used for the file data transfer. */ 00227 00228 00229 #define FF_FS_EXFAT 0 00230 /* This option switches support for exFAT filesystem. (0:Disable or 1:Enable) 00231 / When enable exFAT, also LFN needs to be enabled. 00232 / Note that enabling exFAT discards ANSI C (C89) compatibility. */ 00233 00234 00235 #define FF_FS_HEAPBUF 1 00236 /* This option enables the use of the heap for allocating buffers. Otherwise 00237 / _MAX_SS sized buffers are allocated statically in relevant structures (in 00238 / FATFS if _FS_TINY, otherwise in FATFS and FIL) 00239 / This option allows the filesystem to dynamically allocate the buffers based 00240 / on underlying sector size. */ 00241 00242 00243 #define FF_FS_NORTC 0 00244 #define FF_NORTC_MON 1 00245 #define FF_NORTC_MDAY 1 00246 #define FF_NORTC_YEAR 2017 00247 /* The option FF_FS_NORTC switches timestamp functiton. If the system does not have 00248 / any RTC function or valid timestamp is not needed, set FF_FS_NORTC = 1 to disable 00249 / the timestamp function. All objects modified by FatFs will have a fixed timestamp 00250 / defined by FF_NORTC_MON, FF_NORTC_MDAY and FF_NORTC_YEAR in local time. 00251 / To enable timestamp function (FF_FS_NORTC = 0), get_fattime() function need to be 00252 / added to the project to read current time form real-time clock. FF_NORTC_MON, 00253 / FF_NORTC_MDAY and FF_NORTC_YEAR have no effect. 00254 / These options have no effect at read-only configuration (FF_FS_READONLY = 1). */ 00255 00256 00257 #define FF_FS_LOCK 0 00258 /* The option FF_FS_LOCK switches file lock function to control duplicated file open 00259 / and illegal operation to open objects. This option must be 0 when FF_FS_READONLY 00260 / is 1. 00261 / 00262 / 0: Disable file lock function. To avoid volume corruption, application program 00263 / should avoid illegal open, remove and rename to the open objects. 00264 / >0: Enable file lock function. The value defines how many files/sub-directories 00265 / can be opened simultaneously under file lock control. Note that the file 00266 / lock control is independent of re-entrancy. */ 00267 00268 00269 #define FF_FS_REENTRANT 0 00270 #define FF_FS_TIMEOUT 1000 00271 #define FF_SYNC_t HANDLE 00272 /* The option FF_FS_REENTRANT switches the re-entrancy (thread safe) of the FatFs 00273 / module itself. Note that regardless of this option, file access to different 00274 / volume is always re-entrant and volume control functions, f_mount(), f_mkfs() 00275 / and f_fdisk() function, are always not re-entrant. Only file/directory access 00276 / to the same volume is under control of this function. 00277 / 00278 / 0: Disable re-entrancy. FF_FS_TIMEOUT and FF_SYNC_t have no effect. 00279 / 1: Enable re-entrancy. Also user provided synchronization handlers, 00280 / ff_req_grant(), ff_rel_grant(), ff_del_syncobj() and ff_cre_syncobj() 00281 / function, must be added to the project. Samples are available in 00282 / option/syscall.c. 00283 / 00284 / The FF_FS_TIMEOUT defines timeout period in unit of time tick. 00285 / The FF_SYNC_t defines O/S dependent sync object type. e.g. HANDLE, ID, OS_EVENT*, 00286 / SemaphoreHandle_t and etc. A header file for O/S definitions needs to be 00287 / included somewhere in the scope of ff.h. */ 00288 00289 /* #include <windows.h> // O/S definitions */ 00290 00291 #define FLUSH_ON_NEW_CLUSTER 0 /* Sync the file on every new cluster */ 00292 #define FLUSH_ON_NEW_SECTOR 1 /* Sync the file on every new sector */ 00293 /* Only one of these two defines needs to be set to 1. If both are set to 0 00294 the file is only sync when closed. 00295 Clusters are group of sectors (eg: 8 sectors). Flushing on new cluster means 00296 it would be less often than flushing on new sector. Sectors are generally 00297 512 Bytes long. */ 00298 00299 00300 /*--- End of configuration options ---*/
Generated on Tue Jul 12 2022 12:21:51 by
