diff options
Diffstat (limited to 'lib/chibios/os/hal/ports/STM32/STM32G0xx/stm32_registry.h')
-rw-r--r-- | lib/chibios/os/hal/ports/STM32/STM32G0xx/stm32_registry.h | 449 |
1 files changed, 449 insertions, 0 deletions
diff --git a/lib/chibios/os/hal/ports/STM32/STM32G0xx/stm32_registry.h b/lib/chibios/os/hal/ports/STM32/STM32G0xx/stm32_registry.h new file mode 100644 index 000000000..0e31ae5fb --- /dev/null +++ b/lib/chibios/os/hal/ports/STM32/STM32G0xx/stm32_registry.h | |||
@@ -0,0 +1,449 @@ | |||
1 | /* | ||
2 | ChibiOS - Copyright (C) 2006..2019 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 STM32G0xx/stm32_registry.h | ||
19 | * @brief STM32G0xx capabilities registry. | ||
20 | * | ||
21 | * @addtogroup HAL | ||
22 | * @{ | ||
23 | */ | ||
24 | |||
25 | #ifndef STM32_REGISTRY_H | ||
26 | #define STM32_REGISTRY_H | ||
27 | |||
28 | /*===========================================================================*/ | ||
29 | /* Platform capabilities. */ | ||
30 | /*===========================================================================*/ | ||
31 | |||
32 | /** | ||
33 | * @name STM32G0xx capabilities | ||
34 | * @{ | ||
35 | */ | ||
36 | |||
37 | /*===========================================================================*/ | ||
38 | /* Common. */ | ||
39 | /*===========================================================================*/ | ||
40 | |||
41 | /* RTC and TAMP attributes.*/ | ||
42 | #define STM32_HAS_RTC TRUE | ||
43 | #define STM32_RTC_HAS_SUBSECONDS TRUE | ||
44 | #define STM32_RTC_HAS_PERIODIC_WAKEUPS TRUE | ||
45 | #define STM32_RTC_NUM_ALARMS 2 | ||
46 | #define STM32_RTC_STORAGE_SIZE 20 | ||
47 | #define STM32_RTC_COMMON_HANDLER Vector48 | ||
48 | #define STM32_RTC_COMMON_NUMBER 2 | ||
49 | #define STM32_RTC_EVENT_RTC_EXTI 19 | ||
50 | #define STM32_RTC_EVENT_TAMP_EXTI 21 | ||
51 | #define STM32_RTC_IRQ_ENABLE() do { \ | ||
52 | nvicEnableVector(STM32_RTC_COMMON_NUMBER, \ | ||
53 | STM32_IRQ_EXTI1921_PRIORITY); \ | ||
54 | } while (false) | ||
55 | |||
56 | /* Enabling RTC-related EXTI lines.*/ | ||
57 | #define STM32_RTC_ENABLE_ALL_EXTI() do { \ | ||
58 | extiEnableGroup1(EXTI_MASK1(STM32_RTC_EVENT_RTC_EXTI) | \ | ||
59 | EXTI_MASK1(STM32_RTC_EVENT_TAMP_EXTI), \ | ||
60 | EXTI_MODE_RISING_EDGE | EXTI_MODE_ACTION_INTERRUPT); \ | ||
61 | } while (false) | ||
62 | |||
63 | /* Clearing EXTI interrupts. */ | ||
64 | #define STM32_RTC_CLEAR_ALL_EXTI() do { \ | ||
65 | extiClearGroup1(EXTI_MASK1(STM32_RTC_EVENT_RTC_EXTI) | \ | ||
66 | EXTI_MASK1(STM32_RTC_EVENT_TAMP_EXTI)); \ | ||
67 | } while (false) | ||
68 | |||
69 | /* Masks used to preserve state of RTC and TAMP register reserved bits. */ | ||
70 | #define STM32_RTC_CR_MASK 0xE7FFFF7F | ||
71 | #define STM32_RTC_PRER_MASK 0x007F7FFF | ||
72 | #define STM32_TAMP_CR1_MASK 0x003C0003 | ||
73 | #define STM32_TAMP_CR2_MASK 0x030300FF | ||
74 | #define STM32_TAMP_FLTCR_MASK 0x000000FF | ||
75 | #define STM32_TAMP_IER_MASK 0x003C0003 | ||
76 | |||
77 | #if defined(STM32G081xx) || defined(__DOXYGEN__) | ||
78 | #define STM32_HAS_RNG1 TRUE | ||
79 | #define STM32_HAS_HASH1 FALSE | ||
80 | #define STM32_HAS_CRYP1 TRUE | ||
81 | #else | ||
82 | #define STM32_HAS_RNG1 FALSE | ||
83 | #define STM32_HAS_HASH1 FALSE | ||
84 | #define STM32_HAS_CRYP1 FALSE | ||
85 | #endif | ||
86 | |||
87 | /*===========================================================================*/ | ||
88 | /* STM32G070xx. */ | ||
89 | /*===========================================================================*/ | ||
90 | |||
91 | #if defined(STM32G070xx) || defined(__DOXYGEN__) | ||
92 | |||
93 | /* ADC attributes.*/ | ||
94 | #define STM32_HAS_ADC1 TRUE | ||
95 | #define STM32_HAS_ADC2 FALSE | ||
96 | #define STM32_HAS_ADC3 FALSE | ||
97 | #define STM32_HAS_ADC4 FALSE | ||
98 | |||
99 | /* CAN attributes.*/ | ||
100 | #define STM32_HAS_CAN1 FALSE | ||
101 | #define STM32_HAS_CAN2 FALSE | ||
102 | #define STM32_HAS_CAN3 FALSE | ||
103 | |||
104 | /* DAC attributes.*/ | ||
105 | #define STM32_HAS_DAC1_CH1 FALSE | ||
106 | #define STM32_HAS_DAC1_CH2 FALSE | ||
107 | #define STM32_HAS_DAC2_CH1 FALSE | ||
108 | #define STM32_HAS_DAC2_CH2 FALSE | ||
109 | |||
110 | /* DMA attributes.*/ | ||
111 | #define STM32_ADVANCED_DMA TRUE | ||
112 | #define STM32_DMA_SUPPORTS_DMAMUX TRUE | ||
113 | #define STM32_DMA_SUPPORTS_CSELR FALSE | ||
114 | #define STM32_DMA1_NUM_CHANNELS 7 | ||
115 | #define STM32_DMA2_NUM_CHANNELS 0 | ||
116 | |||
117 | /* ETH attributes.*/ | ||
118 | #define STM32_HAS_ETH FALSE | ||
119 | |||
120 | /* EXTI attributes.*/ | ||
121 | #define STM32_EXTI_HAS_CR TRUE | ||
122 | #define STM32_EXTI_SEPARATE_RF TRUE | ||
123 | #define STM32_EXTI_HAS_GROUP2 FALSE | ||
124 | #define STM32_EXTI_NUM_LINES 16 | ||
125 | #define STM32_EXTI_IMR1_MASK 0xFFF80000U | ||
126 | |||
127 | /* Flash attributes.*/ | ||
128 | #define STM32_FLASH_NUMBER_OF_BANKS 1 | ||
129 | |||
130 | /* GPIO attributes.*/ | ||
131 | #define STM32_HAS_GPIOA TRUE | ||
132 | #define STM32_HAS_GPIOB TRUE | ||
133 | #define STM32_HAS_GPIOC TRUE | ||
134 | #define STM32_HAS_GPIOD TRUE | ||
135 | #define STM32_HAS_GPIOE FALSE | ||
136 | #define STM32_HAS_GPIOF TRUE | ||
137 | #define STM32_HAS_GPIOG FALSE | ||
138 | #define STM32_HAS_GPIOH FALSE | ||
139 | #define STM32_HAS_GPIOI FALSE | ||
140 | #define STM32_HAS_GPIOJ FALSE | ||
141 | #define STM32_HAS_GPIOK FALSE | ||
142 | #define STM32_GPIO_EN_MASK (RCC_IOPENR_GPIOAEN | \ | ||
143 | RCC_IOPENR_GPIOBEN | \ | ||
144 | RCC_IOPENR_GPIOCEN | \ | ||
145 | RCC_IOPENR_GPIODEN | \ | ||
146 | RCC_IOPENR_GPIOFEN) | ||
147 | |||
148 | /* I2C attributes.*/ | ||
149 | #define STM32_HAS_I2C1 TRUE | ||
150 | #define STM32_HAS_I2C2 TRUE | ||
151 | #define STM32_HAS_I2C3 FALSE | ||
152 | #define STM32_HAS_I2C4 FALSE | ||
153 | |||
154 | /* OCTOSPI attributes.*/ | ||
155 | #define STM32_HAS_OCTOSPI1 FALSE | ||
156 | #define STM32_HAS_OCTOSPI2 FALSE | ||
157 | |||
158 | /* QUADSPI attributes.*/ | ||
159 | #define STM32_HAS_QUADSPI1 FALSE | ||
160 | |||
161 | /* SDMMC attributes.*/ | ||
162 | #define STM32_HAS_SDMMC1 FALSE | ||
163 | #define STM32_HAS_SDMMC2 FALSE | ||
164 | |||
165 | /* SPI attributes.*/ | ||
166 | #define STM32_HAS_SPI1 TRUE | ||
167 | #define STM32_SPI1_SUPPORTS_I2S TRUE | ||
168 | |||
169 | #define STM32_HAS_SPI2 TRUE | ||
170 | #define STM32_SPI2_SUPPORTS_I2S FALSE | ||
171 | |||
172 | #define STM32_HAS_SPI3 FALSE | ||
173 | #define STM32_HAS_SPI4 FALSE | ||
174 | #define STM32_HAS_SPI5 FALSE | ||
175 | #define STM32_HAS_SPI6 FALSE | ||
176 | |||
177 | /* TIM attributes.*/ | ||
178 | #define STM32_TIM_MAX_CHANNELS 6 | ||
179 | |||
180 | #define STM32_HAS_TIM1 TRUE | ||
181 | #define STM32_TIM1_IS_32BITS FALSE | ||
182 | #define STM32_TIM1_CHANNELS 6 | ||
183 | |||
184 | #define STM32_HAS_TIM3 TRUE | ||
185 | #define STM32_TIM3_IS_32BITS FALSE | ||
186 | #define STM32_TIM3_CHANNELS 4 | ||
187 | |||
188 | #define STM32_HAS_TIM6 TRUE | ||
189 | #define STM32_TIM6_IS_32BITS FALSE | ||
190 | #define STM32_TIM6_CHANNELS 0 | ||
191 | |||
192 | #define STM32_HAS_TIM7 TRUE | ||
193 | #define STM32_TIM7_IS_32BITS FALSE | ||
194 | #define STM32_TIM7_CHANNELS 0 | ||
195 | |||
196 | #define STM32_HAS_TIM14 TRUE | ||
197 | #define STM32_TIM14_IS_32BITS FALSE | ||
198 | #define STM32_TIM14_CHANNELS 1 | ||
199 | |||
200 | #define STM32_HAS_TIM15 TRUE | ||
201 | #define STM32_TIM15_IS_32BITS FALSE | ||
202 | #define STM32_TIM15_CHANNELS 2 | ||
203 | |||
204 | #define STM32_HAS_TIM16 TRUE | ||
205 | #define STM32_TIM16_IS_32BITS FALSE | ||
206 | #define STM32_TIM16_CHANNELS 1 | ||
207 | |||
208 | #define STM32_HAS_TIM17 TRUE | ||
209 | #define STM32_TIM17_IS_32BITS FALSE | ||
210 | #define STM32_TIM17_CHANNELS 1 | ||
211 | |||
212 | #define STM32_HAS_TIM2 FALSE | ||
213 | #define STM32_HAS_TIM4 FALSE | ||
214 | #define STM32_HAS_TIM5 FALSE | ||
215 | #define STM32_HAS_TIM8 FALSE | ||
216 | #define STM32_HAS_TIM9 FALSE | ||
217 | #define STM32_HAS_TIM10 FALSE | ||
218 | #define STM32_HAS_TIM11 FALSE | ||
219 | #define STM32_HAS_TIM12 FALSE | ||
220 | #define STM32_HAS_TIM13 FALSE | ||
221 | #define STM32_HAS_TIM18 FALSE | ||
222 | #define STM32_HAS_TIM19 FALSE | ||
223 | #define STM32_HAS_TIM20 FALSE | ||
224 | #define STM32_HAS_TIM21 FALSE | ||
225 | #define STM32_HAS_TIM22 FALSE | ||
226 | |||
227 | /* USART attributes.*/ | ||
228 | #define STM32_HAS_USART1 TRUE | ||
229 | #define STM32_HAS_USART2 TRUE | ||
230 | #define STM32_HAS_USART3 TRUE | ||
231 | #define STM32_HAS_UART4 TRUE | ||
232 | #define STM32_HAS_LPUART1 TRUE | ||
233 | #define STM32_HAS_UART5 FALSE | ||
234 | #define STM32_HAS_USART6 FALSE | ||
235 | #define STM32_HAS_UART7 FALSE | ||
236 | #define STM32_HAS_UART8 FALSE | ||
237 | |||
238 | /* USB attributes.*/ | ||
239 | #define STM32_HAS_OTG1 FALSE | ||
240 | #define STM32_HAS_OTG2 FALSE | ||
241 | #define STM32_HAS_USB FALSE | ||
242 | |||
243 | /* IWDG attributes.*/ | ||
244 | #define STM32_HAS_IWDG TRUE | ||
245 | #define STM32_IWDG_IS_WINDOWED TRUE | ||
246 | |||
247 | /* LTDC attributes.*/ | ||
248 | #define STM32_HAS_LTDC FALSE | ||
249 | |||
250 | /* DMA2D attributes.*/ | ||
251 | #define STM32_HAS_DMA2D FALSE | ||
252 | |||
253 | /* FSMC attributes.*/ | ||
254 | #define STM32_HAS_FSMC FALSE | ||
255 | |||
256 | /* CRC attributes.*/ | ||
257 | #define STM32_HAS_CRC FALSE | ||
258 | |||
259 | /* DCMI attributes.*/ | ||
260 | #define STM32_HAS_DCMI FALSE | ||
261 | |||
262 | #endif /* defined(STM32G070xx) */ | ||
263 | |||
264 | /*===========================================================================*/ | ||
265 | /* STM32G071xx STM32G081xx. */ | ||
266 | /*===========================================================================*/ | ||
267 | |||
268 | #if defined(STM32G071xx) || defined(STM32G081xx) | ||
269 | |||
270 | /* ADC attributes.*/ | ||
271 | #define STM32_HAS_ADC1 TRUE | ||
272 | #define STM32_HAS_ADC2 FALSE | ||
273 | #define STM32_HAS_ADC3 FALSE | ||
274 | #define STM32_HAS_ADC4 FALSE | ||
275 | |||
276 | /* CAN attributes.*/ | ||
277 | #define STM32_HAS_CAN1 FALSE | ||
278 | #define STM32_HAS_CAN2 FALSE | ||
279 | #define STM32_HAS_CAN3 FALSE | ||
280 | |||
281 | /* DAC attributes.*/ | ||
282 | #define STM32_HAS_DAC1_CH1 TRUE | ||
283 | #define STM32_HAS_DAC1_CH2 TRUE | ||
284 | #define STM32_HAS_DAC2_CH1 FALSE | ||
285 | #define STM32_HAS_DAC2_CH2 FALSE | ||
286 | |||
287 | /* DMA attributes.*/ | ||
288 | #define STM32_ADVANCED_DMA TRUE | ||
289 | #define STM32_DMA_SUPPORTS_DMAMUX TRUE | ||
290 | #define STM32_DMA_SUPPORTS_CSELR FALSE | ||
291 | #define STM32_DMA1_NUM_CHANNELS 7 | ||
292 | #define STM32_DMA2_NUM_CHANNELS 0 | ||
293 | |||
294 | /* ETH attributes.*/ | ||
295 | #define STM32_HAS_ETH FALSE | ||
296 | |||
297 | /* EXTI attributes.*/ | ||
298 | #define STM32_EXTI_HAS_CR TRUE | ||
299 | #define STM32_EXTI_SEPARATE_RF TRUE | ||
300 | #define STM32_EXTI_HAS_GROUP2 FALSE | ||
301 | #define STM32_EXTI_NUM_LINES 33 | ||
302 | #define STM32_EXTI_IMR1_MASK 0xFFF80000U | ||
303 | #define STM32_EXTI_IMR2_MASK 0xFFFFFFFFU | ||
304 | |||
305 | /* Flash attributes.*/ | ||
306 | #define STM32_FLASH_NUMBER_OF_BANKS 1 | ||
307 | |||
308 | /* GPIO attributes.*/ | ||
309 | #define STM32_HAS_GPIOA TRUE | ||
310 | #define STM32_HAS_GPIOB TRUE | ||
311 | #define STM32_HAS_GPIOC TRUE | ||
312 | #define STM32_HAS_GPIOD TRUE | ||
313 | #define STM32_HAS_GPIOE FALSE | ||
314 | #define STM32_HAS_GPIOF TRUE | ||
315 | #define STM32_HAS_GPIOG FALSE | ||
316 | #define STM32_HAS_GPIOH FALSE | ||
317 | #define STM32_HAS_GPIOI FALSE | ||
318 | #define STM32_HAS_GPIOJ FALSE | ||
319 | #define STM32_HAS_GPIOK FALSE | ||
320 | #define STM32_GPIO_EN_MASK (RCC_IOPENR_GPIOAEN | \ | ||
321 | RCC_IOPENR_GPIOBEN | \ | ||
322 | RCC_IOPENR_GPIOCEN | \ | ||
323 | RCC_IOPENR_GPIODEN | \ | ||
324 | RCC_IOPENR_GPIOFEN) | ||
325 | |||
326 | /* I2C attributes.*/ | ||
327 | #define STM32_HAS_I2C1 TRUE | ||
328 | #define STM32_HAS_I2C2 TRUE | ||
329 | #define STM32_HAS_I2C3 FALSE | ||
330 | #define STM32_HAS_I2C4 FALSE | ||
331 | |||
332 | /* OCTOSPI attributes.*/ | ||
333 | #define STM32_HAS_OCTOSPI1 FALSE | ||
334 | #define STM32_HAS_OCTOSPI2 FALSE | ||
335 | |||
336 | /* QUADSPI attributes.*/ | ||
337 | #define STM32_HAS_QUADSPI1 FALSE | ||
338 | |||
339 | /* SDMMC attributes.*/ | ||
340 | #define STM32_HAS_SDMMC1 FALSE | ||
341 | #define STM32_HAS_SDMMC2 FALSE | ||
342 | |||
343 | /* SPI attributes.*/ | ||
344 | #define STM32_HAS_SPI1 TRUE | ||
345 | #define STM32_SPI1_SUPPORTS_I2S TRUE | ||
346 | |||
347 | #define STM32_HAS_SPI2 TRUE | ||
348 | #define STM32_SPI2_SUPPORTS_I2S FALSE | ||
349 | |||
350 | #define STM32_HAS_SPI3 FALSE | ||
351 | #define STM32_HAS_SPI4 FALSE | ||
352 | #define STM32_HAS_SPI5 FALSE | ||
353 | #define STM32_HAS_SPI6 FALSE | ||
354 | |||
355 | /* TIM attributes.*/ | ||
356 | #define STM32_TIM_MAX_CHANNELS 6 | ||
357 | |||
358 | #define STM32_HAS_TIM1 TRUE | ||
359 | #define STM32_TIM1_IS_32BITS FALSE | ||
360 | #define STM32_TIM1_CHANNELS 6 | ||
361 | |||
362 | #define STM32_HAS_TIM2 TRUE | ||
363 | #define STM32_TIM2_IS_32BITS TRUE | ||
364 | #define STM32_TIM2_CHANNELS 4 | ||
365 | |||
366 | #define STM32_HAS_TIM3 TRUE | ||
367 | #define STM32_TIM3_IS_32BITS FALSE | ||
368 | #define STM32_TIM3_CHANNELS 4 | ||
369 | |||
370 | #define STM32_HAS_TIM6 TRUE | ||
371 | #define STM32_TIM6_IS_32BITS FALSE | ||
372 | #define STM32_TIM6_CHANNELS 0 | ||
373 | |||
374 | #define STM32_HAS_TIM7 TRUE | ||
375 | #define STM32_TIM7_IS_32BITS FALSE | ||
376 | #define STM32_TIM7_CHANNELS 0 | ||
377 | |||
378 | #define STM32_HAS_TIM14 TRUE | ||
379 | #define STM32_TIM14_IS_32BITS FALSE | ||
380 | #define STM32_TIM14_CHANNELS 1 | ||
381 | |||
382 | #define STM32_HAS_TIM15 TRUE | ||
383 | #define STM32_TIM15_IS_32BITS FALSE | ||
384 | #define STM32_TIM15_CHANNELS 2 | ||
385 | |||
386 | #define STM32_HAS_TIM16 TRUE | ||
387 | #define STM32_TIM16_IS_32BITS FALSE | ||
388 | #define STM32_TIM16_CHANNELS 1 | ||
389 | |||
390 | #define STM32_HAS_TIM17 TRUE | ||
391 | #define STM32_TIM17_IS_32BITS FALSE | ||
392 | #define STM32_TIM17_CHANNELS 1 | ||
393 | |||
394 | #define STM32_HAS_TIM4 FALSE | ||
395 | #define STM32_HAS_TIM5 FALSE | ||
396 | #define STM32_HAS_TIM8 FALSE | ||
397 | #define STM32_HAS_TIM9 FALSE | ||
398 | #define STM32_HAS_TIM10 FALSE | ||
399 | #define STM32_HAS_TIM11 FALSE | ||
400 | #define STM32_HAS_TIM12 FALSE | ||
401 | #define STM32_HAS_TIM13 FALSE | ||
402 | #define STM32_HAS_TIM18 FALSE | ||
403 | #define STM32_HAS_TIM19 FALSE | ||
404 | #define STM32_HAS_TIM20 FALSE | ||
405 | #define STM32_HAS_TIM21 FALSE | ||
406 | #define STM32_HAS_TIM22 FALSE | ||
407 | |||
408 | /* USART attributes.*/ | ||
409 | #define STM32_HAS_USART1 TRUE | ||
410 | #define STM32_HAS_USART2 TRUE | ||
411 | #define STM32_HAS_USART3 TRUE | ||
412 | #define STM32_HAS_UART4 TRUE | ||
413 | #define STM32_HAS_LPUART1 TRUE | ||
414 | #define STM32_HAS_UART5 FALSE | ||
415 | #define STM32_HAS_USART6 FALSE | ||
416 | #define STM32_HAS_UART7 FALSE | ||
417 | #define STM32_HAS_UART8 FALSE | ||
418 | |||
419 | /* USB attributes.*/ | ||
420 | #define STM32_HAS_OTG1 FALSE | ||
421 | #define STM32_HAS_OTG2 FALSE | ||
422 | #define STM32_HAS_USB FALSE | ||
423 | |||
424 | /* IWDG attributes.*/ | ||
425 | #define STM32_HAS_IWDG TRUE | ||
426 | #define STM32_IWDG_IS_WINDOWED TRUE | ||
427 | |||
428 | /* LTDC attributes.*/ | ||
429 | #define STM32_HAS_LTDC FALSE | ||
430 | |||
431 | /* DMA2D attributes.*/ | ||
432 | #define STM32_HAS_DMA2D FALSE | ||
433 | |||
434 | /* FSMC attributes.*/ | ||
435 | #define STM32_HAS_FSMC FALSE | ||
436 | |||
437 | /* CRC attributes.*/ | ||
438 | #define STM32_HAS_CRC FALSE | ||
439 | |||
440 | /* DCMI attributes.*/ | ||
441 | #define STM32_HAS_DCMI FALSE | ||
442 | |||
443 | #endif /* defined(STM32G071xx) || defined(STM32G081xx) */ | ||
444 | |||
445 | /** @} */ | ||
446 | |||
447 | #endif /* STM32_REGISTRY_H */ | ||
448 | |||
449 | /** @} */ | ||