aboutsummaryrefslogtreecommitdiff
path: root/lib/chibios/os/hal/ports/STM32/STM32G4xx/stm32_registry.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/chibios/os/hal/ports/STM32/STM32G4xx/stm32_registry.h')
-rw-r--r--lib/chibios/os/hal/ports/STM32/STM32G4xx/stm32_registry.h524
1 files changed, 524 insertions, 0 deletions
diff --git a/lib/chibios/os/hal/ports/STM32/STM32G4xx/stm32_registry.h b/lib/chibios/os/hal/ports/STM32/STM32G4xx/stm32_registry.h
new file mode 100644
index 000000000..b9dd413da
--- /dev/null
+++ b/lib/chibios/os/hal/ports/STM32/STM32G4xx/stm32_registry.h
@@ -0,0 +1,524 @@
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 STM32G4xx/stm32_registry.h
19 * @brief STM32G4xx 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 STM32G4xx capabilities
34 * @{
35 */
36
37/*===========================================================================*/
38/* Common. */
39/*===========================================================================*/
40
41/* RNG attributes.*/
42#define STM32_HAS_RNG1 TRUE
43
44/* RTC attributes.*/
45#define STM32_HAS_RTC TRUE
46#define STM32_RTC_HAS_SUBSECONDS TRUE
47#define STM32_RTC_HAS_PERIODIC_WAKEUPS TRUE
48#define STM32_RTC_NUM_ALARMS 2
49#define STM32_RTC_STORAGE_SIZE 128
50#define STM32_RTC_TAMP_STAMP_HANDLER Vector48
51#define STM32_RTC_WKUP_HANDLER Vector4C
52#define STM32_RTC_ALARM_HANDLER VectorE4
53#define STM32_RTC_TAMP_STAMP_NUMBER 2
54#define STM32_RTC_WKUP_NUMBER 3
55#define STM32_RTC_ALARM_NUMBER 41
56#define STM32_RTC_ALARM_EXTI 18
57#define STM32_RTC_TAMP_STAMP_EXTI 19
58#define STM32_RTC_WKUP_EXTI 20
59#define STM32_RTC_IRQ_ENABLE() do { \
60 nvicEnableVector(STM32_RTC_TAMP_STAMP_NUMBER, STM32_IRQ_EXTI19_PRIORITY); \
61 nvicEnableVector(STM32_RTC_WKUP_NUMBER, STM32_IRQ_EXTI20_PRIORITY); \
62 nvicEnableVector(STM32_RTC_ALARM_NUMBER, STM32_IRQ_EXTI18_PRIORITY); \
63} while (false)
64
65 /* Enabling RTC-related EXTI lines.*/
66#define STM32_RTC_ENABLE_ALL_EXTI() do { \
67 extiEnableGroup1(EXTI_MASK1(STM32_RTC_ALARM_EXTI) | \
68 EXTI_MASK1(STM32_RTC_TAMP_STAMP_EXTI) | \
69 EXTI_MASK1(STM32_RTC_WKUP_EXTI), \
70 EXTI_MODE_RISING_EDGE | EXTI_MODE_ACTION_INTERRUPT); \
71} while (false)
72
73/* Clearing EXTI interrupts. */
74#define STM32_RTC_CLEAR_ALL_EXTI() do { \
75 extiClearGroup1(EXTI_MASK1(STM32_RTC_ALARM_EXTI) | \
76 EXTI_MASK1(STM32_RTC_TAMP_STAMP_EXTI) | \
77 EXTI_MASK1(STM32_RTC_WKUP_EXTI)); \
78} while (false)
79
80/* Masks used to preserve state of RTC and TAMP register reserved bits. */
81#define STM32_RTC_CR_MASK 0xE7FFFF7F
82#define STM32_RTC_PRER_MASK 0x007F7FFF
83#define STM32_TAMP_CR1_MASK 0x003C0007
84#define STM32_TAMP_CR2_MASK 0x07070007
85#define STM32_TAMP_FLTCR_MASK 0x000000FF
86#define STM32_TAMP_IER_MASK 0x003C0007
87
88#if defined(STM32G441xx) || defined(STM32G483xx) || defined(STM32G484xx) || \
89 defined(__DOXYGEN__)
90#define STM32_HAS_HASH1 TRUE
91#define STM32_HAS_CRYP1 TRUE
92#else
93#define STM32_HAS_HASH1 FALSE
94#define STM32_HAS_CRYP1 FALSE
95#endif
96
97/*===========================================================================*/
98/* STM32G473xx, STM32G4843xx, STM32G474xx, STM32G484xx. */
99/*===========================================================================*/
100
101#if defined(STM32G473xx) || defined(STM32G483xx) || \
102 defined(STM32G474xx) || defined(STM32G484xx) || \
103 defined(__DOXYGEN__)
104
105/* ADC attributes.*/
106#define STM32_HAS_ADC1 TRUE
107#define STM32_HAS_ADC2 TRUE
108#define STM32_HAS_ADC3 TRUE
109#define STM32_HAS_ADC4 TRUE
110#define STM32_HAS_ADC5 TRUE
111
112/* CAN attributes.*/
113#define STM32_HAS_FDCAN1 TRUE
114#define STM32_HAS_FDCAN2 TRUE
115#define STM32_HAS_FDCAN3 TRUE
116#define STM32_FDCAN_FLS_NBR 28U
117#define STM32_FDCAN_FLE_NBR 8U
118#define STM32_FDCAN_RF0_NBR 3U
119#define STM32_FDCAN_RF1_NBR 3U
120#define STM32_FDCAN_RB_NBR 0U
121#define STM32_FDCAN_TEF_NBR 3U
122#define STM32_FDCAN_TB_NBR 3U
123#define STM32_FDCAN_TM_NBR 0U
124
125/* DAC attributes.*/
126#define STM32_HAS_DAC1_CH1 TRUE
127#define STM32_HAS_DAC1_CH2 TRUE
128#define STM32_HAS_DAC2_CH1 TRUE
129#define STM32_HAS_DAC2_CH2 FALSE
130#define STM32_HAS_DAC3_CH1 TRUE
131#define STM32_HAS_DAC3_CH2 TRUE
132#define STM32_HAS_DAC4_CH1 TRUE
133#define STM32_HAS_DAC4_CH2 TRUE
134
135/* DMA attributes.*/
136#define STM32_ADVANCED_DMA TRUE
137#define STM32_DMA_SUPPORTS_DMAMUX TRUE
138#define STM32_DMA_SUPPORTS_CSELR FALSE
139#define STM32_DMA1_NUM_CHANNELS 8
140#define STM32_DMA2_NUM_CHANNELS 8
141
142/* ETH attributes.*/
143#define STM32_HAS_ETH FALSE
144
145/* EXTI attributes.*/
146#define STM32_EXTI_HAS_CR FALSE
147#define STM32_EXTI_SEPARATE_RF FALSE
148#define STM32_EXTI_NUM_LINES 44
149#define STM32_EXTI_IMR1_MASK 0x1F840000U
150#define STM32_EXTI_IMR2_MASK 0xFFFFFF3CU
151
152
153/* Flash attributes.*/
154#define STM32_FLASH_NUMBER_OF_BANKS 2
155
156/* GPIO attributes.*/
157#define STM32_HAS_GPIOA TRUE
158#define STM32_HAS_GPIOB TRUE
159#define STM32_HAS_GPIOC TRUE
160#define STM32_HAS_GPIOD TRUE
161#define STM32_HAS_GPIOE TRUE
162#define STM32_HAS_GPIOF TRUE
163#define STM32_HAS_GPIOG TRUE
164#define STM32_HAS_GPIOH FALSE
165#define STM32_HAS_GPIOI FALSE
166#define STM32_HAS_GPIOJ FALSE
167#define STM32_HAS_GPIOK FALSE
168#define STM32_GPIO_EN_MASK (RCC_AHB2ENR_GPIOAEN | \
169 RCC_AHB2ENR_GPIOBEN | \
170 RCC_AHB2ENR_GPIOCEN | \
171 RCC_AHB2ENR_GPIODEN | \
172 RCC_AHB2ENR_GPIOEEN | \
173 RCC_AHB2ENR_GPIOFEN | \
174 RCC_AHB2ENR_GPIOGEN)
175
176/* I2C attributes.*/
177#define STM32_HAS_I2C1 TRUE
178#define STM32_HAS_I2C2 TRUE
179#define STM32_HAS_I2C3 TRUE
180#define STM32_HAS_I2C4 TRUE
181
182/* OCTOSPI attributes.*/
183#define STM32_HAS_OCTOSPI1 FALSE
184#define STM32_HAS_OCTOSPI2 FALSE
185
186/* QUADSPI attributes.*/
187#define STM32_HAS_QUADSPI1 TRUE
188
189/* SDMMC attributes.*/
190#define STM32_HAS_SDMMC1 FALSE
191#define STM32_HAS_SDMMC2 FALSE
192
193/* SPI attributes.*/
194#define STM32_HAS_SPI1 TRUE
195#define STM32_SPI1_SUPPORTS_I2S FALSE
196
197#define STM32_HAS_SPI2 TRUE
198#define STM32_SPI2_SUPPORTS_I2S TRUE
199
200#define STM32_HAS_SPI3 TRUE
201#define STM32_SPI3_SUPPORTS_I2S TRUE
202
203#define STM32_HAS_SPI4 TRUE
204#define STM32_SPI4_SUPPORTS_I2S FALSE
205
206#define STM32_HAS_SPI5 FALSE
207#define STM32_HAS_SPI6 FALSE
208
209/* TIM attributes.*/
210#define STM32_TIM_MAX_CHANNELS 6
211
212#define STM32_HAS_TIM1 TRUE
213#define STM32_TIM1_IS_32BITS FALSE
214#define STM32_TIM1_CHANNELS 6
215
216#define STM32_HAS_TIM2 TRUE
217#define STM32_TIM2_IS_32BITS TRUE
218#define STM32_TIM2_CHANNELS 4
219
220#define STM32_HAS_TIM3 TRUE
221#define STM32_TIM3_IS_32BITS FALSE
222#define STM32_TIM3_CHANNELS 4
223
224#define STM32_HAS_TIM4 TRUE
225#define STM32_TIM4_IS_32BITS FALSE
226#define STM32_TIM4_CHANNELS 4
227
228#define STM32_HAS_TIM5 TRUE
229#define STM32_TIM5_IS_32BITS TRUE
230#define STM32_TIM5_CHANNELS 4
231
232#define STM32_HAS_TIM6 TRUE
233#define STM32_TIM6_IS_32BITS FALSE
234#define STM32_TIM6_CHANNELS 0
235
236#define STM32_HAS_TIM7 TRUE
237#define STM32_TIM7_IS_32BITS FALSE
238#define STM32_TIM7_CHANNELS 0
239
240#define STM32_HAS_TIM8 TRUE
241#define STM32_TIM8_IS_32BITS FALSE
242#define STM32_TIM8_CHANNELS 6
243
244#define STM32_HAS_TIM15 TRUE
245#define STM32_TIM15_IS_32BITS FALSE
246#define STM32_TIM15_CHANNELS 2
247
248#define STM32_HAS_TIM16 TRUE
249#define STM32_TIM16_IS_32BITS FALSE
250#define STM32_TIM16_CHANNELS 1
251
252#define STM32_HAS_TIM17 TRUE
253#define STM32_TIM17_IS_32BITS FALSE
254#define STM32_TIM17_CHANNELS 1
255
256#define STM32_HAS_TIM20 TRUE
257#define STM32_TIM20_IS_32BITS FALSE
258#define STM32_TIM20_CHANNELS 6
259
260#define STM32_HAS_TIM9 FALSE
261#define STM32_HAS_TIM10 FALSE
262#define STM32_HAS_TIM11 FALSE
263#define STM32_HAS_TIM12 FALSE
264#define STM32_HAS_TIM13 FALSE
265#define STM32_HAS_TIM14 FALSE
266#define STM32_HAS_TIM18 FALSE
267#define STM32_HAS_TIM19 FALSE
268#define STM32_HAS_TIM21 FALSE
269#define STM32_HAS_TIM22 FALSE
270
271/* USART attributes.*/
272#define STM32_HAS_USART1 TRUE
273#define STM32_HAS_USART2 TRUE
274#define STM32_HAS_USART3 TRUE
275#define STM32_HAS_UART4 TRUE
276#define STM32_HAS_UART5 TRUE
277#define STM32_HAS_LPUART1 TRUE
278#define STM32_HAS_USART6 FALSE
279#define STM32_HAS_UART7 FALSE
280#define STM32_HAS_UART8 FALSE
281
282/* OTG/USB attributes.*/
283#define STM32_HAS_OTG1 FALSE
284#define STM32_HAS_OTG2 FALSE
285
286#define STM32_HAS_USB TRUE
287#define STM32_USB_ACCESS_SCHEME_2x16 TRUE
288#define STM32_USB_PMA_SIZE 1024
289#define STM32_USB_HAS_BCDR TRUE
290
291/* IWDG attributes.*/
292#define STM32_HAS_IWDG TRUE
293#define STM32_IWDG_IS_WINDOWED TRUE
294
295/* LTDC attributes.*/
296#define STM32_HAS_LTDC FALSE
297
298/* DMA2D attributes.*/
299#define STM32_HAS_DMA2D FALSE
300
301/* FSMC attributes.*/
302#define STM32_HAS_FSMC FALSE
303
304/* CRC attributes.*/
305#define STM32_HAS_CRC TRUE
306#define STM32_CRC_PROGRAMMABLE TRUE
307
308/* DCMI attributes.*/
309#define STM32_HAS_DCMI FALSE
310
311#endif /* defined(STM32G474xx) || defined(STM32G484xx) */
312
313/*===========================================================================*/
314/* STM32G431xx, STM32G441xx, STM32G471xx. */
315/*===========================================================================*/
316
317#if defined(STM32G431xx) || defined(STM32G441xx) || \
318 defined(__DOXYGEN__)
319
320/* ADC attributes.*/
321#define STM32_HAS_ADC1 TRUE
322#define STM32_HAS_ADC2 TRUE
323#define STM32_HAS_ADC3 FALSE
324#define STM32_HAS_ADC4 FALSE
325#define STM32_HAS_ADC5 FALSE
326
327/* CAN attributes.*/
328#define STM32_HAS_FDCAN1 TRUE
329#define STM32_HAS_FDCAN2 FALSE
330#define STM32_HAS_FDCAN3 FALSE
331#define STM32_FDCAN_FLS_NBR 28U
332#define STM32_FDCAN_FLE_NBR 8U
333#define STM32_FDCAN_RF0_NBR 3U
334#define STM32_FDCAN_RF1_NBR 3U
335#define STM32_FDCAN_RB_NBR 0U
336#define STM32_FDCAN_TEF_NBR 3U
337#define STM32_FDCAN_TB_NBR 3U
338#define STM32_FDCAN_TM_NBR 0U
339
340/* DAC attributes.*/
341#define STM32_HAS_DAC1_CH1 TRUE
342#define STM32_HAS_DAC1_CH2 TRUE
343#define STM32_HAS_DAC2_CH1 FALSE
344#define STM32_HAS_DAC2_CH2 FALSE
345#define STM32_HAS_DAC3_CH1 TRUE
346#define STM32_HAS_DAC3_CH2 TRUE
347#define STM32_HAS_DAC4_CH1 FALSE
348#define STM32_HAS_DAC4_CH2 FALSE
349
350/* DMA attributes.*/
351#define STM32_ADVANCED_DMA TRUE
352#define STM32_DMA_SUPPORTS_DMAMUX TRUE
353#define STM32_DMA_SUPPORTS_CSELR FALSE
354#define STM32_DMA1_NUM_CHANNELS 6
355#define STM32_DMA2_NUM_CHANNELS 6
356
357/* ETH attributes.*/
358#define STM32_HAS_ETH FALSE
359
360/* EXTI attributes.*/
361#define STM32_EXTI_HAS_CR FALSE
362#define STM32_EXTI_SEPARATE_RF FALSE
363#define STM32_EXTI_NUM_LINES 44
364#define STM32_EXTI_IMR1_MASK 0x1F840000U
365#define STM32_EXTI_IMR2_MASK 0xFFFFFF3CU
366
367
368/* Flash attributes.*/
369#define STM32_FLASH_NUMBER_OF_BANKS 2
370
371/* GPIO attributes.*/
372#define STM32_HAS_GPIOA TRUE
373#define STM32_HAS_GPIOB TRUE
374#define STM32_HAS_GPIOC TRUE
375#define STM32_HAS_GPIOD TRUE
376#define STM32_HAS_GPIOE TRUE
377#define STM32_HAS_GPIOF TRUE
378#define STM32_HAS_GPIOG TRUE
379#define STM32_HAS_GPIOH FALSE
380#define STM32_HAS_GPIOI FALSE
381#define STM32_HAS_GPIOJ FALSE
382#define STM32_HAS_GPIOK FALSE
383#define STM32_GPIO_EN_MASK (RCC_AHB2ENR_GPIOAEN | \
384 RCC_AHB2ENR_GPIOBEN | \
385 RCC_AHB2ENR_GPIOCEN | \
386 RCC_AHB2ENR_GPIODEN | \
387 RCC_AHB2ENR_GPIOEEN | \
388 RCC_AHB2ENR_GPIOFEN | \
389 RCC_AHB2ENR_GPIOGEN)
390
391/* I2C attributes.*/
392#define STM32_HAS_I2C1 TRUE
393#define STM32_HAS_I2C2 TRUE
394#define STM32_HAS_I2C3 TRUE
395#define STM32_HAS_I2C4 FALSE
396
397/* OCTOSPI attributes.*/
398#define STM32_HAS_OCTOSPI1 FALSE
399#define STM32_HAS_OCTOSPI2 FALSE
400
401/* QUADSPI attributes.*/
402#define STM32_HAS_QUADSPI1 FALSE
403
404/* SDMMC attributes.*/
405#define STM32_HAS_SDMMC1 FALSE
406#define STM32_HAS_SDMMC2 FALSE
407
408/* SPI attributes.*/
409#define STM32_HAS_SPI1 TRUE
410#define STM32_SPI1_SUPPORTS_I2S FALSE
411
412#define STM32_HAS_SPI2 TRUE
413#define STM32_SPI2_SUPPORTS_I2S TRUE
414
415#define STM32_HAS_SPI3 TRUE
416#define STM32_SPI3_SUPPORTS_I2S TRUE
417
418#define STM32_HAS_SPI4 FALSE
419#define STM32_HAS_SPI5 FALSE
420#define STM32_HAS_SPI6 FALSE
421
422/* TIM attributes.*/
423#define STM32_TIM_MAX_CHANNELS 6
424
425#define STM32_HAS_TIM1 TRUE
426#define STM32_TIM1_IS_32BITS FALSE
427#define STM32_TIM1_CHANNELS 6
428
429#define STM32_HAS_TIM2 TRUE
430#define STM32_TIM2_IS_32BITS TRUE
431#define STM32_TIM2_CHANNELS 4
432
433#define STM32_HAS_TIM3 TRUE
434#define STM32_TIM3_IS_32BITS FALSE
435#define STM32_TIM3_CHANNELS 4
436
437#define STM32_HAS_TIM4 TRUE
438#define STM32_TIM4_IS_32BITS FALSE
439#define STM32_TIM4_CHANNELS 4
440
441#define STM32_HAS_TIM6 TRUE
442#define STM32_TIM6_IS_32BITS FALSE
443#define STM32_TIM6_CHANNELS 0
444
445#define STM32_HAS_TIM7 TRUE
446#define STM32_TIM7_IS_32BITS FALSE
447#define STM32_TIM7_CHANNELS 0
448
449#define STM32_HAS_TIM8 TRUE
450#define STM32_TIM8_IS_32BITS FALSE
451#define STM32_TIM8_CHANNELS 6
452
453#define STM32_HAS_TIM15 TRUE
454#define STM32_TIM15_IS_32BITS FALSE
455#define STM32_TIM15_CHANNELS 2
456
457#define STM32_HAS_TIM16 TRUE
458#define STM32_TIM16_IS_32BITS FALSE
459#define STM32_TIM16_CHANNELS 1
460
461#define STM32_HAS_TIM17 TRUE
462#define STM32_TIM17_IS_32BITS FALSE
463#define STM32_TIM17_CHANNELS 1
464
465#define STM32_HAS_TIM5 FALSE
466#define STM32_HAS_TIM9 FALSE
467#define STM32_HAS_TIM10 FALSE
468#define STM32_HAS_TIM11 FALSE
469#define STM32_HAS_TIM12 FALSE
470#define STM32_HAS_TIM13 FALSE
471#define STM32_HAS_TIM14 FALSE
472#define STM32_HAS_TIM18 FALSE
473#define STM32_HAS_TIM19 FALSE
474#define STM32_HAS_TIM20 FALSE
475#define STM32_HAS_TIM21 FALSE
476#define STM32_HAS_TIM22 FALSE
477
478/* USART attributes.*/
479#define STM32_HAS_USART1 TRUE
480#define STM32_HAS_USART2 TRUE
481#define STM32_HAS_USART3 TRUE
482#define STM32_HAS_UART4 TRUE
483#define STM32_HAS_UART5 FALSE
484#define STM32_HAS_LPUART1 TRUE
485#define STM32_HAS_USART6 FALSE
486#define STM32_HAS_UART7 FALSE
487#define STM32_HAS_UART8 FALSE
488
489/* OTG/USB attributes.*/
490#define STM32_HAS_OTG1 FALSE
491#define STM32_HAS_OTG2 FALSE
492
493#define STM32_HAS_USB TRUE
494#define STM32_USB_ACCESS_SCHEME_2x16 TRUE
495#define STM32_USB_PMA_SIZE 1024
496#define STM32_USB_HAS_BCDR TRUE
497
498/* IWDG attributes.*/
499#define STM32_HAS_IWDG TRUE
500#define STM32_IWDG_IS_WINDOWED TRUE
501
502/* LTDC attributes.*/
503#define STM32_HAS_LTDC FALSE
504
505/* DMA2D attributes.*/
506#define STM32_HAS_DMA2D FALSE
507
508/* FSMC attributes.*/
509#define STM32_HAS_FSMC FALSE
510
511/* CRC attributes.*/
512#define STM32_HAS_CRC TRUE
513#define STM32_CRC_PROGRAMMABLE TRUE
514
515/* DCMI attributes.*/
516#define STM32_HAS_DCMI FALSE
517
518#endif /* defined(STM32G431xx) || defined(STM32G441xx) */
519
520/** @} */
521
522#endif /* STM32_REGISTRY_H */
523
524/** @} */