Statistics
| Branch: | Tag: | Revision:

amiro-os / modules / LightRing_1-2 / board.h @ f38aba21

History | View | Annotate | Download (41.424 KB)

1
/*
2
AMiRo-OS is an operating system designed for the Autonomous Mini Robot (AMiRo) platform.
3
Copyright (C) 2016..2019  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
/**
20
 * @file
21
 * @brief   LightRing v1.2 Board specific macros.
22
 *
23
 * @addtogroup lightring_board
24
 * @{
25
 */
26

    
27
#ifndef BOARD_H
28
#define BOARD_H
29

    
30
/*
31
 * Setup for AMiRo LightRing v1.2 board.
32
 */
33

    
34
/*
35
 * Board identifier.
36
 */
37
#define BOARD_LIGHTRING_1_2
38
#define BOARD_NAME              "AMiRo LightRing v1.2"
39

    
40
/*
41
 * Board oscillators-related settings.
42
 * NOTE: LSE not fitted.
43
 */
44
#if !defined(STM32_LSECLK)
45
#define STM32_LSECLK                0U
46
#endif
47

    
48
#if !defined(STM32_HSECLK)
49
#define STM32_HSECLK                8000000U
50
#endif
51

    
52
/*
53
 * Board voltages.
54
 * Required for performance limits calculation.
55
 */
56
#define STM32_VDD                   330U
57

    
58
/*
59
 * MCU type as defined in the ST header.
60
 */
61
#define STM32F103xE
62

    
63
/*
64
 * Identifiers for the several breakout modules, which can be attached to the LightRing v1.2 module.
65
 */
66
#define BOARD_BREAKOUT_NONE         0
67
#define BOARD_BREAKOUT_UWBv10       1
68

    
69
/*
70
 * Configuration macro to define which type of sensor ring is attached.
71
 */
72
#if !defined(BOARD_BREAKOUT_MODULE) || defined(__DOXYGEN__)
73
#define BOARD_BREAKOUT_MODULE       BOARD_BREAKOUT_UWBv10
74
#endif
75

    
76
/*
77
 * IO pins assignments.
78
 */
79
#define GPIOA_USART_CTS             0U
80
#define GPIOA_USART_RTS             1U
81
#define GPIOA_USART_RX              2U
82
#define GPIOA_USART_TX              3U
83
#define GPIOA_LIGHT_BLANK           4U
84
#define GPIOA_LIGHT_SCLK            5U
85
#define GPIOA_LIGHT_MISO            6U
86
#define GPIOA_LIGHT_MOSI            7U
87
#define GPIOA_PIN8                  8U
88
#define GPIOA_PROG_RX               9U
89
#define GPIOA_PROG_TX               10U
90
#define GPIOA_CAN_RX                11U
91
#define GPIOA_CAN_TX                12U
92
#define GPIOA_SWDIO                 13U
93
#define GPIOA_SWCLK                 14U
94
#define GPIOA_RS232_R_EN_N          15U
95

    
96
#define GPIOB_SW_V33_EN             0U
97
#define GPIOB_SW_V42_EN             1U
98
#define GPIOB_SW_V50_EN             2U
99
#define GPIOB_IO_3                  3U
100
#define GPIOB_IO_5                  4U
101
#define GPIOB_IO_6                  5U
102
#define GPIOB_SYS_UART_DN           6U
103
#define GPIOB_PIN7                  7U
104
#define GPIOB_IO_7                  8U
105
#define GPIOB_IO_8                  9U
106
#define GPIOB_I2C_SCL               10U
107
#define GPIOB_I2C_SDA               11U
108
#define GPIOB_SPI_SS_N              12U
109
#define GPIOB_SPI_SCLK              13U
110
#define GPIOB_SPI_MISO              14U
111
#define GPIOB_SPI_MOSI              15U
112

    
113
#define GPIOC_IO_4                  0U
114
#define GPIOC_IO_1                  1U
115
#define GPIOC_IO_2                  2U
116
#define GPIOC_LED                   3U
117
#define GPIOC_LIGHT_XLAT            4U
118
#define GPIOC_SW_V18_EN             5U
119
#define GPIOC_SW_VSYS_EN            6U
120
#define GPIOC_SYS_UART_UP           7U
121
#define GPIOC_PIN8                  8U
122
#define GPIOC_PIN9                  9U
123
#define GPIOC_SYS_UART_RX           10U
124
#define GPIOC_SYS_UART_TX           11U
125
#define GPIOC_RS232_D_OFF_N         12U
126
#define GPIOC_PIN13                 13U
127
#define GPIOC_SYS_PD_N              14U
128
#define GPIOC_PIN15                 15U
129

    
130
#define GPIOD_OSC_IN                0U
131
#define GPIOD_OSC_OUT               1U
132
#define GPIOD_SYS_INT_N             2U
133
#define GPIOD_PIN3                  3U
134
#define GPIOD_PIN4                  4U
135
#define GPIOD_PIN5                  5U
136
#define GPIOD_PIN6                  6U
137
#define GPIOD_PIN7                  7U
138
#define GPIOD_PIN8                  8U
139
#define GPIOD_PIN9                  9U
140
#define GPIOD_PIN10                 10U
141
#define GPIOD_PIN11                 11U
142
#define GPIOD_PIN12                 12U
143
#define GPIOD_PIN13                 13U
144
#define GPIOD_PIN14                 14U
145
#define GPIOD_PIN15                 15U
146

    
147
#define GPIOE_PIN0                  0U
148
#define GPIOE_PIN1                  1U
149
#define GPIOE_PIN2                  2U
150
#define GPIOE_PIN3                  3U
151
#define GPIOE_PIN4                  4U
152
#define GPIOE_PIN5                  5U
153
#define GPIOE_PIN6                  6U
154
#define GPIOE_PIN7                  7U
155
#define GPIOE_PIN8                  8U
156
#define GPIOE_PIN9                  9U
157
#define GPIOE_PIN10                 10U
158
#define GPIOE_PIN11                 11U
159
#define GPIOE_PIN12                 12U
160
#define GPIOE_PIN13                 13U
161
#define GPIOE_PIN14                 14U
162
#define GPIOE_PIN15                 15U
163

    
164
#define GPIOF_PIN0                  0U
165
#define GPIOF_PIN1                  1U
166
#define GPIOF_PIN2                  2U
167
#define GPIOF_PIN3                  3U
168
#define GPIOF_PIN4                  4U
169
#define GPIOF_PIN5                  5U
170
#define GPIOF_PIN6                  6U
171
#define GPIOF_PIN7                  7U
172
#define GPIOF_PIN8                  8U
173
#define GPIOF_PIN9                  9U
174
#define GPIOF_PIN10                 10U
175
#define GPIOF_PIN11                 11U
176
#define GPIOF_PIN12                 12U
177
#define GPIOF_PIN13                 13U
178
#define GPIOF_PIN14                 14U
179
#define GPIOF_PIN15                 15U
180

    
181
#define GPIOG_PIN0                  0U
182
#define GPIOG_PIN1                  1U
183
#define GPIOG_PIN2                  2U
184
#define GPIOG_PIN3                  3U
185
#define GPIOG_PIN4                  4U
186
#define GPIOG_PIN5                  5U
187
#define GPIOG_PIN6                  6U
188
#define GPIOG_PIN7                  7U
189
#define GPIOG_PIN8                  8U
190
#define GPIOG_PIN9                  9U
191
#define GPIOG_PIN10                 10U
192
#define GPIOG_PIN11                 11U
193
#define GPIOG_PIN12                 12U
194
#define GPIOG_PIN13                 13U
195
#define GPIOG_PIN14                 14U
196
#define GPIOG_PIN15                 15U
197

    
198
/*
199
 * IO lines assignments.
200
 */
201
#define LINE_USART_CTS              PAL_LINE(GPIOA, GPIOA_USART_CTS)
202
#define LINE_USART_RTS              PAL_LINE(GPIOA, GPIOA_USART_RTS)
203
#define LINE_USART_RX               PAL_LINE(GPIOA, GPIOA_USART_RX)
204
#define LINE_USART_TX               PAL_LINE(GPIOA, GPIOA_USART_TX)
205
#define LINE_LIGHT_BLANK            PAL_LINE(GPIOA, GPIOA_LIGHT_BLANK)
206
#define LINE_LIGHT_SCLK             PAL_LINE(GPIOA, GPIOA_LIGHT_SCLK)
207
#define LINE_LIGHT_MISO             PAL_LINE(GPIOA, GPIOA_LIGHT_MISO)
208
#define LINE_LIGHT_MOSI             PAL_LINE(GPIOA, GPIOA_LIGHT_MOSI)
209
#define LINE_PROG_RX                PAL_LINE(GPIOA, GPIOA_PROG_RX)
210
#define LINE_PROG_TX                PAL_LINE(GPIOA, GPIOA_PROG_TX)
211
#define LINE_CAN_RX                 PAL_LINE(GPIOA, GPIOA_CAN_RX)
212
#define LINE_CAN_TX                 PAL_LINE(GPIOA, GPIOA_CAN_TX)
213
#define LINE_SWDIO                  PAL_LINE(GPIOA, GPIOA_SWDIO)
214
#define LINE_SWCLK                  PAL_LINE(GPIOA, GPIOA_SWCLK)
215
#define LINE_RS232_R_EN_N           PAL_LINE(GPIOA, GPIOA_RS232_R_EN_N)
216

    
217
#define LINE_SW_V33_EN              PAL_LINE(GPIOB, GPIOB_SW_V33_EN)
218
#define LINE_SW_V42_EN              PAL_LINE(GPIOB, GPIOB_SW_V42_EN)
219
#define LINE_SW_V50_EN              PAL_LINE(GPIOB, GPIOB_SW_V50_EN)
220
#define LINE_IO_3                   PAL_LINE(GPIOB, GPIOB_IO_3)
221
#define LINE_IO_5                   PAL_LINE(GPIOB, GPIOB_IO_5)
222
#define LINE_IO_6                   PAL_LINE(GPIOB, GPIOB_IO_6)
223
#define LINE_SYS_UART_DN            PAL_LINE(GPIOB, GPIOB_SYS_UART_DN)
224
#define LINE_IO_7                   PAL_LINE(GPIOB, GPIOB_IO_7)
225
#define LINE_IO_8                   PAL_LINE(GPIOB, GPIOB_IO_8)
226
#define LINE_I2C_SCL                PAL_LINE(GPIOB, GPIOB_I2C_SCL)
227
#define LINE_I2C_SDA                PAL_LINE(GPIOB, GPIOB_I2C_SDA)
228
#define LINE_SPI_SS_N               PAL_LINE(GPIOB, GPIOB_SPI_SS_N)
229
#define LINE_SPI_SCLK               PAL_LINE(GPIOB, GPIOB_SPI_SCLK)
230
#define LINE_SPI_MISO               PAL_LINE(GPIOB, GPIOB_SPI_MISO)
231
#define LINE_SPI_MOSI               PAL_LINE(GPIOB, GPIOB_SPI_MOSI)
232

    
233
#define LINE_IO_4                   PAL_LINE(GPIOC, GPIOC_IO_4)
234
#define LINE_IO_1                   PAL_LINE(GPIOC, GPIOC_IO_1)
235
#define LINE_IO_2                   PAL_LINE(GPIOC, GPIOC_IO_2)
236
#define LINE_LED                    PAL_LINE(GPIOC, GPIOC_LED)
237
#define LINE_LIGHT_XLAT             PAL_LINE(GPIOC, GPIOC_LIGHT_XLAT)
238
#define LINE_SW_V18_EN              PAL_LINE(GPIOC, GPIOC_SW_V18_EN)
239
#define LINE_SW_VSYS_EN             PAL_LINE(GPIOC, GPIOC_SW_VSYS_EN)
240
#define LINE_SYS_UART_UP            PAL_LINE(GPIOC, GPIOC_SYS_UART_UP)
241
#define LINE_SYS_UART_RX            PAL_LINE(GPIOC, GPIOC_SYS_UART_RX)
242
#define LINE_SYS_UART_TX            PAL_LINE(GPIOC, GPIOC_SYS_UART_TX)
243
#define LINE_RS232_D_OFF_N          PAL_LINE(GPIOC, GPIOC_RS232_D_OFF_N)
244
#define LINE_SYS_PD_N               PAL_LINE(GPIOC, GPIOC_SYS_PD_N)
245

    
246
#define LINE_SYS_INT_N              PAL_LINE(GPIOD, GPIOD_SYS_INT_N)
247

    
248
/*
249
 * I/O ports initial setup, this configuration is established soon after reset
250
 * in the initialization code.
251
 * Please refer to the STM32 Reference Manual for details.
252
 */
253
#define PIN_MODE_INPUT              0U
254
#define PIN_MODE_OUTPUT_2M          2U
255
#define PIN_MODE_OUTPUT_10M         1U
256
#define PIN_MODE_OUTPUT_50M         3U
257
#define PIN_CNF_INPUT_ANALOG        0U
258
#define PIN_CNF_INPUT_FLOATING      1U
259
#define PIN_CNF_INPUT_PULLX         2U
260
#define PIN_CNF_OUTPUT_PUSHPULL     0U
261
#define PIN_CNF_OUTPUT_OPENDRAIN    1U
262
#define PIN_CNF_ALTERNATE_PUSHPULL  2U
263
#define PIN_CNF_ALTERNATE_OPENDRAIN 3U
264
#define PIN_CR(pin, mode, cnf)      (((mode) | ((cnf) << 2U)) << (((pin) % 8U) * 4U))
265
#define PIN_ODR_LOW(n)              (0U << (n))
266
#define PIN_ODR_HIGH(n)             (1U << (n))
267
#define PIN_IGNORE(n)               (1U << (n))
268

    
269
/*
270
 * GPIOA setup:
271
 *
272
 * PA0  - USART_CTS                 (alternate pushpull 50MHz)
273
 * PA1  - USART_RTS                 (alternate pushpull 50MHz)
274
 * PA2  - USART_RX                  (alternate pushpull 50MHz)
275
 * PA3  - USART_TX                  (input pullup)
276
 * PA4  - LIGHT_BLANK               (output pushpull high 50MHz)
277
 * PA5  - LIGHT_SCLK                (alternate pushpull 50MHz)
278
 * PA6  - LIGHT_MISO                (input pullup)
279
 * PA7  - LIGHT_MOSI                (alternate pushpull 50MHz)
280
 * PA8  - PIN8                      (input floating)
281
 * PA9  - PROG_RX                   (alternate pushpull 50MHz)
282
 * PA10 - PROG_TX                   (input pullup)
283
 * PA11 - CAN_RX                    (input floating)
284
 * PA12 - CAN_TX                    (alternate pushpull 50MHz)
285
 * PA13 - SWDIO                     (input pullup)
286
 * PA14 - SWCLK                     (input pullup)
287
 * PA15 - RS232_R_EN_N              (output opendrain low 50MHz)
288
 */
289
#define VAL_GPIOAIGN                0
290
#define VAL_GPIOACRL                (PIN_CR(GPIOA_USART_CTS, PIN_MODE_OUTPUT_50M, PIN_CNF_ALTERNATE_PUSHPULL) |  \
291
                                     PIN_CR(GPIOA_USART_RTS, PIN_MODE_OUTPUT_50M, PIN_CNF_ALTERNATE_PUSHPULL) |  \
292
                                     PIN_CR(GPIOA_USART_RX, PIN_MODE_OUTPUT_50M, PIN_CNF_ALTERNATE_PUSHPULL) |   \
293
                                     PIN_CR(GPIOA_USART_TX, PIN_MODE_INPUT, PIN_CNF_INPUT_PULLX) |               \
294
                                     PIN_CR(GPIOA_LIGHT_BLANK, PIN_MODE_OUTPUT_50M, PIN_CNF_OUTPUT_PUSHPULL) |   \
295
                                     PIN_CR(GPIOA_LIGHT_SCLK, PIN_MODE_OUTPUT_50M, PIN_CNF_ALTERNATE_PUSHPULL) | \
296
                                     PIN_CR(GPIOA_LIGHT_MISO, PIN_MODE_INPUT, PIN_CNF_INPUT_PULLX) |             \
297
                                     PIN_CR(GPIOA_LIGHT_MOSI, PIN_MODE_OUTPUT_50M, PIN_CNF_ALTERNATE_PUSHPULL))
298
#define VAL_GPIOACRH                (PIN_CR(GPIOA_PIN8, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                \
299
                                     PIN_CR(GPIOA_PROG_RX, PIN_MODE_OUTPUT_50M, PIN_CNF_ALTERNATE_PUSHPULL) |    \
300
                                     PIN_CR(GPIOA_PROG_TX, PIN_MODE_INPUT, PIN_CNF_INPUT_PULLX) |                \
301
                                     PIN_CR(GPIOA_CAN_RX, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |              \
302
                                     PIN_CR(GPIOA_CAN_TX, PIN_MODE_OUTPUT_50M, PIN_CNF_ALTERNATE_PUSHPULL) |     \
303
                                     PIN_CR(GPIOA_SWDIO, PIN_MODE_INPUT, PIN_CNF_INPUT_PULLX) |                  \
304
                                     PIN_CR(GPIOA_SWCLK, PIN_MODE_INPUT, PIN_CNF_INPUT_PULLX) |                  \
305
                                     PIN_CR(GPIOA_RS232_R_EN_N, PIN_MODE_OUTPUT_50M, PIN_CNF_OUTPUT_OPENDRAIN))
306
#define VAL_GPIOAODR                (PIN_ODR_LOW(GPIOA_USART_CTS) |                                              \
307
                                     PIN_ODR_LOW(GPIOA_USART_RTS) |                                              \
308
                                     PIN_ODR_HIGH(GPIOA_USART_RX) |                                              \
309
                                     PIN_ODR_HIGH(GPIOA_USART_TX) |                                              \
310
                                     PIN_ODR_HIGH(GPIOA_LIGHT_BLANK) |                                           \
311
                                     PIN_ODR_HIGH(GPIOA_LIGHT_SCLK) |                                            \
312
                                     PIN_ODR_HIGH(GPIOA_LIGHT_MISO) |                                            \
313
                                     PIN_ODR_HIGH(GPIOA_LIGHT_MOSI) |                                            \
314
                                     PIN_ODR_LOW(GPIOA_PIN8) |                                                   \
315
                                     PIN_ODR_HIGH(GPIOA_PROG_RX) |                                               \
316
                                     PIN_ODR_HIGH(GPIOA_PROG_TX) |                                               \
317
                                     PIN_ODR_HIGH(GPIOA_CAN_RX) |                                                \
318
                                     PIN_ODR_HIGH(GPIOA_CAN_TX) |                                                \
319
                                     PIN_ODR_HIGH(GPIOA_SWDIO) |                                                 \
320
                                     PIN_ODR_HIGH(GPIOA_SWCLK) |                                                 \
321
                                     PIN_ODR_LOW(GPIOA_RS232_R_EN_N))
322

    
323
/*
324
 * GPIOB setup:
325
 *
326
 * PB0  - SW_V33_EN                 (output pushpull low 50MHz)
327
 * PB1  - SW_V42_EN                 (output pushpull low 50MHz)
328
 * PB2  - SW_V50_EN                 (output pushpull low 50MHz)
329
 * PB3  - IO_3                      (input floating)
330
 * PB4  - IO_5                      (input floating)
331
 * PB5  - IO_6                      (input floating)
332
 * PB6  - SYS_UART_DN               (output opendrain high 50MHz)
333
 * PB7  - PIN7                      (input foating)
334
 * PB8  - IO_7                      (input floating)
335
 * PB9  - IO_8                      (input floating)
336
 * PB10 - I2C_SCL                   (alternate opendrain 50MHz)
337
 * PB11 - I2C_SDA                   (alternate opendrain 50MHz)
338
 * PB12 - SPI_SS_N                  (output pushpull high 50MHz)
339
 * PB13 - SPI_SCLK                  (alternate pushpull 50MHz)
340
 * PB14 - SPI_MISO                  (input pullup)
341
 * PB15 - SPI_MOSI                  (alternate pushpull 50MHz)
342
 */
343
#define VAL_GPIOBIGN                (PIN_IGNORE(GPIOB_SYS_UART_DN)) & 0
344
#define VAL_GPIOBCRL                (PIN_CR(GPIOB_SW_V33_EN, PIN_MODE_OUTPUT_50M, PIN_CNF_OUTPUT_PUSHPULL) |     \
345
                                     PIN_CR(GPIOB_SW_V42_EN, PIN_MODE_OUTPUT_50M, PIN_CNF_OUTPUT_PUSHPULL) |     \
346
                                     PIN_CR(GPIOB_SW_V50_EN, PIN_MODE_OUTPUT_50M, PIN_CNF_OUTPUT_PUSHPULL) |     \
347
                                     PIN_CR(GPIOB_IO_3, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                \
348
                                     PIN_CR(GPIOB_IO_5, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                \
349
                                     PIN_CR(GPIOB_IO_6, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                \
350
                                     PIN_CR(GPIOB_SYS_UART_DN, PIN_MODE_OUTPUT_50M, PIN_CNF_OUTPUT_OPENDRAIN) |  \
351
                                     PIN_CR(GPIOB_PIN7, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING))
352
#define VAL_GPIOBCRH                (PIN_CR(GPIOB_IO_7, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                \
353
                                     PIN_CR(GPIOB_IO_8, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                \
354
                                     PIN_CR(GPIOB_I2C_SCL, PIN_MODE_OUTPUT_50M, PIN_CNF_ALTERNATE_OPENDRAIN) |   \
355
                                     PIN_CR(GPIOB_I2C_SDA, PIN_MODE_OUTPUT_50M, PIN_CNF_ALTERNATE_OPENDRAIN) |   \
356
                                     PIN_CR(GPIOB_SPI_SS_N, PIN_MODE_OUTPUT_50M, PIN_CNF_OUTPUT_PUSHPULL) |      \
357
                                     PIN_CR(GPIOB_SPI_SCLK, PIN_MODE_OUTPUT_50M, PIN_CNF_ALTERNATE_PUSHPULL) |   \
358
                                     PIN_CR(GPIOB_SPI_MISO, PIN_MODE_INPUT, PIN_CNF_INPUT_PULLX) |               \
359
                                     PIN_CR(GPIOB_SPI_MOSI, PIN_MODE_OUTPUT_50M, PIN_CNF_ALTERNATE_PUSHPULL))
360
#define VAL_GPIOBODR                (PIN_ODR_LOW(GPIOB_SW_V33_EN) |                                              \
361
                                     PIN_ODR_LOW(GPIOB_SW_V42_EN) |                                              \
362
                                     PIN_ODR_LOW(GPIOB_SW_V50_EN) |                                              \
363
                                     PIN_ODR_LOW(GPIOB_IO_3) |                                                   \
364
                                     PIN_ODR_LOW(GPIOB_IO_5) |                                                   \
365
                                     PIN_ODR_LOW(GPIOB_IO_6) |                                                   \
366
                                     PIN_ODR_HIGH(GPIOB_SYS_UART_DN) |                                           \
367
                                     PIN_ODR_LOW(GPIOB_PIN7) |                                                   \
368
                                     PIN_ODR_LOW(GPIOB_IO_7) |                                                   \
369
                                     PIN_ODR_LOW(GPIOB_IO_8) |                                                   \
370
                                     PIN_ODR_HIGH(GPIOB_I2C_SCL) |                                               \
371
                                     PIN_ODR_HIGH(GPIOB_I2C_SDA) |                                               \
372
                                     PIN_ODR_HIGH(GPIOB_SPI_SS_N) |                                              \
373
                                     PIN_ODR_HIGH(GPIOB_SPI_SCLK) |                                              \
374
                                     PIN_ODR_HIGH(GPIOB_SPI_MISO) |                                              \
375
                                     PIN_ODR_HIGH(GPIOB_SPI_MOSI))
376

    
377
/*
378
 * GPIOC setup:
379
 *
380
 * PC0  - IO_4                      (input floating)
381
 * PC1  - IO_1                      (input floating)
382
 * PC2  - IO_2                      (input floating)
383
 * PC3  - LED                       (output opendrain high 50MHz)
384
 * PC4  - LIGHT_XLAT                (output pushpull low 50MHz)
385
 * PC5  - SW_V18_EN                 (output pushpull low 50MHz)
386
 * PC6  - SW_VSYS_EN                (output pushpull low 50MHz)
387
 * PC7  - SYS_UART_UP               (output opendrain high 50MHz)
388
 * PC8  - PIN8                      (input floating)
389
 * PC9  - PIN9                      (input floating)
390
 * PC10 - SYS_UART_RX               (input pullup)
391
 * PC11 - SYS_UART_TX               (input pullup)
392
 * PC12 - RS232_D_OFF_N             (output puspull low 50MHz)
393
 * PC13 - PIN13                     (input floating)
394
 * PC14 - SYS_PD_N                  (output opendrain high 50MHz)
395
 * PC15 - PIN15                     (input floating)
396
 */
397
#define VAL_GPIOCIGN                (PIN_IGNORE(GPIOC_SYS_PD_N)) & 0
398
#define VAL_GPIOCCRL                (PIN_CR(GPIOC_IO_4, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                \
399
                                     PIN_CR(GPIOC_IO_1, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                \
400
                                     PIN_CR(GPIOC_IO_2, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                \
401
                                     PIN_CR(GPIOC_LED, PIN_MODE_OUTPUT_50M, PIN_CNF_OUTPUT_OPENDRAIN) |          \
402
                                     PIN_CR(GPIOC_LIGHT_XLAT, PIN_MODE_OUTPUT_50M, PIN_CNF_OUTPUT_PUSHPULL) |    \
403
                                     PIN_CR(GPIOC_SW_V18_EN, PIN_MODE_OUTPUT_50M, PIN_CNF_OUTPUT_PUSHPULL) |     \
404
                                     PIN_CR(GPIOC_SW_VSYS_EN, PIN_MODE_OUTPUT_50M, PIN_CNF_OUTPUT_PUSHPULL) |    \
405
                                     PIN_CR(GPIOC_SYS_UART_UP, PIN_MODE_OUTPUT_50M, PIN_CNF_OUTPUT_OPENDRAIN))
406
#define VAL_GPIOCCRH                (PIN_CR(GPIOC_PIN8, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                \
407
                                     PIN_CR(GPIOC_PIN9, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                \
408
                                     PIN_CR(GPIOC_SYS_UART_RX, PIN_MODE_INPUT, PIN_CNF_INPUT_PULLX) |            \
409
                                     PIN_CR(GPIOC_SYS_UART_TX, PIN_MODE_INPUT, PIN_CNF_INPUT_PULLX) |            \
410
                                     PIN_CR(GPIOC_RS232_D_OFF_N, PIN_MODE_OUTPUT_50M, PIN_CNF_OUTPUT_PUSHPULL) | \
411
                                     PIN_CR(GPIOC_PIN13, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |               \
412
                                     PIN_CR(GPIOC_SYS_PD_N, PIN_MODE_OUTPUT_50M, PIN_CNF_OUTPUT_OPENDRAIN) |     \
413
                                     PIN_CR(GPIOC_PIN15, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING))
414
#define VAL_GPIOCODR                (PIN_ODR_LOW(GPIOC_IO_4) |                                                   \
415
                                     PIN_ODR_LOW(GPIOC_IO_1) |                                                   \
416
                                     PIN_ODR_LOW(GPIOC_IO_2) |                                                   \
417
                                     PIN_ODR_HIGH(GPIOC_LED) |                                                   \
418
                                     PIN_ODR_LOW(GPIOC_LIGHT_XLAT) |                                             \
419
                                     PIN_ODR_LOW(GPIOC_SW_V18_EN) |                                              \
420
                                     PIN_ODR_LOW(GPIOC_SW_VSYS_EN) |                                             \
421
                                     PIN_ODR_HIGH(GPIOC_SYS_UART_UP) |                                           \
422
                                     PIN_ODR_LOW(GPIOC_PIN8) |                                                   \
423
                                     PIN_ODR_LOW(GPIOC_PIN9) |                                                   \
424
                                     PIN_ODR_HIGH(GPIOC_SYS_UART_RX) |                                           \
425
                                     PIN_ODR_HIGH(GPIOC_SYS_UART_TX) |                                           \
426
                                     PIN_ODR_LOW(GPIOC_RS232_D_OFF_N) |                                          \
427
                                     PIN_ODR_LOW(GPIOC_PIN13) |                                                  \
428
                                     PIN_ODR_HIGH(GPIOC_SYS_PD_N) |                                              \
429
                                     PIN_ODR_LOW(GPIOC_PIN15))
430

    
431
/*
432
 * GPIOD setup:
433
 *
434
 * PD0  - OSC_IN                    (input floating)
435
 * PD1  - OSC_OUT                   (input floating)
436
 * PD2  - SYS_INT_N                 (output opendrain low 50MHz)
437
 * PD3  - PIN3                      (input floating)
438
 * PD4  - PIN4                      (input floating)
439
 * PD5  - PIN5                      (input floating)
440
 * PD6  - PIN6                      (input floating)
441
 * PD7  - PIN7                      (input floating)
442
 * PD8  - PIN8                      (input floating)
443
 * PD9  - PIN9                      (input floating)
444
 * PD10 - PIN10                     (input floating)
445
 * PD11 - PIN11                     (input floating)
446
 * PD12 - PIN12                     (input floating)
447
 * PD13 - PIN13                     (input floating)
448
 * PD14 - PIN14                     (input floating)
449
 * PD15 - PIN15                     (input floating)
450
 */
451
#define VAL_GPIODIGN                (PIN_IGNORE(GPIOD_SYS_INT_N)) & 0
452
#define VAL_GPIODCRL                (PIN_CR(GPIOD_OSC_IN, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |              \
453
                                     PIN_CR(GPIOD_OSC_OUT, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |             \
454
                                     PIN_CR(GPIOD_SYS_INT_N, PIN_MODE_OUTPUT_50M, PIN_CNF_OUTPUT_OPENDRAIN) |    \
455
                                     PIN_CR(GPIOD_PIN3, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                \
456
                                     PIN_CR(GPIOD_PIN4, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                \
457
                                     PIN_CR(GPIOD_PIN5, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                \
458
                                     PIN_CR(GPIOD_PIN6, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                \
459
                                     PIN_CR(GPIOD_PIN7, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING))
460
#define VAL_GPIODCRH                (PIN_CR(GPIOD_PIN8, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                \
461
                                     PIN_CR(GPIOD_PIN9, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                \
462
                                     PIN_CR(GPIOD_PIN10, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |               \
463
                                     PIN_CR(GPIOD_PIN11, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |               \
464
                                     PIN_CR(GPIOD_PIN12, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |               \
465
                                     PIN_CR(GPIOD_PIN13, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |               \
466
                                     PIN_CR(GPIOD_PIN14, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |               \
467
                                     PIN_CR(GPIOD_PIN15, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING))
468
#define VAL_GPIODODR                (PIN_ODR_HIGH(GPIOD_OSC_IN) |                                                \
469
                                     PIN_ODR_HIGH(GPIOD_OSC_OUT) |                                               \
470
                                     PIN_ODR_LOW(GPIOD_SYS_INT_N) |                                             \
471
                                     PIN_ODR_LOW(GPIOD_PIN3) |                                                   \
472
                                     PIN_ODR_LOW(GPIOD_PIN4) |                                                   \
473
                                     PIN_ODR_LOW(GPIOD_PIN5) |                                                   \
474
                                     PIN_ODR_LOW(GPIOD_PIN6) |                                                   \
475
                                     PIN_ODR_LOW(GPIOD_PIN7) |                                                   \
476
                                     PIN_ODR_LOW(GPIOD_PIN8) |                                                   \
477
                                     PIN_ODR_LOW(GPIOD_PIN9) |                                                   \
478
                                     PIN_ODR_LOW(GPIOD_PIN10) |                                                  \
479
                                     PIN_ODR_LOW(GPIOD_PIN11) |                                                  \
480
                                     PIN_ODR_LOW(GPIOD_PIN12) |                                                  \
481
                                     PIN_ODR_LOW(GPIOD_PIN13) |                                                  \
482
                                     PIN_ODR_LOW(GPIOD_PIN14) |                                                  \
483
                                     PIN_ODR_LOW(GPIOD_PIN15))
484

    
485
/*
486
 * GPIOE setup:
487
 *
488
 * PE0  - PIN0                      (input floating)
489
 * PE1  - PIN1                      (input floating)
490
 * PE2  - PIN2                      (input floating)
491
 * PE3  - PIN3                      (input floating)
492
 * PE4  - PIN4                      (input floating)
493
 * PE5  - PIN5                      (input floating)
494
 * PE6  - PIN6                      (input floating)
495
 * PE7  - PIN7                      (input floating)
496
 * PE8  - PIN8                      (input floating)
497
 * PE9  - PIN9                      (input floating)
498
 * PE10 - PIN10                     (input floating)
499
 * PE11 - PIN11                     (input floating)
500
 * PE12 - PIN12                     (input floating)
501
 * PE13 - PIN13                     (input floating)
502
 * PE14 - PIN14                     (input floating)
503
 * PE15 - PIN15                     (input floating)
504
 */
505
#define VAL_GPIOEIGN                0
506
#define VAL_GPIOECRL                (PIN_CR(GPIOE_PIN0, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                  \
507
                                     PIN_CR(GPIOE_PIN1, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                  \
508
                                     PIN_CR(GPIOE_PIN2, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                  \
509
                                     PIN_CR(GPIOE_PIN3, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                  \
510
                                     PIN_CR(GPIOE_PIN4, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                  \
511
                                     PIN_CR(GPIOE_PIN5, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                  \
512
                                     PIN_CR(GPIOE_PIN6, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                  \
513
                                     PIN_CR(GPIOE_PIN7, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING))
514
#define VAL_GPIOECRH                (PIN_CR(GPIOE_PIN8, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                  \
515
                                     PIN_CR(GPIOE_PIN9, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                  \
516
                                     PIN_CR(GPIOE_PIN10, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                 \
517
                                     PIN_CR(GPIOE_PIN11, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                 \
518
                                     PIN_CR(GPIOE_PIN12, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                 \
519
                                     PIN_CR(GPIOE_PIN13, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                 \
520
                                     PIN_CR(GPIOE_PIN14, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                 \
521
                                     PIN_CR(GPIOE_PIN15, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING))
522
#define VAL_GPIOEODR                (PIN_ODR_LOW(GPIOE_PIN0) |                                                     \
523
                                     PIN_ODR_LOW(GPIOE_PIN1) |                                                     \
524
                                     PIN_ODR_LOW(GPIOE_PIN2) |                                                     \
525
                                     PIN_ODR_LOW(GPIOE_PIN3) |                                                     \
526
                                     PIN_ODR_LOW(GPIOE_PIN4) |                                                     \
527
                                     PIN_ODR_LOW(GPIOE_PIN5) |                                                     \
528
                                     PIN_ODR_LOW(GPIOE_PIN6) |                                                     \
529
                                     PIN_ODR_LOW(GPIOE_PIN7) |                                                     \
530
                                     PIN_ODR_LOW(GPIOE_PIN8) |                                                     \
531
                                     PIN_ODR_LOW(GPIOE_PIN9) |                                                     \
532
                                     PIN_ODR_LOW(GPIOE_PIN10) |                                                    \
533
                                     PIN_ODR_LOW(GPIOE_PIN11) |                                                    \
534
                                     PIN_ODR_LOW(GPIOE_PIN12) |                                                    \
535
                                     PIN_ODR_LOW(GPIOE_PIN13) |                                                    \
536
                                     PIN_ODR_LOW(GPIOE_PIN14) |                                                    \
537
                                     PIN_ODR_LOW(GPIOE_PIN15))
538

    
539
/*
540
 * GPIOF setup:
541
 *
542
 * PF0  - PIN0                      (input floating)
543
 * PF1  - PIN1                      (input floating)
544
 * PF2  - PIN2                      (input floating)
545
 * PF3  - PIN3                      (input floating)
546
 * PF4  - PIN4                      (input floating)
547
 * PF5  - PIN5                      (input floating)
548
 * PF6  - PIN6                      (input floating)
549
 * PF7  - PIN7                      (input floating)
550
 * PF8  - PIN8                      (input floating)
551
 * PF9  - PIN9                      (input floating)
552
 * PF10 - PIN10                     (input floating)
553
 * PF11 - PIN11                     (input floating)
554
 * PF12 - PIN12                     (input floating)
555
 * PF13 - PIN13                     (input floating)
556
 * PF14 - PIN14                     (input floating)
557
 * PF15 - PIN15                     (input floating)
558
 */
559
#define VAL_GPIOFIGN                0
560
#define VAL_GPIOFCRL                (PIN_CR(GPIOF_PIN0, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                  \
561
                                     PIN_CR(GPIOF_PIN1, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                  \
562
                                     PIN_CR(GPIOF_PIN2, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                  \
563
                                     PIN_CR(GPIOF_PIN3, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                  \
564
                                     PIN_CR(GPIOF_PIN4, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                  \
565
                                     PIN_CR(GPIOF_PIN5, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                  \
566
                                     PIN_CR(GPIOF_PIN6, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                  \
567
                                     PIN_CR(GPIOF_PIN7, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING))
568
#define VAL_GPIOFCRH                (PIN_CR(GPIOF_PIN8, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                  \
569
                                     PIN_CR(GPIOF_PIN9, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                  \
570
                                     PIN_CR(GPIOF_PIN10, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                 \
571
                                     PIN_CR(GPIOF_PIN11, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                 \
572
                                     PIN_CR(GPIOF_PIN12, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                 \
573
                                     PIN_CR(GPIOF_PIN13, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                 \
574
                                     PIN_CR(GPIOF_PIN14, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                 \
575
                                     PIN_CR(GPIOF_PIN15, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING))
576
#define VAL_GPIOFODR                (PIN_ODR_LOW(GPIOF_PIN0) |                                                     \
577
                                     PIN_ODR_LOW(GPIOF_PIN1) |                                                     \
578
                                     PIN_ODR_LOW(GPIOF_PIN2) |                                                     \
579
                                     PIN_ODR_LOW(GPIOF_PIN3) |                                                     \
580
                                     PIN_ODR_LOW(GPIOF_PIN4) |                                                     \
581
                                     PIN_ODR_LOW(GPIOF_PIN5) |                                                     \
582
                                     PIN_ODR_LOW(GPIOF_PIN6) |                                                     \
583
                                     PIN_ODR_LOW(GPIOF_PIN7) |                                                     \
584
                                     PIN_ODR_LOW(GPIOF_PIN8) |                                                     \
585
                                     PIN_ODR_LOW(GPIOF_PIN9) |                                                     \
586
                                     PIN_ODR_LOW(GPIOF_PIN10) |                                                    \
587
                                     PIN_ODR_LOW(GPIOF_PIN11) |                                                    \
588
                                     PIN_ODR_LOW(GPIOF_PIN12) |                                                    \
589
                                     PIN_ODR_LOW(GPIOF_PIN13) |                                                    \
590
                                     PIN_ODR_LOW(GPIOF_PIN14) |                                                    \
591
                                     PIN_ODR_LOW(GPIOF_PIN15))
592

    
593
/*
594
 * GPIOG setup:
595
 *
596
 * PG0  - PIN0                      (input floating)
597
 * PG1  - PIN1                      (input floating)
598
 * PG2  - PIN2                      (input floating)
599
 * PG3  - PIN3                      (input floating)
600
 * PG4  - PIN4                      (input floating)
601
 * PG5  - PIN5                      (input floating)
602
 * PG6  - PIN6                      (input floating)
603
 * PG7  - PIN7                      (input floating)
604
 * PG8  - PIN8                      (input floating)
605
 * PG9  - PIN9                      (input floating)
606
 * PG10 - PIN10                     (input floating)
607
 * PG11 - PIN11                     (input floating)
608
 * PG12 - PIN12                     (input floating)
609
 * PG13 - PIN13                     (input floating)
610
 * PG14 - PIN14                     (input floating)
611
 * PG15 - PIN15                     (input floating)
612
 */
613
#define VAL_GPIOGIGN                0
614
#define VAL_GPIOGCRL                (PIN_CR(GPIOG_PIN0, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                  \
615
                                     PIN_CR(GPIOG_PIN1, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                  \
616
                                     PIN_CR(GPIOG_PIN2, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                  \
617
                                     PIN_CR(GPIOG_PIN3, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                  \
618
                                     PIN_CR(GPIOG_PIN4, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                  \
619
                                     PIN_CR(GPIOG_PIN5, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                  \
620
                                     PIN_CR(GPIOG_PIN6, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                  \
621
                                     PIN_CR(GPIOG_PIN7, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING))
622
#define VAL_GPIOGCRH                (PIN_CR(GPIOG_PIN8, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                  \
623
                                     PIN_CR(GPIOG_PIN9, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                  \
624
                                     PIN_CR(GPIOG_PIN10, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                 \
625
                                     PIN_CR(GPIOG_PIN11, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                 \
626
                                     PIN_CR(GPIOG_PIN12, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                 \
627
                                     PIN_CR(GPIOG_PIN13, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                 \
628
                                     PIN_CR(GPIOG_PIN14, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                 \
629
                                     PIN_CR(GPIOG_PIN15, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING))
630
#define VAL_GPIOGODR                (PIN_ODR_LOW(GPIOG_PIN0) |                                                     \
631
                                     PIN_ODR_LOW(GPIOG_PIN1) |                                                     \
632
                                     PIN_ODR_LOW(GPIOG_PIN2) |                                                     \
633
                                     PIN_ODR_LOW(GPIOG_PIN3) |                                                     \
634
                                     PIN_ODR_LOW(GPIOG_PIN4) |                                                     \
635
                                     PIN_ODR_LOW(GPIOG_PIN5) |                                                     \
636
                                     PIN_ODR_LOW(GPIOG_PIN6) |                                                     \
637
                                     PIN_ODR_LOW(GPIOG_PIN7) |                                                     \
638
                                     PIN_ODR_LOW(GPIOG_PIN8) |                                                     \
639
                                     PIN_ODR_LOW(GPIOG_PIN9) |                                                     \
640
                                     PIN_ODR_LOW(GPIOG_PIN10) |                                                    \
641
                                     PIN_ODR_LOW(GPIOG_PIN11) |                                                    \
642
                                     PIN_ODR_LOW(GPIOG_PIN12) |                                                    \
643
                                     PIN_ODR_LOW(GPIOG_PIN13) |                                                    \
644
                                     PIN_ODR_LOW(GPIOG_PIN14) |                                                    \
645
                                     PIN_ODR_LOW(GPIOG_PIN15))
646

    
647
#if !defined(_FROM_ASM_)
648
#ifdef __cplusplus
649
extern "C" {
650
#endif
651
  void boardInit(void);
652
#ifdef __cplusplus
653
}
654
#endif
655
#endif /* _FROM_ASM_ */
656

    
657
#endif /* BOARD_H */
658

    
659
/** @} */