amiro-os / modules / LightRing_1-0 / board.h @ 1bb524af
History | View | Annotate | Download (39.365 KB)
1 |
/*
|
---|---|
2 |
AMiRo-OS is an operating system designed for the Autonomous Mini Robot (AMiRo) platform.
|
3 |
Copyright (C) 2016..2018 Thomas Schöpping et al.
|
4 |
|
5 |
This program is free software: you can redistribute it and/or modify
|
6 |
it under the terms of the GNU General Public License as published by
|
7 |
the Free Software Foundation, either version 3 of the License, or
|
8 |
(at your option) any later version.
|
9 |
|
10 |
This program is distributed in the hope that it will be useful,
|
11 |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
GNU General Public License for more details.
|
14 |
|
15 |
You should have received a copy of the GNU General Public License
|
16 |
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17 |
*/
|
18 |
|
19 |
#ifndef _BOARD_H_
|
20 |
#define _BOARD_H_
|
21 |
|
22 |
/*
|
23 |
* Setup for AMiRo LightRing v1.0 board.
|
24 |
*/
|
25 |
|
26 |
/*
|
27 |
* Board identifier.
|
28 |
*/
|
29 |
#define BOARD_LIGHTRING
|
30 |
#define BOARD_NAME "AMiRo LightRing" |
31 |
#define BOARD_VERSION "1.0" |
32 |
|
33 |
/*
|
34 |
* Board oscillators-related settings.
|
35 |
* NOTE: LSE not fitted.
|
36 |
*/
|
37 |
#if !defined(STM32_LSECLK)
|
38 |
#define STM32_LSECLK 0U |
39 |
#endif
|
40 |
|
41 |
#if !defined(STM32_HSECLK)
|
42 |
#define STM32_HSECLK 8000000U |
43 |
#endif
|
44 |
|
45 |
/*
|
46 |
* Board voltages.
|
47 |
* Required for performance limits calculation.
|
48 |
*/
|
49 |
#define STM32_VDD 330U |
50 |
|
51 |
/*
|
52 |
* MCU type as defined in the ST header.
|
53 |
*/
|
54 |
#define STM32F103xE
|
55 |
|
56 |
/*
|
57 |
* IO pins assignments.
|
58 |
*/
|
59 |
#define GPIOA_PIN0 0U |
60 |
#define GPIOA_PIN1 1U |
61 |
#define GPIOA_LASER_RX 2U |
62 |
#define GPIOA_LASER_TX 3U |
63 |
#define GPIOA_LIGHT_BLANK 4U |
64 |
#define GPIOA_LIGHT_SCLK 5U |
65 |
#define GPIOA_PIN6 6U |
66 |
#define GPIOA_LIGHT_MOSI 7U |
67 |
#define GPIOA_PIN8 8U |
68 |
#define GPIOA_PROG_RX 9U |
69 |
#define GPIOA_PROG_TX 10U |
70 |
#define GPIOA_CAN_RX 11U |
71 |
#define GPIOA_CAN_TX 12U |
72 |
#define GPIOA_SWDIO 13U |
73 |
#define GPIOA_SWCLK 14U |
74 |
#define GPIOA_PIN15 15U |
75 |
|
76 |
#define GPIOB_PIN0 0U |
77 |
#define GPIOB_PIN1 1U |
78 |
#define GPIOB_LASER_EN 2U |
79 |
#define GPIOB_PIN3 3U |
80 |
#define GPIOB_PIN4 4U |
81 |
#define GPIOB_LASER_OC_N 5U |
82 |
#define GPIOB_SYS_UART_DN 6U |
83 |
#define GPIOB_PIN7 7U |
84 |
#define GPIOB_WL_GDO2 8U |
85 |
#define GPIOB_WL_GDO0 9U |
86 |
#define GPIOB_MEM_SCL 10U |
87 |
#define GPIOB_MEM_SDA 11U |
88 |
#define GPIOB_WL_SS_N 12U |
89 |
#define GPIOB_WL_SCLK 13U |
90 |
#define GPIOB_WL_MISO 14U |
91 |
#define GPIOB_WL_MOSI 15U |
92 |
|
93 |
#define GPIOC_PIN0 0U |
94 |
#define GPIOC_PIN1 1U |
95 |
#define GPIOC_PIN2 2U |
96 |
#define GPIOC_PIN3 3U |
97 |
#define GPIOC_LIGHT_XLAT 4U |
98 |
#define GPIOC_PIN5 5U |
99 |
#define GPIOC_PIN6 6U |
100 |
#define GPIOC_PIN7 7U |
101 |
#define GPIOC_PIN8 8U |
102 |
#define GPIOC_PIN9 9U |
103 |
#define GPIOC_SYS_UART_RX 10U |
104 |
#define GPIOC_SYS_UART_TX 11U |
105 |
#define GPIOC_PIN12 12U |
106 |
#define GPIOC_PIN13 13U |
107 |
#define GPIOC_SYS_PD_N 14U |
108 |
#define GPIOC_PIN15 15U |
109 |
|
110 |
#define GPIOD_OSC_IN 0U |
111 |
#define GPIOD_OSC_OUT 1U |
112 |
#define GPIOD_SYS_INT_N 2U |
113 |
#define GPIOD_PIN3 3U |
114 |
#define GPIOD_PIN4 4U |
115 |
#define GPIOD_PIN5 5U |
116 |
#define GPIOD_PIN6 6U |
117 |
#define GPIOD_PIN7 7U |
118 |
#define GPIOD_PIN8 8U |
119 |
#define GPIOD_PIN9 9U |
120 |
#define GPIOD_PIN10 10U |
121 |
#define GPIOD_PIN11 11U |
122 |
#define GPIOD_PIN12 12U |
123 |
#define GPIOD_PIN13 13U |
124 |
#define GPIOD_PIN14 14U |
125 |
#define GPIOD_PIN15 15U |
126 |
|
127 |
#define GPIOE_PIN0 0U |
128 |
#define GPIOE_PIN1 1U |
129 |
#define GPIOE_PIN2 2U |
130 |
#define GPIOE_PIN3 3U |
131 |
#define GPIOE_PIN4 4U |
132 |
#define GPIOE_PIN5 5U |
133 |
#define GPIOE_PIN6 6U |
134 |
#define GPIOE_PIN7 7U |
135 |
#define GPIOE_PIN8 8U |
136 |
#define GPIOE_PIN9 9U |
137 |
#define GPIOE_PIN10 10U |
138 |
#define GPIOE_PIN11 11U |
139 |
#define GPIOE_PIN12 12U |
140 |
#define GPIOE_PIN13 13U |
141 |
#define GPIOE_PIN14 14U |
142 |
#define GPIOE_PIN15 15U |
143 |
|
144 |
#define GPIOF_PIN0 0U |
145 |
#define GPIOF_PIN1 1U |
146 |
#define GPIOF_PIN2 2U |
147 |
#define GPIOF_PIN3 3U |
148 |
#define GPIOF_PIN4 4U |
149 |
#define GPIOF_PIN5 5U |
150 |
#define GPIOF_PIN6 6U |
151 |
#define GPIOF_PIN7 7U |
152 |
#define GPIOF_PIN8 8U |
153 |
#define GPIOF_PIN9 9U |
154 |
#define GPIOF_PIN10 10U |
155 |
#define GPIOF_PIN11 11U |
156 |
#define GPIOF_PIN12 12U |
157 |
#define GPIOF_PIN13 13U |
158 |
#define GPIOF_PIN14 14U |
159 |
#define GPIOF_PIN15 15U |
160 |
|
161 |
#define GPIOG_PIN0 0U |
162 |
#define GPIOG_PIN1 1U |
163 |
#define GPIOG_PIN2 2U |
164 |
#define GPIOG_PIN3 3U |
165 |
#define GPIOG_PIN4 4U |
166 |
#define GPIOG_PIN5 5U |
167 |
#define GPIOG_PIN6 6U |
168 |
#define GPIOG_PIN7 7U |
169 |
#define GPIOG_PIN8 8U |
170 |
#define GPIOG_PIN9 9U |
171 |
#define GPIOG_PIN10 10U |
172 |
#define GPIOG_PIN11 11U |
173 |
#define GPIOG_PIN12 12U |
174 |
#define GPIOG_PIN13 13U |
175 |
#define GPIOG_PIN14 14U |
176 |
#define GPIOG_PIN15 15U |
177 |
|
178 |
/*
|
179 |
* IO lines assignments.
|
180 |
*/
|
181 |
#define LINE_LASER_RX PAL_LINE(GPIOA, GPIOA_LASER_RX)
|
182 |
#define LINE_LASER_TX PAL_LINE(GPIOA, GPIOA_LASER_TX)
|
183 |
#define LINE_LIGHT_BLANK PAL_LINE(GPIOA, GPIOA_LIGHT_BLANK)
|
184 |
#define LINE_LIGHT_SCLK PAL_LINE(GPIOA, GPIOA_LIGHT_SCLK)
|
185 |
#define LINE_LIGHT_MOSI PAL_LINE(GPIOA, GPIOA_LIGHT_MOSI)
|
186 |
#define LINE_PROG_RX PAL_LINE(GPIOA, GPIOA_PROG_RX)
|
187 |
#define LINE_PROG_TX PAL_LINE(GPIOA, GPIOA_PROG_TX)
|
188 |
#define LINE_CAN_RX PAL_LINE(GPIOA, GPIOA_CAN_RX)
|
189 |
#define LINE_CAN_TX PAL_LINE(GPIOA, GPIOA_CAN_TX)
|
190 |
#define LINE_SWDIO PAL_LINE(GPIOA, GPIOA_SWDIO)
|
191 |
#define LINE_SWCLK PAL_LINE(GPIOA, GPIOA_SWCLK)
|
192 |
|
193 |
#define LINE_LASER_EN PAL_LINE(GPIOB, GPIOB_LASER_EN)
|
194 |
#define LINE_LASER_OC_N PAL_LINE(GPIOB, GPIOB_LASER_OC_N)
|
195 |
#define LINE_SYS_UART_DN PAL_LINE(GPIOB, GPIOB_SYS_UART_DN)
|
196 |
#define LINE_WL_GDO2 PAL_LINE(GPIOB, GPIOB_WL_GDO2)
|
197 |
#define LINE_WL_GDO0 PAL_LINE(GPIOB, GPIOB_WL_GDO0)
|
198 |
#define LINE_MEM_SCL PAL_LINE(GPIOB, GPIOB_MEM_SCL)
|
199 |
#define LINE_MEM_SDA PAL_LINE(GPIOB, GPIOB_MEM_SDA)
|
200 |
#define LINE_WL_SS_N PAL_LINE(GPIOB, GPIOB_WL_SS_N)
|
201 |
#define LINE_WL_SCLK PAL_LINE(GPIOB, GPIOB_WL_SCLK)
|
202 |
#define LINE_WL_MISO PAL_LINE(GPIOB, GPIOB_WL_MISO)
|
203 |
#define LINE_WL_MOSI PAL_LINE(GPIOB, GPIOB_WL_MOSI)
|
204 |
|
205 |
#define LINE_LIGHT_XLAT PAL_LINE(GPIOC, GPIOC_LIGHT_XLAT)
|
206 |
#define LINE_SYS_UART_RX PAL_LINE(GPIOC, GPIOC_SYS_UART_RX)
|
207 |
#define LINE_SYS_UART_TX PAL_LINE(GPIOC, GPIOC_SYS_UART_TX)
|
208 |
#define LINE_SYS_PD_N PAL_LINE(GPIOC, GPIOC_SYS_PD_N)
|
209 |
|
210 |
#define LINE_SYS_INT_N PAL_LINE(GPIOD, GPIOD_SYS_INT_N)
|
211 |
|
212 |
/*
|
213 |
* I/O ports initial setup, this configuration is established soon after reset
|
214 |
* in the initialization code.
|
215 |
* Please refer to the STM32 Reference Manual for details.
|
216 |
*/
|
217 |
#define PIN_MODE_INPUT 0U |
218 |
#define PIN_MODE_OUTPUT_2M 2U |
219 |
#define PIN_MODE_OUTPUT_10M 1U |
220 |
#define PIN_MODE_OUTPUT_50M 3U |
221 |
#define PIN_CNF_INPUT_ANALOG 0U |
222 |
#define PIN_CNF_INPUT_FLOATING 1U |
223 |
#define PIN_CNF_INPUT_PULLX 2U |
224 |
#define PIN_CNF_OUTPUT_PUSHPULL 0U |
225 |
#define PIN_CNF_OUTPUT_OPENDRAIN 1U |
226 |
#define PIN_CNF_ALTERNATE_PUSHPULL 2U |
227 |
#define PIN_CNF_ALTERNATE_OPENDRAIN 3U |
228 |
#define PIN_CR(pin, mode, cnf) (((mode) | ((cnf) << 2U)) << (((pin) % 8U) * 4U)) |
229 |
#define PIN_ODR_LOW(n) (0U << (n)) |
230 |
#define PIN_ODR_HIGH(n) (1U << (n)) |
231 |
|
232 |
/*
|
233 |
* GPIOA setup:
|
234 |
*
|
235 |
* PA0 - PIN0 (input floating)
|
236 |
* PA1 - PIN1 (input floating)
|
237 |
* PA2 - LASER_RX (alternate pushpull high 50MHz)
|
238 |
* PA3 - LASER_TX (input pullup)
|
239 |
* PA4 - LIGHT_BLANK (output pushpull high 50MHz)
|
240 |
* PA5 - LIGHT_SCLK (alternate pushpull 50MHz)
|
241 |
* PA6 - PIN6 (input foating)
|
242 |
* PA7 - LIGHT_MOSI (alternate pushpull 50MHz)
|
243 |
* PA8 - PIN8 (input floating)
|
244 |
* PA9 - PROG_RX (alternate pushpull 50MHz)
|
245 |
* PA10 - PROG_TX (input pullup)
|
246 |
* PA11 - CAN_RX (input floating)
|
247 |
* PA12 - CAN_TX (alternate pushpull 50MHz)
|
248 |
* PA13 - SWDIO (input pullup)
|
249 |
* PA14 - SWCLK (input pullup)
|
250 |
* PA15 - PIN15 (input floating)
|
251 |
*/
|
252 |
#define VAL_GPIOACRL (PIN_CR(GPIOA_PIN0, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \
|
253 |
PIN_CR(GPIOA_PIN1, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
254 |
PIN_CR(GPIOA_LASER_RX, PIN_MODE_OUTPUT_50M, PIN_CNF_ALTERNATE_PUSHPULL) | \ |
255 |
PIN_CR(GPIOA_LASER_TX, PIN_MODE_INPUT, PIN_CNF_INPUT_PULLX) | \ |
256 |
PIN_CR(GPIOA_LIGHT_BLANK, PIN_MODE_OUTPUT_50M, PIN_CNF_OUTPUT_PUSHPULL) | \ |
257 |
PIN_CR(GPIOA_LIGHT_SCLK, PIN_MODE_OUTPUT_50M, PIN_CNF_ALTERNATE_PUSHPULL) | \ |
258 |
PIN_CR(GPIOA_PIN6, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
259 |
PIN_CR(GPIOA_LIGHT_MOSI, PIN_MODE_OUTPUT_50M, PIN_CNF_ALTERNATE_PUSHPULL)) |
260 |
#define VAL_GPIOACRH (PIN_CR(GPIOA_PIN8, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \
|
261 |
PIN_CR(GPIOA_PROG_RX, PIN_MODE_OUTPUT_50M, PIN_CNF_ALTERNATE_PUSHPULL) | \ |
262 |
PIN_CR(GPIOA_PROG_TX, PIN_MODE_INPUT, PIN_CNF_INPUT_PULLX) | \ |
263 |
PIN_CR(GPIOA_CAN_RX, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
264 |
PIN_CR(GPIOA_CAN_TX, PIN_MODE_OUTPUT_50M, PIN_CNF_ALTERNATE_PUSHPULL) | \ |
265 |
PIN_CR(GPIOA_SWDIO, PIN_MODE_INPUT, PIN_CNF_INPUT_PULLX) | \ |
266 |
PIN_CR(GPIOA_SWCLK, PIN_MODE_INPUT, PIN_CNF_INPUT_PULLX) | \ |
267 |
PIN_CR(GPIOA_PIN15, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING)) |
268 |
#define VAL_GPIOAODR (PIN_ODR_LOW(GPIOA_PIN0) | \
|
269 |
PIN_ODR_LOW(GPIOA_PIN1) | \ |
270 |
PIN_ODR_HIGH(GPIOA_LASER_RX) | \ |
271 |
PIN_ODR_HIGH(GPIOA_LASER_TX) | \ |
272 |
PIN_ODR_HIGH(GPIOA_LIGHT_BLANK) | \ |
273 |
PIN_ODR_HIGH(GPIOA_LIGHT_SCLK) | \ |
274 |
PIN_ODR_LOW(GPIOA_PIN6) | \ |
275 |
PIN_ODR_HIGH(GPIOA_LIGHT_MOSI) | \ |
276 |
PIN_ODR_LOW(GPIOA_PIN8) | \ |
277 |
PIN_ODR_HIGH(GPIOA_PROG_RX) | \ |
278 |
PIN_ODR_HIGH(GPIOA_PROG_TX) | \ |
279 |
PIN_ODR_HIGH(GPIOA_CAN_RX) | \ |
280 |
PIN_ODR_HIGH(GPIOA_CAN_TX) | \ |
281 |
PIN_ODR_HIGH(GPIOA_SWDIO) | \ |
282 |
PIN_ODR_HIGH(GPIOA_SWCLK) | \ |
283 |
PIN_ODR_LOW(GPIOA_PIN15)) |
284 |
|
285 |
/*
|
286 |
* GPIOB setup:
|
287 |
*
|
288 |
* PB0 - PIN0 (input floating)
|
289 |
* PB1 - PIN1 (input floating)
|
290 |
* PB2 - LASER_EN (output pushpull low 50MHz)
|
291 |
* PB3 - PIN3 (input floating)
|
292 |
* PB4 - PIN4 (input floating)
|
293 |
* PB5 - LASER_OC_N (input floating)
|
294 |
* PB6 - SYS_UART_DN (output opendrain high 50MHz)
|
295 |
* PB7 - PIN7 (input foating)
|
296 |
* PB8 - WL_GDO2 (input pullup)
|
297 |
* PB9 - WL_GDO0 (input pullup)
|
298 |
* PB10 - MEM_SCL (alternate opendrain 50MHz)
|
299 |
* PB11 - MEM_SDA (alternate opendrain 50MHz)
|
300 |
* PB12 - WL_SS_N (output pushpull high 50MHz)
|
301 |
* PB13 - WL_SCLK (alternate pushpull 50MHz)
|
302 |
* PB14 - WL_MISO (input pullup)
|
303 |
* PB15 - WL_MOSI (alternate pushpull 50MHz)
|
304 |
*/
|
305 |
#define VAL_GPIOBCRL (PIN_CR(GPIOB_PIN0, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \
|
306 |
PIN_CR(GPIOB_PIN1, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
307 |
PIN_CR(GPIOB_LASER_EN, PIN_MODE_OUTPUT_50M, PIN_CNF_OUTPUT_PUSHPULL) | \ |
308 |
PIN_CR(GPIOB_PIN3, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
309 |
PIN_CR(GPIOB_PIN4, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
310 |
PIN_CR(GPIOB_LASER_OC_N, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
311 |
PIN_CR(GPIOB_SYS_UART_DN, PIN_MODE_OUTPUT_50M, PIN_CNF_OUTPUT_OPENDRAIN) | \ |
312 |
PIN_CR(GPIOB_PIN7, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING)) |
313 |
#define VAL_GPIOBCRH (PIN_CR(GPIOB_WL_GDO2, PIN_MODE_INPUT, PIN_CNF_INPUT_PULLX) | \
|
314 |
PIN_CR(GPIOB_WL_GDO0, PIN_MODE_INPUT, PIN_CNF_INPUT_PULLX) | \ |
315 |
PIN_CR(GPIOB_MEM_SCL, PIN_MODE_OUTPUT_50M, PIN_CNF_ALTERNATE_OPENDRAIN) | \ |
316 |
PIN_CR(GPIOB_MEM_SDA, PIN_MODE_OUTPUT_50M, PIN_CNF_ALTERNATE_OPENDRAIN) | \ |
317 |
PIN_CR(GPIOB_WL_SS_N, PIN_MODE_OUTPUT_50M, PIN_CNF_OUTPUT_PUSHPULL) | \ |
318 |
PIN_CR(GPIOB_WL_SCLK, PIN_MODE_OUTPUT_50M, PIN_CNF_ALTERNATE_PUSHPULL) | \ |
319 |
PIN_CR(GPIOB_WL_MISO, PIN_MODE_INPUT, PIN_CNF_INPUT_PULLX) | \ |
320 |
PIN_CR(GPIOB_WL_MOSI, PIN_MODE_OUTPUT_50M, PIN_CNF_ALTERNATE_PUSHPULL)) |
321 |
#define VAL_GPIOBODR (PIN_ODR_LOW(GPIOB_PIN0) | \
|
322 |
PIN_ODR_LOW(GPIOB_PIN1) | \ |
323 |
PIN_ODR_LOW(GPIOB_LASER_EN) | \ |
324 |
PIN_ODR_LOW(GPIOB_PIN3) | \ |
325 |
PIN_ODR_LOW(GPIOB_PIN4) | \ |
326 |
PIN_ODR_HIGH(GPIOB_LASER_OC_N) | \ |
327 |
PIN_ODR_HIGH(GPIOB_SYS_UART_DN) | \ |
328 |
PIN_ODR_LOW(GPIOB_PIN7) | \ |
329 |
PIN_ODR_HIGH(GPIOB_WL_GDO2) | \ |
330 |
PIN_ODR_HIGH(GPIOB_WL_GDO0) | \ |
331 |
PIN_ODR_HIGH(GPIOB_MEM_SCL) | \ |
332 |
PIN_ODR_HIGH(GPIOB_MEM_SDA) | \ |
333 |
PIN_ODR_HIGH(GPIOB_WL_SS_N) | \ |
334 |
PIN_ODR_HIGH(GPIOB_WL_SCLK) | \ |
335 |
PIN_ODR_HIGH(GPIOB_WL_MISO) | \ |
336 |
PIN_ODR_HIGH(GPIOB_WL_MOSI)) |
337 |
|
338 |
/*
|
339 |
* GPIOC setup:
|
340 |
*
|
341 |
* PC0 - PIN0 (input floating)
|
342 |
* PC1 - PIN1 (input floating)
|
343 |
* PC2 - PIN2 (input floating)
|
344 |
* PC3 - PIN3 (input floating)
|
345 |
* PC4 - LIGHT_XLAT (output pushpull high 10MHz)
|
346 |
* PC5 - PIN5 (input floating)
|
347 |
* PC6 - PIN6 (input floating)
|
348 |
* PC7 - PIN7 (input floating)
|
349 |
* PC8 - PIN8 (input floating)
|
350 |
* PC9 - PIN9 (input floating)
|
351 |
* PC10 - SYS_UART_RX (input pullup)
|
352 |
* PC11 - SYS_UART_TX (input pullup)
|
353 |
* PC12 - PIN12 (input floating)
|
354 |
* PC13 - PIN13 (input floating)
|
355 |
* PC14 - SYS_PD_N (output opendrain high 50MHz)
|
356 |
* PC15 - PIN15 (input floating)
|
357 |
*/
|
358 |
#define VAL_GPIOCCRL (PIN_CR(GPIOC_PIN0, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \
|
359 |
PIN_CR(GPIOC_PIN1, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
360 |
PIN_CR(GPIOC_PIN2, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
361 |
PIN_CR(GPIOC_PIN3, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
362 |
PIN_CR(GPIOC_LIGHT_XLAT, PIN_MODE_OUTPUT_10M, PIN_CNF_OUTPUT_PUSHPULL) | \ |
363 |
PIN_CR(GPIOC_PIN5, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
364 |
PIN_CR(GPIOC_PIN6, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
365 |
PIN_CR(GPIOC_PIN7, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING)) |
366 |
#define VAL_GPIOCCRH (PIN_CR(GPIOC_PIN8, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \
|
367 |
PIN_CR(GPIOC_PIN9, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
368 |
PIN_CR(GPIOC_SYS_UART_RX, PIN_MODE_INPUT, PIN_CNF_INPUT_PULLX) | \ |
369 |
PIN_CR(GPIOC_SYS_UART_TX, PIN_MODE_INPUT, PIN_CNF_INPUT_PULLX) | \ |
370 |
PIN_CR(GPIOC_PIN12, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
371 |
PIN_CR(GPIOC_PIN13, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
372 |
PIN_CR(GPIOC_SYS_PD_N, PIN_MODE_OUTPUT_50M, PIN_CNF_OUTPUT_OPENDRAIN) | \ |
373 |
PIN_CR(GPIOC_PIN15, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING)) |
374 |
#define VAL_GPIOCODR (PIN_ODR_LOW(GPIOC_PIN0) | \
|
375 |
PIN_ODR_LOW(GPIOC_PIN1) | \ |
376 |
PIN_ODR_LOW(GPIOC_PIN2) | \ |
377 |
PIN_ODR_LOW(GPIOC_PIN3) | \ |
378 |
PIN_ODR_LOW(GPIOC_LIGHT_XLAT) | \ |
379 |
PIN_ODR_LOW(GPIOC_PIN5) | \ |
380 |
PIN_ODR_LOW(GPIOC_PIN6) | \ |
381 |
PIN_ODR_LOW(GPIOC_PIN7) | \ |
382 |
PIN_ODR_LOW(GPIOC_PIN8) | \ |
383 |
PIN_ODR_LOW(GPIOC_PIN9) | \ |
384 |
PIN_ODR_HIGH(GPIOC_SYS_UART_RX) | \ |
385 |
PIN_ODR_HIGH(GPIOC_SYS_UART_TX) | \ |
386 |
PIN_ODR_LOW(GPIOC_PIN12) | \ |
387 |
PIN_ODR_LOW(GPIOC_PIN13) | \ |
388 |
PIN_ODR_HIGH(GPIOC_SYS_PD_N) | \ |
389 |
PIN_ODR_LOW(GPIOC_PIN15)) |
390 |
|
391 |
/*
|
392 |
* GPIOD setup:
|
393 |
*
|
394 |
* PD0 - OSC_IN (input floating)
|
395 |
* PD1 - OSC_OUT (input floating)
|
396 |
* PD2 - SYS_INT_N (output opendrain low 50MHz)
|
397 |
* PD3 - PIN3 (input floating)
|
398 |
* PD4 - PIN4 (input floating)
|
399 |
* PD5 - PIN5 (input floating)
|
400 |
* PD6 - PIN6 (input floating)
|
401 |
* PD7 - PIN7 (input floating)
|
402 |
* PD8 - PIN8 (input floating)
|
403 |
* PD9 - PIN9 (input floating)
|
404 |
* PD10 - PIN10 (input floating)
|
405 |
* PD11 - PIN11 (input floating)
|
406 |
* PD12 - PIN12 (input floating)
|
407 |
* PD13 - PIN13 (input floating)
|
408 |
* PD14 - PIN14 (input floating)
|
409 |
* PD15 - PIN15 (input floating)
|
410 |
*/
|
411 |
#define VAL_GPIODCRL (PIN_CR(GPIOD_OSC_IN, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \
|
412 |
PIN_CR(GPIOD_OSC_OUT, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
413 |
PIN_CR(GPIOD_SYS_INT_N, PIN_MODE_OUTPUT_50M, PIN_CNF_OUTPUT_OPENDRAIN) | \ |
414 |
PIN_CR(GPIOD_PIN3, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
415 |
PIN_CR(GPIOD_PIN4, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
416 |
PIN_CR(GPIOD_PIN5, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
417 |
PIN_CR(GPIOD_PIN6, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
418 |
PIN_CR(GPIOD_PIN7, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING)) |
419 |
#define VAL_GPIODCRH (PIN_CR(GPIOD_PIN8, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \
|
420 |
PIN_CR(GPIOD_PIN9, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
421 |
PIN_CR(GPIOD_PIN10, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
422 |
PIN_CR(GPIOD_PIN11, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
423 |
PIN_CR(GPIOD_PIN12, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
424 |
PIN_CR(GPIOD_PIN13, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
425 |
PIN_CR(GPIOD_PIN14, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
426 |
PIN_CR(GPIOD_PIN15, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING)) |
427 |
#define VAL_GPIODODR (PIN_ODR_HIGH(GPIOD_OSC_IN) | \
|
428 |
PIN_ODR_HIGH(GPIOD_OSC_OUT) | \ |
429 |
PIN_ODR_LOW(GPIOD_SYS_INT_N) | \ |
430 |
PIN_ODR_LOW(GPIOD_PIN3) | \ |
431 |
PIN_ODR_LOW(GPIOD_PIN4) | \ |
432 |
PIN_ODR_LOW(GPIOD_PIN5) | \ |
433 |
PIN_ODR_LOW(GPIOD_PIN6) | \ |
434 |
PIN_ODR_LOW(GPIOD_PIN7) | \ |
435 |
PIN_ODR_LOW(GPIOD_PIN8) | \ |
436 |
PIN_ODR_LOW(GPIOD_PIN9) | \ |
437 |
PIN_ODR_LOW(GPIOD_PIN10) | \ |
438 |
PIN_ODR_LOW(GPIOD_PIN11) | \ |
439 |
PIN_ODR_LOW(GPIOD_PIN12) | \ |
440 |
PIN_ODR_LOW(GPIOD_PIN13) | \ |
441 |
PIN_ODR_LOW(GPIOD_PIN14) | \ |
442 |
PIN_ODR_LOW(GPIOD_PIN15)) |
443 |
|
444 |
/*
|
445 |
* GPIOE setup:
|
446 |
*
|
447 |
* PE0 - PIN0 (input floating)
|
448 |
* PE1 - PIN1 (input floating)
|
449 |
* PE2 - PIN2 (input floating)
|
450 |
* PE3 - PIN3 (input floating)
|
451 |
* PE4 - PIN4 (input floating)
|
452 |
* PE5 - PIN5 (input floating)
|
453 |
* PE6 - PIN6 (input floating)
|
454 |
* PE7 - PIN7 (input floating)
|
455 |
* PE8 - PIN8 (input floating)
|
456 |
* PE9 - PIN9 (input floating)
|
457 |
* PE10 - PIN10 (input floating)
|
458 |
* PE11 - PIN11 (input floating)
|
459 |
* PE12 - PIN12 (input floating)
|
460 |
* PE13 - PIN13 (input floating)
|
461 |
* PE14 - PIN14 (input floating)
|
462 |
* PE15 - PIN15 (input floating)
|
463 |
*/
|
464 |
#define VAL_GPIOECRL (PIN_CR(GPIOE_PIN0, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \
|
465 |
PIN_CR(GPIOE_PIN1, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
466 |
PIN_CR(GPIOE_PIN2, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
467 |
PIN_CR(GPIOE_PIN3, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
468 |
PIN_CR(GPIOE_PIN4, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
469 |
PIN_CR(GPIOE_PIN5, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
470 |
PIN_CR(GPIOE_PIN6, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
471 |
PIN_CR(GPIOE_PIN7, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING)) |
472 |
#define VAL_GPIOECRH (PIN_CR(GPIOE_PIN8, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \
|
473 |
PIN_CR(GPIOE_PIN9, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
474 |
PIN_CR(GPIOE_PIN10, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
475 |
PIN_CR(GPIOE_PIN11, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
476 |
PIN_CR(GPIOE_PIN12, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
477 |
PIN_CR(GPIOE_PIN13, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
478 |
PIN_CR(GPIOE_PIN14, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
479 |
PIN_CR(GPIOE_PIN15, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING)) |
480 |
#define VAL_GPIOEODR (PIN_ODR_LOW(GPIOE_PIN0) | \
|
481 |
PIN_ODR_LOW(GPIOE_PIN1) | \ |
482 |
PIN_ODR_LOW(GPIOE_PIN2) | \ |
483 |
PIN_ODR_LOW(GPIOE_PIN3) | \ |
484 |
PIN_ODR_LOW(GPIOE_PIN4) | \ |
485 |
PIN_ODR_LOW(GPIOE_PIN5) | \ |
486 |
PIN_ODR_LOW(GPIOE_PIN6) | \ |
487 |
PIN_ODR_LOW(GPIOE_PIN7) | \ |
488 |
PIN_ODR_LOW(GPIOE_PIN8) | \ |
489 |
PIN_ODR_LOW(GPIOE_PIN9) | \ |
490 |
PIN_ODR_LOW(GPIOE_PIN10) | \ |
491 |
PIN_ODR_LOW(GPIOE_PIN11) | \ |
492 |
PIN_ODR_LOW(GPIOE_PIN12) | \ |
493 |
PIN_ODR_LOW(GPIOE_PIN13) | \ |
494 |
PIN_ODR_LOW(GPIOE_PIN14) | \ |
495 |
PIN_ODR_LOW(GPIOE_PIN15)) |
496 |
|
497 |
/*
|
498 |
* GPIOF setup:
|
499 |
*
|
500 |
* PF0 - PIN0 (input floating)
|
501 |
* PF1 - PIN1 (input floating)
|
502 |
* PF2 - PIN2 (input floating)
|
503 |
* PF3 - PIN3 (input floating)
|
504 |
* PF4 - PIN4 (input floating)
|
505 |
* PF5 - PIN5 (input floating)
|
506 |
* PF6 - PIN6 (input floating)
|
507 |
* PF7 - PIN7 (input floating)
|
508 |
* PF8 - PIN8 (input floating)
|
509 |
* PF9 - PIN9 (input floating)
|
510 |
* PF10 - PIN10 (input floating)
|
511 |
* PF11 - PIN11 (input floating)
|
512 |
* PF12 - PIN12 (input floating)
|
513 |
* PF13 - PIN13 (input floating)
|
514 |
* PF14 - PIN14 (input floating)
|
515 |
* PF15 - PIN15 (input floating)
|
516 |
*/
|
517 |
#define VAL_GPIOFCRL (PIN_CR(GPIOF_PIN0, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \
|
518 |
PIN_CR(GPIOF_PIN1, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
519 |
PIN_CR(GPIOF_PIN2, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
520 |
PIN_CR(GPIOF_PIN3, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
521 |
PIN_CR(GPIOF_PIN4, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
522 |
PIN_CR(GPIOF_PIN5, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
523 |
PIN_CR(GPIOF_PIN6, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
524 |
PIN_CR(GPIOF_PIN7, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING)) |
525 |
#define VAL_GPIOFCRH (PIN_CR(GPIOF_PIN8, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \
|
526 |
PIN_CR(GPIOF_PIN9, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
527 |
PIN_CR(GPIOF_PIN10, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
528 |
PIN_CR(GPIOF_PIN11, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
529 |
PIN_CR(GPIOF_PIN12, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
530 |
PIN_CR(GPIOF_PIN13, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
531 |
PIN_CR(GPIOF_PIN14, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
532 |
PIN_CR(GPIOF_PIN15, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING)) |
533 |
#define VAL_GPIOFODR (PIN_ODR_LOW(GPIOF_PIN0) | \
|
534 |
PIN_ODR_LOW(GPIOF_PIN1) | \ |
535 |
PIN_ODR_LOW(GPIOF_PIN2) | \ |
536 |
PIN_ODR_LOW(GPIOF_PIN3) | \ |
537 |
PIN_ODR_LOW(GPIOF_PIN4) | \ |
538 |
PIN_ODR_LOW(GPIOF_PIN5) | \ |
539 |
PIN_ODR_LOW(GPIOF_PIN6) | \ |
540 |
PIN_ODR_LOW(GPIOF_PIN7) | \ |
541 |
PIN_ODR_LOW(GPIOF_PIN8) | \ |
542 |
PIN_ODR_LOW(GPIOF_PIN9) | \ |
543 |
PIN_ODR_LOW(GPIOF_PIN10) | \ |
544 |
PIN_ODR_LOW(GPIOF_PIN11) | \ |
545 |
PIN_ODR_LOW(GPIOF_PIN12) | \ |
546 |
PIN_ODR_LOW(GPIOF_PIN13) | \ |
547 |
PIN_ODR_LOW(GPIOF_PIN14) | \ |
548 |
PIN_ODR_LOW(GPIOF_PIN15)) |
549 |
|
550 |
/*
|
551 |
* GPIOG setup:
|
552 |
*
|
553 |
* PG0 - PIN0 (input floating)
|
554 |
* PG1 - PIN1 (input floating)
|
555 |
* PG2 - PIN2 (input floating)
|
556 |
* PG3 - PIN3 (input floating)
|
557 |
* PG4 - PIN4 (input floating)
|
558 |
* PG5 - PIN5 (input floating)
|
559 |
* PG6 - PIN6 (input floating)
|
560 |
* PG7 - PIN7 (input floating)
|
561 |
* PG8 - PIN8 (input floating)
|
562 |
* PG9 - PIN9 (input floating)
|
563 |
* PG10 - PIN10 (input floating)
|
564 |
* PG11 - PIN11 (input floating)
|
565 |
* PG12 - PIN12 (input floating)
|
566 |
* PG13 - PIN13 (input floating)
|
567 |
* PG14 - PIN14 (input floating)
|
568 |
* PG15 - PIN15 (input floating)
|
569 |
*/
|
570 |
#define VAL_GPIOGCRL (PIN_CR(GPIOG_PIN0, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \
|
571 |
PIN_CR(GPIOG_PIN1, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
572 |
PIN_CR(GPIOG_PIN2, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
573 |
PIN_CR(GPIOG_PIN3, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
574 |
PIN_CR(GPIOG_PIN4, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
575 |
PIN_CR(GPIOG_PIN5, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
576 |
PIN_CR(GPIOG_PIN6, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
577 |
PIN_CR(GPIOG_PIN7, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING)) |
578 |
#define VAL_GPIOGCRH (PIN_CR(GPIOG_PIN8, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \
|
579 |
PIN_CR(GPIOG_PIN9, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
580 |
PIN_CR(GPIOG_PIN10, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
581 |
PIN_CR(GPIOG_PIN11, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
582 |
PIN_CR(GPIOG_PIN12, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
583 |
PIN_CR(GPIOG_PIN13, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
584 |
PIN_CR(GPIOG_PIN14, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) | \ |
585 |
PIN_CR(GPIOG_PIN15, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING)) |
586 |
#define VAL_GPIOGODR (PIN_ODR_LOW(GPIOG_PIN0) | \
|
587 |
PIN_ODR_LOW(GPIOG_PIN1) | \ |
588 |
PIN_ODR_LOW(GPIOG_PIN2) | \ |
589 |
PIN_ODR_LOW(GPIOG_PIN3) | \ |
590 |
PIN_ODR_LOW(GPIOG_PIN4) | \ |
591 |
PIN_ODR_LOW(GPIOG_PIN5) | \ |
592 |
PIN_ODR_LOW(GPIOG_PIN6) | \ |
593 |
PIN_ODR_LOW(GPIOG_PIN7) | \ |
594 |
PIN_ODR_LOW(GPIOG_PIN8) | \ |
595 |
PIN_ODR_LOW(GPIOG_PIN9) | \ |
596 |
PIN_ODR_LOW(GPIOG_PIN10) | \ |
597 |
PIN_ODR_LOW(GPIOG_PIN11) | \ |
598 |
PIN_ODR_LOW(GPIOG_PIN12) | \ |
599 |
PIN_ODR_LOW(GPIOG_PIN13) | \ |
600 |
PIN_ODR_LOW(GPIOG_PIN14) | \ |
601 |
PIN_ODR_LOW(GPIOG_PIN15)) |
602 |
|
603 |
#if !defined(_FROM_ASM_)
|
604 |
#ifdef __cplusplus
|
605 |
extern "C" { |
606 |
#endif
|
607 |
void boardInit(void); |
608 |
#ifdef __cplusplus
|
609 |
} |
610 |
#endif
|
611 |
#endif /* _FROM_ASM_ */ |
612 |
|
613 |
#endif /* _BOARD_H_ */ |