From 07dc9cc53bd77875ac545a0fbf65d6eac135266c Mon Sep 17 00:00:00 2001 From: Benjamin Valentin Date: Fri, 4 Sep 2020 00:46:40 +0200 Subject: [PATCH] boards/msba2: add default MTD backend --- boards/msba2/Makefile.dep | 7 +++++++ boards/msba2/board_init.c | 7 +++++++ boards/msba2/include/board.h | 11 +++++++++++ 3 files changed, 25 insertions(+) diff --git a/boards/msba2/Makefile.dep b/boards/msba2/Makefile.dep index ad07c250df..7b08d62e5e 100644 --- a/boards/msba2/Makefile.dep +++ b/boards/msba2/Makefile.dep @@ -6,3 +6,10 @@ ifneq (,$(filter saul_default,$(USEMODULE))) USEMODULE += ltc4150 USEMODULE += sht11 endif + +# default to mtd_mci if no other MTD backend is selected +ifneq (,$(filter mtd,$(USEMODULE))) + ifeq (,$(filter mtd_%,$(USEMODULE))) + USEMODULE += mtd_mci + endif +endif diff --git a/boards/msba2/board_init.c b/boards/msba2/board_init.c index ee03815863..bffbfee3a4 100644 --- a/boards/msba2/board_init.c +++ b/boards/msba2/board_init.c @@ -26,9 +26,16 @@ #include "board.h" #include "cpu.h" +#include "mtd.h" #include "periph/init.h" #include "stdio_base.h" +#ifdef MODULE_MTD_MCI +extern const mtd_desc_t mtd_mci_driver; +static mtd_dev_t _mtd_mci = { .driver = &mtd_mci_driver }; +mtd_dev_t *mtd0 = &_mtd_mci; +#endif + void board_init(void) { /* LEDS */ diff --git a/boards/msba2/include/board.h b/boards/msba2/include/board.h index f23d98f98e..68a5353caa 100644 --- a/boards/msba2/include/board.h +++ b/boards/msba2/include/board.h @@ -20,6 +20,7 @@ #define BOARD_H #include "lpc23xx.h" +#include "mtd.h" #include "bitarithm.h" #ifdef __cplusplus @@ -45,6 +46,16 @@ extern "C" { #define LED1_TOGGLE (FIO3PIN ^= LED1_MASK) /** @} */ +/** + * @name MTD configuration + * @{ + */ +#ifdef MODULE_MTD_MCI +extern mtd_dev_t *mtd0; +#define MTD_0 mtd0 +#endif +/** @} */ + #ifdef __cplusplus } #endif