diff options
Diffstat (limited to 'lib/chibios/os/hal/boards')
468 files changed, 178833 insertions, 0 deletions
diff --git a/lib/chibios/os/hal/boards/ADICUP360/board.c b/lib/chibios/os/hal/boards/ADICUP360/board.c new file mode 100644 index 000000000..4b2fbb6df --- /dev/null +++ b/lib/chibios/os/hal/boards/ADICUP360/board.c | |||
@@ -0,0 +1,154 @@ | |||
1 | /* | ||
2 | ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio | ||
3 | |||
4 | Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | you may not use this file except in compliance with the License. | ||
6 | You may obtain a copy of the License at | ||
7 | |||
8 | http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | |||
10 | Unless required by applicable law or agreed to in writing, software | ||
11 | distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | See the License for the specific language governing permissions and | ||
14 | limitations under the License. | ||
15 | */ | ||
16 | |||
17 | /* | ||
18 | * This file has been automatically generated using ChibiStudio board | ||
19 | * generator plugin. Do not edit manually. | ||
20 | */ | ||
21 | |||
22 | #include "hal.h" | ||
23 | #include "aducm_gp.h" | ||
24 | |||
25 | /*===========================================================================*/ | ||
26 | /* Driver local definitions. */ | ||
27 | /*===========================================================================*/ | ||
28 | |||
29 | /*===========================================================================*/ | ||
30 | /* Driver exported variables. */ | ||
31 | /*===========================================================================*/ | ||
32 | |||
33 | /*===========================================================================*/ | ||
34 | /* Driver local variables and types. */ | ||
35 | /*===========================================================================*/ | ||
36 | |||
37 | /** | ||
38 | * @brief Type of ADUCM36x GP port setup. | ||
39 | */ | ||
40 | typedef struct { | ||
41 | uint32_t con; | ||
42 | uint32_t oen; | ||
43 | uint32_t pul; | ||
44 | uint32_t oce; | ||
45 | } gp_setup_t; | ||
46 | |||
47 | /** | ||
48 | * @brief Type of ADUCM36x GPIO initialization data. | ||
49 | */ | ||
50 | typedef struct { | ||
51 | gp_setup_t GP0Data; | ||
52 | gp_setup_t GP1Data; | ||
53 | gp_setup_t GP2Data; | ||
54 | } gp_config_t; | ||
55 | |||
56 | /** | ||
57 | * @brief STM32 GPIO static initialization data. | ||
58 | */ | ||
59 | static const gp_config_t gp_default_config = { | ||
60 | {VAL_GP0CON, VAL_GP0OEN, VAL_GP0PUL, VAL_GP0OCE}, | ||
61 | {VAL_GP1CON, VAL_GP1OEN, VAL_GP1PUL, VAL_GP1OCE}, | ||
62 | {VAL_GP2CON, VAL_GP2OEN, VAL_GP2PUL, VAL_GP2OCE} | ||
63 | }; | ||
64 | |||
65 | /*===========================================================================*/ | ||
66 | /* Driver local functions. */ | ||
67 | /*===========================================================================*/ | ||
68 | |||
69 | static void gp_init(aducm_gp_t *gpp, const gp_setup_t *config) { | ||
70 | |||
71 | gpp->CON = config->con; | ||
72 | gpp->OEN = config->oen; | ||
73 | gpp->PUL = config->pul; | ||
74 | gpp->OCE = config->oce; | ||
75 | } | ||
76 | |||
77 | static void aducm_gpio_init(void) { | ||
78 | |||
79 | /* Initializing all the defined GP ports.*/ | ||
80 | gp_init(GP0, &gp_default_config.GP0Data); | ||
81 | gp_init(GP1, &gp_default_config.GP1Data); | ||
82 | gp_init(GP2, &gp_default_config.GP2Data); | ||
83 | } | ||
84 | |||
85 | /*===========================================================================*/ | ||
86 | /* Driver interrupt handlers. */ | ||
87 | /*===========================================================================*/ | ||
88 | |||
89 | /*===========================================================================*/ | ||
90 | /* Driver exported functions. */ | ||
91 | /*===========================================================================*/ | ||
92 | |||
93 | /** | ||
94 | * @brief Early initialization code. | ||
95 | * @details GP ports and system clocks are initialized before everything | ||
96 | * else. | ||
97 | */ | ||
98 | void __early_init(void) { | ||
99 | |||
100 | aducm_gpio_init(); | ||
101 | aducm_clock_init(); | ||
102 | } | ||
103 | |||
104 | #if HAL_USE_SDC || defined(__DOXYGEN__) | ||
105 | /** | ||
106 | * @brief SDC card detection. | ||
107 | */ | ||
108 | bool sdc_lld_is_card_inserted(SDCDriver *sdcp) { | ||
109 | |||
110 | (void)sdcp; | ||
111 | /* CHTODO: Fill the implementation.*/ | ||
112 | return true; | ||
113 | } | ||
114 | |||
115 | /** | ||
116 | * @brief SDC card write protection detection. | ||
117 | */ | ||
118 | bool sdc_lld_is_write_protected(SDCDriver *sdcp) { | ||
119 | |||
120 | (void)sdcp; | ||
121 | /* CHTODO: Fill the implementation.*/ | ||
122 | return false; | ||
123 | } | ||
124 | #endif /* HAL_USE_SDC */ | ||
125 | |||
126 | #if HAL_USE_MMC_SPI || defined(__DOXYGEN__) | ||
127 | /** | ||
128 | * @brief MMC_SPI card detection. | ||
129 | */ | ||
130 | bool mmc_lld_is_card_inserted(MMCDriver *mmcp) { | ||
131 | |||
132 | (void)mmcp; | ||
133 | /* CHTODO: Fill the implementation.*/ | ||
134 | return true; | ||
135 | } | ||
136 | |||
137 | /** | ||
138 | * @brief MMC_SPI card write protection detection. | ||
139 | */ | ||
140 | bool mmc_lld_is_write_protected(MMCDriver *mmcp) { | ||
141 | |||
142 | (void)mmcp; | ||
143 | /* CHTODO: Fill the implementation.*/ | ||
144 | return false; | ||
145 | } | ||
146 | #endif | ||
147 | |||
148 | /** | ||
149 | * @brief Board-specific initialization code. | ||
150 | * @note You can add your board-specific code here. | ||
151 | */ | ||
152 | void boardInit(void) { | ||
153 | |||
154 | } | ||
diff --git a/lib/chibios/os/hal/boards/ADICUP360/board.h b/lib/chibios/os/hal/boards/ADICUP360/board.h new file mode 100644 index 000000000..d0a685e37 --- /dev/null +++ b/lib/chibios/os/hal/boards/ADICUP360/board.h | |||
@@ -0,0 +1,271 @@ | |||
1 | /* | ||
2 | ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio | ||
3 | |||
4 | Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | you may not use this file except in compliance with the License. | ||
6 | You may obtain a copy of the License at | ||
7 | |||
8 | http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | |||
10 | Unless required by applicable law or agreed to in writing, software | ||
11 | distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | See the License for the specific language governing permissions and | ||
14 | limitations under the License. | ||
15 | */ | ||
16 | |||
17 | /* | ||
18 | * This file has been automatically generated using ChibiStudio board | ||
19 | * generator plugin. Do not edit manually. | ||
20 | */ | ||
21 | |||
22 | #ifndef BOARD_H | ||
23 | #define BOARD_H | ||
24 | |||
25 | /*===========================================================================*/ | ||
26 | /* Driver constants. */ | ||
27 | /*===========================================================================*/ | ||
28 | |||
29 | /* | ||
30 | * Setup for Analog Devices ADICUP360 board. | ||
31 | */ | ||
32 | |||
33 | /* | ||
34 | * Board identifier. | ||
35 | */ | ||
36 | #define BOARD_ADICUP360 | ||
37 | #define BOARD_NAME "Analog Devices ADICUP360" | ||
38 | |||
39 | /* | ||
40 | * Board oscillators-related settings. | ||
41 | */ | ||
42 | #if !defined(ADUCM_LFXTAL) | ||
43 | #define ADUCM_LFXTAL 32768U | ||
44 | #endif | ||
45 | |||
46 | /* | ||
47 | * MCU type as defined in the ADI header. | ||
48 | */ | ||
49 | #define ADUCM360 | ||
50 | |||
51 | /* | ||
52 | * IO pins assignments. | ||
53 | */ | ||
54 | #define GP0_0 0U | ||
55 | #define GP0_1 1U | ||
56 | #define GP0_2 2U | ||
57 | #define GP0_3 3U | ||
58 | #define GP0_LED_BLUE 4U | ||
59 | #define GP0_LED_GREEN 5U | ||
60 | #define GP0_6 6U | ||
61 | #define GP0_7 7U | ||
62 | #define GP0_NPOR 7U | ||
63 | |||
64 | #define GP1_0 0U | ||
65 | #define GP1_1 1U | ||
66 | #define GP1_2 2U | ||
67 | #define GP1_3 3U | ||
68 | #define GP1_4 4U | ||
69 | #define GP1_5 5U | ||
70 | #define GP1_6 6U | ||
71 | #define GP1_7 7U | ||
72 | |||
73 | #define GP2_0 0U | ||
74 | #define GP2_1 1U | ||
75 | #define GP2_BUTTON 2U | ||
76 | #define GP2_SWCLK 3U | ||
77 | #define GP2_SWD 4U | ||
78 | #define GP2_5 5U | ||
79 | #define GP2_6 6U | ||
80 | #define GP2_7 7U | ||
81 | |||
82 | |||
83 | /* | ||
84 | * IO lines assignments. | ||
85 | */ | ||
86 | #define LINE_LED_BLUE PAL_LINE(GP0, 4U) | ||
87 | #define LINE_LED_GREEN PAL_LINE(GP0, 5U) | ||
88 | #define LINE_NPOR PAL_LINE(GP0, 7U) | ||
89 | #define LINE_BUTTON PAL_LINE(GP2, 2U) | ||
90 | #define LINE_SWCLK PAL_LINE(GP2, 3U) | ||
91 | #define LINE_SWD PAL_LINE(GP2, 4U) | ||
92 | |||
93 | /*===========================================================================*/ | ||
94 | /* Driver pre-compile time settings. */ | ||
95 | /*===========================================================================*/ | ||
96 | |||
97 | /*===========================================================================*/ | ||
98 | /* Derived constants and error checks. */ | ||
99 | /*===========================================================================*/ | ||
100 | |||
101 | /*===========================================================================*/ | ||
102 | /* Driver data structures and types. */ | ||
103 | /*===========================================================================*/ | ||
104 | |||
105 | /*===========================================================================*/ | ||
106 | /* Driver macros. */ | ||
107 | /*===========================================================================*/ | ||
108 | |||
109 | /* | ||
110 | * I/O ports initial setup, this configuration is established soon after reset | ||
111 | * in the initialization code. | ||
112 | * Please refer to the ADUCM360 Reference Manual for details. | ||
113 | */ | ||
114 | #define PIN_CON_CON(n, v) ((v) << (n * 2U)) | ||
115 | #define PIN_OEN_INPUT(n) (0U << (n)) | ||
116 | #define PIN_OEN_OUTPUT(n) (1U << (n)) | ||
117 | #define PIN_PUL_FLOATING(n) (0U << (n)) | ||
118 | #define PIN_PUL_PULLUP(n) (1U << (n)) | ||
119 | #define PIN_OCE_NORMAL(n) (0U << (n)) | ||
120 | #define PIN_OCE_HIGHZ(n) (1U << (n)) | ||
121 | |||
122 | /* | ||
123 | * P0 setup: | ||
124 | * | ||
125 | * P0.0 - PIN0 (CON0, GPIO - input pullup). | ||
126 | * P0.1 - PIN1 (CON0, GPIO - input pullup). | ||
127 | * P0.2 - PIN2 (CON0, GPIO - input pullup). | ||
128 | * P0.3 - PIN3 (CON0, GPIO - input pullup). | ||
129 | * P0.4 - LED_BLUE (CON0, GPIO - output floating). | ||
130 | * P0.5 - LED_GREEN (CON0, GPIO - output floating). | ||
131 | * P0.6 - PIN6 (CON0, GPIO - input pullup). | ||
132 | * P0.7 - NPOR (CON0, NPOR). | ||
133 | */ | ||
134 | #define VAL_GP0CON (PIN_CON_CON(GP0_0, 0) | \ | ||
135 | PIN_CON_CON(GP0_1, 0) | \ | ||
136 | PIN_CON_CON(GP0_2, 0) | \ | ||
137 | PIN_CON_CON(GP0_3, 0) | \ | ||
138 | PIN_CON_CON(GP0_LED_BLUE, 0) | \ | ||
139 | PIN_CON_CON(GP0_LED_GREEN, 0) | \ | ||
140 | PIN_CON_CON(GP0_6, 0) | \ | ||
141 | PIN_CON_CON(GP0_NPOR, 0)) | ||
142 | #define VAL_GP0OEN (PIN_OEN_INPUT(GP0_0) | \ | ||
143 | PIN_OEN_INPUT(GP0_1) | \ | ||
144 | PIN_OEN_INPUT(GP0_2) | \ | ||
145 | PIN_OEN_INPUT(GP0_3) | \ | ||
146 | PIN_OEN_OUTPUT(GP0_LED_BLUE) | \ | ||
147 | PIN_OEN_OUTPUT(GP0_LED_GREEN) | \ | ||
148 | PIN_OEN_INPUT(GP0_6) | \ | ||
149 | PIN_OEN_INPUT(GP0_NPOR)) | ||
150 | #define VAL_GP0PUL (PIN_PUL_PULLUP(GP0_0) | \ | ||
151 | PIN_PUL_PULLUP(GP0_1) | \ | ||
152 | PIN_PUL_PULLUP(GP0_2) | \ | ||
153 | PIN_PUL_PULLUP(GP0_3) | \ | ||
154 | PIN_PUL_FLOATING(GP0_LED_BLUE) | \ | ||
155 | PIN_PUL_FLOATING(GP0_LED_GREEN) | \ | ||
156 | PIN_PUL_PULLUP(GP0_6) | \ | ||
157 | PIN_PUL_PULLUP(GP0_NPOR)) | ||
158 | #define VAL_GP0OCE (PIN_OCE_NORMAL(GP0_0) | \ | ||
159 | PIN_OCE_NORMAL(GP0_1) | \ | ||
160 | PIN_OCE_NORMAL(GP0_2) | \ | ||
161 | PIN_OCE_NORMAL(GP0_3) | \ | ||
162 | PIN_OCE_NORMAL(GP0_LED_BLUE) | \ | ||
163 | PIN_OCE_NORMAL(GP0_LED_GREEN) | \ | ||
164 | PIN_OCE_NORMAL(GP0_6) | \ | ||
165 | PIN_OCE_NORMAL(GP0_NPOR)) | ||
166 | |||
167 | /* | ||
168 | * P1 setup: | ||
169 | * | ||
170 | * P1.0 - PIN0 (CON0, GPIO - input pullup). | ||
171 | * P1.1 - PIN1 (CON0, GPIO - input pullup). | ||
172 | * P1.2 - PIN2 (CON0, GPIO - input pullup). | ||
173 | * P1.3 - PIN3 (CON0, GPIO - input pullup). | ||
174 | * P1.4 - PIN4 (CON0, GPIO - input pullup). | ||
175 | * P1.5 - PIN5 (CON0, GPIO - input pullup). | ||
176 | * P1.6 - PIN6 (CON0, GPIO - input pullup). | ||
177 | * P1.7 - PIN7 (CON0, GPIO - input pullup). | ||
178 | */ | ||
179 | #define VAL_GP1CON (PIN_CON_CON(GP1_0, 0) | \ | ||
180 | PIN_CON_CON(GP1_1, 0) | \ | ||
181 | PIN_CON_CON(GP1_2, 0) | \ | ||
182 | PIN_CON_CON(GP1_3, 0) | \ | ||
183 | PIN_CON_CON(GP1_4, 0) | \ | ||
184 | PIN_CON_CON(GP1_5, 0) | \ | ||
185 | PIN_CON_CON(GP1_6, 0) | \ | ||
186 | PIN_CON_CON(GP1_7, 0)) | ||
187 | #define VAL_GP1OEN (PIN_OEN_INPUT(GP1_0) | \ | ||
188 | PIN_OEN_INPUT(GP1_1) | \ | ||
189 | PIN_OEN_INPUT(GP1_2) | \ | ||
190 | PIN_OEN_INPUT(GP1_3) | \ | ||
191 | PIN_OEN_INPUT(GP1_4) | \ | ||
192 | PIN_OEN_INPUT(GP1_5) | \ | ||
193 | PIN_OEN_INPUT(GP1_6) | \ | ||
194 | PIN_OEN_INPUT(GP1_7)) | ||
195 | #define VAL_GP1PUL (PIN_PUL_PULLUP(GP1_0) | \ | ||
196 | PIN_PUL_PULLUP(GP1_1) | \ | ||
197 | PIN_PUL_PULLUP(GP1_2) | \ | ||
198 | PIN_PUL_PULLUP(GP1_3) | \ | ||
199 | PIN_PUL_PULLUP(GP1_4) | \ | ||
200 | PIN_PUL_PULLUP(GP1_5) | \ | ||
201 | PIN_PUL_PULLUP(GP1_6) | \ | ||
202 | PIN_PUL_PULLUP(GP1_7)) | ||
203 | #define VAL_GP1OCE (PIN_OCE_NORMAL(GP1_0) | \ | ||
204 | PIN_OCE_NORMAL(GP1_1) | \ | ||
205 | PIN_OCE_NORMAL(GP1_2) | \ | ||
206 | PIN_OCE_NORMAL(GP1_3) | \ | ||
207 | PIN_OCE_NORMAL(GP1_4) | \ | ||
208 | PIN_OCE_NORMAL(GP1_5) | \ | ||
209 | PIN_OCE_NORMAL(GP1_6) | \ | ||
210 | PIN_OCE_NORMAL(GP1_7)) | ||
211 | |||
212 | /* | ||
213 | * P2 setup: | ||
214 | * | ||
215 | * P2.0 - PIN0 (CON0, GPIO - input pullup). | ||
216 | * P2.1 - PIN1 (CON0, GPIO - input pullup). | ||
217 | * P2.2 - BUTTON (CON0, GPIO - input floating). | ||
218 | * P2.3 - SWCLK (CON0, SWCLK). | ||
219 | * P2.4 - SWD (CON0, SWD). | ||
220 | * P2.5 - PIN5 (CON0, GPIO - input pullup). | ||
221 | * P2.6 - PIN6 (CON0, GPIO - input pullup). | ||
222 | * P2.7 - PIN7 (CON0, GPIO - input pullup). | ||
223 | */ | ||
224 | #define VAL_GP2CON (PIN_CON_CON(GP2_0, 0) | \ | ||
225 | PIN_CON_CON(GP2_1, 0) | \ | ||
226 | PIN_CON_CON(GP2_BUTTON, 0) | \ | ||
227 | PIN_CON_CON(GP2_SWCLK, 0) | \ | ||
228 | PIN_CON_CON(GP2_SWD, 0) | \ | ||
229 | PIN_CON_CON(GP2_5, 0) | \ | ||
230 | PIN_CON_CON(GP2_6, 0) | \ | ||
231 | PIN_CON_CON(GP2_7, 0)) | ||
232 | #define VAL_GP2OEN (PIN_OEN_INPUT(GP2_0) | \ | ||
233 | PIN_OEN_INPUT(GP2_1) | \ | ||
234 | PIN_OEN_INPUT(GP2_BUTTON) | \ | ||
235 | PIN_OEN_INPUT(GP2_SWCLK) | \ | ||
236 | PIN_OEN_INPUT(GP2_SWD) | \ | ||
237 | PIN_OEN_INPUT(GP2_5) | \ | ||
238 | PIN_OEN_INPUT(GP2_6) | \ | ||
239 | PIN_OEN_INPUT(GP2_7)) | ||
240 | #define VAL_GP2PUL (PIN_PUL_PULLUP(GP2_0) | \ | ||
241 | PIN_PUL_PULLUP(GP2_1) | \ | ||
242 | PIN_PUL_FLOATING(GP2_BUTTON) | \ | ||
243 | PIN_PUL_PULLUP(GP2_SWCLK) | \ | ||
244 | PIN_PUL_PULLUP(GP2_SWD) | \ | ||
245 | PIN_PUL_PULLUP(GP2_5) | \ | ||
246 | PIN_PUL_PULLUP(GP2_6) | \ | ||
247 | PIN_PUL_PULLUP(GP2_7)) | ||
248 | #define VAL_GP2OCE (PIN_OCE_NORMAL(GP2_0) | \ | ||
249 | PIN_OCE_NORMAL(GP2_1) | \ | ||
250 | PIN_OCE_NORMAL(GP2_BUTTON) | \ | ||
251 | PIN_OCE_NORMAL(GP2_SWCLK) | \ | ||
252 | PIN_OCE_NORMAL(GP2_SWD) | \ | ||
253 | PIN_OCE_NORMAL(GP2_5) | \ | ||
254 | PIN_OCE_NORMAL(GP2_6) | \ | ||
255 | PIN_OCE_NORMAL(GP2_7)) | ||
256 | |||
257 | /*===========================================================================*/ | ||
258 | /* External declarations. */ | ||
259 | /*===========================================================================*/ | ||
260 | |||
261 | #if !defined(_FROM_ASM_) | ||
262 | #ifdef __cplusplus | ||
263 | extern "C" { | ||
264 | #endif | ||
265 | void boardInit(void); | ||
266 | #ifdef __cplusplus | ||
267 | } | ||
268 | #endif | ||
269 | #endif /* _FROM_ASM_ */ | ||
270 | |||
271 | #endif /* BOARD_H */ | ||
diff --git a/lib/chibios/os/hal/boards/ADICUP360/board.mk b/lib/chibios/os/hal/boards/ADICUP360/board.mk new file mode 100644 index 000000000..77933f52e --- /dev/null +++ b/lib/chibios/os/hal/boards/ADICUP360/board.mk | |||
@@ -0,0 +1,9 @@ | |||
1 | # List of all the board related files. | ||
2 | BOARDSRC = $(CHIBIOS)/os/hal/boards/ADICUP360/board.c | ||
3 | |||
4 | # Required include directories | ||
5 | BOARDINC = $(CHIBIOS)/os/hal/boards/ADICUP360 | ||
6 | |||
7 | # Shared variables | ||
8 | ALLCSRC += $(BOARDSRC) | ||
9 | ALLINC += $(BOARDINC) | ||
diff --git a/lib/chibios/os/hal/boards/ADI_EVAL_ADUCM410EBZ/board.c b/lib/chibios/os/hal/boards/ADI_EVAL_ADUCM410EBZ/board.c new file mode 100644 index 000000000..4b2fbb6df --- /dev/null +++ b/lib/chibios/os/hal/boards/ADI_EVAL_ADUCM410EBZ/board.c | |||
@@ -0,0 +1,154 @@ | |||
1 | /* | ||
2 | ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio | ||
3 | |||
4 | Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | you may not use this file except in compliance with the License. | ||
6 | You may obtain a copy of the License at | ||
7 | |||
8 | http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | |||
10 | Unless required by applicable law or agreed to in writing, software | ||
11 | distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | See the License for the specific language governing permissions and | ||
14 | limitations under the License. | ||
15 | */ | ||
16 | |||
17 | /* | ||
18 | * This file has been automatically generated using ChibiStudio board | ||
19 | * generator plugin. Do not edit manually. | ||
20 | */ | ||
21 | |||
22 | #include "hal.h" | ||
23 | #include "aducm_gp.h" | ||
24 | |||
25 | /*===========================================================================*/ | ||
26 | /* Driver local definitions. */ | ||
27 | /*===========================================================================*/ | ||
28 | |||
29 | /*===========================================================================*/ | ||
30 | /* Driver exported variables. */ | ||
31 | /*===========================================================================*/ | ||
32 | |||
33 | /*===========================================================================*/ | ||
34 | /* Driver local variables and types. */ | ||
35 | /*===========================================================================*/ | ||
36 | |||
37 | /** | ||
38 | * @brief Type of ADUCM36x GP port setup. | ||
39 | */ | ||
40 | typedef struct { | ||
41 | uint32_t con; | ||
42 | uint32_t oen; | ||
43 | uint32_t pul; | ||
44 | uint32_t oce; | ||
45 | } gp_setup_t; | ||
46 | |||
47 | /** | ||
48 | * @brief Type of ADUCM36x GPIO initialization data. | ||
49 | */ | ||
50 | typedef struct { | ||
51 | gp_setup_t GP0Data; | ||
52 | gp_setup_t GP1Data; | ||
53 | gp_setup_t GP2Data; | ||
54 | } gp_config_t; | ||
55 | |||
56 | /** | ||
57 | * @brief STM32 GPIO static initialization data. | ||
58 | */ | ||
59 | static const gp_config_t gp_default_config = { | ||
60 | {VAL_GP0CON, VAL_GP0OEN, VAL_GP0PUL, VAL_GP0OCE}, | ||
61 | {VAL_GP1CON, VAL_GP1OEN, VAL_GP1PUL, VAL_GP1OCE}, | ||
62 | {VAL_GP2CON, VAL_GP2OEN, VAL_GP2PUL, VAL_GP2OCE} | ||
63 | }; | ||
64 | |||
65 | /*===========================================================================*/ | ||
66 | /* Driver local functions. */ | ||
67 | /*===========================================================================*/ | ||
68 | |||
69 | static void gp_init(aducm_gp_t *gpp, const gp_setup_t *config) { | ||
70 | |||
71 | gpp->CON = config->con; | ||
72 | gpp->OEN = config->oen; | ||
73 | gpp->PUL = config->pul; | ||
74 | gpp->OCE = config->oce; | ||
75 | } | ||
76 | |||
77 | static void aducm_gpio_init(void) { | ||
78 | |||
79 | /* Initializing all the defined GP ports.*/ | ||
80 | gp_init(GP0, &gp_default_config.GP0Data); | ||
81 | gp_init(GP1, &gp_default_config.GP1Data); | ||
82 | gp_init(GP2, &gp_default_config.GP2Data); | ||
83 | } | ||
84 | |||
85 | /*===========================================================================*/ | ||
86 | /* Driver interrupt handlers. */ | ||
87 | /*===========================================================================*/ | ||
88 | |||
89 | /*===========================================================================*/ | ||
90 | /* Driver exported functions. */ | ||
91 | /*===========================================================================*/ | ||
92 | |||
93 | /** | ||
94 | * @brief Early initialization code. | ||
95 | * @details GP ports and system clocks are initialized before everything | ||
96 | * else. | ||
97 | */ | ||
98 | void __early_init(void) { | ||
99 | |||
100 | aducm_gpio_init(); | ||
101 | aducm_clock_init(); | ||
102 | } | ||
103 | |||
104 | #if HAL_USE_SDC || defined(__DOXYGEN__) | ||
105 | /** | ||
106 | * @brief SDC card detection. | ||
107 | */ | ||
108 | bool sdc_lld_is_card_inserted(SDCDriver *sdcp) { | ||
109 | |||
110 | (void)sdcp; | ||
111 | /* CHTODO: Fill the implementation.*/ | ||
112 | return true; | ||
113 | } | ||
114 | |||
115 | /** | ||
116 | * @brief SDC card write protection detection. | ||
117 | */ | ||
118 | bool sdc_lld_is_write_protected(SDCDriver *sdcp) { | ||
119 | |||
120 | (void)sdcp; | ||
121 | /* CHTODO: Fill the implementation.*/ | ||
122 | return false; | ||
123 | } | ||
124 | #endif /* HAL_USE_SDC */ | ||
125 | |||
126 | #if HAL_USE_MMC_SPI || defined(__DOXYGEN__) | ||
127 | /** | ||
128 | * @brief MMC_SPI card detection. | ||
129 | */ | ||
130 | bool mmc_lld_is_card_inserted(MMCDriver *mmcp) { | ||
131 | |||
132 | (void)mmcp; | ||
133 | /* CHTODO: Fill the implementation.*/ | ||
134 | return true; | ||
135 | } | ||
136 | |||
137 | /** | ||
138 | * @brief MMC_SPI card write protection detection. | ||
139 | */ | ||
140 | bool mmc_lld_is_write_protected(MMCDriver *mmcp) { | ||
141 | |||
142 | (void)mmcp; | ||
143 | /* CHTODO: Fill the implementation.*/ | ||
144 | return false; | ||
145 | } | ||
146 | #endif | ||
147 | |||
148 | /** | ||
149 | * @brief Board-specific initialization code. | ||
150 | * @note You can add your board-specific code here. | ||
151 | */ | ||
152 | void boardInit(void) { | ||
153 | |||
154 | } | ||
diff --git a/lib/chibios/os/hal/boards/ADI_EVAL_ADUCM410EBZ/board.h b/lib/chibios/os/hal/boards/ADI_EVAL_ADUCM410EBZ/board.h new file mode 100644 index 000000000..9ffc74f85 --- /dev/null +++ b/lib/chibios/os/hal/boards/ADI_EVAL_ADUCM410EBZ/board.h | |||
@@ -0,0 +1,271 @@ | |||
1 | /* | ||
2 | ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio | ||
3 | |||
4 | Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | you may not use this file except in compliance with the License. | ||
6 | You may obtain a copy of the License at | ||
7 | |||
8 | http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | |||
10 | Unless required by applicable law or agreed to in writing, software | ||
11 | distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | See the License for the specific language governing permissions and | ||
14 | limitations under the License. | ||
15 | */ | ||
16 | |||
17 | /* | ||
18 | * This file has been automatically generated using ChibiStudio board | ||
19 | * generator plugin. Do not edit manually. | ||
20 | */ | ||
21 | |||
22 | #ifndef BOARD_H | ||
23 | #define BOARD_H | ||
24 | |||
25 | /*===========================================================================*/ | ||
26 | /* Driver constants. */ | ||
27 | /*===========================================================================*/ | ||
28 | |||
29 | /* | ||
30 | * Setup for Analgo Devices EVAL-ADuCM410EBZ board. | ||
31 | */ | ||
32 | |||
33 | /* | ||
34 | * Board identifier. | ||
35 | */ | ||
36 | #define BOARD_EV_ADUCM410QSPZ_U1 | ||
37 | #define BOARD_NAME "Analog Devices EVAL-ADuCM410EBZ" | ||
38 | |||
39 | /* | ||
40 | * Board oscillators-related settings. | ||
41 | */ | ||
42 | #if !defined(ADUCM_EXTCLK) | ||
43 | #define ADUCM_EXTCLK 0U | ||
44 | #endif | ||
45 | |||
46 | /* | ||
47 | * MCU type as defined in the ADI header. | ||
48 | */ | ||
49 | #define ADUCM410 | ||
50 | |||
51 | /* | ||
52 | * IO pins assignments. | ||
53 | */ | ||
54 | #define GP0_0 0U | ||
55 | #define GP0_1 1U | ||
56 | #define GP0_2 2U | ||
57 | #define GP0_3 3U | ||
58 | #define GP0_LED_BLUE 4U | ||
59 | #define GP0_LED_GREEN 5U | ||
60 | #define GP0_6 6U | ||
61 | #define GP0_7 7U | ||
62 | #define GP0_NPOR 7U | ||
63 | |||
64 | #define GP1_0 0U | ||
65 | #define GP1_1 1U | ||
66 | #define GP1_2 2U | ||
67 | #define GP1_3 3U | ||
68 | #define GP1_4 4U | ||
69 | #define GP1_5 5U | ||
70 | #define GP1_6 6U | ||
71 | #define GP1_7 7U | ||
72 | |||
73 | #define GP2_0 0U | ||
74 | #define GP2_1 1U | ||
75 | #define GP2_BUTTON 2U | ||
76 | #define GP2_SWCLK 3U | ||
77 | #define GP2_SWD 4U | ||
78 | #define GP2_5 5U | ||
79 | #define GP2_6 6U | ||
80 | #define GP2_7 7U | ||
81 | |||
82 | |||
83 | /* | ||
84 | * IO lines assignments. | ||
85 | */ | ||
86 | #define LINE_LED_BLUE PAL_LINE(GP0, 4U) | ||
87 | #define LINE_LED_GREEN PAL_LINE(GP0, 5U) | ||
88 | #define LINE_NPOR PAL_LINE(GP0, 7U) | ||
89 | #define LINE_BUTTON PAL_LINE(GP2, 2U) | ||
90 | #define LINE_SWCLK PAL_LINE(GP2, 3U) | ||
91 | #define LINE_SWD PAL_LINE(GP2, 4U) | ||
92 | |||
93 | /*===========================================================================*/ | ||
94 | /* Driver pre-compile time settings. */ | ||
95 | /*===========================================================================*/ | ||
96 | |||
97 | /*===========================================================================*/ | ||
98 | /* Derived constants and error checks. */ | ||
99 | /*===========================================================================*/ | ||
100 | |||
101 | /*===========================================================================*/ | ||
102 | /* Driver data structures and types. */ | ||
103 | /*===========================================================================*/ | ||
104 | |||
105 | /*===========================================================================*/ | ||
106 | /* Driver macros. */ | ||
107 | /*===========================================================================*/ | ||
108 | |||
109 | /* | ||
110 | * I/O ports initial setup, this configuration is established soon after reset | ||
111 | * in the initialization code. | ||
112 | * Please refer to the ADUCM360 Reference Manual for details. | ||
113 | */ | ||
114 | #define PIN_CON_CON(n, v) ((v) << (n * 2U)) | ||
115 | #define PIN_OEN_INPUT(n) (0U << (n)) | ||
116 | #define PIN_OEN_OUTPUT(n) (1U << (n)) | ||
117 | #define PIN_PUL_FLOATING(n) (0U << (n)) | ||
118 | #define PIN_PUL_PULLUP(n) (1U << (n)) | ||
119 | #define PIN_OCE_NORMAL(n) (0U << (n)) | ||
120 | #define PIN_OCE_HIGHZ(n) (1U << (n)) | ||
121 | |||
122 | /* | ||
123 | * P0 setup: | ||
124 | * | ||
125 | * P0.0 - PIN0 (CON0, GPIO - input pullup). | ||
126 | * P0.1 - PIN1 (CON0, GPIO - input pullup). | ||
127 | * P0.2 - PIN2 (CON0, GPIO - input pullup). | ||
128 | * P0.3 - PIN3 (CON0, GPIO - input pullup). | ||
129 | * P0.4 - LED_BLUE (CON0, GPIO - output floating). | ||
130 | * P0.5 - LED_GREEN (CON0, GPIO - output floating). | ||
131 | * P0.6 - PIN6 (CON0, GPIO - input pullup). | ||
132 | * P0.7 - NPOR (CON0, NPOR). | ||
133 | */ | ||
134 | #define VAL_GP0CON (PIN_CON_CON(GP0_0, 0) | \ | ||
135 | PIN_CON_CON(GP0_1, 0) | \ | ||
136 | PIN_CON_CON(GP0_2, 0) | \ | ||
137 | PIN_CON_CON(GP0_3, 0) | \ | ||
138 | PIN_CON_CON(GP0_LED_BLUE, 0) | \ | ||
139 | PIN_CON_CON(GP0_LED_GREEN, 0) | \ | ||
140 | PIN_CON_CON(GP0_6, 0) | \ | ||
141 | PIN_CON_CON(GP0_NPOR, 0)) | ||
142 | #define VAL_GP0OEN (PIN_OEN_INPUT(GP0_0) | \ | ||
143 | PIN_OEN_INPUT(GP0_1) | \ | ||
144 | PIN_OEN_INPUT(GP0_2) | \ | ||
145 | PIN_OEN_INPUT(GP0_3) | \ | ||
146 | PIN_OEN_OUTPUT(GP0_LED_BLUE) | \ | ||
147 | PIN_OEN_OUTPUT(GP0_LED_GREEN) | \ | ||
148 | PIN_OEN_INPUT(GP0_6) | \ | ||
149 | PIN_OEN_INPUT(GP0_NPOR)) | ||
150 | #define VAL_GP0PUL (PIN_PUL_PULLUP(GP0_0) | \ | ||
151 | PIN_PUL_PULLUP(GP0_1) | \ | ||
152 | PIN_PUL_PULLUP(GP0_2) | \ | ||
153 | PIN_PUL_PULLUP(GP0_3) | \ | ||
154 | PIN_PUL_FLOATING(GP0_LED_BLUE) | \ | ||
155 | PIN_PUL_FLOATING(GP0_LED_GREEN) | \ | ||
156 | PIN_PUL_PULLUP(GP0_6) | \ | ||
157 | PIN_PUL_PULLUP(GP0_NPOR)) | ||
158 | #define VAL_GP0OCE (PIN_OCE_NORMAL(GP0_0) | \ | ||
159 | PIN_OCE_NORMAL(GP0_1) | \ | ||
160 | PIN_OCE_NORMAL(GP0_2) | \ | ||
161 | PIN_OCE_NORMAL(GP0_3) | \ | ||
162 | PIN_OCE_NORMAL(GP0_LED_BLUE) | \ | ||
163 | PIN_OCE_NORMAL(GP0_LED_GREEN) | \ | ||
164 | PIN_OCE_NORMAL(GP0_6) | \ | ||
165 | PIN_OCE_NORMAL(GP0_NPOR)) | ||
166 | |||
167 | /* | ||
168 | * P1 setup: | ||
169 | * | ||
170 | * P1.0 - PIN0 (CON0, GPIO - input pullup). | ||
171 | * P1.1 - PIN1 (CON0, GPIO - input pullup). | ||
172 | * P1.2 - PIN2 (CON0, GPIO - input pullup). | ||
173 | * P1.3 - PIN3 (CON0, GPIO - input pullup). | ||
174 | * P1.4 - PIN4 (CON0, GPIO - input pullup). | ||
175 | * P1.5 - PIN5 (CON0, GPIO - input pullup). | ||
176 | * P1.6 - PIN6 (CON0, GPIO - input pullup). | ||
177 | * P1.7 - PIN7 (CON0, GPIO - input pullup). | ||
178 | */ | ||
179 | #define VAL_GP1CON (PIN_CON_CON(GP1_0, 0) | \ | ||
180 | PIN_CON_CON(GP1_1, 0) | \ | ||
181 | PIN_CON_CON(GP1_2, 0) | \ | ||
182 | PIN_CON_CON(GP1_3, 0) | \ | ||
183 | PIN_CON_CON(GP1_4, 0) | \ | ||
184 | PIN_CON_CON(GP1_5, 0) | \ | ||
185 | PIN_CON_CON(GP1_6, 0) | \ | ||
186 | PIN_CON_CON(GP1_7, 0)) | ||
187 | #define VAL_GP1OEN (PIN_OEN_INPUT(GP1_0) | \ | ||
188 | PIN_OEN_INPUT(GP1_1) | \ | ||
189 | PIN_OEN_INPUT(GP1_2) | \ | ||
190 | PIN_OEN_INPUT(GP1_3) | \ | ||
191 | PIN_OEN_INPUT(GP1_4) | \ | ||
192 | PIN_OEN_INPUT(GP1_5) | \ | ||
193 | PIN_OEN_INPUT(GP1_6) | \ | ||
194 | PIN_OEN_INPUT(GP1_7)) | ||
195 | #define VAL_GP1PUL (PIN_PUL_PULLUP(GP1_0) | \ | ||
196 | PIN_PUL_PULLUP(GP1_1) | \ | ||
197 | PIN_PUL_PULLUP(GP1_2) | \ | ||
198 | PIN_PUL_PULLUP(GP1_3) | \ | ||
199 | PIN_PUL_PULLUP(GP1_4) | \ | ||
200 | PIN_PUL_PULLUP(GP1_5) | \ | ||
201 | PIN_PUL_PULLUP(GP1_6) | \ | ||
202 | PIN_PUL_PULLUP(GP1_7)) | ||
203 | #define VAL_GP1OCE (PIN_OCE_NORMAL(GP1_0) | \ | ||
204 | PIN_OCE_NORMAL(GP1_1) | \ | ||
205 | PIN_OCE_NORMAL(GP1_2) | \ | ||
206 | PIN_OCE_NORMAL(GP1_3) | \ | ||
207 | PIN_OCE_NORMAL(GP1_4) | \ | ||
208 | PIN_OCE_NORMAL(GP1_5) | \ | ||
209 | PIN_OCE_NORMAL(GP1_6) | \ | ||
210 | PIN_OCE_NORMAL(GP1_7)) | ||
211 | |||
212 | /* | ||
213 | * P2 setup: | ||
214 | * | ||
215 | * P2.0 - PIN0 (CON0, GPIO - input pullup). | ||
216 | * P2.1 - PIN1 (CON0, GPIO - input pullup). | ||
217 | * P2.2 - BUTTON (CON0, GPIO - input floating). | ||
218 | * P2.3 - SWCLK (CON0, SWCLK). | ||
219 | * P2.4 - SWD (CON0, SWD). | ||
220 | * P2.5 - PIN5 (CON0, GPIO - input pullup). | ||
221 | * P2.6 - PIN6 (CON0, GPIO - input pullup). | ||
222 | * P2.7 - PIN7 (CON0, GPIO - input pullup). | ||
223 | */ | ||
224 | #define VAL_GP2CON (PIN_CON_CON(GP2_0, 0) | \ | ||
225 | PIN_CON_CON(GP2_1, 0) | \ | ||
226 | PIN_CON_CON(GP2_BUTTON, 0) | \ | ||
227 | PIN_CON_CON(GP2_SWCLK, 0) | \ | ||
228 | PIN_CON_CON(GP2_SWD, 0) | \ | ||
229 | PIN_CON_CON(GP2_5, 0) | \ | ||
230 | PIN_CON_CON(GP2_6, 0) | \ | ||
231 | PIN_CON_CON(GP2_7, 0)) | ||
232 | #define VAL_GP2OEN (PIN_OEN_INPUT(GP2_0) | \ | ||
233 | PIN_OEN_INPUT(GP2_1) | \ | ||
234 | PIN_OEN_INPUT(GP2_BUTTON) | \ | ||
235 | PIN_OEN_INPUT(GP2_SWCLK) | \ | ||
236 | PIN_OEN_INPUT(GP2_SWD) | \ | ||
237 | PIN_OEN_INPUT(GP2_5) | \ | ||
238 | PIN_OEN_INPUT(GP2_6) | \ | ||
239 | PIN_OEN_INPUT(GP2_7)) | ||
240 | #define VAL_GP2PUL (PIN_PUL_PULLUP(GP2_0) | \ | ||
241 | PIN_PUL_PULLUP(GP2_1) | \ | ||
242 | PIN_PUL_FLOATING(GP2_BUTTON) | \ | ||
243 | PIN_PUL_PULLUP(GP2_SWCLK) | \ | ||
244 | PIN_PUL_PULLUP(GP2_SWD) | \ | ||
245 | PIN_PUL_PULLUP(GP2_5) | \ | ||
246 | PIN_PUL_PULLUP(GP2_6) | \ | ||
247 | PIN_PUL_PULLUP(GP2_7)) | ||
248 | #define VAL_GP2OCE (PIN_OCE_NORMAL(GP2_0) | \ | ||
249 | PIN_OCE_NORMAL(GP2_1) | \ | ||
250 | PIN_OCE_NORMAL(GP2_BUTTON) | \ | ||
251 | PIN_OCE_NORMAL(GP2_SWCLK) | \ | ||
252 | PIN_OCE_NORMAL(GP2_SWD) | \ | ||
253 | PIN_OCE_NORMAL(GP2_5) | \ | ||
254 | PIN_OCE_NORMAL(GP2_6) | \ | ||
255 | PIN_OCE_NORMAL(GP2_7)) | ||
256 | |||
257 | /*===========================================================================*/ | ||
258 | /* External declarations. */ | ||
259 | /*===========================================================================*/ | ||
260 | |||
261 | #if !defined(_FROM_ASM_) | ||
262 | #ifdef __cplusplus | ||
263 | extern "C" { | ||
264 | #endif | ||
265 | void boardInit(void); | ||
266 | #ifdef __cplusplus | ||
267 | } | ||
268 | #endif | ||
269 | #endif /* _FROM_ASM_ */ | ||
270 | |||
271 | #endif /* BOARD_H */ | ||
diff --git a/lib/chibios/os/hal/boards/ADI_EVAL_ADUCM410EBZ/board.mk b/lib/chibios/os/hal/boards/ADI_EVAL_ADUCM410EBZ/board.mk new file mode 100644 index 000000000..50f02f4b3 --- /dev/null +++ b/lib/chibios/os/hal/boards/ADI_EVAL_ADUCM410EBZ/board.mk | |||
@@ -0,0 +1,9 @@ | |||
1 | # List of all the board related files. | ||
2 | BOARDSRC = $(CHIBIOS)/os/hal/boards/ADI_EVAL_ADUCM410EBZ/board.c | ||
3 | |||
4 | # Required include directories | ||
5 | BOARDINC = $(CHIBIOS)/os/hal/boards/ADI_EVAL_ADUCM410EBZ | ||
6 | |||
7 | # Shared variables | ||
8 | ALLCSRC += $(BOARDSRC) | ||
9 | ALLINC += $(BOARDINC) | ||
diff --git a/lib/chibios/os/hal/boards/ARDUINO_LEONARDO/board.c b/lib/chibios/os/hal/boards/ARDUINO_LEONARDO/board.c new file mode 100644 index 000000000..edd60ed55 --- /dev/null +++ b/lib/chibios/os/hal/boards/ARDUINO_LEONARDO/board.c | |||
@@ -0,0 +1,75 @@ | |||
1 | /* | ||
2 | ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio | ||
3 | |||
4 | Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | you may not use this file except in compliance with the License. | ||
6 | You may obtain a copy of the License at | ||
7 | |||
8 | http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | |||
10 | Unless required by applicable law or agreed to in writing, software | ||
11 | distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | See the License for the specific language governing permissions and | ||
14 | limitations under the License. | ||
15 | */ | ||
16 | |||
17 | #include "hal.h" | ||
18 | |||
19 | /** | ||
20 | * @brief PAL setup. | ||
21 | * @details Digital I/O ports static configuration as defined in @p board.h. | ||
22 | * This variable is used by the HAL when initializing the PAL driver. | ||
23 | */ | ||
24 | #if HAL_USE_PAL || defined(__DOXYGEN__) | ||
25 | const PALConfig pal_default_config = | ||
26 | { | ||
27 | #if defined(PORTA) | ||
28 | {VAL_PORTA, VAL_DDRA}, | ||
29 | #endif | ||
30 | #if defined(PORTB) | ||
31 | {VAL_PORTB, VAL_DDRB}, | ||
32 | #endif | ||
33 | #if defined(PORTC) | ||
34 | {VAL_PORTC, VAL_DDRC}, | ||
35 | #endif | ||
36 | #if defined(PORTD) | ||
37 | {VAL_PORTD, VAL_DDRD}, | ||
38 | #endif | ||
39 | #if defined(PORTE) | ||
40 | {VAL_PORTE, VAL_DDRE}, | ||
41 | #endif | ||
42 | #if defined(PORTF) | ||
43 | {VAL_PORTF, VAL_DDRF}, | ||
44 | #endif | ||
45 | #if defined(PORTG) | ||
46 | {VAL_PORTG, VAL_DDRG}, | ||
47 | #endif | ||
48 | #if defined(PORTH) | ||
49 | {VAL_PORTH, VAL_DDRH}, | ||
50 | #endif | ||
51 | #if defined(PORTJ) | ||
52 | {VAL_PORTJ, VAL_DDRJ}, | ||
53 | #endif | ||
54 | #if defined(PORTK) | ||
55 | {VAL_PORTK, VAL_DDRK}, | ||
56 | #endif | ||
57 | #if defined(PORTL) | ||
58 | {VAL_PORTL, VAL_DDRL}, | ||
59 | #endif | ||
60 | }; | ||
61 | #endif /* HAL_USE_PAL */ | ||
62 | |||
63 | /** | ||
64 | * Board-specific initialization code. | ||
65 | */ | ||
66 | void boardInit(void) { | ||
67 | |||
68 | /* | ||
69 | * External interrupts setup, all disabled initially. | ||
70 | */ | ||
71 | EICRA = 0x00; | ||
72 | EICRB = 0x00; | ||
73 | EIMSK = 0x00; | ||
74 | |||
75 | } | ||
diff --git a/lib/chibios/os/hal/boards/ARDUINO_LEONARDO/board.h b/lib/chibios/os/hal/boards/ARDUINO_LEONARDO/board.h new file mode 100644 index 000000000..5ebbc7ebd --- /dev/null +++ b/lib/chibios/os/hal/boards/ARDUINO_LEONARDO/board.h | |||
@@ -0,0 +1,127 @@ | |||
1 | /* | ||
2 | ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio | ||
3 | |||
4 | Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | you may not use this file except in compliance with the License. | ||
6 | You may obtain a copy of the License at | ||
7 | |||
8 | http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | |||
10 | Unless required by applicable law or agreed to in writing, software | ||
11 | distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | See the License for the specific language governing permissions and | ||
14 | limitations under the License. | ||
15 | */ | ||
16 | |||
17 | #ifndef _BOARD_H_ | ||
18 | #define _BOARD_H_ | ||
19 | |||
20 | /* | ||
21 | * Setup for the Arduino Leonardo board. | ||
22 | */ | ||
23 | |||
24 | /* | ||
25 | * Board identifier. | ||
26 | */ | ||
27 | #define BOARD_ARDUINO_LEONARDO | ||
28 | #define BOARD_NAME "Arduino Leonardo" | ||
29 | |||
30 | /* | ||
31 | * IO pins assignments. | ||
32 | */ | ||
33 | #define BOARD_LED1 7 | ||
34 | |||
35 | /* | ||
36 | * IO lines assignments. | ||
37 | */ | ||
38 | #define LINE_LED1 PAL_LINE(IOPORT3, 7U) | ||
39 | |||
40 | /* | ||
41 | * Port A setup. | ||
42 | * All inputs with pull-ups. | ||
43 | */ | ||
44 | #define VAL_DDRA 0x00 | ||
45 | #define VAL_PORTA 0xFF | ||
46 | |||
47 | /* | ||
48 | * Port B setup. | ||
49 | * All inputs with pull-ups. | ||
50 | */ | ||
51 | #define VAL_DDRB 0x00 | ||
52 | #define VAL_PORTB 0xFF | ||
53 | |||
54 | /* | ||
55 | * Port C setup. | ||
56 | * All inputs except PC7 which has a LED connected. | ||
57 | */ | ||
58 | #define VAL_DDRC 0x80 | ||
59 | #define VAL_PORTC 0xFF | ||
60 | |||
61 | /* | ||
62 | * Port D setup. | ||
63 | * All inputs with pull-ups except PD5, TXLED. | ||
64 | */ | ||
65 | #define VAL_DDRD 0x10 | ||
66 | #define VAL_PORTD 0xFF | ||
67 | |||
68 | /* | ||
69 | * Port E setup. | ||
70 | * All inputs with pull-ups. | ||
71 | */ | ||
72 | #define VAL_DDRE 0x00 | ||
73 | #define VAL_PORTE 0xFF | ||
74 | |||
75 | /* | ||
76 | * Port F setup. | ||
77 | * All inputs with pull-ups. | ||
78 | */ | ||
79 | #define VAL_DDRF 0x00 | ||
80 | #define VAL_PORTF 0xFF | ||
81 | |||
82 | /* | ||
83 | * Port G setup. | ||
84 | * All inputs with pull-ups. | ||
85 | */ | ||
86 | #define VAL_DDRG 0x00 | ||
87 | #define VAL_PORTG 0xFF | ||
88 | |||
89 | /* | ||
90 | * Port H setup. | ||
91 | * All inputs with pull-ups. | ||
92 | */ | ||
93 | #define VAL_DDRH 0x00 | ||
94 | #define VAL_PORTH 0xFF | ||
95 | |||
96 | /* | ||
97 | * Port J setup. | ||
98 | * All inputs with pull-ups. | ||
99 | */ | ||
100 | #define VAL_DDRJ 0x00 | ||
101 | #define VAL_PORTJ 0xFF | ||
102 | |||
103 | /* | ||
104 | * Port K setup. | ||
105 | * All inputs with pull-ups. | ||
106 | */ | ||
107 | #define VAL_DDRK 0x00 | ||
108 | #define VAL_PORTK 0xFF | ||
109 | |||
110 | /* | ||
111 | * Port L setup. | ||
112 | * All inputs with pull-ups. | ||
113 | */ | ||
114 | #define VAL_DDRL 0x00 | ||
115 | #define VAL_PORTL 0xFF | ||
116 | |||
117 | #if !defined(_FROM_ASM_) | ||
118 | #ifdef __cplusplus | ||
119 | extern "C" { | ||
120 | #endif | ||
121 | void boardInit(void); | ||
122 | #ifdef __cplusplus | ||
123 | } | ||
124 | #endif | ||
125 | #endif /* _FROM_ASM_ */ | ||
126 | |||
127 | #endif /* _BOARD_H_ */ | ||
diff --git a/lib/chibios/os/hal/boards/ARDUINO_LEONARDO/board.mk b/lib/chibios/os/hal/boards/ARDUINO_LEONARDO/board.mk new file mode 100644 index 000000000..f704efcfd --- /dev/null +++ b/lib/chibios/os/hal/boards/ARDUINO_LEONARDO/board.mk | |||
@@ -0,0 +1,9 @@ | |||
1 | # List of all the board related files. | ||
2 | BOARDSRC = ${CHIBIOS}/os/hal/boards/ARDUINO_LEONARDO/board.c | ||
3 | |||
4 | # Required include directories | ||
5 | BOARDINC = ${CHIBIOS}/os/hal/boards/ARDUINO_LEONARDO | ||
6 | |||
7 | # Shared variables | ||
8 | ALLCSRC += $(BOARDSRC) | ||
9 | ALLINC += $(BOARDINC) | ||
diff --git a/lib/chibios/os/hal/boards/ARDUINO_MEGA/board.c b/lib/chibios/os/hal/boards/ARDUINO_MEGA/board.c new file mode 100644 index 000000000..edd60ed55 --- /dev/null +++ b/lib/chibios/os/hal/boards/ARDUINO_MEGA/board.c | |||
@@ -0,0 +1,75 @@ | |||
1 | /* | ||
2 | ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio | ||
3 | |||
4 | Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | you may not use this file except in compliance with the License. | ||
6 | You may obtain a copy of the License at | ||
7 | |||
8 | http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | |||
10 | Unless required by applicable law or agreed to in writing, software | ||
11 | distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | See the License for the specific language governing permissions and | ||
14 | limitations under the License. | ||
15 | */ | ||
16 | |||
17 | #include "hal.h" | ||
18 | |||
19 | /** | ||
20 | * @brief PAL setup. | ||
21 | * @details Digital I/O ports static configuration as defined in @p board.h. | ||
22 | * This variable is used by the HAL when initializing the PAL driver. | ||
23 | */ | ||
24 | #if HAL_USE_PAL || defined(__DOXYGEN__) | ||
25 | const PALConfig pal_default_config = | ||
26 | { | ||
27 | #if defined(PORTA) | ||
28 | {VAL_PORTA, VAL_DDRA}, | ||
29 | #endif | ||
30 | #if defined(PORTB) | ||
31 | {VAL_PORTB, VAL_DDRB}, | ||
32 | #endif | ||
33 | #if defined(PORTC) | ||
34 | {VAL_PORTC, VAL_DDRC}, | ||
35 | #endif | ||
36 | #if defined(PORTD) | ||
37 | {VAL_PORTD, VAL_DDRD}, | ||
38 | #endif | ||
39 | #if defined(PORTE) | ||
40 | {VAL_PORTE, VAL_DDRE}, | ||
41 | #endif | ||
42 | #if defined(PORTF) | ||
43 | {VAL_PORTF, VAL_DDRF}, | ||
44 | #endif | ||
45 | #if defined(PORTG) | ||
46 | {VAL_PORTG, VAL_DDRG}, | ||
47 | #endif | ||
48 | #if defined(PORTH) | ||
49 | {VAL_PORTH, VAL_DDRH}, | ||
50 | #endif | ||
51 | #if defined(PORTJ) | ||
52 | {VAL_PORTJ, VAL_DDRJ}, | ||
53 | #endif | ||
54 | #if defined(PORTK) | ||
55 | {VAL_PORTK, VAL_DDRK}, | ||
56 | #endif | ||
57 | #if defined(PORTL) | ||
58 | {VAL_PORTL, VAL_DDRL}, | ||
59 | #endif | ||
60 | }; | ||
61 | #endif /* HAL_USE_PAL */ | ||
62 | |||
63 | /** | ||
64 | * Board-specific initialization code. | ||
65 | */ | ||
66 | void boardInit(void) { | ||
67 | |||
68 | /* | ||
69 | * External interrupts setup, all disabled initially. | ||
70 | */ | ||
71 | EICRA = 0x00; | ||
72 | EICRB = 0x00; | ||
73 | EIMSK = 0x00; | ||
74 | |||
75 | } | ||
diff --git a/lib/chibios/os/hal/boards/ARDUINO_MEGA/board.h b/lib/chibios/os/hal/boards/ARDUINO_MEGA/board.h new file mode 100644 index 000000000..8647a0b82 --- /dev/null +++ b/lib/chibios/os/hal/boards/ARDUINO_MEGA/board.h | |||
@@ -0,0 +1,128 @@ | |||
1 | /* | ||
2 | ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio | ||
3 | |||
4 | Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | you may not use this file except in compliance with the License. | ||
6 | You may obtain a copy of the License at | ||
7 | |||
8 | http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | |||
10 | Unless required by applicable law or agreed to in writing, software | ||
11 | distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | See the License for the specific language governing permissions and | ||
14 | limitations under the License. | ||
15 | */ | ||
16 | |||
17 | #ifndef _BOARD_H_ | ||
18 | #define _BOARD_H_ | ||
19 | |||
20 | /* | ||
21 | * Setup for the Arduino Mega board. | ||
22 | */ | ||
23 | |||
24 | /* | ||
25 | * Board identifier. | ||
26 | */ | ||
27 | #define BOARD_ARDUINO_MEGA | ||
28 | #define BOARD_NAME "Arduino Mega" | ||
29 | |||
30 | /* | ||
31 | * IO pins assignments. | ||
32 | */ | ||
33 | #define PORTB_LED1 7 | ||
34 | |||
35 | |||
36 | /* | ||
37 | * IO lines assignments. | ||
38 | */ | ||
39 | #define LINE_LED1 PAL_LINE(IOPORT2, 7U) | ||
40 | |||
41 | /* | ||
42 | * Port A setup. | ||
43 | * All inputs with pull-ups. | ||
44 | */ | ||
45 | #define VAL_DDRA 0x00 | ||
46 | #define VAL_PORTA 0xFF | ||
47 | |||
48 | /* | ||
49 | * Port B setup. | ||
50 | * All inputs except PB7 which has a LED connected. | ||
51 | */ | ||
52 | #define VAL_DDRB 0x80 | ||
53 | #define VAL_PORTB 0xFF | ||
54 | |||
55 | /* | ||
56 | * Port C setup. | ||
57 | * All inputs with pull-ups. | ||
58 | */ | ||
59 | #define VAL_DDRC 0x00 | ||
60 | #define VAL_PORTC 0xFF | ||
61 | |||
62 | /* | ||
63 | * Port D setup. | ||
64 | * All inputs with pull-ups. | ||
65 | */ | ||
66 | #define VAL_DDRD 0x00 | ||
67 | #define VAL_PORTD 0xFF | ||
68 | |||
69 | /* | ||
70 | * Port E setup. | ||
71 | * All inputs except PE1 (Serial TX0). | ||
72 | */ | ||
73 | #define VAL_DDRE 0x02 | ||
74 | #define VAL_PORTE 0xFF | ||
75 | |||
76 | /* | ||
77 | * Port F setup. | ||
78 | * All inputs with pull-ups. | ||
79 | */ | ||
80 | #define VAL_DDRF 0x00 | ||
81 | #define VAL_PORTF 0xFF | ||
82 | |||
83 | /* | ||
84 | * Port G setup. | ||
85 | * All inputs with pull-ups. | ||
86 | */ | ||
87 | #define VAL_DDRG 0x00 | ||
88 | #define VAL_PORTG 0xFF | ||
89 | |||
90 | /* | ||
91 | * Port H setup. | ||
92 | * All inputs with pull-ups. | ||
93 | */ | ||
94 | #define VAL_DDRH 0x00 | ||
95 | #define VAL_PORTH 0xFF | ||
96 | |||
97 | /* | ||
98 | * Port J setup. | ||
99 | * All inputs with pull-ups. | ||
100 | */ | ||
101 | #define VAL_DDRJ 0x00 | ||
102 | #define VAL_PORTJ 0xFF | ||
103 | |||
104 | /* | ||
105 | * Port K setup. | ||
106 | * All inputs with pull-ups. | ||
107 | */ | ||
108 | #define VAL_DDRK 0x00 | ||
109 | #define VAL_PORTK 0xFF | ||
110 | |||
111 | /* | ||
112 | * Port L setup. | ||
113 | * All inputs with pull-ups. | ||
114 | */ | ||
115 | #define VAL_DDRL 0x00 | ||
116 | #define VAL_PORTL 0xFF | ||
117 | |||
118 | #if !defined(_FROM_ASM_) | ||
119 | #ifdef __cplusplus | ||
120 | extern "C" { | ||
121 | #endif | ||
122 | void boardInit(void); | ||
123 | #ifdef __cplusplus | ||
124 | } | ||
125 | #endif | ||
126 | #endif /* _FROM_ASM_ */ | ||
127 | |||
128 | #endif /* _BOARD_H_ */ | ||
diff --git a/lib/chibios/os/hal/boards/ARDUINO_MEGA/board.mk b/lib/chibios/os/hal/boards/ARDUINO_MEGA/board.mk new file mode 100644 index 000000000..299e6acae --- /dev/null +++ b/lib/chibios/os/hal/boards/ARDUINO_MEGA/board.mk | |||
@@ -0,0 +1,9 @@ | |||
1 | # List of all the board related files. | ||
2 | BOARDSRC = ${CHIBIOS}/os/hal/boards/ARDUINO_MEGA/board.c | ||
3 | |||
4 | # Required include directories | ||
5 | BOARDINC = ${CHIBIOS}/os/hal/boards/ARDUINO_MEGA | ||
6 | |||
7 | # Shared variables | ||
8 | ALLCSRC += $(BOARDSRC) | ||
9 | ALLINC += $(BOARDINC) | ||
diff --git a/lib/chibios/os/hal/boards/ARDUINO_MINI/board.c b/lib/chibios/os/hal/boards/ARDUINO_MINI/board.c new file mode 100644 index 000000000..47ee782c1 --- /dev/null +++ b/lib/chibios/os/hal/boards/ARDUINO_MINI/board.c | |||
@@ -0,0 +1,50 @@ | |||
1 | /* | ||
2 | ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio | ||
3 | |||
4 | Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | you may not use this file except in compliance with the License. | ||
6 | You may obtain a copy of the License at | ||
7 | |||
8 | http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | |||
10 | Unless required by applicable law or agreed to in writing, software | ||
11 | distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | See the License for the specific language governing permissions and | ||
14 | limitations under the License. | ||
15 | */ | ||
16 | |||
17 | #include "hal.h" | ||
18 | |||
19 | /** | ||
20 | * @brief PAL setup. | ||
21 | * @details Digital I/O ports static configuration as defined in @p board.h. | ||
22 | * This variable is used by the HAL when initializing the PAL driver. | ||
23 | */ | ||
24 | #if HAL_USE_PAL || defined(__DOXYGEN__) | ||
25 | const PALConfig pal_default_config = | ||
26 | { | ||
27 | #if defined(PORTB) | ||
28 | {VAL_PORTB, VAL_DDRB}, | ||
29 | #endif | ||
30 | #if defined(PORTC) | ||
31 | {VAL_PORTC, VAL_DDRC}, | ||
32 | #endif | ||
33 | #if defined(PORTD) | ||
34 | {VAL_PORTD, VAL_DDRD}, | ||
35 | #endif | ||
36 | }; | ||
37 | #endif /* HAL_USE_PAL */ | ||
38 | |||
39 | /** | ||
40 | * Board-specific initialization code. | ||
41 | */ | ||
42 | void boardInit(void) { | ||
43 | |||
44 | /* | ||
45 | * External interrupts setup, all disabled initially. | ||
46 | */ | ||
47 | EICRA = 0x00; | ||
48 | EIMSK = 0x00; | ||
49 | |||
50 | } | ||
diff --git a/lib/chibios/os/hal/boards/ARDUINO_MINI/board.h b/lib/chibios/os/hal/boards/ARDUINO_MINI/board.h new file mode 100644 index 000000000..dd4bcfe6d --- /dev/null +++ b/lib/chibios/os/hal/boards/ARDUINO_MINI/board.h | |||
@@ -0,0 +1,71 @@ | |||
1 | /* | ||
2 | ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio | ||
3 | |||
4 | Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | you may not use this file except in compliance with the License. | ||
6 | You may obtain a copy of the License at | ||
7 | |||
8 | http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | |||
10 | Unless required by applicable law or agreed to in writing, software | ||
11 | distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | See the License for the specific language governing permissions and | ||
14 | limitations under the License. | ||
15 | */ | ||
16 | |||
17 | #ifndef _BOARD_H_ | ||
18 | #define _BOARD_H_ | ||
19 | |||
20 | /* | ||
21 | * Setup for the Arduino Uno or board. | ||
22 | */ | ||
23 | |||
24 | /* | ||
25 | * Board identifier. | ||
26 | */ | ||
27 | #define BOARD_ARDUINO_MINI | ||
28 | #define BOARD_NAME "Arduino Mini" | ||
29 | |||
30 | /* | ||
31 | * IO pins assignments. | ||
32 | */ | ||
33 | #define PORTB_LED1 5 | ||
34 | |||
35 | /* | ||
36 | * IO lines assignments. | ||
37 | */ | ||
38 | #define LINE_LED1 PAL_LINE(IOPORT2, 5U) | ||
39 | |||
40 | /* | ||
41 | * Port B setup. | ||
42 | * All inputs except PB5 which has a LED connected. | ||
43 | */ | ||
44 | #define VAL_DDRB 0x20 | ||
45 | #define VAL_PORTB 0xFF | ||
46 | |||
47 | /* | ||
48 | * Port C setup. | ||
49 | * All inputs with pull-ups. | ||
50 | */ | ||
51 | #define VAL_DDRC 0x00 | ||
52 | #define VAL_PORTC 0xFF | ||
53 | |||
54 | /* | ||
55 | * Port D setup. | ||
56 | * All inputs except PD1 (Serial TX0). | ||
57 | */ | ||
58 | #define VAL_DDRD 0x02 | ||
59 | #define VAL_PORTD 0xFF | ||
60 | |||
61 | #if !defined(_FROM_ASM_) | ||
62 | #ifdef __cplusplus | ||
63 | extern "C" { | ||
64 | #endif | ||
65 | void boardInit(void); | ||
66 | #ifdef __cplusplus | ||
67 | } | ||
68 | #endif | ||
69 | #endif /* _FROM_ASM_ */ | ||
70 | |||
71 | #endif /* _BOARD_H_ */ | ||
diff --git a/lib/chibios/os/hal/boards/ARDUINO_MINI/board.mk b/lib/chibios/os/hal/boards/ARDUINO_MINI/board.mk new file mode 100644 index 000000000..1e32b9124 --- /dev/null +++ b/lib/chibios/os/hal/boards/ARDUINO_MINI/board.mk | |||
@@ -0,0 +1,9 @@ | |||
1 | # List of all the board related files. | ||
2 | BOARDSRC = ${CHIBIOS}/os/hal/boards/ARDUINO_MINI/board.c | ||
3 | |||
4 | # Required include directories | ||
5 | BOARDINC = ${CHIBIOS}/os/hal/boards/ARDUINO_MINI | ||
6 | |||
7 | # Shared variables | ||
8 | ALLCSRC += $(BOARDSRC) | ||
9 | ALLINC += $(BOARDINC) | ||
diff --git a/lib/chibios/os/hal/boards/ARDUINO_NANO/board.c b/lib/chibios/os/hal/boards/ARDUINO_NANO/board.c new file mode 100644 index 000000000..47ee782c1 --- /dev/null +++ b/lib/chibios/os/hal/boards/ARDUINO_NANO/board.c | |||
@@ -0,0 +1,50 @@ | |||
1 | /* | ||
2 | ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio | ||
3 | |||
4 | Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | you may not use this file except in compliance with the License. | ||
6 | You may obtain a copy of the License at | ||
7 | |||
8 | http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | |||
10 | Unless required by applicable law or agreed to in writing, software | ||
11 | distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | See the License for the specific language governing permissions and | ||
14 | limitations under the License. | ||
15 | */ | ||
16 | |||
17 | #include "hal.h" | ||
18 | |||
19 | /** | ||
20 | * @brief PAL setup. | ||
21 | * @details Digital I/O ports static configuration as defined in @p board.h. | ||
22 | * This variable is used by the HAL when initializing the PAL driver. | ||
23 | */ | ||
24 | #if HAL_USE_PAL || defined(__DOXYGEN__) | ||
25 | const PALConfig pal_default_config = | ||
26 | { | ||
27 | #if defined(PORTB) | ||
28 | {VAL_PORTB, VAL_DDRB}, | ||
29 | #endif | ||
30 | #if defined(PORTC) | ||
31 | {VAL_PORTC, VAL_DDRC}, | ||
32 | #endif | ||
33 | #if defined(PORTD) | ||
34 | {VAL_PORTD, VAL_DDRD}, | ||
35 | #endif | ||
36 | }; | ||
37 | #endif /* HAL_USE_PAL */ | ||
38 | |||
39 | /** | ||
40 | * Board-specific initialization code. | ||
41 | */ | ||
42 | void boardInit(void) { | ||
43 | |||
44 | /* | ||
45 | * External interrupts setup, all disabled initially. | ||
46 | */ | ||
47 | EICRA = 0x00; | ||
48 | EIMSK = 0x00; | ||
49 | |||
50 | } | ||
diff --git a/lib/chibios/os/hal/boards/ARDUINO_NANO/board.h b/lib/chibios/os/hal/boards/ARDUINO_NANO/board.h new file mode 100644 index 000000000..361d4bf50 --- /dev/null +++ b/lib/chibios/os/hal/boards/ARDUINO_NANO/board.h | |||
@@ -0,0 +1,71 @@ | |||
1 | /* | ||
2 | ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio | ||
3 | |||
4 | Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | you may not use this file except in compliance with the License. | ||
6 | You may obtain a copy of the License at | ||
7 | |||
8 | http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | |||
10 | Unless required by applicable law or agreed to in writing, software | ||
11 | distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | See the License for the specific language governing permissions and | ||
14 | limitations under the License. | ||
15 | */ | ||
16 | |||
17 | #ifndef _BOARD_H_ | ||
18 | #define _BOARD_H_ | ||
19 | |||
20 | /* | ||
21 | * Setup for the Arduino Uno or board. | ||
22 | */ | ||
23 | |||
24 | /* | ||
25 | * Board identifier. | ||
26 | */ | ||
27 | #define BOARD_ARDUINO_NANO | ||
28 | #define BOARD_NAME "Arduino Nano" | ||
29 | |||
30 | /* | ||
31 | * IO pins assignments. | ||
32 | */ | ||
33 | #define PORTB_LED1 5 | ||
34 | |||
35 | /* | ||
36 | * IO lines assignments. | ||
37 | */ | ||
38 | #define LINE_LED1 PAL_LINE(IOPORT2, 5U) | ||
39 | |||
40 | /* | ||
41 | * Port B setup. | ||
42 | * All inputs except PB5 which has a LED connected. | ||
43 | */ | ||
44 | #define VAL_DDRB 0x20 | ||
45 | #define VAL_PORTB 0xFF | ||
46 | |||
47 | /* | ||
48 | * Port C setup. | ||
49 | * All inputs with pull-ups. | ||
50 | */ | ||
51 | #define VAL_DDRC 0x00 | ||
52 | #define VAL_PORTC 0xFF | ||
53 | |||
54 | /* | ||
55 | * Port D setup. | ||
56 | * All inputs except PD1 (Serial TX0). | ||
57 | */ | ||
58 | #define VAL_DDRD 0x02 | ||
59 | #define VAL_PORTD 0xFF | ||
60 | |||
61 | #if !defined(_FROM_ASM_) | ||
62 | #ifdef __cplusplus | ||
63 | extern "C" { | ||
64 | #endif | ||
65 | void boardInit(void); | ||
66 | #ifdef __cplusplus | ||
67 | } | ||
68 | #endif | ||
69 | #endif /* _FROM_ASM_ */ | ||
70 | |||
71 | #endif /* _BOARD_H_ */ | ||
diff --git a/lib/chibios/os/hal/boards/ARDUINO_NANO/board.mk b/lib/chibios/os/hal/boards/ARDUINO_NANO/board.mk new file mode 100644 index 000000000..5f195171b --- /dev/null +++ b/lib/chibios/os/hal/boards/ARDUINO_NANO/board.mk | |||
@@ -0,0 +1,9 @@ | |||
1 | # List of all the board related files. | ||
2 | BOARDSRC = ${CHIBIOS}/os/hal/boards/ARDUINO_NANO/board.c | ||
3 | |||
4 | # Required include directories | ||
5 | BOARDINC = ${CHIBIOS}/os/hal/boards/ARDUINO_NANO | ||
6 | |||
7 | # Shared variables | ||
8 | ALLCSRC += $(BOARDSRC) | ||
9 | ALLINC += $(BOARDINC) | ||
diff --git a/lib/chibios/os/hal/boards/ARDUINO_UNO/board.c b/lib/chibios/os/hal/boards/ARDUINO_UNO/board.c new file mode 100644 index 000000000..47ee782c1 --- /dev/null +++ b/lib/chibios/os/hal/boards/ARDUINO_UNO/board.c | |||
@@ -0,0 +1,50 @@ | |||
1 | /* | ||
2 | ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio | ||
3 | |||
4 | Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | you may not use this file except in compliance with the License. | ||
6 | You may obtain a copy of the License at | ||
7 | |||
8 | http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | |||
10 | Unless required by applicable law or agreed to in writing, software | ||
11 | distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | See the License for the specific language governing permissions and | ||
14 | limitations under the License. | ||
15 | */ | ||
16 | |||
17 | #include "hal.h" | ||
18 | |||
19 | /** | ||
20 | * @brief PAL setup. | ||
21 | * @details Digital I/O ports static configuration as defined in @p board.h. | ||
22 | * This variable is used by the HAL when initializing the PAL driver. | ||
23 | */ | ||
24 | #if HAL_USE_PAL || defined(__DOXYGEN__) | ||
25 | const PALConfig pal_default_config = | ||
26 | { | ||
27 | #if defined(PORTB) | ||
28 | {VAL_PORTB, VAL_DDRB}, | ||
29 | #endif | ||
30 | #if defined(PORTC) | ||
31 | {VAL_PORTC, VAL_DDRC}, | ||
32 | #endif | ||
33 | #if defined(PORTD) | ||
34 | {VAL_PORTD, VAL_DDRD}, | ||
35 | #endif | ||
36 | }; | ||
37 | #endif /* HAL_USE_PAL */ | ||
38 | |||
39 | /** | ||
40 | * Board-specific initialization code. | ||
41 | */ | ||
42 | void boardInit(void) { | ||
43 | |||
44 | /* | ||
45 | * External interrupts setup, all disabled initially. | ||
46 | */ | ||
47 | EICRA = 0x00; | ||
48 | EIMSK = 0x00; | ||
49 | |||
50 | } | ||
diff --git a/lib/chibios/os/hal/boards/ARDUINO_UNO/board.h b/lib/chibios/os/hal/boards/ARDUINO_UNO/board.h new file mode 100644 index 000000000..5215c21cb --- /dev/null +++ b/lib/chibios/os/hal/boards/ARDUINO_UNO/board.h | |||
@@ -0,0 +1,71 @@ | |||
1 | /* | ||
2 | ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio | ||
3 | |||
4 | Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | you may not use this file except in compliance with the License. | ||
6 | You may obtain a copy of the License at | ||
7 | |||
8 | http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | |||
10 | Unless required by applicable law or agreed to in writing, software | ||
11 | distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | See the License for the specific language governing permissions and | ||
14 | limitations under the License. | ||
15 | */ | ||
16 | |||
17 | #ifndef _BOARD_H_ | ||
18 | #define _BOARD_H_ | ||
19 | |||
20 | /* | ||
21 | * Setup for the Arduino Uno or board. | ||
22 | */ | ||
23 | |||
24 | /* | ||
25 | * Board identifier. | ||
26 | */ | ||
27 | #define BOARD_ARDUINO_UNO | ||
28 | #define BOARD_NAME "Arduino Uno" | ||
29 | |||
30 | /* | ||
31 | * IO pins assignments. | ||
32 | */ | ||
33 | #define PORTB_LED1 5 | ||
34 | |||
35 | /* | ||
36 | * IO lines assignments. | ||
37 | */ | ||
38 | #define LINE_LED1 PAL_LINE(IOPORT2, 5U) | ||
39 | |||
40 | /* | ||
41 | * Port B setup. | ||
42 | * All inputs except PB5 which has a LED connected. | ||
43 | */ | ||
44 | #define VAL_DDRB 0x20 | ||
45 | #define VAL_PORTB 0xFF | ||
46 | |||
47 | /* | ||
48 | * Port C setup. | ||
49 | * All inputs with pull-ups. | ||
50 | */ | ||
51 | #define VAL_DDRC 0x00 | ||
52 | #define VAL_PORTC 0xFF | ||
53 | |||
54 | /* | ||
55 | * Port D setup. | ||
56 | * All inputs except PD1 (Serial TX0). | ||
57 | */ | ||
58 | #define VAL_DDRD 0x02 | ||
59 | #define VAL_PORTD 0xFF | ||
60 | |||
61 | #if !defined(_FROM_ASM_) | ||
62 | #ifdef __cplusplus | ||
63 | extern "C" { | ||
64 | #endif | ||
65 | void boardInit(void); | ||
66 | #ifdef __cplusplus | ||
67 | } | ||
68 | #endif | ||
69 | #endif /* _FROM_ASM_ */ | ||
70 | |||
71 | #endif /* _BOARD_H_ */ | ||
diff --git a/lib/chibios/os/hal/boards/ARDUINO_UNO/board.mk b/lib/chibios/os/hal/boards/ARDUINO_UNO/board.mk new file mode 100644 index 000000000..fd3b9e66e --- /dev/null +++ b/lib/chibios/os/hal/boards/ARDUINO_UNO/board.mk | |||
@@ -0,0 +1,9 @@ | |||
1 | # List of all the board related files. | ||
2 | BOARDSRC = ${CHIBIOS}/os/hal/boards/ARDUINO_UNO/board.c | ||
3 | |||
4 | # Required include directories | ||
5 | BOARDINC = ${CHIBIOS}/os/hal/boards/ARDUINO_UNO | ||
6 | |||
7 | # Shared variables | ||
8 | ALLCSRC += $(BOARDSRC) | ||
9 | ALLINC += $(BOARDINC) | ||
diff --git a/lib/chibios/os/hal/boards/DIGISPARK_ATTINY_167/board.c b/lib/chibios/os/hal/boards/DIGISPARK_ATTINY_167/board.c new file mode 100644 index 000000000..c50b440cb --- /dev/null +++ b/lib/chibios/os/hal/boards/DIGISPARK_ATTINY_167/board.c | |||
@@ -0,0 +1,72 @@ | |||
1 | /* | ||
2 | ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio | ||
3 | |||
4 | Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | you may not use this file except in compliance with the License. | ||
6 | You may obtain a copy of the License at | ||
7 | |||
8 | http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | |||
10 | Unless required by applicable law or agreed to in writing, software | ||
11 | distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | See the License for the specific language governing permissions and | ||
14 | limitations under the License. | ||
15 | */ | ||
16 | |||
17 | #include "hal.h" | ||
18 | |||
19 | /** | ||
20 | * @brief PAL setup. | ||
21 | * @details Digital I/O ports static configuration as defined in @p board.h. | ||
22 | * This variable is used by the HAL when initializing the PAL driver. | ||
23 | */ | ||
24 | #if HAL_USE_PAL || defined(__DOXYGEN__) | ||
25 | const PALConfig pal_default_config = | ||
26 | { | ||
27 | #if defined(PORTA) | ||
28 | {VAL_PORTA, VAL_DDRA}, | ||
29 | #endif | ||
30 | #if defined(PORTB) | ||
31 | {VAL_PORTB, VAL_DDRB}, | ||
32 | #endif | ||
33 | #if defined(PORTC) | ||
34 | {VAL_PORTC, VAL_DDRC}, | ||
35 | #endif | ||
36 | #if defined(PORTD) | ||
37 | {VAL_PORTD, VAL_DDRD}, | ||
38 | #endif | ||
39 | #if defined(PORTE) | ||
40 | {VAL_PORTE, VAL_DDRE}, | ||
41 | #endif | ||
42 | #if defined(PORTF) | ||
43 | {VAL_PORTF, VAL_DDRF}, | ||
44 | #endif | ||
45 | #if defined(PORTG) | ||
46 | {VAL_PORTG, VAL_DDRG}, | ||
47 | #endif | ||
48 | #if defined(PORTH) | ||
49 | {VAL_PORTH, VAL_DDRH}, | ||
50 | #endif | ||
51 | #if defined(PORTJ) | ||
52 | {VAL_PORTJ, VAL_DDRJ}, | ||
53 | #endif | ||
54 | #if defined(PORTK) | ||
55 | {VAL_PORTK, VAL_DDRK}, | ||
56 | #endif | ||
57 | #if defined(PORTL) | ||
58 | {VAL_PORTL, VAL_DDRL}, | ||
59 | #endif | ||
60 | }; | ||
61 | #endif /* HAL_USE_PAL */ | ||
62 | |||
63 | /** | ||
64 | * Board-specific initialization code. | ||
65 | */ | ||
66 | void boardInit(void) { | ||
67 | |||
68 | /* | ||
69 | * External interrupts setup, all disabled initially. | ||
70 | */ | ||
71 | cli(); | ||
72 | } | ||
diff --git a/lib/chibios/os/hal/boards/DIGISPARK_ATTINY_167/board.h b/lib/chibios/os/hal/boards/DIGISPARK_ATTINY_167/board.h new file mode 100644 index 000000000..61ffcba33 --- /dev/null +++ b/lib/chibios/os/hal/boards/DIGISPARK_ATTINY_167/board.h | |||
@@ -0,0 +1,49 @@ | |||
1 | /* | ||
2 | ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio | ||
3 | |||
4 | Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | you may not use this file except in compliance with the License. | ||
6 | You may obtain a copy of the License at | ||
7 | |||
8 | http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | |||
10 | Unless required by applicable law or agreed to in writing, software | ||
11 | distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | See the License for the specific language governing permissions and | ||
14 | limitations under the License. | ||
15 | */ | ||
16 | |||
17 | #ifndef BOARD_H | ||
18 | #define BOARD_H | ||
19 | |||
20 | /* | ||
21 | * Setup for the Digispark ATtiny 167 board. | ||
22 | */ | ||
23 | |||
24 | /* | ||
25 | * Board identifier. | ||
26 | */ | ||
27 | #define BOARD_NAME "Digispark Pro board ATtiny167" | ||
28 | |||
29 | /* All inputs. */ | ||
30 | #define VAL_DDRA 0x00 | ||
31 | #define VAL_PORTA 0xFF | ||
32 | |||
33 | /* All inputs except PB1 which has a LED connected. */ | ||
34 | #define VAL_DDRB 0x02 | ||
35 | #define VAL_PORTB 0xFF | ||
36 | |||
37 | #define PORTB_LED1 1 | ||
38 | |||
39 | #if !defined(_FROM_ASM_) | ||
40 | #ifdef __cplusplus | ||
41 | extern "C" { | ||
42 | #endif | ||
43 | void boardInit(void); | ||
44 | #ifdef __cplusplus | ||
45 | } | ||
46 | #endif | ||
47 | #endif /* _FROM_ASM_ */ | ||
48 | |||
49 | #endif /* BOARD_H */ | ||
diff --git a/lib/chibios/os/hal/boards/DIGISPARK_ATTINY_167/board.mk b/lib/chibios/os/hal/boards/DIGISPARK_ATTINY_167/board.mk new file mode 100644 index 000000000..4c140def4 --- /dev/null +++ b/lib/chibios/os/hal/boards/DIGISPARK_ATTINY_167/board.mk | |||
@@ -0,0 +1,9 @@ | |||
1 | # List of all the board related files. | ||
2 | BOARDSRC = ${CHIBIOS}/os/hal/boards/DIGISPARK_ATTINY_167/board.c | ||
3 | |||
4 | # Required include directories | ||
5 | BOARDINC = ${CHIBIOS}/os/hal/boards/DIGISPARK_ATTINY_167 | ||
6 | |||
7 | # Shared variables | ||
8 | ALLCSRC += $(BOARDSRC) | ||
9 | ALLINC += $(BOARDINC) | ||
diff --git a/lib/chibios/os/hal/boards/EA_LPCXPRESSO_11C24/board.c b/lib/chibios/os/hal/boards/EA_LPCXPRESSO_11C24/board.c new file mode 100644 index 000000000..0059a7849 --- /dev/null +++ b/lib/chibios/os/hal/boards/EA_LPCXPRESSO_11C24/board.c | |||
@@ -0,0 +1,52 @@ | |||
1 | /* | ||
2 | ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio | ||
3 | |||
4 | Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | you may not use this file except in compliance with the License. | ||
6 | You may obtain a copy of the License at | ||
7 | |||
8 | http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | |||
10 | Unless required by applicable law or agreed to in writing, software | ||
11 | distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | See the License for the specific language governing permissions and | ||
14 | limitations under the License. | ||
15 | */ | ||
16 | |||
17 | #include "hal.h" | ||
18 | |||
19 | /** | ||
20 | * @brief PAL setup. | ||
21 | * @details Digital I/O ports static configuration as defined in @p board.h. | ||
22 | * This variable is used by the HAL when initializing the PAL driver. | ||
23 | */ | ||
24 | #if HAL_USE_PAL || defined(__DOXYGEN__) | ||
25 | const PALConfig pal_default_config = { | ||
26 | {VAL_GPIO0DATA, VAL_GPIO0DIR}, | ||
27 | {VAL_GPIO1DATA, VAL_GPIO1DIR}, | ||
28 | {VAL_GPIO2DATA, VAL_GPIO2DIR}, | ||
29 | {VAL_GPIO3DATA, VAL_GPIO3DIR}, | ||
30 | }; | ||
31 | #endif | ||
32 | |||
33 | /* | ||
34 | * Early initialization code. | ||
35 | * This initialization must be performed just after stack setup and before | ||
36 | * any other initialization. | ||
37 | */ | ||
38 | void __early_init(void) { | ||
39 | |||
40 | lpc111x_clock_init(); | ||
41 | } | ||
42 | |||
43 | /* | ||
44 | * Board-specific initialization code. | ||
45 | */ | ||
46 | void boardInit(void) { | ||
47 | |||
48 | /* | ||
49 | * Extra, board-specific, initializations. | ||
50 | */ | ||
51 | LPC_IOCON->PIO0_7 = 0xC0; /* Disables pull-up on LED2 output. */ | ||
52 | } | ||
diff --git a/lib/chibios/os/hal/boards/EA_LPCXPRESSO_11C24/board.h b/lib/chibios/os/hal/boards/EA_LPCXPRESSO_11C24/board.h new file mode 100644 index 000000000..9d9fe92af --- /dev/null +++ b/lib/chibios/os/hal/boards/EA_LPCXPRESSO_11C24/board.h | |||
@@ -0,0 +1,81 @@ | |||
1 | /* | ||
2 | ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio | ||
3 | |||
4 | Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | you may not use this file except in compliance with the License. | ||
6 | You may obtain a copy of the License at | ||
7 | |||
8 | http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | |||
10 | Unless required by applicable law or agreed to in writing, software | ||
11 | distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | See the License for the specific language governing permissions and | ||
14 | limitations under the License. | ||
15 | */ | ||
16 | |||
17 | #ifndef _BOARD_H_ | ||
18 | #define _BOARD_H_ | ||
19 | |||
20 | /* | ||
21 | * Setup for Embedded Artists LPCXpresso LPC11C24 | ||
22 | * board. | ||
23 | */ | ||
24 | |||
25 | /* | ||
26 | * Board identifiers. | ||
27 | */ | ||
28 | #define BOARD_EA_BB_LPC11C24 | ||
29 | #define BOARD_NAME "Embedded Artists LPCXpresso LPC11C24" | ||
30 | |||
31 | /* | ||
32 | * Board frequencies. | ||
33 | */ | ||
34 | #define SYSOSCCLK 12000000 | ||
35 | |||
36 | /* | ||
37 | * SCK0 connection on this board. | ||
38 | */ | ||
39 | #define LPC11xx_SPI_SCK0_SELECTOR SCK0_IS_PIO2_11 | ||
40 | |||
41 | /* | ||
42 | * GPIO 0 initial setup. | ||
43 | */ | ||
44 | #define VAL_GPIO0DIR PAL_PORT_BIT(GPIO0_LED) | ||
45 | #define VAL_GPIO0DATA 0x00000000 | ||
46 | |||
47 | /* | ||
48 | * GPIO 1 initial setup. | ||
49 | */ | ||
50 | #define VAL_GPIO1DIR 0x00000000 | ||
51 | #define VAL_GPIO1DATA 0x00000000 | ||
52 | |||
53 | /* | ||
54 | * GPIO 2 initial setup. | ||
55 | */ | ||
56 | #define VAL_GPIO2DIR 0x00000000 | ||
57 | #define VAL_GPIO2DATA 0x00000000 | ||
58 | |||
59 | /* | ||
60 | * GPIO 3 initial setup. | ||
61 | */ | ||
62 | #define VAL_GPIO3DIR 0x00000000 | ||
63 | #define VAL_GPIO3DATA 0x00000000 | ||
64 | |||
65 | /* | ||
66 | * Pin definitions. | ||
67 | */ | ||
68 | #define GPIO0_SW_ISP 1 | ||
69 | #define GPIO0_LED 7 | ||
70 | |||
71 | #if !defined(_FROM_ASM_) | ||
72 | #ifdef __cplusplus | ||
73 | extern "C" { | ||
74 | #endif | ||
75 | void boardInit(void); | ||
76 | #ifdef __cplusplus | ||
77 | } | ||
78 | #endif | ||
79 | #endif /* _FROM_ASM_ */ | ||
80 | |||
81 | #endif /* _BOARD_H_ */ | ||
diff --git a/lib/chibios/os/hal/boards/EA_LPCXPRESSO_11C24/board.mk b/lib/chibios/os/hal/boards/EA_LPCXPRESSO_11C24/board.mk new file mode 100644 index 000000000..ddea84f93 --- /dev/null +++ b/lib/chibios/os/hal/boards/EA_LPCXPRESSO_11C24/board.mk | |||
@@ -0,0 +1,9 @@ | |||
1 | # List of all the board related files. | ||
2 | BOARDSRC = ${CHIBIOS}/os/hal/boards/EA_LPCXPRESSO_11C24/board.c | ||
3 | |||
4 | # Required include directories | ||
5 | BOARDINC = ${CHIBIOS}/os/hal/boards/EA_LPCXPRESSO_11C24 | ||
6 | |||
7 | # Shared variables | ||
8 | ALLCSRC += $(BOARDSRC) | ||
9 | ALLINC += $(BOARDINC) | ||
diff --git a/lib/chibios/os/hal/boards/EA_LPCXPRESSO_BB_1114/board.c b/lib/chibios/os/hal/boards/EA_LPCXPRESSO_BB_1114/board.c new file mode 100644 index 000000000..fcd983669 --- /dev/null +++ b/lib/chibios/os/hal/boards/EA_LPCXPRESSO_BB_1114/board.c | |||
@@ -0,0 +1,58 @@ | |||
1 | /* | ||
2 | ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio | ||
3 | |||
4 | Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | you may not use this file except in compliance with the License. | ||
6 | You may obtain a copy of the License at | ||
7 | |||
8 | http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | |||
10 | Unless required by applicable law or agreed to in writing, software | ||
11 | distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | See the License for the specific language governing permissions and | ||
14 | limitations under the License. | ||
15 | */ | ||
16 | |||
17 | #include "hal.h" | ||
18 | |||
19 | /** | ||
20 | * @brief PAL setup. | ||
21 | * @details Digital I/O ports static configuration as defined in @p board.h. | ||
22 | * This variable is used by the HAL when initializing the PAL driver. | ||
23 | */ | ||
24 | #if HAL_USE_PAL || defined(__DOXYGEN__) | ||
25 | const PALConfig pal_default_config = { | ||
26 | {VAL_GPIO0DATA, VAL_GPIO0DIR}, | ||
27 | {VAL_GPIO1DATA, VAL_GPIO1DIR}, | ||
28 | {VAL_GPIO2DATA, VAL_GPIO2DIR}, | ||
29 | {VAL_GPIO3DATA, VAL_GPIO3DIR}, | ||
30 | }; | ||
31 | #endif | ||
32 | |||
33 | /* | ||
34 | * Early initialization code. | ||
35 | * This initialization must be performed just after stack setup and before | ||
36 | * any other initialization. | ||
37 | */ | ||
38 | void __early_init(void) { | ||
39 | |||
40 | lpc111x_clock_init(); | ||
41 | } | ||
42 | |||
43 | /* | ||
44 | * Board-specific initialization code. | ||
45 | */ | ||
46 | void boardInit(void) { | ||
47 | |||
48 | /* | ||
49 | * Extra, board-specific, initializations. | ||
50 | * NOTE: PIO1_2 is associated also to the JTAG, if you need to use JTAG | ||
51 | * you must comment that line first. | ||
52 | */ | ||
53 | LPC_IOCON->PIO0_7 = 0xC0; /* Disables pull-up on LED2 output. */ | ||
54 | LPC_IOCON->R_PIO1_2 = 0xC1; /* Disables pull-up on LED3B output | ||
55 | and makes it GPIO1_2. */ | ||
56 | LPC_IOCON->PIO1_9 = 0xC0; /* Disables pull-up on LED3R output.*/ | ||
57 | LPC_IOCON->PIO1_10 = 0xC0; /* Disables pull-up on LED3G output.*/ | ||
58 | } | ||
diff --git a/lib/chibios/os/hal/boards/EA_LPCXPRESSO_BB_1114/board.h b/lib/chibios/os/hal/boards/EA_LPCXPRESSO_BB_1114/board.h new file mode 100644 index 000000000..547fdd5c7 --- /dev/null +++ b/lib/chibios/os/hal/boards/EA_LPCXPRESSO_BB_1114/board.h | |||
@@ -0,0 +1,96 @@ | |||
1 | /* | ||
2 | ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio | ||
3 | |||
4 | Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | you may not use this file except in compliance with the License. | ||
6 | You may obtain a copy of the License at | ||
7 | |||
8 | http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | |||
10 | Unless required by applicable law or agreed to in writing, software | ||
11 | distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | See the License for the specific language governing permissions and | ||
14 | limitations under the License. | ||
15 | */ | ||
16 | |||
17 | #ifndef _BOARD_H_ | ||
18 | #define _BOARD_H_ | ||
19 | |||
20 | /* | ||
21 | * Setup for Embedded Artists LPCXpresso Base Board with LPC1114 daughter | ||
22 | * board. | ||
23 | */ | ||
24 | |||
25 | /* | ||
26 | * Board identifiers. | ||
27 | */ | ||
28 | #define BOARD_EA_BB_LPC1114 | ||
29 | #define BOARD_NAME "Embedded Artists LPCXpresso Base Board + LPC1114" | ||
30 | |||
31 | /* | ||
32 | * Board frequencies. | ||
33 | */ | ||
34 | #define SYSOSCCLK 12000000 | ||
35 | |||
36 | /* | ||
37 | * SCK0 connection on this board. | ||
38 | */ | ||
39 | #define LPC11xx_SPI_SCK0_SELECTOR SCK0_IS_PIO2_11 | ||
40 | |||
41 | /* | ||
42 | * GPIO 0 initial setup. | ||
43 | */ | ||
44 | #define VAL_GPIO0DIR PAL_PORT_BIT(GPIO0_OLEDSEL) | \ | ||
45 | PAL_PORT_BIT(GPIO0_LED2) | ||
46 | #define VAL_GPIO0DATA PAL_PORT_BIT(GPIO0_OLEDSEL) | \ | ||
47 | PAL_PORT_BIT(GPIO0_LED2) | ||
48 | |||
49 | /* | ||
50 | * GPIO 1 initial setup. | ||
51 | */ | ||
52 | #define VAL_GPIO1DIR PAL_PORT_BIT(GPIO1_LED3B) | \ | ||
53 | PAL_PORT_BIT(GPIO1_LED3R) | \ | ||
54 | PAL_PORT_BIT(GPIO1_LED3G) | \ | ||
55 | PAL_PORT_BIT(GPIO1_SPI0SEL) | ||
56 | #define VAL_GPIO1DATA PAL_PORT_BIT(GPIO1_LED3B) | \ | ||
57 | PAL_PORT_BIT(GPIO1_LED3R) | \ | ||
58 | PAL_PORT_BIT(GPIO1_LED3G) | \ | ||
59 | PAL_PORT_BIT(GPIO1_SPI0SEL) | ||
60 | |||
61 | /* | ||
62 | * GPIO 2 initial setup. | ||
63 | */ | ||
64 | #define VAL_GPIO2DIR 0x00000000 | ||
65 | #define VAL_GPIO2DATA 0x00000000 | ||
66 | |||
67 | /* | ||
68 | * GPIO 3 initial setup. | ||
69 | */ | ||
70 | #define VAL_GPIO3DIR 0x00000000 | ||
71 | #define VAL_GPIO3DATA 0x00000000 | ||
72 | |||
73 | /* | ||
74 | * Pin definitions. | ||
75 | */ | ||
76 | #define GPIO0_SW3 1 | ||
77 | #define GPIO0_OLEDSEL 2 | ||
78 | #define GPIO0_LED2 7 | ||
79 | |||
80 | #define GPIO1_LED3B 2 | ||
81 | #define GPIO1_SW4 4 | ||
82 | #define GPIO1_LED3R 9 | ||
83 | #define GPIO1_LED3G 10 | ||
84 | #define GPIO1_SPI0SEL 11 | ||
85 | |||
86 | #if !defined(_FROM_ASM_) | ||
87 | #ifdef __cplusplus | ||
88 | extern "C" { | ||
89 | #endif | ||
90 | void boardInit(void); | ||
91 | #ifdef __cplusplus | ||
92 | } | ||
93 | #endif | ||
94 | #endif /* _FROM_ASM_ */ | ||
95 | |||
96 | #endif /* _BOARD_H_ */ | ||
diff --git a/lib/chibios/os/hal/boards/EA_LPCXPRESSO_BB_1114/board.mk b/lib/chibios/os/hal/boards/EA_LPCXPRESSO_BB_1114/board.mk new file mode 100644 index 000000000..f8b4a408f --- /dev/null +++ b/lib/chibios/os/hal/boards/EA_LPCXPRESSO_BB_1114/board.mk | |||
@@ -0,0 +1,9 @@ | |||
1 | # List of all the board related files. | ||
2 | BOARDSRC = ${CHIBIOS}/os/hal/boards/EA_LPCXPRESSO_BB_1114/board.c | ||
3 | |||
4 | # Required include directories | ||
5 | BOARDINC = ${CHIBIOS}/os/hal/boards/EA_LPCXPRESSO_BB_1114 | ||
6 | |||
7 | # Shared variables | ||
8 | ALLCSRC += $(BOARDSRC) | ||
9 | ALLINC += $(BOARDINC) | ||
diff --git a/lib/chibios/os/hal/boards/EA_LPCXPRESSO_BB_11U14/board.c b/lib/chibios/os/hal/boards/EA_LPCXPRESSO_BB_11U14/board.c new file mode 100644 index 000000000..7527e53ac --- /dev/null +++ b/lib/chibios/os/hal/boards/EA_LPCXPRESSO_BB_11U14/board.c | |||
@@ -0,0 +1,65 @@ | |||
1 | /* | ||
2 | ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio | ||
3 | |||
4 | Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | you may not use this file except in compliance with the License. | ||
6 | You may obtain a copy of the License at | ||
7 | |||
8 | http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | |||
10 | Unless required by applicable law or agreed to in writing, software | ||
11 | distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | See the License for the specific language governing permissions and | ||
14 | limitations under the License. | ||
15 | */ | ||
16 | |||
17 | #include "hal.h" | ||
18 | |||
19 | /** | ||
20 | * @brief PAL setup. | ||
21 | * @details Digital I/O ports static configuration as defined in @p board.h. | ||
22 | * This variable is used by the HAL when initializing the PAL driver. | ||
23 | */ | ||
24 | #if HAL_USE_PAL || defined(__DOXYGEN__) | ||
25 | const PALConfig pal_default_config = { | ||
26 | {VAL_GPIO0DATA, VAL_GPIO0DIR}, | ||
27 | {VAL_GPIO1DATA, VAL_GPIO1DIR} | ||
28 | }; | ||
29 | #endif | ||
30 | |||
31 | /* | ||
32 | * Early initialization code. | ||
33 | * This initialization must be performed just after stack setup and before | ||
34 | * any other initialization. | ||
35 | */ | ||
36 | void __early_init(void) { | ||
37 | |||
38 | lpc_clock_init(); | ||
39 | } | ||
40 | |||
41 | /* | ||
42 | * Board-specific initialization code. | ||
43 | */ | ||
44 | void boardInit(void) { | ||
45 | |||
46 | /* | ||
47 | * Extra, board-specific, initializations. | ||
48 | * NOTE: PIO1_2 is associated also to the JTAG, if you need to use JTAG | ||
49 | * you must comment that line first. | ||
50 | */ | ||
51 | LPC_IOCON->PIO0_7 = 0x80; /* Disables pull-up on LED2 output. */ | ||
52 | LPC_IOCON->TRST_PIO0_14 = 0x81; /* Disables pull-up on LED3B output | ||
53 | and makes it GPIO1_2. */ | ||
54 | LPC_IOCON->PIO0_21 = 0x80; /* Disables pull-up on LED3R output.*/ | ||
55 | LPC_IOCON->PIO0_22 = 0x80; /* Disables pull-up on LED3G output.*/ | ||
56 | |||
57 | /* SSP0 mapping.*/ | ||
58 | LPC_IOCON->PIO1_29 = 0x81; /* SCK0 without resistors. */ | ||
59 | LPC_IOCON->PIO0_8 = 0x81; /* MISO0 without resistors. */ | ||
60 | LPC_IOCON->PIO0_9 = 0x81; /* MOSI0 without resistors. */ | ||
61 | |||
62 | /* USART mapping.*/ | ||
63 | LPC_IOCON->PIO0_18 = 0x81; /* RDX without resistors. */ | ||
64 | LPC_IOCON->PIO0_19 = 0x81; /* TDX without resistors. */ | ||
65 | } | ||
diff --git a/lib/chibios/os/hal/boards/EA_LPCXPRESSO_BB_11U14/board.h b/lib/chibios/os/hal/boards/EA_LPCXPRESSO_BB_11U14/board.h new file mode 100644 index 000000000..1abfcfb28 --- /dev/null +++ b/lib/chibios/os/hal/boards/EA_LPCXPRESSO_BB_11U14/board.h | |||
@@ -0,0 +1,88 @@ | |||
1 | /* | ||
2 | ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio | ||
3 | |||
4 | Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | you may not use this file except in compliance with the License. | ||
6 | You may obtain a copy of the License at | ||
7 | |||
8 | http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | |||
10 | Unless required by applicable law or agreed to in writing, software | ||
11 | distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | See the License for the specific language governing permissions and | ||
14 | limitations under the License. | ||
15 | */ | ||
16 | |||
17 | #ifndef _BOARD_H_ | ||
18 | #define _BOARD_H_ | ||
19 | |||
20 | /* | ||
21 | * Setup for Embedded Artists LPCXpresso Base Board with LPC1114 daughter | ||
22 | * board. | ||
23 | */ | ||
24 | |||
25 | /* | ||
26 | * Board identifiers. | ||
27 | */ | ||
28 | #define BOARD_EA_BB_LPC11U14 | ||
29 | #define BOARD_NAME "Embedded Artists LPCXpresso Base Board + LPC11U14" | ||
30 | |||
31 | /* | ||
32 | * Board frequencies. | ||
33 | */ | ||
34 | #define SYSOSCCLK 12000000 | ||
35 | |||
36 | /* | ||
37 | * SCK0 connection on this board. | ||
38 | */ | ||
39 | #define LPC11xx_SPI_SCK0_SELECTOR SCK0_IS_PIO2_11 | ||
40 | |||
41 | /* | ||
42 | * GPIO 0 initial setup. | ||
43 | */ | ||
44 | #define VAL_GPIO0DIR PAL_PORT_BIT(GPIO0_OLEDSEL) | \ | ||
45 | PAL_PORT_BIT(GPIO0_USB_DPCTL) | \ | ||
46 | PAL_PORT_BIT(GPIO0_LED2) | \ | ||
47 | PAL_PORT_BIT(GPIO0_LED3B) | \ | ||
48 | PAL_PORT_BIT(GPIO0_LED3R) | \ | ||
49 | PAL_PORT_BIT(GPIO0_LED3G) | \ | ||
50 | PAL_PORT_BIT(GPIO0_SPI0SEL) | ||
51 | #define VAL_GPIO0DATA PAL_PORT_BIT(GPIO0_OLEDSEL) | \ | ||
52 | PAL_PORT_BIT(GPIO0_LED2) | \ | ||
53 | PAL_PORT_BIT(GPIO0_LED3B) | \ | ||
54 | PAL_PORT_BIT(GPIO0_LED3R) | \ | ||
55 | PAL_PORT_BIT(GPIO0_LED3G) | \ | ||
56 | PAL_PORT_BIT(GPIO0_SPI0SEL) | ||
57 | |||
58 | /* | ||
59 | * GPIO 1 initial setup. | ||
60 | */ | ||
61 | #define VAL_GPIO1DIR 0x00000000 | ||
62 | #define VAL_GPIO1DATA 0x00000000 | ||
63 | |||
64 | /* | ||
65 | * Pin definitions. | ||
66 | */ | ||
67 | #define GPIO0_SW3 1 | ||
68 | #define GPIO0_OLEDSEL 2 | ||
69 | #define GPIO0_USB_VBUS 3 | ||
70 | #define GPIO0_USB_DPCTL 6 | ||
71 | #define GPIO0_LED2 7 | ||
72 | #define GPIO0_SW4 16 | ||
73 | #define GPIO0_LED3B 14 | ||
74 | #define GPIO0_LED3R 21 | ||
75 | #define GPIO0_LED3G 22 | ||
76 | #define GPIO0_SPI0SEL 23 | ||
77 | |||
78 | #if !defined(_FROM_ASM_) | ||
79 | #ifdef __cplusplus | ||
80 | extern "C" { | ||
81 | #endif | ||
82 | void boardInit(void); | ||
83 | #ifdef __cplusplus | ||
84 | } | ||
85 | #endif | ||
86 | #endif /* _FROM_ASM_ */ | ||
87 | |||
88 | #endif /* _BOARD_H_ */ | ||
diff --git a/lib/chibios/os/hal/boards/EA_LPCXPRESSO_BB_11U14/board.mk b/lib/chibios/os/hal/boards/EA_LPCXPRESSO_BB_11U14/board.mk new file mode 100644 index 000000000..23b610268 --- /dev/null +++ b/lib/chibios/os/hal/boards/EA_LPCXPRESSO_BB_11U14/board.mk | |||
@@ -0,0 +1,9 @@ | |||
1 | # List of all the board related files. | ||
2 | BOARDSRC = ${CHIBIOS}/os/hal/boards/EA_LPCXPRESSO_BB_11U14/board.c | ||
3 | |||
4 | # Required include directories | ||
5 | BOARDINC = ${CHIBIOS}/os/hal/boards/EA_LPCXPRESSO_BB_11U14 | ||
6 | |||
7 | # Shared variables | ||
8 | ALLCSRC += $(BOARDSRC) | ||
9 | ALLINC += $(BOARDINC) | ||
diff --git a/lib/chibios/os/hal/boards/EA_LPCXPRESSO_BB_1343/board.c b/lib/chibios/os/hal/boards/EA_LPCXPRESSO_BB_1343/board.c new file mode 100644 index 000000000..223cd6704 --- /dev/null +++ b/lib/chibios/os/hal/boards/EA_LPCXPRESSO_BB_1343/board.c | |||
@@ -0,0 +1,58 @@ | |||
1 | /* | ||
2 | ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio | ||
3 | |||
4 | Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | you may not use this file except in compliance with the License. | ||
6 | You may obtain a copy of the License at | ||
7 | |||
8 | http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | |||
10 | Unless required by applicable law or agreed to in writing, software | ||
11 | distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | See the License for the specific language governing permissions and | ||
14 | limitations under the License. | ||
15 | */ | ||
16 | |||
17 | #include "hal.h" | ||
18 | |||
19 | /** | ||
20 | * @brief PAL setup. | ||
21 | * @details Digital I/O ports static configuration as defined in @p board.h. | ||
22 | * This variable is used by the HAL when initializing the PAL driver. | ||
23 | */ | ||
24 | #if HAL_USE_PAL || defined(__DOXYGEN__) | ||
25 | const PALConfig pal_default_config = { | ||
26 | {VAL_GPIO0DATA, VAL_GPIO0DIR}, | ||
27 | {VAL_GPIO1DATA, VAL_GPIO1DIR}, | ||
28 | {VAL_GPIO2DATA, VAL_GPIO2DIR}, | ||
29 | {VAL_GPIO3DATA, VAL_GPIO3DIR}, | ||
30 | }; | ||
31 | #endif | ||
32 | |||
33 | /* | ||
34 | * Early initialization code. | ||
35 | * This initialization must be performed just after stack setup and before | ||
36 | * any other initialization. | ||
37 | */ | ||
38 | void __early_init(void) { | ||
39 | |||
40 | LPC13xx_clock_init(); | ||
41 | } | ||
42 | |||
43 | /* | ||
44 | * Board-specific initialization code. | ||
45 | */ | ||
46 | void boardInit(void) { | ||
47 | |||
48 | /* | ||
49 | * Extra, board-specific, initializations. | ||
50 | * NOTE: PIO1_2 is associated also to the JTAG, if you need to use JTAG | ||
51 | * you must comment that line first. | ||
52 | */ | ||
53 | LPC_IOCON->PIO0_7 = 0xC0; /* Disables pull-up on LED2 output. */ | ||
54 | LPC_IOCON->R_PIO1_2 = 0xC1; /* Disables pull-up on LED3B output | ||
55 | and makes it GPIO1_2. */ | ||
56 | LPC_IOCON->PIO1_9 = 0xC0; /* Disables pull-up on LED3R output.*/ | ||
57 | LPC_IOCON->PIO1_10 = 0xC0; /* Disables pull-up on LED3G output.*/ | ||
58 | } | ||
diff --git a/lib/chibios/os/hal/boards/EA_LPCXPRESSO_BB_1343/board.h b/lib/chibios/os/hal/boards/EA_LPCXPRESSO_BB_1343/board.h new file mode 100644 index 000000000..b86b11042 --- /dev/null +++ b/lib/chibios/os/hal/boards/EA_LPCXPRESSO_BB_1343/board.h | |||
@@ -0,0 +1,91 @@ | |||
1 | /* | ||
2 | ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio | ||
3 | |||
4 | Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | you may not use this file except in compliance with the License. | ||
6 | You may obtain a copy of the License at | ||
7 | |||
8 | http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | |||
10 | Unless required by applicable law or agreed to in writing, software | ||
11 | distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | See the License for the specific language governing permissions and | ||
14 | limitations under the License. | ||
15 | */ | ||
16 | |||
17 | #ifndef _BOARD_H_ | ||
18 | #define _BOARD_H_ | ||
19 | |||
20 | /* | ||
21 | * Setup for Embedded Artists LPCXpresso Base Board with LPC1343 daughter | ||
22 | * board. | ||
23 | */ | ||
24 | |||
25 | /* | ||
26 | * Board identifiers. | ||
27 | */ | ||
28 | #define BOARD_EA_BB_LPC1343 | ||
29 | #define BOARD_NAME "Embedded Artists LPCXpresso Base Board + LPC1343" | ||
30 | |||
31 | /* | ||
32 | * Board frequencies. | ||
33 | */ | ||
34 | #define SYSOSCCLK 12000000 | ||
35 | |||
36 | /* | ||
37 | * GPIO 0 initial setup. | ||
38 | */ | ||
39 | #define VAL_GPIO0DIR PAL_PORT_BIT(GPIO0_OLEDSEL) | \ | ||
40 | PAL_PORT_BIT(GPIO0_LED2) | ||
41 | #define VAL_GPIO0DATA PAL_PORT_BIT(GPIO0_OLEDSEL) | \ | ||
42 | PAL_PORT_BIT(GPIO0_LED2) | ||
43 | |||
44 | /* | ||
45 | * GPIO 1 initial setup. | ||
46 | */ | ||
47 | #define VAL_GPIO1DIR PAL_PORT_BIT(GPIO1_LED3B) | \ | ||
48 | PAL_PORT_BIT(GPIO1_LED3R) | \ | ||
49 | PAL_PORT_BIT(GPIO1_LED3G) | \ | ||
50 | PAL_PORT_BIT(GPIO1_SPI0SEL) | ||
51 | #define VAL_GPIO1DATA PAL_PORT_BIT(GPIO1_LED3B) | \ | ||
52 | PAL_PORT_BIT(GPIO1_LED3R) | \ | ||
53 | PAL_PORT_BIT(GPIO1_LED3G) | \ | ||
54 | PAL_PORT_BIT(GPIO1_SPI0SEL) | ||
55 | |||
56 | /* | ||
57 | * GPIO 2 initial setup. | ||
58 | */ | ||
59 | #define VAL_GPIO2DIR 0x00000000 | ||
60 | #define VAL_GPIO2DATA 0x00000000 | ||
61 | |||
62 | /* | ||
63 | * GPIO 3 initial setup. | ||
64 | */ | ||
65 | #define VAL_GPIO3DIR 0x00000000 | ||
66 | #define VAL_GPIO3DATA 0x00000000 | ||
67 | |||
68 | /* | ||
69 | * Pin definitions. | ||
70 | */ | ||
71 | #define GPIO0_SW3 1 | ||
72 | #define GPIO0_OLEDSEL 2 | ||
73 | #define GPIO0_LED2 7 | ||
74 | |||
75 | #define GPIO1_LED3B 2 | ||
76 | #define GPIO1_SW4 4 | ||
77 | #define GPIO1_LED3R 9 | ||
78 | #define GPIO1_LED3G 10 | ||
79 | #define GPIO1_SPI0SEL 11 | ||
80 | |||
81 | #if !defined(_FROM_ASM_) | ||
82 | #ifdef __cplusplus | ||
83 | extern "C" { | ||
84 | #endif | ||
85 | void boardInit(void); | ||
86 | #ifdef __cplusplus | ||
87 | } | ||
88 | #endif | ||
89 | #endif /* _FROM_ASM_ */ | ||
90 | |||
91 | #endif /* _BOARD_H_ */ | ||
diff --git a/lib/chibios/os/hal/boards/EA_LPCXPRESSO_BB_1343/board.mk b/lib/chibios/os/hal/boards/EA_LPCXPRESSO_BB_1343/board.mk new file mode 100644 index 000000000..92d2d7615 --- /dev/null +++ b/lib/chibios/os/hal/boards/EA_LPCXPRESSO_BB_1343/board.mk | |||
@@ -0,0 +1,9 @@ | |||
1 | # List of all the board related files. | ||
2 | BOARDSRC = ${CHIBIOS}/os/hal/boards/EA_LPCXPRESSO_BB_1343/board.c | ||
3 | |||
4 | # Required include directories | ||
5 | BOARDINC = ${CHIBIOS}/os/hal/boards/EA_LPCXPRESSO_BB_1343 | ||
6 | |||
7 | # Shared variables | ||
8 | ALLCSRC += $(BOARDSRC) | ||
9 | ALLINC += $(BOARDINC) | ||
diff --git a/lib/chibios/os/hal/boards/EA_LPCXPRESSO_LPC812/board.c b/lib/chibios/os/hal/boards/EA_LPCXPRESSO_LPC812/board.c new file mode 100644 index 000000000..296d6d686 --- /dev/null +++ b/lib/chibios/os/hal/boards/EA_LPCXPRESSO_LPC812/board.c | |||
@@ -0,0 +1,135 @@ | |||
1 | /* | ||
2 | ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio | ||
3 | |||
4 | Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | you may not use this file except in compliance with the License. | ||
6 | You may obtain a copy of the License at | ||
7 | |||
8 | http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | |||
10 | Unless required by applicable law or agreed to in writing, software | ||
11 | distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | See the License for the specific language governing permissions and | ||
14 | limitations under the License. | ||
15 | */ | ||
16 | |||
17 | #include "hal.h" | ||
18 | |||
19 | /** | ||
20 | * @brief PAL setup. | ||
21 | * @details Digital I/O ports static configuration as defined in @p board.h. | ||
22 | * This variable is used by the HAL when initializing the PAL driver. | ||
23 | */ | ||
24 | #if HAL_USE_PAL || defined(__DOXYGEN__) | ||
25 | const PALConfig pal_default_config = {VAL_GPIO0DATA, VAL_GPIO0DIR}; | ||
26 | #endif | ||
27 | |||
28 | /* | ||
29 | * Early initialization code. | ||
30 | * This initialization must be performed just after stack setup and before | ||
31 | * any other initialization. | ||
32 | */ | ||
33 | void __early_init(void){ | ||
34 | |||
35 | lpc8xx_clock_init(); | ||
36 | } | ||
37 | |||
38 | /* | ||
39 | * Board-specific initialization code. | ||
40 | */ | ||
41 | void boardInit(void){ | ||
42 | |||
43 | /* Enable clocks to IOCON & SWM */ | ||
44 | LPC_SYSCON->SYSAHBCLKCTRL |= ((1<<18)|(1<<7)); | ||
45 | |||
46 | #if defined VAL_PIO0_0 | ||
47 | LPC_IOCON->PIO0_0 = PIN_RSVD|VAL_PIO0_0; | ||
48 | #endif | ||
49 | #if defined VAL_PIO0_1 | ||
50 | LPC_IOCON->PIO0_1 = PIN_RSVD|VAL_PIO0_1; | ||
51 | #endif | ||
52 | #if defined VAL_PIO0_2 | ||
53 | LPC_IOCON->PIO0_2 = PIN_RSVD|VAL_PIO0_2; | ||
54 | #endif | ||
55 | #if defined VAL_PIO0_3 | ||
56 | LPC_IOCON->PIO0_3 = PIN_RSVD|VAL_PIO0_3; | ||
57 | #endif | ||
58 | #if defined VAL_PIO0_4 | ||
59 | LPC_IOCON->PIO0_4 = PIN_RSVD|VAL_PIO0_4; | ||
60 | #endif | ||
61 | #if defined VAL_PIO0_5 | ||
62 | LPC_IOCON->PIO0_5 = PIN_RSVD|VAL_PIO0_5; | ||
63 | #endif | ||
64 | #if defined VAL_PIO0_6 | ||
65 | LPC_IOCON->PIO0_6 = PIN_RSVD|VAL_PIO0_6; | ||
66 | #endif | ||
67 | #if defined VAL_PIO0_7 | ||
68 | LPC_IOCON->PIO0_7 = PIN_RSVD|VAL_PIO0_7; | ||
69 | #endif | ||
70 | #if defined VAL_PIO0_8 | ||
71 | LPC_IOCON->PIO0_8 = PIN_RSVD|VAL_PIO0_8; | ||
72 | #endif | ||
73 | #if defined VAL_PIO0_9 | ||
74 | LPC_IOCON->PIO0_9 = PIN_RSVD|VAL_PIO0_9; | ||
75 | #endif | ||
76 | #if defined VAL_PIO0_10 | ||
77 | LPC_IOCON->PIO0_10 = PIN_RSVD|VAL_PIO0_10; | ||
78 | #endif | ||
79 | #if defined VAL_PIO0_11 | ||
80 | LPC_IOCON->PIO0_11 = PIN_RSVD|VAL_PIO0_11; | ||
81 | #endif | ||
82 | #if defined VAL_PIO0_12 | ||
83 | LPC_IOCON->PIO0_12 = PIN_RSVD|VAL_PIO0_12; | ||
84 | #endif | ||
85 | #if defined VAL_PIO0_13 | ||
86 | LPC_IOCON->PIO0_13 = PIN_RSVD|VAL_PIO0_13; | ||
87 | #endif | ||
88 | #if defined VAL_PIO0_14 | ||
89 | LPC_IOCON->PIO0_14 = PIN_RSVD|VAL_PIO0_14; | ||
90 | #endif | ||
91 | #if defined VAL_PIO0_15 | ||
92 | LPC_IOCON->PIO0_15 = PIN_RSVD|VAL_PIO0_15; | ||
93 | #endif | ||
94 | #if defined VAL_PIO0_16 | ||
95 | LPC_IOCON->PIO0_16 = PIN_RSVD|VAL_PIO0_16; | ||
96 | #endif | ||
97 | #if defined VAL_PIO0_17 | ||
98 | LPC_IOCON->PIO0_17 = PIN_RSVD|VAL_PIO0_17; | ||
99 | #endif | ||
100 | |||
101 | |||
102 | #if defined VAL_PINASSIGN0 | ||
103 | LPC_SWM->PINASSIGN0 = VAL_PINASSIGN0; | ||
104 | #endif | ||
105 | #if defined VAL_PINASSIGN1 | ||
106 | LPC_SWM->PINASSIGN1 = VAL_PINASSIGN1; | ||
107 | #endif | ||
108 | #if defined VAL_PINASSIGN2 | ||
109 | LPC_SWM->PINASSIGN2 = VAL_PINASSIGN2; | ||
110 | #endif | ||
111 | #if defined VAL_PINASSIGN3 | ||
112 | LPC_SWM->PINASSIGN3 = VAL_PINASSIGN3; | ||
113 | #endif | ||
114 | #if defined VAL_PINASSIGN4 | ||
115 | LPC_SWM->PINASSIGN4 = VAL_PINASSIGN4; | ||
116 | #endif | ||
117 | #if defined VAL_PINASSIGN5 | ||
118 | LPC_SWM->PINASSIGN5 = VAL_PINASSIGN5; | ||
119 | #endif | ||
120 | #if defined VAL_PINASSIGN6 | ||
121 | LPC_SWM->PINASSIGN6 = VAL_PINASSIGN6; | ||
122 | #endif | ||
123 | #if defined VAL_PINASSIGN7 | ||
124 | LPC_SWM->PINASSIGN7 = VAL_PINASSIGN7; | ||
125 | #endif | ||
126 | #if defined VAL_PINASSIGN8 | ||
127 | LPC_SWM->PINASSIGN8 = VAL_PINASSIGN8; | ||
128 | #endif | ||
129 | |||
130 | /* Disable clocks to IOCON & SWM */ | ||
131 | LPC_SYSCON->SYSAHBCLKCTRL &= ~((1<<18)|(1<<7)); | ||
132 | |||
133 | } | ||
134 | |||
135 | |||
diff --git a/lib/chibios/os/hal/boards/EA_LPCXPRESSO_LPC812/board.h b/lib/chibios/os/hal/boards/EA_LPCXPRESSO_LPC812/board.h new file mode 100644 index 000000000..559ac7a04 --- /dev/null +++ b/lib/chibios/os/hal/boards/EA_LPCXPRESSO_LPC812/board.h | |||
@@ -0,0 +1,125 @@ | |||
1 | /* | ||
2 | ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio | ||
3 | |||
4 | Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | you may not use this file except in compliance with the License. | ||
6 | You may obtain a copy of the License at | ||
7 | |||
8 | http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | |||
10 | Unless required by applicable law or agreed to in writing, software | ||
11 | distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | See the License for the specific language governing permissions and | ||
14 | limitations under the License. | ||
15 | */ | ||
16 | |||
17 | #ifndef _BOARD_H_ | ||
18 | #define _BOARD_H_ | ||
19 | |||
20 | /* | ||
21 | * Setup for Embedded Artists LPCXpresso LPC812 board. | ||
22 | */ | ||
23 | |||
24 | /* | ||
25 | * Board identifiers. | ||
26 | */ | ||
27 | #define BOARD_EA_LPC812 | ||
28 | #define BOARD_NAME "Embedded Artists LPCXpresso LPC812" | ||
29 | |||
30 | /* | ||
31 | * Board frequencies. | ||
32 | */ | ||
33 | #define SYSOSCCLK 12000000 | ||
34 | |||
35 | |||
36 | /* | ||
37 | * I/O ports initial setup, this configuration is established soon after reset | ||
38 | * in the initialization code. | ||
39 | * Please refer to the LPC8xx Reference Manual for details. | ||
40 | */ | ||
41 | /* Pull-up/down */ | ||
42 | #define PIN_MODE_NOPULL (0<<3) | ||
43 | #define PIN_MODE_PULLDOWN (1<<3) | ||
44 | #define PIN_MODE_PULLUP (2<<3) | ||
45 | #define PIN_MODE_REPEATER (3<<3) | ||
46 | /* Hysteresis */ | ||
47 | #define PIN_HYS_EN (1<<5) | ||
48 | /* Invert Input */ | ||
49 | #define PIN_INV_INPUT (1<<6) | ||
50 | /* Reserved bits */ | ||
51 | #define PIN_RSVD (1<<7) | ||
52 | /* I2C Mode */ | ||
53 | #define PIN_I2CMODE_STD (0<<8) | ||
54 | #define PIN_I2CMODE_STDIO (1<<8) | ||
55 | #define PIN_I2CMODE_FAST (2<<8) | ||
56 | /* Open Drain */ | ||
57 | #define PIN_OPEN_DRAIN (1<<10) | ||
58 | /* Input Filter Sample Clocks */ | ||
59 | #define PIN_SMODE_FILTER(n) ((n)<<11) | ||
60 | /* Input Filter clock divider */ | ||
61 | #define PIN_CLKDIV_FILTER(n) ((n)<<13) | ||
62 | |||
63 | /* | ||
64 | * Pin definitions. | ||
65 | */ | ||
66 | #define LED_RED 7 | ||
67 | #define LED_BLUE 16 | ||
68 | #define LED_GREEN 17 | ||
69 | |||
70 | |||
71 | /* | ||
72 | * GPIO 0 initial setup. | ||
73 | */ | ||
74 | /*#define VAL_PIO0_0 PIN_MODE_PULLUP*/ | ||
75 | /*#define VAL_PIO0_1 PIN_MODE_PULLUP*/ | ||
76 | /*#define VAL_PIO0_2 PIN_MODE_PULLUP*/ | ||
77 | /*#define VAL_PIO0_3 PIN_MODE_PULLUP*/ | ||
78 | /*#define VAL_PIO0_4 PIN_MODE_PULLUP*/ | ||
79 | /*#define VAL_PIO0_5 PIN_MODE_PULLUP*/ | ||
80 | /*#define VAL_PIO0_6 PIN_MODE_PULLUP*/ | ||
81 | #define VAL_PIO0_7 PIN_MODE_NOPULL | ||
82 | /*#define VAL_PIO0_8 PIN_MODE_PULLUP*/ | ||
83 | /*#define VAL_PIO0_9 PIN_MODE_PULLUP*/ | ||
84 | /*#define VAL_PIO0_10 PIN_MODE_PULLUP*/ | ||
85 | /*#define VAL_PIO0_11 PIN_MODE_PULLUP*/ | ||
86 | /*#define VAL_PIO0_12 PIN_MODE_PULLUP*/ | ||
87 | /*#define VAL_PIO0_13 PIN_MODE_PULLUP*/ | ||
88 | /*#define VAL_PIO0_14 PIN_MODE_PULLUP*/ | ||
89 | /*#define VAL_PIO0_15 PIN_MODE_PULLUP*/ | ||
90 | #define VAL_PIO0_16 PIN_MODE_NOPULL | ||
91 | #define VAL_PIO0_17 PIN_MODE_NOPULL | ||
92 | |||
93 | /* UART0: TXD = P0.4, RXD = P0.0)*/ | ||
94 | #define VAL_PINASSIGN0 ((0xFFFF0000) | (0<<8) | (4)) | ||
95 | /*#define VAL_PINASSIGN1 0xFFFFFFFF*/ | ||
96 | /*#define VAL_PINASSIGN2 0xFFFFFFFF*/ | ||
97 | /*#define VAL_PINASSIGN3 0xFFFFFFFF*/ | ||
98 | /*#define VAL_PINASSIGN4 0xFFFFFFFF*/ | ||
99 | /*#define VAL_PINASSIGN5 0xFFFFFFFF*/ | ||
100 | /*#define VAL_PINASSIGN6 0xFFFFFFFF*/ | ||
101 | /*#define VAL_PINASSIGN7 0xFFFFFFFF*/ | ||
102 | /*#define VAL_PINASSIGN8 0xFFFFFFFF*/ | ||
103 | |||
104 | |||
105 | #define VAL_GPIO0DIR (PAL_PORT_BIT(LED_RED) | \ | ||
106 | PAL_PORT_BIT(LED_BLUE) | \ | ||
107 | PAL_PORT_BIT(LED_GREEN)) | ||
108 | |||
109 | #define VAL_GPIO0DATA (PAL_PORT_BIT(LED_RED) | \ | ||
110 | PAL_PORT_BIT(LED_BLUE) | \ | ||
111 | PAL_PORT_BIT(LED_GREEN)) | ||
112 | |||
113 | |||
114 | #if !defined(_FROM_ASM_) | ||
115 | #ifdef __cplusplus | ||
116 | extern "C" { | ||
117 | #endif | ||
118 | void boardInit(void); | ||
119 | #ifdef __cplusplus | ||
120 | } | ||
121 | #endif | ||
122 | #endif /* _FROM_ASM_ */ | ||
123 | |||
124 | |||
125 | #endif /* _BOARD_H_ */ | ||
diff --git a/lib/chibios/os/hal/boards/EA_LPCXPRESSO_LPC812/board.mk b/lib/chibios/os/hal/boards/EA_LPCXPRESSO_LPC812/board.mk new file mode 100644 index 000000000..60953f3f7 --- /dev/null +++ b/lib/chibios/os/hal/boards/EA_LPCXPRESSO_LPC812/board.mk | |||
@@ -0,0 +1,9 @@ | |||
1 | # List of all the board related files. | ||
2 | BOARDSRC = ${CHIBIOS}/os/hal/boards/EA_LPCXPRESSO_LPC812/board.c | ||
3 | |||
4 | # Required include directories | ||
5 | BOARDINC = ${CHIBIOS}/os/hal/boards/EA_LPCXPRESSO_LPC812 | ||
6 | |||
7 | # Shared variables | ||
8 | ALLCSRC += $(BOARDSRC) | ||
9 | ALLINC += $(BOARDINC) | ||
diff --git a/lib/chibios/os/hal/boards/GOLDBULL_STM32_F107VC/board.c b/lib/chibios/os/hal/boards/GOLDBULL_STM32_F107VC/board.c new file mode 100644 index 000000000..e0d7b4c4a --- /dev/null +++ b/lib/chibios/os/hal/boards/GOLDBULL_STM32_F107VC/board.c | |||
@@ -0,0 +1,98 @@ | |||
1 | /* | ||
2 | ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio | ||
3 | |||
4 | Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | you may not use this file except in compliance with the License. | ||
6 | You may obtain a copy of the License at | ||
7 | |||
8 | http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | |||
10 | Unless required by applicable law or agreed to in writing, software | ||
11 | distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | See the License for the specific language governing permissions and | ||
14 | limitations under the License. | ||
15 | */ | ||
16 | |||
17 | #include "hal.h" | ||
18 | |||
19 | /** | ||
20 | * @brief PAL setup. | ||
21 | * @details Digital I/O ports static configuration as defined in @p board.h. | ||
22 | * This variable is used by the HAL when initializing the PAL driver. | ||
23 | */ | ||
24 | #if HAL_USE_PAL || defined(__DOXYGEN__) | ||
25 | const PALConfig pal_default_config = | ||
26 | { | ||
27 | {VAL_GPIOAODR, VAL_GPIOACRL, VAL_GPIOACRH}, | ||
28 | {VAL_GPIOBODR, VAL_GPIOBCRL, VAL_GPIOBCRH}, | ||
29 | {VAL_GPIOCODR, VAL_GPIOCCRL, VAL_GPIOCCRH}, | ||
30 | {VAL_GPIODODR, VAL_GPIODCRL, VAL_GPIODCRH}, | ||
31 | {VAL_GPIOEODR, VAL_GPIOECRL, VAL_GPIOECRH}, | ||
32 | }; | ||
33 | #endif | ||
34 | |||
35 | /* | ||
36 | * Early initialization code. | ||
37 | * This initialization must be performed just after stack setup and before | ||
38 | * any other initialization. | ||
39 | */ | ||
40 | void __early_init(void) { | ||
41 | |||
42 | stm32_clock_init(); | ||
43 | } | ||
44 | |||
45 | #if HAL_USE_MMC_SPI | ||
46 | /* | ||
47 | * Card detection through the card internal pull-up on D3. | ||
48 | */ | ||
49 | bool mmc_lld_is_card_inserted(MMCDriver *mmcp) { | ||
50 | |||
51 | (void)mmcp; | ||
52 | return !palReadPad(GPIOC, GPIOC_SPI3_SD_CD); | ||
53 | } | ||
54 | |||
55 | /* | ||
56 | * Card write protection detection is not possible, the card is always | ||
57 | * reported as not protected. | ||
58 | */ | ||
59 | bool mmc_lld_is_write_protected(MMCDriver *mmcp) { | ||
60 | |||
61 | (void)mmcp; | ||
62 | return FALSE; | ||
63 | } | ||
64 | #endif | ||
65 | |||
66 | /* | ||
67 | * Board-specific initialization code. | ||
68 | */ | ||
69 | void boardInit(void) { | ||
70 | |||
71 | /* | ||
72 | * Several I/O pins are re-mapped: | ||
73 | * USART3 to the PD8/PD9 pins. | ||
74 | * I2C1 to the PB8/PB9 pins. | ||
75 | * SPI3 to the PC10/PC11/PC12 pins. | ||
76 | */ | ||
77 | //AFIO->MAPR |= AFIO_MAPR_USART3_REMAP_FULLREMAP | | ||
78 | // AFIO_MAPR_I2C1_REMAP | | ||
79 | // AFIO_MAPR_SPI3_REMAP | | ||
80 | // AFIO_MAPR_ETH_REMAP; | ||
81 | /* | ||
82 | * Several I/O pins are re-mapped: | ||
83 | * . | ||
84 | */ | ||
85 | AFIO->MAPR |= AFIO_MAPR_ETH_REMAP | | ||
86 | AFIO_MAPR_I2C1_REMAP | | ||
87 | AFIO_MAPR_SPI3_REMAP | | ||
88 | AFIO_MAPR_CAN_REMAP_REMAP3 | | ||
89 | AFIO_MAPR_USART1_REMAP | | ||
90 | AFIO_MAPR_USART2_REMAP; | ||
91 | |||
92 | |||
93 | |||
94 | |||
95 | |||
96 | |||
97 | |||
98 | } | ||
diff --git a/lib/chibios/os/hal/boards/GOLDBULL_STM32_F107VC/board.h b/lib/chibios/os/hal/boards/GOLDBULL_STM32_F107VC/board.h new file mode 100644 index 000000000..8c106e810 --- /dev/null +++ b/lib/chibios/os/hal/boards/GOLDBULL_STM32_F107VC/board.h | |||
@@ -0,0 +1,254 @@ | |||
1 | /* | ||
2 | ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio | ||
3 | |||
4 | Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | you may not use this file except in compliance with the License. | ||
6 | You may obtain a copy of the License at | ||
7 | |||
8 | http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | |||
10 | Unless required by applicable law or agreed to in writing, software | ||
11 | distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | See the License for the specific language governing permissions and | ||
14 | limitations under the License. | ||
15 | */ | ||
16 | |||
17 | #ifndef _BOARD_H_ | ||
18 | #define _BOARD_H_ | ||
19 | |||
20 | /* | ||
21 | * Setup for the GoldBull STM32F107 V3 evaluation board. | ||
22 | */ | ||
23 | |||
24 | /* | ||
25 | * Board identifier. | ||
26 | */ | ||
27 | #define BOARD_GOLDBULL_STM32F107VC | ||
28 | #define BOARD_NAME "GoldBull STM32F107VC V3" | ||
29 | |||
30 | /* | ||
31 | * Board frequencies. | ||
32 | */ | ||
33 | #define STM32_LSECLK 32768 | ||
34 | #define STM32_HSECLK 25000000 | ||
35 | |||
36 | /* | ||
37 | * MCU type, supported types are defined in ./os/hal/platforms/hal_lld.h. | ||
38 | */ | ||
39 | #define STM32F107xC | ||
40 | |||
41 | /* | ||
42 | * Ethernet PHY type. | ||
43 | */ | ||
44 | #define BOARD_PHY_ID MII_DP83848I_ID | ||
45 | #define BOARD_PHY_RMII | ||
46 | |||
47 | /* | ||
48 | * IO pins assignments. | ||
49 | */ | ||
50 | #define GPIOA_SWITCH_WKUP 0 | ||
51 | #define GPIOB_SWITCH_USER 2 | ||
52 | #define GPIOC_SWITCH_TAMPER 13 | ||
53 | |||
54 | #define GPIOC_SPI3_SD_CS 3 | ||
55 | #define GPIOC_SPI3_SD_CD 2 | ||
56 | |||
57 | #define GPIOD_LED3 2 | ||
58 | #define GPIOD_LED4 3 | ||
59 | #define GPIOD_LED5 4 | ||
60 | #define GPIOD_LED6 7 | ||
61 | |||
62 | /* | ||
63 | * I/O ports initial setup, this configuration is established soon after reset | ||
64 | * in the initialization code. | ||
65 | * | ||
66 | * The digits have the following meaning: | ||
67 | * 0 - Analog input. | ||
68 | * 1 - Push Pull output 10MHz. | ||
69 | * 2 - Push Pull output 2MHz. | ||
70 | * 3 - Push Pull output 50MHz. | ||
71 | * 4 - Digital input. | ||
72 | * 5 - Open Drain output 10MHz. | ||
73 | * 6 - Open Drain output 2MHz. | ||
74 | * 7 - Open Drain output 50MHz. | ||
75 | * 8 - Digital input with PullUp or PullDown resistor depending on ODR. | ||
76 | * 9 - Alternate Push Pull output 10MHz. | ||
77 | * A - Alternate Push Pull output 2MHz. | ||
78 | * B - Alternate Push Pull output 50MHz. | ||
79 | * C - Reserved. | ||
80 | * D - Alternate Open Drain output 10MHz. | ||
81 | * E - Alternate Open Drain output 2MHz. | ||
82 | * F - Alternate Open Drain output 50MHz. | ||
83 | * Please refer to the STM32 Reference Manual for details. | ||
84 | */ | ||
85 | |||
86 | /* | ||
87 | * Port A setup. | ||
88 | * Everything input with pull-up except: | ||
89 | * PA0 - Normal input (WKUP BUTTON). | ||
90 | * PA1 - Normal input (ETH_RMII_REF_CLK). | ||
91 | * PA2 - Alternate output (ETH_RMII_MDIO). | ||
92 | * PA3 - Input with PU (TP_IRQ). | ||
93 | * PA4 - Push Pull output (TP_CS). | ||
94 | * PA5 - Alternate output (SPI1 SCK). | ||
95 | * PA6 - Input with PU (SPI1 MISO). | ||
96 | * PA7 - Alternate output (SPI1 MOSI). | ||
97 | * PA8 - Alternate output (MCO). | ||
98 | * PA9 - Normal input (OTG_VBUS). | ||
99 | * PA10 - Normal input (OTG_ID). | ||
100 | * PA11 - Normal input (OTG_DM). | ||
101 | * PA12 - Normal input (OTG_DP). | ||
102 | * PA13 - Normal input (TMS). | ||
103 | * PA14 - Normal input (TCK). | ||
104 | * PA15 - Normal input (TDI). | ||
105 | */ | ||
106 | #define VAL_GPIOACRL 0xB8B38B44 /* PA7...PA0 */ | ||
107 | #define VAL_GPIOACRH 0x4444444B /* PA15...PA8 */ | ||
108 | #define VAL_GPIOAODR 0xFFFFFFFF | ||
109 | |||
110 | /* | ||
111 | * 0 - Analog input. | ||
112 | * 1 - Push Pull output 10MHz. | ||
113 | * 2 - Push Pull output 2MHz. | ||
114 | * 3 - Push Pull output 50MHz. | ||
115 | * 4 - Digital input. | ||
116 | * 5 - Open Drain output 10MHz. | ||
117 | * 6 - Open Drain output 2MHz. | ||
118 | * 7 - Open Drain output 50MHz. | ||
119 | * 8 - Digital input with PullUp or PullDown resistor depending on ODR. | ||
120 | * 9 - Alternate Push Pull output 10MHz. | ||
121 | * A - Alternate Push Pull output 2MHz. | ||
122 | * B - Alternate Push Pull output 50MHz. | ||
123 | * C - Reserved. | ||
124 | * D - Alternate Open Drain output 10MHz. | ||
125 | * E - Alternate Open Drain output 2MHz. | ||
126 | * F - Alternate Open Drain output 50MHz. | ||
127 | */ | ||
128 | |||
129 | /* | ||
130 | * Port B setup: | ||
131 | * PB0 - Input with PU (unconnected). | ||
132 | * PB1 - Input with PU (unconnected). | ||
133 | * PB2 - Normal input (BOOT1, KEY_USER). | ||
134 | * PB3 - Normal input (TDO). | ||
135 | * PB4 - Normal input (TRST). | ||
136 | * PB5 - Input with PU (CAN2 RX). | ||
137 | * PB6 - Alternate output (USART1 TX, remapped). | ||
138 | * PB7 - Input with PU (USART1 RX, remapped). | ||
139 | * PB8 - Alternate O.D. (I2C1 SCL, remapped). | ||
140 | * PB9 - Alternate O.D. (I2C1 SDA, remapped). | ||
141 | * PB10 - Input with PU (BL_CNT). | ||
142 | * PB11 - Alternate output (ETH_RMII_TX_EN). | ||
143 | * PB12 - Alternate output (ETH_RMII_TXD0). | ||
144 | * PB13 - Alternate output (ETH_RMII_TXD1). | ||
145 | * PB14 - Input with PU (unconnected). | ||
146 | * PB15 - Input with PU (unconnected). | ||
147 | */ | ||
148 | #define VAL_GPIOBCRL 0x8B844488 /* PB7...PB0 */ | ||
149 | #define VAL_GPIOBCRH 0x88BBB8FF /* PB15...PB8 */ | ||
150 | #define VAL_GPIOBODR 0xFFFFFFFF | ||
151 | |||
152 | /* | ||
153 | * 0 - Analog input. | ||
154 | * 1 - Push Pull output 10MHz. | ||
155 | * 2 - Push Pull output 2MHz. | ||
156 | * 3 - Push Pull output 50MHz. | ||
157 | * 4 - Digital input. | ||
158 | * 5 - Open Drain output 10MHz. | ||
159 | * 6 - Open Drain output 2MHz. | ||
160 | * 7 - Open Drain output 50MHz. | ||
161 | * 8 - Digital input with PullUp or PullDown resistor depending on ODR. | ||
162 | * 9 - Alternate Push Pull output 10MHz. | ||
163 | * A - Alternate Push Pull output 2MHz. | ||
164 | * B - Alternate Push Pull output 50MHz. | ||
165 | * C - Reserved. | ||
166 | * D - Alternate Open Drain output 10MHz. | ||
167 | * E - Alternate Open Drain output 2MHz. | ||
168 | * F - Alternate Open Drain output 50MHz. | ||
169 | */ | ||
170 | |||
171 | /* | ||
172 | * Port C setup: | ||
173 | * PC0 - Analog input (ADC_IN). | ||
174 | * PC1 - Alternate output (ETH_MDC). | ||
175 | * PC2 - Input with PU (SD_CD). | ||
176 | * PC3 - Push Pull output (SD_CS). | ||
177 | * PC4 - Push Pull output (OTG_PW_ON). | ||
178 | * PC5 - Push Pull output (SF_CS). | ||
179 | * PC6 - Push Pull output (LCD_RD). | ||
180 | * PC7 - Push Pull output (LCD_WR). | ||
181 | * PC8 - Push Pull output (LCD_RS). | ||
182 | * PC9 - Push Pull output (LCD_CS). | ||
183 | * PC10 - Alternate output (SPI3 SCK). | ||
184 | * PC11 - Input with PU (SPI3 MISO). | ||
185 | * PC12 - Alternate output (SPI3 MOSI). | ||
186 | * PC13 - Normal input (KEY_TAMPER). | ||
187 | * PC14 - Normal input (OSC32 IN). | ||
188 | * PC15 - Normal input (OSC32 OUT). | ||
189 | */ | ||
190 | #define VAL_GPIOCCRL 0x333338B0 /* PC7...PC0 */ | ||
191 | #define VAL_GPIOCCRH 0x444B8B33 /* PC15...PC8 */ | ||
192 | #define VAL_GPIOCODR 0xFFFFFFFF | ||
193 | |||
194 | /* | ||
195 | * 0 - Analog input. | ||
196 | * 1 - Push Pull output 10MHz. | ||
197 | * 2 - Push Pull output 2MHz. | ||
198 | * 3 - Push Pull output 50MHz. | ||
199 | * 4 - Digital input. | ||
200 | * 5 - Open Drain output 10MHz. | ||
201 | * 6 - Open Drain output 2MHz. | ||
202 | * 7 - Open Drain output 50MHz. | ||
203 | * 8 - Digital input with PullUp or PullDown resistor depending on ODR. | ||
204 | * 9 - Alternate Push Pull output 10MHz. | ||
205 | * A - Alternate Push Pull output 2MHz. | ||
206 | * B - Alternate Push Pull output 50MHz. | ||
207 | * C - Reserved. | ||
208 | * D - Alternate Open Drain output 10MHz. | ||
209 | * E - Alternate Open Drain output 2MHz. | ||
210 | * F - Alternate Open Drain output 50MHz. | ||
211 | */ | ||
212 | |||
213 | /* | ||
214 | * Port D setup: | ||
215 | * PD0 - Input with PU (CAN1_RX, remapped). | ||
216 | * PD1 - Alternate output (CAN1_TX, remapped). | ||
217 | * PD2 - Push Pull output (LED3). | ||
218 | * PD3 - Push Pull output (LED4). | ||
219 | * PD4 - Push Pull output (LED5). | ||
220 | * PD5 - Alternate output (USART2 TX, remapped). | ||
221 | * PD6 - Input with PU (USART2 RX, remapped). | ||
222 | * PD7 - Push Pull output (LED6). | ||
223 | * PD8 - Normal input (ETH_RMII_CRS_DV, remapped). | ||
224 | * PD9 - Normal input (ETH_RMII_RXD0, remapped). | ||
225 | * PD10 - Normal input (ETH_RMII_RXD1, remapped). | ||
226 | * PD11 - Input with PU (JOY_UP). | ||
227 | * PD12 - Input with PU (JOY_DOWN). | ||
228 | * PD13 - Input with PU (JOY_LEFT). | ||
229 | * PD14 - Input with PU (JOY_RIGHT). | ||
230 | * PD15 - Input with PU (JOY_SEL). | ||
231 | */ | ||
232 | #define VAL_GPIODCRL 0x38B333B8 /* PD7...PD0 */ | ||
233 | #define VAL_GPIODCRH 0x88888444 /* PD15...PD8 */ | ||
234 | #define VAL_GPIODODR 0xFFFFFFFF | ||
235 | |||
236 | /* | ||
237 | * Port E setup. | ||
238 | * Everything input with pull-up except: | ||
239 | */ | ||
240 | #define VAL_GPIOECRL 0x88888888 /* PE7...PE0 */ | ||
241 | #define VAL_GPIOECRH 0x88888888 /* PE15...PE8 */ | ||
242 | #define VAL_GPIOEODR 0xFFFFFFFF | ||
243 | |||
244 | #if !defined(_FROM_ASM_) | ||
245 | #ifdef __cplusplus | ||
246 | extern "C" { | ||
247 | #endif | ||
248 | void boardInit(void); | ||
249 | #ifdef __cplusplus | ||
250 | } | ||
251 | #endif | ||
252 | #endif /* _FROM_ASM_ */ | ||
253 | |||
254 | #endif /* _BOARD_H_ */ | ||
diff --git a/lib/chibios/os/hal/boards/GOLDBULL_STM32_F107VC/board.mk b/lib/chibios/os/hal/boards/GOLDBULL_STM32_F107VC/board.mk new file mode 100644 index 000000000..fd1570a67 --- /dev/null +++ b/lib/chibios/os/hal/boards/GOLDBULL_STM32_F107VC/board.mk | |||
@@ -0,0 +1,9 @@ | |||
1 | # List of all the board related files. | ||
2 | BOARDSRC = ${CHIBIOS}/os/hal/boards/GOLDBULL_STM32_F107VC/board.c | ||
3 | |||
4 | # Required include directories | ||
5 | BOARDINC = ${CHIBIOS}/os/hal/boards/GOLDBULL_STM32_F107VC | ||
6 | |||
7 | # Shared variables | ||
8 | ALLCSRC += $(BOARDSRC) | ||
9 | ALLINC += $(BOARDINC) | ||
diff --git a/lib/chibios/os/hal/boards/MAPLEMINI_STM32_F103/board.c b/lib/chibios/os/hal/boards/MAPLEMINI_STM32_F103/board.c new file mode 100644 index 000000000..236dde472 --- /dev/null +++ b/lib/chibios/os/hal/boards/MAPLEMINI_STM32_F103/board.c | |||
@@ -0,0 +1,49 @@ | |||
1 | /* | ||
2 | ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio | ||
3 | |||
4 | Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | you may not use this file except in compliance with the License. | ||
6 | You may obtain a copy of the License at | ||
7 | |||
8 | http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | |||
10 | Unless required by applicable law or agreed to in writing, software | ||
11 | distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | See the License for the specific language governing permissions and | ||
14 | limitations under the License. | ||
15 | */ | ||
16 | |||
17 | #include "hal.h" | ||
18 | |||
19 | /** | ||
20 | * @brief PAL setup. | ||
21 | * @details Digital I/O ports static configuration as defined in @p board.h. | ||
22 | * This variable is used by the HAL when initializing the PAL driver. | ||
23 | */ | ||
24 | #if HAL_USE_PAL || defined(__DOXYGEN__) | ||
25 | const PALConfig pal_default_config = | ||
26 | { | ||
27 | {VAL_GPIOAODR, VAL_GPIOACRL, VAL_GPIOACRH}, | ||
28 | {VAL_GPIOBODR, VAL_GPIOBCRL, VAL_GPIOBCRH}, | ||
29 | {VAL_GPIOCODR, VAL_GPIOCCRL, VAL_GPIOCCRH}, | ||
30 | {VAL_GPIODODR, VAL_GPIODCRL, VAL_GPIODCRH}, | ||
31 | {VAL_GPIOEODR, VAL_GPIOECRL, VAL_GPIOECRH}, | ||
32 | }; | ||
33 | #endif | ||
34 | |||
35 | /* | ||
36 | * Early initialization code. | ||
37 | * This initialization must be performed just after stack setup and before | ||
38 | * any other initialization. | ||
39 | */ | ||
40 | void __early_init(void) { | ||
41 | |||
42 | stm32_clock_init(); | ||
43 | } | ||
44 | |||
45 | /* | ||
46 | * Board-specific initialization code. | ||
47 | */ | ||
48 | void boardInit(void) { | ||
49 | } | ||
diff --git a/lib/chibios/os/hal/boards/MAPLEMINI_STM32_F103/board.h b/lib/chibios/os/hal/boards/MAPLEMINI_STM32_F103/board.h new file mode 100644 index 000000000..ca9a860b2 --- /dev/null +++ b/lib/chibios/os/hal/boards/MAPLEMINI_STM32_F103/board.h | |||
@@ -0,0 +1,193 @@ | |||
1 | /* | ||
2 | ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio | ||
3 | |||
4 | Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | you may not use this file except in compliance with the License. | ||
6 | You may obtain a copy of the License at | ||
7 | |||
8 | http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | |||
10 | Unless required by applicable law or agreed to in writing, software | ||
11 | distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | See the License for the specific language governing permissions and | ||
14 | limitations under the License. | ||
15 | */ | ||
16 | |||
17 | #ifndef _BOARD_H_ | ||
18 | #define _BOARD_H_ | ||
19 | |||
20 | /* | ||
21 | * Setup for the LeafLabs Maple Mini. | ||
22 | */ | ||
23 | |||
24 | /* | ||
25 | * Board identifier. | ||
26 | */ | ||
27 | #define BOARD_MAPLEMINI_STM32_F103 | ||
28 | #define BOARD_NAME "LeafLabs Maple Mini" | ||
29 | |||
30 | /* | ||
31 | * Board frequencies. | ||
32 | */ | ||
33 | #define STM32_LSECLK 32768 | ||
34 | #define STM32_HSECLK 8000000 | ||
35 | |||
36 | /* | ||
37 | * MCU type, supported types are defined in ./os/hal/platforms/hal_lld.h. | ||
38 | */ | ||
39 | #define STM32F103xB | ||
40 | |||
41 | /* | ||
42 | * IO pins assignments | ||
43 | * | ||
44 | * numbering is sorted by onboard/connectors, as from the schematics in | ||
45 | * https://github.com/leaflabs/maplemini | ||
46 | */ | ||
47 | |||
48 | /* on-board */ | ||
49 | |||
50 | #define GPIOB_LED 1 | ||
51 | #define GPIOB_USB_DISC 9 | ||
52 | #define GPIOD_OSC_IN 0 | ||
53 | #define GPIOD_OSC_OUT 1 | ||
54 | |||
55 | /* J1 connector */ | ||
56 | |||
57 | // pin 1: AV+ | ||
58 | // pin 2: AV- | ||
59 | // pin 3: VBAT | ||
60 | #define GPIOC_TAMPER_RTC 13 // pin 4 | ||
61 | #define GPIOC_OSC32_IN 14 // pin 5 | ||
62 | #define GPIOC_OSD32_OUT 15 // pin 6 | ||
63 | // pin 7: RESET | ||
64 | #define GPIOA_USART2_CTS 0 // pin 8 | ||
65 | #define GPIOA_USART2_RTS 1 // pin 9 | ||
66 | #define GPIOA_USART2_TX 2 // pin 10 | ||
67 | #define GPIOA_USART2_RX 3 // pin 11 | ||
68 | #define GPIOA_SPI1_NSS 4 // pin 12 | ||
69 | #define GPIOA_SPI1_SCK 5 // pin 13 | ||
70 | #define GPIOA_SPI1_MISO 6 // pin 14 | ||
71 | #define GPIOA_SPI1_MOSI 7 // pin 15 | ||
72 | #define GPIOB_ADC12_IN8 0 // pin 16 | ||
73 | #define GPIOB_BOOT1 2 // pin 17 | ||
74 | #define GPIOB_I2C2_SCL 10 // pin 18 | ||
75 | #define GPIOB_I2C2_SDA 11 // pin 19 | ||
76 | // pin 20: VIN | ||
77 | |||
78 | /* J2 connector */ | ||
79 | |||
80 | #define GPIOB_SPI2_NSS 12 // pin 1 | ||
81 | #define GPIOB_SPI2_SCK 13 // pin 2 | ||
82 | #define GPIOB_SPI2_MISO 14 // pin 3 | ||
83 | #define GPIOB_SPI2_MOSI 15 // pin 4 | ||
84 | #define GPIOA_USART1_CK 8 // pin 5 | ||
85 | #define GPIOA_USART1_TX 9 // pin 6 | ||
86 | #define GPIOA_USART1_RX 10 // pin 7 | ||
87 | #define GPIOA_USBDM 11 // pin 8 | ||
88 | #define GPIOA_USBDP 12 // pin 9 | ||
89 | #define GPIOA_JTMS 13 // pin 10 | ||
90 | #define GPIOA_JTCK 14 // pin 11 | ||
91 | #define GPIOA_JTDI 15 // pin 12 | ||
92 | #define GPIOB_JTDO 3 // pin 13 | ||
93 | #define GPIOB_JTRST 4 // pin 14 | ||
94 | #define GPIOB_I2C1_SMBA 5 // pin 15 | ||
95 | #define GPIOB_I2C1_SCL 6 // pin 16 | ||
96 | #define GPIOB_I2C1_SDA 7 // pin 17 | ||
97 | #define GPIOB_BOOT0_BUTTON 8 // pin 18 | ||
98 | // pin 19: GND | ||
99 | // pin 20: VCC | ||
100 | |||
101 | /* | ||
102 | * I/O ports initial setup, this configuration is established soon after reset | ||
103 | * in the initialization code. | ||
104 | * | ||
105 | * The digits have the following meaning: | ||
106 | * 0 - Analog input. | ||
107 | * 1 - Push Pull output 10MHz. | ||
108 | * 2 - Push Pull output 2MHz. | ||
109 | * 3 - Push Pull output 50MHz. | ||
110 | * 4 - Digital input. | ||
111 | * 5 - Open Drain output 10MHz. | ||
112 | * 6 - Open Drain output 2MHz. | ||
113 | * 7 - Open Drain output 50MHz. | ||
114 | * 8 - Digital input with PullUp or PullDown resistor depending on ODR. | ||
115 | * 9 - Alternate Push Pull output 10MHz. | ||
116 | * A - Alternate Push Pull output 2MHz. | ||
117 | * B - Alternate Push Pull output 50MHz. | ||
118 | * C - Reserved. | ||
119 | * D - Alternate Open Drain output 10MHz. | ||
120 | * E - Alternate Open Drain output 2MHz. | ||
121 | * F - Alternate Open Drain output 50MHz. | ||
122 | * Please refer to the STM32 Reference Manual for details. | ||
123 | */ | ||
124 | |||
125 | /* | ||
126 | * Port A setup. | ||
127 | * Everything input with pull-up except: | ||
128 | * PA2 - Alternate output (USART2 TX). | ||
129 | * PA3 - Normal input (USART2 RX). | ||
130 | * PA9 - Alternate output (USART1 TX). | ||
131 | * PA10 - Normal input (USART1 RX). | ||
132 | */ | ||
133 | #define VAL_GPIOACRL 0x88884B88 /* PA7...PA0 */ | ||
134 | #define VAL_GPIOACRH 0x888884B8 /* PA15...PA8 */ | ||
135 | #define VAL_GPIOAODR 0xFFFFFFFF | ||
136 | |||
137 | /* | ||
138 | * Port B setup. | ||
139 | * Everything input with pull-up except: | ||
140 | * PB1 - Push Pull output (LED). | ||
141 | * PB9 - Push Pull output (USB switch). | ||
142 | */ | ||
143 | #define VAL_GPIOBCRL 0x88888838 /* PB7...PB0 */ | ||
144 | #define VAL_GPIOBCRH 0x88888838 /* PB15...PB8 */ | ||
145 | #define VAL_GPIOBODR 0xFFFFFFFF | ||
146 | |||
147 | /* | ||
148 | * Port C setup. | ||
149 | * Everything input with pull-up except: | ||
150 | */ | ||
151 | #define VAL_GPIOCCRL 0x88888888 /* PC7...PC0 */ | ||
152 | #define VAL_GPIOCCRH 0x88888888 /* PC15...PC8 */ | ||
153 | #define VAL_GPIOCODR 0xFFFFFFFF | ||
154 | |||
155 | /* | ||
156 | * Port D setup. | ||
157 | * Everything input with pull-up except: | ||
158 | * PD0 - Normal input (XTAL). | ||
159 | * PD1 - Normal input (XTAL). | ||
160 | */ | ||
161 | #define VAL_GPIODCRL 0x88888844 /* PD7...PD0 */ | ||
162 | #define VAL_GPIODCRH 0x88888888 /* PD15...PD8 */ | ||
163 | #define VAL_GPIODODR 0xFFFFFFFF | ||
164 | |||
165 | /* | ||
166 | * Port E setup. | ||
167 | * Everything input with pull-up except: | ||
168 | */ | ||
169 | #define VAL_GPIOECRL 0x88888888 /* PE7...PE0 */ | ||
170 | #define VAL_GPIOECRH 0x88888888 /* PE15...PE8 */ | ||
171 | #define VAL_GPIOEODR 0xFFFFFFFF | ||
172 | |||
173 | /* | ||
174 | * USB bus activation macro, required by the USB driver. | ||
175 | */ | ||
176 | #define usb_lld_connect_bus(usbp) palClearPad(GPIOB, GPIOB_USB_DISC) | ||
177 | |||
178 | /* | ||
179 | * USB bus de-activation macro, required by the USB driver. | ||
180 | */ | ||
181 | #define usb_lld_disconnect_bus(usbp) palSetPad(GPIOB, GPIOB_USB_DISC) | ||
182 | |||
183 | #if !defined(_FROM_ASM_) | ||
184 | #ifdef __cplusplus | ||
185 | extern "C" { | ||
186 | #endif | ||
187 | void boardInit(void); | ||
188 | #ifdef __cplusplus | ||
189 | } | ||
190 | #endif | ||
191 | #endif /* _FROM_ASM_ */ | ||
192 | |||
193 | #endif /* _BOARD_H_ */ | ||
diff --git a/lib/chibios/os/hal/boards/MAPLEMINI_STM32_F103/board.mk b/lib/chibios/os/hal/boards/MAPLEMINI_STM32_F103/board.mk new file mode 100644 index 000000000..95ae22e83 --- /dev/null +++ b/lib/chibios/os/hal/boards/MAPLEMINI_STM32_F103/board.mk | |||
@@ -0,0 +1,9 @@ | |||
1 | # List of all the board related files. | ||
2 | BOARDSRC = ${CHIBIOS}/os/hal/boards/MAPLEMINI_STM32_F103/board.c | ||
3 | |||
4 | # Required include directories | ||
5 | BOARDINC = ${CHIBIOS}/os/hal/boards/MAPLEMINI_STM32_F103 | ||
6 | |||
7 | # Shared variables | ||
8 | ALLCSRC += $(BOARDSRC) | ||
9 | ALLINC += $(BOARDINC) | ||
diff --git a/lib/chibios/os/hal/boards/MIKROE_CLICKER2_STM32/board.c b/lib/chibios/os/hal/boards/MIKROE_CLICKER2_STM32/board.c new file mode 100644 index 000000000..9ff3f758c --- /dev/null +++ b/lib/chibios/os/hal/boards/MIKROE_CLICKER2_STM32/board.c | |||
@@ -0,0 +1,266 @@ | |||
1 | /* | ||
2 | ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio | ||
3 | |||
4 | Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | you may not use this file except in compliance with the License. | ||
6 | You may obtain a copy of the License at | ||
7 | |||
8 | http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | |||
10 | Unless required by applicable law or agreed to in writing, software | ||
11 | distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | See the License for the specific language governing permissions and | ||
14 | limitations under the License. | ||
15 | */ | ||
16 | |||
17 | /* | ||
18 | * This file has been automatically generated using ChibiStudio board | ||
19 | * generator plugin. Do not edit manually. | ||
20 | */ | ||
21 | |||
22 | #include "hal.h" | ||
23 | #include "stm32_gpio.h" | ||
24 | |||
25 | /*===========================================================================*/ | ||
26 | /* Driver local definitions. */ | ||
27 | /*===========================================================================*/ | ||
28 | |||
29 | /*===========================================================================*/ | ||
30 | /* Driver exported variables. */ | ||
31 | /*===========================================================================*/ | ||
32 | |||
33 | /*===========================================================================*/ | ||
34 | /* Driver local variables and types. */ | ||
35 | /*===========================================================================*/ | ||
36 | |||
37 | /** | ||
38 | * @brief Type of STM32 GPIO port setup. | ||
39 | */ | ||
40 | typedef struct { | ||
41 | uint32_t moder; | ||
42 | uint32_t otyper; | ||
43 | uint32_t ospeedr; | ||
44 | uint32_t pupdr; | ||
45 | uint32_t odr; | ||
46 | uint32_t afrl; | ||
47 | uint32_t afrh; | ||
48 | } gpio_setup_t; | ||
49 | |||
50 | /** | ||
51 | * @brief Type of STM32 GPIO initialization data. | ||
52 | */ | ||
53 | typedef struct { | ||
54 | #if STM32_HAS_GPIOA || defined(__DOXYGEN__) | ||
55 | gpio_setup_t PAData; | ||
56 | #endif | ||
57 | #if STM32_HAS_GPIOB || defined(__DOXYGEN__) | ||
58 | gpio_setup_t PBData; | ||
59 | #endif | ||
60 | #if STM32_HAS_GPIOC || defined(__DOXYGEN__) | ||
61 | gpio_setup_t PCData; | ||
62 | #endif | ||
63 | #if STM32_HAS_GPIOD || defined(__DOXYGEN__) | ||
64 | gpio_setup_t PDData; | ||
65 | #endif | ||
66 | #if STM32_HAS_GPIOE || defined(__DOXYGEN__) | ||
67 | gpio_setup_t PEData; | ||
68 | #endif | ||
69 | #if STM32_HAS_GPIOF || defined(__DOXYGEN__) | ||
70 | gpio_setup_t PFData; | ||
71 | #endif | ||
72 | #if STM32_HAS_GPIOG || defined(__DOXYGEN__) | ||
73 | gpio_setup_t PGData; | ||
74 | #endif | ||
75 | #if STM32_HAS_GPIOH || defined(__DOXYGEN__) | ||
76 | gpio_setup_t PHData; | ||
77 | #endif | ||
78 | #if STM32_HAS_GPIOI || defined(__DOXYGEN__) | ||
79 | gpio_setup_t PIData; | ||
80 | #endif | ||
81 | #if STM32_HAS_GPIOJ || defined(__DOXYGEN__) | ||
82 | gpio_setup_t PJData; | ||
83 | #endif | ||
84 | #if STM32_HAS_GPIOK || defined(__DOXYGEN__) | ||
85 | gpio_setup_t PKData; | ||
86 | #endif | ||
87 | } gpio_config_t; | ||
88 | |||
89 | /** | ||
90 | * @brief STM32 GPIO static initialization data. | ||
91 | */ | ||
92 | static const gpio_config_t gpio_default_config = { | ||
93 | #if STM32_HAS_GPIOA | ||
94 | {VAL_GPIOA_MODER, VAL_GPIOA_OTYPER, VAL_GPIOA_OSPEEDR, VAL_GPIOA_PUPDR, | ||
95 | VAL_GPIOA_ODR, VAL_GPIOA_AFRL, VAL_GPIOA_AFRH}, | ||
96 | #endif | ||
97 | #if STM32_HAS_GPIOB | ||
98 | {VAL_GPIOB_MODER, VAL_GPIOB_OTYPER, VAL_GPIOB_OSPEEDR, VAL_GPIOB_PUPDR, | ||
99 | VAL_GPIOB_ODR, VAL_GPIOB_AFRL, VAL_GPIOB_AFRH}, | ||
100 | #endif | ||
101 | #if STM32_HAS_GPIOC | ||
102 | {VAL_GPIOC_MODER, VAL_GPIOC_OTYPER, VAL_GPIOC_OSPEEDR, VAL_GPIOC_PUPDR, | ||
103 | VAL_GPIOC_ODR, VAL_GPIOC_AFRL, VAL_GPIOC_AFRH}, | ||
104 | #endif | ||
105 | #if STM32_HAS_GPIOD | ||
106 | {VAL_GPIOD_MODER, VAL_GPIOD_OTYPER, VAL_GPIOD_OSPEEDR, VAL_GPIOD_PUPDR, | ||
107 | VAL_GPIOD_ODR, VAL_GPIOD_AFRL, VAL_GPIOD_AFRH}, | ||
108 | #endif | ||
109 | #if STM32_HAS_GPIOE | ||
110 | {VAL_GPIOE_MODER, VAL_GPIOE_OTYPER, VAL_GPIOE_OSPEEDR, VAL_GPIOE_PUPDR, | ||
111 | VAL_GPIOE_ODR, VAL_GPIOE_AFRL, VAL_GPIOE_AFRH}, | ||
112 | #endif | ||
113 | #if STM32_HAS_GPIOF | ||
114 | {VAL_GPIOF_MODER, VAL_GPIOF_OTYPER, VAL_GPIOF_OSPEEDR, VAL_GPIOF_PUPDR, | ||
115 | VAL_GPIOF_ODR, VAL_GPIOF_AFRL, VAL_GPIOF_AFRH}, | ||
116 | #endif | ||
117 | #if STM32_HAS_GPIOG | ||
118 | {VAL_GPIOG_MODER, VAL_GPIOG_OTYPER, VAL_GPIOG_OSPEEDR, VAL_GPIOG_PUPDR, | ||
119 | VAL_GPIOG_ODR, VAL_GPIOG_AFRL, VAL_GPIOG_AFRH}, | ||
120 | #endif | ||
121 | #if STM32_HAS_GPIOH | ||
122 | {VAL_GPIOH_MODER, VAL_GPIOH_OTYPER, VAL_GPIOH_OSPEEDR, VAL_GPIOH_PUPDR, | ||
123 | VAL_GPIOH_ODR, VAL_GPIOH_AFRL, VAL_GPIOH_AFRH}, | ||
124 | #endif | ||
125 | #if STM32_HAS_GPIOI | ||
126 | {VAL_GPIOI_MODER, VAL_GPIOI_OTYPER, VAL_GPIOI_OSPEEDR, VAL_GPIOI_PUPDR, | ||
127 | VAL_GPIOI_ODR, VAL_GPIOI_AFRL, VAL_GPIOI_AFRH}, | ||
128 | #endif | ||
129 | #if STM32_HAS_GPIOJ | ||
130 | {VAL_GPIOJ_MODER, VAL_GPIOJ_OTYPER, VAL_GPIOJ_OSPEEDR, VAL_GPIOJ_PUPDR, | ||
131 | VAL_GPIOJ_ODR, VAL_GPIOJ_AFRL, VAL_GPIOJ_AFRH}, | ||
132 | #endif | ||
133 | #if STM32_HAS_GPIOK | ||
134 | {VAL_GPIOK_MODER, VAL_GPIOK_OTYPER, VAL_GPIOK_OSPEEDR, VAL_GPIOK_PUPDR, | ||
135 | VAL_GPIOK_ODR, VAL_GPIOK_AFRL, VAL_GPIOK_AFRH} | ||
136 | #endif | ||
137 | }; | ||
138 | |||
139 | /*===========================================================================*/ | ||
140 | /* Driver local functions. */ | ||
141 | /*===========================================================================*/ | ||
142 | |||
143 | static void gpio_init(stm32_gpio_t *gpiop, const gpio_setup_t *config) { | ||
144 | |||
145 | gpiop->OTYPER = config->otyper; | ||
146 | gpiop->OSPEEDR = config->ospeedr; | ||
147 | gpiop->PUPDR = config->pupdr; | ||
148 | gpiop->ODR = config->odr; | ||
149 | gpiop->AFRL = config->afrl; | ||
150 | gpiop->AFRH = config->afrh; | ||
151 | gpiop->MODER = config->moder; | ||
152 | } | ||
153 | |||
154 | static void stm32_gpio_init(void) { | ||
155 | |||
156 | /* Enabling GPIO-related clocks, the mask comes from the | ||
157 | registry header file.*/ | ||
158 | rccResetAHB1(STM32_GPIO_EN_MASK); | ||
159 | rccEnableAHB1(STM32_GPIO_EN_MASK, true); | ||
160 | |||
161 | /* Initializing all the defined GPIO ports.*/ | ||
162 | #if STM32_HAS_GPIOA | ||
163 | gpio_init(GPIOA, &gpio_default_config.PAData); | ||
164 | #endif | ||
165 | #if STM32_HAS_GPIOB | ||
166 | gpio_init(GPIOB, &gpio_default_config.PBData); | ||
167 | #endif | ||
168 | #if STM32_HAS_GPIOC | ||
169 | gpio_init(GPIOC, &gpio_default_config.PCData); | ||
170 | #endif | ||
171 | #if STM32_HAS_GPIOD | ||
172 | gpio_init(GPIOD, &gpio_default_config.PDData); | ||
173 | #endif | ||
174 | #if STM32_HAS_GPIOE | ||
175 | gpio_init(GPIOE, &gpio_default_config.PEData); | ||
176 | #endif | ||
177 | #if STM32_HAS_GPIOF | ||
178 | gpio_init(GPIOF, &gpio_default_config.PFData); | ||
179 | #endif | ||
180 | #if STM32_HAS_GPIOG | ||
181 | gpio_init(GPIOG, &gpio_default_config.PGData); | ||
182 | #endif | ||
183 | #if STM32_HAS_GPIOH | ||
184 | gpio_init(GPIOH, &gpio_default_config.PHData); | ||
185 | #endif | ||
186 | #if STM32_HAS_GPIOI | ||
187 | gpio_init(GPIOI, &gpio_default_config.PIData); | ||
188 | #endif | ||
189 | #if STM32_HAS_GPIOJ | ||
190 | gpio_init(GPIOJ, &gpio_default_config.PJData); | ||
191 | #endif | ||
192 | #if STM32_HAS_GPIOK | ||
193 | gpio_init(GPIOK, &gpio_default_config.PKData); | ||
194 | #endif | ||
195 | } | ||
196 | |||
197 | /*===========================================================================*/ | ||
198 | /* Driver interrupt handlers. */ | ||
199 | /*===========================================================================*/ | ||
200 | |||
201 | /*===========================================================================*/ | ||
202 | /* Driver exported functions. */ | ||
203 | /*===========================================================================*/ | ||
204 | |||
205 | /** | ||
206 | * @brief Early initialization code. | ||
207 | * @details GPIO ports and system clocks are initialized before everything | ||
208 | * else. | ||
209 | */ | ||
210 | void __early_init(void) { | ||
211 | |||
212 | stm32_gpio_init(); | ||
213 | stm32_clock_init(); | ||
214 | } | ||
215 | |||
216 | #if HAL_USE_SDC || defined(__DOXYGEN__) | ||
217 | /** | ||
218 | * @brief SDC card detection. | ||
219 | */ | ||
220 | bool sdc_lld_is_card_inserted(SDCDriver *sdcp) { | ||
221 | |||
222 | (void)sdcp; | ||
223 | /* CHTODO: Fill the implementation.*/ | ||
224 | return true; | ||
225 | } | ||
226 | |||
227 | /** | ||
228 | * @brief SDC card write protection detection. | ||
229 | */ | ||
230 | bool sdc_lld_is_write_protected(SDCDriver *sdcp) { | ||
231 | |||
232 | (void)sdcp; | ||
233 | /* CHTODO: Fill the implementation.*/ | ||
234 | return false; | ||
235 | } | ||
236 | #endif /* HAL_USE_SDC */ | ||
237 | |||
238 | #if HAL_USE_MMC_SPI || defined(__DOXYGEN__) | ||
239 | /** | ||
240 | * @brief MMC_SPI card detection. | ||
241 | */ | ||
242 | bool mmc_lld_is_card_inserted(MMCDriver *mmcp) { | ||
243 | |||
244 | (void)mmcp; | ||
245 | /* CHTODO: Fill the implementation.*/ | ||
246 | return true; | ||
247 | } | ||
248 | |||
249 | /** | ||
250 | * @brief MMC_SPI card write protection detection. | ||
251 | */ | ||
252 | bool mmc_lld_is_write_protected(MMCDriver *mmcp) { | ||
253 | |||
254 | (void)mmcp; | ||
255 | /* CHTODO: Fill the implementation.*/ | ||
256 | return false; | ||
257 | } | ||
258 | #endif | ||
259 | |||
260 | /** | ||
261 | * @brief Board-specific initialization code. | ||
262 | * @note You can add your board-specific code here. | ||
263 | */ | ||
264 | void boardInit(void) { | ||
265 | |||
266 | } | ||
diff --git a/lib/chibios/os/hal/boards/MIKROE_CLICKER2_STM32/board.h b/lib/chibios/os/hal/boards/MIKROE_CLICKER2_STM32/board.h new file mode 100644 index 000000000..1372d16c5 --- /dev/null +++ b/lib/chibios/os/hal/boards/MIKROE_CLICKER2_STM32/board.h | |||
@@ -0,0 +1,1359 @@ | |||
1 | /* | ||
2 | ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio | ||
3 | |||
4 | Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | you may not use this file except in compliance with the License. | ||
6 | You may obtain a copy of the License at | ||
7 | |||
8 | http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | |||
10 | Unless required by applicable law or agreed to in writing, software | ||
11 | distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | See the License for the specific language governing permissions and | ||
14 | limitations under the License. | ||
15 | */ | ||
16 | |||
17 | /* | ||
18 | * This file has been automatically generated using ChibiStudio board | ||
19 | * generator plugin. Do not edit manually. | ||
20 | */ | ||
21 | |||
22 | #ifndef BOARD_H | ||
23 | #define BOARD_H | ||
24 | |||
25 | /*===========================================================================*/ | ||
26 | /* Driver constants. */ | ||
27 | /*===========================================================================*/ | ||
28 | |||
29 | /* | ||
30 | * Setup for Mikroe Clicker 2 for STM32 board. | ||
31 | */ | ||
32 | |||
33 | /* | ||
34 | * Board identifier. | ||
35 | */ | ||
36 | #define BOARD_MIKROE_CLICKER2_STM32 | ||
37 | #define BOARD_NAME "Mikroe Clicker 2 for STM32" | ||
38 | |||
39 | /* | ||
40 | * Board oscillators-related settings. | ||
41 | */ | ||
42 | #if !defined(STM32_LSECLK) | ||
43 | #define STM32_LSECLK 32768U | ||
44 | #endif | ||
45 | |||
46 | #if !defined(STM32_HSECLK) | ||
47 | #define STM32_HSECLK 25000000U | ||
48 | #endif | ||
49 | |||
50 | /* | ||
51 | * Board voltages. | ||
52 | * Required for performance limits calculation. | ||
53 | */ | ||
54 | #define STM32_VDD 300U | ||
55 | |||
56 | /* | ||
57 | * MCU type as defined in the ST header. | ||
58 | */ | ||
59 | #define STM32F407xx | ||
60 | |||
61 | /* | ||
62 | * IO pins assignments. | ||
63 | */ | ||
64 | #define GPIOA_PIN0 0U | ||
65 | #define GPIOA_PIN1 1U | ||
66 | #define GPIOA_MB1_AN 2U | ||
67 | #define GPIOA_MB2_AN 3U | ||
68 | #define GPIOA_PIN4 4U | ||
69 | #define GPIOA_PIN5 5U | ||
70 | #define GPIOA_PIN6 6U | ||
71 | #define GPIOA_PIN7 7U | ||
72 | #define GPIOA_I2C3_SCL 8U | ||
73 | #define GPIOA_VBUS_FS 9U | ||
74 | #define GPIOA_BUTTON2 10U | ||
75 | #define GPIOA_OTG_FS_DM 11U | ||
76 | #define GPIOA_OTG_FS_DP 12U | ||
77 | #define GPIOA_SWDIO 13U | ||
78 | #define GPIOA_SWCLK 14U | ||
79 | #define GPIOA_PIN15 15U | ||
80 | |||
81 | #define GPIOB_PIN0 0U | ||
82 | #define GPIOB_PIN1 1U | ||
83 | #define GPIOB_PIN2 2U | ||
84 | #define GPIOB_PIN3 3U | ||
85 | #define GPIOB_PIN4 4U | ||
86 | #define GPIOB_PIN5 5U | ||
87 | #define GPIOB_PIN6 6U | ||
88 | #define GPIOB_PIN7 7U | ||
89 | #define GPIOB_PIN8 8U | ||
90 | #define GPIOB_PIN9 9U | ||
91 | #define GPIOB_I2C2_SCL 10U | ||
92 | #define GPIOB_I2C2_SDA 11U | ||
93 | #define GPIOB_PIN12 12U | ||
94 | #define GPIOB_SPI2_SCK 13U | ||
95 | #define GPIOB_SPI2_MISO 14U | ||
96 | #define GPIOB_SPI2_MOSI 15U | ||
97 | |||
98 | #define GPIOC_PIN0 0U | ||
99 | #define GPIOC_PIN1 1U | ||
100 | #define GPIOC_PIN2 2U | ||
101 | #define GPIOC_PIN3 3U | ||
102 | #define GPIOC_PIN4 4U | ||
103 | #define GPIOC_PIN5 5U | ||
104 | #define GPIOC_PIN6 6U | ||
105 | #define GPIOC_PIN7 7U | ||
106 | #define GPIOC_PIN8 8U | ||
107 | #define GPIOC_I2C3_SDA 9U | ||
108 | #define GPIOC_SPI3_SCK 10U | ||
109 | #define GPIOC_SPI3_MISO 11U | ||
110 | #define GPIOC_SPI3_MOSI 12U | ||
111 | #define GPIOC_PIN13 13U | ||
112 | #define GPIOC_PIN14 14U | ||
113 | #define GPIOC_PIN15 15U | ||
114 | |||
115 | #define GPIOD_PIN0 0U | ||
116 | #define GPIOD_PIN1 1U | ||
117 | #define GPIOD_PIN2 2U | ||
118 | #define GPIOD_PIN3 3U | ||
119 | #define GPIOD_PIN4 4U | ||
120 | #define GPIOD_USART2_TX 5U | ||
121 | #define GPIOD_USART2_RX 6U | ||
122 | #define GPIOD_PIN7 7U | ||
123 | #define GPIOD_USART3_TX 8U | ||
124 | #define GPIOD_USART3_RX 9U | ||
125 | #define GPIOD_PIN10 10U | ||
126 | #define GPIOD_PIN11 11U | ||
127 | #define GPIOD_MB2_PWM 12U | ||
128 | #define GPIOD_PIN13 13U | ||
129 | #define GPIOD_PIN14 14U | ||
130 | #define GPIOD_PIN15 15U | ||
131 | |||
132 | #define GPIOE_BUTTON1 0U | ||
133 | #define GPIOE_PIN1 1U | ||
134 | #define GPIOE_PIN2 2U | ||
135 | #define GPIOE_PIN3 3U | ||
136 | #define GPIOE_PIN4 4U | ||
137 | #define GPIOE_PIN5 5U | ||
138 | #define GPIOE_PIN6 6U | ||
139 | #define GPIOE_MB1_RST 7U | ||
140 | #define GPIOE_MB1_CS 8U | ||
141 | #define GPIOE_MB1_PWM 9U | ||
142 | #define GPIOE_MB1_INT 10U | ||
143 | #define GPIOE_MB2_CS 11U | ||
144 | #define GPIOE_LED1 12U | ||
145 | #define GPIOE_MB2_RST 13U | ||
146 | #define GPIOE_MB2_INT 14U | ||
147 | #define GPIOE_LED2 15U | ||
148 | |||
149 | #define GPIOF_PIN0 0U | ||
150 | #define GPIOF_PIN1 1U | ||
151 | #define GPIOF_PIN2 2U | ||
152 | #define GPIOF_PIN3 3U | ||
153 | #define GPIOF_PIN4 4U | ||
154 | #define GPIOF_PIN5 5U | ||
155 | #define GPIOF_PIN6 6U | ||
156 | #define GPIOF_PIN7 7U | ||
157 | #define GPIOF_PIN8 8U | ||
158 | #define GPIOF_PIN9 9U | ||
159 | #define GPIOF_PIN10 10U | ||
160 | #define GPIOF_PIN11 11U | ||
161 | #define GPIOF_PIN12 12U | ||
162 | #define GPIOF_PIN13 13U | ||
163 | #define GPIOF_PIN14 14U | ||
164 | #define GPIOF_PIN15 15U | ||
165 | |||
166 | #define GPIOG_PIN0 0U | ||
167 | #define GPIOG_PIN1 1U | ||
168 | #define GPIOG_PIN2 2U | ||
169 | #define GPIOG_PIN3 3U | ||
170 | #define GPIOG_PIN4 4U | ||
171 | #define GPIOG_PIN5 5U | ||
172 | #define GPIOG_PIN6 6U | ||
173 | #define GPIOG_PIN7 7U | ||
174 | #define GPIOG_PIN8 8U | ||
175 | #define GPIOG_PIN9 9U | ||
176 | #define GPIOG_PIN10 10U | ||
177 | #define GPIOG_PIN11 11U | ||
178 | #define GPIOG_PIN12 12U | ||
179 | #define GPIOG_PIN13 13U | ||
180 | #define GPIOG_PIN14 14U | ||
181 | #define GPIOG_PIN15 15U | ||
182 | |||
183 | #define GPIOH_PIN0 0U | ||
184 | #define GPIOH_PIN1 1U | ||
185 | #define GPIOH_PIN2 2U | ||
186 | #define GPIOH_PIN3 3U | ||
187 | #define GPIOH_PIN4 4U | ||
188 | #define GPIOH_PIN5 5U | ||
189 | #define GPIOH_PIN6 6U | ||
190 | #define GPIOH_PIN7 7U | ||
191 | #define GPIOH_PIN8 8U | ||
192 | #define GPIOH_PIN9 9U | ||
193 | #define GPIOH_PIN10 10U | ||
194 | #define GPIOH_PIN11 11U | ||
195 | #define GPIOH_PIN12 12U | ||
196 | #define GPIOH_PIN13 13U | ||
197 | #define GPIOH_PIN14 14U | ||
198 | #define GPIOH_PIN15 15U | ||
199 | |||
200 | #define GPIOI_PIN0 0U | ||
201 | #define GPIOI_PIN1 1U | ||
202 | #define GPIOI_PIN2 2U | ||
203 | #define GPIOI_PIN3 3U | ||
204 | #define GPIOI_PIN4 4U | ||
205 | #define GPIOI_PIN5 5U | ||
206 | #define GPIOI_PIN6 6U | ||
207 | #define GPIOI_PIN7 7U | ||
208 | #define GPIOI_PIN8 8U | ||
209 | #define GPIOI_PIN9 9U | ||
210 | #define GPIOI_PIN10 10U | ||
211 | #define GPIOI_PIN11 11U | ||
212 | #define GPIOI_PIN12 12U | ||
213 | #define GPIOI_PIN13 13U | ||
214 | #define GPIOI_PIN14 14U | ||
215 | #define GPIOI_PIN15 15U | ||
216 | |||
217 | /* | ||
218 | * IO lines assignments. | ||
219 | */ | ||
220 | #define LINE_MB1_AN PAL_LINE(GPIOA, 2U) | ||
221 | #define LINE_MB2_AN PAL_LINE(GPIOA, 3U) | ||
222 | #define LINE_I2C3_SCL PAL_LINE(GPIOA, 8U) | ||
223 | #define LINE_VBUS_FS PAL_LINE(GPIOA, 9U) | ||
224 | #define LINE_BUTTON2 PAL_LINE(GPIOA, 10U) | ||
225 | #define LINE_OTG_FS_DM PAL_LINE(GPIOA, 11U) | ||
226 | #define LINE_OTG_FS_DP PAL_LINE(GPIOA, 12U) | ||
227 | #define LINE_SWDIO PAL_LINE(GPIOA, 13U) | ||
228 | #define LINE_SWCLK PAL_LINE(GPIOA, 14U) | ||
229 | #define LINE_I2C2_SCL PAL_LINE(GPIOB, 10U) | ||
230 | #define LINE_I2C2_SDA PAL_LINE(GPIOB, 11U) | ||
231 | #define LINE_SPI2_SCK PAL_LINE(GPIOB, 13U) | ||
232 | #define LINE_SPI2_MISO PAL_LINE(GPIOB, 14U) | ||
233 | #define LINE_SPI2_MOSI PAL_LINE(GPIOB, 15U) | ||
234 | #define LINE_I2C3_SDA PAL_LINE(GPIOC, 9U) | ||
235 | #define LINE_SPI3_SCK PAL_LINE(GPIOC, 10U) | ||
236 | #define LINE_SPI3_MISO PAL_LINE(GPIOC, 11U) | ||
237 | #define LINE_SPI3_MOSI PAL_LINE(GPIOC, 12U) | ||
238 | #define LINE_USART2_TX PAL_LINE(GPIOD, 5U) | ||
239 | #define LINE_USART2_RX PAL_LINE(GPIOD, 6U) | ||
240 | #define LINE_USART3_TX PAL_LINE(GPIOD, 8U) | ||
241 | #define LINE_USART3_RX PAL_LINE(GPIOD, 9U) | ||
242 | #define LINE_MB2_PWM PAL_LINE(GPIOD, 12U) | ||
243 | #define LINE_BUTTON1 PAL_LINE(GPIOE, 0U) | ||
244 | #define LINE_MB1_RST PAL_LINE(GPIOE, 7U) | ||
245 | #define LINE_MB1_CS PAL_LINE(GPIOE, 8U) | ||
246 | #define LINE_MB1_PWM PAL_LINE(GPIOE, 9U) | ||
247 | #define LINE_MB1_INT PAL_LINE(GPIOE, 10U) | ||
248 | #define LINE_MB2_CS PAL_LINE(GPIOE, 11U) | ||
249 | #define LINE_LED1 PAL_LINE(GPIOE, 12U) | ||
250 | #define LINE_MB2_RST PAL_LINE(GPIOE, 13U) | ||
251 | #define LINE_MB2_INT PAL_LINE(GPIOE, 14U) | ||
252 | #define LINE_LED2 PAL_LINE(GPIOE, 15U) | ||
253 | |||
254 | /*===========================================================================*/ | ||
255 | /* Driver pre-compile time settings. */ | ||
256 | /*===========================================================================*/ | ||
257 | |||
258 | /*===========================================================================*/ | ||
259 | /* Derived constants and error checks. */ | ||
260 | /*===========================================================================*/ | ||
261 | |||
262 | /*===========================================================================*/ | ||
263 | /* Driver data structures and types. */ | ||
264 | /*===========================================================================*/ | ||
265 | |||
266 | /*===========================================================================*/ | ||
267 | /* Driver macros. */ | ||
268 | /*===========================================================================*/ | ||
269 | |||
270 | /* | ||
271 | * I/O ports initial setup, this configuration is established soon after reset | ||
272 | * in the initialization code. | ||
273 | * Please refer to the STM32 Reference Manual for details. | ||
274 | */ | ||
275 | #define PIN_MODE_INPUT(n) (0U << ((n) * 2U)) | ||
276 | #define PIN_MODE_OUTPUT(n) (1U << ((n) * 2U)) | ||
277 | #define PIN_MODE_ALTERNATE(n) (2U << ((n) * 2U)) | ||
278 | #define PIN_MODE_ANALOG(n) (3U << ((n) * 2U)) | ||
279 | #define PIN_ODR_LOW(n) (0U << (n)) | ||
280 | #define PIN_ODR_HIGH(n) (1U << (n)) | ||
281 | #define PIN_OTYPE_PUSHPULL(n) (0U << (n)) | ||
282 | #define PIN_OTYPE_OPENDRAIN(n) (1U << (n)) | ||
283 | #define PIN_OSPEED_VERYLOW(n) (0U << ((n) * 2U)) | ||
284 | #define PIN_OSPEED_LOW(n) (1U << ((n) * 2U)) | ||
285 | #define PIN_OSPEED_MEDIUM(n) (2U << ((n) * 2U)) | ||
286 | #define PIN_OSPEED_HIGH(n) (3U << ((n) * 2U)) | ||
287 | #define PIN_PUPDR_FLOATING(n) (0U << ((n) * 2U)) | ||
288 | #define PIN_PUPDR_PULLUP(n) (1U << ((n) * 2U)) | ||
289 | #define PIN_PUPDR_PULLDOWN(n) (2U << ((n) * 2U)) | ||
290 | #define PIN_AFIO_AF(n, v) ((v) << (((n) % 8U) * 4U)) | ||
291 | |||
292 | /* | ||
293 | * GPIOA setup: | ||
294 | * | ||
295 | * PA0 - PIN0 (input pullup). | ||
296 | * PA1 - PIN1 (input pullup). | ||
297 | * PA2 - MB1_AN (analog). | ||
298 | * PA3 - MB2_AN (analog). | ||
299 | * PA4 - PIN4 (input pullup). | ||
300 | * PA5 - PIN5 (input pullup). | ||
301 | * PA6 - PIN6 (input pullup). | ||
302 | * PA7 - PIN7 (input pullup). | ||
303 | * PA8 - I2C3_SCL (alternate 4). | ||
304 | * PA9 - VBUS_FS (input floating). | ||
305 | * PA10 - BUTTON2 (input floating). | ||
306 | * PA11 - OTG_FS_DM (alternate 10). | ||
307 | * PA12 - OTG_FS_DP (alternate 10). | ||
308 | * PA13 - SWDIO (alternate 0). | ||
309 | * PA14 - SWCLK (alternate 0). | ||
310 | * PA15 - PIN15 (input pullup). | ||
311 | */ | ||
312 | #define VAL_GPIOA_MODER (PIN_MODE_INPUT(GPIOA_PIN0) | \ | ||
313 | PIN_MODE_INPUT(GPIOA_PIN1) | \ | ||
314 | PIN_MODE_ANALOG(GPIOA_MB1_AN) | \ | ||
315 | PIN_MODE_ANALOG(GPIOA_MB2_AN) | \ | ||
316 | PIN_MODE_INPUT(GPIOA_PIN4) | \ | ||
317 | PIN_MODE_INPUT(GPIOA_PIN5) | \ | ||
318 | PIN_MODE_INPUT(GPIOA_PIN6) | \ | ||
319 | PIN_MODE_INPUT(GPIOA_PIN7) | \ | ||
320 | PIN_MODE_ALTERNATE(GPIOA_I2C3_SCL) | \ | ||
321 | PIN_MODE_INPUT(GPIOA_VBUS_FS) | \ | ||
322 | PIN_MODE_INPUT(GPIOA_BUTTON2) | \ | ||
323 | PIN_MODE_ALTERNATE(GPIOA_OTG_FS_DM) | \ | ||
324 | PIN_MODE_ALTERNATE(GPIOA_OTG_FS_DP) | \ | ||
325 | PIN_MODE_ALTERNATE(GPIOA_SWDIO) | \ | ||
326 | PIN_MODE_ALTERNATE(GPIOA_SWCLK) | \ | ||
327 | PIN_MODE_INPUT(GPIOA_PIN15)) | ||
328 | #define VAL_GPIOA_OTYPER (PIN_OTYPE_PUSHPULL(GPIOA_PIN0) | \ | ||
329 | PIN_OTYPE_PUSHPULL(GPIOA_PIN1) | \ | ||
330 | PIN_OTYPE_PUSHPULL(GPIOA_MB1_AN) | \ | ||
331 | PIN_OTYPE_PUSHPULL(GPIOA_MB2_AN) | \ | ||
332 | PIN_OTYPE_PUSHPULL(GPIOA_PIN4) | \ | ||
333 | PIN_OTYPE_PUSHPULL(GPIOA_PIN5) | \ | ||
334 | PIN_OTYPE_PUSHPULL(GPIOA_PIN6) | \ | ||
335 | PIN_OTYPE_PUSHPULL(GPIOA_PIN7) | \ | ||
336 | PIN_OTYPE_PUSHPULL(GPIOA_I2C3_SCL) | \ | ||
337 | PIN_OTYPE_PUSHPULL(GPIOA_VBUS_FS) | \ | ||
338 | PIN_OTYPE_PUSHPULL(GPIOA_BUTTON2) | \ | ||
339 | PIN_OTYPE_PUSHPULL(GPIOA_OTG_FS_DM) | \ | ||
340 | PIN_OTYPE_PUSHPULL(GPIOA_OTG_FS_DP) | \ | ||
341 | PIN_OTYPE_PUSHPULL(GPIOA_SWDIO) | \ | ||
342 | PIN_OTYPE_PUSHPULL(GPIOA_SWCLK) | \ | ||
343 | PIN_OTYPE_PUSHPULL(GPIOA_PIN15)) | ||
344 | #define VAL_GPIOA_OSPEEDR (PIN_OSPEED_HIGH(GPIOA_PIN0) | \ | ||
345 | PIN_OSPEED_HIGH(GPIOA_PIN1) | \ | ||
346 | PIN_OSPEED_HIGH(GPIOA_MB1_AN) | \ | ||
347 | PIN_OSPEED_HIGH(GPIOA_MB2_AN) | \ | ||
348 | PIN_OSPEED_HIGH(GPIOA_PIN4) | \ | ||
349 | PIN_OSPEED_HIGH(GPIOA_PIN5) | \ | ||
350 | PIN_OSPEED_HIGH(GPIOA_PIN6) | \ | ||
351 | PIN_OSPEED_HIGH(GPIOA_PIN7) | \ | ||
352 | PIN_OSPEED_HIGH(GPIOA_I2C3_SCL) | \ | ||
353 | PIN_OSPEED_HIGH(GPIOA_VBUS_FS) | \ | ||
354 | PIN_OSPEED_HIGH(GPIOA_BUTTON2) | \ | ||
355 | PIN_OSPEED_HIGH(GPIOA_OTG_FS_DM) | \ | ||
356 | PIN_OSPEED_HIGH(GPIOA_OTG_FS_DP) | \ | ||
357 | PIN_OSPEED_HIGH(GPIOA_SWDIO) | \ | ||
358 | PIN_OSPEED_HIGH(GPIOA_SWCLK) | \ | ||
359 | PIN_OSPEED_HIGH(GPIOA_PIN15)) | ||
360 | #define VAL_GPIOA_PUPDR (PIN_PUPDR_PULLUP(GPIOA_PIN0) | \ | ||
361 | PIN_PUPDR_PULLUP(GPIOA_PIN1) | \ | ||
362 | PIN_PUPDR_FLOATING(GPIOA_MB1_AN) | \ | ||
363 | PIN_PUPDR_FLOATING(GPIOA_MB2_AN) | \ | ||
364 | PIN_PUPDR_PULLUP(GPIOA_PIN4) | \ | ||
365 | PIN_PUPDR_PULLUP(GPIOA_PIN5) | \ | ||
366 | PIN_PUPDR_PULLUP(GPIOA_PIN6) | \ | ||
367 | PIN_PUPDR_PULLUP(GPIOA_PIN7) | \ | ||
368 | PIN_PUPDR_FLOATING(GPIOA_I2C3_SCL) | \ | ||
369 | PIN_PUPDR_FLOATING(GPIOA_VBUS_FS) | \ | ||
370 | PIN_PUPDR_FLOATING(GPIOA_BUTTON2) | \ | ||
371 | PIN_PUPDR_FLOATING(GPIOA_OTG_FS_DM) | \ | ||
372 | PIN_PUPDR_FLOATING(GPIOA_OTG_FS_DP) | \ | ||
373 | PIN_PUPDR_FLOATING(GPIOA_SWDIO) | \ | ||
374 | PIN_PUPDR_FLOATING(GPIOA_SWCLK) | \ | ||
375 | PIN_PUPDR_PULLUP(GPIOA_PIN15)) | ||
376 | #define VAL_GPIOA_ODR (PIN_ODR_HIGH(GPIOA_PIN0) | \ | ||
377 | PIN_ODR_HIGH(GPIOA_PIN1) | \ | ||
378 | PIN_ODR_HIGH(GPIOA_MB1_AN) | \ | ||
379 | PIN_ODR_HIGH(GPIOA_MB2_AN) | \ | ||
380 | PIN_ODR_HIGH(GPIOA_PIN4) | \ | ||
381 | PIN_ODR_HIGH(GPIOA_PIN5) | \ | ||
382 | PIN_ODR_HIGH(GPIOA_PIN6) | \ | ||
383 | PIN_ODR_HIGH(GPIOA_PIN7) | \ | ||
384 | PIN_ODR_HIGH(GPIOA_I2C3_SCL) | \ | ||
385 | PIN_ODR_HIGH(GPIOA_VBUS_FS) | \ | ||
386 | PIN_ODR_HIGH(GPIOA_BUTTON2) | \ | ||
387 | PIN_ODR_HIGH(GPIOA_OTG_FS_DM) | \ | ||
388 | PIN_ODR_HIGH(GPIOA_OTG_FS_DP) | \ | ||
389 | PIN_ODR_HIGH(GPIOA_SWDIO) | \ | ||
390 | PIN_ODR_HIGH(GPIOA_SWCLK) | \ | ||
391 | PIN_ODR_HIGH(GPIOA_PIN15)) | ||
392 | #define VAL_GPIOA_AFRL (PIN_AFIO_AF(GPIOA_PIN0, 0U) | \ | ||
393 | PIN_AFIO_AF(GPIOA_PIN1, 0U) | \ | ||
394 | PIN_AFIO_AF(GPIOA_MB1_AN, 0U) | \ | ||
395 | PIN_AFIO_AF(GPIOA_MB2_AN, 0U) | \ | ||
396 | PIN_AFIO_AF(GPIOA_PIN4, 0U) | \ | ||
397 | PIN_AFIO_AF(GPIOA_PIN5, 0U) | \ | ||
398 | PIN_AFIO_AF(GPIOA_PIN6, 0U) | \ | ||
399 | PIN_AFIO_AF(GPIOA_PIN7, 0U)) | ||
400 | #define VAL_GPIOA_AFRH (PIN_AFIO_AF(GPIOA_I2C3_SCL, 4U) | \ | ||
401 | PIN_AFIO_AF(GPIOA_VBUS_FS, 0U) | \ | ||
402 | PIN_AFIO_AF(GPIOA_BUTTON2, 0U) | \ | ||
403 | PIN_AFIO_AF(GPIOA_OTG_FS_DM, 10U) | \ | ||
404 | PIN_AFIO_AF(GPIOA_OTG_FS_DP, 10U) | \ | ||
405 | PIN_AFIO_AF(GPIOA_SWDIO, 0U) | \ | ||
406 | PIN_AFIO_AF(GPIOA_SWCLK, 0U) | \ | ||
407 | PIN_AFIO_AF(GPIOA_PIN15, 0U)) | ||
408 | |||
409 | /* | ||
410 | * GPIOB setup: | ||
411 | * | ||
412 | * PB0 - PIN0 (input pullup). | ||
413 | * PB1 - PIN1 (input pullup). | ||
414 | * PB2 - PIN2 (input pullup). | ||
415 | * PB3 - PIN3 (input pullup). | ||
416 | * PB4 - PIN4 (input pullup). | ||
417 | * PB5 - PIN5 (input pullup). | ||
418 | * PB6 - PIN6 (input pullup). | ||
419 | * PB7 - PIN7 (input pullup). | ||
420 | * PB8 - PIN8 (input pullup). | ||
421 | * PB9 - PIN9 (input pullup). | ||
422 | * PB10 - I2C2_SCL (alternate 4). | ||
423 | * PB11 - I2C2_SDA (alternate 4). | ||
424 | * PB12 - PIN12 (input pullup). | ||
425 | * PB13 - SPI2_SCK (alternate 5). | ||
426 | * PB14 - SPI2_MISO (alternate 14). | ||
427 | * PB15 - SPI2_MOSI (alternate 5). | ||
428 | */ | ||
429 | #define VAL_GPIOB_MODER (PIN_MODE_INPUT(GPIOB_PIN0) | \ | ||
430 | PIN_MODE_INPUT(GPIOB_PIN1) | \ | ||
431 | PIN_MODE_INPUT(GPIOB_PIN2) | \ | ||
432 | PIN_MODE_INPUT(GPIOB_PIN3) | \ | ||
433 | PIN_MODE_INPUT(GPIOB_PIN4) | \ | ||
434 | PIN_MODE_INPUT(GPIOB_PIN5) | \ | ||
435 | PIN_MODE_INPUT(GPIOB_PIN6) | \ | ||
436 | PIN_MODE_INPUT(GPIOB_PIN7) | \ | ||
437 | PIN_MODE_INPUT(GPIOB_PIN8) | \ | ||
438 | PIN_MODE_INPUT(GPIOB_PIN9) | \ | ||
439 | PIN_MODE_ALTERNATE(GPIOB_I2C2_SCL) | \ | ||
440 | PIN_MODE_ALTERNATE(GPIOB_I2C2_SDA) | \ | ||
441 | PIN_MODE_INPUT(GPIOB_PIN12) | \ | ||
442 | PIN_MODE_ALTERNATE(GPIOB_SPI2_SCK) | \ | ||
443 | PIN_MODE_ALTERNATE(GPIOB_SPI2_MISO) | \ | ||
444 | PIN_MODE_ALTERNATE(GPIOB_SPI2_MOSI)) | ||
445 | #define VAL_GPIOB_OTYPER (PIN_OTYPE_PUSHPULL(GPIOB_PIN0) | \ | ||
446 | PIN_OTYPE_PUSHPULL(GPIOB_PIN1) | \ | ||
447 | PIN_OTYPE_PUSHPULL(GPIOB_PIN2) | \ | ||
448 | PIN_OTYPE_PUSHPULL(GPIOB_PIN3) | \ | ||
449 | PIN_OTYPE_PUSHPULL(GPIOB_PIN4) | \ | ||
450 | PIN_OTYPE_PUSHPULL(GPIOB_PIN5) | \ | ||
451 | PIN_OTYPE_PUSHPULL(GPIOB_PIN6) | \ | ||
452 | PIN_OTYPE_PUSHPULL(GPIOB_PIN7) | \ | ||
453 | PIN_OTYPE_PUSHPULL(GPIOB_PIN8) | \ | ||
454 | PIN_OTYPE_PUSHPULL(GPIOB_PIN9) | \ | ||
455 | PIN_OTYPE_PUSHPULL(GPIOB_I2C2_SCL) | \ | ||
456 | PIN_OTYPE_PUSHPULL(GPIOB_I2C2_SDA) | \ | ||
457 | PIN_OTYPE_PUSHPULL(GPIOB_PIN12) | \ | ||
458 | PIN_OTYPE_PUSHPULL(GPIOB_SPI2_SCK) | \ | ||
459 | PIN_OTYPE_PUSHPULL(GPIOB_SPI2_MISO) | \ | ||
460 | PIN_OTYPE_PUSHPULL(GPIOB_SPI2_MOSI)) | ||
461 | #define VAL_GPIOB_OSPEEDR (PIN_OSPEED_HIGH(GPIOB_PIN0) | \ | ||
462 | PIN_OSPEED_HIGH(GPIOB_PIN1) | \ | ||
463 | PIN_OSPEED_HIGH(GPIOB_PIN2) | \ | ||
464 | PIN_OSPEED_HIGH(GPIOB_PIN3) | \ | ||
465 | PIN_OSPEED_HIGH(GPIOB_PIN4) | \ | ||
466 | PIN_OSPEED_HIGH(GPIOB_PIN5) | \ | ||
467 | PIN_OSPEED_HIGH(GPIOB_PIN6) | \ | ||
468 | PIN_OSPEED_HIGH(GPIOB_PIN7) | \ | ||
469 | PIN_OSPEED_HIGH(GPIOB_PIN8) | \ | ||
470 | PIN_OSPEED_HIGH(GPIOB_PIN9) | \ | ||
471 | PIN_OSPEED_HIGH(GPIOB_I2C2_SCL) | \ | ||
472 | PIN_OSPEED_HIGH(GPIOB_I2C2_SDA) | \ | ||
473 | PIN_OSPEED_HIGH(GPIOB_PIN12) | \ | ||
474 | PIN_OSPEED_HIGH(GPIOB_SPI2_SCK) | \ | ||
475 | PIN_OSPEED_HIGH(GPIOB_SPI2_MISO) | \ | ||
476 | PIN_OSPEED_HIGH(GPIOB_SPI2_MOSI)) | ||
477 | #define VAL_GPIOB_PUPDR (PIN_PUPDR_PULLUP(GPIOB_PIN0) | \ | ||
478 | PIN_PUPDR_PULLUP(GPIOB_PIN1) | \ | ||
479 | PIN_PUPDR_PULLUP(GPIOB_PIN2) | \ | ||
480 | PIN_PUPDR_PULLUP(GPIOB_PIN3) | \ | ||
481 | PIN_PUPDR_PULLUP(GPIOB_PIN4) | \ | ||
482 | PIN_PUPDR_PULLUP(GPIOB_PIN5) | \ | ||
483 | PIN_PUPDR_PULLUP(GPIOB_PIN6) | \ | ||
484 | PIN_PUPDR_PULLUP(GPIOB_PIN7) | \ | ||
485 | PIN_PUPDR_PULLUP(GPIOB_PIN8) | \ | ||
486 | PIN_PUPDR_PULLUP(GPIOB_PIN9) | \ | ||
487 | PIN_PUPDR_FLOATING(GPIOB_I2C2_SCL) | \ | ||
488 | PIN_PUPDR_FLOATING(GPIOB_I2C2_SDA) | \ | ||
489 | PIN_PUPDR_PULLUP(GPIOB_PIN12) | \ | ||
490 | PIN_PUPDR_FLOATING(GPIOB_SPI2_SCK) | \ | ||
491 | PIN_PUPDR_FLOATING(GPIOB_SPI2_MISO) | \ | ||
492 | PIN_PUPDR_FLOATING(GPIOB_SPI2_MOSI)) | ||
493 | #define VAL_GPIOB_ODR (PIN_ODR_HIGH(GPIOB_PIN0) | \ | ||
494 | PIN_ODR_HIGH(GPIOB_PIN1) | \ | ||
495 | PIN_ODR_HIGH(GPIOB_PIN2) | \ | ||
496 | PIN_ODR_HIGH(GPIOB_PIN3) | \ | ||
497 | PIN_ODR_HIGH(GPIOB_PIN4) | \ | ||
498 | PIN_ODR_HIGH(GPIOB_PIN5) | \ | ||
499 | PIN_ODR_HIGH(GPIOB_PIN6) | \ | ||
500 | PIN_ODR_HIGH(GPIOB_PIN7) | \ | ||
501 | PIN_ODR_HIGH(GPIOB_PIN8) | \ | ||
502 | PIN_ODR_HIGH(GPIOB_PIN9) | \ | ||
503 | PIN_ODR_HIGH(GPIOB_I2C2_SCL) | \ | ||
504 | PIN_ODR_HIGH(GPIOB_I2C2_SDA) | \ | ||
505 | PIN_ODR_HIGH(GPIOB_PIN12) | \ | ||
506 | PIN_ODR_HIGH(GPIOB_SPI2_SCK) | \ | ||
507 | PIN_ODR_HIGH(GPIOB_SPI2_MISO) | \ | ||
508 | PIN_ODR_HIGH(GPIOB_SPI2_MOSI)) | ||
509 | #define VAL_GPIOB_AFRL (PIN_AFIO_AF(GPIOB_PIN0, 0U) | \ | ||
510 | PIN_AFIO_AF(GPIOB_PIN1, 0U) | \ | ||
511 | PIN_AFIO_AF(GPIOB_PIN2, 0U) | \ | ||
512 | PIN_AFIO_AF(GPIOB_PIN3, 0U) | \ | ||
513 | PIN_AFIO_AF(GPIOB_PIN4, 0U) | \ | ||
514 | PIN_AFIO_AF(GPIOB_PIN5, 0U) | \ | ||
515 | PIN_AFIO_AF(GPIOB_PIN6, 0U) | \ | ||
516 | PIN_AFIO_AF(GPIOB_PIN7, 0U)) | ||
517 | #define VAL_GPIOB_AFRH (PIN_AFIO_AF(GPIOB_PIN8, 0U) | \ | ||
518 | PIN_AFIO_AF(GPIOB_PIN9, 0U) | \ | ||
519 | PIN_AFIO_AF(GPIOB_I2C2_SCL, 4U) | \ | ||
520 | PIN_AFIO_AF(GPIOB_I2C2_SDA, 4U) | \ | ||
521 | PIN_AFIO_AF(GPIOB_PIN12, 0U) | \ | ||
522 | PIN_AFIO_AF(GPIOB_SPI2_SCK, 5U) | \ | ||
523 | PIN_AFIO_AF(GPIOB_SPI2_MISO, 14U) | \ | ||
524 | PIN_AFIO_AF(GPIOB_SPI2_MOSI, 5U)) | ||
525 | |||
526 | /* | ||
527 | * GPIOC setup: | ||
528 | * | ||
529 | * PC0 - PIN0 (input pullup). | ||
530 | * PC1 - PIN1 (input pullup). | ||
531 | * PC2 - PIN2 (input pullup). | ||
532 | * PC3 - PIN3 (input pullup). | ||
533 | * PC4 - PIN4 (input pullup). | ||
534 | * PC5 - PIN5 (input pullup). | ||
535 | * PC6 - PIN6 (input pullup). | ||
536 | * PC7 - PIN7 (input pullup). | ||
537 | * PC8 - PIN8 (input pullup). | ||
538 | * PC9 - I2C3_SDA (alternate 4). | ||
539 | * PC10 - SPI3_SCK (alternate 6). | ||
540 | * PC11 - SPI3_MISO (alternate 6). | ||
541 | * PC12 - SPI3_MOSI (alternate 6). | ||
542 | * PC13 - PIN13 (input pullup). | ||
543 | * PC14 - PIN14 (input pullup). | ||
544 | * PC15 - PIN15 (input pullup). | ||
545 | */ | ||
546 | #define VAL_GPIOC_MODER (PIN_MODE_INPUT(GPIOC_PIN0) | \ | ||
547 | PIN_MODE_INPUT(GPIOC_PIN1) | \ | ||
548 | PIN_MODE_INPUT(GPIOC_PIN2) | \ | ||
549 | PIN_MODE_INPUT(GPIOC_PIN3) | \ | ||
550 | PIN_MODE_INPUT(GPIOC_PIN4) | \ | ||
551 | PIN_MODE_INPUT(GPIOC_PIN5) | \ | ||
552 | PIN_MODE_INPUT(GPIOC_PIN6) | \ | ||
553 | PIN_MODE_INPUT(GPIOC_PIN7) | \ | ||
554 | PIN_MODE_INPUT(GPIOC_PIN8) | \ | ||
555 | PIN_MODE_ALTERNATE(GPIOC_I2C3_SDA) | \ | ||
556 | PIN_MODE_ALTERNATE(GPIOC_SPI3_SCK) | \ | ||
557 | PIN_MODE_ALTERNATE(GPIOC_SPI3_MISO) | \ | ||
558 | PIN_MODE_ALTERNATE(GPIOC_SPI3_MOSI) | \ | ||
559 | PIN_MODE_INPUT(GPIOC_PIN13) | \ | ||
560 | PIN_MODE_INPUT(GPIOC_PIN14) | \ | ||
561 | PIN_MODE_INPUT(GPIOC_PIN15)) | ||
562 | #define VAL_GPIOC_OTYPER (PIN_OTYPE_PUSHPULL(GPIOC_PIN0) | \ | ||
563 | PIN_OTYPE_PUSHPULL(GPIOC_PIN1) | \ | ||
564 | PIN_OTYPE_PUSHPULL(GPIOC_PIN2) | \ | ||
565 | PIN_OTYPE_PUSHPULL(GPIOC_PIN3) | \ | ||
566 | PIN_OTYPE_PUSHPULL(GPIOC_PIN4) | \ | ||
567 | PIN_OTYPE_PUSHPULL(GPIOC_PIN5) | \ | ||
568 | PIN_OTYPE_PUSHPULL(GPIOC_PIN6) | \ | ||
569 | PIN_OTYPE_PUSHPULL(GPIOC_PIN7) | \ | ||
570 | PIN_OTYPE_PUSHPULL(GPIOC_PIN8) | \ | ||
571 | PIN_OTYPE_PUSHPULL(GPIOC_I2C3_SDA) | \ | ||
572 | PIN_OTYPE_PUSHPULL(GPIOC_SPI3_SCK) | \ | ||
573 | PIN_OTYPE_PUSHPULL(GPIOC_SPI3_MISO) | \ | ||
574 | PIN_OTYPE_PUSHPULL(GPIOC_SPI3_MOSI) | \ | ||
575 | PIN_OTYPE_PUSHPULL(GPIOC_PIN13) | \ | ||
576 | PIN_OTYPE_PUSHPULL(GPIOC_PIN14) | \ | ||
577 | PIN_OTYPE_PUSHPULL(GPIOC_PIN15)) | ||
578 | #define VAL_GPIOC_OSPEEDR (PIN_OSPEED_HIGH(GPIOC_PIN0) | \ | ||
579 | PIN_OSPEED_HIGH(GPIOC_PIN1) | \ | ||
580 | PIN_OSPEED_HIGH(GPIOC_PIN2) | \ | ||
581 | PIN_OSPEED_HIGH(GPIOC_PIN3) | \ | ||
582 | PIN_OSPEED_HIGH(GPIOC_PIN4) | \ | ||
583 | PIN_OSPEED_HIGH(GPIOC_PIN5) | \ | ||
584 | PIN_OSPEED_HIGH(GPIOC_PIN6) | \ | ||
585 | PIN_OSPEED_HIGH(GPIOC_PIN7) | \ | ||
586 | PIN_OSPEED_HIGH(GPIOC_PIN8) | \ | ||
587 | PIN_OSPEED_HIGH(GPIOC_I2C3_SDA) | \ | ||
588 | PIN_OSPEED_HIGH(GPIOC_SPI3_SCK) | \ | ||
589 | PIN_OSPEED_HIGH(GPIOC_SPI3_MISO) | \ | ||
590 | PIN_OSPEED_HIGH(GPIOC_SPI3_MOSI) | \ | ||
591 | PIN_OSPEED_HIGH(GPIOC_PIN13) | \ | ||
592 | PIN_OSPEED_HIGH(GPIOC_PIN14) | \ | ||
593 | PIN_OSPEED_HIGH(GPIOC_PIN15)) | ||
594 | #define VAL_GPIOC_PUPDR (PIN_PUPDR_PULLUP(GPIOC_PIN0) | \ | ||
595 | PIN_PUPDR_PULLUP(GPIOC_PIN1) | \ | ||
596 | PIN_PUPDR_PULLUP(GPIOC_PIN2) | \ | ||
597 | PIN_PUPDR_PULLUP(GPIOC_PIN3) | \ | ||
598 | PIN_PUPDR_PULLUP(GPIOC_PIN4) | \ | ||
599 | PIN_PUPDR_PULLUP(GPIOC_PIN5) | \ | ||
600 | PIN_PUPDR_PULLUP(GPIOC_PIN6) | \ | ||
601 | PIN_PUPDR_PULLUP(GPIOC_PIN7) | \ | ||
602 | PIN_PUPDR_PULLUP(GPIOC_PIN8) | \ | ||
603 | PIN_PUPDR_FLOATING(GPIOC_I2C3_SDA) | \ | ||
604 | PIN_PUPDR_FLOATING(GPIOC_SPI3_SCK) | \ | ||
605 | PIN_PUPDR_FLOATING(GPIOC_SPI3_MISO) | \ | ||
606 | PIN_PUPDR_FLOATING(GPIOC_SPI3_MOSI) | \ | ||
607 | PIN_PUPDR_PULLUP(GPIOC_PIN13) | \ | ||
608 | PIN_PUPDR_PULLUP(GPIOC_PIN14) | \ | ||
609 | PIN_PUPDR_PULLUP(GPIOC_PIN15)) | ||
610 | #define VAL_GPIOC_ODR (PIN_ODR_HIGH(GPIOC_PIN0) | \ | ||
611 | PIN_ODR_HIGH(GPIOC_PIN1) | \ | ||
612 | PIN_ODR_HIGH(GPIOC_PIN2) | \ | ||
613 | PIN_ODR_HIGH(GPIOC_PIN3) | \ | ||
614 | PIN_ODR_HIGH(GPIOC_PIN4) | \ | ||
615 | PIN_ODR_HIGH(GPIOC_PIN5) | \ | ||
616 | PIN_ODR_HIGH(GPIOC_PIN6) | \ | ||
617 | PIN_ODR_HIGH(GPIOC_PIN7) | \ | ||
618 | PIN_ODR_HIGH(GPIOC_PIN8) | \ | ||
619 | PIN_ODR_HIGH(GPIOC_I2C3_SDA) | \ | ||
620 | PIN_ODR_HIGH(GPIOC_SPI3_SCK) | \ | ||
621 | PIN_ODR_HIGH(GPIOC_SPI3_MISO) | \ | ||
622 | PIN_ODR_HIGH(GPIOC_SPI3_MOSI) | \ | ||
623 | PIN_ODR_HIGH(GPIOC_PIN13) | \ | ||
624 | PIN_ODR_HIGH(GPIOC_PIN14) | \ | ||
625 | PIN_ODR_HIGH(GPIOC_PIN15)) | ||
626 | #define VAL_GPIOC_AFRL (PIN_AFIO_AF(GPIOC_PIN0, 0U) | \ | ||
627 | PIN_AFIO_AF(GPIOC_PIN1, 0U) | \ | ||
628 | PIN_AFIO_AF(GPIOC_PIN2, 0U) | \ | ||
629 | PIN_AFIO_AF(GPIOC_PIN3, 0U) | \ | ||
630 | PIN_AFIO_AF(GPIOC_PIN4, 0U) | \ | ||
631 | PIN_AFIO_AF(GPIOC_PIN5, 0U) | \ | ||
632 | PIN_AFIO_AF(GPIOC_PIN6, 0U) | \ | ||
633 | PIN_AFIO_AF(GPIOC_PIN7, 0U)) | ||
634 | #define VAL_GPIOC_AFRH (PIN_AFIO_AF(GPIOC_PIN8, 0U) | \ | ||
635 | PIN_AFIO_AF(GPIOC_I2C3_SDA, 4U) | \ | ||
636 | PIN_AFIO_AF(GPIOC_SPI3_SCK, 6U) | \ | ||
637 | PIN_AFIO_AF(GPIOC_SPI3_MISO, 6U) | \ | ||
638 | PIN_AFIO_AF(GPIOC_SPI3_MOSI, 6U) | \ | ||
639 | PIN_AFIO_AF(GPIOC_PIN13, 0U) | \ | ||
640 | PIN_AFIO_AF(GPIOC_PIN14, 0U) | \ | ||
641 | PIN_AFIO_AF(GPIOC_PIN15, 0U)) | ||
642 | |||
643 | /* | ||
644 | * GPIOD setup: | ||
645 | * | ||
646 | * PD0 - PIN0 (input pullup). | ||
647 | * PD1 - PIN1 (input pullup). | ||
648 | * PD2 - PIN2 (input pullup). | ||
649 | * PD3 - PIN3 (input pullup). | ||
650 | * PD4 - PIN4 (input pullup). | ||
651 | * PD5 - USART2_TX (alternate 7). | ||
652 | * PD6 - USART2_RX (alternate 7). | ||
653 | * PD7 - PIN7 (input pullup). | ||
654 | * PD8 - USART3_TX (alternate 7). | ||
655 | * PD9 - USART3_RX (alternate 7). | ||
656 | * PD10 - PIN10 (input pullup). | ||
657 | * PD11 - PIN11 (input pullup). | ||
658 | * PD12 - MB2_PWM (alternate 2). | ||
659 | * PD13 - PIN13 (input pullup). | ||
660 | * PD14 - PIN14 (input pullup). | ||
661 | * PD15 - PIN15 (input pullup). | ||
662 | */ | ||
663 | #define VAL_GPIOD_MODER (PIN_MODE_INPUT(GPIOD_PIN0) | \ | ||
664 | PIN_MODE_INPUT(GPIOD_PIN1) | \ | ||
665 | PIN_MODE_INPUT(GPIOD_PIN2) | \ | ||
666 | PIN_MODE_INPUT(GPIOD_PIN3) | \ | ||
667 | PIN_MODE_INPUT(GPIOD_PIN4) | \ | ||
668 | PIN_MODE_ALTERNATE(GPIOD_USART2_TX) | \ | ||
669 | PIN_MODE_ALTERNATE(GPIOD_USART2_RX) | \ | ||
670 | PIN_MODE_INPUT(GPIOD_PIN7) | \ | ||
671 | PIN_MODE_ALTERNATE(GPIOD_USART3_TX) | \ | ||
672 | PIN_MODE_ALTERNATE(GPIOD_USART3_RX) | \ | ||
673 | PIN_MODE_INPUT(GPIOD_PIN10) | \ | ||
674 | PIN_MODE_INPUT(GPIOD_PIN11) | \ | ||
675 | PIN_MODE_ALTERNATE(GPIOD_MB2_PWM) | \ | ||
676 | PIN_MODE_INPUT(GPIOD_PIN13) | \ | ||
677 | PIN_MODE_INPUT(GPIOD_PIN14) | \ | ||
678 | PIN_MODE_INPUT(GPIOD_PIN15)) | ||
679 | #define VAL_GPIOD_OTYPER (PIN_OTYPE_PUSHPULL(GPIOD_PIN0) | \ | ||
680 | PIN_OTYPE_PUSHPULL(GPIOD_PIN1) | \ | ||
681 | PIN_OTYPE_PUSHPULL(GPIOD_PIN2) | \ | ||
682 | PIN_OTYPE_PUSHPULL(GPIOD_PIN3) | \ | ||
683 | PIN_OTYPE_PUSHPULL(GPIOD_PIN4) | \ | ||
684 | PIN_OTYPE_PUSHPULL(GPIOD_USART2_TX) | \ | ||
685 | PIN_OTYPE_PUSHPULL(GPIOD_USART2_RX) | \ | ||
686 | PIN_OTYPE_PUSHPULL(GPIOD_PIN7) | \ | ||
687 | PIN_OTYPE_PUSHPULL(GPIOD_USART3_TX) | \ | ||
688 | PIN_OTYPE_PUSHPULL(GPIOD_USART3_RX) | \ | ||
689 | PIN_OTYPE_PUSHPULL(GPIOD_PIN10) | \ | ||
690 | PIN_OTYPE_PUSHPULL(GPIOD_PIN11) | \ | ||
691 | PIN_OTYPE_PUSHPULL(GPIOD_MB2_PWM) | \ | ||
692 | PIN_OTYPE_PUSHPULL(GPIOD_PIN13) | \ | ||
693 | PIN_OTYPE_PUSHPULL(GPIOD_PIN14) | \ | ||
694 | PIN_OTYPE_PUSHPULL(GPIOD_PIN15)) | ||
695 | #define VAL_GPIOD_OSPEEDR (PIN_OSPEED_HIGH(GPIOD_PIN0) | \ | ||
696 | PIN_OSPEED_HIGH(GPIOD_PIN1) | \ | ||
697 | PIN_OSPEED_HIGH(GPIOD_PIN2) | \ | ||
698 | PIN_OSPEED_HIGH(GPIOD_PIN3) | \ | ||
699 | PIN_OSPEED_HIGH(GPIOD_PIN4) | \ | ||
700 | PIN_OSPEED_HIGH(GPIOD_USART2_TX) | \ | ||
701 | PIN_OSPEED_HIGH(GPIOD_USART2_RX) | \ | ||
702 | PIN_OSPEED_HIGH(GPIOD_PIN7) | \ | ||
703 | PIN_OSPEED_HIGH(GPIOD_USART3_TX) | \ | ||
704 | PIN_OSPEED_HIGH(GPIOD_USART3_RX) | \ | ||
705 | PIN_OSPEED_HIGH(GPIOD_PIN10) | \ | ||
706 | PIN_OSPEED_HIGH(GPIOD_PIN11) | \ | ||
707 | PIN_OSPEED_HIGH(GPIOD_MB2_PWM) | \ | ||
708 | PIN_OSPEED_HIGH(GPIOD_PIN13) | \ | ||
709 | PIN_OSPEED_HIGH(GPIOD_PIN14) | \ | ||
710 | PIN_OSPEED_HIGH(GPIOD_PIN15)) | ||
711 | #define VAL_GPIOD_PUPDR (PIN_PUPDR_PULLUP(GPIOD_PIN0) | \ | ||
712 | PIN_PUPDR_PULLUP(GPIOD_PIN1) | \ | ||
713 | PIN_PUPDR_PULLUP(GPIOD_PIN2) | \ | ||
714 | PIN_PUPDR_PULLUP(GPIOD_PIN3) | \ | ||
715 | PIN_PUPDR_PULLUP(GPIOD_PIN4) | \ | ||
716 | PIN_PUPDR_FLOATING(GPIOD_USART2_TX) | \ | ||
717 | PIN_PUPDR_FLOATING(GPIOD_USART2_RX) | \ | ||
718 | PIN_PUPDR_PULLUP(GPIOD_PIN7) | \ | ||
719 | PIN_PUPDR_FLOATING(GPIOD_USART3_TX) | \ | ||
720 | PIN_PUPDR_FLOATING(GPIOD_USART3_RX) | \ | ||
721 | PIN_PUPDR_PULLUP(GPIOD_PIN10) | \ | ||
722 | PIN_PUPDR_PULLUP(GPIOD_PIN11) | \ | ||
723 | PIN_PUPDR_FLOATING(GPIOD_MB2_PWM) | \ | ||
724 | PIN_PUPDR_PULLUP(GPIOD_PIN13) | \ | ||
725 | PIN_PUPDR_PULLUP(GPIOD_PIN14) | \ | ||
726 | PIN_PUPDR_PULLUP(GPIOD_PIN15)) | ||
727 | #define VAL_GPIOD_ODR (PIN_ODR_HIGH(GPIOD_PIN0) | \ | ||
728 | PIN_ODR_HIGH(GPIOD_PIN1) | \ | ||
729 | PIN_ODR_HIGH(GPIOD_PIN2) | \ | ||
730 | PIN_ODR_HIGH(GPIOD_PIN3) | \ | ||
731 | PIN_ODR_HIGH(GPIOD_PIN4) | \ | ||
732 | PIN_ODR_HIGH(GPIOD_USART2_TX) | \ | ||
733 | PIN_ODR_HIGH(GPIOD_USART2_RX) | \ | ||
734 | PIN_ODR_HIGH(GPIOD_PIN7) | \ | ||
735 | PIN_ODR_HIGH(GPIOD_USART3_TX) | \ | ||
736 | PIN_ODR_HIGH(GPIOD_USART3_RX) | \ | ||
737 | PIN_ODR_HIGH(GPIOD_PIN10) | \ | ||
738 | PIN_ODR_HIGH(GPIOD_PIN11) | \ | ||
739 | PIN_ODR_HIGH(GPIOD_MB2_PWM) | \ | ||
740 | PIN_ODR_HIGH(GPIOD_PIN13) | \ | ||
741 | PIN_ODR_HIGH(GPIOD_PIN14) | \ | ||
742 | PIN_ODR_HIGH(GPIOD_PIN15)) | ||
743 | #define VAL_GPIOD_AFRL (PIN_AFIO_AF(GPIOD_PIN0, 0U) | \ | ||
744 | PIN_AFIO_AF(GPIOD_PIN1, 0U) | \ | ||
745 | PIN_AFIO_AF(GPIOD_PIN2, 0U) | \ | ||
746 | PIN_AFIO_AF(GPIOD_PIN3, 0U) | \ | ||
747 | PIN_AFIO_AF(GPIOD_PIN4, 0U) | \ | ||
748 | PIN_AFIO_AF(GPIOD_USART2_TX, 7U) | \ | ||
749 | PIN_AFIO_AF(GPIOD_USART2_RX, 7U) | \ | ||
750 | PIN_AFIO_AF(GPIOD_PIN7, 0U)) | ||
751 | #define VAL_GPIOD_AFRH (PIN_AFIO_AF(GPIOD_USART3_TX, 7U) | \ | ||
752 | PIN_AFIO_AF(GPIOD_USART3_RX, 7U) | \ | ||
753 | PIN_AFIO_AF(GPIOD_PIN10, 0U) | \ | ||
754 | PIN_AFIO_AF(GPIOD_PIN11, 0U) | \ | ||
755 | PIN_AFIO_AF(GPIOD_MB2_PWM, 2U) | \ | ||
756 | PIN_AFIO_AF(GPIOD_PIN13, 0U) | \ | ||
757 | PIN_AFIO_AF(GPIOD_PIN14, 0U) | \ | ||
758 | PIN_AFIO_AF(GPIOD_PIN15, 0U)) | ||
759 | |||
760 | /* | ||
761 | * GPIOE setup: | ||
762 | * | ||
763 | * PE0 - BUTTON1 (input floating). | ||
764 | * PE1 - PIN1 (input pullup). | ||
765 | * PE2 - PIN2 (input pullup). | ||
766 | * PE3 - PIN3 (input pullup). | ||
767 | * PE4 - PIN4 (input pullup). | ||
768 | * PE5 - PIN5 (input pullup). | ||
769 | * PE6 - PIN6 (input pullup). | ||
770 | * PE7 - MB1_RST (output pushpull maximum). | ||
771 | * PE8 - MB1_CS (output pushpull maximum). | ||
772 | * PE9 - MB1_PWM (alternate 1). | ||
773 | * PE10 - MB1_INT (input floating). | ||
774 | * PE11 - MB2_CS (output pushpull maximum). | ||
775 | * PE12 - LED1 (output pushpull maximum). | ||
776 | * PE13 - MB2_RST (output pushpull maximum). | ||
777 | * PE14 - MB2_INT (input floating). | ||
778 | * PE15 - LED2 (output pushpull maximum). | ||
779 | */ | ||
780 | #define VAL_GPIOE_MODER (PIN_MODE_INPUT(GPIOE_BUTTON1) | \ | ||
781 | PIN_MODE_INPUT(GPIOE_PIN1) | \ | ||
782 | PIN_MODE_INPUT(GPIOE_PIN2) | \ | ||
783 | PIN_MODE_INPUT(GPIOE_PIN3) | \ | ||
784 | PIN_MODE_INPUT(GPIOE_PIN4) | \ | ||
785 | PIN_MODE_INPUT(GPIOE_PIN5) | \ | ||
786 | PIN_MODE_INPUT(GPIOE_PIN6) | \ | ||
787 | PIN_MODE_OUTPUT(GPIOE_MB1_RST) | \ | ||
788 | PIN_MODE_OUTPUT(GPIOE_MB1_CS) | \ | ||
789 | PIN_MODE_ALTERNATE(GPIOE_MB1_PWM) | \ | ||
790 | PIN_MODE_INPUT(GPIOE_MB1_INT) | \ | ||
791 | PIN_MODE_OUTPUT(GPIOE_MB2_CS) | \ | ||
792 | PIN_MODE_OUTPUT(GPIOE_LED1) | \ | ||
793 | PIN_MODE_OUTPUT(GPIOE_MB2_RST) | \ | ||
794 | PIN_MODE_INPUT(GPIOE_MB2_INT) | \ | ||
795 | PIN_MODE_OUTPUT(GPIOE_LED2)) | ||
796 | #define VAL_GPIOE_OTYPER (PIN_OTYPE_PUSHPULL(GPIOE_BUTTON1) | \ | ||
797 | PIN_OTYPE_PUSHPULL(GPIOE_PIN1) | \ | ||
798 | PIN_OTYPE_PUSHPULL(GPIOE_PIN2) | \ | ||
799 | PIN_OTYPE_PUSHPULL(GPIOE_PIN3) | \ | ||
800 | PIN_OTYPE_PUSHPULL(GPIOE_PIN4) | \ | ||
801 | PIN_OTYPE_PUSHPULL(GPIOE_PIN5) | \ | ||
802 | PIN_OTYPE_PUSHPULL(GPIOE_PIN6) | \ | ||
803 | PIN_OTYPE_PUSHPULL(GPIOE_MB1_RST) | \ | ||
804 | PIN_OTYPE_PUSHPULL(GPIOE_MB1_CS) | \ | ||
805 | PIN_OTYPE_PUSHPULL(GPIOE_MB1_PWM) | \ | ||
806 | PIN_OTYPE_PUSHPULL(GPIOE_MB1_INT) | \ | ||
807 | PIN_OTYPE_PUSHPULL(GPIOE_MB2_CS) | \ | ||
808 | PIN_OTYPE_PUSHPULL(GPIOE_LED1) | \ | ||
809 | PIN_OTYPE_PUSHPULL(GPIOE_MB2_RST) | \ | ||
810 | PIN_OTYPE_PUSHPULL(GPIOE_MB2_INT) | \ | ||
811 | PIN_OTYPE_PUSHPULL(GPIOE_LED2)) | ||
812 | #define VAL_GPIOE_OSPEEDR (PIN_OSPEED_HIGH(GPIOE_BUTTON1) | \ | ||
813 | PIN_OSPEED_HIGH(GPIOE_PIN1) | \ | ||
814 | PIN_OSPEED_HIGH(GPIOE_PIN2) | \ | ||
815 | PIN_OSPEED_HIGH(GPIOE_PIN3) | \ | ||
816 | PIN_OSPEED_HIGH(GPIOE_PIN4) | \ | ||
817 | PIN_OSPEED_HIGH(GPIOE_PIN5) | \ | ||
818 | PIN_OSPEED_HIGH(GPIOE_PIN6) | \ | ||
819 | PIN_OSPEED_HIGH(GPIOE_MB1_RST) | \ | ||
820 | PIN_OSPEED_HIGH(GPIOE_MB1_CS) | \ | ||
821 | PIN_OSPEED_HIGH(GPIOE_MB1_PWM) | \ | ||
822 | PIN_OSPEED_HIGH(GPIOE_MB1_INT) | \ | ||
823 | PIN_OSPEED_HIGH(GPIOE_MB2_CS) | \ | ||
824 | PIN_OSPEED_HIGH(GPIOE_LED1) | \ | ||
825 | PIN_OSPEED_HIGH(GPIOE_MB2_RST) | \ | ||
826 | PIN_OSPEED_HIGH(GPIOE_MB2_INT) | \ | ||
827 | PIN_OSPEED_HIGH(GPIOE_LED2)) | ||
828 | #define VAL_GPIOE_PUPDR (PIN_PUPDR_FLOATING(GPIOE_BUTTON1) | \ | ||
829 | PIN_PUPDR_PULLUP(GPIOE_PIN1) | \ | ||
830 | PIN_PUPDR_PULLUP(GPIOE_PIN2) | \ | ||
831 | PIN_PUPDR_PULLUP(GPIOE_PIN3) | \ | ||
832 | PIN_PUPDR_PULLUP(GPIOE_PIN4) | \ | ||
833 | PIN_PUPDR_PULLUP(GPIOE_PIN5) | \ | ||
834 | PIN_PUPDR_PULLUP(GPIOE_PIN6) | \ | ||
835 | PIN_PUPDR_FLOATING(GPIOE_MB1_RST) | \ | ||
836 | PIN_PUPDR_FLOATING(GPIOE_MB1_CS) | \ | ||
837 | PIN_PUPDR_FLOATING(GPIOE_MB1_PWM) | \ | ||
838 | PIN_PUPDR_FLOATING(GPIOE_MB1_INT) | \ | ||
839 | PIN_PUPDR_FLOATING(GPIOE_MB2_CS) | \ | ||
840 | PIN_PUPDR_FLOATING(GPIOE_LED1) | \ | ||
841 | PIN_PUPDR_FLOATING(GPIOE_MB2_RST) | \ | ||
842 | PIN_PUPDR_FLOATING(GPIOE_MB2_INT) | \ | ||
843 | PIN_PUPDR_FLOATING(GPIOE_LED2)) | ||
844 | #define VAL_GPIOE_ODR (PIN_ODR_HIGH(GPIOE_BUTTON1) | \ | ||
845 | PIN_ODR_HIGH(GPIOE_PIN1) | \ | ||
846 | PIN_ODR_HIGH(GPIOE_PIN2) | \ | ||
847 | PIN_ODR_HIGH(GPIOE_PIN3) | \ | ||
848 | PIN_ODR_HIGH(GPIOE_PIN4) | \ | ||
849 | PIN_ODR_HIGH(GPIOE_PIN5) | \ | ||
850 | PIN_ODR_HIGH(GPIOE_PIN6) | \ | ||
851 | PIN_ODR_LOW(GPIOE_MB1_RST) | \ | ||
852 | PIN_ODR_HIGH(GPIOE_MB1_CS) | \ | ||
853 | PIN_ODR_HIGH(GPIOE_MB1_PWM) | \ | ||
854 | PIN_ODR_HIGH(GPIOE_MB1_INT) | \ | ||
855 | PIN_ODR_HIGH(GPIOE_MB2_CS) | \ | ||
856 | PIN_ODR_LOW(GPIOE_LED1) | \ | ||
857 | PIN_ODR_LOW(GPIOE_MB2_RST) | \ | ||
858 | PIN_ODR_HIGH(GPIOE_MB2_INT) | \ | ||
859 | PIN_ODR_LOW(GPIOE_LED2)) | ||
860 | #define VAL_GPIOE_AFRL (PIN_AFIO_AF(GPIOE_BUTTON1, 0U) | \ | ||
861 | PIN_AFIO_AF(GPIOE_PIN1, 0U) | \ | ||
862 | PIN_AFIO_AF(GPIOE_PIN2, 0U) | \ | ||
863 | PIN_AFIO_AF(GPIOE_PIN3, 0U) | \ | ||
864 | PIN_AFIO_AF(GPIOE_PIN4, 0U) | \ | ||
865 | PIN_AFIO_AF(GPIOE_PIN5, 0U) | \ | ||
866 | PIN_AFIO_AF(GPIOE_PIN6, 0U) | \ | ||
867 | PIN_AFIO_AF(GPIOE_MB1_RST, 0U)) | ||
868 | #define VAL_GPIOE_AFRH (PIN_AFIO_AF(GPIOE_MB1_CS, 0U) | \ | ||
869 | PIN_AFIO_AF(GPIOE_MB1_PWM, 1U) | \ | ||
870 | PIN_AFIO_AF(GPIOE_MB1_INT, 0U) | \ | ||
871 | PIN_AFIO_AF(GPIOE_MB2_CS, 0U) | \ | ||
872 | PIN_AFIO_AF(GPIOE_LED1, 0U) | \ | ||
873 | PIN_AFIO_AF(GPIOE_MB2_RST, 0U) | \ | ||
874 | PIN_AFIO_AF(GPIOE_MB2_INT, 0U) | \ | ||
875 | PIN_AFIO_AF(GPIOE_LED2, 0U)) | ||
876 | |||
877 | /* | ||
878 | * GPIOF setup: | ||
879 | * | ||
880 | * PF0 - PIN0 (input pullup). | ||
881 | * PF1 - PIN1 (input pullup). | ||
882 | * PF2 - PIN2 (input pullup). | ||
883 | * PF3 - PIN3 (input pullup). | ||
884 | * PF4 - PIN4 (input pullup). | ||
885 | * PF5 - PIN5 (input pullup). | ||
886 | * PF6 - PIN6 (input pullup). | ||
887 | * PF7 - PIN7 (input pullup). | ||
888 | * PF8 - PIN8 (input pullup). | ||
889 | * PF9 - PIN9 (input pullup). | ||
890 | * PF10 - PIN10 (input pullup). | ||
891 | * PF11 - PIN11 (input pullup). | ||
892 | * PF12 - PIN12 (input pullup). | ||
893 | * PF13 - PIN13 (input pullup). | ||
894 | * PF14 - PIN14 (input pullup). | ||
895 | * PF15 - PIN15 (input pullup). | ||
896 | */ | ||
897 | #define VAL_GPIOF_MODER (PIN_MODE_INPUT(GPIOF_PIN0) | \ | ||
898 | PIN_MODE_INPUT(GPIOF_PIN1) | \ | ||
899 | PIN_MODE_INPUT(GPIOF_PIN2) | \ | ||
900 | PIN_MODE_INPUT(GPIOF_PIN3) | \ | ||
901 | PIN_MODE_INPUT(GPIOF_PIN4) | \ | ||
902 | PIN_MODE_INPUT(GPIOF_PIN5) | \ | ||
903 | PIN_MODE_INPUT(GPIOF_PIN6) | \ | ||
904 | PIN_MODE_INPUT(GPIOF_PIN7) | \ | ||
905 | PIN_MODE_INPUT(GPIOF_PIN8) | \ | ||
906 | PIN_MODE_INPUT(GPIOF_PIN9) | \ | ||
907 | PIN_MODE_INPUT(GPIOF_PIN10) | \ | ||
908 | PIN_MODE_INPUT(GPIOF_PIN11) | \ | ||
909 | PIN_MODE_INPUT(GPIOF_PIN12) | \ | ||
910 | PIN_MODE_INPUT(GPIOF_PIN13) | \ | ||
911 | PIN_MODE_INPUT(GPIOF_PIN14) | \ | ||
912 | PIN_MODE_INPUT(GPIOF_PIN15)) | ||
913 | #define VAL_GPIOF_OTYPER (PIN_OTYPE_PUSHPULL(GPIOF_PIN0) | \ | ||
914 | PIN_OTYPE_PUSHPULL(GPIOF_PIN1) | \ | ||
915 | PIN_OTYPE_PUSHPULL(GPIOF_PIN2) | \ | ||
916 | PIN_OTYPE_PUSHPULL(GPIOF_PIN3) | \ | ||
917 | PIN_OTYPE_PUSHPULL(GPIOF_PIN4) | \ | ||
918 | PIN_OTYPE_PUSHPULL(GPIOF_PIN5) | \ | ||
919 | PIN_OTYPE_PUSHPULL(GPIOF_PIN6) | \ | ||
920 | PIN_OTYPE_PUSHPULL(GPIOF_PIN7) | \ | ||
921 | PIN_OTYPE_PUSHPULL(GPIOF_PIN8) | \ | ||
922 | PIN_OTYPE_PUSHPULL(GPIOF_PIN9) | \ | ||
923 | PIN_OTYPE_PUSHPULL(GPIOF_PIN10) | \ | ||
924 | PIN_OTYPE_PUSHPULL(GPIOF_PIN11) | \ | ||
925 | PIN_OTYPE_PUSHPULL(GPIOF_PIN12) | \ | ||
926 | PIN_OTYPE_PUSHPULL(GPIOF_PIN13) | \ | ||
927 | PIN_OTYPE_PUSHPULL(GPIOF_PIN14) | \ | ||
928 | PIN_OTYPE_PUSHPULL(GPIOF_PIN15)) | ||
929 | #define VAL_GPIOF_OSPEEDR (PIN_OSPEED_HIGH(GPIOF_PIN0) | \ | ||
930 | PIN_OSPEED_HIGH(GPIOF_PIN1) | \ | ||
931 | PIN_OSPEED_HIGH(GPIOF_PIN2) | \ | ||
932 | PIN_OSPEED_HIGH(GPIOF_PIN3) | \ | ||
933 | PIN_OSPEED_HIGH(GPIOF_PIN4) | \ | ||
934 | PIN_OSPEED_HIGH(GPIOF_PIN5) | \ | ||
935 | PIN_OSPEED_HIGH(GPIOF_PIN6) | \ | ||
936 | PIN_OSPEED_HIGH(GPIOF_PIN7) | \ | ||
937 | PIN_OSPEED_HIGH(GPIOF_PIN8) | \ | ||
938 | PIN_OSPEED_HIGH(GPIOF_PIN9) | \ | ||
939 | PIN_OSPEED_HIGH(GPIOF_PIN10) | \ | ||
940 | PIN_OSPEED_HIGH(GPIOF_PIN11) | \ | ||
941 | PIN_OSPEED_HIGH(GPIOF_PIN12) | \ | ||
942 | PIN_OSPEED_HIGH(GPIOF_PIN13) | \ | ||
943 | PIN_OSPEED_HIGH(GPIOF_PIN14) | \ | ||
944 | PIN_OSPEED_HIGH(GPIOF_PIN15)) | ||
945 | #define VAL_GPIOF_PUPDR (PIN_PUPDR_PULLUP(GPIOF_PIN0) | \ | ||
946 | PIN_PUPDR_PULLUP(GPIOF_PIN1) | \ | ||
947 | PIN_PUPDR_PULLUP(GPIOF_PIN2) | \ | ||
948 | PIN_PUPDR_PULLUP(GPIOF_PIN3) | \ | ||
949 | PIN_PUPDR_PULLUP(GPIOF_PIN4) | \ | ||
950 | PIN_PUPDR_PULLUP(GPIOF_PIN5) | \ | ||
951 | PIN_PUPDR_PULLUP(GPIOF_PIN6) | \ | ||
952 | PIN_PUPDR_PULLUP(GPIOF_PIN7) | \ | ||
953 | PIN_PUPDR_PULLUP(GPIOF_PIN8) | \ | ||
954 | PIN_PUPDR_PULLUP(GPIOF_PIN9) | \ | ||
955 | PIN_PUPDR_PULLUP(GPIOF_PIN10) | \ | ||
956 | PIN_PUPDR_PULLUP(GPIOF_PIN11) | \ | ||
957 | PIN_PUPDR_PULLUP(GPIOF_PIN12) | \ | ||
958 | PIN_PUPDR_PULLUP(GPIOF_PIN13) | \ | ||
959 | PIN_PUPDR_PULLUP(GPIOF_PIN14) | \ | ||
960 | PIN_PUPDR_PULLUP(GPIOF_PIN15)) | ||
961 | #define VAL_GPIOF_ODR (PIN_ODR_HIGH(GPIOF_PIN0) | \ | ||
962 | PIN_ODR_HIGH(GPIOF_PIN1) | \ | ||
963 | PIN_ODR_HIGH(GPIOF_PIN2) | \ | ||
964 | PIN_ODR_HIGH(GPIOF_PIN3) | \ | ||
965 | PIN_ODR_HIGH(GPIOF_PIN4) | \ | ||
966 | PIN_ODR_HIGH(GPIOF_PIN5) | \ | ||
967 | PIN_ODR_HIGH(GPIOF_PIN6) | \ | ||
968 | PIN_ODR_HIGH(GPIOF_PIN7) | \ | ||
969 | PIN_ODR_HIGH(GPIOF_PIN8) | \ | ||
970 | PIN_ODR_HIGH(GPIOF_PIN9) | \ | ||
971 | PIN_ODR_HIGH(GPIOF_PIN10) | \ | ||
972 | PIN_ODR_HIGH(GPIOF_PIN11) | \ | ||
973 | PIN_ODR_HIGH(GPIOF_PIN12) | \ | ||
974 | PIN_ODR_HIGH(GPIOF_PIN13) | \ | ||
975 | PIN_ODR_HIGH(GPIOF_PIN14) | \ | ||
976 | PIN_ODR_HIGH(GPIOF_PIN15)) | ||
977 | #define VAL_GPIOF_AFRL (PIN_AFIO_AF(GPIOF_PIN0, 0U) | \ | ||
978 | PIN_AFIO_AF(GPIOF_PIN1, 0U) | \ | ||
979 | PIN_AFIO_AF(GPIOF_PIN2, 0U) | \ | ||
980 | PIN_AFIO_AF(GPIOF_PIN3, 0U) | \ | ||
981 | PIN_AFIO_AF(GPIOF_PIN4, 0U) | \ | ||
982 | PIN_AFIO_AF(GPIOF_PIN5, 0U) | \ | ||
983 | PIN_AFIO_AF(GPIOF_PIN6, 0U) | \ | ||
984 | PIN_AFIO_AF(GPIOF_PIN7, 0U)) | ||
985 | #define VAL_GPIOF_AFRH (PIN_AFIO_AF(GPIOF_PIN8, 0U) | \ | ||
986 | PIN_AFIO_AF(GPIOF_PIN9, 0U) | \ | ||
987 | PIN_AFIO_AF(GPIOF_PIN10, 0U) | \ | ||
988 | PIN_AFIO_AF(GPIOF_PIN11, 0U) | \ | ||
989 | PIN_AFIO_AF(GPIOF_PIN12, 0U) | \ | ||
990 | PIN_AFIO_AF(GPIOF_PIN13, 0U) | \ | ||
991 | PIN_AFIO_AF(GPIOF_PIN14, 0U) | \ | ||
992 | PIN_AFIO_AF(GPIOF_PIN15, 0U)) | ||
993 | |||
994 | /* | ||
995 | * GPIOG setup: | ||
996 | * | ||
997 | * PG0 - PIN0 (input pullup). | ||
998 | * PG1 - PIN1 (input pullup). | ||
999 | * PG2 - PIN2 (input pullup). | ||
1000 | * PG3 - PIN3 (input pullup). | ||
1001 | * PG4 - PIN4 (input pullup). | ||
1002 | * PG5 - PIN5 (input pullup). | ||
1003 | * PG6 - PIN6 (input pullup). | ||
1004 | * PG7 - PIN7 (input pullup). | ||
1005 | * PG8 - PIN8 (input pullup). | ||
1006 | * PG9 - PIN9 (input pullup). | ||
1007 | * PG10 - PIN10 (input pullup). | ||
1008 | * PG11 - PIN11 (input pullup). | ||
1009 | * PG12 - PIN12 (input pullup). | ||
1010 | * PG13 - PIN13 (input pullup). | ||
1011 | * PG14 - PIN14 (input pullup). | ||
1012 | * PG15 - PIN15 (input pullup). | ||
1013 | */ | ||
1014 | #define VAL_GPIOG_MODER (PIN_MODE_INPUT(GPIOG_PIN0) | \ | ||
1015 | PIN_MODE_INPUT(GPIOG_PIN1) | \ | ||
1016 | PIN_MODE_INPUT(GPIOG_PIN2) | \ | ||
1017 | PIN_MODE_INPUT(GPIOG_PIN3) | \ | ||
1018 | PIN_MODE_INPUT(GPIOG_PIN4) | \ | ||
1019 | PIN_MODE_INPUT(GPIOG_PIN5) | \ | ||
1020 | PIN_MODE_INPUT(GPIOG_PIN6) | \ | ||
1021 | PIN_MODE_INPUT(GPIOG_PIN7) | \ | ||
1022 | PIN_MODE_INPUT(GPIOG_PIN8) | \ | ||
1023 | PIN_MODE_INPUT(GPIOG_PIN9) | \ | ||
1024 | PIN_MODE_INPUT(GPIOG_PIN10) | \ | ||
1025 | PIN_MODE_INPUT(GPIOG_PIN11) | \ | ||
1026 | PIN_MODE_INPUT(GPIOG_PIN12) | \ | ||
1027 | PIN_MODE_INPUT(GPIOG_PIN13) | \ | ||
1028 | PIN_MODE_INPUT(GPIOG_PIN14) | \ | ||
1029 | PIN_MODE_INPUT(GPIOG_PIN15)) | ||
1030 | #define VAL_GPIOG_OTYPER (PIN_OTYPE_PUSHPULL(GPIOG_PIN0) | \ | ||
1031 | PIN_OTYPE_PUSHPULL(GPIOG_PIN1) | \ | ||
1032 | PIN_OTYPE_PUSHPULL(GPIOG_PIN2) | \ | ||
1033 | PIN_OTYPE_PUSHPULL(GPIOG_PIN3) | \ | ||
1034 | PIN_OTYPE_PUSHPULL(GPIOG_PIN4) | \ | ||
1035 | PIN_OTYPE_PUSHPULL(GPIOG_PIN5) | \ | ||
1036 | PIN_OTYPE_PUSHPULL(GPIOG_PIN6) | \ | ||
1037 | PIN_OTYPE_PUSHPULL(GPIOG_PIN7) | \ | ||
1038 | PIN_OTYPE_PUSHPULL(GPIOG_PIN8) | \ | ||
1039 | PIN_OTYPE_PUSHPULL(GPIOG_PIN9) | \ | ||
1040 | PIN_OTYPE_PUSHPULL(GPIOG_PIN10) | \ | ||
1041 | PIN_OTYPE_PUSHPULL(GPIOG_PIN11) | \ | ||
1042 | PIN_OTYPE_PUSHPULL(GPIOG_PIN12) | \ | ||
1043 | PIN_OTYPE_PUSHPULL(GPIOG_PIN13) | \ | ||
1044 | PIN_OTYPE_PUSHPULL(GPIOG_PIN14) | \ | ||
1045 | PIN_OTYPE_PUSHPULL(GPIOG_PIN15)) | ||
1046 | #define VAL_GPIOG_OSPEEDR (PIN_OSPEED_HIGH(GPIOG_PIN0) | \ | ||
1047 | PIN_OSPEED_HIGH(GPIOG_PIN1) | \ | ||
1048 | PIN_OSPEED_HIGH(GPIOG_PIN2) | \ | ||
1049 | PIN_OSPEED_HIGH(GPIOG_PIN3) | \ | ||
1050 | PIN_OSPEED_HIGH(GPIOG_PIN4) | \ | ||
1051 | PIN_OSPEED_HIGH(GPIOG_PIN5) | \ | ||
1052 | PIN_OSPEED_HIGH(GPIOG_PIN6) | \ | ||
1053 | PIN_OSPEED_HIGH(GPIOG_PIN7) | \ | ||
1054 | PIN_OSPEED_HIGH(GPIOG_PIN8) | \ | ||
1055 | PIN_OSPEED_HIGH(GPIOG_PIN9) | \ | ||
1056 | PIN_OSPEED_HIGH(GPIOG_PIN10) | \ | ||
1057 | PIN_OSPEED_HIGH(GPIOG_PIN11) | \ | ||
1058 | PIN_OSPEED_HIGH(GPIOG_PIN12) | \ | ||
1059 | PIN_OSPEED_HIGH(GPIOG_PIN13) | \ | ||
1060 | PIN_OSPEED_HIGH(GPIOG_PIN14) | \ | ||
1061 | PIN_OSPEED_HIGH(GPIOG_PIN15)) | ||
1062 | #define VAL_GPIOG_PUPDR (PIN_PUPDR_PULLUP(GPIOG_PIN0) | \ | ||
1063 | PIN_PUPDR_PULLUP(GPIOG_PIN1) | \ | ||
1064 | PIN_PUPDR_PULLUP(GPIOG_PIN2) | \ | ||
1065 | PIN_PUPDR_PULLUP(GPIOG_PIN3) | \ | ||
1066 | PIN_PUPDR_PULLUP(GPIOG_PIN4) | \ | ||
1067 | PIN_PUPDR_PULLUP(GPIOG_PIN5) | \ | ||
1068 | PIN_PUPDR_PULLUP(GPIOG_PIN6) | \ | ||
1069 | PIN_PUPDR_PULLUP(GPIOG_PIN7) | \ | ||
1070 | PIN_PUPDR_PULLUP(GPIOG_PIN8) | \ | ||
1071 | PIN_PUPDR_PULLUP(GPIOG_PIN9) | \ | ||
1072 | PIN_PUPDR_PULLUP(GPIOG_PIN10) | \ | ||
1073 | PIN_PUPDR_PULLUP(GPIOG_PIN11) | \ | ||
1074 | PIN_PUPDR_PULLUP(GPIOG_PIN12) | \ | ||
1075 | PIN_PUPDR_PULLUP(GPIOG_PIN13) | \ | ||
1076 | PIN_PUPDR_PULLUP(GPIOG_PIN14) | \ | ||
1077 | PIN_PUPDR_PULLUP(GPIOG_PIN15)) | ||
1078 | #define VAL_GPIOG_ODR (PIN_ODR_HIGH(GPIOG_PIN0) | \ | ||
1079 | PIN_ODR_HIGH(GPIOG_PIN1) | \ | ||
1080 | PIN_ODR_HIGH(GPIOG_PIN2) | \ | ||
1081 | PIN_ODR_HIGH(GPIOG_PIN3) | \ | ||
1082 | PIN_ODR_HIGH(GPIOG_PIN4) | \ | ||
1083 | PIN_ODR_HIGH(GPIOG_PIN5) | \ | ||
1084 | PIN_ODR_HIGH(GPIOG_PIN6) | \ | ||
1085 | PIN_ODR_HIGH(GPIOG_PIN7) | \ | ||
1086 | PIN_ODR_HIGH(GPIOG_PIN8) | \ | ||
1087 | PIN_ODR_HIGH(GPIOG_PIN9) | \ | ||
1088 | PIN_ODR_HIGH(GPIOG_PIN10) | \ | ||
1089 | PIN_ODR_HIGH(GPIOG_PIN11) | \ | ||
1090 | PIN_ODR_HIGH(GPIOG_PIN12) | \ | ||
1091 | PIN_ODR_HIGH(GPIOG_PIN13) | \ | ||
1092 | PIN_ODR_HIGH(GPIOG_PIN14) | \ | ||
1093 | PIN_ODR_HIGH(GPIOG_PIN15)) | ||
1094 | #define VAL_GPIOG_AFRL (PIN_AFIO_AF(GPIOG_PIN0, 0U) | \ | ||
1095 | PIN_AFIO_AF(GPIOG_PIN1, 0U) | \ | ||
1096 | PIN_AFIO_AF(GPIOG_PIN2, 0U) | \ | ||
1097 | PIN_AFIO_AF(GPIOG_PIN3, 0U) | \ | ||
1098 | PIN_AFIO_AF(GPIOG_PIN4, 0U) | \ | ||
1099 | PIN_AFIO_AF(GPIOG_PIN5, 0U) | \ | ||
1100 | PIN_AFIO_AF(GPIOG_PIN6, 0U) | \ | ||
1101 | PIN_AFIO_AF(GPIOG_PIN7, 0U)) | ||
1102 | #define VAL_GPIOG_AFRH (PIN_AFIO_AF(GPIOG_PIN8, 0U) | \ | ||
1103 | PIN_AFIO_AF(GPIOG_PIN9, 0U) | \ | ||
1104 | PIN_AFIO_AF(GPIOG_PIN10, 0U) | \ | ||
1105 | PIN_AFIO_AF(GPIOG_PIN11, 0U) | \ | ||
1106 | PIN_AFIO_AF(GPIOG_PIN12, 0U) | \ | ||
1107 | PIN_AFIO_AF(GPIOG_PIN13, 0U) | \ | ||
1108 | PIN_AFIO_AF(GPIOG_PIN14, 0U) | \ | ||
1109 | PIN_AFIO_AF(GPIOG_PIN15, 0U)) | ||
1110 | |||
1111 | /* | ||
1112 | * GPIOH setup: | ||
1113 | * | ||
1114 | * PH0 - PIN0 (input pullup). | ||
1115 | * PH1 - PIN1 (input pullup). | ||
1116 | * PH2 - PIN2 (input pullup). | ||
1117 | * PH3 - PIN3 (input pullup). | ||
1118 | * PH4 - PIN4 (input pullup). | ||
1119 | * PH5 - PIN5 (input pullup). | ||
1120 | * PH6 - PIN6 (input pullup). | ||
1121 | * PH7 - PIN7 (input pullup). | ||
1122 | * PH8 - PIN8 (input pullup). | ||
1123 | * PH9 - PIN9 (input pullup). | ||
1124 | * PH10 - PIN10 (input pullup). | ||
1125 | * PH11 - PIN11 (input pullup). | ||
1126 | * PH12 - PIN12 (input pullup). | ||
1127 | * PH13 - PIN13 (input pullup). | ||
1128 | * PH14 - PIN14 (input pullup). | ||
1129 | * PH15 - PIN15 (input pullup). | ||
1130 | */ | ||
1131 | #define VAL_GPIOH_MODER (PIN_MODE_INPUT(GPIOH_PIN0) | \ | ||
1132 | PIN_MODE_INPUT(GPIOH_PIN1) | \ | ||
1133 | PIN_MODE_INPUT(GPIOH_PIN2) | \ | ||
1134 | PIN_MODE_INPUT(GPIOH_PIN3) | \ | ||
1135 | PIN_MODE_INPUT(GPIOH_PIN4) | \ | ||
1136 | PIN_MODE_INPUT(GPIOH_PIN5) | \ | ||
1137 | PIN_MODE_INPUT(GPIOH_PIN6) | \ | ||
1138 | PIN_MODE_INPUT(GPIOH_PIN7) | \ | ||
1139 | PIN_MODE_INPUT(GPIOH_PIN8) | \ | ||
1140 | PIN_MODE_INPUT(GPIOH_PIN9) | \ | ||
1141 | PIN_MODE_INPUT(GPIOH_PIN10) | \ | ||
1142 | PIN_MODE_INPUT(GPIOH_PIN11) | \ | ||
1143 | PIN_MODE_INPUT(GPIOH_PIN12) | \ | ||
1144 | PIN_MODE_INPUT(GPIOH_PIN13) | \ | ||
1145 | PIN_MODE_INPUT(GPIOH_PIN14) | \ | ||
1146 | PIN_MODE_INPUT(GPIOH_PIN15)) | ||
1147 | #define VAL_GPIOH_OTYPER (PIN_OTYPE_PUSHPULL(GPIOH_PIN0) | \ | ||
1148 | PIN_OTYPE_PUSHPULL(GPIOH_PIN1) | \ | ||
1149 | PIN_OTYPE_PUSHPULL(GPIOH_PIN2) | \ | ||
1150 | PIN_OTYPE_PUSHPULL(GPIOH_PIN3) | \ | ||
1151 | PIN_OTYPE_PUSHPULL(GPIOH_PIN4) | \ | ||
1152 | PIN_OTYPE_PUSHPULL(GPIOH_PIN5) | \ | ||
1153 | PIN_OTYPE_PUSHPULL(GPIOH_PIN6) | \ | ||
1154 | PIN_OTYPE_PUSHPULL(GPIOH_PIN7) | \ | ||
1155 | PIN_OTYPE_PUSHPULL(GPIOH_PIN8) | \ | ||
1156 | PIN_OTYPE_PUSHPULL(GPIOH_PIN9) | \ | ||
1157 | PIN_OTYPE_PUSHPULL(GPIOH_PIN10) | \ | ||
1158 | PIN_OTYPE_PUSHPULL(GPIOH_PIN11) | \ | ||
1159 | PIN_OTYPE_PUSHPULL(GPIOH_PIN12) | \ | ||
1160 | PIN_OTYPE_PUSHPULL(GPIOH_PIN13) | \ | ||
1161 | PIN_OTYPE_PUSHPULL(GPIOH_PIN14) | \ | ||
1162 | PIN_OTYPE_PUSHPULL(GPIOH_PIN15)) | ||
1163 | #define VAL_GPIOH_OSPEEDR (PIN_OSPEED_HIGH(GPIOH_PIN0) | \ | ||
1164 | PIN_OSPEED_HIGH(GPIOH_PIN1) | \ | ||
1165 | PIN_OSPEED_HIGH(GPIOH_PIN2) | \ | ||
1166 | PIN_OSPEED_HIGH(GPIOH_PIN3) | \ | ||
1167 | PIN_OSPEED_HIGH(GPIOH_PIN4) | \ | ||
1168 | PIN_OSPEED_HIGH(GPIOH_PIN5) | \ | ||
1169 | PIN_OSPEED_HIGH(GPIOH_PIN6) | \ | ||
1170 | PIN_OSPEED_HIGH(GPIOH_PIN7) | \ | ||
1171 | PIN_OSPEED_HIGH(GPIOH_PIN8) | \ | ||
1172 | PIN_OSPEED_HIGH(GPIOH_PIN9) | \ | ||
1173 | PIN_OSPEED_HIGH(GPIOH_PIN10) | \ | ||
1174 | PIN_OSPEED_HIGH(GPIOH_PIN11) | \ | ||
1175 | PIN_OSPEED_HIGH(GPIOH_PIN12) | \ | ||
1176 | PIN_OSPEED_HIGH(GPIOH_PIN13) | \ | ||
1177 | PIN_OSPEED_HIGH(GPIOH_PIN14) | \ | ||
1178 | PIN_OSPEED_HIGH(GPIOH_PIN15)) | ||
1179 | #define VAL_GPIOH_PUPDR (PIN_PUPDR_PULLUP(GPIOH_PIN0) | \ | ||
1180 | PIN_PUPDR_PULLUP(GPIOH_PIN1) | \ | ||
1181 | PIN_PUPDR_PULLUP(GPIOH_PIN2) | \ | ||
1182 | PIN_PUPDR_PULLUP(GPIOH_PIN3) | \ | ||
1183 | PIN_PUPDR_PULLUP(GPIOH_PIN4) | \ | ||
1184 | PIN_PUPDR_PULLUP(GPIOH_PIN5) | \ | ||
1185 | PIN_PUPDR_PULLUP(GPIOH_PIN6) | \ | ||
1186 | PIN_PUPDR_PULLUP(GPIOH_PIN7) | \ | ||
1187 | PIN_PUPDR_PULLUP(GPIOH_PIN8) | \ | ||
1188 | PIN_PUPDR_PULLUP(GPIOH_PIN9) | \ | ||
1189 | PIN_PUPDR_PULLUP(GPIOH_PIN10) | \ | ||
1190 | PIN_PUPDR_PULLUP(GPIOH_PIN11) | \ | ||
1191 | PIN_PUPDR_PULLUP(GPIOH_PIN12) | \ | ||
1192 | PIN_PUPDR_PULLUP(GPIOH_PIN13) | \ | ||
1193 | PIN_PUPDR_PULLUP(GPIOH_PIN14) | \ | ||
1194 | PIN_PUPDR_PULLUP(GPIOH_PIN15)) | ||
1195 | #define VAL_GPIOH_ODR (PIN_ODR_HIGH(GPIOH_PIN0) | \ | ||
1196 | PIN_ODR_HIGH(GPIOH_PIN1) | \ | ||
1197 | PIN_ODR_HIGH(GPIOH_PIN2) | \ | ||
1198 | PIN_ODR_HIGH(GPIOH_PIN3) | \ | ||
1199 | PIN_ODR_HIGH(GPIOH_PIN4) | \ | ||
1200 | PIN_ODR_HIGH(GPIOH_PIN5) | \ | ||
1201 | PIN_ODR_HIGH(GPIOH_PIN6) | \ | ||
1202 | PIN_ODR_HIGH(GPIOH_PIN7) | \ | ||
1203 | PIN_ODR_HIGH(GPIOH_PIN8) | \ | ||
1204 | PIN_ODR_HIGH(GPIOH_PIN9) | \ | ||
1205 | PIN_ODR_HIGH(GPIOH_PIN10) | \ | ||
1206 | PIN_ODR_HIGH(GPIOH_PIN11) | \ | ||
1207 | PIN_ODR_HIGH(GPIOH_PIN12) | \ | ||
1208 | PIN_ODR_HIGH(GPIOH_PIN13) | \ | ||
1209 | PIN_ODR_HIGH(GPIOH_PIN14) | \ | ||
1210 | PIN_ODR_HIGH(GPIOH_PIN15)) | ||
1211 | #define VAL_GPIOH_AFRL (PIN_AFIO_AF(GPIOH_PIN0, 0U) | \ | ||
1212 | PIN_AFIO_AF(GPIOH_PIN1, 0U) | \ | ||
1213 | PIN_AFIO_AF(GPIOH_PIN2, 0U) | \ | ||
1214 | PIN_AFIO_AF(GPIOH_PIN3, 0U) | \ | ||
1215 | PIN_AFIO_AF(GPIOH_PIN4, 0U) | \ | ||
1216 | PIN_AFIO_AF(GPIOH_PIN5, 0U) | \ | ||
1217 | PIN_AFIO_AF(GPIOH_PIN6, 0U) | \ | ||
1218 | PIN_AFIO_AF(GPIOH_PIN7, 0U)) | ||
1219 | #define VAL_GPIOH_AFRH (PIN_AFIO_AF(GPIOH_PIN8, 0U) | \ | ||
1220 | PIN_AFIO_AF(GPIOH_PIN9, 0U) | \ | ||
1221 | PIN_AFIO_AF(GPIOH_PIN10, 0U) | \ | ||
1222 | PIN_AFIO_AF(GPIOH_PIN11, 0U) | \ | ||
1223 | PIN_AFIO_AF(GPIOH_PIN12, 0U) | \ | ||
1224 | PIN_AFIO_AF(GPIOH_PIN13, 0U) | \ | ||
1225 | PIN_AFIO_AF(GPIOH_PIN14, 0U) | \ | ||
1226 | PIN_AFIO_AF(GPIOH_PIN15, 0U)) | ||
1227 | |||
1228 | /* | ||
1229 | * GPIOI setup: | ||
1230 | * | ||
1231 | * PI0 - PIN0 (input pullup). | ||
1232 | * PI1 - PIN1 (input pullup). | ||
1233 | * PI2 - PIN2 (input pullup). | ||
1234 | * PI3 - PIN3 (input pullup). | ||
1235 | * PI4 - PIN4 (input pullup). | ||
1236 | * PI5 - PIN5 (input pullup). | ||
1237 | * PI6 - PIN6 (input pullup). | ||
1238 | * PI7 - PIN7 (input pullup). | ||
1239 | * PI8 - PIN8 (input pullup). | ||
1240 | * PI9 - PIN9 (input pullup). | ||
1241 | * PI10 - PIN10 (input pullup). | ||
1242 | * PI11 - PIN11 (input pullup). | ||
1243 | * PI12 - PIN12 (input pullup). | ||
1244 | * PI13 - PIN13 (input pullup). | ||
1245 | * PI14 - PIN14 (input pullup). | ||
1246 | * PI15 - PIN15 (input pullup). | ||
1247 | */ | ||
1248 | #define VAL_GPIOI_MODER (PIN_MODE_INPUT(GPIOI_PIN0) | \ | ||
1249 | PIN_MODE_INPUT(GPIOI_PIN1) | \ | ||
1250 | PIN_MODE_INPUT(GPIOI_PIN2) | \ | ||
1251 | PIN_MODE_INPUT(GPIOI_PIN3) | \ | ||
1252 | PIN_MODE_INPUT(GPIOI_PIN4) | \ | ||
1253 | PIN_MODE_INPUT(GPIOI_PIN5) | \ | ||
1254 | PIN_MODE_INPUT(GPIOI_PIN6) | \ | ||
1255 | PIN_MODE_INPUT(GPIOI_PIN7) | \ | ||
1256 | PIN_MODE_INPUT(GPIOI_PIN8) | \ | ||
1257 | PIN_MODE_INPUT(GPIOI_PIN9) | \ | ||
1258 | PIN_MODE_INPUT(GPIOI_PIN10) | \ | ||
1259 | PIN_MODE_INPUT(GPIOI_PIN11) | \ | ||
1260 | PIN_MODE_INPUT(GPIOI_PIN12) | \ | ||
1261 | PIN_MODE_INPUT(GPIOI_PIN13) | \ | ||
1262 | PIN_MODE_INPUT(GPIOI_PIN14) | \ | ||
1263 | PIN_MODE_INPUT(GPIOI_PIN15)) | ||
1264 | #define VAL_GPIOI_OTYPER (PIN_OTYPE_PUSHPULL(GPIOI_PIN0) | \ | ||
1265 | PIN_OTYPE_PUSHPULL(GPIOI_PIN1) | \ | ||
1266 | PIN_OTYPE_PUSHPULL(GPIOI_PIN2) | \ | ||
1267 | PIN_OTYPE_PUSHPULL(GPIOI_PIN3) | \ | ||
1268 | PIN_OTYPE_PUSHPULL(GPIOI_PIN4) | \ | ||
1269 | PIN_OTYPE_PUSHPULL(GPIOI_PIN5) | \ | ||
1270 | PIN_OTYPE_PUSHPULL(GPIOI_PIN6) | \ | ||
1271 | PIN_OTYPE_PUSHPULL(GPIOI_PIN7) | \ | ||
1272 | PIN_OTYPE_PUSHPULL(GPIOI_PIN8) | \ | ||
1273 | PIN_OTYPE_PUSHPULL(GPIOI_PIN9) | \ | ||
1274 | PIN_OTYPE_PUSHPULL(GPIOI_PIN10) | \ | ||
1275 | PIN_OTYPE_PUSHPULL(GPIOI_PIN11) | \ | ||
1276 | PIN_OTYPE_PUSHPULL(GPIOI_PIN12) | \ | ||
1277 | PIN_OTYPE_PUSHPULL(GPIOI_PIN13) | \ | ||
1278 | PIN_OTYPE_PUSHPULL(GPIOI_PIN14) | \ | ||
1279 | PIN_OTYPE_PUSHPULL(GPIOI_PIN15)) | ||
1280 | #define VAL_GPIOI_OSPEEDR (PIN_OSPEED_HIGH(GPIOI_PIN0) | \ | ||
1281 | PIN_OSPEED_HIGH(GPIOI_PIN1) | \ | ||
1282 | PIN_OSPEED_HIGH(GPIOI_PIN2) | \ | ||
1283 | PIN_OSPEED_HIGH(GPIOI_PIN3) | \ | ||
1284 | PIN_OSPEED_HIGH(GPIOI_PIN4) | \ | ||
1285 | PIN_OSPEED_HIGH(GPIOI_PIN5) | \ | ||
1286 | PIN_OSPEED_HIGH(GPIOI_PIN6) | \ | ||
1287 | PIN_OSPEED_HIGH(GPIOI_PIN7) | \ | ||
1288 | PIN_OSPEED_HIGH(GPIOI_PIN8) | \ | ||
1289 | PIN_OSPEED_HIGH(GPIOI_PIN9) | \ | ||
1290 | PIN_OSPEED_HIGH(GPIOI_PIN10) | \ | ||
1291 | PIN_OSPEED_HIGH(GPIOI_PIN11) | \ | ||
1292 | PIN_OSPEED_HIGH(GPIOI_PIN12) | \ | ||
1293 | PIN_OSPEED_HIGH(GPIOI_PIN13) | \ | ||
1294 | PIN_OSPEED_HIGH(GPIOI_PIN14) | \ | ||
1295 | PIN_OSPEED_HIGH(GPIOI_PIN15)) | ||
1296 | #define VAL_GPIOI_PUPDR (PIN_PUPDR_PULLUP(GPIOI_PIN0) | \ | ||
1297 | PIN_PUPDR_PULLUP(GPIOI_PIN1) | \ | ||
1298 | PIN_PUPDR_PULLUP(GPIOI_PIN2) | \ | ||
1299 | PIN_PUPDR_PULLUP(GPIOI_PIN3) | \ | ||
1300 | PIN_PUPDR_PULLUP(GPIOI_PIN4) | \ | ||
1301 | PIN_PUPDR_PULLUP(GPIOI_PIN5) | \ | ||
1302 | PIN_PUPDR_PULLUP(GPIOI_PIN6) | \ | ||
1303 | PIN_PUPDR_PULLUP(GPIOI_PIN7) | \ | ||
1304 | PIN_PUPDR_PULLUP(GPIOI_PIN8) | \ | ||
1305 | PIN_PUPDR_PULLUP(GPIOI_PIN9) | \ | ||
1306 | PIN_PUPDR_PULLUP(GPIOI_PIN10) | \ | ||
1307 | PIN_PUPDR_PULLUP(GPIOI_PIN11) | \ | ||
1308 | PIN_PUPDR_PULLUP(GPIOI_PIN12) | \ | ||
1309 | PIN_PUPDR_PULLUP(GPIOI_PIN13) | \ | ||
1310 | PIN_PUPDR_PULLUP(GPIOI_PIN14) | \ | ||
1311 | PIN_PUPDR_PULLUP(GPIOI_PIN15)) | ||
1312 | #define VAL_GPIOI_ODR (PIN_ODR_HIGH(GPIOI_PIN0) | \ | ||
1313 | PIN_ODR_HIGH(GPIOI_PIN1) | \ | ||
1314 | PIN_ODR_HIGH(GPIOI_PIN2) | \ | ||
1315 | PIN_ODR_HIGH(GPIOI_PIN3) | \ | ||
1316 | PIN_ODR_HIGH(GPIOI_PIN4) | \ | ||
1317 | PIN_ODR_HIGH(GPIOI_PIN5) | \ | ||
1318 | PIN_ODR_HIGH(GPIOI_PIN6) | \ | ||
1319 | PIN_ODR_HIGH(GPIOI_PIN7) | \ | ||
1320 | PIN_ODR_HIGH(GPIOI_PIN8) | \ | ||
1321 | PIN_ODR_HIGH(GPIOI_PIN9) | \ | ||
1322 | PIN_ODR_HIGH(GPIOI_PIN10) | \ | ||
1323 | PIN_ODR_HIGH(GPIOI_PIN11) | \ | ||
1324 | PIN_ODR_HIGH(GPIOI_PIN12) | \ | ||
1325 | PIN_ODR_HIGH(GPIOI_PIN13) | \ | ||
1326 | PIN_ODR_HIGH(GPIOI_PIN14) | \ | ||
1327 | PIN_ODR_HIGH(GPIOI_PIN15)) | ||
1328 | #define VAL_GPIOI_AFRL (PIN_AFIO_AF(GPIOI_PIN0, 0U) | \ | ||
1329 | PIN_AFIO_AF(GPIOI_PIN1, 0U) | \ | ||
1330 | PIN_AFIO_AF(GPIOI_PIN2, 0U) | \ | ||
1331 | PIN_AFIO_AF(GPIOI_PIN3, 0U) | \ | ||
1332 | PIN_AFIO_AF(GPIOI_PIN4, 0U) | \ | ||
1333 | PIN_AFIO_AF(GPIOI_PIN5, 0U) | \ | ||
1334 | PIN_AFIO_AF(GPIOI_PIN6, 0U) | \ | ||
1335 | PIN_AFIO_AF(GPIOI_PIN7, 0U)) | ||
1336 | #define VAL_GPIOI_AFRH (PIN_AFIO_AF(GPIOI_PIN8, 0U) | \ | ||
1337 | PIN_AFIO_AF(GPIOI_PIN9, 0U) | \ | ||
1338 | PIN_AFIO_AF(GPIOI_PIN10, 0U) | \ | ||
1339 | PIN_AFIO_AF(GPIOI_PIN11, 0U) | \ | ||
1340 | PIN_AFIO_AF(GPIOI_PIN12, 0U) | \ | ||
1341 | PIN_AFIO_AF(GPIOI_PIN13, 0U) | \ | ||
1342 | PIN_AFIO_AF(GPIOI_PIN14, 0U) | \ | ||
1343 | PIN_AFIO_AF(GPIOI_PIN15, 0U)) | ||
1344 | |||
1345 | /*===========================================================================*/ | ||
1346 | /* External declarations. */ | ||
1347 | /*===========================================================================*/ | ||
1348 | |||
1349 | #if !defined(_FROM_ASM_) | ||
1350 | #ifdef __cplusplus | ||
1351 | extern "C" { | ||
1352 | #endif | ||
1353 | void boardInit(void); | ||
1354 | #ifdef __cplusplus | ||
1355 | } | ||
1356 | #endif | ||
1357 | #endif /* _FROM_ASM_ */ | ||
1358 | |||
1359 | #endif /* BOARD_H */ | ||
diff --git a/lib/chibios/os/hal/boards/MIKROE_CLICKER2_STM32/board.mk b/lib/chibios/os/hal/boards/MIKROE_CLICKER2_STM32/board.mk new file mode 100644 index 000000000..ade34733b --- /dev/null +++ b/lib/chibios/os/hal/boards/MIKROE_CLICKER2_STM32/board.mk | |||
@@ -0,0 +1,9 @@ | |||
1 | # List of all the board related files. | ||
2 | BOARDSRC = $(CHIBIOS)/os/hal/boards/MIKROE_CLICKER2_STM32/board.c | ||
3 | |||
4 | # Required include directories | ||
5 | BOARDINC = $(CHIBIOS)/os/hal/boards/MIKROE_CLICKER2_STM32 | ||
6 | |||
7 | # Shared variables | ||
8 | ALLCSRC += $(BOARDSRC) | ||
9 | ALLINC += $(BOARDINC) | ||
diff --git a/lib/chibios/os/hal/boards/MIKROE_CLICKER2_STM32/cfg/board.chcfg b/lib/chibios/os/hal/boards/MIKROE_CLICKER2_STM32/cfg/board.chcfg new file mode 100644 index 000000000..126d37c84 --- /dev/null +++ b/lib/chibios/os/hal/boards/MIKROE_CLICKER2_STM32/cfg/board.chcfg | |||
@@ -0,0 +1,1193 @@ | |||
1 | <?xml version="1.0" encoding="UTF-8"?> | ||
2 | <!-- STM32F4xx board Template --> | ||
3 | <board | ||
4 | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
5 | xsi:noNamespaceSchemaLocation="http://www.chibios.org/xml/schema/boards/stm32f4xx_board.xsd"> | ||
6 | <configuration_settings> | ||
7 | <templates_path>resources/gencfg/processors/boards/stm32f4xx/templates</templates_path> | ||
8 | <output_path>..</output_path> | ||
9 | <hal_version>5.0.x</hal_version> | ||
10 | </configuration_settings> | ||
11 | <board_name>Mikroe Clicker 2 for STM32</board_name> | ||
12 | <board_id>MIKROE_CLICKER2_STM32</board_id> | ||
13 | <board_functions></board_functions> | ||
14 | <subtype>STM32F407xx</subtype> | ||
15 | <clocks | ||
16 | HSEFrequency="25000000" | ||
17 | HSEBypass="false" | ||
18 | LSEFrequency="32768" | ||
19 | LSEBypass="false" | ||
20 | VDD="300" /> | ||
21 | <ports> | ||
22 | <GPIOA> | ||
23 | <pin0 | ||
24 | ID="" | ||
25 | Type="PushPull" | ||
26 | Level="High" | ||
27 | Speed="Maximum" | ||
28 | Resistor="PullUp" | ||
29 | Mode="Input" | ||
30 | Alternate="0" /> | ||
31 | <pin1 | ||
32 | ID="" | ||
33 | Type="PushPull" | ||
34 | Level="High" | ||
35 | Speed="Maximum" | ||
36 | Resistor="PullUp" | ||
37 | Mode="Input" | ||
38 | Alternate="0" /> | ||
39 | <pin2 | ||
40 | ID="MB1_AN" | ||
41 | Type="PushPull" | ||
42 | Level="High" | ||
43 | Speed="Maximum" | ||
44 | Resistor="Floating" | ||
45 | Mode="Analog" | ||
46 | Alternate="0" /> | ||
47 | <pin3 | ||
48 | ID="MB2_AN" | ||
49 | Type="PushPull" | ||
50 | Level="High" | ||
51 | Speed="Maximum" | ||
52 | Resistor="Floating" | ||
53 | Mode="Analog" | ||
54 | Alternate="0" /> | ||
55 | <pin4 | ||
56 | ID="" | ||
57 | Type="PushPull" | ||
58 | Level="High" | ||
59 | Speed="Maximum" | ||
60 | Resistor="PullUp" | ||
61 | Mode="Input" | ||
62 | Alternate="0" /> | ||
63 | <pin5 | ||
64 | ID="" | ||
65 | Type="PushPull" | ||
66 | Level="High" | ||
67 | Speed="Maximum" | ||
68 | Resistor="PullUp" | ||
69 | Mode="Input" | ||
70 | Alternate="0" /> | ||
71 | <pin6 | ||
72 | ID="" | ||
73 | Type="PushPull" | ||
74 | Level="High" | ||
75 | Speed="Maximum" | ||
76 | Resistor="PullUp" | ||
77 | Mode="Input" | ||
78 | Alternate="0" /> | ||
79 | <pin7 | ||
80 | ID="" | ||
81 | Type="PushPull" | ||
82 | Level="High" | ||
83 | Speed="Maximum" | ||
84 | Resistor="PullUp" | ||
85 | Mode="Input" | ||
86 | Alternate="0" /> | ||
87 | <pin8 | ||
88 | ID="I2C3_SCL" | ||
89 | Type="PushPull" | ||
90 | Level="High" | ||
91 | Speed="Maximum" | ||
92 | Resistor="Floating" | ||
93 | Mode="Alternate" | ||
94 | Alternate="4" /> | ||
95 | <pin9 | ||
96 | ID="VBUS_FS " | ||
97 | Type="PushPull" | ||
98 | Level="High" | ||
99 | Speed="Maximum" | ||
100 | Resistor="Floating" | ||
101 | Mode="Input" | ||
102 | Alternate="0" /> | ||
103 | <pin10 | ||
104 | ID="BUTTON2" | ||
105 | Type="PushPull" | ||
106 | Level="High" | ||
107 | Speed="Maximum" | ||
108 | Resistor="Floating" | ||
109 | Mode="Input" | ||
110 | Alternate="0" /> | ||
111 | <pin11 | ||
112 | ID="OTG_FS_DM" | ||
113 | Type="PushPull" | ||
114 | Level="High" | ||
115 | Speed="Maximum" | ||
116 | Resistor="Floating" | ||
117 | Mode="Alternate" | ||
118 | Alternate="10" /> | ||
119 | <pin12 | ||
120 | ID="OTG_FS_DP" | ||
121 | Type="PushPull" | ||
122 | Level="High" | ||
123 | Speed="Maximum" | ||
124 | Resistor="Floating" | ||
125 | Mode="Alternate" | ||
126 | Alternate="10" /> | ||
127 | <pin13 | ||
128 | ID="SWDIO" | ||
129 | Type="PushPull" | ||
130 | Level="High" | ||
131 | Speed="Maximum" | ||
132 | Resistor="Floating" | ||
133 | Mode="Alternate" | ||
134 | Alternate="0" /> | ||
135 | <pin14 | ||
136 | ID="SWCLK" | ||
137 | Type="PushPull" | ||
138 | Level="High" | ||
139 | Speed="Maximum" | ||
140 | Resistor="Floating" | ||
141 | Mode="Alternate" | ||
142 | Alternate="0" /> | ||
143 | <pin15 | ||
144 | ID="" | ||
145 | Type="PushPull" | ||
146 | Level="High" | ||
147 | Speed="Maximum" | ||
148 | Resistor="PullUp" | ||
149 | Mode="Input" | ||
150 | Alternate="0" /> | ||
151 | </GPIOA> | ||
152 | <GPIOB> | ||
153 | <pin0 | ||
154 | ID="" | ||
155 | Type="PushPull" | ||
156 | Level="High" | ||
157 | Speed="Maximum" | ||
158 | Resistor="PullUp" | ||
159 | Mode="Input" | ||
160 | Alternate="0" /> | ||
161 | <pin1 | ||
162 | ID="" | ||
163 | Type="PushPull" | ||
164 | Level="High" | ||
165 | Speed="Maximum" | ||
166 | Resistor="PullUp" | ||
167 | Mode="Input" | ||
168 | Alternate="0" /> | ||
169 | <pin2 | ||
170 | ID="" | ||
171 | Type="PushPull" | ||
172 | Level="High" | ||
173 | Speed="Maximum" | ||
174 | Resistor="PullUp" | ||
175 | Mode="Input" | ||
176 | Alternate="0" /> | ||
177 | <pin3 | ||
178 | ID="" | ||
179 | Type="PushPull" | ||
180 | Level="High" | ||
181 | Speed="Maximum" | ||
182 | Resistor="PullUp" | ||
183 | Mode="Input" | ||
184 | Alternate="0" /> | ||
185 | <pin4 | ||
186 | ID="" | ||
187 | Type="PushPull" | ||
188 | Level="High" | ||
189 | Speed="Maximum" | ||
190 | Resistor="PullUp" | ||
191 | Mode="Input" | ||
192 | Alternate="0" /> | ||
193 | <pin5 | ||
194 | ID="" | ||
195 | Type="PushPull" | ||
196 | Level="High" | ||
197 | Speed="Maximum" | ||
198 | Resistor="PullUp" | ||
199 | Mode="Input" | ||
200 | Alternate="0" /> | ||
201 | <pin6 | ||
202 | ID="" | ||
203 | Type="PushPull" | ||
204 | Level="High" | ||
205 | Speed="Maximum" | ||
206 | Resistor="PullUp" | ||
207 | Mode="Input" | ||
208 | Alternate="0" /> | ||
209 | <pin7 | ||
210 | ID="" | ||
211 | Type="PushPull" | ||
212 | Level="High" | ||
213 | Speed="Maximum" | ||
214 | Resistor="PullUp" | ||
215 | Mode="Input" | ||
216 | Alternate="0" /> | ||
217 | <pin8 | ||
218 | ID="" | ||
219 | Type="PushPull" | ||
220 | Level="High" | ||
221 | Speed="Maximum" | ||
222 | Resistor="PullUp" | ||
223 | Mode="Input" | ||
224 | Alternate="0" /> | ||
225 | <pin9 | ||
226 | ID="" | ||
227 | Type="PushPull" | ||
228 | Level="High" | ||
229 | Speed="Maximum" | ||
230 | Resistor="PullUp" | ||
231 | Mode="Input" | ||
232 | Alternate="0" /> | ||
233 | <pin10 | ||
234 | ID="I2C2_SCL" | ||
235 | Type="PushPull" | ||
236 | Level="High" | ||
237 | Speed="Maximum" | ||
238 | Resistor="Floating" | ||
239 | Mode="Alternate" | ||
240 | Alternate="4" /> | ||
241 | <pin11 | ||
242 | ID="I2C2_SDA" | ||
243 | Type="PushPull" | ||
244 | Level="High" | ||
245 | Speed="Maximum" | ||
246 | Resistor="Floating" | ||
247 | Mode="Alternate" | ||
248 | Alternate="4" /> | ||
249 | <pin12 | ||
250 | ID="" | ||
251 | Type="PushPull" | ||
252 | Level="High" | ||
253 | Speed="Maximum" | ||
254 | Resistor="PullUp" | ||
255 | Mode="Input" | ||
256 | Alternate="0" /> | ||
257 | <pin13 | ||
258 | ID="SPI2_SCK" | ||
259 | Type="PushPull" | ||
260 | Level="High" | ||
261 | Speed="Maximum" | ||
262 | Resistor="Floating" | ||
263 | Mode="Alternate" | ||
264 | Alternate="5" /> | ||
265 | <pin14 | ||
266 | ID="SPI2_MISO" | ||
267 | Type="PushPull" | ||
268 | Level="High" | ||
269 | Speed="Maximum" | ||
270 | Resistor="Floating" | ||
271 | Mode="Alternate" | ||
272 | Alternate="14" /> | ||
273 | <pin15 | ||
274 | ID="SPI2_MOSI" | ||
275 | Type="PushPull" | ||
276 | Level="High" | ||
277 | Speed="Maximum" | ||
278 | Resistor="Floating" | ||
279 | Mode="Alternate" | ||
280 | Alternate="5" /> | ||
281 | </GPIOB> | ||
282 | <GPIOC> | ||
283 | <pin0 | ||
284 | ID="" | ||
285 | Type="PushPull" | ||
286 | Level="High" | ||
287 | Speed="Maximum" | ||
288 | Resistor="PullUp" | ||
289 | Mode="Input" | ||
290 | Alternate="0" /> | ||
291 | <pin1 | ||
292 | ID="" | ||
293 | Type="PushPull" | ||
294 | Level="High" | ||
295 | Speed="Maximum" | ||
296 | Resistor="PullUp" | ||
297 | Mode="Input" | ||
298 | Alternate="0" /> | ||
299 | <pin2 | ||
300 | ID="" | ||
301 | Type="PushPull" | ||
302 | Level="High" | ||
303 | Speed="Maximum" | ||
304 | Resistor="PullUp" | ||
305 | Mode="Input" | ||
306 | Alternate="0" /> | ||
307 | <pin3 | ||
308 | ID="" | ||
309 | Type="PushPull" | ||
310 | Level="High" | ||
311 | Speed="Maximum" | ||
312 | Resistor="PullUp" | ||
313 | Mode="Input" | ||
314 | Alternate="0" /> | ||
315 | <pin4 | ||
316 | ID="" | ||
317 | Type="PushPull" | ||
318 | Level="High" | ||
319 | Speed="Maximum" | ||
320 | Resistor="PullUp" | ||
321 | Mode="Input" | ||
322 | Alternate="0" /> | ||
323 | <pin5 | ||
324 | ID="" | ||
325 | Type="PushPull" | ||
326 | Level="High" | ||
327 | Speed="Maximum" | ||
328 | Resistor="PullUp" | ||
329 | Mode="Input" | ||
330 | Alternate="0" /> | ||
331 | <pin6 | ||
332 | ID="" | ||
333 | Type="PushPull" | ||
334 | Level="High" | ||
335 | Speed="Maximum" | ||
336 | Resistor="PullUp" | ||
337 | Mode="Input" | ||
338 | Alternate="0" /> | ||
339 | <pin7 | ||
340 | ID="" | ||
341 | Type="PushPull" | ||
342 | Level="High" | ||
343 | Speed="Maximum" | ||
344 | Resistor="PullUp" | ||
345 | Mode="Input" | ||
346 | Alternate="0" /> | ||
347 | <pin8 | ||
348 | ID="" | ||
349 | Type="PushPull" | ||
350 | Level="High" | ||
351 | Speed="Maximum" | ||
352 | Resistor="PullUp" | ||
353 | Mode="Input" | ||
354 | Alternate="0" /> | ||
355 | <pin9 | ||
356 | ID="I2C3_SDA" | ||
357 | Type="PushPull" | ||
358 | Level="High" | ||
359 | Speed="Maximum" | ||
360 | Resistor="Floating" | ||
361 | Mode="Alternate" | ||
362 | Alternate="4" /> | ||
363 | <pin10 | ||
364 | ID="SPI3_SCK" | ||
365 | Type="PushPull" | ||
366 | Level="High" | ||
367 | Speed="Maximum" | ||
368 | Resistor="Floating" | ||
369 | Mode="Alternate" | ||
370 | Alternate="6" /> | ||
371 | <pin11 | ||
372 | ID="SPI3_MISO" | ||
373 | Type="PushPull" | ||
374 | Level="High" | ||
375 | Speed="Maximum" | ||
376 | Resistor="Floating" | ||
377 | Mode="Alternate" | ||
378 | Alternate="6" /> | ||
379 | <pin12 | ||
380 | ID="SPI3_MOSI" | ||
381 | Type="PushPull" | ||
382 | Level="High" | ||
383 | Speed="Maximum" | ||
384 | Resistor="Floating" | ||
385 | Mode="Alternate" | ||
386 | Alternate="6" /> | ||
387 | <pin13 | ||
388 | ID="" | ||
389 | Type="PushPull" | ||
390 | Level="High" | ||
391 | Speed="Maximum" | ||
392 | Resistor="PullUp" | ||
393 | Mode="Input" | ||
394 | Alternate="0" /> | ||
395 | <pin14 | ||
396 | ID="" | ||
397 | Type="PushPull" | ||
398 | Level="High" | ||
399 | Speed="Maximum" | ||
400 | Resistor="PullUp" | ||
401 | Mode="Input" | ||
402 | Alternate="0" /> | ||
403 | <pin15 | ||
404 | ID="" | ||
405 | Type="PushPull" | ||
406 | Level="High" | ||
407 | Speed="Maximum" | ||
408 | Resistor="PullUp" | ||
409 | Mode="Input" | ||
410 | Alternate="0" /> | ||
411 | </GPIOC> | ||
412 | <GPIOD> | ||
413 | <pin0 | ||
414 | ID="" | ||
415 | Type="PushPull" | ||
416 | Level="High" | ||
417 | Speed="Maximum" | ||
418 | Resistor="PullUp" | ||
419 | Mode="Input" | ||
420 | Alternate="0" /> | ||
421 | <pin1 | ||
422 | ID="" | ||
423 | Type="PushPull" | ||
424 | Level="High" | ||
425 | Speed="Maximum" | ||
426 | Resistor="PullUp" | ||
427 | Mode="Input" | ||
428 | Alternate="0" /> | ||
429 | <pin2 | ||
430 | ID="" | ||
431 | Type="PushPull" | ||
432 | Level="High" | ||
433 | Speed="Maximum" | ||
434 | Resistor="PullUp" | ||
435 | Mode="Input" | ||
436 | Alternate="0" /> | ||
437 | <pin3 | ||
438 | ID="" | ||
439 | Type="PushPull" | ||
440 | Level="High" | ||
441 | Speed="Maximum" | ||
442 | Resistor="PullUp" | ||
443 | Mode="Input" | ||
444 | Alternate="0" /> | ||
445 | <pin4 | ||
446 | ID="" | ||
447 | Type="PushPull" | ||
448 | Level="High" | ||
449 | Speed="Maximum" | ||
450 | Resistor="PullUp" | ||
451 | Mode="Input" | ||
452 | Alternate="0" /> | ||
453 | <pin5 | ||
454 | ID="USART2_TX" | ||
455 | Type="PushPull" | ||
456 | Level="High" | ||
457 | Speed="Maximum" | ||
458 | Resistor="Floating" | ||
459 | Mode="Alternate" | ||
460 | Alternate="7" /> | ||
461 | <pin6 | ||
462 | ID="USART2_RX" | ||
463 | Type="PushPull" | ||
464 | Level="High" | ||
465 | Speed="Maximum" | ||
466 | Resistor="Floating" | ||
467 | Mode="Alternate" | ||
468 | Alternate="7" /> | ||
469 | <pin7 | ||
470 | ID="" | ||
471 | Type="PushPull" | ||
472 | Level="High" | ||
473 | Speed="Maximum" | ||
474 | Resistor="PullUp" | ||
475 | Mode="Input" | ||
476 | Alternate="0" /> | ||
477 | <pin8 | ||
478 | ID="USART3_TX" | ||
479 | Type="PushPull" | ||
480 | Level="High" | ||
481 | Speed="Maximum" | ||
482 | Resistor="Floating" | ||
483 | Mode="Alternate" | ||
484 | Alternate="7" /> | ||
485 | <pin9 | ||
486 | ID="USART3_RX" | ||
487 | Type="PushPull" | ||
488 | Level="High" | ||
489 | Speed="Maximum" | ||
490 | Resistor="Floating" | ||
491 | Mode="Alternate" | ||
492 | Alternate="7" /> | ||
493 | <pin10 | ||
494 | ID="" | ||
495 | Type="PushPull" | ||
496 | Level="High" | ||
497 | Speed="Maximum" | ||
498 | Resistor="PullUp" | ||
499 | Mode="Input" | ||
500 | Alternate="0" /> | ||
501 | <pin11 | ||
502 | ID="" | ||
503 | Type="PushPull" | ||
504 | Level="High" | ||
505 | Speed="Maximum" | ||
506 | Resistor="PullUp" | ||
507 | Mode="Input" | ||
508 | Alternate="0" /> | ||
509 | <pin12 | ||
510 | ID="MB2_PWM" | ||
511 | Type="PushPull" | ||
512 | Level="High" | ||
513 | Speed="Maximum" | ||
514 | Resistor="Floating" | ||
515 | Mode="Alternate" | ||
516 | Alternate="2" /> | ||
517 | <pin13 | ||
518 | ID="" | ||
519 | Type="PushPull" | ||
520 | Level="High" | ||
521 | Speed="Maximum" | ||
522 | Resistor="PullUp" | ||
523 | Mode="Input" | ||
524 | Alternate="0" /> | ||
525 | <pin14 | ||
526 | ID="" | ||
527 | Type="PushPull" | ||
528 | Level="High" | ||
529 | Speed="Maximum" | ||
530 | Resistor="PullUp" | ||
531 | Mode="Input" | ||
532 | Alternate="0" /> | ||
533 | <pin15 | ||
534 | ID="" | ||
535 | Type="PushPull" | ||
536 | Level="High" | ||
537 | Speed="Maximum" | ||
538 | Resistor="PullUp" | ||
539 | Mode="Input" | ||
540 | Alternate="0" /> | ||
541 | </GPIOD> | ||
542 | <GPIOE> | ||
543 | <pin0 | ||
544 | ID="BUTTON1" | ||
545 | Type="PushPull" | ||
546 | Level="High" | ||
547 | Speed="Maximum" | ||
548 | Resistor="Floating" | ||
549 | Mode="Input" | ||
550 | Alternate="0" /> | ||
551 | <pin1 | ||
552 | ID="" | ||
553 | Type="PushPull" | ||
554 | Level="High" | ||
555 | Speed="Maximum" | ||
556 | Resistor="PullUp" | ||
557 | Mode="Input" | ||
558 | Alternate="0" /> | ||
559 | <pin2 | ||
560 | ID="" | ||
561 | Type="PushPull" | ||
562 | Level="High" | ||
563 | Speed="Maximum" | ||
564 | Resistor="PullUp" | ||
565 | Mode="Input" | ||
566 | Alternate="0" /> | ||
567 | <pin3 | ||
568 | ID="" | ||
569 | Type="PushPull" | ||
570 | Level="High" | ||
571 | Speed="Maximum" | ||
572 | Resistor="PullUp" | ||
573 | Mode="Input" | ||
574 | Alternate="0" /> | ||
575 | <pin4 | ||
576 | ID="" | ||
577 | Type="PushPull" | ||
578 | Level="High" | ||
579 | Speed="Maximum" | ||
580 | Resistor="PullUp" | ||
581 | Mode="Input" | ||
582 | Alternate="0" /> | ||
583 | <pin5 | ||
584 | ID="" | ||
585 | Type="PushPull" | ||
586 | Level="High" | ||
587 | Speed="Maximum" | ||
588 | Resistor="PullUp" | ||
589 | Mode="Input" | ||
590 | Alternate="0" /> | ||
591 | <pin6 | ||
592 | ID="" | ||
593 | Type="PushPull" | ||
594 | Level="High" | ||
595 | Speed="Maximum" | ||
596 | Resistor="PullUp" | ||
597 | Mode="Input" | ||
598 | Alternate="0" /> | ||
599 | <pin7 | ||
600 | ID="MB1_RST" | ||
601 | Type="PushPull" | ||
602 | Level="Low" | ||
603 | Speed="Maximum" | ||
604 | Resistor="Floating" | ||
605 | Mode="Output" | ||
606 | Alternate="0" /> | ||
607 | <pin8 | ||
608 | ID="MB1_CS" | ||
609 | Type="PushPull" | ||
610 | Level="High" | ||
611 | Speed="Maximum" | ||
612 | Resistor="Floating" | ||
613 | Mode="Output" | ||
614 | Alternate="0" /> | ||
615 | <pin9 | ||
616 | ID="MB1_PWM" | ||
617 | Type="PushPull" | ||
618 | Level="High" | ||
619 | Speed="Maximum" | ||
620 | Resistor="Floating" | ||
621 | Mode="Alternate" | ||
622 | Alternate="1" /> | ||
623 | <pin10 | ||
624 | ID="MB1_INT" | ||
625 | Type="PushPull" | ||
626 | Level="High" | ||
627 | Speed="Maximum" | ||
628 | Resistor="Floating" | ||
629 | Mode="Input" | ||
630 | Alternate="0" /> | ||
631 | <pin11 | ||
632 | ID='MB2_CS' | ||
633 | Type="PushPull" | ||
634 | Level="High" | ||
635 | Speed="Maximum" | ||
636 | Resistor="Floating" | ||
637 | Mode="Output" | ||
638 | Alternate="0" /> | ||
639 | <pin12 | ||
640 | ID="LED1" | ||
641 | Type="PushPull" | ||
642 | Level="Low" | ||
643 | Speed="Maximum" | ||
644 | Resistor="Floating" | ||
645 | Mode="Output" | ||
646 | Alternate="0" /> | ||
647 | <pin13 | ||
648 | ID='MB2_RST' | ||
649 | Type="PushPull" | ||
650 | Level="Low" | ||
651 | Speed="Maximum" | ||
652 | Resistor="Floating" | ||
653 | Mode="Output" | ||
654 | Alternate="0" /> | ||
655 | <pin14 | ||
656 | ID='MB2_INT' | ||
657 | Type="PushPull" | ||
658 | Level="High" | ||
659 | Speed="Maximum" | ||
660 | Resistor="Floating" | ||
661 | Mode="Input" | ||
662 | Alternate="0" /> | ||
663 | <pin15 | ||
664 | ID="LED2" | ||
665 | Type="PushPull" | ||
666 | Level="Low" | ||
667 | Speed="Maximum" | ||
668 | Resistor="Floating" | ||
669 | Mode="Output" | ||
670 | Alternate="0" /> | ||
671 | </GPIOE> | ||
672 | <GPIOF> | ||
673 | <pin0 | ||
674 | ID="" | ||
675 | Type="PushPull" | ||
676 | Level="High" | ||
677 | Speed="Maximum" | ||
678 | Resistor="PullUp" | ||
679 | Mode="Input" | ||
680 | Alternate="0" /> | ||
681 | <pin1 | ||
682 | ID="" | ||
683 | Type="PushPull" | ||
684 | Level="High" | ||
685 | Speed="Maximum" | ||
686 | Resistor="PullUp" | ||
687 | Mode="Input" | ||
688 | Alternate="0" /> | ||
689 | <pin2 | ||
690 | ID="" | ||
691 | Type="PushPull" | ||
692 | Level="High" | ||
693 | Speed="Maximum" | ||
694 | Resistor="PullUp" | ||
695 | Mode="Input" | ||
696 | Alternate="0" /> | ||
697 | <pin3 | ||
698 | ID="" | ||
699 | Type="PushPull" | ||
700 | Level="High" | ||
701 | Speed="Maximum" | ||
702 | Resistor="PullUp" | ||
703 | Mode="Input" | ||
704 | Alternate="0" /> | ||
705 | <pin4 | ||
706 | ID="" | ||
707 | Type="PushPull" | ||
708 | Level="High" | ||
709 | Speed="Maximum" | ||
710 | Resistor="PullUp" | ||
711 | Mode="Input" | ||
712 | Alternate="0" /> | ||
713 | <pin5 | ||
714 | ID="" | ||
715 | Type="PushPull" | ||
716 | Level="High" | ||
717 | Speed="Maximum" | ||
718 | Resistor="PullUp" | ||
719 | Mode="Input" | ||
720 | Alternate="0" /> | ||
721 | <pin6 | ||
722 | ID="" | ||
723 | Type="PushPull" | ||
724 | Level="High" | ||
725 | Speed="Maximum" | ||
726 | Resistor="PullUp" | ||
727 | Mode="Input" | ||
728 | Alternate="0" /> | ||
729 | <pin7 | ||
730 | ID="" | ||
731 | Type="PushPull" | ||
732 | Level="High" | ||
733 | Speed="Maximum" | ||
734 | Resistor="PullUp" | ||
735 | Mode="Input" | ||
736 | Alternate="0" /> | ||
737 | <pin8 | ||
738 | ID="" | ||
739 | Type="PushPull" | ||
740 | Level="High" | ||
741 | Speed="Maximum" | ||
742 | Resistor="PullUp" | ||
743 | Mode="Input" | ||
744 | Alternate="0" /> | ||
745 | <pin9 | ||
746 | ID="" | ||
747 | Type="PushPull" | ||
748 | Level="High" | ||
749 | Speed="Maximum" | ||
750 | Resistor="PullUp" | ||
751 | Mode="Input" | ||
752 | Alternate="0" /> | ||
753 | <pin10 | ||
754 | ID="" | ||
755 | Type="PushPull" | ||
756 | Level="High" | ||
757 | Speed="Maximum" | ||
758 | Resistor="PullUp" | ||
759 | Mode="Input" | ||
760 | Alternate="0" /> | ||
761 | <pin11 | ||
762 | ID="" | ||
763 | Type="PushPull" | ||
764 | Level="High" | ||
765 | Speed="Maximum" | ||
766 | Resistor="PullUp" | ||
767 | Mode="Input" | ||
768 | Alternate="0" /> | ||
769 | <pin12 | ||
770 | ID="" | ||
771 | Type="PushPull" | ||
772 | Level="High" | ||
773 | Speed="Maximum" | ||
774 | Resistor="PullUp" | ||
775 | Mode="Input" | ||
776 | Alternate="0" /> | ||
777 | <pin13 | ||
778 | ID="" | ||
779 | Type="PushPull" | ||
780 | Level="High" | ||
781 | Speed="Maximum" | ||
782 | Resistor="PullUp" | ||
783 | Mode="Input" | ||
784 | Alternate="0" /> | ||
785 | <pin14 | ||
786 | ID="" | ||
787 | Type="PushPull" | ||
788 | Level="High" | ||
789 | Speed="Maximum" | ||
790 | Resistor="PullUp" | ||
791 | Mode="Input" | ||
792 | Alternate="0" /> | ||
793 | <pin15 | ||
794 | ID="" | ||
795 | Type="PushPull" | ||
796 | Level="High" | ||
797 | Speed="Maximum" | ||
798 | Resistor="PullUp" | ||
799 | Mode="Input" | ||
800 | Alternate="0" /> | ||
801 | </GPIOF> | ||
802 | <GPIOG> | ||
803 | <pin0 | ||
804 | ID="" | ||
805 | Type="PushPull" | ||
806 | Level="High" | ||
807 | Speed="Maximum" | ||
808 | Resistor="PullUp" | ||
809 | Mode="Input" | ||
810 | Alternate="0" /> | ||
811 | <pin1 | ||
812 | ID="" | ||
813 | Type="PushPull" | ||
814 | Level="High" | ||
815 | Speed="Maximum" | ||
816 | Resistor="PullUp" | ||
817 | Mode="Input" | ||
818 | Alternate="0" /> | ||
819 | <pin2 | ||
820 | ID="" | ||
821 | Type="PushPull" | ||
822 | Level="High" | ||
823 | Speed="Maximum" | ||
824 | Resistor="PullUp" | ||
825 | Mode="Input" | ||
826 | Alternate="0" /> | ||
827 | <pin3 | ||
828 | ID="" | ||
829 | Type="PushPull" | ||
830 | Level="High" | ||
831 | Speed="Maximum" | ||
832 | Resistor="PullUp" | ||
833 | Mode="Input" | ||
834 | Alternate="0" /> | ||
835 | <pin4 | ||
836 | ID="" | ||
837 | Type="PushPull" | ||
838 | Level="High" | ||
839 | Speed="Maximum" | ||
840 | Resistor="PullUp" | ||
841 | Mode="Input" | ||
842 | Alternate="0" /> | ||
843 | <pin5 | ||
844 | ID="" | ||
845 | Type="PushPull" | ||
846 | Level="High" | ||
847 | Speed="Maximum" | ||
848 | Resistor="PullUp" | ||
849 | Mode="Input" | ||
850 | Alternate="0" /> | ||
851 | <pin6 | ||
852 | ID="" | ||
853 | Type="PushPull" | ||
854 | Level="High" | ||
855 | Speed="Maximum" | ||
856 | Resistor="PullUp" | ||
857 | Mode="Input" | ||
858 | Alternate="0" /> | ||
859 | <pin7 | ||
860 | ID="" | ||
861 | Type="PushPull" | ||
862 | Level="High" | ||
863 | Speed="Maximum" | ||
864 | Resistor="PullUp" | ||
865 | Mode="Input" | ||
866 | Alternate="0" /> | ||
867 | <pin8 | ||
868 | ID="" | ||
869 | Type="PushPull" | ||
870 | Level="High" | ||
871 | Speed="Maximum" | ||
872 | Resistor="PullUp" | ||
873 | Mode="Input" | ||
874 | Alternate="0" /> | ||
875 | <pin9 | ||
876 | ID="" | ||
877 | Type="PushPull" | ||
878 | Level="High" | ||
879 | Speed="Maximum" | ||
880 | Resistor="PullUp" | ||
881 | Mode="Input" | ||
882 | Alternate="0" /> | ||
883 | <pin10 | ||
884 | ID="" | ||
885 | Type="PushPull" | ||
886 | Level="High" | ||
887 | Speed="Maximum" | ||
888 | Resistor="PullUp" | ||
889 | Mode="Input" | ||
890 | Alternate="0" /> | ||
891 | <pin11 | ||
892 | ID="" | ||
893 | Type="PushPull" | ||
894 | Level="High" | ||
895 | Speed="Maximum" | ||
896 | Resistor="PullUp" | ||
897 | Mode="Input" | ||
898 | Alternate="0" /> | ||
899 | <pin12 | ||
900 | ID="" | ||
901 | Type="PushPull" | ||
902 | Level="High" | ||
903 | Speed="Maximum" | ||
904 | Resistor="PullUp" | ||
905 | Mode="Input" | ||
906 | Alternate="0" /> | ||
907 | <pin13 | ||
908 | ID="" | ||
909 | Type="PushPull" | ||
910 | Level="High" | ||
911 | Speed="Maximum" | ||
912 | Resistor="PullUp" | ||
913 | Mode="Input" | ||
914 | Alternate="0" /> | ||
915 | <pin14 | ||
916 | ID="" | ||
917 | Type="PushPull" | ||
918 | Level="High" | ||
919 | Speed="Maximum" | ||
920 | Resistor="PullUp" | ||
921 | Mode="Input" | ||
922 | Alternate="0" /> | ||
923 | <pin15 | ||
924 | ID="" | ||
925 | Type="PushPull" | ||
926 | Level="High" | ||
927 | Speed="Maximum" | ||
928 | Resistor="PullUp" | ||
929 | Mode="Input" | ||
930 | Alternate="0" /> | ||
931 | </GPIOG> | ||
932 | <GPIOH> | ||
933 | <pin0 | ||
934 | ID="" | ||
935 | Type="PushPull" | ||
936 | Level="High" | ||
937 | Speed="Maximum" | ||
938 | Resistor="PullUp" | ||
939 | Mode="Input" | ||
940 | Alternate="0" /> | ||
941 | <pin1 | ||
942 | ID="" | ||
943 | Type="PushPull" | ||
944 | Level="High" | ||
945 | Speed="Maximum" | ||
946 | Resistor="PullUp" | ||
947 | Mode="Input" | ||
948 | Alternate="0" /> | ||
949 | <pin2 | ||
950 | ID="" | ||
951 | Type="PushPull" | ||
952 | Level="High" | ||
953 | Speed="Maximum" | ||
954 | Resistor="PullUp" | ||
955 | Mode="Input" | ||
956 | Alternate="0" /> | ||
957 | <pin3 | ||
958 | ID="" | ||
959 | Type="PushPull" | ||
960 | Level="High" | ||
961 | Speed="Maximum" | ||
962 | Resistor="PullUp" | ||
963 | Mode="Input" | ||
964 | Alternate="0" /> | ||
965 | <pin4 | ||
966 | ID="" | ||
967 | Type="PushPull" | ||
968 | Level="High" | ||
969 | Speed="Maximum" | ||
970 | Resistor="PullUp" | ||
971 | Mode="Input" | ||
972 | Alternate="0" /> | ||
973 | <pin5 | ||
974 | ID="" | ||
975 | Type="PushPull" | ||
976 | Level="High" | ||
977 | Speed="Maximum" | ||
978 | Resistor="PullUp" | ||
979 | Mode="Input" | ||
980 | Alternate="0" /> | ||
981 | <pin6 | ||
982 | ID="" | ||
983 | Type="PushPull" | ||
984 | Level="High" | ||
985 | Speed="Maximum" | ||
986 | Resistor="PullUp" | ||
987 | Mode="Input" | ||
988 | Alternate="0" /> | ||
989 | <pin7 | ||
990 | ID="" | ||
991 | Type="PushPull" | ||
992 | Level="High" | ||
993 | Speed="Maximum" | ||
994 | Resistor="PullUp" | ||
995 | Mode="Input" | ||
996 | Alternate="0" /> | ||
997 | <pin8 | ||
998 | ID="" | ||
999 | Type="PushPull" | ||
1000 | Level="High" | ||
1001 | Speed="Maximum" | ||
1002 | Resistor="PullUp" | ||
1003 | Mode="Input" | ||
1004 | Alternate="0" /> | ||
1005 | <pin9 | ||
1006 | ID="" | ||
1007 | Type="PushPull" | ||
1008 | Level="High" | ||
1009 | Speed="Maximum" | ||
1010 | Resistor="PullUp" | ||
1011 | Mode="Input" | ||
1012 | Alternate="0" /> | ||
1013 | <pin10 | ||
1014 | ID="" | ||
1015 | Type="PushPull" | ||
1016 | Level="High" | ||
1017 | Speed="Maximum" | ||
1018 | Resistor="PullUp" | ||
1019 | Mode="Input" | ||
1020 | Alternate="0" /> | ||
1021 | <pin11 | ||
1022 | ID="" | ||
1023 | Type="PushPull" | ||
1024 | Level="High" | ||
1025 | Speed="Maximum" | ||
1026 | Resistor="PullUp" | ||
1027 | Mode="Input" | ||
1028 | Alternate="0" /> | ||
1029 | <pin12 | ||
1030 | ID="" | ||
1031 | Type="PushPull" | ||
1032 | Level="High" | ||
1033 | Speed="Maximum" | ||
1034 | Resistor="PullUp" | ||
1035 | Mode="Input" | ||
1036 | Alternate="0" /> | ||
1037 | <pin13 | ||
1038 | ID="" | ||
1039 | Type="PushPull" | ||
1040 | Level="High" | ||
1041 | Speed="Maximum" | ||
1042 | Resistor="PullUp" | ||
1043 | Mode="Input" | ||
1044 | Alternate="0" /> | ||
1045 | <pin14 | ||
1046 | ID="" | ||
1047 | Type="PushPull" | ||
1048 | Level="High" | ||
1049 | Speed="Maximum" | ||
1050 | Resistor="PullUp" | ||
1051 | Mode="Input" | ||
1052 | Alternate="0" /> | ||
1053 | <pin15 | ||
1054 | ID="" | ||
1055 | Type="PushPull" | ||
1056 | Level="High" | ||
1057 | Speed="Maximum" | ||
1058 | Resistor="PullUp" | ||
1059 | Mode="Input" | ||
1060 | Alternate="0" /> | ||
1061 | </GPIOH> | ||
1062 | <GPIOI> | ||
1063 | <pin0 | ||
1064 | ID="" | ||
1065 | Type="PushPull" | ||
1066 | Level="High" | ||
1067 | Speed="Maximum" | ||
1068 | Resistor="PullUp" | ||
1069 | Mode="Input" | ||
1070 | Alternate="0" /> | ||
1071 | <pin1 | ||
1072 | ID="" | ||
1073 | Type="PushPull" | ||
1074 | Level="High" | ||
1075 | Speed="Maximum" | ||
1076 | Resistor="PullUp" | ||
1077 | Mode="Input" | ||
1078 | Alternate="0" /> | ||
1079 | <pin2 | ||
1080 | ID="" | ||
1081 | Type="PushPull" | ||
1082 | Level="High" | ||
1083 | Speed="Maximum" | ||
1084 | Resistor="PullUp" | ||
1085 | Mode="Input" | ||
1086 | Alternate="0" /> | ||
1087 | <pin3 | ||
1088 | ID="" | ||
1089 | Type="PushPull" | ||
1090 | Level="High" | ||
1091 | Speed="Maximum" | ||
1092 | Resistor="PullUp" | ||
1093 | Mode="Input" | ||
1094 | Alternate="0" /> | ||
1095 | <pin4 | ||
1096 | ID="" | ||
1097 | Type="PushPull" | ||
1098 | Level="High" | ||
1099 | Speed="Maximum" | ||
1100 | Resistor="PullUp" | ||
1101 | Mode="Input" | ||
1102 | Alternate="0" /> | ||
1103 | <pin5 | ||
1104 | ID="" | ||
1105 | Type="PushPull" | ||
1106 | Level="High" | ||
1107 | Speed="Maximum" | ||
1108 | Resistor="PullUp" | ||
1109 | Mode="Input" | ||
1110 | Alternate="0" /> | ||
1111 | <pin6 | ||
1112 | ID="" | ||
1113 | Type="PushPull" | ||
1114 | Level="High" | ||
1115 | Speed="Maximum" | ||
1116 | Resistor="PullUp" | ||
1117 | Mode="Input" | ||
1118 | Alternate="0" /> | ||
1119 | <pin7 | ||
1120 | ID="" | ||
1121 | Type="PushPull" | ||
1122 | Level="High" | ||
1123 | Speed="Maximum" | ||
1124 | Resistor="PullUp" | ||
1125 | Mode="Input" | ||
1126 | Alternate="0" /> | ||
1127 | <pin8 | ||
1128 | ID="" | ||
1129 | Type="PushPull" | ||
1130 | Level="High" | ||
1131 | Speed="Maximum" | ||
1132 | Resistor="PullUp" | ||
1133 | Mode="Input" | ||
1134 | Alternate="0" /> | ||
1135 | <pin9 | ||
1136 | ID="" | ||
1137 | Type="PushPull" | ||
1138 | Level="High" | ||
1139 | Speed="Maximum" | ||
1140 | Resistor="PullUp" | ||
1141 | Mode="Input" | ||
1142 | Alternate="0" /> | ||
1143 | <pin10 | ||
1144 | ID="" | ||
1145 | Type="PushPull" | ||
1146 | Level="High" | ||
1147 | Speed="Maximum" | ||
1148 | Resistor="PullUp" | ||
1149 | Mode="Input" | ||
1150 | Alternate="0" /> | ||
1151 | <pin11 | ||
1152 | ID="" | ||
1153 | Type="PushPull" | ||
1154 | Level="High" | ||
1155 | Speed="Maximum" | ||
1156 | Resistor="PullUp" | ||
1157 | Mode="Input" | ||
1158 | Alternate="0" /> | ||
1159 | <pin12 | ||
1160 | ID="" | ||
1161 | Type="PushPull" | ||
1162 | Level="High" | ||
1163 | Speed="Maximum" | ||
1164 | Resistor="PullUp" | ||
1165 | Mode="Input" | ||
1166 | Alternate="0" /> | ||
1167 | <pin13 | ||
1168 | ID="" | ||
1169 | Type="PushPull" | ||
1170 | Level="High" | ||
1171 | Speed="Maximum" | ||
1172 | Resistor="PullUp" | ||
1173 | Mode="Input" | ||
1174 | Alternate="0" /> | ||
1175 | <pin14 | ||
1176 | ID="" | ||
1177 | Type="PushPull" | ||
1178 | Level="High" | ||
1179 | Speed="Maximum" | ||
1180 | Resistor="PullUp" | ||
1181 | Mode="Input" | ||
1182 | Alternate="0" /> | ||
1183 | <pin15 | ||
1184 | ID="" | ||
1185 | Type="PushPull" | ||
1186 | Level="High" | ||
1187 | Speed="Maximum" | ||
1188 | Resistor="PullUp" | ||
1189 | Mode="Input" | ||
1190 | Alternate="0" /> | ||
1191 | </GPIOI> | ||
1192 | </ports> | ||
1193 | </board> | ||
diff --git a/lib/chibios/os/hal/boards/MIKROE_CLICKER2_STM32/cfg/board.fmpp b/lib/chibios/os/hal/boards/MIKROE_CLICKER2_STM32/cfg/board.fmpp new file mode 100644 index 000000000..41754c141 --- /dev/null +++ b/lib/chibios/os/hal/boards/MIKROE_CLICKER2_STM32/cfg/board.fmpp | |||
@@ -0,0 +1,15 @@ | |||
1 | sourceRoot: ../../../../../tools/ftl/processors/boards/stm32f4xx/templates | ||
2 | outputRoot: .. | ||
3 | dataRoot: . | ||
4 | |||
5 | freemarkerLinks: { | ||
6 | lib: ../../../../../tools/ftl/libs | ||
7 | } | ||
8 | |||
9 | data : { | ||
10 | doc1:xml ( | ||
11 | board.chcfg | ||
12 | { | ||
13 | } | ||
14 | ) | ||
15 | } | ||
diff --git a/lib/chibios/os/hal/boards/MT-DB-X4/board.c b/lib/chibios/os/hal/boards/MT-DB-X4/board.c new file mode 100644 index 000000000..c97fe5280 --- /dev/null +++ b/lib/chibios/os/hal/boards/MT-DB-X4/board.c | |||
@@ -0,0 +1,68 @@ | |||
1 | /* | ||
2 | ChibiOS - Copyright (C) 2017 Theodore Ateba | ||
3 | |||
4 | Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | you may not use this file except in compliance with the License. | ||
6 | You may obtain a copy of the License at | ||
7 | |||
8 | http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | |||
10 | Unless required by applicable law or agreed to in writing, software | ||
11 | distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | See the License for the specific language governing permissions and | ||
14 | limitations under the License. | ||
15 | */ | ||
16 | |||
17 | #include "hal.h" | ||
18 | |||
19 | /** | ||
20 | * @brief PAL setup. | ||
21 | * @details Digital I/O ports static configuration as defined in @p board.h. | ||
22 | * This variable is used by the HAL when initializing the PAL driver. | ||
23 | */ | ||
24 | #if HAL_USE_PAL || defined(__DOXYGEN__) | ||
25 | const PALConfig pal_default_config = | ||
26 | { | ||
27 | #if defined(PORTA) | ||
28 | {VAL_PORTA, VAL_DDRA}, | ||
29 | #endif | ||
30 | #if defined(PORTB) | ||
31 | {VAL_PORTB, VAL_DDRB}, | ||
32 | #endif | ||
33 | #if defined(PORTC) | ||
34 | {VAL_PORTC, VAL_DDRC}, | ||
35 | #endif | ||
36 | #if defined(PORTD) | ||
37 | {VAL_PORTD, VAL_DDRD}, | ||
38 | #endif | ||
39 | #if defined(PORTE) | ||
40 | {VAL_PORTE, VAL_DDRE}, | ||
41 | #endif | ||
42 | #if defined(PORTF) | ||
43 | {VAL_PORTF, VAL_DDRF}, | ||
44 | #endif | ||
45 | #if defined(PORTG) | ||
46 | {VAL_PORTG, VAL_DDRG}, | ||
47 | #endif | ||
48 | #if defined(PORTH) | ||
49 | {VAL_PORTH, VAL_DDRH}, | ||
50 | #endif | ||
51 | #if defined(PORTJ) | ||
52 | {VAL_PORTJ, VAL_DDRJ}, | ||
53 | #endif | ||
54 | #if defined(PORTK) | ||
55 | {VAL_PORTK, VAL_DDRK}, | ||
56 | #endif | ||
57 | #if defined(PORTL) | ||
58 | {VAL_PORTL, VAL_DDRL}, | ||
59 | #endif | ||
60 | }; | ||
61 | #endif /* HAL_USE_PAL */ | ||
62 | |||
63 | /** | ||
64 | * Board-specific initialization code. | ||
65 | */ | ||
66 | void boardInit(void) { | ||
67 | |||
68 | } | ||
diff --git a/lib/chibios/os/hal/boards/MT-DB-X4/board.h b/lib/chibios/os/hal/boards/MT-DB-X4/board.h new file mode 100644 index 000000000..2b508f0f8 --- /dev/null +++ b/lib/chibios/os/hal/boards/MT-DB-X4/board.h | |||
@@ -0,0 +1,86 @@ | |||
1 | /* | ||
2 | ChibiOS - Copyright (C) 2017 Theodore Ateba | ||
3 | |||
4 | Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | you may not use this file except in compliance with the License. | ||
6 | You may obtain a copy of the License at | ||
7 | |||
8 | http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | |||
10 | Unless required by applicable law or agreed to in writing, software | ||
11 | distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | See the License for the specific language governing permissions and | ||
14 | limitations under the License. | ||
15 | */ | ||
16 | |||
17 | #ifndef BOARD_H | ||
18 | #define BOARD_H | ||
19 | |||
20 | /* | ||
21 | * Setup for the Mattair board. | ||
22 | */ | ||
23 | |||
24 | /* | ||
25 | * Board identifier. | ||
26 | */ | ||
27 | #define BOARD_MT_DB_X4 | ||
28 | #define BOARD_NAME "MT-DB-X4 board" | ||
29 | |||
30 | /* All inputs with pull-ups */ | ||
31 | #define VAL_DDRA 0x00 | ||
32 | #define VAL_PORTA 0xFF | ||
33 | |||
34 | /* All inputs. */ | ||
35 | #define VAL_DDRB 0x00 | ||
36 | #define VAL_PORTB 0xFF | ||
37 | |||
38 | /* All inputs with pull-ups */ | ||
39 | #define VAL_DDRC 0x00 | ||
40 | #define VAL_PORTC 0xFF | ||
41 | |||
42 | /* All inputs with pull-ups */ | ||
43 | #define VAL_DDRD 0x00 | ||
44 | #define VAL_PORTD 0xFF | ||
45 | |||
46 | /* All inputs except PE1 wich has a LED connected. */ | ||
47 | #define VAL_DDRE 0x02 | ||
48 | #define VAL_PORTE 0xFF | ||
49 | |||
50 | /* All inputs with pull-ups */ | ||
51 | #define VAL_DDRF 0x00 | ||
52 | #define VAL_PORTF 0xFF | ||
53 | |||
54 | /* All inputs with pull-ups */ | ||
55 | #define VAL_DDRG 0x00 | ||
56 | #define VAL_PORTG 0xFF | ||
57 | |||
58 | /* All inputs with pull-ups */ | ||
59 | #define VAL_DDRH 0x00 | ||
60 | #define VAL_PORTH 0xFF | ||
61 | |||
62 | /* All inputs with pull-ups */ | ||
63 | #define VAL_DDRJ 0x00 | ||
64 | #define VAL_PORTJ 0xFF | ||
65 | |||
66 | /* All inputs with pull-ups */ | ||
67 | #define VAL_DDRK 0x00 | ||
68 | #define VAL_PORTK 0xFF | ||
69 | |||
70 | /* All inputs with pull-ups */ | ||
71 | #define VAL_DDRL 0x00 | ||
72 | #define VAL_PORTL 0xFF | ||
73 | |||
74 | #define PORTE_LED 1 | ||
75 | |||
76 | #if !defined(_FROM_ASM_) | ||
77 | #ifdef __cplusplus | ||
78 | extern "C" { | ||
79 | #endif | ||
80 | void boardInit(void); | ||
81 | #ifdef __cplusplus | ||
82 | } | ||
83 | #endif | ||
84 | #endif /* _FROM_ASM_ */ | ||
85 | |||
86 | #endif /* BOARD_H */ | ||
diff --git a/lib/chibios/os/hal/boards/MT-DB-X4/board.mk b/lib/chibios/os/hal/boards/MT-DB-X4/board.mk new file mode 100644 index 000000000..46b221a60 --- /dev/null +++ b/lib/chibios/os/hal/boards/MT-DB-X4/board.mk | |||
@@ -0,0 +1,9 @@ | |||
1 | # List of all the board related files. | ||
2 | BOARDSRC = ${CHIBIOS}/os/hal/boards/MT-DB-X4/board.c | ||
3 | |||
4 | # Required include directories | ||
5 | BOARDINC = ${CHIBIOS}/os/hal/boards/MT-DB-X4 | ||
6 | |||
7 | # Shared variables | ||
8 | ALLCSRC += $(BOARDSRC) | ||
9 | ALLINC += $(BOARDINC) | ||
diff --git a/lib/chibios/os/hal/boards/NGX_BB_LPC11U14/board.c b/lib/chibios/os/hal/boards/NGX_BB_LPC11U14/board.c new file mode 100644 index 000000000..65c164809 --- /dev/null +++ b/lib/chibios/os/hal/boards/NGX_BB_LPC11U14/board.c | |||
@@ -0,0 +1,60 @@ | |||
1 | /* | ||
2 | ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio | ||
3 | |||
4 | Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | you may not use this file except in compliance with the License. | ||
6 | You may obtain a copy of the License at | ||
7 | |||
8 | http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | |||
10 | Unless required by applicable law or agreed to in writing, software | ||
11 | distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | See the License for the specific language governing permissions and | ||
14 | limitations under the License. | ||
15 | */ | ||
16 | |||
17 | #include "hal.h" | ||
18 | |||
19 | /** | ||
20 | * @brief PAL setup. | ||
21 | * @details Digital I/O ports static configuration as defined in @p board.h. | ||
22 | * This variable is used by the HAL when initializing the PAL driver. | ||
23 | */ | ||
24 | #if HAL_USE_PAL || defined(__DOXYGEN__) | ||
25 | const PALConfig pal_default_config = { | ||
26 | {VAL_GPIO0DATA, VAL_GPIO0DIR}, | ||
27 | {VAL_GPIO1DATA, VAL_GPIO1DIR} | ||
28 | }; | ||
29 | #endif | ||
30 | |||
31 | /* | ||
32 | * Early initialization code. | ||
33 | * This initialization must be performed just after stack setup and before | ||
34 | * any other initialization. | ||
35 | */ | ||
36 | __inline void __early_init(void) { | ||
37 | |||
38 | lpc_clock_init(); | ||
39 | } | ||
40 | |||
41 | /* | ||
42 | * Board-specific initialization code. | ||
43 | */ | ||
44 | __inline void boardInit(void) { | ||
45 | |||
46 | /* LCD */ | ||
47 | LPC_IOCON->TMS_PIO0_12 = 0x91; /* LCD_EN: GPIO - pull-up */ | ||
48 | LPC_IOCON->TDO_PIO0_13 = 0x81; /* LCD_RW: GPIO - No pull-up */ | ||
49 | LPC_IOCON->TRST_PIO0_14 = 0x81; /* LCD_RS: GPIO - No pull-up */ | ||
50 | |||
51 | /* USART */ | ||
52 | LPC_IOCON->PIO0_18 = 0x81; /* RDX: RXD - No pull-up */ | ||
53 | LPC_IOCON->PIO0_19 = 0x81; /* TDX: TXD - No pull-up */ | ||
54 | |||
55 | /* Test LEDs */ | ||
56 | LPC_IOCON->PIO0_22 = 0x80; /* LED_TEST1: GPIO - No pull-up */ | ||
57 | LPC_IOCON->PIO0_23 = 0x80; /* LED_TEST2: GPIO - No pull-up */ | ||
58 | |||
59 | } | ||
60 | |||
diff --git a/lib/chibios/os/hal/boards/NGX_BB_LPC11U14/board.h b/lib/chibios/os/hal/boards/NGX_BB_LPC11U14/board.h new file mode 100644 index 000000000..15d9dce2a --- /dev/null +++ b/lib/chibios/os/hal/boards/NGX_BB_LPC11U14/board.h | |||
@@ -0,0 +1,125 @@ | |||
1 | /* | ||
2 | ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio | ||
3 | |||
4 | Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | you may not use this file except in compliance with the License. | ||
6 | You may obtain a copy of the License at | ||
7 | |||
8 | http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | |||
10 | Unless required by applicable law or agreed to in writing, software | ||
11 | distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | See the License for the specific language governing permissions and | ||
14 | limitations under the License. | ||
15 | */ | ||
16 | |||
17 | #ifndef _BOARD_H_ | ||
18 | #define _BOARD_H_ | ||
19 | |||
20 | /* | ||
21 | * Setup for NGX BlueBoard LPC11U14. | ||
22 | */ | ||
23 | |||
24 | /* | ||
25 | * Board identifiers. | ||
26 | */ | ||
27 | #define BOARD_NGX_BB_LPC11U14 | ||
28 | #define BOARD_NAME "NGX BlueBoard LPC11U14" | ||
29 | |||
30 | /* | ||
31 | * Board frequencies. | ||
32 | */ | ||
33 | #define SYSOSCCLK 12000000 | ||
34 | |||
35 | /* | ||
36 | * Pin definitions. | ||
37 | */ | ||
38 | |||
39 | /* GPIO Port0 */ | ||
40 | #define BUTTON_ISP_PORT GPIO0 | ||
41 | #define BUTTON_ISP 1 | ||
42 | |||
43 | #define LCD_ERD_PORT GPIO0 | ||
44 | #define LCD_ERD 12 | ||
45 | |||
46 | #define LCD_RWR_PORT GPIO0 | ||
47 | #define LCD_RWR 13 | ||
48 | |||
49 | #define LCD_RS_PORT GPIO0 | ||
50 | #define LCD_RS 14 | ||
51 | |||
52 | #define LED_PORT GPIO0 | ||
53 | #define LED_TEST1 22 | ||
54 | #define LED_TEST2 23 | ||
55 | |||
56 | /* GPIO Port1 */ | ||
57 | #define LCD_RST_PORT GPIO1 | ||
58 | #define LCD_RST 0 | ||
59 | |||
60 | #define LCD_CS_PORT GPIO1 | ||
61 | #define LCD_CS 13 | ||
62 | |||
63 | #define LCD_BL_PORT GPIO1 | ||
64 | #define LCD_BL 14 | ||
65 | #define LCD_VCCEN_PORT GPIO1 | ||
66 | #define LCD_VCCEN 14 | ||
67 | |||
68 | #define WHEEL_SENSOR_PORT GPIO0 | ||
69 | #define WHEEL_SENSOR 21 | ||
70 | |||
71 | #define LCD_DATA_PORT GPIO1 | ||
72 | #define LCD_D0 19 | ||
73 | #define LCD_D1 20 | ||
74 | #define LCD_D2 21 | ||
75 | #define LCD_D3 22 | ||
76 | #define LCD_D4 26 | ||
77 | #define LCD_D5 27 | ||
78 | #define LCD_D6 28 | ||
79 | #define LCD_D7 31 | ||
80 | |||
81 | #define LCD_DATA_MASK PAL_PORT_BIT(LCD_D0) | \ | ||
82 | PAL_PORT_BIT(LCD_D1) | \ | ||
83 | PAL_PORT_BIT(LCD_D2) | \ | ||
84 | PAL_PORT_BIT(LCD_D3) | \ | ||
85 | PAL_PORT_BIT(LCD_D4) | \ | ||
86 | PAL_PORT_BIT(LCD_D5) | \ | ||
87 | PAL_PORT_BIT(LCD_D6) | \ | ||
88 | PAL_PORT_BIT(LCD_D7) | ||
89 | |||
90 | /* | ||
91 | * GPIO 0 initial setup. | ||
92 | */ | ||
93 | #define VAL_GPIO0DIR PAL_PORT_BIT(LCD_ERD) | \ | ||
94 | PAL_PORT_BIT(LCD_RWR) | \ | ||
95 | PAL_PORT_BIT(LCD_RS) | \ | ||
96 | PAL_PORT_BIT(LED_TEST1) | \ | ||
97 | PAL_PORT_BIT(LED_TEST2) | ||
98 | |||
99 | #define VAL_GPIO0DATA PAL_PORT_BIT(LCD_ERD) | \ | ||
100 | PAL_PORT_BIT(LCD_RWR) | \ | ||
101 | PAL_PORT_BIT(LED_TEST1) | \ | ||
102 | PAL_PORT_BIT(LED_TEST2) | ||
103 | |||
104 | /* | ||
105 | * GPIO 1 initial setup. | ||
106 | */ | ||
107 | #define VAL_GPIO1DIR PAL_PORT_BIT(LCD_RST) | \ | ||
108 | PAL_PORT_BIT(LCD_CS) | \ | ||
109 | PAL_PORT_BIT(LCD_BL) | \ | ||
110 | LCD_DATA_MASK | ||
111 | |||
112 | #define VAL_GPIO1DATA 0x00000000 | ||
113 | |||
114 | |||
115 | #if !defined(_FROM_ASM_) | ||
116 | #ifdef __cplusplus | ||
117 | extern "C" { | ||
118 | #endif | ||
119 | void boardInit(void); | ||
120 | #ifdef __cplusplus | ||
121 | } | ||
122 | #endif | ||
123 | #endif | ||
124 | |||
125 | #endif | ||
diff --git a/lib/chibios/os/hal/boards/NGX_BB_LPC11U14/board.mk b/lib/chibios/os/hal/boards/NGX_BB_LPC11U14/board.mk new file mode 100644 index 000000000..33e91044b --- /dev/null +++ b/lib/chibios/os/hal/boards/NGX_BB_LPC11U14/board.mk | |||
@@ -0,0 +1,9 @@ | |||
1 | # List of all the board related files. | ||
2 | BOARDSRC = ${CHIBIOS}/os/hal/boards/NGX_BB_LPC11U14/board.c | ||
3 | |||
4 | # Required include directories | ||
5 | BOARDINC = ${CHIBIOS}/os/hal/boards/NGX_BB_LPC11U14 | ||
6 | |||
7 | # Shared variables | ||
8 | ALLCSRC += $(BOARDSRC) | ||
9 | ALLINC += $(BOARDINC) | ||
diff --git a/lib/chibios/os/hal/boards/OLIMEX_AVR_CAN/board.c b/lib/chibios/os/hal/boards/OLIMEX_AVR_CAN/board.c new file mode 100644 index 000000000..e41d9809a --- /dev/null +++ b/lib/chibios/os/hal/boards/OLIMEX_AVR_CAN/board.c | |||
@@ -0,0 +1,89 @@ | |||
1 | /* | ||
2 | ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio | ||
3 | |||
4 | Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | you may not use this file except in compliance with the License. | ||
6 | You may obtain a copy of the License at | ||
7 | |||
8 | http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | |||
10 | Unless required by applicable law or agreed to in writing, software | ||
11 | distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | See the License for the specific language governing permissions and | ||
14 | limitations under the License. | ||
15 | */ | ||
16 | |||
17 | #include "hal.h" | ||
18 | |||
19 | /** | ||
20 | * @brief PAL setup. | ||
21 | * @details Digital I/O ports static configuration as defined in @p board.h. | ||
22 | * This variable is used by the HAL when initializing the PAL driver. | ||
23 | */ | ||
24 | #if HAL_USE_PAL || defined(__DOXYGEN__) | ||
25 | const PALConfig pal_default_config = | ||
26 | { | ||
27 | #if defined(PORTA) | ||
28 | {VAL_PORTA, VAL_DDRA}, | ||
29 | #endif | ||
30 | #if defined(PORTB) | ||
31 | {VAL_PORTB, VAL_DDRB}, | ||
32 | #endif | ||
33 | #if defined(PORTC) | ||
34 | {VAL_PORTC, VAL_DDRC}, | ||
35 | #endif | ||
36 | #if defined(PORTD) | ||
37 | {VAL_PORTD, VAL_DDRD}, | ||
38 | #endif | ||
39 | #if defined(PORTE) | ||
40 | {VAL_PORTE, VAL_DDRE}, | ||
41 | #endif | ||
42 | #if defined(PORTF) | ||
43 | {VAL_PORTF, VAL_DDRF}, | ||
44 | #endif | ||
45 | #if defined(PORTG) | ||
46 | {VAL_PORTG, VAL_DDRG}, | ||
47 | #endif | ||
48 | }; | ||
49 | #endif /* HAL_USE_PAL */ | ||
50 | |||
51 | CH_IRQ_HANDLER(TIMER0_COMP_vect) { | ||
52 | |||
53 | CH_IRQ_PROLOGUE(); | ||
54 | |||
55 | chSysLockFromIsr(); | ||
56 | chSysTimerHandlerI(); | ||
57 | chSysUnlockFromIsr(); | ||
58 | |||
59 | CH_IRQ_EPILOGUE(); | ||
60 | } | ||
61 | |||
62 | /* | ||
63 | * Board-specific initialization code. | ||
64 | */ | ||
65 | void boardInit(void) { | ||
66 | |||
67 | /* | ||
68 | * External interrupts setup, all disabled initially. | ||
69 | */ | ||
70 | EICRA = 0x00; | ||
71 | EICRB = 0x00; | ||
72 | EIMSK = 0x00; | ||
73 | |||
74 | /* | ||
75 | * Enables Idle mode for SLEEP instruction. | ||
76 | */ | ||
77 | SMCR = (1 << SE); | ||
78 | |||
79 | /* | ||
80 | * Timer 0 setup. | ||
81 | */ | ||
82 | TCCR0A = (1 << WGM01) | (0 << WGM00) | /* CTC mode. */ | ||
83 | (0 << COM0A1) | (0 << COM0A0) | /* OC0A disabled. */ | ||
84 | (0 << CS02) | (1 << CS01) | (1 << CS00); /* CLK/64 clock. */ | ||
85 | OCR0A = F_CPU / 64 / CH_FREQUENCY - 1; | ||
86 | TCNT0 = 0; /* Reset counter. */ | ||
87 | TIFR0 = (1 << OCF0A); /* Reset pending. */ | ||
88 | TIMSK0 = (1 << OCIE0A); /* IRQ on compare. */ | ||
89 | } | ||
diff --git a/lib/chibios/os/hal/boards/OLIMEX_AVR_CAN/board.h b/lib/chibios/os/hal/boards/OLIMEX_AVR_CAN/board.h new file mode 100644 index 000000000..b87bc472d --- /dev/null +++ b/lib/chibios/os/hal/boards/OLIMEX_AVR_CAN/board.h | |||
@@ -0,0 +1,99 @@ | |||
1 | /* | ||
2 | ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio | ||
3 | |||
4 | Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | you may not use this file except in compliance with the License. | ||
6 | You may obtain a copy of the License at | ||
7 | |||
8 | http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | |||
10 | Unless required by applicable law or agreed to in writing, software | ||
11 | distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | See the License for the specific language governing permissions and | ||
14 | limitations under the License. | ||
15 | */ | ||
16 | |||
17 | #ifndef _BOARD_H_ | ||
18 | #define _BOARD_H_ | ||
19 | |||
20 | /* | ||
21 | * Setup for the Olimex AVR-CAN proto board. | ||
22 | */ | ||
23 | |||
24 | /* | ||
25 | * Board identifier. | ||
26 | */ | ||
27 | #define BOARD_OLIMEX_AVR_CAN | ||
28 | #define BOARD_NAME "Olimex AVR-CAN" | ||
29 | |||
30 | /* | ||
31 | * All inputs with pullups. | ||
32 | */ | ||
33 | #define VAL_DDRA 0x00 | ||
34 | #define VAL_PORTA 0xFF | ||
35 | |||
36 | /* | ||
37 | * All inputs with pullups. | ||
38 | */ | ||
39 | #define VAL_DDRB 0x00 | ||
40 | #define VAL_PORTB 0xFF | ||
41 | |||
42 | /* | ||
43 | * All inputs with pullups. | ||
44 | */ | ||
45 | #define VAL_DDRC 0x00 | ||
46 | #define VAL_PORTC 0xFF | ||
47 | |||
48 | /* PD7 PD6 PD5 PD4 PD3 PD2 PD1 PD0 | ||
49 | * IN IN OUT IN OUT IN IN IN | ||
50 | * DDRD 0 0 1 0 1 0 0 0 | ||
51 | * PU HiZ VAL PU VAL HiZ HiZ HiZ | ||
52 | * PORTD 1 0 ?1 1 1 0 0 0 | ||
53 | */ | ||
54 | #define VAL_DDRD 0x28 | ||
55 | #define VAL_PORTD 0xB8 | ||
56 | |||
57 | /* PE7 PE6 BUT LED PE3 PE2 PE1 PE0 | ||
58 | * IN IN IN OUT IN IN OUT IN | ||
59 | * DDRE 0 0 0 1 0 0 1 0 | ||
60 | * PU PU HiZ VAL PU PU VAL HiZ | ||
61 | * PORTE 1 1 0 1 1 1 1 0 | ||
62 | */ | ||
63 | #define VAL_DDRE 0x12 | ||
64 | #define VAL_PORTE 0xDE | ||
65 | |||
66 | /* TDI TDO TMS TCK PF3 PF2 PF1 PF0 | ||
67 | * x x x x IN IN IN IN | ||
68 | * DDRF 0 0 0 0 0 0 0 0 | ||
69 | * x x x x PU PU PU PU | ||
70 | * PORTF 0 0 0 0 1 1 1 1 | ||
71 | * | ||
72 | */ | ||
73 | #define VAL_DDRF 0x00 | ||
74 | #define VAL_PORTF 0x0F | ||
75 | |||
76 | /* x x x x x PG2 PG1 PG0 | ||
77 | * x x x x x IN IN IN | ||
78 | * DDRG 0 0 0 0 0 0 0 0 | ||
79 | * x x x x x PU PU PU | ||
80 | * PORTG 0 0 0 0 0 1 1 1 | ||
81 | * | ||
82 | */ | ||
83 | #define VAL_DDRG 0x00 | ||
84 | #define VAL_PORTG 0x07 | ||
85 | |||
86 | #define PORTE_LED 4 | ||
87 | #define PORTE_BUTTON 5 | ||
88 | |||
89 | #if !defined(_FROM_ASM_) | ||
90 | #ifdef __cplusplus | ||
91 | extern "C" { | ||
92 | #endif | ||
93 | void boardInit(void); | ||
94 | #ifdef __cplusplus | ||
95 | } | ||
96 | #endif | ||
97 | #endif /* _FROM_ASM_ */ | ||
98 | |||
99 | #endif /* _BOARD_H_ */ | ||
diff --git a/lib/chibios/os/hal/boards/OLIMEX_AVR_CAN/board.mk b/lib/chibios/os/hal/boards/OLIMEX_AVR_CAN/board.mk new file mode 100644 index 000000000..d9aad6e5a --- /dev/null +++ b/lib/chibios/os/hal/boards/OLIMEX_AVR_CAN/board.mk | |||
@@ -0,0 +1,9 @@ | |||
1 | # List of all the board related files. | ||
2 | BOARDSRC = ${CHIBIOS}/os/hal/boards/OLIMEX_AVR_CAN/board.c | ||
3 | |||
4 | # Required include directories | ||
5 | BOARDINC = ${CHIBIOS}/os/hal/boards/OLIMEX_AVR_CAN | ||
6 | |||
7 | # Shared variables | ||
8 | ALLCSRC += $(BOARDSRC) | ||
9 | ALLINC += $(BOARDINC) | ||
diff --git a/lib/chibios/os/hal/boards/OLIMEX_AVR_MT_128/board.c b/lib/chibios/os/hal/boards/OLIMEX_AVR_MT_128/board.c new file mode 100644 index 000000000..4aeae736b --- /dev/null +++ b/lib/chibios/os/hal/boards/OLIMEX_AVR_MT_128/board.c | |||
@@ -0,0 +1,92 @@ | |||
1 | /* | ||
2 | ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio | ||
3 | |||
4 | Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | you may not use this file except in compliance with the License. | ||
6 | You may obtain a copy of the License at | ||
7 | |||
8 | http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | |||
10 | Unless required by applicable law or agreed to in writing, software | ||
11 | distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | See the License for the specific language governing permissions and | ||
14 | limitations under the License. | ||
15 | */ | ||
16 | |||
17 | #include "hal.h" | ||
18 | |||
19 | /** | ||
20 | * @brief PAL setup. | ||
21 | * @details Digital I/O ports static configuration as defined in @p board.h. | ||
22 | * This variable is used by the HAL when initializing the PAL driver. | ||
23 | */ | ||
24 | #if HAL_USE_PAL || defined(__DOXYGEN__) | ||
25 | const PALConfig pal_default_config = | ||
26 | { | ||
27 | #if defined(PORTA) | ||
28 | {VAL_PORTA, VAL_DDRA}, | ||
29 | #endif | ||
30 | #if defined(PORTB) | ||
31 | {VAL_PORTB, VAL_DDRB}, | ||
32 | #endif | ||
33 | #if defined(PORTC) | ||
34 | {VAL_PORTC, VAL_DDRC}, | ||
35 | #endif | ||
36 | #if defined(PORTD) | ||
37 | {VAL_PORTD, VAL_DDRD}, | ||
38 | #endif | ||
39 | #if defined(PORTE) | ||
40 | {VAL_PORTE, VAL_DDRE}, | ||
41 | #endif | ||
42 | #if defined(PORTF) | ||
43 | {VAL_PORTF, VAL_DDRF}, | ||
44 | #endif | ||
45 | #if defined(PORTG) | ||
46 | {VAL_PORTG, VAL_DDRG}, | ||
47 | #endif | ||
48 | }; | ||
49 | #endif /* HAL_USE_PAL */ | ||
50 | |||
51 | /** | ||
52 | * @brief Timer0 interrupt handler. | ||
53 | */ | ||
54 | CH_IRQ_HANDLER(TIMER0_COMP_vect) { | ||
55 | |||
56 | CH_IRQ_PROLOGUE(); | ||
57 | |||
58 | chSysLockFromIsr(); | ||
59 | chSysTimerHandlerI(); | ||
60 | chSysUnlockFromIsr(); | ||
61 | |||
62 | CH_IRQ_EPILOGUE(); | ||
63 | } | ||
64 | |||
65 | /** | ||
66 | * Board-specific initialization code. | ||
67 | */ | ||
68 | void boardInit(void) { | ||
69 | |||
70 | /* | ||
71 | * External interrupts setup, all disabled initially. | ||
72 | */ | ||
73 | EICRA = 0x00; | ||
74 | EICRB = 0x00; | ||
75 | EIMSK = 0x00; | ||
76 | |||
77 | /* | ||
78 | * Enables Idle mode for SLEEP instruction. | ||
79 | */ | ||
80 | MCUCR = (1 << SE); | ||
81 | |||
82 | /* | ||
83 | * Timer 0 setup. | ||
84 | */ | ||
85 | TCCR0 = (1 << WGM01) | (0 << WGM00) | /* CTC mode. */ | ||
86 | (0 << COM01) | (0 << COM00) | /* OC0A disabled. */ | ||
87 | (1 << CS02) | (0 << CS01) | (0 << CS00); /* CLK/64 clock. */ | ||
88 | OCR0 = F_CPU / 64 / CH_FREQUENCY - 1; | ||
89 | TCNT0 = 0; /* Reset counter. */ | ||
90 | TIFR = (1 << OCF0); /* Reset pending. */ | ||
91 | TIMSK = (1 << OCIE0); /* IRQ on compare. */ | ||
92 | } | ||
diff --git a/lib/chibios/os/hal/boards/OLIMEX_AVR_MT_128/board.h b/lib/chibios/os/hal/boards/OLIMEX_AVR_MT_128/board.h new file mode 100644 index 000000000..2526949de --- /dev/null +++ b/lib/chibios/os/hal/boards/OLIMEX_AVR_MT_128/board.h | |||
@@ -0,0 +1,124 @@ | |||
1 | /* | ||
2 | ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio | ||
3 | |||
4 | Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | you may not use this file except in compliance with the License. | ||
6 | You may obtain a copy of the License at | ||
7 | |||
8 | http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | |||
10 | Unless required by applicable law or agreed to in writing, software | ||
11 | distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | See the License for the specific language governing permissions and | ||
14 | limitations under the License. | ||
15 | */ | ||
16 | |||
17 | #ifndef _BOARD_H_ | ||
18 | #define _BOARD_H_ | ||
19 | |||
20 | /* | ||
21 | * Setup for the Olimex AVR-MT-128 proto board. | ||
22 | */ | ||
23 | |||
24 | /* | ||
25 | * Board identifier. | ||
26 | */ | ||
27 | #define BOARD_OLIMEX_AVR_MT_128 | ||
28 | #define BOARD_NAME "Olimex AVR-MT-128" | ||
29 | |||
30 | /* PA7 RLY DS B5 B4 B3 B2 B1 | ||
31 | * IN OUT IN IN IN IN IN IN | ||
32 | * DDRA 0 1 0 0 0 0 0 0 | ||
33 | * PU VAL HiZ HiZ HiZ HiZ HiZ HiZ | ||
34 | * PORTA 1 0 0 0 0 0 0 0 | ||
35 | */ | ||
36 | #define VAL_DDRA 0x40 | ||
37 | #define VAL_PORTA 0x80 | ||
38 | |||
39 | /* | ||
40 | * All inputs with pullups. | ||
41 | */ | ||
42 | #define VAL_DDRB 0x00 | ||
43 | #define VAL_PORTB 0xFF | ||
44 | |||
45 | /* D7 D6 D5 D4 PC3 E R/W RS | ||
46 | * OUT OUT OUT OUT IN OUT OUT OUT | ||
47 | * DDRC 1 1 1 1 0 1 1 1 | ||
48 | * PU PU PU PU PU VAL VAL VAL | ||
49 | * PORTC 0 0 0 0 1 0 0 0 | ||
50 | */ | ||
51 | #define VAL_DDRC 0xF7 | ||
52 | #define VAL_PORTC 0x08 | ||
53 | |||
54 | /* PD7 PD6 PD5 PD4 TXD RXD PD1 PD0 | ||
55 | * IN IN IN IN OUT IN IN IN | ||
56 | * DDRD 0 0 0 0 1 0 0 0 | ||
57 | * PU PU PU PU VAL HiZ PU PU | ||
58 | * PORTD 1 1 1 1 1 0 1 1 | ||
59 | */ | ||
60 | #define VAL_DDRD 0x08 | ||
61 | #define VAL_PORTD 0xFB | ||
62 | |||
63 | /* PE7 PE6 BZ2 BZ2 PE3 PE2 PE1 PE0 | ||
64 | * IN IN OUT OUT IN IN OUT IN | ||
65 | * DDRE 0 0 1 1 0 0 1 0 | ||
66 | * PU PU VAL VAL PU PU VAL PU | ||
67 | * PORTE 1 1 1 1 1 1 1 1 | ||
68 | */ | ||
69 | #define VAL_DDRE 0x32 | ||
70 | #define VAL_PORTE 0xFF | ||
71 | |||
72 | /* TDI TDO TMS TCK PF3 PF2 PF1 PF0 | ||
73 | * x x x x IN IN IN IN | ||
74 | * DDRF 0 0 0 0 0 0 0 0 | ||
75 | * x x x x PU PU PU PU | ||
76 | * PORTF 0 0 0 0 1 1 1 1 | ||
77 | * | ||
78 | */ | ||
79 | #define VAL_DDRF 0x00 | ||
80 | #define VAL_PORTF 0x0F | ||
81 | |||
82 | /* x x x x x PG2 PG1 PG0 | ||
83 | * x x x x x IN IN IN | ||
84 | * DDRG 0 0 0 0 0 0 0 0 | ||
85 | * x x x x x PU PU PU | ||
86 | * PORTG 0 0 0 0 0 1 1 1 | ||
87 | * | ||
88 | */ | ||
89 | #define VAL_DDRG 0x00 | ||
90 | #define VAL_PORTG 0x07 | ||
91 | |||
92 | |||
93 | #define PORTA_BUTTON1 0 | ||
94 | #define PORTA_BUTTON2 1 | ||
95 | #define PORTA_BUTTON3 2 | ||
96 | #define PORTA_BUTTON4 3 | ||
97 | #define PORTA_BUTTON5 4 | ||
98 | #define PORTA_DALLAS 5 | ||
99 | #define PORTA_RELAY 6 | ||
100 | |||
101 | #define PORTC_44780_RS_MASK (1 << 0) | ||
102 | #define PORTC_44780_RW_MASK (1 << 1) | ||
103 | #define PORTC_44780_E_MASK (1 << 2) | ||
104 | #define PORTC_44780_D4_MASK (1 << 4) | ||
105 | #define PORTC_44780_D5_MASK (1 << 5) | ||
106 | #define PORTC_44780_D6_MASK (1 << 6) | ||
107 | #define PORTC_44780_D7_MASK (1 << 7) | ||
108 | #define PORTC_44780_DATA_MASK (PORTC_44780_D4_MASK | PORTC_44780_D5_MASK | \ | ||
109 | PORTC_44780_D6_MASK | PORTC_44780_D7_MASK) | ||
110 | |||
111 | #define PORTE_BUZZ1 (1 << 4) | ||
112 | #define PORTE_BUZZ2 (1 << 5) | ||
113 | |||
114 | #if !defined(_FROM_ASM_) | ||
115 | #ifdef __cplusplus | ||
116 | extern "C" { | ||
117 | #endif | ||
118 | void boardInit(void); | ||
119 | #ifdef __cplusplus | ||
120 | } | ||
121 | #endif | ||
122 | #endif /* _FROM_ASM_ */ | ||
123 | |||
124 | #endif /* _BOARD_H_ */ | ||
diff --git a/lib/chibios/os/hal/boards/OLIMEX_AVR_MT_128/board.mk b/lib/chibios/os/hal/boards/OLIMEX_AVR_MT_128/board.mk new file mode 100644 index 000000000..902aad520 --- /dev/null +++ b/lib/chibios/os/hal/boards/OLIMEX_AVR_MT_128/board.mk | |||
@@ -0,0 +1,9 @@ | |||
1 | # List of all the board related files. | ||
2 | BOARDSRC = ${CHIBIOS}/os/hal/boards/OLIMEX_AVR_MT_128/board.c | ||
3 | |||
4 | # Required include directories | ||
5 | BOARDINC = ${CHIBIOS}/os/hal/boards/OLIMEX_AVR_MT_128 | ||
6 | |||
7 | # Shared variables | ||
8 | ALLCSRC += $(BOARDSRC) | ||
9 | ALLINC += $(BOARDINC) | ||
diff --git a/lib/chibios/os/hal/boards/OLIMEX_LPC_P1227/board.c b/lib/chibios/os/hal/boards/OLIMEX_LPC_P1227/board.c new file mode 100644 index 000000000..81656d4e3 --- /dev/null +++ b/lib/chibios/os/hal/boards/OLIMEX_LPC_P1227/board.c | |||
@@ -0,0 +1,53 @@ | |||
1 | /* | ||
2 | ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio | ||
3 | |||
4 | Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | you may not use this file except in compliance with the License. | ||
6 | You may obtain a copy of the License at | ||
7 | |||
8 | http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | |||
10 | Unless required by applicable law or agreed to in writing, software | ||
11 | distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | See the License for the specific language governing permissions and | ||
14 | limitations under the License. | ||
15 | */ | ||
16 | |||
17 | #include "hal.h" | ||
18 | |||
19 | /** | ||
20 | * @brief PAL setup. | ||
21 | * @details Digital I/O ports static configuration as defined in @p board.h. | ||
22 | * This variable is used by the HAL when initializing the PAL driver. | ||
23 | */ | ||
24 | #if HAL_USE_PAL || defined(__DOXYGEN__) | ||
25 | const PALConfig pal_default_config = { | ||
26 | {VAL_GPIO0DATA, VAL_GPIO0DIR}, | ||
27 | {VAL_GPIO1DATA, VAL_GPIO1DIR}, | ||
28 | {VAL_GPIO2DATA, VAL_GPIO2DIR}, | ||
29 | }; | ||
30 | #endif | ||
31 | |||
32 | /* | ||
33 | * Early initialization code. | ||
34 | * This initialization must be performed just after stack setup and before | ||
35 | * any other initialization. | ||
36 | */ | ||
37 | void __early_init(void) { | ||
38 | |||
39 | lpc122x_clock_init(); | ||
40 | } | ||
41 | |||
42 | /* | ||
43 | * Board-specific initialization code. | ||
44 | */ | ||
45 | void boardInit(void) { | ||
46 | |||
47 | /* | ||
48 | * Extra, board-specific, initializations. | ||
49 | */ | ||
50 | LPC_IOCON->PIO1_4 = 0x80; /* Disables pull-up on LED2 output. */ | ||
51 | LPC_IOCON->PIO1_5 = 0x80; /* Disables pull-up on LED1 output */ | ||
52 | LPC_IOCON->PIO1_6 = 0x80; /* Disables pull-up on Buzzer output */ | ||
53 | } | ||
diff --git a/lib/chibios/os/hal/boards/OLIMEX_LPC_P1227/board.h b/lib/chibios/os/hal/boards/OLIMEX_LPC_P1227/board.h new file mode 100644 index 000000000..002a2cfad --- /dev/null +++ b/lib/chibios/os/hal/boards/OLIMEX_LPC_P1227/board.h | |||
@@ -0,0 +1,94 @@ | |||
1 | /* | ||
2 | ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio | ||
3 | |||
4 | Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | you may not use this file except in compliance with the License. | ||
6 | You may obtain a copy of the License at | ||
7 | |||
8 | http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | |||
10 | Unless required by applicable law or agreed to in writing, software | ||
11 | distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | See the License for the specific language governing permissions and | ||
14 | limitations under the License. | ||
15 | */ | ||
16 | |||
17 | #ifndef _BOARD_H_ | ||
18 | #define _BOARD_H_ | ||
19 | |||
20 | /* | ||
21 | * Setup for Olimex LPC-P1227 board. | ||
22 | * | ||
23 | */ | ||
24 | |||
25 | /* | ||
26 | * Board identifiers. | ||
27 | */ | ||
28 | #define OLIMEX_LPC_P1227 | ||
29 | #define BOARD_NAME "Olimex LPC-P1227" | ||
30 | |||
31 | /* | ||
32 | * Board frequencies. | ||
33 | */ | ||
34 | #define SYSOSCCLK 12000000 | ||
35 | |||
36 | |||
37 | /* | ||
38 | * GPIO 0 initial setup. | ||
39 | */ | ||
40 | #define VAL_GPIO0DIR 0x00000000 | ||
41 | #define VAL_GPIO0DATA 0x00000000 | ||
42 | |||
43 | /* | ||
44 | * GPIO 1 initial setup. | ||
45 | */ | ||
46 | #define VAL_GPIO1DIR PAL_PORT_BIT(GPIO1_LED1) | \ | ||
47 | PAL_PORT_BIT(GPIO1_LED2) | \ | ||
48 | PAL_PORT_BIT(GPIO1_BUZZER) | ||
49 | |||
50 | #define VAL_GPIO1DATA PAL_PORT_BIT(GPIO1_LED1) | ||
51 | |||
52 | |||
53 | /* | ||
54 | * GPIO 2 initial setup. | ||
55 | */ | ||
56 | #define VAL_GPIO2DIR PAL_PORT_BIT(GPIO2_LCD_DC) | \ | ||
57 | PAL_PORT_BIT(GPIO2_LCD_SS) | \ | ||
58 | PAL_PORT_BIT(GPIO2_LCD_RES) | ||
59 | #define VAL_GPIO2DATA PAL_PORT_BIT(GPIO2_LCD_SS) | ||
60 | |||
61 | |||
62 | /* | ||
63 | * Pin definitions. | ||
64 | */ | ||
65 | |||
66 | #define GPIO1_LED1 5 | ||
67 | #define GPIO1_LED2 4 | ||
68 | #define GPIO1_SW_WAKEUP 3 | ||
69 | #define GPIO1_BUZZER 6 | ||
70 | |||
71 | #define GPIO2_SW_USER1 12 | ||
72 | #define GPIO2_SW_USER2 11 | ||
73 | #define GPIO2_SW_USER3 10 | ||
74 | #define GPIO2_LCD_DC 15 | ||
75 | #define GPIO2_LCD_SS 14 | ||
76 | #define GPIO2_LCD_RES 13 | ||
77 | |||
78 | /* LCD3310 pins */ | ||
79 | #define LCD3310_RES_PIN GPIO2_LCD_RES | ||
80 | #define LCD3310_RES_PORT GPIO2 | ||
81 | #define LCD3310_DC_PIN GPIO2_LCD_DC | ||
82 | #define LCD3310_DC_PORT GPIO2 | ||
83 | |||
84 | #if !defined(_FROM_ASM_) | ||
85 | #ifdef __cplusplus | ||
86 | extern "C" { | ||
87 | #endif | ||
88 | void boardInit(void); | ||
89 | #ifdef __cplusplus | ||
90 | } | ||
91 | #endif | ||
92 | #endif /* _FROM_ASM_ */ | ||
93 | |||
94 | #endif /* _BOARD_H_ */ | ||
diff --git a/lib/chibios/os/hal/boards/OLIMEX_LPC_P1227/board.mk b/lib/chibios/os/hal/boards/OLIMEX_LPC_P1227/board.mk new file mode 100644 index 000000000..0b49d51e0 --- /dev/null +++ b/lib/chibios/os/hal/boards/OLIMEX_LPC_P1227/board.mk | |||
@@ -0,0 +1,9 @@ | |||
1 | # List of all the board related files. | ||
2 | BOARDSRC = ${CHIBIOS}/os/hal/boards/OLIMEX_LPC-P1227/board.c | ||
3 | |||
4 | # Required include directories | ||
5 | BOARDINC = ${CHIBIOS}/os/hal/boards/OLIMEX_LPC-P1227 | ||
6 | |||
7 | # Shared variables | ||
8 | ALLCSRC += $(BOARDSRC) | ||
9 | ALLINC += $(BOARDINC) | ||
diff --git a/lib/chibios/os/hal/boards/OLIMEX_LPC_P1343/board.c b/lib/chibios/os/hal/boards/OLIMEX_LPC_P1343/board.c new file mode 100644 index 000000000..534752001 --- /dev/null +++ b/lib/chibios/os/hal/boards/OLIMEX_LPC_P1343/board.c | |||
@@ -0,0 +1,51 @@ | |||
1 | /* | ||
2 | ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio | ||
3 | |||
4 | Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | you may not use this file except in compliance with the License. | ||
6 | You may obtain a copy of the License at | ||
7 | |||
8 | http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | |||
10 | Unless required by applicable law or agreed to in writing, software | ||
11 | distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | See the License for the specific language governing permissions and | ||
14 | limitations under the License. | ||
15 | */ | ||
16 | |||
17 | #include "hal.h" | ||
18 | |||
19 | /** | ||
20 | * @brief PAL setup. | ||
21 | * @details Digital I/O ports static configuration as defined in @p board.h. | ||
22 | * This variable is used by the HAL when initializing the PAL driver. | ||
23 | */ | ||
24 | #if HAL_USE_PAL || defined(__DOXYGEN__) | ||
25 | const PALConfig pal_default_config = { | ||
26 | {VAL_GPIO0DATA, VAL_GPIO0DIR}, | ||
27 | {VAL_GPIO1DATA, VAL_GPIO1DIR}, | ||
28 | {VAL_GPIO2DATA, VAL_GPIO2DIR}, | ||
29 | {VAL_GPIO3DATA, VAL_GPIO3DIR}, | ||
30 | }; | ||
31 | #endif | ||
32 | |||
33 | /* | ||
34 | * Early initialization code. | ||
35 | * This initialization must be performed just after stack setup and before | ||
36 | * any other initialization. | ||
37 | */ | ||
38 | void __early_init(void) { | ||
39 | |||
40 | LPC13xx_clock_init(); | ||
41 | } | ||
42 | |||
43 | /* | ||
44 | * Board-specific initialization code. | ||
45 | */ | ||
46 | void boardInit(void) { | ||
47 | |||
48 | /* | ||
49 | * Extra, board-specific, initializations. | ||
50 | */ | ||
51 | } | ||
diff --git a/lib/chibios/os/hal/boards/OLIMEX_LPC_P1343/board.h b/lib/chibios/os/hal/boards/OLIMEX_LPC_P1343/board.h new file mode 100644 index 000000000..1eae8715a --- /dev/null +++ b/lib/chibios/os/hal/boards/OLIMEX_LPC_P1343/board.h | |||
@@ -0,0 +1,104 @@ | |||
1 | /* | ||
2 | ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio | ||
3 | |||
4 | Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | you may not use this file except in compliance with the License. | ||
6 | You may obtain a copy of the License at | ||
7 | |||
8 | http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | |||
10 | Unless required by applicable law or agreed to in writing, software | ||
11 | distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | See the License for the specific language governing permissions and | ||
14 | limitations under the License. | ||
15 | */ | ||
16 | |||
17 | #ifndef _BOARD_H_ | ||
18 | #define _BOARD_H_ | ||
19 | |||
20 | /* | ||
21 | * Setup for the Olimex LPC-P1343 proto board. | ||
22 | */ | ||
23 | |||
24 | /* | ||
25 | * Board identifiers. | ||
26 | */ | ||
27 | #define BOARD_OLIMEX_LPC_P1343 | ||
28 | #define BOARD_NAME "Olimex LPC-P1343" | ||
29 | |||
30 | /* | ||
31 | * Board frequencies. | ||
32 | */ | ||
33 | #define SYSOSCCLK 12000000 | ||
34 | |||
35 | /* | ||
36 | * GPIO 0 initial setup. | ||
37 | */ | ||
38 | #define VAL_GPIO0DIR 0x00000000 | ||
39 | #define VAL_GPIO0DATA 0x00000000 | ||
40 | |||
41 | /* | ||
42 | * GPIO 1 initial setup. | ||
43 | */ | ||
44 | #define VAL_GPIO1DIR PAL_PORT_BIT(GPIO1_SW2) | ||
45 | |||
46 | #define VAL_GPIO1DATA PAL_PORT_BIT(GPIO1_SW2) | ||
47 | |||
48 | /* | ||
49 | * GPIO 2 initial setup. | ||
50 | */ | ||
51 | |||
52 | #define VAL_GPIO2DIR PAL_PORT_BIT(GPIO2_SW1) | \ | ||
53 | PAL_PORT_BIT(GPIO2_LED5) | \ | ||
54 | PAL_PORT_BIT(GPIO2_LED6) | \ | ||
55 | PAL_PORT_BIT(GPIO2_LED7) | \ | ||
56 | PAL_PORT_BIT(GPIO2_LED8) | ||
57 | |||
58 | #define VAL_GPIO2DATA PAL_PORT_BIT(GPIO2_LED5) | \ | ||
59 | PAL_PORT_BIT(GPIO2_LED6) | \ | ||
60 | PAL_PORT_BIT(GPIO2_LED7) | \ | ||
61 | PAL_PORT_BIT(GPIO2_LED8) | ||
62 | |||
63 | /* | ||
64 | * GPIO 3 initial setup. | ||
65 | */ | ||
66 | |||
67 | #define VAL_GPIO3DIR PAL_PORT_BIT(GPIO3_LED1) | \ | ||
68 | PAL_PORT_BIT(GPIO3_LED2) | \ | ||
69 | PAL_PORT_BIT(GPIO3_LED3) | \ | ||
70 | PAL_PORT_BIT(GPIO3_LED4) | ||
71 | |||
72 | #define VAL_GPIO3DATA PAL_PORT_BIT(GPIO3_LED1) | \ | ||
73 | PAL_PORT_BIT(GPIO3_LED2) | \ | ||
74 | PAL_PORT_BIT(GPIO3_LED3) | \ | ||
75 | PAL_PORT_BIT(GPIO3_LED4) | ||
76 | |||
77 | /* | ||
78 | * Pin definitions. | ||
79 | */ | ||
80 | #define GPIO1_SW2 4 | ||
81 | #define GPIO1_SPI0SEL 11 | ||
82 | |||
83 | #define GPIO2_SW1 9 | ||
84 | |||
85 | #define GPIO3_LED1 0 | ||
86 | #define GPIO3_LED2 1 | ||
87 | #define GPIO3_LED3 2 | ||
88 | #define GPIO3_LED4 3 | ||
89 | #define GPIO2_LED5 4 | ||
90 | #define GPIO2_LED6 5 | ||
91 | #define GPIO2_LED7 6 | ||
92 | #define GPIO2_LED8 7 | ||
93 | |||
94 | #if !defined(_FROM_ASM_) | ||
95 | #ifdef __cplusplus | ||
96 | extern "C" { | ||
97 | #endif | ||
98 | void boardInit(void); | ||
99 | #ifdef __cplusplus | ||
100 | } | ||
101 | #endif | ||
102 | #endif /* _FROM_ASM_ */ | ||
103 | |||
104 | #endif /* _BOARD_H_ */ | ||
diff --git a/lib/chibios/os/hal/boards/OLIMEX_LPC_P1343/board.mk b/lib/chibios/os/hal/boards/OLIMEX_LPC_P1343/board.mk new file mode 100644 index 000000000..629e92be6 --- /dev/null +++ b/lib/chibios/os/hal/boards/OLIMEX_LPC_P1343/board.mk | |||
@@ -0,0 +1,9 @@ | |||
1 | # List of all the board related files. | ||
2 | BOARDSRC = ${CHIBIOS}/os/hal/boards/OLIMEX_LPC_P1343/board.c | ||
3 | |||
4 | # Required include directories | ||
5 | BOARDINC = ${CHIBIOS}/os/hal/boards/OLIMEX_LPC_P1343 | ||
6 | |||
7 | # Shared variables | ||
8 | ALLCSRC += $(BOARDSRC) | ||
9 | ALLINC += $(BOARDINC) | ||
diff --git a/lib/chibios/os/hal/boards/OLIMEX_LPC_P2148/board.c b/lib/chibios/os/hal/boards/OLIMEX_LPC_P2148/board.c new file mode 100644 index 000000000..5060e41ab --- /dev/null +++ b/lib/chibios/os/hal/boards/OLIMEX_LPC_P2148/board.c | |||
@@ -0,0 +1,94 @@ | |||
1 | /* | ||
2 | ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio | ||
3 | |||
4 | Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | you may not use this file except in compliance with the License. | ||
6 | You may obtain a copy of the License at | ||
7 | |||
8 | http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | |||
10 | Unless required by applicable law or agreed to in writing, software | ||
11 | distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | See the License for the specific language governing permissions and | ||
14 | limitations under the License. | ||
15 | */ | ||
16 | |||
17 | #include "hal.h" | ||
18 | |||
19 | #define VAL_TC0_PRESCALER 0 | ||
20 | |||
21 | /** | ||
22 | * @brief PAL setup. | ||
23 | * @details Digital I/O ports static configuration as defined in @p board.h. | ||
24 | * This variable is used by the HAL when initializing the PAL driver. | ||
25 | */ | ||
26 | #if HAL_USE_PAL || defined(__DOXYGEN__) | ||
27 | const PALConfig pal_default_config = | ||
28 | { | ||
29 | VAL_PINSEL0, | ||
30 | VAL_PINSEL1, | ||
31 | VAL_PINSEL2, | ||
32 | {VAL_FIO0PIN, VAL_FIO0DIR}, | ||
33 | {VAL_FIO1PIN, VAL_FIO1DIR} | ||
34 | }; | ||
35 | #endif | ||
36 | |||
37 | /* | ||
38 | * Timer 0 IRQ handling here. | ||
39 | */ | ||
40 | static CH_IRQ_HANDLER(T0IrqHandler) { | ||
41 | |||
42 | CH_IRQ_PROLOGUE(); | ||
43 | T0IR = 1; /* Clear interrupt on match MR0. */ | ||
44 | |||
45 | chSysLockFromISR(); | ||
46 | chSysTimerHandlerI(); | ||
47 | chSysUnlockFromISR(); | ||
48 | |||
49 | VICVectAddr = 0; | ||
50 | CH_IRQ_EPILOGUE(); | ||
51 | } | ||
52 | |||
53 | /* | ||
54 | * Early initialization code. | ||
55 | * This initialization must be performed just after stack setup and before | ||
56 | * any other initialization. | ||
57 | */ | ||
58 | void __early_init(void) { | ||
59 | |||
60 | lpc214x_clock_init(); | ||
61 | } | ||
62 | |||
63 | #if HAL_USE_MMC_SPI | ||
64 | /* Board-related functions related to the MMC_SPI driver.*/ | ||
65 | bool mmc_lld_is_card_inserted(MMCDriver *mmcp) { | ||
66 | |||
67 | (void)mmcp; | ||
68 | return !palReadPad(IOPORT2, PB_CP1); | ||
69 | } | ||
70 | |||
71 | bool mmc_lld_is_write_protected(MMCDriver *mmcp) { | ||
72 | |||
73 | (void)mmcp; | ||
74 | return palReadPad(IOPORT2, PB_WP1); | ||
75 | } | ||
76 | #endif | ||
77 | |||
78 | /* | ||
79 | * Board-specific initialization code. | ||
80 | */ | ||
81 | void boardInit(void) { | ||
82 | |||
83 | /* | ||
84 | * System Timer initialization, 1ms intervals. | ||
85 | */ | ||
86 | SetVICVector(T0IrqHandler, 0, SOURCE_Timer0); | ||
87 | VICIntEnable = INTMASK(SOURCE_Timer0); | ||
88 | TC *timer = T0Base; | ||
89 | timer->TC_PR = VAL_TC0_PRESCALER; | ||
90 | timer->TC_MR0 = (PCLK / CH_CFG_ST_FREQUENCY) / (VAL_TC0_PRESCALER + 1); | ||
91 | timer->TC_MCR = 3; /* Interrupt and clear TC on match MR0. */ | ||
92 | timer->TC_TCR = 2; /* Reset counter and prescaler. */ | ||
93 | timer->TC_TCR = 1; /* Timer enabled. */ | ||
94 | } | ||
diff --git a/lib/chibios/os/hal/boards/OLIMEX_LPC_P2148/board.h b/lib/chibios/os/hal/boards/OLIMEX_LPC_P2148/board.h new file mode 100644 index 000000000..3fe3f4d1d --- /dev/null +++ b/lib/chibios/os/hal/boards/OLIMEX_LPC_P2148/board.h | |||
@@ -0,0 +1,92 @@ | |||
1 | /* | ||
2 | ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio | ||
3 | |||
4 | Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | you may not use this file except in compliance with the License. | ||
6 | You may obtain a copy of the License at | ||
7 | |||
8 | http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | |||
10 | Unless required by applicable law or agreed to in writing, software | ||
11 | distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | See the License for the specific language governing permissions and | ||
14 | limitations under the License. | ||
15 | */ | ||
16 | |||
17 | #ifndef _BOARD_H_ | ||
18 | #define _BOARD_H_ | ||
19 | |||
20 | /* | ||
21 | * Setup for the Olimex LPC-P2148 proto board. | ||
22 | */ | ||
23 | |||
24 | /* | ||
25 | * Board identifier. | ||
26 | */ | ||
27 | #define BOARD_OLIMEX_LPC_P2148 | ||
28 | #define BOARD_NAME "Olimex LPC-P2148" | ||
29 | |||
30 | /* | ||
31 | * The following values are implementation dependent. You may change them in | ||
32 | * order to match your HW. | ||
33 | */ | ||
34 | #define FOSC 12000000 | ||
35 | #define CCLK 48000000 | ||
36 | #define PCLK 12000000 | ||
37 | |||
38 | /* | ||
39 | * Pins configuration for Olimex LPC-P2148. | ||
40 | * | ||
41 | * PINSEL0 | ||
42 | * P0 P0 P0 P0 P0 P0 RXD TXD SSE MOS MIS SCK SDA SCL RXD TXD | ||
43 | * 15 14 13 12 11 10 1 1 L0 I0 O0 0 0 0 0 0 | ||
44 | * 00 00 00 00 00 00 01 01 01 01 01 01 01 01 01 01 | ||
45 | * FIO0DIR (15...0) | ||
46 | * IN IN OUT OUT OUT OUT -- -- -- -- -- -- -- -- -- -- | ||
47 | * 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 | ||
48 | * | ||
49 | * PINSEL1 | ||
50 | * P0 AD P0 P0 -- -- AO -- VB P0 P0 P0 MOS MIS SCK P0 | ||
51 | * 31 03 29 28 -- -- UT -- US 22 21 20 I1 O1 1 16 | ||
52 | * 00 01 00 00 00 00 10 00 01 00 00 00 10 10 10 00 | ||
53 | * FIO0DIR (31...16) | ||
54 | * OUT -- OUT OUT -- -- -- -- -- OUT OUT OUT -- -- -- IN | ||
55 | * 1 0 1 1 0 0 0 0 0 1 1 1 0 0 0 0 | ||
56 | * | ||
57 | * FIO1DIR (31...16) | ||
58 | * -- -- -- -- -- IN IN OUT OUT OUT OUT OUT OUT OUT OUT OUT | ||
59 | * 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 | ||
60 | */ | ||
61 | #define VAL_PINSEL0 0x00055555 | ||
62 | #define VAL_PINSEL1 0x100840A8 | ||
63 | #define VAL_PINSEL2 0x00000004 /* Do not modify */ | ||
64 | #define VAL_FIO0DIR 0xB0703C00 | ||
65 | #define VAL_FIO1DIR 0x01FF0000 | ||
66 | #define VAL_FIO0PIN 0xFFFFFFFF | ||
67 | #define VAL_FIO1PIN 0xFFFFFFFF | ||
68 | |||
69 | #define PA_LED1 10 | ||
70 | #define PA_LED2 11 | ||
71 | #define PA_BUZZ1 12 | ||
72 | #define PA_BUZZ2 13 | ||
73 | #define PA_BSL 14 | ||
74 | #define PA_BUTTON1 15 | ||
75 | #define PA_BUTTON2 16 | ||
76 | #define PA_SSEL1 20 | ||
77 | #define PA_LEDUSB 31 | ||
78 | |||
79 | #define PB_WP1 24 | ||
80 | #define PB_CP1 25 | ||
81 | |||
82 | #if !defined(_FROM_ASM_) | ||
83 | #ifdef __cplusplus | ||
84 | extern "C" { | ||
85 | #endif | ||
86 | void boardInit(void); | ||
87 | #ifdef __cplusplus | ||
88 | } | ||
89 | #endif | ||
90 | #endif /* _FROM_ASM_ */ | ||
91 | |||
92 | #endif /* _BOARD_H_ */ | ||
diff --git a/lib/chibios/os/hal/boards/OLIMEX_LPC_P2148/board.mk b/lib/chibios/os/hal/boards/OLIMEX_LPC_P2148/board.mk new file mode 100644 index 000000000..4ac25257e --- /dev/null +++ b/lib/chibios/os/hal/boards/OLIMEX_LPC_P2148/board.mk | |||
@@ -0,0 +1,9 @@ | |||
1 | # List of all the mandatory board related files. | ||
2 | BOARDSRC = ${CHIBIOS}/os/hal/boards/OLIMEX_LPC_P2148/board.c | ||
3 | |||
4 | # Required include directories | ||
5 | BOARDINC = ${CHIBIOS}/os/hal/boards/OLIMEX_LPC_P2148 | ||
6 | |||
7 | # Shared variables | ||
8 | ALLCSRC += $(BOARDSRC) | ||
9 | ALLINC += $(BOARDINC) | ||
diff --git a/lib/chibios/os/hal/boards/OLIMEX_LPC_P2148/buzzer.c b/lib/chibios/os/hal/boards/OLIMEX_LPC_P2148/buzzer.c new file mode 100644 index 000000000..165bd7a1e --- /dev/null +++ b/lib/chibios/os/hal/boards/OLIMEX_LPC_P2148/buzzer.c | |||
@@ -0,0 +1,110 @@ | |||
1 | /* | ||
2 | ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio | ||
3 | |||
4 | Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | you may not use this file except in compliance with the License. | ||
6 | You may obtain a copy of the License at | ||
7 | |||
8 | http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | |||
10 | Unless required by applicable law or agreed to in writing, software | ||
11 | distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | See the License for the specific language governing permissions and | ||
14 | limitations under the License. | ||
15 | */ | ||
16 | |||
17 | /* | ||
18 | * Buzzer driver for Olimex LPC-P2148. | ||
19 | * Uses the timer 1 for wave generation and a Virtual Timer for the sound | ||
20 | * duration. | ||
21 | * The driver also generates an event when the sound is done and the buzzer | ||
22 | * goes silent. | ||
23 | */ | ||
24 | |||
25 | #include "hal.h" | ||
26 | |||
27 | #include "buzzer.h" | ||
28 | |||
29 | EventSource BuzzerSilentEventSource; | ||
30 | |||
31 | #define StartCounter(t) ((t)->TC_EMR = 0xF1, (t)->TC_TCR = 1) | ||
32 | #define StopCounter(t) ((t)->TC_EMR = 0, (t)->TC_TCR = 2) | ||
33 | |||
34 | /** | ||
35 | * @brief Buzzer driver initialization. | ||
36 | */ | ||
37 | void buzzInit(void) { | ||
38 | |||
39 | chEvtInit(&BuzzerSilentEventSource); | ||
40 | |||
41 | /* | ||
42 | * Switches P0.12 and P0.13 to MAT1.0 and MAT1.1 functions. | ||
43 | * Enables Timer1 clock. | ||
44 | */ | ||
45 | PINSEL0 &= 0xF0FFFFFF; | ||
46 | PINSEL0 |= 0x0A000000; | ||
47 | PCONP = (PCONP & PCALL) | PCTIM1; | ||
48 | |||
49 | /* | ||
50 | * Timer setup. | ||
51 | */ | ||
52 | TC *tc = T1Base; | ||
53 | StopCounter(tc); | ||
54 | tc->TC_CTCR = 0; /* Clock source is PCLK. */ | ||
55 | tc->TC_PR = 0; /* Prescaler disabled. */ | ||
56 | tc->TC_MCR = 2; /* Clear TC on match MR0. */ | ||
57 | } | ||
58 | |||
59 | /** | ||
60 | * @brief Stops the sound. | ||
61 | * | ||
62 | * @param[in] p pointer to the timer | ||
63 | */ | ||
64 | static void stop(void *p) { | ||
65 | |||
66 | StopCounter((TC *)p); | ||
67 | chSysLockFromIsr(); | ||
68 | chEvtBroadcastI(&BuzzerSilentEventSource); | ||
69 | chSysUnlockFromIsr(); | ||
70 | } | ||
71 | |||
72 | /** | ||
73 | * @brief Plays a tone asynchronously. | ||
74 | * | ||
75 | * @param[in] freq approximated tone frequency | ||
76 | * @param[in] duration tone duration in systicks | ||
77 | */ | ||
78 | void buzzPlay(uint32_t freq, systime_t duration) { | ||
79 | static VirtualTimer bvt; | ||
80 | TC *tc = T1Base; | ||
81 | |||
82 | chSysLock(); | ||
83 | |||
84 | if (chVTIsArmedI(&bvt)) { /* If a sound is already being */ | ||
85 | chVTResetI(&bvt); /* played then aborts it. */ | ||
86 | StopCounter(tc); | ||
87 | } | ||
88 | |||
89 | tc->TC_MR0 = tc->TC_MR1 = (PCLK / (freq * 2)); | ||
90 | StartCounter(tc); | ||
91 | chVTSetI(&bvt, duration, stop, tc); | ||
92 | |||
93 | chSysUnlock(); | ||
94 | } | ||
95 | |||
96 | /** | ||
97 | * @brief Plays a tone. | ||
98 | * | ||
99 | * @param[in] freq approximated tone frequency | ||
100 | * @param[in] duration tone duration in systicks | ||
101 | */ | ||
102 | void buzzPlayWait(uint32_t freq, systime_t duration) { | ||
103 | TC *tc = T1Base; | ||
104 | |||
105 | StopCounter(tc); | ||
106 | tc->TC_MR0 = tc->TC_MR1 = (PCLK / (freq * 2)); | ||
107 | StartCounter(tc); | ||
108 | chThdSleep(duration); | ||
109 | StopCounter(tc); | ||
110 | } | ||
diff --git a/lib/chibios/os/hal/boards/OLIMEX_LPC_P2148/buzzer.h b/lib/chibios/os/hal/boards/OLIMEX_LPC_P2148/buzzer.h new file mode 100644 index 000000000..998d31feb --- /dev/null +++ b/lib/chibios/os/hal/boards/OLIMEX_LPC_P2148/buzzer.h | |||
@@ -0,0 +1,32 @@ | |||
1 | /* | ||
2 | ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio | ||
3 | |||
4 | Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | you may not use this file except in compliance with the License. | ||
6 | You may obtain a copy of the License at | ||
7 | |||
8 | http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | |||
10 | Unless required by applicable law or agreed to in writing, software | ||
11 | distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | See the License for the specific language governing permissions and | ||
14 | limitations under the License. | ||
15 | */ | ||
16 | |||
17 | #ifndef _BUZZER_H_ | ||
18 | #define _BUZZER_H_ | ||
19 | |||
20 | #ifdef __cplusplus | ||
21 | extern "C" { | ||
22 | #endif | ||
23 | void buzzInit(void); | ||
24 | void buzzPlay(uint32_t freq, systime_t duration); | ||
25 | void buzzPlayWait(uint32_t freq, systime_t duration); | ||
26 | #ifdef __cplusplus | ||
27 | } | ||
28 | #endif | ||
29 | |||
30 | extern EventSource BuzzerSilentEventSource; | ||
31 | |||
32 | #endif /* _BUZZER_H_ */ | ||
diff --git a/lib/chibios/os/hal/boards/OLIMEX_MSP430_P1611/board.c b/lib/chibios/os/hal/boards/OLIMEX_MSP430_P1611/board.c new file mode 100644 index 000000000..aeb937762 --- /dev/null +++ b/lib/chibios/os/hal/boards/OLIMEX_MSP430_P1611/board.c | |||
@@ -0,0 +1,79 @@ | |||
1 | /* | ||
2 | ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio | ||
3 | |||
4 | Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | you may not use this file except in compliance with the License. | ||
6 | You may obtain a copy of the License at | ||
7 | |||
8 | http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | |||
10 | Unless required by applicable law or agreed to in writing, software | ||
11 | distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | See the License for the specific language governing permissions and | ||
14 | limitations under the License. | ||
15 | */ | ||
16 | |||
17 | #include "hal.h" | ||
18 | |||
19 | /** | ||
20 | * @brief PAL setup. | ||
21 | * @details Digital I/O ports static configuration as defined in @p board.h. | ||
22 | * This variable is used by the HAL when initializing the PAL driver. | ||
23 | */ | ||
24 | #if HAL_USE_PAL || defined(__DOXYGEN__) | ||
25 | const PALConfig pal_default_config = | ||
26 | { | ||
27 | #if defined(__MSP430_HAS_PORT1__) || defined(__MSP430_HAS_PORT1_R__) | ||
28 | {VAL_P1OUT, VAL_P1DIR}, | ||
29 | #endif | ||
30 | #if defined(__MSP430_HAS_PORT2__) || defined(__MSP430_HAS_PORT2_R__) | ||
31 | {VAL_P2OUT, VAL_P2DIR}, | ||
32 | #endif | ||
33 | #if defined(__MSP430_HAS_PORT3__) || defined(__MSP430_HAS_PORT3_R__) | ||
34 | {VAL_P3OUT, VAL_P3DIR}, | ||
35 | #endif | ||
36 | #if defined(__MSP430_HAS_PORT4__) || defined(__MSP430_HAS_PORT4_R__) | ||
37 | {VAL_P4OUT, VAL_P4DIR}, | ||
38 | #endif | ||
39 | #if defined(__MSP430_HAS_PORT5__) || defined(__MSP430_HAS_PORT5_R__) | ||
40 | {VAL_P5OUT, VAL_P5DIR}, | ||
41 | #endif | ||
42 | #if defined(__MSP430_HAS_PORT6__) || defined(__MSP430_HAS_PORT6_R__) | ||
43 | {VAL_P6OUT, VAL_P6DIR}, | ||
44 | #endif | ||
45 | }; | ||
46 | #endif | ||
47 | |||
48 | CH_IRQ_HANDLER(TIMERA0) { | ||
49 | |||
50 | CH_IRQ_PROLOGUE(); | ||
51 | |||
52 | chSysLockFromIsr(); | ||
53 | chSysTimerHandlerI(); | ||
54 | chSysUnlockFromIsr(); | ||
55 | |||
56 | CH_IRQ_EPILOGUE(); | ||
57 | } | ||
58 | |||
59 | /* | ||
60 | * Board-specific initialization code. | ||
61 | */ | ||
62 | void boardInit(void) { | ||
63 | |||
64 | #if USE_MSP430_USART0 | ||
65 | P3SEL |= (1 << 4) | (1 << 5); | ||
66 | #endif | ||
67 | |||
68 | #if USE_MSP430_USART1 | ||
69 | P3SEL |= (1 << 6) | (1 << 7); | ||
70 | #endif | ||
71 | |||
72 | /* | ||
73 | * Timer 0 setup, uses SMCLK as source. | ||
74 | */ | ||
75 | TACCR0 = SMCLK / 4 / CH_FREQUENCY - 1;/* Counter limit. */ | ||
76 | TACTL = TACLR; /* Clean start. */ | ||
77 | TACTL = TASSEL_2 | ID_2 | MC_1; /* Src=SMCLK, ID=4, cmp=TACCR0. */ | ||
78 | TACCTL0 = CCIE; /* Interrupt on compare. */ | ||
79 | } | ||
diff --git a/lib/chibios/os/hal/boards/OLIMEX_MSP430_P1611/board.h b/lib/chibios/os/hal/boards/OLIMEX_MSP430_P1611/board.h new file mode 100644 index 000000000..44a37d928 --- /dev/null +++ b/lib/chibios/os/hal/boards/OLIMEX_MSP430_P1611/board.h | |||
@@ -0,0 +1,80 @@ | |||
1 | /* | ||
2 | ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio | ||
3 | |||
4 | Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | you may not use this file except in compliance with the License. | ||
6 | You may obtain a copy of the License at | ||
7 | |||
8 | http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | |||
10 | Unless required by applicable law or agreed to in writing, software | ||
11 | distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | See the License for the specific language governing permissions and | ||
14 | limitations under the License. | ||
15 | */ | ||
16 | |||
17 | #ifndef _BOARD_H_ | ||
18 | #define _BOARD_H_ | ||
19 | |||
20 | /* | ||
21 | * Setup for the Olimex MSP430-P1611 proto board. | ||
22 | */ | ||
23 | |||
24 | /* | ||
25 | * Board identifier. | ||
26 | */ | ||
27 | #define BOARD_OLIMEX_MSP430_P1611 | ||
28 | #define BOARD_NAME "Olimex MSP430-P1611" | ||
29 | |||
30 | /* | ||
31 | * Clock constants. | ||
32 | */ | ||
33 | #define LFXT1CLK 32768 | ||
34 | #define XT2CLK 8000000 | ||
35 | #define DCOCLK 750000 | ||
36 | |||
37 | /* | ||
38 | * Pin definitions for the Olimex MSP430-P1611 board. | ||
39 | */ | ||
40 | #define P3_O_TXD0 4 | ||
41 | #define P3_O_TXD0_MASK (1 << P3_O_TXD0) | ||
42 | #define P3_I_RXD0 5 | ||
43 | #define P3_I_RXD0_MASK (1 << P3_I_RXD0) | ||
44 | #define P6_O_LED 0 | ||
45 | #define P6_O_LED_MASK (1 << P6_O_LED) | ||
46 | #define P6_I_BUTTON 1 | ||
47 | #define P6_I_BUTTON_MASK (1 << P6_I_BUTTON) | ||
48 | |||
49 | /* | ||
50 | * Initial I/O ports settings. | ||
51 | */ | ||
52 | #define VAL_P1OUT 0x00 | ||
53 | #define VAL_P1DIR 0xFF | ||
54 | |||
55 | #define VAL_P2OUT 0x00 | ||
56 | #define VAL_P2DIR 0xFF | ||
57 | |||
58 | #define VAL_P3OUT P3_O_TXD0_MASK | ||
59 | #define VAL_P3DIR ~P3_I_RXD0_MASK | ||
60 | |||
61 | #define VAL_P4OUT 0x00 | ||
62 | #define VAL_P4DIR 0xFF | ||
63 | |||
64 | #define VAL_P5OUT 0x00 | ||
65 | #define VAL_P5DIR 0xFF | ||
66 | |||
67 | #define VAL_P6OUT P6_O_LED_MASK | ||
68 | #define VAL_P6DIR ~P6_I_BUTTON_MASK | ||
69 | |||
70 | #if !defined(_FROM_ASM_) | ||
71 | #ifdef __cplusplus | ||
72 | extern "C" { | ||
73 | #endif | ||
74 | void boardInit(void); | ||
75 | #ifdef __cplusplus | ||
76 | } | ||
77 | #endif | ||
78 | #endif /* _FROM_ASM_ */ | ||
79 | |||
80 | #endif /* _BOARD_H_ */ | ||
diff --git a/lib/chibios/os/hal/boards/OLIMEX_MSP430_P1611/board.mk b/lib/chibios/os/hal/boards/OLIMEX_MSP430_P1611/board.mk new file mode 100644 index 000000000..df191c076 --- /dev/null +++ b/lib/chibios/os/hal/boards/OLIMEX_MSP430_P1611/board.mk | |||
@@ -0,0 +1,9 @@ | |||
1 | # List of all the board related files. | ||
2 | BOARDSRC = ${CHIBIOS}/os/hal/boards/OLIMEX_MSP430_P1611/board.c | ||
3 | |||
4 | # Required include directories | ||
5 | BOARDINC = ${CHIBIOS}/os/hal/boards/OLIMEX_MSP430_P1611 | ||
6 | |||
7 | # Shared variables | ||
8 | ALLCSRC += $(BOARDSRC) | ||
9 | ALLINC += $(BOARDINC) | ||
diff --git a/lib/chibios/os/hal/boards/OLIMEX_SAM7_EX256/board.c b/lib/chibios/os/hal/boards/OLIMEX_SAM7_EX256/board.c new file mode 100644 index 000000000..21ca13149 --- /dev/null +++ b/lib/chibios/os/hal/boards/OLIMEX_SAM7_EX256/board.c | |||
@@ -0,0 +1,136 @@ | |||
1 | /* | ||
2 | ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio | ||
3 | |||
4 | Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | you may not use this file except in compliance with the License. | ||
6 | You may obtain a copy of the License at | ||
7 | |||
8 | http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | |||
10 | Unless required by applicable law or agreed to in writing, software | ||
11 | distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | See the License for the specific language governing permissions and | ||
14 | limitations under the License. | ||
15 | */ | ||
16 | |||
17 | #include "hal.h" | ||
18 | |||
19 | /** | ||
20 | * @brief PAL setup. | ||
21 | * @details Digital I/O ports static configuration as defined in @p board.h. | ||
22 | * This variable is used by the HAL when initializing the PAL driver. | ||
23 | */ | ||
24 | #if HAL_USE_PAL || defined(__DOXYGEN__) | ||
25 | const PALConfig pal_default_config = | ||
26 | { | ||
27 | {VAL_PIOA_ODSR, VAL_PIOA_OSR, VAL_PIOA_PUSR}, | ||
28 | #if (SAM7_PLATFORM == SAM7X128) || (SAM7_PLATFORM == SAM7X256) || \ | ||
29 | (SAM7_PLATFORM == SAM7X512) || (SAM7_PLATFORM == SAM7A3) | ||
30 | {VAL_PIOB_ODSR, VAL_PIOB_OSR, VAL_PIOB_PUSR} | ||
31 | #endif | ||
32 | }; | ||
33 | #endif | ||
34 | |||
35 | /* | ||
36 | * SYS IRQ handling here. | ||
37 | */ | ||
38 | static CH_IRQ_HANDLER(SYSIrqHandler) { | ||
39 | |||
40 | CH_IRQ_PROLOGUE(); | ||
41 | |||
42 | if (AT91C_BASE_PITC->PITC_PISR & AT91C_PITC_PITS) { | ||
43 | (void) AT91C_BASE_PITC->PITC_PIVR; | ||
44 | chSysLockFromIsr(); | ||
45 | chSysTimerHandlerI(); | ||
46 | chSysUnlockFromIsr(); | ||
47 | } | ||
48 | |||
49 | #if USE_SAM7_DBGU_UART | ||
50 | if (AT91C_BASE_DBGU->DBGU_CSR & | ||
51 | (AT91C_US_RXRDY | AT91C_US_TXRDY | AT91C_US_PARE | AT91C_US_FRAME | | ||
52 | AT91C_US_OVRE | AT91C_US_RXBRK)) { | ||
53 | sd_lld_serve_interrupt(&SDDBG); | ||
54 | } | ||
55 | #endif | ||
56 | AT91C_BASE_AIC->AIC_EOICR = 0; | ||
57 | CH_IRQ_EPILOGUE(); | ||
58 | } | ||
59 | |||
60 | /* | ||
61 | * Early initialization code. | ||
62 | * This initialization must be performed just after stack setup and before | ||
63 | * any other initialization. | ||
64 | */ | ||
65 | void __early_init(void) { | ||
66 | |||
67 | /* Watchdog disabled.*/ | ||
68 | AT91C_BASE_WDTC->WDTC_WDMR = AT91C_WDTC_WDDIS; | ||
69 | |||
70 | at91sam7_clock_init(); | ||
71 | } | ||
72 | |||
73 | #if HAL_USE_MMC_SPI | ||
74 | /* Board-related functions related to the MMC_SPI driver.*/ | ||
75 | bool mmc_lld_is_card_inserted(MMCDriver *mmcp) { | ||
76 | |||
77 | (void)mmcp; | ||
78 | return !palReadPad(IOPORT2, PIOB_MMC_CP); | ||
79 | } | ||
80 | |||
81 | bool mmc_lld_is_write_protected(MMCDriver *mmcp) { | ||
82 | |||
83 | (void)mmcp; | ||
84 | return palReadPad(IOPORT2, PIOB_MMC_WP); | ||
85 | } | ||
86 | #endif | ||
87 | |||
88 | /* | ||
89 | * Board-specific initialization code. | ||
90 | */ | ||
91 | void boardInit(void) { | ||
92 | |||
93 | /* | ||
94 | * LCD pins setup. | ||
95 | */ | ||
96 | palClearPad(IOPORT2, PIOB_LCD_BL); | ||
97 | palSetPadMode(IOPORT2, PIOB_LCD_BL, PAL_MODE_OUTPUT_PUSHPULL); | ||
98 | |||
99 | palSetPad(IOPORT1, PIOA_LCD_RESET); | ||
100 | palSetPadMode(IOPORT1, PIOA_LCD_RESET, PAL_MODE_OUTPUT_PUSHPULL); | ||
101 | |||
102 | /* | ||
103 | * Joystick and buttons setup. | ||
104 | */ | ||
105 | palSetGroupMode(IOPORT1, | ||
106 | PIOA_B1_MASK | PIOA_B2_MASK | PIOA_B3_MASK | | ||
107 | PIOA_B4_MASK | PIOA_B5_MASK, | ||
108 | 0, | ||
109 | PAL_MODE_INPUT); | ||
110 | palSetGroupMode(IOPORT2, PIOB_SW1_MASK | PIOB_SW2_MASK, 0, PAL_MODE_INPUT); | ||
111 | |||
112 | /* | ||
113 | * MMC/SD slot setup. | ||
114 | */ | ||
115 | palSetGroupMode(IOPORT2, | ||
116 | PIOB_MMC_WP_MASK | PIOB_MMC_CP_MASK, | ||
117 | 0, | ||
118 | PAL_MODE_INPUT); | ||
119 | |||
120 | /* | ||
121 | * PIT Initialization. | ||
122 | */ | ||
123 | AIC_ConfigureIT(AT91C_ID_SYS, | ||
124 | AT91C_AIC_SRCTYPE_HIGH_LEVEL | (AT91C_AIC_PRIOR_HIGHEST - 1), | ||
125 | SYSIrqHandler); | ||
126 | AIC_EnableIT(AT91C_ID_SYS); | ||
127 | AT91C_BASE_PITC->PITC_PIMR = (MCK / 16 / CH_FREQUENCY) - 1; | ||
128 | AT91C_BASE_PITC->PITC_PIMR |= AT91C_PITC_PITEN | AT91C_PITC_PITIEN; | ||
129 | |||
130 | /* | ||
131 | * RTS/CTS pins enabled for USART0 only. | ||
132 | */ | ||
133 | AT91C_BASE_PIOA->PIO_PDR = AT91C_PA3_RTS0 | AT91C_PA4_CTS0; | ||
134 | AT91C_BASE_PIOA->PIO_ASR = AT91C_PIO_PA3 | AT91C_PIO_PA4; | ||
135 | AT91C_BASE_PIOA->PIO_PPUDR = AT91C_PIO_PA3 | AT91C_PIO_PA4; | ||
136 | } | ||
diff --git a/lib/chibios/os/hal/boards/OLIMEX_SAM7_EX256/board.h b/lib/chibios/os/hal/boards/OLIMEX_SAM7_EX256/board.h |