From 6133d51ef7355e29d65bed33f120c932f8086e7c Mon Sep 17 00:00:00 2001 From: Kumar Gala Date: Wed, 6 May 2020 23:41:47 -0500 Subject: [PATCH] storage: flash_map: Add macros to get FLASH_AREA info Add macros that we'll utilize instead of DT_FLASH_AREA_ Signed-off-by: Kumar Gala --- include/storage/flash_map.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/include/storage/flash_map.h b/include/storage/flash_map.h index 3898cc673f7..6449cb18cbf 100644 --- a/include/storage/flash_map.h +++ b/include/storage/flash_map.h @@ -209,6 +209,18 @@ int flash_area_has_driver(const struct flash_area *fa); */ struct device *flash_area_get_device(const struct flash_area *fa); +#define FLASH_AREA_LABEL_EXISTS(label) \ + DT_HAS_FIXED_PARTITION_LABEL(label) + +#define FLASH_AREA_ID(label) \ + DT_FIXED_PARTITION_ID(DT_NODE_BY_FIXED_PARTITION_LABEL(label)) + +#define FLASH_AREA_OFFSET(label) \ + DT_REG_ADDR(DT_NODE_BY_FIXED_PARTITION_LABEL(label)) + +#define FLASH_AREA_SIZE(label) \ + DT_REG_SIZE(DT_NODE_BY_FIXED_PARTITION_LABEL(label)) + #ifdef __cplusplus } #endif