modules: fatfs: volume strings from DTS
Instead of relying on a hardcoded list of valid strings, automatically create a perfectly sized array of disk names from devicetree. Signed-off-by: Jordan Yates <jordan@embeint.com>
This commit is contained in:
parent
0b5021aec8
commit
befb464d6e
1 changed files with 15 additions and 5 deletions
|
@ -8,6 +8,8 @@
|
||||||
#error "Configuration version mismatch"
|
#error "Configuration version mismatch"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <zephyr/devicetree.h>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Overrides of FF_ options from ffconf.h
|
* Overrides of FF_ options from ffconf.h
|
||||||
*/
|
*/
|
||||||
|
@ -100,13 +102,21 @@
|
||||||
#define FF_STR_VOLUME_ID 1
|
#define FF_STR_VOLUME_ID 1
|
||||||
|
|
||||||
/* By default FF_STR_VOLUME_ID in ffconf.h is 0, which means that
|
/* By default FF_STR_VOLUME_ID in ffconf.h is 0, which means that
|
||||||
* FF_VOLUME_STRS is not used. Zephyr uses FF_VOLUME_STRS, which
|
* FF_VOLUME_STRS is not used. Zephyr uses FF_VOLUME_STRS.
|
||||||
* by default holds 8 possible strings representing mount points,
|
* The array of volume strings is automatically generated from devicetree.
|
||||||
* and FF_VOLUMES needs to reflect that, which means that dolt
|
|
||||||
* value of 1 is overridden here with 8.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#define _FF_DISK_NAME(node) DT_PROP(node, disk_name),
|
||||||
|
|
||||||
|
#undef FF_VOLUME_STRS
|
||||||
|
#define FF_VOLUME_STRS \
|
||||||
|
DT_FOREACH_STATUS_OKAY(zephyr_flash_disk, _FF_DISK_NAME) \
|
||||||
|
DT_FOREACH_STATUS_OKAY(zephyr_ram_disk, _FF_DISK_NAME) \
|
||||||
|
DT_FOREACH_STATUS_OKAY(zephyr_sdmmc_disk, _FF_DISK_NAME) \
|
||||||
|
DT_FOREACH_STATUS_OKAY(st_stm32_sdmmc, _FF_DISK_NAME)
|
||||||
|
|
||||||
#undef FF_VOLUMES
|
#undef FF_VOLUMES
|
||||||
#define FF_VOLUMES 8
|
#define FF_VOLUMES NUM_VA_ARGS_LESS_1(FF_VOLUME_STRS _)
|
||||||
|
|
||||||
#if defined(CONFIG_FS_FATFS_EXTRA_NATIVE_API)
|
#if defined(CONFIG_FS_FATFS_EXTRA_NATIVE_API)
|
||||||
#undef FF_USE_LABEL
|
#undef FF_USE_LABEL
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue