Statistics
| Branch: | Tag: | Revision:

amiro-os / modules / LightRing_1-2 / board.h @ 0b989911

History | View | Annotate | Download (41.2 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 optional peripherals.
65
 */
66
#define BOARD_DW1000_CONNECTED      false
67
#define BOARD_MIC9404x_CONNECTED    true /* Power supply for DW1000 in Light ring */
68

    
69
/*
70
 * IO pins assignments.
71
 */
72
#define GPIOA_USART_CTS             0U
73
#define GPIOA_USART_RTS             1U
74
#define GPIOA_USART_RX              2U
75
#define GPIOA_USART_TX              3U
76
#define GPIOA_LIGHT_BLANK           4U
77
#define GPIOA_LIGHT_SCLK            5U
78
#define GPIOA_LIGHT_MISO            6U
79
#define GPIOA_LIGHT_MOSI            7U
80
#define GPIOA_PIN8                  8U
81
#define GPIOA_PROG_RX               9U
82
#define GPIOA_PROG_TX               10U
83
#define GPIOA_CAN_RX                11U
84
#define GPIOA_CAN_TX                12U
85
#define GPIOA_SWDIO                 13U
86
#define GPIOA_SWCLK                 14U
87
#define GPIOA_RS232_R_EN_N          15U
88

    
89
#define GPIOB_SW_V33_EN             0U
90
#define GPIOB_SW_V42_EN             1U
91
#define GPIOB_SW_V50_EN             2U
92
#define GPIOB_IO_3                  3U
93
#define GPIOB_IO_5                  4U
94
#define GPIOB_IO_6                  5U
95
#define GPIOB_SYS_UART_DN           6U
96
#define GPIOB_PIN7                  7U
97
#define GPIOB_IO_7                  8U
98
#define GPIOB_IO_8                  9U
99
#define GPIOB_I2C_SCL               10U
100
#define GPIOB_I2C_SDA               11U
101
#define GPIOB_SPI_SS_N              12U
102
#define GPIOB_SPI_SCLK              13U
103
#define GPIOB_SPI_MISO              14U
104
#define GPIOB_SPI_MOSI              15U
105

    
106
#define GPIOC_IO_4                  0U
107
#define GPIOC_IO_1                  1U
108
#define GPIOC_IO_2                  2U
109
#define GPIOC_LED                   3U
110
#define GPIOC_LIGHT_XLAT            4U
111
#define GPIOC_SW_V18_EN             5U
112
#define GPIOC_SW_VSYS_EN            6U
113
#define GPIOC_SYS_UART_UP           7U
114
#define GPIOC_PIN8                  8U
115
#define GPIOC_PIN9                  9U
116
#define GPIOC_SYS_UART_RX           10U
117
#define GPIOC_SYS_UART_TX           11U
118
#define GPIOC_RS232_D_OFF_N         12U
119
#define GPIOC_PIN13                 13U
120
#define GPIOC_SYS_PD_N              14U
121
#define GPIOC_PIN15                 15U
122

    
123
#define GPIOD_OSC_IN                0U
124
#define GPIOD_OSC_OUT               1U
125
#define GPIOD_SYS_INT_N             2U
126
#define GPIOD_PIN3                  3U
127
#define GPIOD_PIN4                  4U
128
#define GPIOD_PIN5                  5U
129
#define GPIOD_PIN6                  6U
130
#define GPIOD_PIN7                  7U
131
#define GPIOD_PIN8                  8U
132
#define GPIOD_PIN9                  9U
133
#define GPIOD_PIN10                 10U
134
#define GPIOD_PIN11                 11U
135
#define GPIOD_PIN12                 12U
136
#define GPIOD_PIN13                 13U
137
#define GPIOD_PIN14                 14U
138
#define GPIOD_PIN15                 15U
139

    
140
#define GPIOE_PIN0                  0U
141
#define GPIOE_PIN1                  1U
142
#define GPIOE_PIN2                  2U
143
#define GPIOE_PIN3                  3U
144
#define GPIOE_PIN4                  4U
145
#define GPIOE_PIN5                  5U
146
#define GPIOE_PIN6                  6U
147
#define GPIOE_PIN7                  7U
148
#define GPIOE_PIN8                  8U
149
#define GPIOE_PIN9                  9U
150
#define GPIOE_PIN10                 10U
151
#define GPIOE_PIN11                 11U
152
#define GPIOE_PIN12                 12U
153
#define GPIOE_PIN13                 13U
154
#define GPIOE_PIN14                 14U
155
#define GPIOE_PIN15                 15U
156

    
157
#define GPIOF_PIN0                  0U
158
#define GPIOF_PIN1                  1U
159
#define GPIOF_PIN2                  2U
160
#define GPIOF_PIN3                  3U
161
#define GPIOF_PIN4                  4U
162
#define GPIOF_PIN5                  5U
163
#define GPIOF_PIN6                  6U
164
#define GPIOF_PIN7                  7U
165
#define GPIOF_PIN8                  8U
166
#define GPIOF_PIN9                  9U
167
#define GPIOF_PIN10                 10U
168
#define GPIOF_PIN11                 11U
169
#define GPIOF_PIN12                 12U
170
#define GPIOF_PIN13                 13U
171
#define GPIOF_PIN14                 14U
172
#define GPIOF_PIN15                 15U
173

    
174
#define GPIOG_PIN0                  0U
175
#define GPIOG_PIN1                  1U
176
#define GPIOG_PIN2                  2U
177
#define GPIOG_PIN3                  3U
178
#define GPIOG_PIN4                  4U
179
#define GPIOG_PIN5                  5U
180
#define GPIOG_PIN6                  6U
181
#define GPIOG_PIN7                  7U
182
#define GPIOG_PIN8                  8U
183
#define GPIOG_PIN9                  9U
184
#define GPIOG_PIN10                 10U
185
#define GPIOG_PIN11                 11U
186
#define GPIOG_PIN12                 12U
187
#define GPIOG_PIN13                 13U
188
#define GPIOG_PIN14                 14U
189
#define GPIOG_PIN15                 15U
190

    
191
/*
192
 * IO lines assignments.
193
 */
194
#define LINE_USART_CTS              PAL_LINE(GPIOA, GPIOA_USART_CTS)
195
#define LINE_USART_RTS              PAL_LINE(GPIOA, GPIOA_USART_RTS)
196
#define LINE_USART_RX               PAL_LINE(GPIOA, GPIOA_USART_RX)
197
#define LINE_USART_TX               PAL_LINE(GPIOA, GPIOA_USART_TX)
198
#define LINE_LIGHT_BLANK            PAL_LINE(GPIOA, GPIOA_LIGHT_BLANK)
199
#define LINE_LIGHT_SCLK             PAL_LINE(GPIOA, GPIOA_LIGHT_SCLK)
200
#define LINE_LIGHT_MISO             PAL_LINE(GPIOA, GPIOA_LIGHT_MISO)
201
#define LINE_LIGHT_MOSI             PAL_LINE(GPIOA, GPIOA_LIGHT_MOSI)
202
#define LINE_PROG_RX                PAL_LINE(GPIOA, GPIOA_PROG_RX)
203
#define LINE_PROG_TX                PAL_LINE(GPIOA, GPIOA_PROG_TX)
204
#define LINE_CAN_RX                 PAL_LINE(GPIOA, GPIOA_CAN_RX)
205
#define LINE_CAN_TX                 PAL_LINE(GPIOA, GPIOA_CAN_TX)
206
#define LINE_SWDIO                  PAL_LINE(GPIOA, GPIOA_SWDIO)
207
#define LINE_SWCLK                  PAL_LINE(GPIOA, GPIOA_SWCLK)
208
#define LINE_RS232_R_EN_N           PAL_LINE(GPIOA, GPIOA_RS232_R_EN_N)
209

    
210
#define LINE_SW_V33_EN              PAL_LINE(GPIOB, GPIOB_SW_V33_EN)
211
#define LINE_SW_V42_EN              PAL_LINE(GPIOB, GPIOB_SW_V42_EN)
212
#define LINE_SW_V50_EN              PAL_LINE(GPIOB, GPIOB_SW_V50_EN)
213
#define LINE_IO_3                   PAL_LINE(GPIOB, GPIOB_IO_3)
214
#define LINE_IO_5                   PAL_LINE(GPIOB, GPIOB_IO_5)
215
#define LINE_IO_6                   PAL_LINE(GPIOB, GPIOB_IO_6)
216
#define LINE_SYS_UART_DN            PAL_LINE(GPIOB, GPIOB_SYS_UART_DN)
217
#define LINE_IO_7                   PAL_LINE(GPIOB, GPIOB_IO_7)
218
#define LINE_IO_8                   PAL_LINE(GPIOB, GPIOB_IO_8)
219
#define LINE_I2C_SCL                PAL_LINE(GPIOB, GPIOB_I2C_SCL)
220
#define LINE_I2C_SDA                PAL_LINE(GPIOB, GPIOB_I2C_SDA)
221
#define LINE_SPI_SS_N               PAL_LINE(GPIOB, GPIOB_SPI_SS_N)
222
#define LINE_SPI_SCLK               PAL_LINE(GPIOB, GPIOB_SPI_SCLK)
223
#define LINE_SPI_MISO               PAL_LINE(GPIOB, GPIOB_SPI_MISO)
224
#define LINE_SPI_MOSI               PAL_LINE(GPIOB, GPIOB_SPI_MOSI)
225

    
226
#define LINE_IO_4                   PAL_LINE(GPIOC, GPIOC_IO_4)
227
#define LINE_IO_1                   PAL_LINE(GPIOC, GPIOC_IO_1)
228
#define LINE_IO_2                   PAL_LINE(GPIOC, GPIOC_IO_2)
229
#define LINE_LED                    PAL_LINE(GPIOC, GPIOC_LED)
230
#define LINE_LIGHT_XLAT             PAL_LINE(GPIOC, GPIOC_LIGHT_XLAT)
231
#define LINE_SW_V18_EN              PAL_LINE(GPIOC, GPIOC_SW_V18_EN)
232
#define LINE_SW_VSYS_EN             PAL_LINE(GPIOC, GPIOC_SW_VSYS_EN)
233
#define LINE_SYS_UART_UP            PAL_LINE(GPIOC, GPIOC_SYS_UART_UP)
234
#define LINE_SYS_UART_RX            PAL_LINE(GPIOC, GPIOC_SYS_UART_RX)
235
#define LINE_SYS_UART_TX            PAL_LINE(GPIOC, GPIOC_SYS_UART_TX)
236
#define LINE_RS232_D_OFF_N          PAL_LINE(GPIOC, GPIOC_RS232_D_OFF_N)
237
#define LINE_SYS_PD_N               PAL_LINE(GPIOC, GPIOC_SYS_PD_N)
238

    
239
#define LINE_SYS_INT_N              PAL_LINE(GPIOD, GPIOD_SYS_INT_N)
240

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

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

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

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

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

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

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

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

    
640
#if !defined(_FROM_ASM_)
641
#ifdef __cplusplus
642
extern "C" {
643
#endif
644
  void boardInit(void);
645
#ifdef __cplusplus
646
}
647
#endif
648
#endif /* _FROM_ASM_ */
649

    
650
#endif /* BOARD_H */
651

    
652
/** @} */