fs/fatfs: Add CONFIG_FS_FATFS_MIN_SS

The Kconfig option allows to set minimum expected sector size
to be supported by FAT fs driver.
When this value differs from CONFIG_FS_FATFS_MAX_SS the driver
will query device for actual sector size, expecting different
sector sizes for different device. When CONFIG_FS_FATFS_MIN_SS
and CONFIG_FS_FATFS_MAX_SS are the same, then there is slight
reduction if FAT driver size, as the query logic is removed
and CONFIG_FS_FATFS_MAX_SS is used for all devices.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
This commit is contained in:
Dominik Ermel 2022-11-24 13:15:10 +00:00 committed by Carles Cufí
parent 43d1d9133b
commit 043cea12e5
2 changed files with 19 additions and 0 deletions

View File

@ -51,6 +51,11 @@
#define FF_MAX_LFN CONFIG_FS_FATFS_MAX_LFN
#endif /* defined(CONFIG_FS_FATFS_MAX_LFN) */
#if defined(CONFIG_FS_FATFS_MIN_SS)
#undef FF_MIN_SS
#define FF_MIN_SS CONFIG_FS_FATFS_MIN_SS
#endif /* defined(CONFIG_FS_FATFS_MIN_SS) */
#if defined(CONFIG_FS_FATFS_MAX_SS)
#undef FF_MAX_SS
#define FF_MAX_SS CONFIG_FS_FATFS_MAX_SS

View File

@ -142,6 +142,20 @@ config FS_FATFS_MAX_SS
range 512 4096
default 512
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_MAX_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