From 26030e28af801012c92e96f87d86b1346b5474d8 Mon Sep 17 00:00:00 2001 From: Gunar Schorcht Date: Thu, 23 Nov 2023 17:46:10 +0100 Subject: [PATCH] boards: remove `extern mtd_dev_t*` Declarations --- .../include/board.h | 9 +++------ boards/adafruit-itsybitsy-m4/include/board.h | 4 +--- boards/adafruit-pybadge/include/board.h | 4 +--- boards/common/esp32x/include/board_common.h | 12 ++---------- boards/common/esp8266/include/board_common.h | 6 +----- boards/common/weact-f4x1cx/include/board.h | 4 +--- boards/ikea-tradfri/include/board.h | 5 +---- boards/iotlab-m3/include/board.h | 4 +--- boards/mcb2388/include/board.h | 4 +--- boards/msba2/include/board.h | 4 +--- boards/mulle/include/board.h | 4 +--- boards/native/include/board.h | 11 ++--------- boards/nrf52840dk/include/board.h | 6 +----- boards/nrf5340dk-app/include/board.h | 4 +--- boards/pinetime/include/board.h | 4 +--- boards/qn9080dk/include/board.h | 4 +--- boards/remote-revb/include/board.h | 6 +----- boards/same54-xpro/include/board.h | 10 ++++------ boards/samr34-xpro/include/board.h | 4 +--- boards/seeedstudio-gd32/include/board.h | 4 +--- boards/sensebox_samd21/include/board.h | 6 ++---- boards/serpente/include/board.h | 4 +--- boards/sipeed-longan-nano/include/board.h | 4 +--- boards/teensy31/include/board.h | 1 - boards/waspmote-pro/include/board.h | 6 +----- boards/waveshare-nrf52840-eval-kit/include/board.h | 4 +--- 26 files changed, 33 insertions(+), 105 deletions(-) diff --git a/boards/adafruit-grand-central-m4-express/include/board.h b/boards/adafruit-grand-central-m4-express/include/board.h index c803d56763..811c9d7947 100644 --- a/boards/adafruit-grand-central-m4-express/include/board.h +++ b/boards/adafruit-grand-central-m4-express/include/board.h @@ -20,7 +20,6 @@ #define BOARD_H #include "cpu.h" -#include "mtd.h" #ifdef __cplusplus extern "C" { @@ -66,12 +65,10 @@ extern "C" { * @name MTD configuration * @{ */ -extern mtd_dev_t *mtd0; /**< Flash MTD device pointer */ -#define MTD_0 mtd0 /**< Flash MTD device */ -extern mtd_dev_t *mtd1; /**< MTD device pointer for SD Card */ -#define MTD_1 mtd1 /**< MTD device for SD Card */ +#define MTD_0 mtd_dev_get(0) /**< MTD device for the 8 MByte QSPI Flash */ +#define MTD_1 mtd_dev_get(1) /**< MTD device for the SD Card */ -#define CONFIG_SDCARD_GENERIC_MTD_OFFSET 1 /**< mtd1 is used for SD Card */ +#define CONFIG_SDCARD_GENERIC_MTD_OFFSET 1 /**< MTD_1 is used for SD Card */ /** @} */ /** diff --git a/boards/adafruit-itsybitsy-m4/include/board.h b/boards/adafruit-itsybitsy-m4/include/board.h index 57aca8bbb2..f0023cd4ab 100644 --- a/boards/adafruit-itsybitsy-m4/include/board.h +++ b/boards/adafruit-itsybitsy-m4/include/board.h @@ -20,7 +20,6 @@ #define BOARD_H #include "cpu.h" -#include "mtd.h" #ifdef __cplusplus extern "C" { @@ -53,8 +52,7 @@ extern "C" { * @name MTD configuration * @{ */ -extern mtd_dev_t *mtd0; -#define MTD_0 mtd0 +#define MTD_0 mtd_dev_get(0) /** @} */ /** diff --git a/boards/adafruit-pybadge/include/board.h b/boards/adafruit-pybadge/include/board.h index 11f7703210..7fc807b575 100644 --- a/boards/adafruit-pybadge/include/board.h +++ b/boards/adafruit-pybadge/include/board.h @@ -20,7 +20,6 @@ #define BOARD_H #include "cpu.h" -#include "mtd.h" #include "periph/gpio.h" #ifdef __cplusplus @@ -101,8 +100,7 @@ extern "C" { * @name MTD configuration * @{ */ -extern mtd_dev_t *mtd0; /**< pointer to mtd0 */ -#define MTD_0 mtd0 /**< mtd0 constant */ +#define MTD_0 mtd_dev_get(0) /**< MTD_0 constant */ /** @} */ /** diff --git a/boards/common/esp32x/include/board_common.h b/boards/common/esp32x/include/board_common.h index 684f13a663..30b98def2c 100644 --- a/boards/common/esp32x/include/board_common.h +++ b/boards/common/esp32x/include/board_common.h @@ -34,10 +34,6 @@ #include "periph/gpio.h" #include "sdkconfig.h" -#if MODULE_MTD -#include "mtd.h" -#endif - #ifdef __cplusplus extern "C" { #endif @@ -103,14 +99,10 @@ extern "C" { #define SPI_FLASH_DRIVE_START 0 #endif -#define MTD_0 mtd0 /**< Flash MTD device */ -extern mtd_dev_t *mtd0; /**< Flash MTD device pointer */ +#define MTD_0 mtd_dev_get(0) /**< MTD device for the internal Flash */ #if MODULE_MTD_SDCARD_DEFAULT || DOXYGEN - -#define MTD_1 mtd1 /**< SD Card MTD device */ -extern mtd_dev_t *mtd1; /**< SD Card MTD device pointer */ - +#define MTD_1 mtd_dev_get(1) /**< MTD device for the SD Card */ #endif /* MODULE_MTD_SDCARD_DEFAULT || DOXYGEN */ /** diff --git a/boards/common/esp8266/include/board_common.h b/boards/common/esp8266/include/board_common.h index 84392a82f8..35855066d3 100644 --- a/boards/common/esp8266/include/board_common.h +++ b/boards/common/esp8266/include/board_common.h @@ -87,13 +87,9 @@ extern "C" { * a system MTD device has to be defined. * @{ */ -#include "mtd.h" /** Default MTD device definition */ -#define MTD_0 mtd0 - -/** Pointer to the default MTD device structure */ -extern mtd_dev_t *mtd0; +#define MTD_0 mtd_dev_get(0) /** * @brief MTD offset for SD Card interfaces diff --git a/boards/common/weact-f4x1cx/include/board.h b/boards/common/weact-f4x1cx/include/board.h index 5f249a120e..eeb4b8a109 100644 --- a/boards/common/weact-f4x1cx/include/board.h +++ b/boards/common/weact-f4x1cx/include/board.h @@ -25,7 +25,6 @@ extern "C" { #endif -#include "mtd.h" #include "periph_cpu.h" /** @@ -73,8 +72,7 @@ extern "C" { * @name MTD configuration * @{ */ -extern mtd_dev_t *mtd0; -#define MTD_0 mtd0 +#define MTD_0 mtd_dev_get(0) /** @} */ #ifdef __cplusplus diff --git a/boards/ikea-tradfri/include/board.h b/boards/ikea-tradfri/include/board.h index 66497ace12..9707c502b7 100644 --- a/boards/ikea-tradfri/include/board.h +++ b/boards/ikea-tradfri/include/board.h @@ -25,8 +25,6 @@ #include "periph/gpio.h" #include "periph/spi.h" -#include "mtd.h" - #ifdef __cplusplus extern "C" { #endif @@ -100,8 +98,7 @@ extern "C" { * @name MTD configuration */ /** @{ */ -extern mtd_dev_t *mtd0; -#define MTD_0 mtd0 +#define MTD_0 mtd_dev_get(0) /** @} */ #ifdef __cplusplus diff --git a/boards/iotlab-m3/include/board.h b/boards/iotlab-m3/include/board.h index 48bda93577..c9b8f019ea 100644 --- a/boards/iotlab-m3/include/board.h +++ b/boards/iotlab-m3/include/board.h @@ -27,7 +27,6 @@ #include "cpu.h" #include "periph_conf.h" #include "board_common.h" -#include "mtd.h" #ifdef __cplusplus extern "C" { @@ -70,8 +69,7 @@ extern "C" { * @name MTD configuration * @{ */ -extern mtd_dev_t *mtd0; /**< SPI NOR Flash device */ -#define MTD_0 mtd0 /**< Indicate presence of MTD device */ +#define MTD_0 mtd_dev_get(0) /**< SPI NOR Flash device */ /** @} */ #ifdef __cplusplus diff --git a/boards/mcb2388/include/board.h b/boards/mcb2388/include/board.h index 40735cd30b..5fa08c79a6 100644 --- a/boards/mcb2388/include/board.h +++ b/boards/mcb2388/include/board.h @@ -20,7 +20,6 @@ #define BOARD_H #include "lpc23xx.h" -#include "mtd.h" #ifdef __cplusplus extern "C" { @@ -110,8 +109,7 @@ extern "C" { * @{ */ #ifdef MODULE_MTD_MCI -extern mtd_dev_t *mtd0; -#define MTD_0 mtd0 +#define MTD_0 mtd_dev_get(0) #endif /** @} */ diff --git a/boards/msba2/include/board.h b/boards/msba2/include/board.h index 68a5353caa..a839853b8e 100644 --- a/boards/msba2/include/board.h +++ b/boards/msba2/include/board.h @@ -20,7 +20,6 @@ #define BOARD_H #include "lpc23xx.h" -#include "mtd.h" #include "bitarithm.h" #ifdef __cplusplus @@ -51,8 +50,7 @@ extern "C" { * @{ */ #ifdef MODULE_MTD_MCI -extern mtd_dev_t *mtd0; -#define MTD_0 mtd0 +#define MTD_0 mtd_dev_get(0) #endif /** @} */ diff --git a/boards/mulle/include/board.h b/boards/mulle/include/board.h index 4eb673c50d..d890a25ac9 100644 --- a/boards/mulle/include/board.h +++ b/boards/mulle/include/board.h @@ -22,7 +22,6 @@ #include "cpu.h" #include "periph_conf.h" #include "mulle-nvram.h" -#include "mtd.h" /* Use the on board RTC 32kHz clock for LPTMR clocking. */ #undef LPTIMER_CLKSRC @@ -150,8 +149,7 @@ extern "C" { * @name MTD configuration */ /** @{ */ -extern mtd_dev_t *mtd0; -#define MTD_0 mtd0 +#define MTD_0 mtd_dev_get(0) /** @} */ /** diff --git a/boards/native/include/board.h b/boards/native/include/board.h index 6179b75944..426d18c9f0 100644 --- a/boards/native/include/board.h +++ b/boards/native/include/board.h @@ -31,10 +31,6 @@ extern "C" { #endif -#ifdef MODULE_MTD -#include "mtd_native.h" -#endif - /** * @name LED handlers * @{ @@ -90,11 +86,8 @@ void _native_LED_RED_TOGGLE(void); #endif /** @} */ -/** Default MTD device */ -#define MTD_0 mtd0 - -/** mtd flash emulation device */ -extern mtd_dev_t *mtd0; +/** Default MTD device (mtd flash emulation device) */ +#define MTD_0 mtd_dev_get(0) #endif /** diff --git a/boards/nrf52840dk/include/board.h b/boards/nrf52840dk/include/board.h index 0874aff0ab..0cff00bcd5 100644 --- a/boards/nrf52840dk/include/board.h +++ b/boards/nrf52840dk/include/board.h @@ -21,7 +21,6 @@ #define BOARD_H #include "board_common.h" -#include "mtd.h" #ifdef __cplusplus extern "C" { @@ -77,10 +76,7 @@ extern "C" { /** @} */ /** Default MTD device */ -#define MTD_0 mtd0 - -/** mtd flash emulation device */ -extern mtd_dev_t *mtd0; +#define MTD_0 mtd_dev_get(0) /** * @name Button pin configuration diff --git a/boards/nrf5340dk-app/include/board.h b/boards/nrf5340dk-app/include/board.h index 2d29603c1a..d77640825a 100644 --- a/boards/nrf5340dk-app/include/board.h +++ b/boards/nrf5340dk-app/include/board.h @@ -20,7 +20,6 @@ #define BOARD_H #include "cpu.h" -#include "mtd.h" #ifdef __cplusplus extern "C" { @@ -100,8 +99,7 @@ extern "C" { * @name MTD configuration * @{ */ -extern mtd_dev_t *mtd0; -#define MTD_0 mtd0 +#define MTD_0 mtd_dev_get(0) #define BOARD_QSPI_PIN_CS GPIO_PIN(0, 18) /**< SPI Flash Chip Select */ #define BOARD_QSPI_PIN_WP GPIO_PIN(0, 15) /**< SPI Flash Write Protect */ diff --git a/boards/pinetime/include/board.h b/boards/pinetime/include/board.h index d8fc93b319..1be876807f 100644 --- a/boards/pinetime/include/board.h +++ b/boards/pinetime/include/board.h @@ -23,7 +23,6 @@ #include "cpu.h" #include "board_common.h" -#include "mtd.h" #ifdef __cplusplus extern "C" { @@ -97,8 +96,7 @@ extern "C" { * @name MTD configuration * @{ */ -extern mtd_dev_t *mtd0; -#define MTD_0 mtd0 +#define MTD_0 mtd_dev_get(0) /** @} */ /** diff --git a/boards/qn9080dk/include/board.h b/boards/qn9080dk/include/board.h index 35ca62604a..f41f273230 100644 --- a/boards/qn9080dk/include/board.h +++ b/boards/qn9080dk/include/board.h @@ -20,7 +20,6 @@ #define BOARD_H #include "cpu.h" -#include "mtd.h" #include "periph_conf.h" #include "periph_cpu.h" @@ -63,8 +62,7 @@ extern "C" { * @name MTD configuration * @{ */ -extern mtd_dev_t *mtd0; -#define MTD_0 mtd0 +#define MTD_0 mtd_dev_get(0) /** @} */ #ifdef __cplusplus diff --git a/boards/remote-revb/include/board.h b/boards/remote-revb/include/board.h index d89dfc9ce4..604b62baa9 100644 --- a/boards/remote-revb/include/board.h +++ b/boards/remote-revb/include/board.h @@ -23,7 +23,6 @@ #define BOARD_H #include "cpu.h" -#include "mtd.h" #include "board_common.h" #ifdef __cplusplus @@ -124,10 +123,7 @@ /** @} */ /** Default MTD device */ -#define MTD_0 mtd0 - -/** mtd flash emulation device */ -extern mtd_dev_t *mtd0; +#define MTD_0 mtd_dev_get(0) #ifdef __cplusplus } /* end extern "C" */ diff --git a/boards/same54-xpro/include/board.h b/boards/same54-xpro/include/board.h index 38cfb5b554..e6c548fb34 100644 --- a/boards/same54-xpro/include/board.h +++ b/boards/same54-xpro/include/board.h @@ -21,7 +21,6 @@ #define BOARD_H #include "cpu.h" -#include "mtd.h" #ifdef __cplusplus extern "C" { @@ -71,12 +70,11 @@ extern "C" { * @name MTD configuration * @{ */ -extern mtd_dev_t *mtd0, *mtd1, *mtd2; -#define MTD_0 mtd0 -#define MTD_1 mtd1 -#define MTD_2 mtd2 +#define MTD_0 mtd_dev_get(0) /**< MTD device for the QSPI Flash */ +#define MTD_1 mtd_dev_get(1) /**< MTD device for the AT24MAC402 serial EEPROM */ +#define MTD_2 mtd_dev_get(2) /**< MTD device for the SD/MMC Card */ -#define CONFIG_SDMMC_GENERIC_MTD_OFFSET 2 /**< mtd2 is used for SD Card */ +#define CONFIG_SDMMC_GENERIC_MTD_OFFSET 2 /**< MTD_2 is used for the SD Card */ /** @} */ /** diff --git a/boards/samr34-xpro/include/board.h b/boards/samr34-xpro/include/board.h index 81d9302a23..7b2dc4b807 100644 --- a/boards/samr34-xpro/include/board.h +++ b/boards/samr34-xpro/include/board.h @@ -21,7 +21,6 @@ #define BOARD_H #include "cpu.h" -#include "mtd.h" #ifdef __cplusplus extern "C" { @@ -80,8 +79,7 @@ extern "C" { * @name MTD configuration * @{ */ -extern mtd_dev_t *mtd0; /**< First memory type device */ -#define MTD_0 mtd0 /**< First memory type device */ +#define MTD_0 mtd_dev_get(0) /**< First memory type device */ /** @} */ #ifdef __cplusplus diff --git a/boards/seeedstudio-gd32/include/board.h b/boards/seeedstudio-gd32/include/board.h index d41e2d1467..361363f428 100644 --- a/boards/seeedstudio-gd32/include/board.h +++ b/boards/seeedstudio-gd32/include/board.h @@ -22,7 +22,6 @@ #define BOARD_H #include "board_common.h" -#include "mtd.h" #ifdef __cplusplus extern "C" { @@ -72,8 +71,7 @@ extern "C" { * @name MTD configuration * @{ */ -#define MTD_0 mtd0 /**< MTD device for SD Card */ -extern mtd_dev_t *mtd0; /**< MTD device pointer for SD Card */ +#define MTD_0 mtd_dev_get(0) /**< MTD device for the SD Card */ /** @} */ /** diff --git a/boards/sensebox_samd21/include/board.h b/boards/sensebox_samd21/include/board.h index ec875cc9ff..9d41f1fee3 100644 --- a/boards/sensebox_samd21/include/board.h +++ b/boards/sensebox_samd21/include/board.h @@ -25,7 +25,6 @@ #include "cpu.h" #include "periph_conf.h" #include "periph_cpu.h" -#include "mtd.h" #ifdef __cplusplus extern "C" { @@ -164,11 +163,10 @@ extern "C" { #if defined(MODULE_MTD_SDCARD) || defined(DOXYGEN) /** - * @brief MTD device 0 (SD Card) definition. mtd0 is defined in board.c + * @brief MTD device 0 (SD Card) definition. mtd_dev_get(0) is defined in board.c * @{ */ -extern mtd_dev_t *mtd0; -#define MTD_0 mtd0 +#define MTD_0 mtd_dev_get(0) /** @} */ #endif /* MODULE_MTD_SDCARD || DOXYGEN */ diff --git a/boards/serpente/include/board.h b/boards/serpente/include/board.h index 233c2497da..e615a8bc75 100644 --- a/boards/serpente/include/board.h +++ b/boards/serpente/include/board.h @@ -23,7 +23,6 @@ #include "cpu.h" #include "periph_conf.h" -#include "mtd.h" #ifdef __cplusplus extern "C" { @@ -78,8 +77,7 @@ extern "C" { * @name MTD configuration * @{ */ -extern mtd_dev_t *mtd0; -#define MTD_0 mtd0 +#define MTD_0 mtd_dev_get(0) /** @} */ /** diff --git a/boards/sipeed-longan-nano/include/board.h b/boards/sipeed-longan-nano/include/board.h index a22c4554c9..a4b1baa2ec 100644 --- a/boards/sipeed-longan-nano/include/board.h +++ b/boards/sipeed-longan-nano/include/board.h @@ -21,7 +21,6 @@ #define BOARD_H #include "board_common.h" -#include "mtd.h" #ifdef __cplusplus extern "C" { @@ -67,8 +66,7 @@ extern "C" { * @name MTD configuration * @{ */ -#define MTD_0 mtd0 /**< MTD device for SD Card */ -extern mtd_dev_t *mtd0; /**< MTD device pointer for SD Card */ +#define MTD_0 mtd_dev_get(0) /**< MTD device for the SD Card */ /** @} */ /** diff --git a/boards/teensy31/include/board.h b/boards/teensy31/include/board.h index 2d211e7609..293a1822d6 100644 --- a/boards/teensy31/include/board.h +++ b/boards/teensy31/include/board.h @@ -21,7 +21,6 @@ #include "cpu.h" #include "periph_conf.h" -#include "mtd.h" #ifdef __cplusplus extern "C" { diff --git a/boards/waspmote-pro/include/board.h b/boards/waspmote-pro/include/board.h index d144093393..f69be5e932 100644 --- a/boards/waspmote-pro/include/board.h +++ b/boards/waspmote-pro/include/board.h @@ -21,7 +21,6 @@ #define BOARD_H #include "cpu.h" -#include "mtd.h" #include "waspmote_pinmap.h" #ifdef __cplusplus @@ -197,10 +196,7 @@ extern "C" { /** @} */ /** Default MTD device */ -#define MTD_0 mtd0 - -/** mtd flash emulation device */ -extern mtd_dev_t *mtd0; +#define MTD_0 mtd_dev_get(0) #ifdef __cplusplus } diff --git a/boards/waveshare-nrf52840-eval-kit/include/board.h b/boards/waveshare-nrf52840-eval-kit/include/board.h index 8f55b3aa95..210d758a04 100644 --- a/boards/waveshare-nrf52840-eval-kit/include/board.h +++ b/boards/waveshare-nrf52840-eval-kit/include/board.h @@ -20,7 +20,6 @@ #define BOARD_H #include "board_common.h" -#include "mtd.h" #ifdef __cplusplus extern "C" { @@ -87,8 +86,7 @@ extern "C" { * @name MTD configuration * @{ */ -#define MTD_0 mtd0 /**< MTD device for SD Card */ -extern mtd_dev_t *mtd0; /**< MTD device pointer for SD Card */ +#define MTD_0 mtd_dev_get(0) /**< MTD device for the SD Card */ /** @} */ #ifdef __cplusplus