# Copyright (c) 2016 Intel Corporation # Copyright (c) 2020 Nordic Semiconductor ASA # Copyright (c) 2023 Husqvarna AB # SPDX-License-Identifier: Apache-2.0 config FAT_FILESYSTEM_ELM bool "ELM FAT file system support" depends on FILE_SYSTEM select DISK_ACCESS help Use the ELM FAT File system implementation. if FAT_FILESYSTEM_ELM menu "ELM FAT file system settings" visible if FAT_FILESYSTEM_ELM config FS_FATFS_READ_ONLY bool "Read-only support for all volumes" help Excludes write code from ELM FAT file system driver. Select this when using FAT for read-only access to slightly reduce code size. This option affects FF_FS_READONLY defined in ffconf.h, inside ELM FAT module. config FS_FATFS_MKFS bool "mkfs support for FAT FS" depends on !FS_FATFS_READ_ONLY default y if FILE_SYSTEM_MKFS help Adds code for creating disks with FAT file system. This option affects FF_USE_MKFS defined in ffconf.h, inside ELM FAT module. config FS_FATFS_MOUNT_MKFS bool "Allow formatting volume when mounting fails" default y select FS_FATFS_MKFS help This option adds code that allows fs_mount to attempt to format a volume if no file system is found. If formatting is not needed, disabling this flag will slightly reduce application size. Note: This option is destructive to data and will automatically destroy your disk, if mount attempt fails. In case when your disk can be detached from a device and recovered using other system, it may be worth disabling this option. When this option is disabled, disk needs to be FAT formatted prior to connecting to a device, otherwise it will not be mountable. if FS_FATFS_MKFS config FS_FATFS_MAX_ROOT_ENTRIES int "Max number of entries in FAT FS root directory" default 512 range 1 32768 help Sets how many root directory entries will be allocated when formatting new FAT system to a device. Note that this should be multiply of FS_FATFS_MAX_SS / 32. endif # FS_FATFS_MKFS config FS_FATFS_EXFAT bool "ExFAT support" select FS_FATFS_LFN help Enable the exFAT format support for FatFs. config FS_FATFS_NUM_FILES int "Maximum number of opened files" default 4 help Affects how many file objects area available for parallel use by FAT driver. Each object is of size sizeof(FIL), where FIL is defined in ff.h of ELM FAT driver, and is pre-allocated at compile-time. This affects use of fs_open on FAT type mounted file systems. config FS_FATFS_NUM_DIRS int "Maximum number of opened directories" default 4 help Affects how many directory objects area available for parallel use by FAT driver. Each object is of size sizeof(DIR), where DIR is defined in ff.h of ELM FAT driver, and is pre-allocated at compile-time. This affects use of fs_opendir on FAT type mounted file systems. config FS_FATFS_HAS_RTC bool "Timestamping support" help Enable file system timestamping instead of using a hardcoded date for all operations. Requires an application supplied implementation of `get_fattime`. Format of the uint32_t bits are as follows: 31:25 = Year from 1980 24:21 = Month (1..12) 20:16 = Day of month (1..31) 15:11 = Hour (0..23) 10: 5 = Minute (0..59) 4: 0 = Seconds/2 (0..29) config FS_FATFS_EXTRA_NATIVE_API bool "Additional native API functions" help Enable the following additional native API functions that do not have an equivalent in the Zephyr VFS API: * `f_getlabel` * `f_setlabel` * `f_expand` * `f_findfirst` * `f_findnext` config FS_FATFS_LFN bool "Long filenames (LFN)" help Without long filenames enabled, file names are limited to 8.3 format. This option increases working buffer size. if FS_FATFS_LFN choice FS_FATFS_LFN_MODE prompt "LFN memory mode" default FS_FATFS_LFN_MODE_BSS config FS_FATFS_LFN_MODE_BSS bool "Static buffer" help Enable LFN with static working buffer on the BSS. Always NOT thread-safe. This option affects FF_USE_LFN defined in ffconf.h, inside ELM FAT module, by setting its value to 1. config FS_FATFS_LFN_MODE_STACK bool "Stack buffer" help Enable LFN with dynamic working buffer on the STACK. This option affects FF_USE_LFN defined in ffconf.h, inside ELM FAT module, by setting its value to 2. config FS_FATFS_LFN_MODE_HEAP bool "Heap buffer" depends on HEAP_MEM_POOL_SIZE > 0 help Enable LFN with dynamic working buffer on the HEAP. This option affects FF_USE_LFN defined in ffconf.h, inside ELM FAT module, by setting its value to 3. endchoice config FS_FATFS_FF_USE_LFN int default 1 if FS_FATFS_LFN_MODE_BSS default 2 if FS_FATFS_LFN_MODE_STACK default 3 if FS_FATFS_LFN_MODE_HEAP help Translates FS_FATFS_LFN_MODE selection to FF_USE_LFN, defined in ffconf.h, inside ELM FAT module. config FS_FATFS_MAX_LFN int "Max filename length" range 12 $(UINT8_MAX) default $(UINT8_MAX) help The working buffer occupies (FS_FATFS_MAX_LFN + 1) * 2 bytes and additional 608 bytes at exFAT enabled. It should be set 255 to support full featured LFN operations. endif # FS_FATFS_LFN config FS_FATFS_CODEPAGE int "FatFS code page (character set)" default 437 help Valid code page values: 437 - U.S. 720 - Arabic 737 - Greek 771 - KBL 775 - Baltic 850 - Latin 1 852 - Latin 2 855 - Cyrillic 857 - Turkish 860 - Portuguese 861 - Icelandic 862 - Hebrew 863 - Canadian French 864 - Arabic 865 - Nordic 866 - Russian 869 - Greek 2 932 - Japanese (DBCS) 936 - Simplified Chinese (DBCS) 949 - Korean (DBCS) 950 - Traditional Chinese (DBCS) 0 - Include all supported code pages This option affects FF_CODE_PAGE defined in ffconf.h, inside ELM FAT module. config FS_FATFS_MAX_SS int "Maximum supported sector size" range 512 4096 default 512 help Value set here will be used as maximum supported read/write sector size, with 512 being minimum value. Option affects write/read granularity and will increase size of buffers used by FAT driver, which in practice affects how much RAM each FATFS object, used with FAT mount point, requires, which is this value plus some constant amount, independent from this setting. This will affect your compile time RAM allocation, when mount point is defined as static/global life time variable, or stack. When this value is set to 512, all mount points will use 512 as sector size, all other values will cause FAT driver to query device for sector size on mount. This option affects FF_MAX_SS defined in ffconf.h, inside ELM FAT module. config FS_FATFS_MIN_SS int "Minimum expected sector size" range 512 FS_FATFS_MAX_SS default 512 help Specifies minimum sector size the FAT FS driver is expected to support. Set this to FS_FATFS_MAX_FS when you have single device with FAT FS or all connected devices use the same sector size, to have slight reduction in code in FAT FS driver. The reduction comes from the fact that FAT FS does not have to query every connected device for sector size. This option affects FF_MIN_SS defined in ffconf.h, inside ELM FAT module. config FS_FATFS_WINDOW_ALIGNMENT int "Memory alignment for the member \"win\" in FATFS" default 1 help Specifies alignment, in bytes of FAT FS window buffer that is used for device's read/write operations. MMC controllers may require read/write buffer to start at memory address with specific alignment, for example 16 or 512 bytes, the value provided here is used as such alignment. Note that the window buffer is internal element of FATFS structure, which means that, in worst scenario, value provided here may cause FATFS structure to have size of twice the value. config FS_FATFS_REENTRANT bool "FatFs reentrant" depends on !FS_FATFS_LFN_MODE_BSS help Enable the FatFs re-entrancy (thread safe) option for file/directory access for each volume. Will create a zephyr mutex object for each FatFs volume and a FatFs system mutex. config FS_FATFS_LBA64 bool "Support for 64-bit LBA" depends on FS_FATFS_EXFAT help This option enables support for 64-bit LBA, which also enables GPT support. config FS_FATFS_MULTI_PARTITION bool "Support for multiple volumes on the physical drive" help When this function is enabled, each logical drive number can be bound to arbitrary physical drive and partition listed in the VolToPart[] of the fatfs module. The VolToPart[] is expected to be provided by Zephyr application. The mount points have to be numbered in this case. For example, 2 FAT partition on SD disk (3) in terms of Zephyr: {3, 1} - mount point "/0:" {3, 2} - mount point "/1:" When disabled (default), each logical drive number is bound to the same physical drive number and only an FAT volume found on the physical drive will be mounted. endmenu endif # FAT_FILESYSTEM_ELM