mtd_default.h
1 /*
2  * Copyright (C) 2023 ML!PA Consulting GmbH
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser
5  * General Public License v2.1. See the file LICENSE in the top level
6  * directory for more details.
7  */
17 #ifndef MTD_DEFAULT_H
18 #define MTD_DEFAULT_H
19 
20 #include "board.h"
21 #include "modules.h"
22 #include "mtd.h"
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
28 #if defined(MODULE_MTD_SDCARD_DEFAULT)
29 #include "mtd_sdcard.h"
30 #endif
31 
32 #if defined(MODULE_MTD_EMULATED)
33 #include "mtd_emulated.h"
34 #endif
35 
36 #if defined(MODULE_MTD_SDCARD_DEFAULT)
37 extern mtd_sdcard_t mtd_sdcard_dev0;
38 #endif
39 
40 #if defined(MODULE_MTD_EMULATED)
41 extern mtd_emulated_t mtd_emulated_dev0;
42 #endif
43 
54 static inline mtd_dev_t *mtd_default_get_dev(unsigned idx)
55 {
56  return ((MTD_NUMOF != 0) && (idx < MTD_NUMOF)) ? mtd_dev_xfa[idx] : NULL;
57 }
58 
59 #ifdef __cplusplus
60 }
61 #endif
62 
63 #endif /* MTD_DEFAULT_H */
mtd_dev_t *const mtd_dev_xfa[]
MTD device array as XFA.
Definition: mtd.h:139
static mtd_dev_t * mtd_default_get_dev(unsigned idx)
Default MTD device configuration.
Definition: mtd_default.h:54
#define MTD_NUMOF
Number of MTDs defined in the MTD device array in XFA.
Definition: mtd.h:172
Common macros and compiler attributes/pragmas configuration.
Interface definition for the mtd_sdcard driver.
MTD device descriptor.
Definition: mtd.h:112
Device descriptor for a MTD device that is emulated in RAM.
Definition: mtd_emulated.h:91
Device descriptor for mtd_sdcard device.
Definition: mtd_sdcard.h:40