diff options
Diffstat (limited to 'lib/chibios/os/hal/boards/OLIMEX_STM32_P103/board.h')
-rw-r--r-- | lib/chibios/os/hal/boards/OLIMEX_STM32_P103/board.h | 169 |
1 files changed, 169 insertions, 0 deletions
diff --git a/lib/chibios/os/hal/boards/OLIMEX_STM32_P103/board.h b/lib/chibios/os/hal/boards/OLIMEX_STM32_P103/board.h new file mode 100644 index 000000000..4d817c636 --- /dev/null +++ b/lib/chibios/os/hal/boards/OLIMEX_STM32_P103/board.h | |||
@@ -0,0 +1,169 @@ | |||
1 | /* | ||
2 | ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio | ||
3 | |||
4 | Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | you may not use this file except in compliance with the License. | ||
6 | You may obtain a copy of the License at | ||
7 | |||
8 | http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | |||
10 | Unless required by applicable law or agreed to in writing, software | ||
11 | distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | See the License for the specific language governing permissions and | ||
14 | limitations under the License. | ||
15 | */ | ||
16 | |||
17 | #ifndef _BOARD_H_ | ||
18 | #define _BOARD_H_ | ||
19 | |||
20 | /* | ||
21 | * Setup for the Olimex STM32-P103 proto board. | ||
22 | */ | ||
23 | |||
24 | /* | ||
25 | * Board identifier. | ||
26 | */ | ||
27 | #define BOARD_OLIMEX_STM32_P103 | ||
28 | #define BOARD_NAME "Olimex STM32-P103" | ||
29 | |||
30 | /* | ||
31 | * Board frequencies. | ||
32 | */ | ||
33 | #define STM32_LSECLK 32768 | ||
34 | #define STM32_HSECLK 8000000 | ||
35 | |||
36 | /* | ||
37 | * MCU type, supported types are defined in ./os/hal/platforms/hal_lld.h. | ||
38 | */ | ||
39 | #define STM32F103xB | ||
40 | |||
41 | /* | ||
42 | * IO pins assignments. | ||
43 | */ | ||
44 | #define GPIOA_BUTTON 0 | ||
45 | #define GPIOA_SPI1NSS 4 | ||
46 | |||
47 | #define GPIOB_SPI2NSS 12 | ||
48 | |||
49 | #define GPIOC_USB_P 4 | ||
50 | #define GPIOC_MMCWP 6 | ||
51 | #define GPIOC_MMCCP 7 | ||
52 | #define GPIOC_CAN_CNTL 10 | ||
53 | #define GPIOC_USB_DISC 11 | ||
54 | #define GPIOC_LED 12 | ||
55 | |||
56 | /* | ||
57 | * IO lines assignments. | ||
58 | */ | ||
59 | #define LINE_BUTTON PAL_LINE(GPIOA, 0U) | ||
60 | #define LINE_SPI1NSS PAL_LINE(GPIOA, 4U) | ||
61 | #define LINE_SPI2NSS PAL_LINE(GPIOB, 12U) | ||
62 | #define LINE_USB_P PAL_LINE(GPIOC, 4U) | ||
63 | #define LINE_MMCWP PAL_LINE(GPIOC, 6U) | ||
64 | #define LINE_MMCCP PAL_LINE(GPIOC, 7U) | ||
65 | #define LINE_CAN_CNTL PAL_LINE(GPIOC, 10U) | ||
66 | #define LINE_USB_DISC PAL_LINE(GPIOC, 11U) | ||
67 | #define LINE_LED PAL_LINE(GPIOC, 12U) | ||
68 | |||
69 | /* | ||
70 | * I/O ports initial setup, this configuration is established soon after reset | ||
71 | * in the initialization code. | ||
72 | * | ||
73 | * The digits have the following meaning: | ||
74 | * 0 - Analog input. | ||
75 | * 1 - Push Pull output 10MHz. | ||
76 | * 2 - Push Pull output 2MHz. | ||
77 | * 3 - Push Pull output 50MHz. | ||
78 | * 4 - Digital input. | ||
79 | * 5 - Open Drain output 10MHz. | ||
80 | * 6 - Open Drain output 2MHz. | ||
81 | * 7 - Open Drain output 50MHz. | ||
82 | * 8 - Digital input with PullUp or PullDown resistor depending on ODR. | ||
83 | * 9 - Alternate Push Pull output 10MHz. | ||
84 | * A - Alternate Push Pull output 2MHz. | ||
85 | * B - Alternate Push Pull output 50MHz. | ||
86 | * C - Reserved. | ||
87 | * D - Alternate Open Drain output 10MHz. | ||
88 | * E - Alternate Open Drain output 2MHz. | ||
89 | * F - Alternate Open Drain output 50MHz. | ||
90 | * Please refer to the STM32 Reference Manual for details. | ||
91 | */ | ||
92 | |||
93 | /* | ||
94 | * Port A setup. | ||
95 | * Everything input with pull-up except: | ||
96 | * PA0 - Normal input (BUTTON). | ||
97 | * PA2 - Alternate output (USART2 TX). | ||
98 | * PA3 - Normal input (USART2 RX). | ||
99 | * PA11 - Normal input (USB DM). | ||
100 | * PA12 - Normal input (USB DP). | ||
101 | */ | ||
102 | #define VAL_GPIOACRL 0x88884B84 /* PA7...PA0 */ | ||
103 | #define VAL_GPIOACRH 0x88844888 /* PA15...PA8 */ | ||
104 | #define VAL_GPIOAODR 0xFFFFFFFF | ||
105 | |||
106 | /* | ||
107 | * Port B setup. | ||
108 | * Everything input with pull-up except: | ||
109 | * PB13 - Alternate output (MMC SPI2 SCK). | ||
110 | * PB14 - Normal input (MMC SPI2 MISO). | ||
111 | * PB15 - Alternate output (MMC SPI2 MOSI). | ||
112 | */ | ||
113 | #define VAL_GPIOBCRL 0x88888888 /* PB7...PB0 */ | ||
114 | #define VAL_GPIOBCRH 0xB4B88888 /* PB15...PB8 */ | ||
115 | #define VAL_GPIOBODR 0xFFFFFFFF | ||
116 | |||
117 | /* | ||
118 | * Port C setup. | ||
119 | * Everything input with pull-up except: | ||
120 | * PC4 - Normal input because there is an external resistor. | ||
121 | * PC6 - Normal input because there is an external resistor. | ||
122 | * PC7 - Normal input because there is an external resistor. | ||
123 | * PC10 - Push Pull output (CAN CNTRL). | ||
124 | * PC11 - Push Pull output (USB DISC). | ||
125 | * PC12 - Push Pull output (LED). | ||
126 | */ | ||
127 | #define VAL_GPIOCCRL 0x44848888 /* PC7...PC0 */ | ||
128 | #define VAL_GPIOCCRH 0x88833388 /* PC15...PC8 */ | ||
129 | #define VAL_GPIOCODR 0xFFFFFFFF | ||
130 | |||
131 | /* | ||
132 | * Port D setup. | ||
133 | * Everything input with pull-up except: | ||
134 | * PD0 - Normal input (XTAL). | ||
135 | * PD1 - Normal input (XTAL). | ||
136 | */ | ||
137 | #define VAL_GPIODCRL 0x88888844 /* PD7...PD0 */ | ||
138 | #define VAL_GPIODCRH 0x88888888 /* PD15...PD8 */ | ||
139 | #define VAL_GPIODODR 0xFFFFFFFF | ||
140 | |||
141 | /* | ||
142 | * Port E setup. | ||
143 | * Everything input with pull-up except: | ||
144 | */ | ||
145 | #define VAL_GPIOECRL 0x88888888 /* PE7...PE0 */ | ||
146 | #define VAL_GPIOECRH 0x88888888 /* PE15...PE8 */ | ||
147 | #define VAL_GPIOEODR 0xFFFFFFFF | ||
148 | |||
149 | /* | ||
150 | * USB bus activation macro, required by the USB driver. | ||
151 | */ | ||
152 | #define usb_lld_connect_bus(usbp) palClearPad(GPIOC, GPIOC_USB_DISC) | ||
153 | |||
154 | /* | ||
155 | * USB bus de-activation macro, required by the USB driver. | ||
156 | */ | ||
157 | #define usb_lld_disconnect_bus(usbp) palSetPad(GPIOC, GPIOC_USB_DISC) | ||
158 | |||
159 | #if !defined(_FROM_ASM_) | ||
160 | #ifdef __cplusplus | ||
161 | extern "C" { | ||
162 | #endif | ||
163 | void boardInit(void); | ||
164 | #ifdef __cplusplus | ||
165 | } | ||
166 | #endif | ||
167 | #endif /* _FROM_ASM_ */ | ||
168 | |||
169 | #endif /* _BOARD_H_ */ | ||