1# Copyright (c) 2016 Intel Corporation 2# Copyright (c) 2020 Nordic Semiconductor ASA 3# Copyright (c) 2023 Husqvarna AB 4# SPDX-License-Identifier: Apache-2.0 5 6config FAT_FILESYSTEM_ELM 7 bool "ELM FAT file system support" 8 depends on FILE_SYSTEM 9 select DISK_ACCESS 10 help 11 Use the ELM FAT File system implementation. 12 13if FAT_FILESYSTEM_ELM 14 15menu "ELM FAT file system settings" 16 visible if FAT_FILESYSTEM_ELM 17 18config FS_FATFS_READ_ONLY 19 bool "Read-only support for all volumes" 20 help 21 Excludes write code from ELM FAT file system driver. 22 Select this when using FAT for read-only access to slightly 23 reduce code size. 24 This option affects FF_FS_READONLY defined in ffconf.h, inside 25 ELM FAT module. 26 27config FS_FATFS_MKFS 28 bool "mkfs support for FAT FS" 29 depends on !FS_FATFS_READ_ONLY 30 default y if FILE_SYSTEM_MKFS 31 help 32 Adds code for creating disks with FAT file system. 33 This option affects FF_USE_MKFS defined in ffconf.h, inside 34 ELM FAT module. 35 36config FS_FATFS_MOUNT_MKFS 37 bool "Allow formatting volume when mounting fails" 38 default y 39 select FS_FATFS_MKFS 40 help 41 This option adds code that allows fs_mount to attempt to format 42 a volume if no file system is found. 43 If formatting is not needed, disabling this flag will slightly 44 reduce application size. 45 Note: This option is destructive to data and will automatically 46 destroy your disk, if mount attempt fails. In case when your 47 disk can be detached from a device and recovered using other 48 system, it may be worth disabling this option. 49 When this option is disabled, disk needs to be FAT formatted 50 prior to connecting to a device, otherwise it will not be 51 mountable. 52 53if FS_FATFS_MKFS 54 55config FS_FATFS_MAX_ROOT_ENTRIES 56 int "Max number of entries in FAT FS root directory" 57 default 512 58 range 1 32768 59 help 60 Sets how many root directory entries will be allocated when 61 formatting new FAT system to a device. 62 Note that this should be multiply of FS_FATFS_MAX_SS / 32. 63 64endif # FS_FATFS_MKFS 65 66config FS_FATFS_EXFAT 67 bool "ExFAT support" 68 select FS_FATFS_LFN 69 help 70 Enable the exFAT format support for FatFs. 71 72config FS_FATFS_NUM_FILES 73 int "Maximum number of opened files" 74 default 4 75 help 76 Affects how many file objects area available for parallel 77 use by FAT driver. Each object is of size sizeof(FIL), where 78 FIL is defined in ff.h of ELM FAT driver, and is pre-allocated 79 at compile-time. 80 This affects use of fs_open on FAT type mounted file systems. 81 82config FS_FATFS_NUM_DIRS 83 int "Maximum number of opened directories" 84 default 4 85 help 86 Affects how many directory objects area available for parallel 87 use by FAT driver. Each object is of size sizeof(DIR), where 88 DIR is defined in ff.h of ELM FAT driver, and is pre-allocated 89 at compile-time. 90 This affects use of fs_opendir on FAT type mounted file systems. 91 92config FS_FATFS_HAS_RTC 93 bool "Timestamping support" 94 help 95 Enable file system timestamping instead of using a hardcoded date 96 for all operations. Requires an application supplied implementation 97 of `get_fattime`. Format of the uint32_t bits are as follows: 98 31:25 = Year from 1980 99 24:21 = Month (1..12) 100 20:16 = Day of month (1..31) 101 15:11 = Hour (0..23) 102 10: 5 = Minute (0..59) 103 4: 0 = Seconds/2 (0..29) 104 105config FS_FATFS_EXTRA_NATIVE_API 106 bool "Additional native API functions" 107 help 108 Enable the following additional native API functions that do not have 109 an equivalent in the Zephyr VFS API: 110 * `f_getlabel` 111 * `f_setlabel` 112 * `f_expand` 113 * `f_findfirst` 114 * `f_findnext` 115 116config FS_FATFS_LFN 117 bool "Long filenames (LFN)" 118 help 119 Without long filenames enabled, file names are limited to 8.3 format. 120 This option increases working buffer size. 121 122if FS_FATFS_LFN 123 124choice FS_FATFS_LFN_MODE 125 prompt "LFN memory mode" 126 default FS_FATFS_LFN_MODE_BSS 127 128config FS_FATFS_LFN_MODE_BSS 129 bool "Static buffer" 130 help 131 Enable LFN with static working buffer on the BSS. Always NOT thread-safe. 132 This option affects FF_USE_LFN defined in ffconf.h, inside 133 ELM FAT module, by setting its value to 1. 134 135config FS_FATFS_LFN_MODE_STACK 136 bool "Stack buffer" 137 help 138 Enable LFN with dynamic working buffer on the STACK. 139 This option affects FF_USE_LFN defined in ffconf.h, inside 140 ELM FAT module, by setting its value to 2. 141 142config FS_FATFS_LFN_MODE_HEAP 143 bool "Heap buffer" 144 depends on HEAP_MEM_POOL_SIZE > 0 145 help 146 Enable LFN with dynamic working buffer on the HEAP. 147 This option affects FF_USE_LFN defined in ffconf.h, inside 148 ELM FAT module, by setting its value to 3. 149 150endchoice 151 152config FS_FATFS_FF_USE_LFN 153 int 154 default 1 if FS_FATFS_LFN_MODE_BSS 155 default 2 if FS_FATFS_LFN_MODE_STACK 156 default 3 if FS_FATFS_LFN_MODE_HEAP 157 help 158 Translates FS_FATFS_LFN_MODE selection to FF_USE_LFN, defined in ffconf.h, 159 inside ELM FAT module. 160 161config FS_FATFS_MAX_LFN 162 int "Max filename length" 163 range 12 $(UINT8_MAX) 164 default $(UINT8_MAX) 165 help 166 The working buffer occupies (FS_FATFS_MAX_LFN + 1) * 2 bytes and 167 additional 608 bytes at exFAT enabled. 168 It should be set 255 to support full featured LFN operations. 169 170endif # FS_FATFS_LFN 171 172config FS_FATFS_CODEPAGE 173 int "FatFS code page (character set)" 174 default 437 175 help 176 Valid code page values: 177 437 - U.S. 178 720 - Arabic 179 737 - Greek 180 771 - KBL 181 775 - Baltic 182 850 - Latin 1 183 852 - Latin 2 184 855 - Cyrillic 185 857 - Turkish 186 860 - Portuguese 187 861 - Icelandic 188 862 - Hebrew 189 863 - Canadian French 190 864 - Arabic 191 865 - Nordic 192 866 - Russian 193 869 - Greek 2 194 932 - Japanese (DBCS) 195 936 - Simplified Chinese (DBCS) 196 949 - Korean (DBCS) 197 950 - Traditional Chinese (DBCS) 198 0 - Include all supported code pages 199 This option affects FF_CODE_PAGE defined in ffconf.h, inside 200 ELM FAT module. 201 202config FS_FATFS_MAX_SS 203 int "Maximum supported sector size" 204 range 512 4096 205 default 512 206 help 207 Value set here will be used as maximum supported read/write 208 sector size, with 512 being minimum value. 209 Option affects write/read granularity and will increase 210 size of buffers used by FAT driver, which in practice affects 211 how much RAM each FATFS object, used with FAT mount point, 212 requires, which is this value plus some constant amount, 213 independent from this setting. 214 This will affect your compile time RAM allocation, when 215 mount point is defined as static/global life time variable, 216 or stack. 217 When this value is set to 512, all mount points will use 218 512 as sector size, all other values will cause FAT driver 219 to query device for sector size on mount. 220 This option affects FF_MAX_SS defined in ffconf.h, inside 221 ELM FAT module. 222 223config FS_FATFS_MIN_SS 224 int "Minimum expected sector size" 225 range 512 FS_FATFS_MAX_SS 226 default 512 227 help 228 Specifies minimum sector size the FAT FS driver is expected to 229 support. Set this to FS_FATFS_MAX_FS when you have single 230 device with FAT FS or all connected devices use the same 231 sector size, to have slight reduction in code in FAT FS driver. 232 The reduction comes from the fact that FAT FS does not have to 233 query every connected device for sector size. 234 This option affects FF_MIN_SS defined in ffconf.h, inside 235 ELM FAT module. 236 237config FS_FATFS_WINDOW_ALIGNMENT 238 int "Memory alignment for the member \"win\" in FATFS" 239 default 1 240 help 241 Specifies alignment, in bytes of FAT FS window buffer that is 242 used for device's read/write operations. MMC controllers may 243 require read/write buffer to start at memory address with 244 specific alignment, for example 16 or 512 bytes, the value 245 provided here is used as such alignment. Note that the window 246 buffer is internal element of FATFS structure, which means 247 that, in worst scenario, value provided here may cause FATFS 248 structure to have size of twice the value. 249 250config FS_FATFS_REENTRANT 251 bool "FatFs reentrant" 252 depends on !FS_FATFS_LFN_MODE_BSS 253 help 254 Enable the FatFs re-entrancy (thread safe) option for file/directory 255 access for each volume. Will create a zephyr mutex object for each 256 FatFs volume and a FatFs system mutex. 257 258config FS_FATFS_LBA64 259 bool "Support for 64-bit LBA" 260 depends on FS_FATFS_EXFAT 261 help 262 This option enables support for 64-bit LBA, which also 263 enables GPT support. 264 265config FS_FATFS_MULTI_PARTITION 266 bool "Support for multiple volumes on the physical drive" 267 help 268 When this function is enabled, each logical drive number can 269 be bound to arbitrary physical drive and partition listed 270 in the VolToPart[] of the fatfs module. The VolToPart[] is expected to be 271 provided by Zephyr application. 272 The mount points have to be numbered in this case. 273 For example, 2 FAT partition on SD disk (3) in terms of Zephyr: 274 {3, 1} - mount point "/0:" 275 {3, 2} - mount point "/1:" 276 When disabled (default), each logical drive number is bound to the same 277 physical drive number and only an FAT volume found on the physical drive 278 will be mounted. 279 280endmenu 281 282endif # FAT_FILESYSTEM_ELM 283