Statistics
| Branch: | Tag: | Revision:

amiro-os / modules / LightRing_1-0 / board.h @ 27e4a312

History | View | Annotate | Download (39.883 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
/**
20
 * @file
21
 * @brief   LightRing v1.0 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.0 board.
32
 */
33

    
34
/*
35
 * Board identifier.
36
 */
37
#define BOARD_LIGHTRING
38
#define BOARD_NAME              "AMiRo LightRing"
39
#define BOARD_VERSION           "1.0"
40

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

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

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

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

    
64
/*
65
 * IO pins assignments.
66
 */
67
#define GPIOA_PIN0                  0U
68
#define GPIOA_PIN1                  1U
69
#define GPIOA_LASER_RX              2U
70
#define GPIOA_LASER_TX              3U
71
#define GPIOA_LIGHT_BLANK           4U
72
#define GPIOA_LIGHT_SCLK            5U
73
#define GPIOA_PIN6                  6U
74
#define GPIOA_LIGHT_MOSI            7U
75
#define GPIOA_PIN8                  8U
76
#define GPIOA_PROG_RX               9U
77
#define GPIOA_PROG_TX               10U
78
#define GPIOA_CAN_RX                11U
79
#define GPIOA_CAN_TX                12U
80
#define GPIOA_SWDIO                 13U
81
#define GPIOA_SWCLK                 14U
82
#define GPIOA_PIN15                 15U
83

    
84
#define GPIOB_PIN0                  0U
85
#define GPIOB_PIN1                  1U
86
#define GPIOB_LASER_EN              2U
87
#define GPIOB_PIN3                  3U
88
#define GPIOB_PIN4                  4U
89
#define GPIOB_LASER_OC_N            5U
90
#define GPIOB_SYS_UART_DN           6U
91
#define GPIOB_PIN7                  7U
92
#define GPIOB_WL_GDO2               8U
93
#define GPIOB_WL_GDO0               9U
94
#define GPIOB_MEM_SCL               10U
95
#define GPIOB_MEM_SDA               11U
96
#define GPIOB_WL_SS_N               12U
97
#define GPIOB_WL_SCLK               13U
98
#define GPIOB_WL_MISO               14U
99
#define GPIOB_WL_MOSI               15U
100

    
101
#define GPIOC_PIN0                  0U
102
#define GPIOC_PIN1                  1U
103
#define GPIOC_PIN2                  2U
104
#define GPIOC_PIN3                  3U
105
#define GPIOC_LIGHT_XLAT            4U
106
#define GPIOC_PIN5                  5U
107
#define GPIOC_PIN6                  6U
108
#define GPIOC_PIN7                  7U
109
#define GPIOC_PIN8                  8U
110
#define GPIOC_PIN9                  9U
111
#define GPIOC_SYS_UART_RX           10U
112
#define GPIOC_SYS_UART_TX           11U
113
#define GPIOC_PIN12                 12U
114
#define GPIOC_PIN13                 13U
115
#define GPIOC_SYS_PD_N              14U
116
#define GPIOC_PIN15                 15U
117

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

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

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

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

    
186
/*
187
 * IO lines assignments.
188
 */
189
#define LINE_LASER_RX               PAL_LINE(GPIOA, GPIOA_LASER_RX)
190
#define LINE_LASER_TX               PAL_LINE(GPIOA, GPIOA_LASER_TX)
191
#define LINE_LIGHT_BLANK            PAL_LINE(GPIOA, GPIOA_LIGHT_BLANK)
192
#define LINE_LIGHT_SCLK             PAL_LINE(GPIOA, GPIOA_LIGHT_SCLK)
193
#define LINE_LIGHT_MOSI             PAL_LINE(GPIOA, GPIOA_LIGHT_MOSI)
194
#define LINE_PROG_RX                PAL_LINE(GPIOA, GPIOA_PROG_RX)
195
#define LINE_PROG_TX                PAL_LINE(GPIOA, GPIOA_PROG_TX)
196
#define LINE_CAN_RX                 PAL_LINE(GPIOA, GPIOA_CAN_RX)
197
#define LINE_CAN_TX                 PAL_LINE(GPIOA, GPIOA_CAN_TX)
198
#define LINE_SWDIO                  PAL_LINE(GPIOA, GPIOA_SWDIO)
199
#define LINE_SWCLK                  PAL_LINE(GPIOA, GPIOA_SWCLK)
200

    
201
#define LINE_LASER_EN               PAL_LINE(GPIOB, GPIOB_LASER_EN)
202
#define LINE_LASER_OC_N             PAL_LINE(GPIOB, GPIOB_LASER_OC_N)
203
#define LINE_SYS_UART_DN            PAL_LINE(GPIOB, GPIOB_SYS_UART_DN)
204
#define LINE_WL_GDO2                PAL_LINE(GPIOB, GPIOB_WL_GDO2)
205
#define LINE_WL_GDO0                PAL_LINE(GPIOB, GPIOB_WL_GDO0)
206
#define LINE_MEM_SCL                PAL_LINE(GPIOB, GPIOB_MEM_SCL)
207
#define LINE_MEM_SDA                PAL_LINE(GPIOB, GPIOB_MEM_SDA)
208
#define LINE_WL_SS_N                PAL_LINE(GPIOB, GPIOB_WL_SS_N)
209
#define LINE_WL_SCLK                PAL_LINE(GPIOB, GPIOB_WL_SCLK)
210
#define LINE_WL_MISO                PAL_LINE(GPIOB, GPIOB_WL_MISO)
211
#define LINE_WL_MOSI                PAL_LINE(GPIOB, GPIOB_WL_MOSI)
212

    
213
#define LINE_LIGHT_XLAT             PAL_LINE(GPIOC, GPIOC_LIGHT_XLAT)
214
#define LINE_SYS_UART_RX            PAL_LINE(GPIOC, GPIOC_SYS_UART_RX)
215
#define LINE_SYS_UART_TX            PAL_LINE(GPIOC, GPIOC_SYS_UART_TX)
216
#define LINE_SYS_PD_N               PAL_LINE(GPIOC, GPIOC_SYS_PD_N)
217

    
218
#define LINE_SYS_INT_N              PAL_LINE(GPIOD, GPIOD_SYS_INT_N)
219

    
220
/*
221
 * I/O ports initial setup, this configuration is established soon after reset
222
 * in the initialization code.
223
 * Please refer to the STM32 Reference Manual for details.
224
 */
225
#define PIN_MODE_INPUT              0U
226
#define PIN_MODE_OUTPUT_2M          2U
227
#define PIN_MODE_OUTPUT_10M         1U
228
#define PIN_MODE_OUTPUT_50M         3U
229
#define PIN_CNF_INPUT_ANALOG        0U
230
#define PIN_CNF_INPUT_FLOATING      1U
231
#define PIN_CNF_INPUT_PULLX         2U
232
#define PIN_CNF_OUTPUT_PUSHPULL     0U
233
#define PIN_CNF_OUTPUT_OPENDRAIN    1U
234
#define PIN_CNF_ALTERNATE_PUSHPULL  2U
235
#define PIN_CNF_ALTERNATE_OPENDRAIN 3U
236
#define PIN_CR(pin, mode, cnf)      (((mode) | ((cnf) << 2U)) << (((pin) % 8U) * 4U))
237
#define PIN_ODR_LOW(n)              (0U << (n))
238
#define PIN_ODR_HIGH(n)             (1U << (n))
239
#define PIN_IGNORE(n)               (1U << (n))
240

    
241
/*
242
 * GPIOA setup:
243
 *
244
 * PA0  - PIN0                      (input floating)
245
 * PA1  - PIN1                      (input floating)
246
 * PA2  - LASER_RX                  (alternate pushpull high 50MHz)
247
 * PA3  - LASER_TX                  (input pullup)
248
 * PA4  - LIGHT_BLANK               (output pushpull high 50MHz)
249
 * PA5  - LIGHT_SCLK                (alternate pushpull 50MHz)
250
 * PA6  - PIN6                      (input foating)
251
 * PA7  - LIGHT_MOSI                (alternate pushpull 50MHz)
252
 * PA8  - PIN8                      (input floating)
253
 * PA9  - PROG_RX                   (alternate pushpull 50MHz)
254
 * PA10 - PROG_TX                   (input pullup)
255
 * PA11 - CAN_RX                    (input floating)
256
 * PA12 - CAN_TX                    (alternate pushpull 50MHz)
257
 * PA13 - SWDIO                     (input pullup)
258
 * PA14 - SWCLK                     (input pullup)
259
 * PA15 - PIN15                     (input floating)
260
 */
261
#define VAL_GPIOAIGN                0
262
#define VAL_GPIOACRL                (PIN_CR(GPIOA_PIN0, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                \
263
                                     PIN_CR(GPIOA_PIN1, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                \
264
                                     PIN_CR(GPIOA_LASER_RX, PIN_MODE_OUTPUT_50M, PIN_CNF_ALTERNATE_PUSHPULL) |   \
265
                                     PIN_CR(GPIOA_LASER_TX, PIN_MODE_INPUT, PIN_CNF_INPUT_PULLX) |               \
266
                                     PIN_CR(GPIOA_LIGHT_BLANK, PIN_MODE_OUTPUT_50M, PIN_CNF_OUTPUT_PUSHPULL) |   \
267
                                     PIN_CR(GPIOA_LIGHT_SCLK, PIN_MODE_OUTPUT_50M, PIN_CNF_ALTERNATE_PUSHPULL) | \
268
                                     PIN_CR(GPIOA_PIN6, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                \
269
                                     PIN_CR(GPIOA_LIGHT_MOSI, PIN_MODE_OUTPUT_50M, PIN_CNF_ALTERNATE_PUSHPULL))
270
#define VAL_GPIOACRH                (PIN_CR(GPIOA_PIN8, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                \
271
                                     PIN_CR(GPIOA_PROG_RX, PIN_MODE_OUTPUT_50M, PIN_CNF_ALTERNATE_PUSHPULL) |    \
272
                                     PIN_CR(GPIOA_PROG_TX, PIN_MODE_INPUT, PIN_CNF_INPUT_PULLX) |                \
273
                                     PIN_CR(GPIOA_CAN_RX, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |              \
274
                                     PIN_CR(GPIOA_CAN_TX, PIN_MODE_OUTPUT_50M, PIN_CNF_ALTERNATE_PUSHPULL) |     \
275
                                     PIN_CR(GPIOA_SWDIO, PIN_MODE_INPUT, PIN_CNF_INPUT_PULLX) |                  \
276
                                     PIN_CR(GPIOA_SWCLK, PIN_MODE_INPUT, PIN_CNF_INPUT_PULLX) |                  \
277
                                     PIN_CR(GPIOA_PIN15, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING))
278
#define VAL_GPIOAODR                (PIN_ODR_LOW(GPIOA_PIN0) |                                                   \
279
                                     PIN_ODR_LOW(GPIOA_PIN1) |                                                   \
280
                                     PIN_ODR_HIGH(GPIOA_LASER_RX) |                                              \
281
                                     PIN_ODR_HIGH(GPIOA_LASER_TX) |                                              \
282
                                     PIN_ODR_HIGH(GPIOA_LIGHT_BLANK) |                                           \
283
                                     PIN_ODR_HIGH(GPIOA_LIGHT_SCLK) |                                            \
284
                                     PIN_ODR_LOW(GPIOA_PIN6) |                                                   \
285
                                     PIN_ODR_HIGH(GPIOA_LIGHT_MOSI) |                                            \
286
                                     PIN_ODR_LOW(GPIOA_PIN8) |                                                   \
287
                                     PIN_ODR_HIGH(GPIOA_PROG_RX) |                                               \
288
                                     PIN_ODR_HIGH(GPIOA_PROG_TX) |                                               \
289
                                     PIN_ODR_HIGH(GPIOA_CAN_RX) |                                                \
290
                                     PIN_ODR_HIGH(GPIOA_CAN_TX) |                                                \
291
                                     PIN_ODR_HIGH(GPIOA_SWDIO) |                                                 \
292
                                     PIN_ODR_HIGH(GPIOA_SWCLK) |                                                 \
293
                                     PIN_ODR_LOW(GPIOA_PIN15))
294

    
295
/*
296
 * GPIOB setup:
297
 *
298
 * PB0  - PIN0                      (input floating)
299
 * PB1  - PIN1                      (input floating)
300
 * PB2  - LASER_EN                  (output pushpull low 50MHz)
301
 * PB3  - PIN3                      (input floating)
302
 * PB4  - PIN4                      (input floating)
303
 * PB5  - LASER_OC_N                (input floating)
304
 * PB6  - SYS_UART_DN               (output opendrain high 50MHz)
305
 * PB7  - PIN7                      (input foating)
306
 * PB8  - WL_GDO2                   (input pullup)
307
 * PB9  - WL_GDO0                   (input pullup)
308
 * PB10 - MEM_SCL                   (alternate opendrain 50MHz)
309
 * PB11 - MEM_SDA                   (alternate opendrain 50MHz)
310
 * PB12 - WL_SS_N                   (output pushpull high 50MHz)
311
 * PB13 - WL_SCLK                   (alternate pushpull 50MHz)
312
 * PB14 - WL_MISO                   (input pullup)
313
 * PB15 - WL_MOSI                   (alternate pushpull 50MHz)
314
 */
315
#define VAL_GPIOBIGN                (PIN_IGNORE(GPIOB_SYS_UART_DN)) & 0
316
#define VAL_GPIOBCRL                (PIN_CR(GPIOB_PIN0, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                \
317
                                     PIN_CR(GPIOB_PIN1, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                \
318
                                     PIN_CR(GPIOB_LASER_EN, PIN_MODE_OUTPUT_50M, PIN_CNF_OUTPUT_PUSHPULL) |      \
319
                                     PIN_CR(GPIOB_PIN3, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                \
320
                                     PIN_CR(GPIOB_PIN4, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                \
321
                                     PIN_CR(GPIOB_LASER_OC_N, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |          \
322
                                     PIN_CR(GPIOB_SYS_UART_DN, PIN_MODE_OUTPUT_50M, PIN_CNF_OUTPUT_OPENDRAIN) |  \
323
                                     PIN_CR(GPIOB_PIN7, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING))
324
#define VAL_GPIOBCRH                (PIN_CR(GPIOB_WL_GDO2, PIN_MODE_INPUT, PIN_CNF_INPUT_PULLX) |                \
325
                                     PIN_CR(GPIOB_WL_GDO0, PIN_MODE_INPUT, PIN_CNF_INPUT_PULLX) |                \
326
                                     PIN_CR(GPIOB_MEM_SCL, PIN_MODE_OUTPUT_50M, PIN_CNF_ALTERNATE_OPENDRAIN) |   \
327
                                     PIN_CR(GPIOB_MEM_SDA, PIN_MODE_OUTPUT_50M, PIN_CNF_ALTERNATE_OPENDRAIN) |   \
328
                                     PIN_CR(GPIOB_WL_SS_N, PIN_MODE_OUTPUT_50M, PIN_CNF_OUTPUT_PUSHPULL) |       \
329
                                     PIN_CR(GPIOB_WL_SCLK, PIN_MODE_OUTPUT_50M, PIN_CNF_ALTERNATE_PUSHPULL) |    \
330
                                     PIN_CR(GPIOB_WL_MISO, PIN_MODE_INPUT, PIN_CNF_INPUT_PULLX) |                \
331
                                     PIN_CR(GPIOB_WL_MOSI, PIN_MODE_OUTPUT_50M, PIN_CNF_ALTERNATE_PUSHPULL))
332
#define VAL_GPIOBODR                (PIN_ODR_LOW(GPIOB_PIN0) |                                                   \
333
                                     PIN_ODR_LOW(GPIOB_PIN1) |                                                   \
334
                                     PIN_ODR_LOW(GPIOB_LASER_EN) |                                               \
335
                                     PIN_ODR_LOW(GPIOB_PIN3) |                                                   \
336
                                     PIN_ODR_LOW(GPIOB_PIN4) |                                                   \
337
                                     PIN_ODR_HIGH(GPIOB_LASER_OC_N) |                                            \
338
                                     PIN_ODR_HIGH(GPIOB_SYS_UART_DN) |                                           \
339
                                     PIN_ODR_LOW(GPIOB_PIN7) |                                                   \
340
                                     PIN_ODR_HIGH(GPIOB_WL_GDO2) |                                               \
341
                                     PIN_ODR_HIGH(GPIOB_WL_GDO0) |                                               \
342
                                     PIN_ODR_HIGH(GPIOB_MEM_SCL) |                                               \
343
                                     PIN_ODR_HIGH(GPIOB_MEM_SDA) |                                               \
344
                                     PIN_ODR_HIGH(GPIOB_WL_SS_N) |                                               \
345
                                     PIN_ODR_HIGH(GPIOB_WL_SCLK) |                                               \
346
                                     PIN_ODR_HIGH(GPIOB_WL_MISO) |                                               \
347
                                     PIN_ODR_HIGH(GPIOB_WL_MOSI))
348

    
349
/*
350
 * GPIOC setup:
351
 *
352
 * PC0  - PIN0                      (input floating)
353
 * PC1  - PIN1                      (input floating)
354
 * PC2  - PIN2                      (input floating)
355
 * PC3  - PIN3                      (input floating)
356
 * PC4  - LIGHT_XLAT                (output pushpull high 10MHz)
357
 * PC5  - PIN5                      (input floating)
358
 * PC6  - PIN6                      (input floating)
359
 * PC7  - PIN7                      (input floating)
360
 * PC8  - PIN8                      (input floating)
361
 * PC9  - PIN9                      (input floating)
362
 * PC10 - SYS_UART_RX               (input pullup)
363
 * PC11 - SYS_UART_TX               (input pullup)
364
 * PC12 - PIN12                     (input floating)
365
 * PC13 - PIN13                     (input floating)
366
 * PC14 - SYS_PD_N                  (output opendrain high 50MHz)
367
 * PC15 - PIN15                     (input floating)
368
 */
369
#define VAL_GPIOCIGN                (PIN_IGNORE(GPIOC_SYS_PD_N)) & 0
370
#define VAL_GPIOCCRL                (PIN_CR(GPIOC_PIN0, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                \
371
                                     PIN_CR(GPIOC_PIN1, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                \
372
                                     PIN_CR(GPIOC_PIN2, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                \
373
                                     PIN_CR(GPIOC_PIN3, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                \
374
                                     PIN_CR(GPIOC_LIGHT_XLAT, PIN_MODE_OUTPUT_10M, PIN_CNF_OUTPUT_PUSHPULL) |    \
375
                                     PIN_CR(GPIOC_PIN5, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                \
376
                                     PIN_CR(GPIOC_PIN6, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                \
377
                                     PIN_CR(GPIOC_PIN7, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING))
378
#define VAL_GPIOCCRH                (PIN_CR(GPIOC_PIN8, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                \
379
                                     PIN_CR(GPIOC_PIN9, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                \
380
                                     PIN_CR(GPIOC_SYS_UART_RX, PIN_MODE_INPUT, PIN_CNF_INPUT_PULLX) |            \
381
                                     PIN_CR(GPIOC_SYS_UART_TX, PIN_MODE_INPUT, PIN_CNF_INPUT_PULLX) |            \
382
                                     PIN_CR(GPIOC_PIN12, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |               \
383
                                     PIN_CR(GPIOC_PIN13, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |               \
384
                                     PIN_CR(GPIOC_SYS_PD_N, PIN_MODE_OUTPUT_50M, PIN_CNF_OUTPUT_OPENDRAIN) |     \
385
                                     PIN_CR(GPIOC_PIN15, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING))
386
#define VAL_GPIOCODR                (PIN_ODR_LOW(GPIOC_PIN0) |                                                   \
387
                                     PIN_ODR_LOW(GPIOC_PIN1) |                                                   \
388
                                     PIN_ODR_LOW(GPIOC_PIN2) |                                                   \
389
                                     PIN_ODR_LOW(GPIOC_PIN3) |                                                   \
390
                                     PIN_ODR_LOW(GPIOC_LIGHT_XLAT) |                                             \
391
                                     PIN_ODR_LOW(GPIOC_PIN5) |                                                   \
392
                                     PIN_ODR_LOW(GPIOC_PIN6) |                                                   \
393
                                     PIN_ODR_LOW(GPIOC_PIN7) |                                                   \
394
                                     PIN_ODR_LOW(GPIOC_PIN8) |                                                   \
395
                                     PIN_ODR_LOW(GPIOC_PIN9) |                                                   \
396
                                     PIN_ODR_HIGH(GPIOC_SYS_UART_RX) |                                           \
397
                                     PIN_ODR_HIGH(GPIOC_SYS_UART_TX) |                                           \
398
                                     PIN_ODR_LOW(GPIOC_PIN12) |                                                  \
399
                                     PIN_ODR_LOW(GPIOC_PIN13) |                                                  \
400
                                     PIN_ODR_HIGH(GPIOC_SYS_PD_N) |                                              \
401
                                     PIN_ODR_LOW(GPIOC_PIN15))
402

    
403
/*
404
 * GPIOD setup:
405
 *
406
 * PD0  - OSC_IN                    (input floating)
407
 * PD1  - OSC_OUT                   (input floating)
408
 * PD2  - SYS_INT_N                 (output opendrain low 50MHz)
409
 * PD3  - PIN3                      (input floating)
410
 * PD4  - PIN4                      (input floating)
411
 * PD5  - PIN5                      (input floating)
412
 * PD6  - PIN6                      (input floating)
413
 * PD7  - PIN7                      (input floating)
414
 * PD8  - PIN8                      (input floating)
415
 * PD9  - PIN9                      (input floating)
416
 * PD10 - PIN10                     (input floating)
417
 * PD11 - PIN11                     (input floating)
418
 * PD12 - PIN12                     (input floating)
419
 * PD13 - PIN13                     (input floating)
420
 * PD14 - PIN14                     (input floating)
421
 * PD15 - PIN15                     (input floating)
422
 */
423
#define VAL_GPIODIGN                (PIN_IGNORE(GPIOD_SYS_INT_N)) & 0
424
#define VAL_GPIODCRL                (PIN_CR(GPIOD_OSC_IN, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |              \
425
                                     PIN_CR(GPIOD_OSC_OUT, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |             \
426
                                     PIN_CR(GPIOD_SYS_INT_N, PIN_MODE_OUTPUT_50M, PIN_CNF_OUTPUT_OPENDRAIN) |    \
427
                                     PIN_CR(GPIOD_PIN3, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                \
428
                                     PIN_CR(GPIOD_PIN4, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                \
429
                                     PIN_CR(GPIOD_PIN5, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                \
430
                                     PIN_CR(GPIOD_PIN6, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                \
431
                                     PIN_CR(GPIOD_PIN7, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING))
432
#define VAL_GPIODCRH                (PIN_CR(GPIOD_PIN8, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                \
433
                                     PIN_CR(GPIOD_PIN9, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                \
434
                                     PIN_CR(GPIOD_PIN10, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |               \
435
                                     PIN_CR(GPIOD_PIN11, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |               \
436
                                     PIN_CR(GPIOD_PIN12, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |               \
437
                                     PIN_CR(GPIOD_PIN13, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |               \
438
                                     PIN_CR(GPIOD_PIN14, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |               \
439
                                     PIN_CR(GPIOD_PIN15, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING))
440
#define VAL_GPIODODR                (PIN_ODR_HIGH(GPIOD_OSC_IN) |                                                \
441
                                     PIN_ODR_HIGH(GPIOD_OSC_OUT) |                                               \
442
                                     PIN_ODR_LOW(GPIOD_SYS_INT_N) |                                             \
443
                                     PIN_ODR_LOW(GPIOD_PIN3) |                                                   \
444
                                     PIN_ODR_LOW(GPIOD_PIN4) |                                                   \
445
                                     PIN_ODR_LOW(GPIOD_PIN5) |                                                   \
446
                                     PIN_ODR_LOW(GPIOD_PIN6) |                                                   \
447
                                     PIN_ODR_LOW(GPIOD_PIN7) |                                                   \
448
                                     PIN_ODR_LOW(GPIOD_PIN8) |                                                   \
449
                                     PIN_ODR_LOW(GPIOD_PIN9) |                                                   \
450
                                     PIN_ODR_LOW(GPIOD_PIN10) |                                                  \
451
                                     PIN_ODR_LOW(GPIOD_PIN11) |                                                  \
452
                                     PIN_ODR_LOW(GPIOD_PIN12) |                                                  \
453
                                     PIN_ODR_LOW(GPIOD_PIN13) |                                                  \
454
                                     PIN_ODR_LOW(GPIOD_PIN14) |                                                  \
455
                                     PIN_ODR_LOW(GPIOD_PIN15))
456

    
457
/*
458
 * GPIOE setup:
459
 *
460
 * PE0  - PIN0                      (input floating)
461
 * PE1  - PIN1                      (input floating)
462
 * PE2  - PIN2                      (input floating)
463
 * PE3  - PIN3                      (input floating)
464
 * PE4  - PIN4                      (input floating)
465
 * PE5  - PIN5                      (input floating)
466
 * PE6  - PIN6                      (input floating)
467
 * PE7  - PIN7                      (input floating)
468
 * PE8  - PIN8                      (input floating)
469
 * PE9  - PIN9                      (input floating)
470
 * PE10 - PIN10                     (input floating)
471
 * PE11 - PIN11                     (input floating)
472
 * PE12 - PIN12                     (input floating)
473
 * PE13 - PIN13                     (input floating)
474
 * PE14 - PIN14                     (input floating)
475
 * PE15 - PIN15                     (input floating)
476
 */
477
#define VAL_GPIOEIGN                0
478
#define VAL_GPIOECRL                (PIN_CR(GPIOE_PIN0, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                  \
479
                                     PIN_CR(GPIOE_PIN1, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                  \
480
                                     PIN_CR(GPIOE_PIN2, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                  \
481
                                     PIN_CR(GPIOE_PIN3, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                  \
482
                                     PIN_CR(GPIOE_PIN4, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                  \
483
                                     PIN_CR(GPIOE_PIN5, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                  \
484
                                     PIN_CR(GPIOE_PIN6, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                  \
485
                                     PIN_CR(GPIOE_PIN7, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING))
486
#define VAL_GPIOECRH                (PIN_CR(GPIOE_PIN8, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                  \
487
                                     PIN_CR(GPIOE_PIN9, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                  \
488
                                     PIN_CR(GPIOE_PIN10, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                 \
489
                                     PIN_CR(GPIOE_PIN11, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                 \
490
                                     PIN_CR(GPIOE_PIN12, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                 \
491
                                     PIN_CR(GPIOE_PIN13, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                 \
492
                                     PIN_CR(GPIOE_PIN14, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                 \
493
                                     PIN_CR(GPIOE_PIN15, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING))
494
#define VAL_GPIOEODR                (PIN_ODR_LOW(GPIOE_PIN0) |                                                     \
495
                                     PIN_ODR_LOW(GPIOE_PIN1) |                                                     \
496
                                     PIN_ODR_LOW(GPIOE_PIN2) |                                                     \
497
                                     PIN_ODR_LOW(GPIOE_PIN3) |                                                     \
498
                                     PIN_ODR_LOW(GPIOE_PIN4) |                                                     \
499
                                     PIN_ODR_LOW(GPIOE_PIN5) |                                                     \
500
                                     PIN_ODR_LOW(GPIOE_PIN6) |                                                     \
501
                                     PIN_ODR_LOW(GPIOE_PIN7) |                                                     \
502
                                     PIN_ODR_LOW(GPIOE_PIN8) |                                                     \
503
                                     PIN_ODR_LOW(GPIOE_PIN9) |                                                     \
504
                                     PIN_ODR_LOW(GPIOE_PIN10) |                                                    \
505
                                     PIN_ODR_LOW(GPIOE_PIN11) |                                                    \
506
                                     PIN_ODR_LOW(GPIOE_PIN12) |                                                    \
507
                                     PIN_ODR_LOW(GPIOE_PIN13) |                                                    \
508
                                     PIN_ODR_LOW(GPIOE_PIN14) |                                                    \
509
                                     PIN_ODR_LOW(GPIOE_PIN15))
510

    
511
/*
512
 * GPIOF setup:
513
 *
514
 * PF0  - PIN0                      (input floating)
515
 * PF1  - PIN1                      (input floating)
516
 * PF2  - PIN2                      (input floating)
517
 * PF3  - PIN3                      (input floating)
518
 * PF4  - PIN4                      (input floating)
519
 * PF5  - PIN5                      (input floating)
520
 * PF6  - PIN6                      (input floating)
521
 * PF7  - PIN7                      (input floating)
522
 * PF8  - PIN8                      (input floating)
523
 * PF9  - PIN9                      (input floating)
524
 * PF10 - PIN10                     (input floating)
525
 * PF11 - PIN11                     (input floating)
526
 * PF12 - PIN12                     (input floating)
527
 * PF13 - PIN13                     (input floating)
528
 * PF14 - PIN14                     (input floating)
529
 * PF15 - PIN15                     (input floating)
530
 */
531
#define VAL_GPIOFIGN                0
532
#define VAL_GPIOFCRL                (PIN_CR(GPIOF_PIN0, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                  \
533
                                     PIN_CR(GPIOF_PIN1, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                  \
534
                                     PIN_CR(GPIOF_PIN2, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                  \
535
                                     PIN_CR(GPIOF_PIN3, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                  \
536
                                     PIN_CR(GPIOF_PIN4, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                  \
537
                                     PIN_CR(GPIOF_PIN5, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                  \
538
                                     PIN_CR(GPIOF_PIN6, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                  \
539
                                     PIN_CR(GPIOF_PIN7, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING))
540
#define VAL_GPIOFCRH                (PIN_CR(GPIOF_PIN8, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                  \
541
                                     PIN_CR(GPIOF_PIN9, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                  \
542
                                     PIN_CR(GPIOF_PIN10, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                 \
543
                                     PIN_CR(GPIOF_PIN11, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                 \
544
                                     PIN_CR(GPIOF_PIN12, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                 \
545
                                     PIN_CR(GPIOF_PIN13, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                 \
546
                                     PIN_CR(GPIOF_PIN14, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                 \
547
                                     PIN_CR(GPIOF_PIN15, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING))
548
#define VAL_GPIOFODR                (PIN_ODR_LOW(GPIOF_PIN0) |                                                     \
549
                                     PIN_ODR_LOW(GPIOF_PIN1) |                                                     \
550
                                     PIN_ODR_LOW(GPIOF_PIN2) |                                                     \
551
                                     PIN_ODR_LOW(GPIOF_PIN3) |                                                     \
552
                                     PIN_ODR_LOW(GPIOF_PIN4) |                                                     \
553
                                     PIN_ODR_LOW(GPIOF_PIN5) |                                                     \
554
                                     PIN_ODR_LOW(GPIOF_PIN6) |                                                     \
555
                                     PIN_ODR_LOW(GPIOF_PIN7) |                                                     \
556
                                     PIN_ODR_LOW(GPIOF_PIN8) |                                                     \
557
                                     PIN_ODR_LOW(GPIOF_PIN9) |                                                     \
558
                                     PIN_ODR_LOW(GPIOF_PIN10) |                                                    \
559
                                     PIN_ODR_LOW(GPIOF_PIN11) |                                                    \
560
                                     PIN_ODR_LOW(GPIOF_PIN12) |                                                    \
561
                                     PIN_ODR_LOW(GPIOF_PIN13) |                                                    \
562
                                     PIN_ODR_LOW(GPIOF_PIN14) |                                                    \
563
                                     PIN_ODR_LOW(GPIOF_PIN15))
564

    
565
/*
566
 * GPIOG setup:
567
 *
568
 * PG0  - PIN0                      (input floating)
569
 * PG1  - PIN1                      (input floating)
570
 * PG2  - PIN2                      (input floating)
571
 * PG3  - PIN3                      (input floating)
572
 * PG4  - PIN4                      (input floating)
573
 * PG5  - PIN5                      (input floating)
574
 * PG6  - PIN6                      (input floating)
575
 * PG7  - PIN7                      (input floating)
576
 * PG8  - PIN8                      (input floating)
577
 * PG9  - PIN9                      (input floating)
578
 * PG10 - PIN10                     (input floating)
579
 * PG11 - PIN11                     (input floating)
580
 * PG12 - PIN12                     (input floating)
581
 * PG13 - PIN13                     (input floating)
582
 * PG14 - PIN14                     (input floating)
583
 * PG15 - PIN15                     (input floating)
584
 */
585
#define VAL_GPIOGIGN                0
586
#define VAL_GPIOGCRL                (PIN_CR(GPIOG_PIN0, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                  \
587
                                     PIN_CR(GPIOG_PIN1, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                  \
588
                                     PIN_CR(GPIOG_PIN2, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                  \
589
                                     PIN_CR(GPIOG_PIN3, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                  \
590
                                     PIN_CR(GPIOG_PIN4, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                  \
591
                                     PIN_CR(GPIOG_PIN5, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                  \
592
                                     PIN_CR(GPIOG_PIN6, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                  \
593
                                     PIN_CR(GPIOG_PIN7, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING))
594
#define VAL_GPIOGCRH                (PIN_CR(GPIOG_PIN8, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                  \
595
                                     PIN_CR(GPIOG_PIN9, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                  \
596
                                     PIN_CR(GPIOG_PIN10, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                 \
597
                                     PIN_CR(GPIOG_PIN11, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                 \
598
                                     PIN_CR(GPIOG_PIN12, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                 \
599
                                     PIN_CR(GPIOG_PIN13, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                 \
600
                                     PIN_CR(GPIOG_PIN14, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING) |                 \
601
                                     PIN_CR(GPIOG_PIN15, PIN_MODE_INPUT, PIN_CNF_INPUT_FLOATING))
602
#define VAL_GPIOGODR                (PIN_ODR_LOW(GPIOG_PIN0) |                                                     \
603
                                     PIN_ODR_LOW(GPIOG_PIN1) |                                                     \
604
                                     PIN_ODR_LOW(GPIOG_PIN2) |                                                     \
605
                                     PIN_ODR_LOW(GPIOG_PIN3) |                                                     \
606
                                     PIN_ODR_LOW(GPIOG_PIN4) |                                                     \
607
                                     PIN_ODR_LOW(GPIOG_PIN5) |                                                     \
608
                                     PIN_ODR_LOW(GPIOG_PIN6) |                                                     \
609
                                     PIN_ODR_LOW(GPIOG_PIN7) |                                                     \
610
                                     PIN_ODR_LOW(GPIOG_PIN8) |                                                     \
611
                                     PIN_ODR_LOW(GPIOG_PIN9) |                                                     \
612
                                     PIN_ODR_LOW(GPIOG_PIN10) |                                                    \
613
                                     PIN_ODR_LOW(GPIOG_PIN11) |                                                    \
614
                                     PIN_ODR_LOW(GPIOG_PIN12) |                                                    \
615
                                     PIN_ODR_LOW(GPIOG_PIN13) |                                                    \
616
                                     PIN_ODR_LOW(GPIOG_PIN14) |                                                    \
617
                                     PIN_ODR_LOW(GPIOG_PIN15))
618

    
619
#if !defined(_FROM_ASM_)
620
#ifdef __cplusplus
621
extern "C" {
622
#endif
623
  void boardInit(void);
624
#ifdef __cplusplus
625
}
626
#endif
627
#endif /* _FROM_ASM_ */
628

    
629
#endif /* _BOARD_H_ */
630

    
631
/** @} */