From 43d822ebabae24da931a74df4c396ee8dd3eb195 Mon Sep 17 00:00:00 2001 From: Dominik Ermel Date: Wed, 23 Nov 2022 11:16:29 +0000 Subject: [PATCH] fs/fatfs: Move FF_USE_LFN logic to Kconfig Commit add hidden Kconfig option CONFIG_FS_FATFS_FF_USE_LFN that is passed to ELM FAT to define FF_USE_LFN configuration. The FF_USE_LFN still depends, indirectly, on choice CONFIG_FS_FATFS_LFN_MODE config options CONFIG_FS_FATFS_LFN_MODE_BSS, FS_FATFS_LFN_MODE_STACK and FS_FATFS_LFN_MODE_HEAP, but the logic has been moved out of zephyr_fatfs_config.h into Kconfig file. Signed-off-by: Dominik Ermel --- modules/fatfs/zephyr_fatfs_config.h | 10 +++------- subsys/fs/Kconfig.fatfs | 9 +++++++++ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/modules/fatfs/zephyr_fatfs_config.h b/modules/fatfs/zephyr_fatfs_config.h index fb633d24851ce..222a8a74474fc 100644 --- a/modules/fatfs/zephyr_fatfs_config.h +++ b/modules/fatfs/zephyr_fatfs_config.h @@ -33,14 +33,10 @@ #define FF_CODE_PAGE 437 #endif /* defined(CONFIG_FS_FATFS_CODEPAGE) */ -#if defined(CONFIG_FS_FATFS_LFN) +#if defined(CONFIG_FS_FATFS_FF_USE_LFN) +#if CONFIG_FS_FATFS_FF_USE_LFN <= 3 #undef FF_USE_LFN -#if CONFIG_FS_FATFS_LFN_MODE_BSS -#define FF_USE_LFN 1 -#elif CONFIG_FS_FATFS_LFN_MODE_STACK -#define FF_USE_LFN 2 -#elif CONFIG_FS_FATFS_LFN_MODE_HEAP -#define FF_USE_LFN 3 +#define FF_USE_LFN CONFIG_FS_FATFS_FF_USE_LFN #else #error Invalid LFN buffer location #endif diff --git a/subsys/fs/Kconfig.fatfs b/subsys/fs/Kconfig.fatfs index 849882f47c72a..fbd11712bb75b 100644 --- a/subsys/fs/Kconfig.fatfs +++ b/subsys/fs/Kconfig.fatfs @@ -99,6 +99,15 @@ config FS_FATFS_LFN_MODE_HEAP 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 255