Skip to content

Commit a1d6f80

Browse files
JordanYatesnashif
authored andcommitted
fs: fatfs: additional ELM FAT options
Make additional ELM FAT library options configurable to the user. Signed-off-by: Jordan Yates <[email protected]>
1 parent 4235dbf commit a1d6f80

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

modules/fatfs/zephyr_fatfs_config.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,11 @@
8989
#define FF_FS_TINY 1
9090

9191
#undef FF_FS_NORTC
92+
#if defined(CONFIG_FS_FATFS_HAS_RTC)
93+
#define FF_FS_NORTC 0
94+
#else
9295
#define FF_FS_NORTC 1
96+
#endif /* defined(CONFIG_FS_FATFS_HAS_RTC) */
9397

9498
/* Zephyr uses FF_VOLUME_STRS */
9599
#undef FF_STR_VOLUME_ID
@@ -104,6 +108,15 @@
104108
#undef FF_VOLUMES
105109
#define FF_VOLUMES 8
106110

111+
#if defined(CONFIG_FS_FATFS_EXTRA_NATIVE_API)
112+
#undef FF_USE_LABEL
113+
#undef FF_USE_EXPAND
114+
#undef FF_USE_FIND
115+
#define FF_USE_LABEL 1
116+
#define FF_USE_EXPAND 1
117+
#define FF_USE_FIND 1
118+
#endif /* defined(CONFIG_FS_FATFS_EXTRA_NATIVE_API) */
119+
107120
/*
108121
* Options provided below have been added to ELM FAT source code to
109122
* support Zephyr specific features, and are not part of ffconf.h.

subsys/fs/Kconfig.fatfs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,30 @@ config FS_FATFS_NUM_DIRS
8989
at compile-time.
9090
This affects use of fs_opendir on FAT type mounted file systems.
9191

92+
config 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+
105+
config 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+
92116
config FS_FATFS_LFN
93117
bool "Long filenames (LFN)"
94118
help

0 commit comments

Comments
 (0)