From 714b3e3384db56b8fdd20a565d409e6a15ac7fde Mon Sep 17 00:00:00 2001 From: Gunar Schorcht Date: Fri, 28 Apr 2023 10:43:28 +0200 Subject: [PATCH] drivers/mtd_default: add external declarations for mtd* The `mtd_default` module defines `MTD_NUMOF` if not existing based on the `MTD_*` defines which are usually set to the corresponding MTD device pointer variables `mtd*`. However, these MTD device pointer variables are not always made known by external variable declarations. An example are SD Card Interfaces which are defined via the `mtd_sdcard_default` module. As a consequence, an application that uses `mtd_default` has still to be modified. Therefore, `mtd_default` also declares up to 6 `mtd*` MTD device pointer variables. --- drivers/include/mtd_default.h | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/drivers/include/mtd_default.h b/drivers/include/mtd_default.h index e8190c2316..fff6376a2e 100644 --- a/drivers/include/mtd_default.h +++ b/drivers/include/mtd_default.h @@ -57,6 +57,31 @@ extern "C" { #endif /* !defined(MTD_NUMOF) && !DOXYGEN */ +#if !DOXYGEN + +/** + * @brief Declare `mtd*` according to the number of MTD devices + */ +#if MTD_NUMOF > 0 +extern mtd_dev_t *mtd0; +#endif +#if MTD_NUMOF > 1 +extern mtd_dev_t *mtd1; +#endif +#if MTD_NUMOF > 2 +extern mtd_dev_t *mtd2; +#endif +#if MTD_NUMOF > 3 +extern mtd_dev_t *mtd3; +#endif +#if MTD_NUMOF > 4 +extern mtd_dev_t *mtd4; +#endif +#if MTD_NUMOF > 5 +extern mtd_dev_t *mtd5; +#endif +#endif /* !DOXYGEN */ + #if defined(MODULE_MTD_SDCARD_DEFAULT) extern mtd_sdcard_t mtd_sdcard_dev0; #endif