diff options
Diffstat (limited to 'lib/chibios/os/hal/ports/STM32/STM32F0xx/stm32_registry.h')
-rw-r--r-- | lib/chibios/os/hal/ports/STM32/STM32F0xx/stm32_registry.h | 2222 |
1 files changed, 2222 insertions, 0 deletions
diff --git a/lib/chibios/os/hal/ports/STM32/STM32F0xx/stm32_registry.h b/lib/chibios/os/hal/ports/STM32/STM32F0xx/stm32_registry.h new file mode 100644 index 000000000..2c97ab4a7 --- /dev/null +++ b/lib/chibios/os/hal/ports/STM32/STM32F0xx/stm32_registry.h | |||
@@ -0,0 +1,2222 @@ | |||
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 | /** | ||
18 | * @file STM32F0xx/stm32_registry.h | ||
19 | * @brief STM32F0xx capabilities registry. | ||
20 | * | ||
21 | * @addtogroup HAL | ||
22 | * @{ | ||
23 | */ | ||
24 | |||
25 | #ifndef STM32_REGISTRY_H | ||
26 | #define STM32_REGISTRY_H | ||
27 | |||
28 | #if !defined(STM32F0XX) || defined(__DOXYGEN__) | ||
29 | #define STM32F0XX | ||
30 | #endif | ||
31 | |||
32 | /*===========================================================================*/ | ||
33 | /* Platform capabilities. */ | ||
34 | /*===========================================================================*/ | ||
35 | |||
36 | /** | ||
37 | * @name STM32F0xx capabilities | ||
38 | * @{ | ||
39 | */ | ||
40 | |||
41 | /*===========================================================================*/ | ||
42 | /* Common. */ | ||
43 | /*===========================================================================*/ | ||
44 | |||
45 | /* RNG attributes.*/ | ||
46 | #define STM32_HAS_RNG1 FALSE | ||
47 | |||
48 | /*===========================================================================*/ | ||
49 | /* STM32F030x4, STM32F030x6, STM32F030x8, STM32F030xC. */ | ||
50 | /*===========================================================================*/ | ||
51 | #if defined(STM32F030x4) || defined(STM32F030x6) || \ | ||
52 | defined(STM32F030x8) || defined(STM32F030xC) || defined(__DOXYGEN__) | ||
53 | |||
54 | /* Common identifier of all STM32F030 devices.*/ | ||
55 | #define STM32F030 | ||
56 | |||
57 | /* RCC attributes. */ | ||
58 | #define STM32_HAS_HSI48 FALSE | ||
59 | #if defined(STM32F030xC) || defined(__DOXYGEN__) | ||
60 | #define STM32_HAS_HSI_PREDIV TRUE | ||
61 | #else | ||
62 | #define STM32_HAS_HSI_PREDIV FALSE | ||
63 | #endif | ||
64 | #define STM32_HAS_MCO_PREDIV TRUE | ||
65 | |||
66 | /* ADC attributes.*/ | ||
67 | #define STM32_HAS_ADC1 TRUE | ||
68 | #define STM32_ADC_SUPPORTS_PRESCALER FALSE | ||
69 | #define STM32_ADC_SUPPORTS_OVERSAMPLING FALSE | ||
70 | #define STM32_ADC1_HANDLER Vector70 | ||
71 | #define STM32_ADC1_NUMBER 12 | ||
72 | #define STM32_ADC1_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 1) |\ | ||
73 | STM32_DMA_STREAM_ID_MSK(1, 2)) | ||
74 | #define STM32_ADC1_DMA_CHN 0x00000011 | ||
75 | |||
76 | #define STM32_HAS_ADC2 FALSE | ||
77 | #define STM32_HAS_ADC3 FALSE | ||
78 | #define STM32_HAS_ADC4 FALSE | ||
79 | |||
80 | /* CAN attributes.*/ | ||
81 | #define STM32_HAS_CAN1 FALSE | ||
82 | #define STM32_HAS_CAN2 FALSE | ||
83 | #define STM32_HAS_CAN3 FALSE | ||
84 | |||
85 | /* DAC attributes.*/ | ||
86 | #define STM32_HAS_DAC1_CH1 FALSE | ||
87 | #define STM32_HAS_DAC1_CH2 FALSE | ||
88 | #define STM32_HAS_DAC2_CH1 FALSE | ||
89 | #define STM32_HAS_DAC2_CH2 FALSE | ||
90 | |||
91 | /* DMA attributes.*/ | ||
92 | #define STM32_ADVANCED_DMA TRUE | ||
93 | #define STM32_DMA_SUPPORTS_DMAMUX FALSE | ||
94 | #if defined(STM32F030xC) || defined(__DOXYGEN__) | ||
95 | #define STM32_DMA_SUPPORTS_CSELR TRUE | ||
96 | #else | ||
97 | #define STM32_DMA_SUPPORTS_CSELR FALSE | ||
98 | #endif | ||
99 | #define STM32_DMA1_NUM_CHANNELS 5 | ||
100 | #define STM32_DMA2_NUM_CHANNELS 0 | ||
101 | #define STM32_DMA1_CH1_HANDLER Vector64 | ||
102 | #define STM32_DMA1_CH23_HANDLER Vector68 | ||
103 | #define STM32_DMA1_CH4567_HANDLER Vector6C | ||
104 | #define STM32_DMA1_CH1_NUMBER 9 | ||
105 | #define STM32_DMA1_CH23_NUMBER 10 | ||
106 | #define STM32_DMA1_CH4567_NUMBER 11 | ||
107 | |||
108 | #define STM32_DMA1_CH2_NUMBER STM32_DMA1_CH23_NUMBER | ||
109 | #define STM32_DMA1_CH3_NUMBER STM32_DMA1_CH23_NUMBER | ||
110 | #define STM32_DMA1_CH2_CMASK 0x00000006U | ||
111 | #define STM32_DMA1_CH3_CMASK 0x00000006U | ||
112 | |||
113 | #define STM32_DMA1_CH4_NUMBER STM32_DMA1_CH4567_NUMBER | ||
114 | #define STM32_DMA1_CH5_NUMBER STM32_DMA1_CH4567_NUMBER | ||
115 | #define STM32_DMA1_CH6_NUMBER STM32_DMA1_CH4567_NUMBER | ||
116 | #define STM32_DMA1_CH7_NUMBER STM32_DMA1_CH4567_NUMBER | ||
117 | #define STM32_DMA1_CH4_CMASK 0x00000078U | ||
118 | #define STM32_DMA1_CH5_CMASK 0x00000078U | ||
119 | #define STM32_DMA1_CH6_CMASK 0x00000078U | ||
120 | #define STM32_DMA1_CH7_CMASK 0x00000078U | ||
121 | |||
122 | /* ETH attributes.*/ | ||
123 | #define STM32_HAS_ETH FALSE | ||
124 | |||
125 | /* EXTI attributes.*/ | ||
126 | #define STM32_EXTI_NUM_LINES 20 | ||
127 | #define STM32_EXTI_IMR1_MASK 0xFFF50000U | ||
128 | |||
129 | /* GPIO attributes.*/ | ||
130 | #define STM32_HAS_GPIOA TRUE | ||
131 | #define STM32_HAS_GPIOB TRUE | ||
132 | #if !defined(STM32F030x4) && !defined(STM32F030x6) | ||
133 | #define STM32_HAS_GPIOC TRUE | ||
134 | #define STM32_HAS_GPIOD TRUE | ||
135 | #else | ||
136 | #define STM32_HAS_GPIOC FALSE | ||
137 | #define STM32_HAS_GPIOD FALSE | ||
138 | #endif | ||
139 | #define STM32_HAS_GPIOE FALSE | ||
140 | #define STM32_HAS_GPIOF TRUE | ||
141 | #define STM32_HAS_GPIOG FALSE | ||
142 | #define STM32_HAS_GPIOH FALSE | ||
143 | #define STM32_HAS_GPIOI FALSE | ||
144 | #define STM32_HAS_GPIOJ FALSE | ||
145 | #define STM32_HAS_GPIOK FALSE | ||
146 | #define STM32_GPIO_EN_MASK (RCC_AHBENR_GPIOAEN | \ | ||
147 | RCC_AHBENR_GPIOBEN | \ | ||
148 | RCC_AHBENR_GPIOCEN | \ | ||
149 | RCC_AHBENR_GPIODEN | \ | ||
150 | RCC_AHBENR_GPIOFEN) | ||
151 | |||
152 | /* I2C attributes.*/ | ||
153 | #define STM32_HAS_I2C1 TRUE | ||
154 | #define STM32_I2C1_RX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 3) | ||
155 | #define STM32_I2C1_RX_DMA_CHN 0x00000200 | ||
156 | #define STM32_I2C1_TX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 2) | ||
157 | #define STM32_I2C1_TX_DMA_CHN 0x00000020 | ||
158 | |||
159 | #if defined(STM32F030x8) || defined(STM32F030xC) || defined(__DOXYGEN__) | ||
160 | #define STM32_HAS_I2C2 TRUE | ||
161 | #define STM32_I2C2_RX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 5) | ||
162 | #define STM32_I2C2_RX_DMA_CHN 0x00020000 | ||
163 | #define STM32_I2C2_TX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 4) | ||
164 | #define STM32_I2C2_TX_DMA_CHN 0x00002000 | ||
165 | #else | ||
166 | #define STM32_HAS_I2C2 FALSE | ||
167 | #endif | ||
168 | |||
169 | #define STM32_HAS_I2C3 FALSE | ||
170 | #define STM32_HAS_I2C4 FALSE | ||
171 | |||
172 | /* QUADSPI attributes.*/ | ||
173 | #define STM32_HAS_QUADSPI1 FALSE | ||
174 | |||
175 | /* RTC attributes.*/ | ||
176 | #define STM32_HAS_RTC TRUE | ||
177 | #define STM32_RTC_HAS_SUBSECONDS TRUE | ||
178 | #if defined (STM32F030xC) | ||
179 | #define STM32_RTC_HAS_PERIODIC_WAKEUPS TRUE | ||
180 | #else | ||
181 | #define STM32_RTC_HAS_PERIODIC_WAKEUPS FALSE | ||
182 | #endif | ||
183 | #define STM32_RTC_NUM_ALARMS 1 | ||
184 | #define STM32_RTC_STORAGE_SIZE 0 | ||
185 | #define STM32_RTC_COMMON_HANDLER Vector48 | ||
186 | #define STM32_RTC_COMMON_NUMBER 2 | ||
187 | #define STM32_RTC_ALARM_EXTI 17 | ||
188 | #define STM32_RTC_TAMP_STAMP_EXTI 19 | ||
189 | #define STM32_RTC_WKUP_EXTI 20 | ||
190 | #define STM32_RTC_IRQ_ENABLE() \ | ||
191 | nvicEnableVector(STM32_RTC_COMMON_NUMBER, STM32_IRQ_EXTI17_20_IRQ_PRIORITY) | ||
192 | |||
193 | /* SDIO attributes.*/ | ||
194 | #define STM32_HAS_SDIO FALSE | ||
195 | |||
196 | /* SPI attributes.*/ | ||
197 | #define STM32_HAS_SPI1 TRUE | ||
198 | #define STM32_SPI1_SUPPORTS_I2S FALSE | ||
199 | #define STM32_SPI1_RX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 2) | ||
200 | #define STM32_SPI1_RX_DMA_CHN 0x00000030 | ||
201 | #define STM32_SPI1_TX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 3) | ||
202 | #define STM32_SPI1_TX_DMA_CHN 0x00000300 | ||
203 | |||
204 | #if defined(STM32F030x8) || defined(STM32F030xC) || defined(__DOXYGEN__) | ||
205 | #define STM32_HAS_SPI2 TRUE | ||
206 | #define STM32_SPI2_SUPPORTS_I2S FALSE | ||
207 | #define STM32_SPI2_RX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 4) | ||
208 | #define STM32_SPI2_RX_DMA_CHN 0x00003000 | ||
209 | #define STM32_SPI2_TX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 5) | ||
210 | #define STM32_SPI2_TX_DMA_CHN 0x00030000 | ||
211 | #else | ||
212 | #define STM32_HAS_SPI2 FALSE | ||
213 | #endif | ||
214 | |||
215 | #define STM32_HAS_SPI3 FALSE | ||
216 | #define STM32_HAS_SPI4 FALSE | ||
217 | #define STM32_HAS_SPI5 FALSE | ||
218 | #define STM32_HAS_SPI6 FALSE | ||
219 | |||
220 | /* TIM attributes.*/ | ||
221 | #define STM32_TIM_MAX_CHANNELS 4 | ||
222 | |||
223 | #define STM32_HAS_TIM1 TRUE | ||
224 | #define STM32_TIM1_IS_32BITS FALSE | ||
225 | #define STM32_TIM1_CHANNELS 4 | ||
226 | |||
227 | #define STM32_HAS_TIM3 TRUE | ||
228 | #define STM32_TIM3_IS_32BITS FALSE | ||
229 | #define STM32_TIM3_CHANNELS 4 | ||
230 | |||
231 | #if defined(STM32F030x8) || defined(STM32F030xC) || defined(__DOXYGEN__) | ||
232 | #define STM32_HAS_TIM6 TRUE | ||
233 | #define STM32_TIM6_IS_32BITS FALSE | ||
234 | #define STM32_TIM6_CHANNELS 0 | ||
235 | #else | ||
236 | #define STM32_HAS_TIM6 FALSE | ||
237 | #endif | ||
238 | |||
239 | #if defined(STM32F030xC) | ||
240 | #define STM32_HAS_TIM7 TRUE | ||
241 | #define STM32_TIM7_IS_32BITS FALSE | ||
242 | #define STM32_TIM7_CHANNELS 0 | ||
243 | #else | ||
244 | #define STM32_HAS_TIM7 FALSE | ||
245 | #endif | ||
246 | |||
247 | #define STM32_HAS_TIM14 TRUE | ||
248 | #define STM32_TIM14_IS_32BITS FALSE | ||
249 | #define STM32_TIM14_CHANNELS 1 | ||
250 | |||
251 | #if defined(STM32F030x8) || defined(STM32F030xC) || defined(__DOXYGEN__) | ||
252 | #define STM32_HAS_TIM15 TRUE | ||
253 | #define STM32_TIM15_IS_32BITS FALSE | ||
254 | #define STM32_TIM15_CHANNELS 2 | ||
255 | #else | ||
256 | #define STM32_HAS_TIM15 FALSE | ||
257 | #endif | ||
258 | |||
259 | #define STM32_HAS_TIM16 TRUE | ||
260 | #define STM32_TIM16_IS_32BITS FALSE | ||
261 | #define STM32_TIM16_CHANNELS 1 | ||
262 | |||
263 | #define STM32_HAS_TIM17 TRUE | ||
264 | #define STM32_TIM17_IS_32BITS FALSE | ||
265 | #define STM32_TIM17_CHANNELS 1 | ||
266 | |||
267 | #define STM32_HAS_TIM2 FALSE | ||
268 | #define STM32_HAS_TIM4 FALSE | ||
269 | #define STM32_HAS_TIM5 FALSE | ||
270 | #define STM32_HAS_TIM8 FALSE | ||
271 | #define STM32_HAS_TIM9 FALSE | ||
272 | #define STM32_HAS_TIM10 FALSE | ||
273 | #define STM32_HAS_TIM11 FALSE | ||
274 | #define STM32_HAS_TIM12 FALSE | ||
275 | #define STM32_HAS_TIM13 FALSE | ||
276 | #define STM32_HAS_TIM18 FALSE | ||
277 | #define STM32_HAS_TIM19 FALSE | ||
278 | #define STM32_HAS_TIM20 FALSE | ||
279 | #define STM32_HAS_TIM21 FALSE | ||
280 | #define STM32_HAS_TIM22 FALSE | ||
281 | |||
282 | /* USART attributes.*/ | ||
283 | #define STM32_HAS_USART1 TRUE | ||
284 | #define STM32_USART1_RX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 1) |\ | ||
285 | STM32_DMA_STREAM_ID_MSK(1, 3) |\ | ||
286 | STM32_DMA_STREAM_ID_MSK(1, 5)) | ||
287 | #define STM32_USART1_RX_DMA_CHN 0x00080808 | ||
288 | #define STM32_USART1_TX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 2) |\ | ||
289 | STM32_DMA_STREAM_ID_MSK(1, 4)) | ||
290 | #define STM32_USART1_TX_DMA_CHN 0x00008080 | ||
291 | |||
292 | #if defined(STM32F030x8) || defined(STM32F030xC) || defined(__DOXYGEN__) | ||
293 | #define STM32_HAS_USART2 TRUE | ||
294 | #define STM32_USART2_RX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 1) |\ | ||
295 | STM32_DMA_STREAM_ID_MSK(1, 3) |\ | ||
296 | STM32_DMA_STREAM_ID_MSK(1, 5)) | ||
297 | #define STM32_USART2_RX_DMA_CHN 0x00090909 | ||
298 | #define STM32_USART2_TX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 2) |\ | ||
299 | STM32_DMA_STREAM_ID_MSK(1, 4)) | ||
300 | #define STM32_USART2_TX_DMA_CHN 0x00009090 | ||
301 | #else | ||
302 | #define STM32_HAS_USART2 FALSE | ||
303 | #endif | ||
304 | |||
305 | #if defined(STM32F030xC) || defined(__DOXYGEN__) | ||
306 | #define STM32_HAS_USART3 TRUE | ||
307 | #define STM32_USART3_RX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 1) |\ | ||
308 | STM32_DMA_STREAM_ID_MSK(1, 3) |\ | ||
309 | STM32_DMA_STREAM_ID_MSK(1, 5)) | ||
310 | #define STM32_USART3_RX_DMA_CHN 0x000A0A0A | ||
311 | #define STM32_USART3_TX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 2) |\ | ||
312 | STM32_DMA_STREAM_ID_MSK(1, 4)) | ||
313 | #define STM32_USART3_TX_DMA_CHN 0x0000A0A0 | ||
314 | |||
315 | #define STM32_HAS_UART4 TRUE | ||
316 | #define STM32_UART4_RX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 1) |\ | ||
317 | STM32_DMA_STREAM_ID_MSK(1, 3) |\ | ||
318 | STM32_DMA_STREAM_ID_MSK(1, 5)) | ||
319 | #define STM32_UART4_RX_DMA_CHN 0x000B0B0B | ||
320 | #define STM32_UART4_TX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 2) |\ | ||
321 | STM32_DMA_STREAM_ID_MSK(1, 4)) | ||
322 | #define STM32_UART4_TX_DMA_CHN 0x0000B0B0 | ||
323 | |||
324 | #define STM32_HAS_UART5 TRUE | ||
325 | #define STM32_UART5_RX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 1) |\ | ||
326 | STM32_DMA_STREAM_ID_MSK(1, 3) |\ | ||
327 | STM32_DMA_STREAM_ID_MSK(1, 5)) | ||
328 | #define STM32_UART5_RX_DMA_CHN 0x000C0C0C | ||
329 | #define STM32_UART5_TX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 2) |\ | ||
330 | STM32_DMA_STREAM_ID_MSK(1, 4)) | ||
331 | #define STM32_UART5_TX_DMA_CHN 0x0000C0C0 | ||
332 | |||
333 | #define STM32_HAS_USART6 TRUE | ||
334 | #define STM32_USART6_RX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 1) |\ | ||
335 | STM32_DMA_STREAM_ID_MSK(1, 3) |\ | ||
336 | STM32_DMA_STREAM_ID_MSK(1, 5)) | ||
337 | #define STM32_USART6_RX_DMA_CHN 0x000D0D0D | ||
338 | #define STM32_USART6_TX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 2) |\ | ||
339 | STM32_DMA_STREAM_ID_MSK(1, 4)) | ||
340 | #define STM32_USART6_TX_DMA_CHN 0x0000D0D0 | ||
341 | |||
342 | #define STM32_HAS_UART7 FALSE | ||
343 | #define STM32_HAS_UART8 FALSE | ||
344 | #define STM32_HAS_LPUART1 FALSE | ||
345 | #else | ||
346 | #define STM32_HAS_USART3 FALSE | ||
347 | #define STM32_HAS_UART4 FALSE | ||
348 | #define STM32_HAS_UART5 FALSE | ||
349 | #define STM32_HAS_USART6 FALSE | ||
350 | #define STM32_HAS_UART7 FALSE | ||
351 | #define STM32_HAS_UART8 FALSE | ||
352 | #define STM32_HAS_LPUART1 FALSE | ||
353 | #endif | ||
354 | |||
355 | /* USB attributes.*/ | ||
356 | #define STM32_HAS_USB FALSE | ||
357 | #define STM32_HAS_OTG1 FALSE | ||
358 | #define STM32_HAS_OTG2 FALSE | ||
359 | |||
360 | /* IWDG attributes.*/ | ||
361 | #define STM32_HAS_IWDG TRUE | ||
362 | #define STM32_IWDG_IS_WINDOWED TRUE | ||
363 | |||
364 | /* LTDC attributes.*/ | ||
365 | #define STM32_HAS_LTDC FALSE | ||
366 | |||
367 | /* DMA2D attributes.*/ | ||
368 | #define STM32_HAS_DMA2D FALSE | ||
369 | |||
370 | /* FSMC attributes.*/ | ||
371 | #define STM32_HAS_FSMC FALSE | ||
372 | |||
373 | /* CRC attributes.*/ | ||
374 | #define STM32_HAS_CRC TRUE | ||
375 | #define STM32_CRC_PROGRAMMABLE FALSE | ||
376 | |||
377 | /*===========================================================================*/ | ||
378 | /* STM32F031x6, STM32F038xx. */ | ||
379 | /*===========================================================================*/ | ||
380 | #elif defined(STM32F031x6) || defined(STM32F038xx) | ||
381 | |||
382 | /* RCC attributes. */ | ||
383 | #define STM32_HAS_HSI48 FALSE | ||
384 | #define STM32_HAS_HSI_PREDIV FALSE | ||
385 | #define STM32_HAS_MCO_PREDIV TRUE | ||
386 | |||
387 | /* ADC attributes.*/ | ||
388 | #define STM32_HAS_ADC1 TRUE | ||
389 | #define STM32_ADC_SUPPORTS_PRESCALER FALSE | ||
390 | #define STM32_ADC_SUPPORTS_OVERSAMPLING FALSE | ||
391 | #define STM32_ADC1_HANDLER Vector70 | ||
392 | #define STM32_ADC1_NUMBER 12 | ||
393 | #define STM32_ADC1_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 1) |\ | ||
394 | STM32_DMA_STREAM_ID_MSK(1, 2)) | ||
395 | #define STM32_ADC1_DMA_CHN 0x00000000 | ||
396 | |||
397 | #define STM32_HAS_ADC2 FALSE | ||
398 | #define STM32_HAS_ADC3 FALSE | ||
399 | #define STM32_HAS_ADC4 FALSE | ||
400 | |||
401 | /* CAN attributes.*/ | ||
402 | #define STM32_HAS_CAN1 FALSE | ||
403 | #define STM32_HAS_CAN2 FALSE | ||
404 | #define STM32_HAS_CAN3 FALSE | ||
405 | |||
406 | /* DAC attributes.*/ | ||
407 | #define STM32_HAS_DAC1_CH1 FALSE | ||
408 | #define STM32_HAS_DAC1_CH2 FALSE | ||
409 | #define STM32_HAS_DAC2_CH1 FALSE | ||
410 | #define STM32_HAS_DAC2_CH2 FALSE | ||
411 | |||
412 | /* DMA attributes.*/ | ||
413 | #define STM32_ADVANCED_DMA TRUE | ||
414 | #define STM32_DMA_SUPPORTS_DMAMUX FALSE | ||
415 | #define STM32_DMA_SUPPORTS_CSELR FALSE | ||
416 | #define STM32_DMA1_NUM_CHANNELS 5 | ||
417 | #define STM32_DMA2_NUM_CHANNELS 0 | ||
418 | #define STM32_DMA1_CH1_HANDLER Vector64 | ||
419 | #define STM32_DMA1_CH23_HANDLER Vector68 | ||
420 | #define STM32_DMA1_CH4567_HANDLER Vector6C | ||
421 | #define STM32_DMA1_CH1_NUMBER 9 | ||
422 | #define STM32_DMA1_CH23_NUMBER 10 | ||
423 | #define STM32_DMA1_CH4567_NUMBER 11 | ||
424 | |||
425 | #define STM32_DMA1_CH2_NUMBER STM32_DMA1_CH23_NUMBER | ||
426 | #define STM32_DMA1_CH3_NUMBER STM32_DMA1_CH23_NUMBER | ||
427 | #define STM32_DMA1_CH2_CMASK 0x00000006U | ||
428 | #define STM32_DMA1_CH3_CMASK 0x00000006U | ||
429 | |||
430 | #define STM32_DMA1_CH4_NUMBER STM32_DMA1_CH4567_NUMBER | ||
431 | #define STM32_DMA1_CH5_NUMBER STM32_DMA1_CH4567_NUMBER | ||
432 | #define STM32_DMA1_CH6_NUMBER STM32_DMA1_CH4567_NUMBER | ||
433 | #define STM32_DMA1_CH7_NUMBER STM32_DMA1_CH4567_NUMBER | ||
434 | #define STM32_DMA1_CH4_CMASK 0x00000078U | ||
435 | #define STM32_DMA1_CH5_CMASK 0x00000078U | ||
436 | #define STM32_DMA1_CH6_CMASK 0x00000078U | ||
437 | #define STM32_DMA1_CH7_CMASK 0x00000078U | ||
438 | |||
439 | /* ETH attributes.*/ | ||
440 | #define STM32_HAS_ETH FALSE | ||
441 | |||
442 | /* EXTI attributes.*/ | ||
443 | #define STM32_EXTI_NUM_LINES 32 | ||
444 | #define STM32_EXTI_IMR1_MASK 0x0FF40000U | ||
445 | |||
446 | /* GPIO attributes.*/ | ||
447 | #define STM32_HAS_GPIOA TRUE | ||
448 | #define STM32_HAS_GPIOB TRUE | ||
449 | #define STM32_HAS_GPIOC TRUE | ||
450 | #define STM32_HAS_GPIOD FALSE | ||
451 | #define STM32_HAS_GPIOE FALSE | ||
452 | #define STM32_HAS_GPIOF TRUE | ||
453 | #define STM32_HAS_GPIOG FALSE | ||
454 | #define STM32_HAS_GPIOH FALSE | ||
455 | #define STM32_HAS_GPIOI FALSE | ||
456 | #define STM32_HAS_GPIOJ FALSE | ||
457 | #define STM32_HAS_GPIOK FALSE | ||
458 | #define STM32_GPIO_EN_MASK (RCC_AHBENR_GPIOAEN | \ | ||
459 | RCC_AHBENR_GPIOBEN | \ | ||
460 | RCC_AHBENR_GPIOCEN | \ | ||
461 | RCC_AHBENR_GPIOFEN) | ||
462 | |||
463 | /* I2C attributes.*/ | ||
464 | #define STM32_HAS_I2C1 TRUE | ||
465 | #define STM32_I2C1_RX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 3) | ||
466 | #define STM32_I2C1_RX_DMA_CHN 0x00000000 | ||
467 | #define STM32_I2C1_TX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 2) | ||
468 | #define STM32_I2C1_TX_DMA_CHN 0x00000000 | ||
469 | |||
470 | #define STM32_HAS_I2C2 FALSE | ||
471 | #define STM32_HAS_I2C3 FALSE | ||
472 | #define STM32_HAS_I2C4 FALSE | ||
473 | |||
474 | /* QUADSPI attributes.*/ | ||
475 | #define STM32_HAS_QUADSPI1 FALSE | ||
476 | |||
477 | /* RTC attributes.*/ | ||
478 | #define STM32_HAS_RTC TRUE | ||
479 | #define STM32_RTC_HAS_SUBSECONDS TRUE | ||
480 | #define STM32_RTC_HAS_PERIODIC_WAKEUPS FALSE | ||
481 | #define STM32_RTC_NUM_ALARMS 1 | ||
482 | #define STM32_RTC_STORAGE_SIZE 0 | ||
483 | #define STM32_RTC_COMMON_HANDLER Vector48 | ||
484 | #define STM32_RTC_COMMON_NUMBER 2 | ||
485 | #define STM32_RTC_ALARM_EXTI 17 | ||
486 | #define STM32_RTC_TAMP_STAMP_EXTI 19 | ||
487 | #define STM32_RTC_WKUP_EXTI 20 | ||
488 | #define STM32_RTC_IRQ_ENABLE() \ | ||
489 | nvicEnableVector(STM32_RTC_COMMON_NUMBER, STM32_IRQ_EXTI17_20_IRQ_PRIORITY) | ||
490 | |||
491 | /* SDIO attributes.*/ | ||
492 | #define STM32_HAS_SDIO FALSE | ||
493 | |||
494 | /* SPI attributes.*/ | ||
495 | #define STM32_HAS_SPI1 TRUE | ||
496 | #define STM32_SPI1_SUPPORTS_I2S TRUE | ||
497 | #define STM32_SPI1_I2S_FULLDUPLEX FALSE | ||
498 | #define STM32_SPI1_RX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 2) | ||
499 | #define STM32_SPI1_RX_DMA_CHN 0x00000000 | ||
500 | #define STM32_SPI1_TX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 3) | ||
501 | #define STM32_SPI1_TX_DMA_CHN 0x00000000 | ||
502 | |||
503 | #define STM32_HAS_SPI2 FALSE | ||
504 | #define STM32_HAS_SPI3 FALSE | ||
505 | #define STM32_HAS_SPI4 FALSE | ||
506 | #define STM32_HAS_SPI5 FALSE | ||
507 | #define STM32_HAS_SPI6 FALSE | ||
508 | |||
509 | /* TIM attributes.*/ | ||
510 | #define STM32_TIM_MAX_CHANNELS 4 | ||
511 | |||
512 | #define STM32_HAS_TIM1 TRUE | ||
513 | #define STM32_TIM1_IS_32BITS FALSE | ||
514 | #define STM32_TIM1_CHANNELS 4 | ||
515 | |||
516 | #define STM32_HAS_TIM2 TRUE | ||
517 | #define STM32_TIM2_IS_32BITS TRUE | ||
518 | #define STM32_TIM2_CHANNELS 4 | ||
519 | |||
520 | #define STM32_HAS_TIM3 TRUE | ||
521 | #define STM32_TIM3_IS_32BITS FALSE | ||
522 | #define STM32_TIM3_CHANNELS 4 | ||
523 | |||
524 | #define STM32_HAS_TIM14 TRUE | ||
525 | #define STM32_TIM14_IS_32BITS FALSE | ||
526 | #define STM32_TIM14_CHANNELS 1 | ||
527 | |||
528 | #define STM32_HAS_TIM16 TRUE | ||
529 | #define STM32_TIM16_IS_32BITS FALSE | ||
530 | #define STM32_TIM16_CHANNELS 1 | ||
531 | |||
532 | #define STM32_HAS_TIM17 TRUE | ||
533 | #define STM32_TIM17_IS_32BITS FALSE | ||
534 | #define STM32_TIM17_CHANNELS 1 | ||
535 | |||
536 | #define STM32_HAS_TIM4 FALSE | ||
537 | #define STM32_HAS_TIM5 FALSE | ||
538 | #define STM32_HAS_TIM6 FALSE | ||
539 | #define STM32_HAS_TIM7 FALSE | ||
540 | #define STM32_HAS_TIM8 FALSE | ||
541 | #define STM32_HAS_TIM9 FALSE | ||
542 | #define STM32_HAS_TIM10 FALSE | ||
543 | #define STM32_HAS_TIM11 FALSE | ||
544 | #define STM32_HAS_TIM12 FALSE | ||
545 | #define STM32_HAS_TIM13 FALSE | ||
546 | #define STM32_HAS_TIM15 FALSE | ||
547 | #define STM32_HAS_TIM18 FALSE | ||
548 | #define STM32_HAS_TIM19 FALSE | ||
549 | #define STM32_HAS_TIM20 FALSE | ||
550 | #define STM32_HAS_TIM21 FALSE | ||
551 | #define STM32_HAS_TIM22 FALSE | ||
552 | |||
553 | /* USART attributes.*/ | ||
554 | #define STM32_HAS_USART1 TRUE | ||
555 | #define STM32_USART1_RX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 3) |\ | ||
556 | STM32_DMA_STREAM_ID_MSK(1, 5)) | ||
557 | #define STM32_USART1_RX_DMA_CHN 0x00000000 | ||
558 | #define STM32_USART1_TX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 2) |\ | ||
559 | STM32_DMA_STREAM_ID_MSK(1, 4)) | ||
560 | #define STM32_USART1_TX_DMA_CHN 0x00000000 | ||
561 | |||
562 | #define STM32_HAS_USART2 FALSE | ||
563 | #define STM32_HAS_USART3 FALSE | ||
564 | #define STM32_HAS_UART4 FALSE | ||
565 | #define STM32_HAS_UART5 FALSE | ||
566 | #define STM32_HAS_USART6 FALSE | ||
567 | #define STM32_HAS_UART7 FALSE | ||
568 | #define STM32_HAS_UART8 FALSE | ||
569 | #define STM32_HAS_LPUART1 FALSE | ||
570 | |||
571 | /* USB attributes.*/ | ||
572 | #define STM32_HAS_USB FALSE | ||
573 | #define STM32_HAS_OTG1 FALSE | ||
574 | #define STM32_HAS_OTG2 FALSE | ||
575 | |||
576 | /* IWDG attributes.*/ | ||
577 | #define STM32_HAS_IWDG TRUE | ||
578 | #define STM32_IWDG_IS_WINDOWED TRUE | ||
579 | |||
580 | /* LTDC attributes.*/ | ||
581 | #define STM32_HAS_LTDC FALSE | ||
582 | |||
583 | /* DMA2D attributes.*/ | ||
584 | #define STM32_HAS_DMA2D FALSE | ||
585 | |||
586 | /* FSMC attributes.*/ | ||
587 | #define STM32_HAS_FSMC FALSE | ||
588 | |||
589 | /* CRC attributes.*/ | ||
590 | #define STM32_HAS_CRC TRUE | ||
591 | #define STM32_CRC_PROGRAMMABLE TRUE | ||
592 | |||
593 | /*===========================================================================*/ | ||
594 | /* STM32F042x6. */ | ||
595 | /*===========================================================================*/ | ||
596 | #elif defined(STM32F042x6) | ||
597 | |||
598 | /* RCC attributes. */ | ||
599 | #define STM32_HAS_HSI48 TRUE | ||
600 | #define STM32_HAS_HSI_PREDIV TRUE | ||
601 | #define STM32_HAS_MCO_PREDIV TRUE | ||
602 | |||
603 | /* ADC attributes.*/ | ||
604 | #define STM32_HAS_ADC1 TRUE | ||
605 | #define STM32_ADC_SUPPORTS_PRESCALER FALSE | ||
606 | #define STM32_ADC_SUPPORTS_OVERSAMPLING FALSE | ||
607 | #define STM32_ADC1_HANDLER Vector70 | ||
608 | #define STM32_ADC1_NUMBER 12 | ||
609 | #define STM32_ADC1_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 1) |\ | ||
610 | STM32_DMA_STREAM_ID_MSK(1, 2)) | ||
611 | #define STM32_ADC1_DMA_CHN 0x00000000 | ||
612 | |||
613 | #define STM32_HAS_ADC2 FALSE | ||
614 | #define STM32_HAS_ADC3 FALSE | ||
615 | #define STM32_HAS_ADC4 FALSE | ||
616 | |||
617 | /* CAN attributes.*/ | ||
618 | #define STM32_HAS_CAN1 TRUE | ||
619 | #define STM32_HAS_CAN2 FALSE | ||
620 | #define STM32_HAS_CAN3 FALSE | ||
621 | #define STM32_CAN_MAX_FILTERS 14 | ||
622 | |||
623 | /* DAC attributes.*/ | ||
624 | #define STM32_HAS_DAC1_CH1 FALSE | ||
625 | #define STM32_HAS_DAC1_CH2 FALSE | ||
626 | #define STM32_HAS_DAC2_CH1 FALSE | ||
627 | #define STM32_HAS_DAC2_CH2 FALSE | ||
628 | |||
629 | /* DMA attributes.*/ | ||
630 | #define STM32_ADVANCED_DMA TRUE | ||
631 | #define STM32_DMA_SUPPORTS_DMAMUX FALSE | ||
632 | #define STM32_DMA_SUPPORTS_CSELR FALSE | ||
633 | #define STM32_DMA1_NUM_CHANNELS 5 | ||
634 | #define STM32_DMA2_NUM_CHANNELS 0 | ||
635 | #define STM32_DMA1_CH1_HANDLER Vector64 | ||
636 | #define STM32_DMA1_CH23_HANDLER Vector68 | ||
637 | #define STM32_DMA1_CH4567_HANDLER Vector6C | ||
638 | #define STM32_DMA1_CH1_NUMBER 9 | ||
639 | #define STM32_DMA1_CH23_NUMBER 10 | ||
640 | #define STM32_DMA1_CH4567_NUMBER 11 | ||
641 | |||
642 | #define STM32_DMA1_CH2_NUMBER STM32_DMA1_CH23_NUMBER | ||
643 | #define STM32_DMA1_CH3_NUMBER STM32_DMA1_CH23_NUMBER | ||
644 | #define STM32_DMA1_CH2_CMASK 0x00000006U | ||
645 | #define STM32_DMA1_CH3_CMASK 0x00000006U | ||
646 | |||
647 | #define STM32_DMA1_CH4_NUMBER STM32_DMA1_CH4567_NUMBER | ||
648 | #define STM32_DMA1_CH5_NUMBER STM32_DMA1_CH4567_NUMBER | ||
649 | #define STM32_DMA1_CH6_NUMBER STM32_DMA1_CH4567_NUMBER | ||
650 | #define STM32_DMA1_CH7_NUMBER STM32_DMA1_CH4567_NUMBER | ||
651 | #define STM32_DMA1_CH4_CMASK 0x00000078U | ||
652 | #define STM32_DMA1_CH5_CMASK 0x00000078U | ||
653 | #define STM32_DMA1_CH6_CMASK 0x00000078U | ||
654 | #define STM32_DMA1_CH7_CMASK 0x00000078U | ||
655 | |||
656 | /* ETH attributes.*/ | ||
657 | #define STM32_HAS_ETH FALSE | ||
658 | |||
659 | /* EXTI attributes.*/ | ||
660 | #define STM32_EXTI_NUM_LINES 32 | ||
661 | #define STM32_EXTI_IMR1_MASK 0x7FF40000U | ||
662 | |||
663 | /* GPIO attributes.*/ | ||
664 | #define STM32_HAS_GPIOA TRUE | ||
665 | #define STM32_HAS_GPIOB TRUE | ||
666 | #define STM32_HAS_GPIOC TRUE | ||
667 | #define STM32_HAS_GPIOD FALSE | ||
668 | #define STM32_HAS_GPIOE FALSE | ||
669 | #define STM32_HAS_GPIOF TRUE | ||
670 | #define STM32_HAS_GPIOG FALSE | ||
671 | #define STM32_HAS_GPIOH FALSE | ||
672 | #define STM32_HAS_GPIOI FALSE | ||
673 | #define STM32_HAS_GPIOJ FALSE | ||
674 | #define STM32_HAS_GPIOK FALSE | ||
675 | #define STM32_GPIO_EN_MASK (RCC_AHBENR_GPIOAEN | \ | ||
676 | RCC_AHBENR_GPIOBEN | \ | ||
677 | RCC_AHBENR_GPIOCEN | \ | ||
678 | RCC_AHBENR_GPIOFEN) | ||
679 | |||
680 | /* I2C attributes.*/ | ||
681 | #define STM32_HAS_I2C1 TRUE | ||
682 | #define STM32_I2C1_RX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 3) | ||
683 | #define STM32_I2C1_RX_DMA_CHN 0x00000000 | ||
684 | #define STM32_I2C1_TX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 2) | ||
685 | #define STM32_I2C1_TX_DMA_CHN 0x00000000 | ||
686 | |||
687 | #define STM32_HAS_I2C2 FALSE | ||
688 | #define STM32_HAS_I2C3 FALSE | ||
689 | #define STM32_HAS_I2C4 FALSE | ||
690 | |||
691 | /* QUADSPI attributes.*/ | ||
692 | #define STM32_HAS_QUADSPI1 FALSE | ||
693 | |||
694 | /* RTC attributes.*/ | ||
695 | #define STM32_HAS_RTC TRUE | ||
696 | #define STM32_RTC_HAS_SUBSECONDS TRUE | ||
697 | #define STM32_RTC_HAS_PERIODIC_WAKEUPS FALSE | ||
698 | #define STM32_RTC_NUM_ALARMS 1 | ||
699 | #define STM32_RTC_STORAGE_SIZE 0 | ||
700 | #define STM32_RTC_COMMON_HANDLER Vector48 | ||
701 | #define STM32_RTC_COMMON_NUMBER 2 | ||
702 | #define STM32_RTC_ALARM_EXTI 17 | ||
703 | #define STM32_RTC_TAMP_STAMP_EXTI 19 | ||
704 | #define STM32_RTC_WKUP_EXTI 20 | ||
705 | #define STM32_RTC_IRQ_ENABLE() \ | ||
706 | nvicEnableVector(STM32_RTC_COMMON_NUMBER, STM32_IRQ_EXTI17_20_IRQ_PRIORITY) | ||
707 | |||
708 | /* SDIO attributes.*/ | ||
709 | #define STM32_HAS_SDIO FALSE | ||
710 | |||
711 | /* SPI attributes.*/ | ||
712 | #define STM32_HAS_SPI1 TRUE | ||
713 | #define STM32_SPI1_SUPPORTS_I2S TRUE | ||
714 | #define STM32_SPI1_I2S_FULLDUPLEX FALSE | ||
715 | #define STM32_SPI1_RX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 2) | ||
716 | #define STM32_SPI1_RX_DMA_CHN 0x00000000 | ||
717 | #define STM32_SPI1_TX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 3) | ||
718 | #define STM32_SPI1_TX_DMA_CHN 0x00000000 | ||
719 | |||
720 | #define STM32_HAS_SPI2 FALSE | ||
721 | #define STM32_HAS_SPI3 FALSE | ||
722 | #define STM32_HAS_SPI4 FALSE | ||
723 | #define STM32_HAS_SPI5 FALSE | ||
724 | #define STM32_HAS_SPI6 FALSE | ||
725 | |||
726 | /* TIM attributes.*/ | ||
727 | #define STM32_TIM_MAX_CHANNELS 4 | ||
728 | |||
729 | #define STM32_HAS_TIM1 TRUE | ||
730 | #define STM32_TIM1_IS_32BITS FALSE | ||
731 | #define STM32_TIM1_CHANNELS 4 | ||
732 | |||
733 | #define STM32_HAS_TIM2 TRUE | ||
734 | #define STM32_TIM2_IS_32BITS TRUE | ||
735 | #define STM32_TIM2_CHANNELS 4 | ||
736 | |||
737 | #define STM32_HAS_TIM3 TRUE | ||
738 | #define STM32_TIM3_IS_32BITS FALSE | ||
739 | #define STM32_TIM3_CHANNELS 4 | ||
740 | |||
741 | #define STM32_HAS_TIM14 TRUE | ||
742 | #define STM32_TIM14_IS_32BITS FALSE | ||
743 | #define STM32_TIM14_CHANNELS 1 | ||
744 | |||
745 | #define STM32_HAS_TIM16 TRUE | ||
746 | #define STM32_TIM16_IS_32BITS FALSE | ||
747 | #define STM32_TIM16_CHANNELS 1 | ||
748 | |||
749 | #define STM32_HAS_TIM17 TRUE | ||
750 | #define STM32_TIM17_IS_32BITS FALSE | ||
751 | #define STM32_TIM17_CHANNELS 1 | ||
752 | |||
753 | #define STM32_HAS_TIM4 FALSE | ||
754 | #define STM32_HAS_TIM5 FALSE | ||
755 | #define STM32_HAS_TIM6 FALSE | ||
756 | #define STM32_HAS_TIM7 FALSE | ||
757 | #define STM32_HAS_TIM8 FALSE | ||
758 | #define STM32_HAS_TIM9 FALSE | ||
759 | #define STM32_HAS_TIM10 FALSE | ||
760 | #define STM32_HAS_TIM11 FALSE | ||
761 | #define STM32_HAS_TIM12 FALSE | ||
762 | #define STM32_HAS_TIM13 FALSE | ||
763 | #define STM32_HAS_TIM15 FALSE | ||
764 | #define STM32_HAS_TIM18 FALSE | ||
765 | #define STM32_HAS_TIM19 FALSE | ||
766 | #define STM32_HAS_TIM20 FALSE | ||
767 | #define STM32_HAS_TIM21 FALSE | ||
768 | #define STM32_HAS_TIM22 FALSE | ||
769 | |||
770 | /* USART attributes.*/ | ||
771 | #define STM32_HAS_USART1 TRUE | ||
772 | #define STM32_USART1_RX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 3) |\ | ||
773 | STM32_DMA_STREAM_ID_MSK(1, 5)) | ||
774 | #define STM32_USART1_RX_DMA_CHN 0x00000000 | ||
775 | #define STM32_USART1_TX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 2) |\ | ||
776 | STM32_DMA_STREAM_ID_MSK(1, 4)) | ||
777 | #define STM32_USART1_TX_DMA_CHN 0x00000000 | ||
778 | |||
779 | #define STM32_HAS_USART2 TRUE | ||
780 | #define STM32_USART2_RX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 5) | ||
781 | #define STM32_USART2_RX_DMA_CHN 0x00000000 | ||
782 | #define STM32_USART2_TX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 4) | ||
783 | #define STM32_USART2_TX_DMA_CHN 0x00000000 | ||
784 | |||
785 | #define STM32_HAS_USART3 FALSE | ||
786 | #define STM32_HAS_UART4 FALSE | ||
787 | #define STM32_HAS_UART5 FALSE | ||
788 | #define STM32_HAS_USART6 FALSE | ||
789 | #define STM32_HAS_UART7 FALSE | ||
790 | #define STM32_HAS_UART8 FALSE | ||
791 | #define STM32_HAS_LPUART1 FALSE | ||
792 | |||
793 | /* USB attributes.*/ | ||
794 | #define STM32_HAS_USB TRUE | ||
795 | #define STM32_USB_ACCESS_SCHEME_2x16 TRUE | ||
796 | #define STM32_USB_PMA_SIZE 768 | ||
797 | #define STM32_USB_HAS_BCDR TRUE | ||
798 | |||
799 | #define STM32_HAS_OTG1 FALSE | ||
800 | #define STM32_HAS_OTG2 FALSE | ||
801 | |||
802 | /* IWDG attributes.*/ | ||
803 | #define STM32_HAS_IWDG TRUE | ||
804 | #define STM32_IWDG_IS_WINDOWED TRUE | ||
805 | |||
806 | /* LTDC attributes.*/ | ||
807 | #define STM32_HAS_LTDC FALSE | ||
808 | |||
809 | /* DMA2D attributes.*/ | ||
810 | #define STM32_HAS_DMA2D FALSE | ||
811 | |||
812 | /* FSMC attributes.*/ | ||
813 | #define STM32_HAS_FSMC FALSE | ||
814 | |||
815 | /* CRC attributes.*/ | ||
816 | #define STM32_HAS_CRC TRUE | ||
817 | #define STM32_CRC_PROGRAMMABLE TRUE | ||
818 | |||
819 | /*===========================================================================*/ | ||
820 | /* STM32F048xx. */ | ||
821 | /*===========================================================================*/ | ||
822 | #elif defined(STM32F048xx) | ||
823 | |||
824 | /* RCC attributes. */ | ||
825 | #define STM32_HAS_HSI48 TRUE | ||
826 | #define STM32_HAS_HSI_PREDIV TRUE | ||
827 | #define STM32_HAS_MCO_PREDIV TRUE | ||
828 | |||
829 | /* ADC attributes.*/ | ||
830 | #define STM32_HAS_ADC1 TRUE | ||
831 | #define STM32_ADC_SUPPORTS_PRESCALER FALSE | ||
832 | #define STM32_ADC_SUPPORTS_OVERSAMPLING FALSE | ||
833 | #define STM32_ADC1_HANDLER Vector70 | ||
834 | #define STM32_ADC1_NUMBER 12 | ||
835 | #define STM32_ADC1_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 1) |\ | ||
836 | STM32_DMA_STREAM_ID_MSK(1, 2)) | ||
837 | #define STM32_ADC1_DMA_CHN 0x00000000 | ||
838 | |||
839 | #define STM32_HAS_ADC2 FALSE | ||
840 | #define STM32_HAS_ADC3 FALSE | ||
841 | #define STM32_HAS_ADC4 FALSE | ||
842 | |||
843 | /* CAN attributes.*/ | ||
844 | #define STM32_HAS_CAN1 FALSE | ||
845 | #define STM32_HAS_CAN2 FALSE | ||
846 | #define STM32_HAS_CAN3 FALSE | ||
847 | |||
848 | /* DAC attributes.*/ | ||
849 | #define STM32_HAS_DAC1_CH1 FALSE | ||
850 | #define STM32_HAS_DAC1_CH2 FALSE | ||
851 | #define STM32_HAS_DAC2_CH1 FALSE | ||
852 | #define STM32_HAS_DAC2_CH2 FALSE | ||
853 | |||
854 | /* DMA attributes.*/ | ||
855 | #define STM32_ADVANCED_DMA TRUE | ||
856 | #define STM32_DMA_SUPPORTS_DMAMUX FALSE | ||
857 | #define STM32_DMA_SUPPORTS_CSELR FALSE | ||
858 | #define STM32_DMA1_NUM_CHANNELS 5 | ||
859 | #define STM32_DMA2_NUM_CHANNELS 0 | ||
860 | #define STM32_DMA1_CH1_HANDLER Vector64 | ||
861 | #define STM32_DMA1_CH23_HANDLER Vector68 | ||
862 | #define STM32_DMA1_CH4567_HANDLER Vector6C | ||
863 | #define STM32_DMA1_CH1_NUMBER 9 | ||
864 | #define STM32_DMA1_CH23_NUMBER 10 | ||
865 | #define STM32_DMA1_CH4567_NUMBER 11 | ||
866 | |||
867 | #define STM32_DMA1_CH2_NUMBER STM32_DMA1_CH23_NUMBER | ||
868 | #define STM32_DMA1_CH3_NUMBER STM32_DMA1_CH23_NUMBER | ||
869 | #define STM32_DMA1_CH2_CMASK 0x00000006U | ||
870 | #define STM32_DMA1_CH3_CMASK 0x00000006U | ||
871 | |||
872 | #define STM32_DMA1_CH4_NUMBER STM32_DMA1_CH4567_NUMBER | ||
873 | #define STM32_DMA1_CH5_NUMBER STM32_DMA1_CH4567_NUMBER | ||
874 | #define STM32_DMA1_CH6_NUMBER STM32_DMA1_CH4567_NUMBER | ||
875 | #define STM32_DMA1_CH7_NUMBER STM32_DMA1_CH4567_NUMBER | ||
876 | #define STM32_DMA1_CH4_CMASK 0x00000078U | ||
877 | #define STM32_DMA1_CH5_CMASK 0x00000078U | ||
878 | #define STM32_DMA1_CH6_CMASK 0x00000078U | ||
879 | #define STM32_DMA1_CH7_CMASK 0x00000078U | ||
880 | |||
881 | /* ETH attributes.*/ | ||
882 | #define STM32_HAS_ETH FALSE | ||
883 | |||
884 | /* EXTI attributes.*/ | ||
885 | #define STM32_EXTI_NUM_LINES 32 | ||
886 | #define STM32_EXTI_IMR1_MASK 0x7FF40000U | ||
887 | |||
888 | /* GPIO attributes.*/ | ||
889 | #define STM32_HAS_GPIOA TRUE | ||
890 | #define STM32_HAS_GPIOB TRUE | ||
891 | #define STM32_HAS_GPIOC TRUE | ||
892 | #define STM32_HAS_GPIOD FALSE | ||
893 | #define STM32_HAS_GPIOE FALSE | ||
894 | #define STM32_HAS_GPIOF TRUE | ||
895 | #define STM32_HAS_GPIOG FALSE | ||
896 | #define STM32_HAS_GPIOH FALSE | ||
897 | #define STM32_HAS_GPIOI FALSE | ||
898 | #define STM32_HAS_GPIOJ FALSE | ||
899 | #define STM32_HAS_GPIOK FALSE | ||
900 | #define STM32_GPIO_EN_MASK (RCC_AHBENR_GPIOAEN | \ | ||
901 | RCC_AHBENR_GPIOBEN | \ | ||
902 | RCC_AHBENR_GPIOCEN | \ | ||
903 | RCC_AHBENR_GPIOFEN) | ||
904 | |||
905 | /* I2C attributes.*/ | ||
906 | #define STM32_HAS_I2C1 TRUE | ||
907 | #define STM32_I2C1_RX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 3) | ||
908 | #define STM32_I2C1_RX_DMA_CHN 0x00000000 | ||
909 | #define STM32_I2C1_TX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 2) | ||
910 | #define STM32_I2C1_TX_DMA_CHN 0x00000000 | ||
911 | |||
912 | #define STM32_HAS_I2C2 FALSE | ||
913 | #define STM32_HAS_I2C3 FALSE | ||
914 | #define STM32_HAS_I2C4 FALSE | ||
915 | |||
916 | /* QUADSPI attributes.*/ | ||
917 | #define STM32_HAS_QUADSPI1 FALSE | ||
918 | |||
919 | /* RTC attributes.*/ | ||
920 | #define STM32_HAS_RTC TRUE | ||
921 | #define STM32_RTC_HAS_SUBSECONDS TRUE | ||
922 | #define STM32_RTC_HAS_PERIODIC_WAKEUPS FALSE | ||
923 | #define STM32_RTC_NUM_ALARMS 1 | ||
924 | #define STM32_RTC_STORAGE_SIZE 0 | ||
925 | #define STM32_RTC_COMMON_HANDLER Vector48 | ||
926 | #define STM32_RTC_COMMON_NUMBER 2 | ||
927 | #define STM32_RTC_ALARM_EXTI 17 | ||
928 | #define STM32_RTC_TAMP_STAMP_EXTI 19 | ||
929 | #define STM32_RTC_WKUP_EXTI 20 | ||
930 | #define STM32_RTC_IRQ_ENABLE() \ | ||
931 | nvicEnableVector(STM32_RTC_COMMON_NUMBER, STM32_IRQ_EXTI17_20_IRQ_PRIORITY) | ||
932 | |||
933 | /* SDIO attributes.*/ | ||
934 | #define STM32_HAS_SDIO FALSE | ||
935 | |||
936 | /* SPI attributes.*/ | ||
937 | #define STM32_HAS_SPI1 TRUE | ||
938 | #define STM32_SPI1_SUPPORTS_I2S TRUE | ||
939 | #define STM32_SPI1_I2S_FULLDUPLEX FALSE | ||
940 | #define STM32_SPI1_RX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 2) | ||
941 | #define STM32_SPI1_RX_DMA_CHN 0x00000000 | ||
942 | #define STM32_SPI1_TX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 3) | ||
943 | #define STM32_SPI1_TX_DMA_CHN 0x00000000 | ||
944 | |||
945 | #define STM32_HAS_SPI2 TRUE | ||
946 | #define STM32_SPI2_SUPPORTS_I2S FALSE | ||
947 | #define STM32_SPI2_RX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 4) | ||
948 | #define STM32_SPI2_RX_DMA_CHN 0x00000000 | ||
949 | #define STM32_SPI2_TX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 5) | ||
950 | #define STM32_SPI2_TX_DMA_CHN 0x00000000 | ||
951 | |||
952 | #define STM32_HAS_SPI3 FALSE | ||
953 | #define STM32_HAS_SPI4 FALSE | ||
954 | #define STM32_HAS_SPI5 FALSE | ||
955 | #define STM32_HAS_SPI6 FALSE | ||
956 | |||
957 | /* TIM attributes.*/ | ||
958 | #define STM32_TIM_MAX_CHANNELS 4 | ||
959 | |||
960 | #define STM32_HAS_TIM1 TRUE | ||
961 | #define STM32_TIM1_IS_32BITS FALSE | ||
962 | #define STM32_TIM1_CHANNELS 4 | ||
963 | |||
964 | #define STM32_HAS_TIM2 TRUE | ||
965 | #define STM32_TIM2_IS_32BITS TRUE | ||
966 | #define STM32_TIM2_CHANNELS 4 | ||
967 | |||
968 | #define STM32_HAS_TIM3 TRUE | ||
969 | #define STM32_TIM3_IS_32BITS FALSE | ||
970 | #define STM32_TIM3_CHANNELS 4 | ||
971 | |||
972 | #define STM32_HAS_TIM14 TRUE | ||
973 | #define STM32_TIM14_IS_32BITS FALSE | ||
974 | #define STM32_TIM14_CHANNELS 1 | ||
975 | |||
976 | #define STM32_HAS_TIM16 TRUE | ||
977 | #define STM32_TIM16_IS_32BITS FALSE | ||
978 | #define STM32_TIM16_CHANNELS 1 | ||
979 | |||
980 | #define STM32_HAS_TIM17 TRUE | ||
981 | #define STM32_TIM17_IS_32BITS FALSE | ||
982 | #define STM32_TIM17_CHANNELS 1 | ||
983 | |||
984 | #define STM32_HAS_TIM4 FALSE | ||
985 | #define STM32_HAS_TIM5 FALSE | ||
986 | #define STM32_HAS_TIM6 FALSE | ||
987 | #define STM32_HAS_TIM7 FALSE | ||
988 | #define STM32_HAS_TIM8 FALSE | ||
989 | #define STM32_HAS_TIM9 FALSE | ||
990 | #define STM32_HAS_TIM10 FALSE | ||
991 | #define STM32_HAS_TIM11 FALSE | ||
992 | #define STM32_HAS_TIM12 FALSE | ||
993 | #define STM32_HAS_TIM13 FALSE | ||
994 | #define STM32_HAS_TIM15 FALSE | ||
995 | #define STM32_HAS_TIM18 FALSE | ||
996 | #define STM32_HAS_TIM19 FALSE | ||
997 | #define STM32_HAS_TIM20 FALSE | ||
998 | #define STM32_HAS_TIM21 FALSE | ||
999 | #define STM32_HAS_TIM22 FALSE | ||
1000 | |||
1001 | /* USART attributes.*/ | ||
1002 | #define STM32_HAS_USART1 TRUE | ||
1003 | #define STM32_USART1_RX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 3) |\ | ||
1004 | STM32_DMA_STREAM_ID_MSK(1, 5)) | ||
1005 | #define STM32_USART1_RX_DMA_CHN 0x00000000 | ||
1006 | #define STM32_USART1_TX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 2) |\ | ||
1007 | STM32_DMA_STREAM_ID_MSK(1, 4)) | ||
1008 | #define STM32_USART1_TX_DMA_CHN 0x00000000 | ||
1009 | |||
1010 | #define STM32_HAS_USART2 TRUE | ||
1011 | #define STM32_USART2_RX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 5) | ||
1012 | #define STM32_USART2_RX_DMA_CHN 0x00000000 | ||
1013 | #define STM32_USART2_TX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 4) | ||
1014 | #define STM32_USART2_TX_DMA_CHN 0x00000000 | ||
1015 | |||
1016 | #define STM32_HAS_USART3 FALSE | ||
1017 | #define STM32_HAS_UART4 FALSE | ||
1018 | #define STM32_HAS_UART5 FALSE | ||
1019 | #define STM32_HAS_USART6 FALSE | ||
1020 | #define STM32_HAS_UART7 FALSE | ||
1021 | #define STM32_HAS_UART8 FALSE | ||
1022 | #define STM32_HAS_LPUART1 FALSE | ||
1023 | |||
1024 | /* USB attributes.*/ | ||
1025 | #define STM32_HAS_USB TRUE | ||
1026 | #define STM32_USB_ACCESS_SCHEME_2x16 TRUE | ||
1027 | #define STM32_USB_PMA_SIZE 768 | ||
1028 | #define STM32_USB_HAS_BCDR TRUE | ||
1029 | #define STM32_HAS_OTG1 FALSE | ||
1030 | #define STM32_HAS_OTG2 FALSE | ||
1031 | |||
1032 | /* IWDG attributes.*/ | ||
1033 | #define STM32_HAS_IWDG TRUE | ||
1034 | #define STM32_IWDG_IS_WINDOWED TRUE | ||
1035 | |||
1036 | /* LTDC attributes.*/ | ||
1037 | #define STM32_HAS_LTDC FALSE | ||
1038 | |||
1039 | /* DMA2D attributes.*/ | ||
1040 | #define STM32_HAS_DMA2D FALSE | ||
1041 | |||
1042 | /* FSMC attributes.*/ | ||
1043 | #define STM32_HAS_FSMC FALSE | ||
1044 | |||
1045 | /* CRC attributes.*/ | ||
1046 | #define STM32_HAS_CRC TRUE | ||
1047 | #define STM32_CRC_PROGRAMMABLE TRUE | ||
1048 | |||
1049 | /*===========================================================================*/ | ||
1050 | /* STM32F051x8, STM32F058xx. */ | ||
1051 | /*===========================================================================*/ | ||
1052 | #elif defined(STM32F051x8) || defined(STM32F058xx) | ||
1053 | |||
1054 | /* RCC attributes. */ | ||
1055 | #define STM32_HAS_HSI48 FALSE | ||
1056 | #define STM32_HAS_HSI_PREDIV FALSE | ||
1057 | #define STM32_HAS_MCO_PREDIV FALSE | ||
1058 | |||
1059 | /* ADC attributes.*/ | ||
1060 | #define STM32_HAS_ADC1 TRUE | ||
1061 | #define STM32_ADC_SUPPORTS_PRESCALER FALSE | ||
1062 | #define STM32_ADC_SUPPORTS_OVERSAMPLING FALSE | ||
1063 | #define STM32_ADC1_HANDLER Vector70 | ||
1064 | #define STM32_ADC1_NUMBER 12 | ||
1065 | #define STM32_ADC1_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 1) |\ | ||
1066 | STM32_DMA_STREAM_ID_MSK(1, 2)) | ||
1067 | #define STM32_ADC1_DMA_CHN 0x00000000 | ||
1068 | |||
1069 | #define STM32_HAS_ADC2 FALSE | ||
1070 | #define STM32_HAS_ADC3 FALSE | ||
1071 | #define STM32_HAS_ADC4 FALSE | ||
1072 | |||
1073 | /* CAN attributes.*/ | ||
1074 | #define STM32_HAS_CAN1 FALSE | ||
1075 | #define STM32_HAS_CAN2 FALSE | ||
1076 | #define STM32_HAS_CAN3 FALSE | ||
1077 | |||
1078 | /* DAC attributes.*/ | ||
1079 | #define STM32_HAS_DAC1_CH1 TRUE | ||
1080 | #define STM32_DAC1_CH1_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 3) | ||
1081 | #define STM32_DAC1_CH1_DMA_CHN 0x00000000 | ||
1082 | |||
1083 | #define STM32_HAS_DAC1_CH2 FALSE | ||
1084 | #define STM32_HAS_DAC2_CH1 FALSE | ||
1085 | #define STM32_HAS_DAC2_CH2 FALSE | ||
1086 | |||
1087 | /* DMA attributes.*/ | ||
1088 | #define STM32_ADVANCED_DMA TRUE | ||
1089 | #define STM32_DMA_SUPPORTS_DMAMUX FALSE | ||
1090 | #define STM32_DMA_SUPPORTS_CSELR FALSE | ||
1091 | #define STM32_DMA1_NUM_CHANNELS 5 | ||
1092 | #define STM32_DMA2_NUM_CHANNELS 0 | ||
1093 | |||
1094 | #define STM32_DMA1_CH1_HANDLER Vector64 | ||
1095 | #define STM32_DMA1_CH23_HANDLER Vector68 | ||
1096 | #define STM32_DMA1_CH4567_HANDLER Vector6C | ||
1097 | #define STM32_DMA1_CH1_NUMBER 9 | ||
1098 | #define STM32_DMA1_CH23_NUMBER 10 | ||
1099 | #define STM32_DMA1_CH4567_NUMBER 11 | ||
1100 | |||
1101 | #define STM32_DMA1_CH2_NUMBER STM32_DMA1_CH23_NUMBER | ||
1102 | #define STM32_DMA1_CH3_NUMBER STM32_DMA1_CH23_NUMBER | ||
1103 | #define STM32_DMA1_CH2_CMASK 0x00000006U | ||
1104 | #define STM32_DMA1_CH3_CMASK 0x00000006U | ||
1105 | |||
1106 | #define STM32_DMA1_CH4_NUMBER STM32_DMA1_CH4567_NUMBER | ||
1107 | #define STM32_DMA1_CH5_NUMBER STM32_DMA1_CH4567_NUMBER | ||
1108 | #define STM32_DMA1_CH6_NUMBER STM32_DMA1_CH4567_NUMBER | ||
1109 | #define STM32_DMA1_CH7_NUMBER STM32_DMA1_CH4567_NUMBER | ||
1110 | #define STM32_DMA1_CH4_CMASK 0x00000078U | ||
1111 | #define STM32_DMA1_CH5_CMASK 0x00000078U | ||
1112 | #define STM32_DMA1_CH6_CMASK 0x00000078U | ||
1113 | #define STM32_DMA1_CH7_CMASK 0x00000078U | ||
1114 | |||
1115 | /* ETH attributes.*/ | ||
1116 | #define STM32_HAS_ETH FALSE | ||
1117 | |||
1118 | /* EXTI attributes.*/ | ||
1119 | #define STM32_EXTI_NUM_LINES 32 | ||
1120 | #define STM32_EXTI_IMR1_MASK 0x0F940000U | ||
1121 | |||
1122 | /* GPIO attributes.*/ | ||
1123 | #define STM32_HAS_GPIOA TRUE | ||
1124 | #define STM32_HAS_GPIOB TRUE | ||
1125 | #define STM32_HAS_GPIOC TRUE | ||
1126 | #define STM32_HAS_GPIOD TRUE | ||
1127 | #define STM32_HAS_GPIOE FALSE | ||
1128 | #define STM32_HAS_GPIOF TRUE | ||
1129 | #define STM32_HAS_GPIOG FALSE | ||
1130 | #define STM32_HAS_GPIOH FALSE | ||
1131 | #define STM32_HAS_GPIOI FALSE | ||
1132 | #define STM32_HAS_GPIOJ FALSE | ||
1133 | #define STM32_HAS_GPIOK FALSE | ||
1134 | #define STM32_GPIO_EN_MASK (RCC_AHBENR_GPIOAEN | \ | ||
1135 | RCC_AHBENR_GPIOBEN | \ | ||
1136 | RCC_AHBENR_GPIOCEN | \ | ||
1137 | RCC_AHBENR_GPIODEN | \ | ||
1138 | RCC_AHBENR_GPIOFEN) | ||
1139 | |||
1140 | /* I2C attributes.*/ | ||
1141 | #define STM32_HAS_I2C1 TRUE | ||
1142 | #define STM32_I2C1_RX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 3) | ||
1143 | #define STM32_I2C1_RX_DMA_CHN 0x00000000 | ||
1144 | #define STM32_I2C1_TX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 2) | ||
1145 | #define STM32_I2C1_TX_DMA_CHN 0x00000000 | ||
1146 | |||
1147 | #define STM32_HAS_I2C2 TRUE | ||
1148 | #define STM32_I2C2_RX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 5) | ||
1149 | #define STM32_I2C2_RX_DMA_CHN 0x00000000 | ||
1150 | #define STM32_I2C2_TX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 4) | ||
1151 | #define STM32_I2C2_TX_DMA_CHN 0x00000000 | ||
1152 | |||
1153 | #define STM32_HAS_I2C3 FALSE | ||
1154 | #define STM32_HAS_I2C4 FALSE | ||
1155 | |||
1156 | /* QUADSPI attributes.*/ | ||
1157 | #define STM32_HAS_QUADSPI1 FALSE | ||
1158 | |||
1159 | /* RTC attributes.*/ | ||
1160 | #define STM32_HAS_RTC TRUE | ||
1161 | #define STM32_RTC_HAS_SUBSECONDS TRUE | ||
1162 | #define STM32_RTC_HAS_PERIODIC_WAKEUPS FALSE | ||
1163 | #define STM32_RTC_NUM_ALARMS 1 | ||
1164 | #define STM32_RTC_STORAGE_SIZE 0 | ||
1165 | #define STM32_RTC_COMMON_HANDLER Vector48 | ||
1166 | #define STM32_RTC_COMMON_NUMBER 2 | ||
1167 | #define STM32_RTC_ALARM_EXTI 17 | ||
1168 | #define STM32_RTC_TAMP_STAMP_EXTI 19 | ||
1169 | #define STM32_RTC_WKUP_EXTI 20 | ||
1170 | #define STM32_RTC_IRQ_ENABLE() \ | ||
1171 | nvicEnableVector(STM32_RTC_COMMON_NUMBER, STM32_IRQ_EXTI17_20_IRQ_PRIORITY) | ||
1172 | |||
1173 | /* SDIO attributes.*/ | ||
1174 | #define STM32_HAS_SDIO FALSE | ||
1175 | |||
1176 | /* SPI attributes.*/ | ||
1177 | #define STM32_HAS_SPI1 TRUE | ||
1178 | #define STM32_SPI1_SUPPORTS_I2S TRUE | ||
1179 | #define STM32_SPI1_I2S_FULLDUPLEX FALSE | ||
1180 | #define STM32_SPI1_RX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 2) | ||
1181 | #define STM32_SPI1_RX_DMA_CHN 0x00000000 | ||
1182 | #define STM32_SPI1_TX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 3) | ||
1183 | #define STM32_SPI1_TX_DMA_CHN 0x00000000 | ||
1184 | |||
1185 | #define STM32_HAS_SPI2 TRUE | ||
1186 | #define STM32_SPI2_SUPPORTS_I2S FALSE | ||
1187 | #define STM32_SPI2_RX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 4) | ||
1188 | #define STM32_SPI2_RX_DMA_CHN 0x00000000 | ||
1189 | #define STM32_SPI2_TX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 5) | ||
1190 | #define STM32_SPI2_TX_DMA_CHN 0x00000000 | ||
1191 | |||
1192 | #define STM32_HAS_SPI3 FALSE | ||
1193 | #define STM32_HAS_SPI4 FALSE | ||
1194 | #define STM32_HAS_SPI5 FALSE | ||
1195 | #define STM32_HAS_SPI6 FALSE | ||
1196 | |||
1197 | /* TIM attributes.*/ | ||
1198 | #define STM32_TIM_MAX_CHANNELS 4 | ||
1199 | |||
1200 | #define STM32_HAS_TIM1 TRUE | ||
1201 | #define STM32_TIM1_IS_32BITS FALSE | ||
1202 | #define STM32_TIM1_CHANNELS 4 | ||
1203 | |||
1204 | #define STM32_HAS_TIM2 TRUE | ||
1205 | #define STM32_TIM2_IS_32BITS TRUE | ||
1206 | #define STM32_TIM2_CHANNELS 4 | ||
1207 | |||
1208 | #define STM32_HAS_TIM3 TRUE | ||
1209 | #define STM32_TIM3_IS_32BITS FALSE | ||
1210 | #define STM32_TIM3_CHANNELS 4 | ||
1211 | |||
1212 | #define STM32_HAS_TIM6 TRUE | ||
1213 | #define STM32_TIM6_IS_32BITS FALSE | ||
1214 | #define STM32_TIM6_CHANNELS 0 | ||
1215 | |||
1216 | #define STM32_HAS_TIM14 TRUE | ||
1217 | #define STM32_TIM14_IS_32BITS FALSE | ||
1218 | #define STM32_TIM14_CHANNELS 1 | ||
1219 | |||
1220 | #define STM32_HAS_TIM15 TRUE | ||
1221 | #define STM32_TIM15_IS_32BITS FALSE | ||
1222 | #define STM32_TIM15_CHANNELS 2 | ||
1223 | |||
1224 | #define STM32_HAS_TIM16 TRUE | ||
1225 | #define STM32_TIM16_IS_32BITS FALSE | ||
1226 | #define STM32_TIM16_CHANNELS 1 | ||
1227 | |||
1228 | #define STM32_HAS_TIM17 TRUE | ||
1229 | #define STM32_TIM17_IS_32BITS FALSE | ||
1230 | #define STM32_TIM17_CHANNELS 1 | ||
1231 | |||
1232 | #define STM32_HAS_TIM4 FALSE | ||
1233 | #define STM32_HAS_TIM5 FALSE | ||
1234 | #define STM32_HAS_TIM7 FALSE | ||
1235 | #define STM32_HAS_TIM8 FALSE | ||
1236 | #define STM32_HAS_TIM9 FALSE | ||
1237 | #define STM32_HAS_TIM10 FALSE | ||
1238 | #define STM32_HAS_TIM11 FALSE | ||
1239 | #define STM32_HAS_TIM12 FALSE | ||
1240 | #define STM32_HAS_TIM13 FALSE | ||
1241 | #define STM32_HAS_TIM18 FALSE | ||
1242 | #define STM32_HAS_TIM19 FALSE | ||
1243 | #define STM32_HAS_TIM20 FALSE | ||
1244 | #define STM32_HAS_TIM21 FALSE | ||
1245 | #define STM32_HAS_TIM22 FALSE | ||
1246 | |||
1247 | /* USART attributes.*/ | ||
1248 | #define STM32_HAS_USART1 TRUE | ||
1249 | #define STM32_USART1_RX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 3) |\ | ||
1250 | STM32_DMA_STREAM_ID_MSK(1, 5)) | ||
1251 | #define STM32_USART1_RX_DMA_CHN 0x00000000 | ||
1252 | #define STM32_USART1_TX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 2) |\ | ||
1253 | STM32_DMA_STREAM_ID_MSK(1, 4)) | ||
1254 | #define STM32_USART1_TX_DMA_CHN 0x00000000 | ||
1255 | |||
1256 | #define STM32_HAS_USART2 TRUE | ||
1257 | #define STM32_USART2_RX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 5) | ||
1258 | #define STM32_USART2_RX_DMA_CHN 0x00000000 | ||
1259 | #define STM32_USART2_TX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 4) | ||
1260 | #define STM32_USART2_TX_DMA_CHN 0x00000000 | ||
1261 | |||
1262 | #define STM32_HAS_USART3 FALSE | ||
1263 | #define STM32_HAS_UART4 FALSE | ||
1264 | #define STM32_HAS_UART5 FALSE | ||
1265 | #define STM32_HAS_USART6 FALSE | ||
1266 | #define STM32_HAS_UART7 FALSE | ||
1267 | #define STM32_HAS_UART8 FALSE | ||
1268 | #define STM32_HAS_LPUART1 FALSE | ||
1269 | |||
1270 | /* USB attributes.*/ | ||
1271 | #define STM32_HAS_USB FALSE | ||
1272 | #define STM32_HAS_OTG1 FALSE | ||
1273 | #define STM32_HAS_OTG2 FALSE | ||
1274 | |||
1275 | /* IWDG attributes.*/ | ||
1276 | #define STM32_HAS_IWDG TRUE | ||
1277 | #define STM32_IWDG_IS_WINDOWED TRUE | ||
1278 | |||
1279 | /* LTDC attributes.*/ | ||
1280 | #define STM32_HAS_LTDC FALSE | ||
1281 | |||
1282 | /* DMA2D attributes.*/ | ||
1283 | #define STM32_HAS_DMA2D FALSE | ||
1284 | |||
1285 | /* FSMC attributes.*/ | ||
1286 | #define STM32_HAS_FSMC FALSE | ||
1287 | |||
1288 | /* CRC attributes.*/ | ||
1289 | #define STM32_HAS_CRC TRUE | ||
1290 | #define STM32_CRC_PROGRAMMABLE TRUE | ||
1291 | |||
1292 | /*===========================================================================*/ | ||
1293 | /* STM32F070x6, STM32F070xB. */ | ||
1294 | /*===========================================================================*/ | ||
1295 | #elif defined(STM32F070x6) || defined(STM32F070xB) | ||
1296 | |||
1297 | /* Common identifier of all STM32F070 devices.*/ | ||
1298 | #define STM32F070 | ||
1299 | |||
1300 | /* RCC attributes. */ | ||
1301 | #define STM32_HAS_HSI48 FALSE | ||
1302 | #define STM32_HAS_HSI_PREDIV TRUE | ||
1303 | #define STM32_HAS_MCO_PREDIV TRUE | ||
1304 | |||
1305 | /* ADC attributes.*/ | ||
1306 | #define STM32_HAS_ADC1 TRUE | ||
1307 | #define STM32_ADC_SUPPORTS_PRESCALER FALSE | ||
1308 | #define STM32_ADC_SUPPORTS_OVERSAMPLING FALSE | ||
1309 | #define STM32_ADC1_HANDLER Vector70 | ||
1310 | #define STM32_ADC1_NUMBER 12 | ||
1311 | #define STM32_ADC1_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 1) |\ | ||
1312 | STM32_DMA_STREAM_ID_MSK(1, 2)) | ||
1313 | #define STM32_ADC1_DMA_CHN 0x00000000 | ||
1314 | |||
1315 | #define STM32_HAS_ADC2 FALSE | ||
1316 | #define STM32_HAS_ADC3 FALSE | ||
1317 | #define STM32_HAS_ADC4 FALSE | ||
1318 | |||
1319 | /* CAN attributes.*/ | ||
1320 | #define STM32_HAS_CAN1 FALSE | ||
1321 | #define STM32_HAS_CAN2 FALSE | ||
1322 | #define STM32_HAS_CAN3 FALSE | ||
1323 | |||
1324 | /* DAC attributes.*/ | ||
1325 | #define STM32_HAS_DAC1_CH1 FALSE | ||
1326 | #define STM32_HAS_DAC1_CH2 FALSE | ||
1327 | #define STM32_HAS_DAC2_CH1 FALSE | ||
1328 | #define STM32_HAS_DAC2_CH2 FALSE | ||
1329 | |||
1330 | /* DMA attributes.*/ | ||
1331 | #define STM32_ADVANCED_DMA TRUE | ||
1332 | #define STM32_DMA_SUPPORTS_DMAMUX FALSE | ||
1333 | #define STM32_DMA_SUPPORTS_CSELR FALSE | ||
1334 | #define STM32_DMA1_NUM_CHANNELS 5 | ||
1335 | #define STM32_DMA2_NUM_CHANNELS 0 | ||
1336 | #define STM32_DMA1_CH1_HANDLER Vector64 | ||
1337 | #define STM32_DMA1_CH23_HANDLER Vector68 | ||
1338 | #define STM32_DMA1_CH4567_HANDLER Vector6C | ||
1339 | #define STM32_DMA1_CH1_NUMBER 9 | ||
1340 | #define STM32_DMA1_CH23_NUMBER 10 | ||
1341 | #define STM32_DMA1_CH4567_NUMBER 11 | ||
1342 | |||
1343 | #define STM32_DMA1_CH2_NUMBER STM32_DMA1_CH23_NUMBER | ||
1344 | #define STM32_DMA1_CH3_NUMBER STM32_DMA1_CH23_NUMBER | ||
1345 | #define STM32_DMA1_CH2_CMASK 0x00000006U | ||
1346 | #define STM32_DMA1_CH3_CMASK 0x00000006U | ||
1347 | |||
1348 | #define STM32_DMA1_CH4_NUMBER STM32_DMA1_CH4567_NUMBER | ||
1349 | #define STM32_DMA1_CH5_NUMBER STM32_DMA1_CH4567_NUMBER | ||
1350 | #define STM32_DMA1_CH6_NUMBER STM32_DMA1_CH4567_NUMBER | ||
1351 | #define STM32_DMA1_CH7_NUMBER STM32_DMA1_CH4567_NUMBER | ||
1352 | #define STM32_DMA1_CH4_CMASK 0x00000078U | ||
1353 | #define STM32_DMA1_CH5_CMASK 0x00000078U | ||
1354 | #define STM32_DMA1_CH6_CMASK 0x00000078U | ||
1355 | #define STM32_DMA1_CH7_CMASK 0x00000078U | ||
1356 | |||
1357 | /* ETH attributes.*/ | ||
1358 | #define STM32_HAS_ETH FALSE | ||
1359 | |||
1360 | /* EXTI attributes.*/ | ||
1361 | #define STM32_EXTI_NUM_LINES 32 | ||
1362 | #define STM32_EXTI_IMR1_MASK 0x7F840000U | ||
1363 | |||
1364 | /* GPIO attributes.*/ | ||
1365 | #define STM32_HAS_GPIOA TRUE | ||
1366 | #define STM32_HAS_GPIOB TRUE | ||
1367 | #define STM32_HAS_GPIOC TRUE | ||
1368 | #if defined(STM32F070x6) | ||
1369 | #define STM32_HAS_GPIOD FALSE | ||
1370 | #else | ||
1371 | #define STM32_HAS_GPIOD TRUE | ||
1372 | #endif | ||
1373 | #define STM32_HAS_GPIOE FALSE | ||
1374 | #define STM32_HAS_GPIOF TRUE | ||
1375 | #define STM32_HAS_GPIOG FALSE | ||
1376 | #define STM32_HAS_GPIOH FALSE | ||
1377 | #define STM32_HAS_GPIOI FALSE | ||
1378 | #define STM32_HAS_GPIOJ FALSE | ||
1379 | #define STM32_HAS_GPIOK FALSE | ||
1380 | #define STM32_GPIO_EN_MASK (RCC_AHBENR_GPIOAEN | \ | ||
1381 | RCC_AHBENR_GPIOBEN | \ | ||
1382 | RCC_AHBENR_GPIOCEN | \ | ||
1383 | RCC_AHBENR_GPIODEN | \ | ||
1384 | RCC_AHBENR_GPIOFEN) | ||
1385 | |||
1386 | /* I2C attributes.*/ | ||
1387 | #define STM32_HAS_I2C1 TRUE | ||
1388 | #define STM32_I2C1_RX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 3) | ||
1389 | #define STM32_I2C1_RX_DMA_CHN 0x00000000 | ||
1390 | #define STM32_I2C1_TX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 2) | ||
1391 | #define STM32_I2C1_TX_DMA_CHN 0x00000000 | ||
1392 | |||
1393 | #define STM32_HAS_I2C2 TRUE | ||
1394 | #define STM32_I2C2_RX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 5) | ||
1395 | #define STM32_I2C2_RX_DMA_CHN 0x00000000 | ||
1396 | #define STM32_I2C2_TX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 4) | ||
1397 | #define STM32_I2C2_TX_DMA_CHN 0x00000000 | ||
1398 | |||
1399 | #define STM32_HAS_I2C3 FALSE | ||
1400 | #define STM32_HAS_I2C4 FALSE | ||
1401 | |||
1402 | /* QUADSPI attributes.*/ | ||
1403 | #define STM32_HAS_QUADSPI1 FALSE | ||
1404 | |||
1405 | /* RTC attributes.*/ | ||
1406 | #define STM32_HAS_RTC TRUE | ||
1407 | #define STM32_RTC_HAS_SUBSECONDS TRUE | ||
1408 | #if defined (STM32F070xB) | ||
1409 | #define STM32_RTC_HAS_PERIODIC_WAKEUPS TRUE | ||
1410 | #else | ||
1411 | #define STM32_RTC_HAS_PERIODIC_WAKEUPS FALSE | ||
1412 | #endif | ||
1413 | #define STM32_RTC_NUM_ALARMS 1 | ||
1414 | #define STM32_RTC_STORAGE_SIZE 0 | ||
1415 | #define STM32_RTC_COMMON_HANDLER Vector48 | ||
1416 | #define STM32_RTC_COMMON_NUMBER 2 | ||
1417 | #define STM32_RTC_ALARM_EXTI 17 | ||
1418 | #define STM32_RTC_TAMP_STAMP_EXTI 19 | ||
1419 | #define STM32_RTC_WKUP_EXTI 20 | ||
1420 | #define STM32_RTC_IRQ_ENABLE() \ | ||
1421 | nvicEnableVector(STM32_RTC_COMMON_NUMBER, STM32_IRQ_EXTI17_20_IRQ_PRIORITY) | ||
1422 | |||
1423 | /* SDIO attributes.*/ | ||
1424 | #define STM32_HAS_SDIO FALSE | ||
1425 | |||
1426 | /* SPI attributes.*/ | ||
1427 | #define STM32_HAS_SPI1 TRUE | ||
1428 | #define STM32_SPI1_SUPPORTS_I2S FALSE | ||
1429 | #define STM32_SPI1_RX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 2) | ||
1430 | #define STM32_SPI1_RX_DMA_CHN 0x00000000 | ||
1431 | #define STM32_SPI1_TX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 3) | ||
1432 | #define STM32_SPI1_TX_DMA_CHN 0x00000000 | ||
1433 | |||
1434 | #define STM32_HAS_SPI2 TRUE | ||
1435 | #define STM32_SPI2_SUPPORTS_I2S FALSE | ||
1436 | #define STM32_SPI2_RX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 4) | ||
1437 | #define STM32_SPI2_RX_DMA_CHN 0x00000000 | ||
1438 | #define STM32_SPI2_TX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 5) | ||
1439 | #define STM32_SPI2_TX_DMA_CHN 0x00000000 | ||
1440 | |||
1441 | #define STM32_HAS_SPI3 FALSE | ||
1442 | #define STM32_HAS_SPI4 FALSE | ||
1443 | #define STM32_HAS_SPI5 FALSE | ||
1444 | #define STM32_HAS_SPI6 FALSE | ||
1445 | |||
1446 | /* TIM attributes.*/ | ||
1447 | #define STM32_TIM_MAX_CHANNELS 4 | ||
1448 | |||
1449 | #define STM32_HAS_TIM1 TRUE | ||
1450 | #define STM32_TIM1_IS_32BITS FALSE | ||
1451 | #define STM32_TIM1_CHANNELS 4 | ||
1452 | |||
1453 | #define STM32_HAS_TIM3 TRUE | ||
1454 | #define STM32_TIM3_IS_32BITS FALSE | ||
1455 | #define STM32_TIM3_CHANNELS 4 | ||
1456 | |||
1457 | #define STM32_HAS_TIM6 TRUE | ||
1458 | #define STM32_TIM6_IS_32BITS FALSE | ||
1459 | #define STM32_TIM6_CHANNELS 0 | ||
1460 | |||
1461 | #define STM32_HAS_TIM7 TRUE | ||
1462 | #define STM32_TIM7_IS_32BITS FALSE | ||
1463 | #define STM32_TIM7_CHANNELS 0 | ||
1464 | |||
1465 | #define STM32_HAS_TIM14 TRUE | ||
1466 | #define STM32_TIM14_IS_32BITS FALSE | ||
1467 | #define STM32_TIM14_CHANNELS 1 | ||
1468 | |||
1469 | #define STM32_HAS_TIM15 TRUE | ||
1470 | #define STM32_TIM15_IS_32BITS FALSE | ||
1471 | #define STM32_TIM15_CHANNELS 2 | ||
1472 | |||
1473 | #define STM32_HAS_TIM16 TRUE | ||
1474 | #define STM32_TIM16_IS_32BITS FALSE | ||
1475 | #define STM32_TIM16_CHANNELS 1 | ||
1476 | |||
1477 | #define STM32_HAS_TIM17 TRUE | ||
1478 | #define STM32_TIM17_IS_32BITS FALSE | ||
1479 | #define STM32_TIM17_CHANNELS 1 | ||
1480 | |||
1481 | #define STM32_HAS_TIM2 FALSE | ||
1482 | #define STM32_HAS_TIM4 FALSE | ||
1483 | #define STM32_HAS_TIM5 FALSE | ||
1484 | #define STM32_HAS_TIM8 FALSE | ||
1485 | #define STM32_HAS_TIM9 FALSE | ||
1486 | #define STM32_HAS_TIM10 FALSE | ||
1487 | #define STM32_HAS_TIM11 FALSE | ||
1488 | #define STM32_HAS_TIM12 FALSE | ||
1489 | #define STM32_HAS_TIM13 FALSE | ||
1490 | #define STM32_HAS_TIM18 FALSE | ||
1491 | #define STM32_HAS_TIM19 FALSE | ||
1492 | #define STM32_HAS_TIM20 FALSE | ||
1493 | #define STM32_HAS_TIM21 FALSE | ||
1494 | #define STM32_HAS_TIM22 FALSE | ||
1495 | |||
1496 | /* USART attributes.*/ | ||
1497 | #define STM32_HAS_USART1 TRUE | ||
1498 | #define STM32_USART1_RX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 3) |\ | ||
1499 | STM32_DMA_STREAM_ID_MSK(1, 5)) | ||
1500 | #define STM32_USART1_RX_DMA_CHN 0x00000000 | ||
1501 | #define STM32_USART1_TX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 2) |\ | ||
1502 | STM32_DMA_STREAM_ID_MSK(1, 4)) | ||
1503 | #define STM32_USART1_TX_DMA_CHN 0x00000000 | ||
1504 | |||
1505 | #define STM32_HAS_USART2 TRUE | ||
1506 | #define STM32_USART2_RX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 5) | ||
1507 | #define STM32_USART2_RX_DMA_CHN 0x00000000 | ||
1508 | #define STM32_USART2_TX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 4) | ||
1509 | #define STM32_USART2_TX_DMA_CHN 0x00000000 | ||
1510 | |||
1511 | #define STM32_HAS_USART3 TRUE | ||
1512 | #define STM32_USART3_RX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 3) | ||
1513 | #define STM32_USART3_RX_DMA_CHN 0x00000000 | ||
1514 | #define STM32_USART3_TX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 2) | ||
1515 | #define STM32_USART3_TX_DMA_CHN 0x00000000 | ||
1516 | |||
1517 | #define STM32_HAS_UART4 TRUE | ||
1518 | #define STM32_UART4_RX_DMA_MSK 0 | ||
1519 | #define STM32_UART4_RX_DMA_CHN 0x00000000 | ||
1520 | #define STM32_UART4_TX_DMA_MSK 0 | ||
1521 | #define STM32_UART4_TX_DMA_CHN 0x00000000 | ||
1522 | |||
1523 | #define STM32_HAS_UART5 FALSE | ||
1524 | #define STM32_HAS_USART6 FALSE | ||
1525 | #define STM32_HAS_UART7 FALSE | ||
1526 | #define STM32_HAS_UART8 FALSE | ||
1527 | #define STM32_HAS_LPUART1 FALSE | ||
1528 | |||
1529 | /* USB attributes.*/ | ||
1530 | #define STM32_HAS_USB TRUE | ||
1531 | #define STM32_USB_ACCESS_SCHEME_2x16 TRUE | ||
1532 | #define STM32_USB_PMA_SIZE 768 | ||
1533 | #define STM32_USB_HAS_BCDR TRUE | ||
1534 | |||
1535 | #define STM32_HAS_OTG1 FALSE | ||
1536 | #define STM32_HAS_OTG2 FALSE | ||
1537 | |||
1538 | /* IWDG attributes.*/ | ||
1539 | #define STM32_HAS_IWDG TRUE | ||
1540 | #define STM32_IWDG_IS_WINDOWED TRUE | ||
1541 | |||
1542 | /* LTDC attributes.*/ | ||
1543 | #define STM32_HAS_LTDC FALSE | ||
1544 | |||
1545 | /* DMA2D attributes.*/ | ||
1546 | #define STM32_HAS_DMA2D FALSE | ||
1547 | |||
1548 | /* FSMC attributes.*/ | ||
1549 | #define STM32_HAS_FSMC FALSE | ||
1550 | |||
1551 | /* CRC attributes.*/ | ||
1552 | #define STM32_HAS_CRC TRUE | ||
1553 | #define STM32_CRC_PROGRAMMABLE FALSE | ||
1554 | |||
1555 | /*===========================================================================*/ | ||
1556 | /* STM32F071xB, STM32F072xB, STM32F078xx. */ | ||
1557 | /*===========================================================================*/ | ||
1558 | #elif defined(STM32F071xB) || defined(STM32F072xB) || \ | ||
1559 | defined(STM32F078xx) | ||
1560 | |||
1561 | /* RCC attributes. */ | ||
1562 | #define STM32_HAS_HSI48 TRUE | ||
1563 | #define STM32_HAS_HSI_PREDIV TRUE | ||
1564 | #define STM32_HAS_MCO_PREDIV TRUE | ||
1565 | |||
1566 | /* ADC attributes.*/ | ||
1567 | #define STM32_HAS_ADC1 TRUE | ||
1568 | #define STM32_ADC_SUPPORTS_PRESCALER FALSE | ||
1569 | #define STM32_ADC_SUPPORTS_OVERSAMPLING FALSE | ||
1570 | #define STM32_ADC1_HANDLER Vector70 | ||
1571 | #define STM32_ADC1_NUMBER 12 | ||
1572 | #define STM32_ADC1_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 1) |\ | ||
1573 | STM32_DMA_STREAM_ID_MSK(1, 2)) | ||
1574 | #define STM32_ADC1_DMA_CHN 0x00000000 | ||
1575 | |||
1576 | #define STM32_HAS_ADC2 FALSE | ||
1577 | #define STM32_HAS_ADC3 FALSE | ||
1578 | #define STM32_HAS_ADC4 FALSE | ||
1579 | |||
1580 | /* CAN attributes.*/ | ||
1581 | #if defined(STM32F072xB) | ||
1582 | #define STM32_HAS_CAN1 TRUE | ||
1583 | #define STM32_CAN_MAX_FILTERS 14 | ||
1584 | #else | ||
1585 | #define STM32_HAS_CAN1 FALSE | ||
1586 | #endif | ||
1587 | #define STM32_HAS_CAN2 FALSE | ||
1588 | #define STM32_HAS_CAN3 FALSE | ||
1589 | |||
1590 | /* DAC attributes.*/ | ||
1591 | #define STM32_HAS_DAC1_CH1 TRUE | ||
1592 | #define STM32_DAC1_CH1_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 3) | ||
1593 | #define STM32_DAC1_CH1_DMA_CHN 0x00000000 | ||
1594 | |||
1595 | #define STM32_HAS_DAC1_CH2 TRUE | ||
1596 | #define STM32_DAC1_CH2_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 4) | ||
1597 | #define STM32_DAC1_CH2_DMA_CHN 0x00000000 | ||
1598 | |||
1599 | #define STM32_HAS_DAC2_CH1 FALSE | ||
1600 | #define STM32_HAS_DAC2_CH2 FALSE | ||
1601 | |||
1602 | /* DMA attributes.*/ | ||
1603 | #define STM32_ADVANCED_DMA TRUE | ||
1604 | #define STM32_DMA_SUPPORTS_DMAMUX FALSE | ||
1605 | #define STM32_DMA_SUPPORTS_CSELR FALSE | ||
1606 | #define STM32_DMA1_NUM_CHANNELS 7 | ||
1607 | #define STM32_DMA2_NUM_CHANNELS 0 | ||
1608 | #define STM32_DMA1_CH1_HANDLER Vector64 | ||
1609 | #define STM32_DMA1_CH23_HANDLER Vector68 | ||
1610 | #define STM32_DMA1_CH4567_HANDLER Vector6C | ||
1611 | #define STM32_DMA1_CH1_NUMBER 9 | ||
1612 | #define STM32_DMA1_CH23_NUMBER 10 | ||
1613 | #define STM32_DMA1_CH4567_NUMBER 11 | ||
1614 | |||
1615 | #define STM32_DMA1_CH2_NUMBER STM32_DMA1_CH23_NUMBER | ||
1616 | #define STM32_DMA1_CH3_NUMBER STM32_DMA1_CH23_NUMBER | ||
1617 | #define STM32_DMA1_CH2_CMASK 0x00000006U | ||
1618 | #define STM32_DMA1_CH3_CMASK 0x00000006U | ||
1619 | |||
1620 | #define STM32_DMA1_CH4_NUMBER STM32_DMA1_CH4567_NUMBER | ||
1621 | #define STM32_DMA1_CH5_NUMBER STM32_DMA1_CH4567_NUMBER | ||
1622 | #define STM32_DMA1_CH6_NUMBER STM32_DMA1_CH4567_NUMBER | ||
1623 | #define STM32_DMA1_CH7_NUMBER STM32_DMA1_CH4567_NUMBER | ||
1624 | #define STM32_DMA1_CH4_CMASK 0x00000078U | ||
1625 | #define STM32_DMA1_CH5_CMASK 0x00000078U | ||
1626 | #define STM32_DMA1_CH6_CMASK 0x00000078U | ||
1627 | #define STM32_DMA1_CH7_CMASK 0x00000078U | ||
1628 | |||
1629 | /* ETH attributes.*/ | ||
1630 | #define STM32_HAS_ETH FALSE | ||
1631 | |||
1632 | /* EXTI attributes.*/ | ||
1633 | #define STM32_EXTI_NUM_LINES 32 | ||
1634 | #define STM32_EXTI_IMR1_MASK 0x7F840000U | ||
1635 | |||
1636 | /* GPIO attributes.*/ | ||
1637 | #define STM32_HAS_GPIOA TRUE | ||
1638 | #define STM32_HAS_GPIOB TRUE | ||
1639 | #define STM32_HAS_GPIOC TRUE | ||
1640 | #define STM32_HAS_GPIOD TRUE | ||
1641 | #define STM32_HAS_GPIOE TRUE | ||
1642 | #define STM32_HAS_GPIOF TRUE | ||
1643 | #define STM32_HAS_GPIOG FALSE | ||
1644 | #define STM32_HAS_GPIOH FALSE | ||
1645 | #define STM32_HAS_GPIOI FALSE | ||
1646 | #define STM32_HAS_GPIOJ FALSE | ||
1647 | #define STM32_HAS_GPIOK FALSE | ||
1648 | #define STM32_GPIO_EN_MASK (RCC_AHBENR_GPIOAEN | \ | ||
1649 | RCC_AHBENR_GPIOBEN | \ | ||
1650 | RCC_AHBENR_GPIOCEN | \ | ||
1651 | RCC_AHBENR_GPIODEN | \ | ||
1652 | RCC_AHBENR_GPIOEEN | \ | ||
1653 | RCC_AHBENR_GPIOFEN) | ||
1654 | |||
1655 | /* I2C attributes.*/ | ||
1656 | #define STM32_HAS_I2C1 TRUE | ||
1657 | #define STM32_I2C1_RX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 3) |\ | ||
1658 | STM32_DMA_STREAM_ID_MSK(1, 7)) | ||
1659 | #define STM32_I2C1_RX_DMA_CHN 0x00000000 | ||
1660 | #define STM32_I2C1_TX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 2) |\ | ||
1661 | STM32_DMA_STREAM_ID_MSK(1, 6)) | ||
1662 | #define STM32_I2C1_TX_DMA_CHN 0x00000000 | ||
1663 | |||
1664 | #define STM32_HAS_I2C2 TRUE | ||
1665 | #define STM32_I2C2_RX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 5) | ||
1666 | #define STM32_I2C2_RX_DMA_CHN 0x00000000 | ||
1667 | #define STM32_I2C2_TX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 4) | ||
1668 | #define STM32_I2C2_TX_DMA_CHN 0x00000000 | ||
1669 | |||
1670 | #define STM32_HAS_I2C3 FALSE | ||
1671 | #define STM32_HAS_I2C4 FALSE | ||
1672 | |||
1673 | /* QUADSPI attributes.*/ | ||
1674 | #define STM32_HAS_QUADSPI1 FALSE | ||
1675 | |||
1676 | /* RTC attributes.*/ | ||
1677 | #define STM32_HAS_RTC TRUE | ||
1678 | #define STM32_RTC_HAS_SUBSECONDS TRUE | ||
1679 | #define STM32_RTC_HAS_PERIODIC_WAKEUPS TRUE | ||
1680 | #define STM32_RTC_NUM_ALARMS 1 | ||
1681 | #define STM32_RTC_STORAGE_SIZE 0 | ||
1682 | #define STM32_RTC_COMMON_HANDLER Vector48 | ||
1683 | #define STM32_RTC_COMMON_NUMBER 2 | ||
1684 | #define STM32_RTC_ALARM_EXTI 17 | ||
1685 | #define STM32_RTC_TAMP_STAMP_EXTI 19 | ||
1686 | #define STM32_RTC_WKUP_EXTI 20 | ||
1687 | #define STM32_RTC_IRQ_ENABLE() \ | ||
1688 | nvicEnableVector(STM32_RTC_COMMON_NUMBER, STM32_IRQ_EXTI17_20_IRQ_PRIORITY) | ||
1689 | |||
1690 | /* SDIO attributes.*/ | ||
1691 | #define STM32_HAS_SDIO FALSE | ||
1692 | |||
1693 | /* SPI attributes.*/ | ||
1694 | #define STM32_HAS_SPI1 TRUE | ||
1695 | #define STM32_SPI1_SUPPORTS_I2S TRUE | ||
1696 | #define STM32_SPI1_I2S_FULLDUPLEX FALSE | ||
1697 | #define STM32_SPI1_RX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 2) | ||
1698 | #define STM32_SPI1_RX_DMA_CHN 0x00000000 | ||
1699 | #define STM32_SPI1_TX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 3) | ||
1700 | #define STM32_SPI1_TX_DMA_CHN 0x00000000 | ||
1701 | |||
1702 | #define STM32_HAS_SPI2 TRUE | ||
1703 | #define STM32_SPI2_SUPPORTS_I2S TRUE | ||
1704 | #define STM32_SPI2_I2S_FULLDUPLEX FALSE | ||
1705 | #define STM32_SPI2_RX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 4) |\ | ||
1706 | STM32_DMA_STREAM_ID_MSK(1, 6)) | ||
1707 | #define STM32_SPI2_RX_DMA_CHN 0x00000000 | ||
1708 | #define STM32_SPI2_TX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 5) |\ | ||
1709 | STM32_DMA_STREAM_ID_MSK(1, 7)) | ||
1710 | #define STM32_SPI2_TX_DMA_CHN 0x00000000 | ||
1711 | |||
1712 | #define STM32_HAS_SPI3 FALSE | ||
1713 | #define STM32_HAS_SPI4 FALSE | ||
1714 | #define STM32_HAS_SPI5 FALSE | ||
1715 | #define STM32_HAS_SPI6 FALSE | ||
1716 | |||
1717 | /* TIM attributes.*/ | ||
1718 | #define STM32_TIM_MAX_CHANNELS 4 | ||
1719 | |||
1720 | #define STM32_HAS_TIM1 TRUE | ||
1721 | #define STM32_TIM1_IS_32BITS FALSE | ||
1722 | #define STM32_TIM1_CHANNELS 4 | ||
1723 | |||
1724 | #define STM32_HAS_TIM2 TRUE | ||
1725 | #define STM32_TIM2_IS_32BITS TRUE | ||
1726 | #define STM32_TIM2_CHANNELS 4 | ||
1727 | |||
1728 | #define STM32_HAS_TIM3 TRUE | ||
1729 | #define STM32_TIM3_IS_32BITS FALSE | ||
1730 | #define STM32_TIM3_CHANNELS 4 | ||
1731 | |||
1732 | #define STM32_HAS_TIM6 TRUE | ||
1733 | #define STM32_TIM6_IS_32BITS FALSE | ||
1734 | #define STM32_TIM6_CHANNELS 0 | ||
1735 | |||
1736 | #define STM32_HAS_TIM14 TRUE | ||
1737 | #define STM32_TIM14_IS_32BITS FALSE | ||
1738 | #define STM32_TIM14_CHANNELS 1 | ||
1739 | |||
1740 | #define STM32_HAS_TIM15 TRUE | ||
1741 | #define STM32_TIM15_IS_32BITS FALSE | ||
1742 | #define STM32_TIM15_CHANNELS 2 | ||
1743 | |||
1744 | #define STM32_HAS_TIM16 TRUE | ||
1745 | #define STM32_TIM16_IS_32BITS FALSE | ||
1746 | #define STM32_TIM16_CHANNELS 1 | ||
1747 | |||
1748 | #define STM32_HAS_TIM17 TRUE | ||
1749 | #define STM32_TIM17_IS_32BITS FALSE | ||
1750 | #define STM32_TIM17_CHANNELS 1 | ||
1751 | |||
1752 | #define STM32_HAS_TIM4 FALSE | ||
1753 | #define STM32_HAS_TIM5 FALSE | ||
1754 | #define STM32_HAS_TIM7 FALSE | ||
1755 | #define STM32_HAS_TIM8 FALSE | ||
1756 | #define STM32_HAS_TIM9 FALSE | ||
1757 | #define STM32_HAS_TIM10 FALSE | ||
1758 | #define STM32_HAS_TIM11 FALSE | ||
1759 | #define STM32_HAS_TIM12 FALSE | ||
1760 | #define STM32_HAS_TIM13 FALSE | ||
1761 | #define STM32_HAS_TIM18 FALSE | ||
1762 | #define STM32_HAS_TIM19 FALSE | ||
1763 | #define STM32_HAS_TIM20 FALSE | ||
1764 | #define STM32_HAS_TIM21 FALSE | ||
1765 | #define STM32_HAS_TIM22 FALSE | ||
1766 | |||
1767 | /* USART attributes.*/ | ||
1768 | #define STM32_HAS_USART1 TRUE | ||
1769 | #define STM32_USART1_RX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 3) |\ | ||
1770 | STM32_DMA_STREAM_ID_MSK(1, 5)) | ||
1771 | #define STM32_USART1_RX_DMA_CHN 0x00000000 | ||
1772 | #define STM32_USART1_TX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 2) |\ | ||
1773 | STM32_DMA_STREAM_ID_MSK(1, 4)) | ||
1774 | #define STM32_USART1_TX_DMA_CHN 0x00000000 | ||
1775 | |||
1776 | #define STM32_HAS_USART2 TRUE | ||
1777 | #define STM32_USART2_RX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 5) |\ | ||
1778 | STM32_DMA_STREAM_ID_MSK(1, 6)) | ||
1779 | #define STM32_USART2_RX_DMA_CHN 0x00000000 | ||
1780 | #define STM32_USART2_TX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 4) |\ | ||
1781 | STM32_DMA_STREAM_ID_MSK(1, 7)) | ||
1782 | #define STM32_USART2_TX_DMA_CHN 0x00000000 | ||
1783 | |||
1784 | #define STM32_HAS_USART3 TRUE | ||
1785 | #define STM32_USART3_RX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 6) |\ | ||
1786 | STM32_DMA_STREAM_ID_MSK(1, 3)) | ||
1787 | #define STM32_USART3_RX_DMA_CHN 0x00000000 | ||
1788 | #define STM32_USART3_TX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 7) |\ | ||
1789 | STM32_DMA_STREAM_ID_MSK(1, 2)) | ||
1790 | #define STM32_USART3_TX_DMA_CHN 0x00000000 | ||
1791 | |||
1792 | #define STM32_HAS_UART4 TRUE | ||
1793 | #define STM32_UART4_RX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 6) | ||
1794 | #define STM32_UART4_RX_DMA_CHN 0x00000000 | ||
1795 | #define STM32_UART4_TX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 7) | ||
1796 | #define STM32_UART4_TX_DMA_CHN 0x00000000 | ||
1797 | |||
1798 | #define STM32_HAS_UART5 FALSE | ||
1799 | #define STM32_HAS_USART6 FALSE | ||
1800 | #define STM32_HAS_UART7 FALSE | ||
1801 | #define STM32_HAS_UART8 FALSE | ||
1802 | #define STM32_HAS_LPUART1 FALSE | ||
1803 | |||
1804 | /* USB attributes.*/ | ||
1805 | #if defined(STM32F072xB) || defined(STM32F078xx) | ||
1806 | #define STM32_HAS_USB TRUE | ||
1807 | #define STM32_USB_ACCESS_SCHEME_2x16 TRUE | ||
1808 | #define STM32_USB_PMA_SIZE 768 | ||
1809 | #define STM32_USB_HAS_BCDR TRUE | ||
1810 | #else | ||
1811 | #define STM32_HAS_USB FALSE | ||
1812 | #endif | ||
1813 | #define STM32_HAS_OTG1 FALSE | ||
1814 | #define STM32_HAS_OTG2 FALSE | ||
1815 | |||
1816 | /* IWDG attributes.*/ | ||
1817 | #define STM32_HAS_IWDG TRUE | ||
1818 | #define STM32_IWDG_IS_WINDOWED TRUE | ||
1819 | |||
1820 | /* LTDC attributes.*/ | ||
1821 | #define STM32_HAS_LTDC FALSE | ||
1822 | |||
1823 | /* DMA2D attributes.*/ | ||
1824 | #define STM32_HAS_DMA2D FALSE | ||
1825 | |||
1826 | /* FSMC attributes.*/ | ||
1827 | #define STM32_HAS_FSMC FALSE | ||
1828 | |||
1829 | /* CRC attributes.*/ | ||
1830 | #define STM32_HAS_CRC TRUE | ||
1831 | #define STM32_CRC_PROGRAMMABLE TRUE | ||
1832 | |||
1833 | /*===========================================================================*/ | ||
1834 | /* STM32F091xC, STM32F098xx. */ | ||
1835 | /*===========================================================================*/ | ||
1836 | #elif defined(STM32F091xC) || defined(STM32F098xx) | ||
1837 | |||
1838 | /* RCC attributes. */ | ||
1839 | #define STM32_HAS_HSI48 TRUE | ||
1840 | #define STM32_HAS_HSI_PREDIV TRUE | ||
1841 | #define STM32_HAS_MCO_PREDIV TRUE | ||
1842 | |||
1843 | /* ADC attributes.*/ | ||
1844 | #define STM32_HAS_ADC1 TRUE | ||
1845 | #define STM32_ADC_SUPPORTS_PRESCALER FALSE | ||
1846 | #define STM32_ADC_SUPPORTS_OVERSAMPLING FALSE | ||
1847 | #define STM32_ADC1_HANDLER Vector70 | ||
1848 | #define STM32_ADC1_NUMBER 12 | ||
1849 | #define STM32_ADC1_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 1) |\ | ||
1850 | STM32_DMA_STREAM_ID_MSK(1, 2) |\ | ||
1851 | STM32_DMA_STREAM_ID_MSK(2, 5)) | ||
1852 | #define STM32_ADC1_DMA_CHN 0x00100011 | ||
1853 | |||
1854 | #define STM32_HAS_ADC2 FALSE | ||
1855 | #define STM32_HAS_ADC3 FALSE | ||
1856 | #define STM32_HAS_ADC4 FALSE | ||
1857 | |||
1858 | /* CAN attributes.*/ | ||
1859 | #define STM32_HAS_CAN1 TRUE | ||
1860 | #define STM32_HAS_CAN2 FALSE | ||
1861 | #define STM32_HAS_CAN3 FALSE | ||
1862 | #define STM32_CAN_MAX_FILTERS 14 | ||
1863 | |||
1864 | /* DAC attributes.*/ | ||
1865 | #define STM32_HAS_DAC1_CH1 TRUE | ||
1866 | #define STM32_DAC1_CH1_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 3) |\ | ||
1867 | STM32_DMA_STREAM_ID_MSK(2, 3)) | ||
1868 | #define STM32_DAC1_CH1_DMA_CHN 0x00000100 | ||
1869 | |||
1870 | #define STM32_HAS_DAC1_CH2 TRUE | ||
1871 | #define STM32_DAC1_CH2_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 4) |\ | ||
1872 | STM32_DMA_STREAM_ID_MSK(2, 4)) | ||
1873 | #define STM32_DAC1_CH2_DMA_CHN 0x00001000 | ||
1874 | |||
1875 | #define STM32_HAS_DAC2_CH1 FALSE | ||
1876 | #define STM32_HAS_DAC2_CH2 FALSE | ||
1877 | |||
1878 | /* DMA attributes.*/ | ||
1879 | #define STM32_ADVANCED_DMA TRUE | ||
1880 | #define STM32_DMA_SUPPORTS_DMAMUX FALSE | ||
1881 | #define STM32_DMA_SUPPORTS_CSELR TRUE | ||
1882 | |||
1883 | #define STM32_DMA1_NUM_CHANNELS 7 | ||
1884 | #define STM32_DMA2_NUM_CHANNELS 5 | ||
1885 | |||
1886 | #define STM32_DMA1_CH1_HANDLER Vector64 | ||
1887 | #define STM32_DMA12_CH23_CH12_HANDLER Vector68 | ||
1888 | #define STM32_DMA12_CH4567_CH345_HANDLER Vector6C | ||
1889 | #define STM32_DMA1_CH1_NUMBER 9 | ||
1890 | #define STM32_DMA12_CH23_CH12_NUMBER 10 | ||
1891 | #define STM32_DMA12_CH4567_CH345_NUMBER 11 | ||
1892 | |||
1893 | #define STM32_DMA1_CH2_NUMBER STM32_DMA12_CH23_CH12_NUMBER | ||
1894 | #define STM32_DMA1_CH3_NUMBER STM32_DMA12_CH23_CH12_NUMBER | ||
1895 | #define STM32_DMA2_CH1_NUMBER STM32_DMA12_CH23_CH12_NUMBER | ||
1896 | #define STM32_DMA2_CH2_NUMBER STM32_DMA12_CH23_CH12_NUMBER | ||
1897 | #define STM32_DMA1_CH2_CMASK 0x00000186U | ||
1898 | #define STM32_DMA1_CH3_CMASK 0x00000186U | ||
1899 | #define STM32_DMA2_CH1_CMASK 0x00000186U | ||
1900 | #define STM32_DMA2_CH2_CMASK 0x00000186U | ||
1901 | |||
1902 | #define STM32_DMA1_CH4_NUMBER STM32_DMA12_CH4567_CH345_NUMBER | ||
1903 | #define STM32_DMA1_CH5_NUMBER STM32_DMA12_CH4567_CH345_NUMBER | ||
1904 | #define STM32_DMA1_CH6_NUMBER STM32_DMA12_CH4567_CH345_NUMBER | ||
1905 | #define STM32_DMA1_CH7_NUMBER STM32_DMA12_CH4567_CH345_NUMBER | ||
1906 | #define STM32_DMA2_CH3_NUMBER STM32_DMA12_CH4567_CH345_NUMBER | ||
1907 | #define STM32_DMA2_CH4_NUMBER STM32_DMA12_CH4567_CH345_NUMBER | ||
1908 | #define STM32_DMA2_CH5_NUMBER STM32_DMA12_CH4567_CH345_NUMBER | ||
1909 | #define STM32_DMA1_CH4_CMASK 0x00000E78U | ||
1910 | #define STM32_DMA1_CH5_CMASK 0x00000E78U | ||
1911 | #define STM32_DMA1_CH6_CMASK 0x00000E78U | ||
1912 | #define STM32_DMA1_CH7_CMASK 0x00000E78U | ||
1913 | #define STM32_DMA2_CH3_CMASK 0x00000E78U | ||
1914 | #define STM32_DMA2_CH4_CMASK 0x00000E78U | ||
1915 | #define STM32_DMA2_CH5_CMASK 0x00000E78U | ||
1916 | |||
1917 | /* ETH attributes.*/ | ||
1918 | #define STM32_HAS_ETH FALSE | ||
1919 | |||
1920 | /* EXTI attributes.*/ | ||
1921 | #define STM32_EXTI_NUM_LINES 32 | ||
1922 | #define STM32_EXTI_IMR1_MASK 0x7F840000U | ||
1923 | |||
1924 | /* GPIO attributes.*/ | ||
1925 | #define STM32_HAS_GPIOA TRUE | ||
1926 | #define STM32_HAS_GPIOB TRUE | ||
1927 | #define STM32_HAS_GPIOC TRUE | ||
1928 | #define STM32_HAS_GPIOD TRUE | ||
1929 | #define STM32_HAS_GPIOE FALSE | ||
1930 | #define STM32_HAS_GPIOF TRUE | ||
1931 | #define STM32_HAS_GPIOG FALSE | ||
1932 | #define STM32_HAS_GPIOH FALSE | ||
1933 | #define STM32_HAS_GPIOI FALSE | ||
1934 | #define STM32_HAS_GPIOJ FALSE | ||
1935 | #define STM32_HAS_GPIOK FALSE | ||
1936 | #define STM32_GPIO_EN_MASK (RCC_AHBENR_GPIOAEN | \ | ||
1937 | RCC_AHBENR_GPIOBEN | \ | ||
1938 | RCC_AHBENR_GPIOCEN | \ | ||
1939 | RCC_AHBENR_GPIODEN | \ | ||
1940 | RCC_AHBENR_GPIOFEN) | ||
1941 | |||
1942 | /* I2C attributes.*/ | ||
1943 | #define STM32_HAS_I2C1 TRUE | ||
1944 | #define STM32_I2C1_RX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 3) |\ | ||
1945 | STM32_DMA_STREAM_ID_MSK(1, 7)) | ||
1946 | #define STM32_I2C1_RX_DMA_CHN 0x02000200 | ||
1947 | #define STM32_I2C1_TX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 2) |\ | ||
1948 | STM32_DMA_STREAM_ID_MSK(1, 6)) | ||
1949 | #define STM32_I2C1_TX_DMA_CHN 0x00200020 | ||
1950 | |||
1951 | #define STM32_HAS_I2C2 TRUE | ||
1952 | #define STM32_I2C2_RX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 5) |\ | ||
1953 | STM32_DMA_STREAM_ID_MSK(2, 2)) | ||
1954 | #define STM32_I2C2_RX_DMA_CHN 0x00020020 | ||
1955 | #define STM32_I2C2_TX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 4) |\ | ||
1956 | STM32_DMA_STREAM_ID_MSK(2, 1)) | ||
1957 | #define STM32_I2C2_TX_DMA_CHN 0x00002002 | ||
1958 | |||
1959 | #define STM32_HAS_I2C3 FALSE | ||
1960 | #define STM32_HAS_I2C4 FALSE | ||
1961 | |||
1962 | /* QUADSPI attributes.*/ | ||
1963 | #define STM32_HAS_QUADSPI1 FALSE | ||
1964 | |||
1965 | /* RTC attributes.*/ | ||
1966 | #define STM32_HAS_RTC TRUE | ||
1967 | #define STM32_RTC_HAS_SUBSECONDS TRUE | ||
1968 | #define STM32_RTC_HAS_PERIODIC_WAKEUPS TRUE | ||
1969 | #define STM32_RTC_NUM_ALARMS 1 | ||
1970 | #define STM32_RTC_STORAGE_SIZE 0 | ||
1971 | #define STM32_RTC_COMMON_HANDLER Vector48 | ||
1972 | #define STM32_RTC_COMMON_NUMBER 2 | ||
1973 | #define STM32_RTC_ALARM_EXTI 17 | ||
1974 | #define STM32_RTC_TAMP_STAMP_EXTI 19 | ||
1975 | #define STM32_RTC_WKUP_EXTI 20 | ||
1976 | #define STM32_RTC_IRQ_ENABLE() \ | ||
1977 | nvicEnableVector(STM32_RTC_COMMON_NUMBER, STM32_IRQ_EXTI17_20_IRQ_PRIORITY) | ||
1978 | |||
1979 | /* SDIO attributes.*/ | ||
1980 | #define STM32_HAS_SDIO FALSE | ||
1981 | |||
1982 | /* SPI attributes.*/ | ||
1983 | #define STM32_HAS_SPI1 TRUE | ||
1984 | #define STM32_SPI1_SUPPORTS_I2S TRUE | ||
1985 | #define STM32_SPI1_I2S_FULLDUPLEX FALSE | ||
1986 | #define STM32_SPI1_RX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 2) |\ | ||
1987 | STM32_DMA_STREAM_ID_MSK(2, 3)) | ||
1988 | #define STM32_SPI1_RX_DMA_CHN 0x00000330 | ||
1989 | #define STM32_SPI1_TX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 3) |\ | ||
1990 | STM32_DMA_STREAM_ID_MSK(2, 4)) | ||
1991 | #define STM32_SPI1_TX_DMA_CHN 0x00003300 | ||
1992 | |||
1993 | #define STM32_HAS_SPI2 TRUE | ||
1994 | #define STM32_SPI2_SUPPORTS_I2S TRUE | ||
1995 | #define STM32_SPI2_I2S_FULLDUPLEX FALSE | ||
1996 | #define STM32_SPI2_RX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 4) |\ | ||
1997 | STM32_DMA_STREAM_ID_MSK(1, 6)) | ||
1998 | #define STM32_SPI2_RX_DMA_CHN 0x00303000 | ||
1999 | #define STM32_SPI2_TX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 5) |\ | ||
2000 | STM32_DMA_STREAM_ID_MSK(1, 7)) | ||
2001 | #define STM32_SPI2_TX_DMA_CHN 0x03030000 | ||
2002 | |||
2003 | #define STM32_HAS_SPI3 FALSE | ||
2004 | #define STM32_HAS_SPI4 FALSE | ||
2005 | #define STM32_HAS_SPI5 FALSE | ||
2006 | #define STM32_HAS_SPI6 FALSE | ||
2007 | |||
2008 | /* TIM attributes.*/ | ||
2009 | #define STM32_TIM_MAX_CHANNELS 4 | ||
2010 | |||
2011 | #define STM32_HAS_TIM1 TRUE | ||
2012 | #define STM32_TIM1_IS_32BITS FALSE | ||
2013 | #define STM32_TIM1_CHANNELS 4 | ||
2014 | |||
2015 | #define STM32_HAS_TIM2 TRUE | ||
2016 | #define STM32_TIM2_IS_32BITS TRUE | ||
2017 | #define STM32_TIM2_CHANNELS 4 | ||
2018 | |||
2019 | #define STM32_HAS_TIM3 TRUE | ||
2020 | #define STM32_TIM3_IS_32BITS FALSE | ||
2021 | #define STM32_TIM3_CHANNELS 4 | ||
2022 | |||
2023 | #define STM32_HAS_TIM6 TRUE | ||
2024 | #define STM32_TIM6_IS_32BITS FALSE | ||
2025 | #define STM32_TIM6_CHANNELS 0 | ||
2026 | |||
2027 | #define STM32_HAS_TIM7 TRUE | ||
2028 | #define STM32_TIM7_IS_32BITS FALSE | ||
2029 | #define STM32_TIM7_CHANNELS 0 | ||
2030 | |||
2031 | #define STM32_HAS_TIM14 TRUE | ||
2032 | #define STM32_TIM14_IS_32BITS FALSE | ||
2033 | #define STM32_TIM14_CHANNELS 1 | ||
2034 | |||
2035 | #define STM32_HAS_TIM15 TRUE | ||
2036 | #define STM32_TIM15_IS_32BITS FALSE | ||
2037 | #define STM32_TIM15_CHANNELS 2 | ||
2038 | |||
2039 | #define STM32_HAS_TIM16 TRUE | ||
2040 | #define STM32_TIM16_IS_32BITS FALSE | ||
2041 | #define STM32_TIM16_CHANNELS 1 | ||
2042 | |||
2043 | #define STM32_HAS_TIM17 TRUE | ||
2044 | #define STM32_TIM17_IS_32BITS FALSE | ||
2045 | #define STM32_TIM17_CHANNELS 1 | ||
2046 | |||
2047 | #define STM32_HAS_TIM4 FALSE | ||
2048 | #define STM32_HAS_TIM5 FALSE | ||
2049 | #define STM32_HAS_TIM8 FALSE | ||
2050 | #define STM32_HAS_TIM9 FALSE | ||
2051 | #define STM32_HAS_TIM10 FALSE | ||
2052 | #define STM32_HAS_TIM11 FALSE | ||
2053 | #define STM32_HAS_TIM12 FALSE | ||
2054 | #define STM32_HAS_TIM13 FALSE | ||
2055 | #define STM32_HAS_TIM18 FALSE | ||
2056 | #define STM32_HAS_TIM19 FALSE | ||
2057 | #define STM32_HAS_TIM20 FALSE | ||
2058 | #define STM32_HAS_TIM21 FALSE | ||
2059 | #define STM32_HAS_TIM22 FALSE | ||
2060 | |||
2061 | /* USART attributes.*/ | ||
2062 | #define STM32_HAS_USART1 TRUE | ||
2063 | #define STM32_USART1_RX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 1) |\ | ||
2064 | STM32_DMA_STREAM_ID_MSK(1, 3) |\ | ||
2065 | STM32_DMA_STREAM_ID_MSK(1, 5) |\ | ||
2066 | STM32_DMA_STREAM_ID_MSK(1, 6) |\ | ||
2067 | STM32_DMA_STREAM_ID_MSK(2, 2) |\ | ||
2068 | STM32_DMA_STREAM_ID_MSK(2, 3)) | ||
2069 | #define STM32_USART1_RX_DMA_CHN 0x00880888 | ||
2070 | #define STM32_USART1_TX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 2) |\ | ||
2071 | STM32_DMA_STREAM_ID_MSK(1, 4) |\ | ||
2072 | STM32_DMA_STREAM_ID_MSK(1, 7) |\ | ||
2073 | STM32_DMA_STREAM_ID_MSK(2, 1) |\ | ||
2074 | STM32_DMA_STREAM_ID_MSK(2, 4) |\ | ||
2075 | STM32_DMA_STREAM_ID_MSK(2, 5)) | ||
2076 | #define STM32_USART1_TX_DMA_CHN 0x08088088 | ||
2077 | |||
2078 | #define STM32_HAS_USART2 TRUE | ||
2079 | #define STM32_USART2_RX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 1) |\ | ||
2080 | STM32_DMA_STREAM_ID_MSK(1, 3) |\ | ||
2081 | STM32_DMA_STREAM_ID_MSK(1, 5) |\ | ||
2082 | STM32_DMA_STREAM_ID_MSK(1, 6) |\ | ||
2083 | STM32_DMA_STREAM_ID_MSK(2, 2) |\ | ||
2084 | STM32_DMA_STREAM_ID_MSK(2, 3)) | ||
2085 | #define STM32_USART2_RX_DMA_CHN 0x00990999 | ||
2086 | #define STM32_USART2_TX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 2) |\ | ||
2087 | STM32_DMA_STREAM_ID_MSK(1, 4) |\ | ||
2088 | STM32_DMA_STREAM_ID_MSK(1, 7) |\ | ||
2089 | STM32_DMA_STREAM_ID_MSK(2, 1) |\ | ||
2090 | STM32_DMA_STREAM_ID_MSK(2, 4) |\ | ||
2091 | STM32_DMA_STREAM_ID_MSK(2, 5)) | ||
2092 | #define STM32_USART2_TX_DMA_CHN 0x09099099 | ||
2093 | |||
2094 | #define STM32_HAS_USART3 TRUE | ||
2095 | #define STM32_USART3_RX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 1) |\ | ||
2096 | STM32_DMA_STREAM_ID_MSK(1, 3) |\ | ||
2097 | STM32_DMA_STREAM_ID_MSK(1, 5) |\ | ||
2098 | STM32_DMA_STREAM_ID_MSK(1, 6) |\ | ||
2099 | STM32_DMA_STREAM_ID_MSK(2, 2) |\ | ||
2100 | STM32_DMA_STREAM_ID_MSK(2, 3)) | ||
2101 | #define STM32_USART3_RX_DMA_CHN 0x00AA0AAA | ||
2102 | #define STM32_USART3_TX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 2) |\ | ||
2103 | STM32_DMA_STREAM_ID_MSK(1, 4) |\ | ||
2104 | STM32_DMA_STREAM_ID_MSK(1, 7) |\ | ||
2105 | STM32_DMA_STREAM_ID_MSK(2, 1) |\ | ||
2106 | STM32_DMA_STREAM_ID_MSK(2, 4) |\ | ||
2107 | STM32_DMA_STREAM_ID_MSK(2, 5)) | ||
2108 | #define STM32_USART3_TX_DMA_CHN 0x0A0AA0AA | ||
2109 | |||
2110 | #define STM32_HAS_UART4 TRUE | ||
2111 | #define STM32_UART4_RX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 1) |\ | ||
2112 | STM32_DMA_STREAM_ID_MSK(1, 3) |\ | ||
2113 | STM32_DMA_STREAM_ID_MSK(1, 5) |\ | ||
2114 | STM32_DMA_STREAM_ID_MSK(1, 6) |\ | ||
2115 | STM32_DMA_STREAM_ID_MSK(2, 2) |\ | ||
2116 | STM32_DMA_STREAM_ID_MSK(2, 3)) | ||
2117 | #define STM32_UART4_RX_DMA_CHN 0x00BB0BBB | ||
2118 | #define STM32_UART4_TX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 2) |\ | ||
2119 | STM32_DMA_STREAM_ID_MSK(1, 4) |\ | ||
2120 | STM32_DMA_STREAM_ID_MSK(1, 7) |\ | ||
2121 | STM32_DMA_STREAM_ID_MSK(2, 1) |\ | ||
2122 | STM32_DMA_STREAM_ID_MSK(2, 4) |\ | ||
2123 | STM32_DMA_STREAM_ID_MSK(2, 5)) | ||
2124 | #define STM32_UART4_TX_DMA_CHN 0x0B0BB0BB | ||
2125 | |||
2126 | #define STM32_HAS_UART5 TRUE | ||
2127 | #define STM32_UART5_RX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 1) |\ | ||
2128 | STM32_DMA_STREAM_ID_MSK(1, 3) |\ | ||
2129 | STM32_DMA_STREAM_ID_MSK(1, 5) |\ | ||
2130 | STM32_DMA_STREAM_ID_MSK(1, 6) |\ | ||
2131 | STM32_DMA_STREAM_ID_MSK(2, 2) |\ | ||
2132 | STM32_DMA_STREAM_ID_MSK(2, 3)) | ||
2133 | #define STM32_UART5_RX_DMA_CHN 0x00CC0CCC | ||
2134 | #define STM32_UART5_TX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 2) |\ | ||
2135 | STM32_DMA_STREAM_ID_MSK(1, 4) |\ | ||
2136 | STM32_DMA_STREAM_ID_MSK(1, 7) |\ | ||
2137 | STM32_DMA_STREAM_ID_MSK(2, 1) |\ | ||
2138 | STM32_DMA_STREAM_ID_MSK(2, 4) |\ | ||
2139 | STM32_DMA_STREAM_ID_MSK(2, 5)) | ||
2140 | #define STM32_UART5_TX_DMA_CHN 0x0C0CC0CC | ||
2141 | |||
2142 | #define STM32_HAS_USART6 TRUE | ||
2143 | #define STM32_USART6_RX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 1) |\ | ||
2144 | STM32_DMA_STREAM_ID_MSK(1, 3) |\ | ||
2145 | STM32_DMA_STREAM_ID_MSK(1, 5) |\ | ||
2146 | STM32_DMA_STREAM_ID_MSK(1, 6) |\ | ||
2147 | STM32_DMA_STREAM_ID_MSK(2, 2) |\ | ||
2148 | STM32_DMA_STREAM_ID_MSK(2, 3)) | ||
2149 | #define STM32_USART6_RX_DMA_CHN 0x00DD0DDD | ||
2150 | #define STM32_USART6_TX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 2) |\ | ||
2151 | STM32_DMA_STREAM_ID_MSK(1, 4) |\ | ||
2152 | STM32_DMA_STREAM_ID_MSK(1, 7) |\ | ||
2153 | STM32_DMA_STREAM_ID_MSK(2, 1) |\ | ||
2154 | STM32_DMA_STREAM_ID_MSK(2, 4) |\ | ||
2155 | STM32_DMA_STREAM_ID_MSK(2, 5)) | ||
2156 | #define STM32_USART6_TX_DMA_CHN 0x0D0DD0DD | ||
2157 | |||
2158 | #define STM32_HAS_UART7 TRUE | ||
2159 | #define STM32_UART7_RX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 1) |\ | ||
2160 | STM32_DMA_STREAM_ID_MSK(1, 3) |\ | ||
2161 | STM32_DMA_STREAM_ID_MSK(1, 5) |\ | ||
2162 | STM32_DMA_STREAM_ID_MSK(1, 6) |\ | ||
2163 | STM32_DMA_STREAM_ID_MSK(2, 2) |\ | ||
2164 | STM32_DMA_STREAM_ID_MSK(2, 3)) | ||
2165 | #define STM32_UART7_RX_DMA_CHN 0x00EE0EEE | ||
2166 | #define STM32_UART7_TX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 2) |\ | ||
2167 | STM32_DMA_STREAM_ID_MSK(1, 4) |\ | ||
2168 | STM32_DMA_STREAM_ID_MSK(1, 7) |\ | ||
2169 | STM32_DMA_STREAM_ID_MSK(2, 1) |\ | ||
2170 | STM32_DMA_STREAM_ID_MSK(2, 4) |\ | ||
2171 | STM32_DMA_STREAM_ID_MSK(2, 5)) | ||
2172 | #define STM32_UART7_TX_DMA_CHN 0x0E0EE0EE | ||
2173 | |||
2174 | #define STM32_HAS_UART8 TRUE | ||
2175 | #define STM32_UART8_RX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 1) |\ | ||
2176 | STM32_DMA_STREAM_ID_MSK(1, 3) |\ | ||
2177 | STM32_DMA_STREAM_ID_MSK(1, 5) |\ | ||
2178 | STM32_DMA_STREAM_ID_MSK(1, 6) |\ | ||
2179 | STM32_DMA_STREAM_ID_MSK(2, 2) |\ | ||
2180 | STM32_DMA_STREAM_ID_MSK(2, 3)) | ||
2181 | #define STM32_UART8_RX_DMA_CHN 0x00FF0FFF | ||
2182 | #define STM32_UART8_TX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 2) |\ | ||
2183 | STM32_DMA_STREAM_ID_MSK(1, 4) |\ | ||
2184 | STM32_DMA_STREAM_ID_MSK(1, 7) |\ | ||
2185 | STM32_DMA_STREAM_ID_MSK(2, 1) |\ | ||
2186 | STM32_DMA_STREAM_ID_MSK(2, 4) |\ | ||
2187 | STM32_DMA_STREAM_ID_MSK(2, 5)) | ||
2188 | #define STM32_UART8_TX_DMA_CHN 0x0F0FF0FF | ||
2189 | |||
2190 | #define STM32_HAS_LPUART1 FALSE | ||
2191 | |||
2192 | /* USB attributes.*/ | ||
2193 | #define STM32_HAS_USB FALSE | ||
2194 | #define STM32_HAS_OTG1 FALSE | ||
2195 | #define STM32_HAS_OTG2 FALSE | ||
2196 | |||
2197 | /* IWDG attributes.*/ | ||
2198 | #define STM32_HAS_IWDG TRUE | ||
2199 | #define STM32_IWDG_IS_WINDOWED TRUE | ||
2200 | |||
2201 | /* LTDC attributes.*/ | ||
2202 | #define STM32_HAS_LTDC FALSE | ||
2203 | |||
2204 | /* DMA2D attributes.*/ | ||
2205 | #define STM32_HAS_DMA2D FALSE | ||
2206 | |||
2207 | /* FSMC attributes.*/ | ||
2208 | #define STM32_HAS_FSMC FALSE | ||
2209 | |||
2210 | /* CRC attributes.*/ | ||
2211 | #define STM32_HAS_CRC TRUE | ||
2212 | #define STM32_CRC_PROGRAMMABLE TRUE | ||
2213 | |||
2214 | #else | ||
2215 | #error "STM32F0xx device not specified" | ||
2216 | #endif | ||
2217 | |||
2218 | /** @} */ | ||
2219 | |||
2220 | #endif /* STM32_REGISTRY_H */ | ||
2221 | |||
2222 | /** @} */ | ||