Statistics
| Branch: | Tag: | Revision:

amiro-os / modules / NUCLEO-F103RB / board.h @ 0f60c8ad

History | View | Annotate | Download (8.59 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
#ifndef BOARD_H
20
#define BOARD_H
21

    
22
/*
23
 * Setup for the ST NUCLEO64-F103RB board.
24
 */
25

    
26
/*
27
 * Board identifier.
28
 */
29
#define BOARD_ST_NUCLEO64_F103RB
30
#define BOARD_NAME              "STMicroelectronics NUCLEO-F103RB"
31

    
32
/*
33
 * Board frequencies.
34
 */
35
#define STM32_LSECLK            0
36

    
37
#if defined(NUCLEO_EXTERNAL_OSCILLATOR)
38
#define STM32_HSECLK            8000000
39
#define STM32_HSE_BYPASS
40

    
41
#elif defined(NUCLEO_HSE_CRYSTAL)
42
#define STM32_HSECLK            8000000
43

    
44
#else
45
#define STM32_HSECLK            0
46
#endif
47

    
48
/*
49
 * MCU type, supported types are defined in ./os/hal/platforms/hal_lld.h.
50
 */
51
#define STM32F103xB
52

    
53
/*
54
 * IO pins assignments.
55
 */
56
#define GPIOA_ARD_A0                0U
57
#define GPIOA_ADC1_IN0              0U
58
#define GPIOA_ARD_A1                1U
59
#define GPIOA_ADC1_IN1              1U
60
#define GPIOA_ARD_D1                2U
61
#define GPIOA_USART2_TX             2U
62
#define GPIOA_ARD_D0                3U
63
#define GPIOA_USART2_RX             3U
64
#define GPIOA_ARD_A2                4U
65
#define GPIOA_ADC1_IN4              4U
66
#define GPIOA_LED_GREEN             5U
67
#define GPIOA_ARD_D13               5U
68
#define GPIOA_ARD_D12               6U
69
#define GPIOA_ARD_D11               7U
70
#define GPIOA_ARD_D7                8U
71
#define GPIOA_ARD_D8                9U
72
#define GPIOA_ARD_D2                10U
73
#define GPIOA_PIN11                 11U
74
#define GPIOA_PIN12                 12U
75
#define GPIOA_SWDIO                 13U
76
#define GPIOA_SWCLK                 14U
77
#define GPIOA_PIN15                 15U
78

    
79
#define GPIOB_ARD_A3                0U
80
#define GPIOB_ADC1_IN8              0U
81
#define GPIOB_PIN1                  1U
82
#define GPIOB_PIN2                  2U
83
#define GPIOB_SWO                   3U
84
#define GPIOB_ARD_D3                3U
85
#define GPIOB_ARD_D5                4U
86
#define GPIOB_ARD_D4                5U
87
#define GPIOB_ARD_D10               6U
88
#define GPIOB_PIN7                  7U
89
#define GPIOB_ARD_D15               8U
90
#define GPIOB_ARD_D14               9U
91
#define GPIOB_ARD_D6                10U
92
#define GPIOB_PIN11                 11U
93
#define GPIOB_PIN12                 12U
94
#define GPIOB_PIN13                 13U
95
#define GPIOB_PIN14                 14U
96
#define GPIOB_PIN15                 15U
97

    
98
#define GPIOC_ARD_A5                0U
99
#define GPIOC_ADC1_IN11             0U
100
#define GPIOC_ARD_A4                1U
101
#define GPIOC_ADC1_IN10             1U
102
#define GPIOC_PIN2                  2U
103
#define GPIOC_PIN3                  3U
104
#define GPIOC_PIN4                  4U
105
#define GPIOC_PIN5                  5U
106
#define GPIOC_PIN6                  6U
107
#define GPIOC_ARD_D9                7U
108
#define GPIOC_PIN8                  8U
109
#define GPIOC_PIN9                  9U
110
#define GPIOC_PIN10                 10U
111
#define GPIOC_PIN11                 11U
112
#define GPIOC_PIN12                 12U
113
#define GPIOC_BUTTON                13U
114
#define GPIOC_PIN14                 14U
115
#define GPIOC_PIN15                 15U
116

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

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

    
153
#define GPIOF_PIN0                  0U
154
#define GPIOF_PIN1                  1U
155
#define GPIOF_PIN2                  2U
156
#define GPIOF_PIN3                  3U
157
#define GPIOF_PIN4                  4U
158
#define GPIOF_PIN5                  5U
159
#define GPIOF_PIN6                  6U
160
#define GPIOF_PIN7                  7U
161
#define GPIOF_PIN8                  8U
162
#define GPIOF_PIN9                  9U
163
#define GPIOF_PIN10                 10U
164
#define GPIOF_PIN11                 11U
165
#define GPIOF_PIN12                 12U
166
#define GPIOF_PIN13                 13U
167
#define GPIOF_PIN14                 14U
168
#define GPIOF_PIN15                 15U
169
/*
170
 * I/O ports initial setup, this configuration is established soon after reset
171
 * in the initialization code.
172
 *
173
 * The digits have the following meaning:
174
 *   0 - Analog input.
175
 *   1 - Push Pull output 10MHz.
176
 *   2 - Push Pull output 2MHz.
177
 *   3 - Push Pull output 50MHz.
178
 *   4 - Digital input.
179
 *   5 - Open Drain output 10MHz.
180
 *   6 - Open Drain output 2MHz.
181
 *   7 - Open Drain output 50MHz.
182
 *   8 - Digital input with PullUp or PullDown resistor depending on ODR.
183
 *   9 - Alternate Push Pull output 10MHz.
184
 *   A - Alternate Push Pull output 2MHz.
185
 *   B - Alternate Push Pull output 50MHz.
186
 *   C - Reserved.
187
 *   D - Alternate Open Drain output 10MHz.
188
 *   E - Alternate Open Drain output 2MHz.
189
 *   F - Alternate Open Drain output 50MHz.
190
 * Please refer to the STM32 Reference Manual for details.
191
 */
192

    
193
/*
194
 * Port A setup.
195
 * Everything input with pull-up except:
196
 * PA2  - Alternate output          (GPIOA_ARD_D1, GPIOA_USART2_TX).
197
 * PA3  - Normal input              (GPIOA_ARD_D0, GPIOA_USART2_RX).
198
 * PA5  - Push Pull output          (GPIOA_LED_GREEN).
199
 * PA13 - Pull-up input             (GPIOA_SWDIO).
200
 * PA14 - Pull-down input           (GPIOA_SWCLK).
201
 */
202
#define VAL_GPIOACRL            0x88384B88      /*  PA7...PA0 */
203
#define VAL_GPIOACRH            0x88888888      /* PA15...PA8 */
204
#define VAL_GPIOAODR            0xFFFFBFDF
205

    
206
/*
207
 * Port B setup.
208
 * Everything input with pull-up except:
209
 * PB3  - Pull-up input             (GPIOA_SWO).
210
 */
211
#define VAL_GPIOBCRL            0x88888888      /*  PB7...PB0 */
212
#define VAL_GPIOBCRH            0x88888888      /* PB15...PB8 */
213
#define VAL_GPIOBODR            0xFFFFFFFF
214

    
215
/*
216
 * Port C setup.
217
 * Everything input with pull-up except:
218
 * PC13 - Normal input              (GPIOC_BUTTON).
219
 */
220
#define VAL_GPIOCCRL            0x88888888      /*  PC7...PC0 */
221
#define VAL_GPIOCCRH            0x88488888      /* PC15...PC8 */
222
#define VAL_GPIOCODR            0xFFFFFFFF
223

    
224
/*
225
 * Port D setup.
226
 * Everything input with pull-up except:
227
 * PD0  - Normal input              (GPIOD_OSC_IN).
228
 * PD1  - Normal input              (GPIOD_OSC_OUT).
229
 */
230
#define VAL_GPIODCRL            0x88888844      /*  PD7...PD0 */
231
#define VAL_GPIODCRH            0x88888888      /* PD15...PD8 */
232
#define VAL_GPIODODR            0xFFFFFFFF
233

    
234
/*
235
 * Port E setup.
236
 * Everything input with pull-up except:
237
 */
238
#define VAL_GPIOECRL            0x88888888      /*  PE7...PE0 */
239
#define VAL_GPIOECRH            0x88888888      /* PE15...PE8 */
240
#define VAL_GPIOEODR            0xFFFFFFFF
241

    
242
/*
243
 * USB bus activation macro, required by the USB driver.
244
 */
245
#define usb_lld_connect_bus(usbp)
246

    
247
/*
248
 * USB bus de-activation macro, required by the USB driver.
249
 */
250
#define usb_lld_disconnect_bus(usbp)
251

    
252
#if !defined(_FROM_ASM_)
253
#ifdef __cplusplus
254
extern "C" {
255
#endif
256
  void boardInit(void);
257
#ifdef __cplusplus
258
}
259
#endif
260
#endif /* _FROM_ASM_ */
261

    
262
#endif /* BOARD_H */