native/include/board.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2013 Ludwig Knüpfer <ludwig.knuepfer@fu-berlin.de>
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  */
8 
24 #ifndef BOARD_H
25 #define BOARD_H
26 
27 #include <stdint.h>
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
33 #ifdef MODULE_MTD
34 #include "mtd_native.h"
35 #endif
36 
41 void _native_LED_GREEN_OFF(void);
42 void _native_LED_GREEN_ON(void);
43 void _native_LED_GREEN_TOGGLE(void);
44 void _native_LED_RED_OFF(void);
45 void _native_LED_RED_ON(void);
46 void _native_LED_RED_TOGGLE(void);
47 
48 #define LED0_ON (_native_LED_RED_ON())
49 #define LED0_OFF (_native_LED_RED_OFF())
50 #define LED0_TOGGLE (_native_LED_RED_TOGGLE())
51 #define LED1_ON (_native_LED_GREEN_ON())
52 #define LED1_OFF (_native_LED_GREEN_OFF())
53 #define LED1_TOGGLE (_native_LED_GREEN_TOGGLE())
54 
56 #if defined(MODULE_MTD) || DOXYGEN
57 
61 #ifndef MTD_PAGE_SIZE
62 #define MTD_PAGE_SIZE (256)
63 #endif
64 #ifndef MTD_SECTOR_SIZE
65 #define MTD_SECTOR_SIZE (4096)
66 #endif
67 #ifndef MTD_SECTOR_NUM
68 #define MTD_SECTOR_NUM (2048)
69 #endif
70 #ifndef MTD_NATIVE_FILENAME
71 #define MTD_NATIVE_FILENAME "MEMORY.bin"
72 #endif
73 
76 #define MTD_0 mtd0
77 
79 extern mtd_dev_t *mtd0;
80 #endif
81 
82 #if defined(MODULE_SPIFFS) || DOXYGEN
83 
87 /* SPIFFS config flags */
88 #ifndef SPIFFS_READ_ONLY
89 #define SPIFFS_READ_ONLY (0)
90 #endif
91 #ifndef SPIFFS_SINGLETON
92 #define SPIFFS_SINGLETON (0)
93 #endif
94 #ifndef SPIFFS_HAL_CALLBACK_EXTRA
95 #define SPIFFS_HAL_CALLBACK_EXTRA (1)
96 #endif
97 #ifndef SPIFFS_CACHE
98 #define SPIFFS_CACHE (1)
99 #endif
100 
101 #if SPIFFS_SINGLETON == 1
102 /* MTD config if singleton is used */
103 #ifndef SPIFFS_CFG_PHYS_SZ
104 #define SPIFFS_CFG_PHYS_SZ(ignore) (MTD_SECTOR_SIZE * MTD_SECTOR_NUM)
105 #endif
106 #ifndef SPIFFS_CFG_PHYS_ERASE_SZ
107 #define SPIFFS_CFG_PHYS_ERASE_SZ(ignore) (MTD_SECTOR_SIZE)
108 #endif
109 #ifndef SPIFFS_CFG_PHYS_ADDR
110 #define SPIFFS_CFG_PHYS_ADDR(ignore) (0)
111 #endif
112 #ifndef SPIFFS_CFG_LOG_PAGE_SZ
113 #define SPIFFS_CFG_LOG_PAGE_SZ(ignore) (MTD_PAGE_SIZE)
114 #endif
115 #ifndef SPIFFS_CFG_LOG_BLOCK_SZ
116 #define SPIFFS_CFG_LOG_BLOCK_SZ(ignore) (MTD_SECTOR_SIZE)
117 #endif
118 #endif
119 
120 #if SPIFFS_HAL_CALLBACK_EXTRA == 0
121 /* Default MTD device if no callback parameter */
122 #ifndef SPIFFS_MTD_DEV
123 #define SPIFFS_MTD_DEV (MTD_0)
124 #endif
125 #endif
126 
127 #endif
128 
129 #ifdef __cplusplus
130 }
131 #endif
132 
134 #endif /* BOARD_H */
mtd_dev_t * mtd0
mtd flash emulation device
MTD device descriptor.
Definition: mtd.h:58