aboutsummaryrefslogtreecommitdiff
path: root/lib/chibios/os/hal/ports/STM32/STM32L4xx/stm32_registry.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/chibios/os/hal/ports/STM32/STM32L4xx/stm32_registry.h')
-rw-r--r--lib/chibios/os/hal/ports/STM32/STM32L4xx/stm32_registry.h1349
1 files changed, 1349 insertions, 0 deletions
diff --git a/lib/chibios/os/hal/ports/STM32/STM32L4xx/stm32_registry.h b/lib/chibios/os/hal/ports/STM32/STM32L4xx/stm32_registry.h
new file mode 100644
index 000000000..7a3a66ee5
--- /dev/null
+++ b/lib/chibios/os/hal/ports/STM32/STM32L4xx/stm32_registry.h
@@ -0,0 +1,1349 @@
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 STM32L4xx/stm32_registry.h
19 * @brief STM32L4xx 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 STM32L4xx 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#if defined(STM32L486xx) || defined(STM32L4A6xx) || \
66 defined(__DOXYGEN__)
67#define STM32_HAS_HASH1 TRUE
68#define STM32_HAS_CRYP1 TRUE
69#else
70#define STM32_HAS_HASH1 FALSE
71#define STM32_HAS_CRYP1 FALSE
72#endif
73
74/*===========================================================================*/
75/* STM32L432xx. */
76/*===========================================================================*/
77
78#if defined(STM32L432xx) || defined(__DOXYGEN__)
79
80/* Clock attributes.*/
81#define STM32_CLOCK_HAS_HSI48 TRUE
82
83/* ADC attributes.*/
84#define STM32_HAS_ADC1 TRUE
85#define STM32_ADC1_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 1) |\
86 STM32_DMA_STREAM_ID_MSK(2, 3))
87#define STM32_ADC1_DMA_CHN 0x00000000
88
89#define STM32_HAS_ADC2 FALSE
90#define STM32_HAS_ADC3 FALSE
91#define STM32_HAS_ADC4 FALSE
92
93/* CAN attributes.*/
94#define STM32_CAN_MAX_FILTERS 14
95#define STM32_HAS_CAN1 TRUE
96#define STM32_HAS_CAN2 FALSE
97#define STM32_HAS_CAN3 FALSE
98
99/* DAC attributes.*/
100#define STM32_HAS_DAC1_CH1 TRUE
101#define STM32_DAC1_CH1_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 3)|\
102 STM32_DMA_STREAM_ID_MSK(2, 4))
103#define STM32_DAC1_CH1_DMA_CHN 0x00003600
104
105#define STM32_HAS_DAC1_CH2 TRUE
106#define STM32_DAC1_CH2_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 4)|\
107 STM32_DMA_STREAM_ID_MSK(2, 5))
108#define STM32_DAC1_CH2_DMA_CHN 0x00035000
109
110#define STM32_HAS_DAC2_CH1 FALSE
111#define STM32_HAS_DAC2_CH2 FALSE
112
113/* DMA attributes.*/
114#define STM32_ADVANCED_DMA TRUE
115#define STM32_DMA_SUPPORTS_DMAMUX FALSE
116#define STM32_DMA_SUPPORTS_CSELR TRUE
117#define STM32_DMA1_NUM_CHANNELS 7
118#define STM32_DMA2_NUM_CHANNELS 7
119
120/* ETH attributes.*/
121#define STM32_HAS_ETH FALSE
122
123/* EXTI attributes.*/
124#define STM32_EXTI_NUM_LINES 40
125#define STM32_EXTI_IMR1_MASK 0xFF820000U
126#define STM32_EXTI_IMR2_MASK 0xFFFFFF87U
127
128/* Flash attributes.*/
129#define STM32_FLASH_NUMBER_OF_BANKS 1
130#if !defined(STM32_FLASH_SECTORS_PER_BANK) || defined(__DOXYGEN__)
131#define STM32_FLASH_SECTORS_PER_BANK 256 /* Maximum, can be redefined.*/
132#endif
133
134/* GPIO attributes.*/
135#define STM32_HAS_GPIOA TRUE
136#define STM32_HAS_GPIOB TRUE
137#define STM32_HAS_GPIOC TRUE
138#define STM32_HAS_GPIOD FALSE
139#define STM32_HAS_GPIOE FALSE
140#define STM32_HAS_GPIOF FALSE
141#define STM32_HAS_GPIOG FALSE
142#define STM32_HAS_GPIOH TRUE
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_AHB2ENR_GPIOAEN | \
147 RCC_AHB2ENR_GPIOBEN | \
148 RCC_AHB2ENR_GPIOCEN)
149
150/* I2C attributes.*/
151#define STM32_HAS_I2C1 TRUE
152#define STM32_I2C1_RX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 7) |\
153 STM32_DMA_STREAM_ID_MSK(2, 6))
154#define STM32_I2C1_RX_DMA_CHN 0x03500000
155#define STM32_I2C1_TX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 6) |\
156 STM32_DMA_STREAM_ID_MSK(2, 7))
157#define STM32_I2C1_TX_DMA_CHN 0x05300000
158
159#define STM32_HAS_I2C3 TRUE
160#define STM32_I2C3_RX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 3))
161#define STM32_I2C3_RX_DMA_CHN 0x00000300
162#define STM32_I2C3_TX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 2))
163#define STM32_I2C3_TX_DMA_CHN 0x00000030
164
165#define STM32_HAS_I2C2 FALSE
166#define STM32_HAS_I2C4 FALSE
167
168/* QUADSPI attributes.*/
169#define STM32_HAS_QUADSPI1 TRUE
170#define STM32_QUADSPI1_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 5) |\
171 STM32_DMA_STREAM_ID_MSK(2, 7))
172#define STM32_QUADSPI1_DMA_CHN 0x03050000
173
174/* SDMMC attributes.*/
175#define STM32_HAS_SDMMC1 FALSE
176#define STM32_HAS_SDMMC2 FALSE
177
178/* SPI attributes.*/
179#define STM32_HAS_SPI1 TRUE
180#define STM32_SPI1_SUPPORTS_I2S FALSE
181#define STM32_SPI1_RX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 2) |\
182 STM32_DMA_STREAM_ID_MSK(2, 3))
183#define STM32_SPI1_RX_DMA_CHN 0x00000410
184#define STM32_SPI1_TX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 3) |\
185 STM32_DMA_STREAM_ID_MSK(2, 4))
186#define STM32_SPI1_TX_DMA_CHN 0x00004100
187
188#define STM32_HAS_SPI3 TRUE
189#define STM32_SPI3_SUPPORTS_I2S FALSE
190#define STM32_SPI3_RX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(2, 1))
191#define STM32_SPI3_RX_DMA_CHN 0x00000003
192#define STM32_SPI3_TX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(2, 2))
193#define STM32_SPI3_TX_DMA_CHN 0x00000030
194
195#define STM32_HAS_SPI2 FALSE
196#define STM32_HAS_SPI4 FALSE
197#define STM32_HAS_SPI5 FALSE
198#define STM32_HAS_SPI6 FALSE
199
200/* TIM attributes.*/
201#define STM32_TIM_MAX_CHANNELS 6
202
203#define STM32_HAS_TIM1 TRUE
204#define STM32_TIM1_IS_32BITS FALSE
205#define STM32_TIM1_CHANNELS 6
206
207#define STM32_HAS_TIM2 TRUE
208#define STM32_TIM2_IS_32BITS TRUE
209#define STM32_TIM2_CHANNELS 4
210
211#define STM32_HAS_TIM6 TRUE
212#define STM32_TIM6_IS_32BITS FALSE
213#define STM32_TIM6_CHANNELS 0
214
215#define STM32_HAS_TIM7 TRUE
216#define STM32_TIM7_IS_32BITS FALSE
217#define STM32_TIM7_CHANNELS 0
218
219#define STM32_HAS_TIM15 TRUE
220#define STM32_TIM15_IS_32BITS FALSE
221#define STM32_TIM15_CHANNELS 2
222
223#define STM32_HAS_TIM16 TRUE
224#define STM32_TIM16_IS_32BITS FALSE
225#define STM32_TIM16_CHANNELS 2
226
227#define STM32_HAS_TIM3 FALSE
228#define STM32_HAS_TIM4 FALSE
229#define STM32_HAS_TIM5 FALSE
230#define STM32_HAS_TIM8 FALSE
231#define STM32_HAS_TIM9 FALSE
232#define STM32_HAS_TIM10 FALSE
233#define STM32_HAS_TIM11 FALSE
234#define STM32_HAS_TIM12 FALSE
235#define STM32_HAS_TIM13 FALSE
236#define STM32_HAS_TIM14 FALSE
237#define STM32_HAS_TIM17 FALSE
238#define STM32_HAS_TIM18 FALSE
239#define STM32_HAS_TIM19 FALSE
240#define STM32_HAS_TIM20 FALSE
241#define STM32_HAS_TIM21 FALSE
242#define STM32_HAS_TIM22 FALSE
243
244/* USART attributes.*/
245#define STM32_HAS_USART1 TRUE
246#define STM32_USART1_RX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 5) |\
247 STM32_DMA_STREAM_ID_MSK(2, 7))
248#define STM32_USART1_RX_DMA_CHN 0x02020000
249#define STM32_USART1_TX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 4) |\
250 STM32_DMA_STREAM_ID_MSK(2, 6))
251#define STM32_USART1_TX_DMA_CHN 0x00202000
252
253#define STM32_HAS_USART2 TRUE
254#define STM32_USART2_RX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 6))
255#define STM32_USART2_RX_DMA_CHN 0x00200000
256#define STM32_USART2_TX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 7))
257#define STM32_USART2_TX_DMA_CHN 0x02000000
258
259#define STM32_HAS_LPUART1 TRUE
260
261#define STM32_HAS_USART3 FALSE
262#define STM32_HAS_UART4 FALSE
263#define STM32_HAS_UART5 FALSE
264#define STM32_HAS_USART6 FALSE
265#define STM32_HAS_UART7 FALSE
266#define STM32_HAS_UART8 FALSE
267
268/* USB attributes.*/
269#define STM32_HAS_USB TRUE
270#define STM32_USB_ACCESS_SCHEME_2x16 TRUE
271#define STM32_USB_PMA_SIZE 1024
272#define STM32_USB_HAS_BCDR TRUE
273
274#define STM32_HAS_OTG1 FALSE
275#define STM32_HAS_OTG2 FALSE
276
277/* IWDG attributes.*/
278#define STM32_HAS_IWDG TRUE
279#define STM32_IWDG_IS_WINDOWED TRUE
280
281/* LTDC attributes.*/
282#define STM32_HAS_LTDC FALSE
283
284/* DMA2D attributes.*/
285#define STM32_HAS_DMA2D FALSE
286
287/* FSMC attributes.*/
288#define STM32_HAS_FSMC TRUE
289
290/* CRC attributes.*/
291#define STM32_HAS_CRC TRUE
292#define STM32_CRC_PROGRAMMABLE TRUE
293
294#endif /* defined(STM32L432xx) */
295
296/*===========================================================================*/
297/* STM32L433xx, STM32L443xx. */
298/*===========================================================================*/
299
300#if defined(STM32L433xx) || defined(STM32L443xx) || defined(__DOXYGEN__)
301
302/* Clock attributes.*/
303#define STM32_CLOCK_HAS_HSI48 TRUE
304
305/* ADC attributes.*/
306#define STM32_HAS_ADC1 TRUE
307#define STM32_ADC1_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 1) |\
308 STM32_DMA_STREAM_ID_MSK(2, 3))
309#define STM32_ADC1_DMA_CHN 0x00000000
310
311#define STM32_HAS_ADC2 FALSE
312#define STM32_HAS_ADC3 FALSE
313#define STM32_HAS_ADC4 FALSE
314
315/* CAN attributes.*/
316#define STM32_CAN_MAX_FILTERS 14
317#define STM32_HAS_CAN1 TRUE
318#define STM32_HAS_CAN2 FALSE
319#define STM32_HAS_CAN3 FALSE
320
321/* DAC attributes.*/
322#define STM32_HAS_DAC1_CH1 TRUE
323#define STM32_DAC1_CH1_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 3)|\
324 STM32_DMA_STREAM_ID_MSK(2, 4))
325#define STM32_DAC1_CH1_DMA_CHN 0x00003600
326
327#define STM32_HAS_DAC1_CH2 TRUE
328#define STM32_DAC1_CH2_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 4)|\
329 STM32_DMA_STREAM_ID_MSK(2, 5))
330#define STM32_DAC1_CH2_DMA_CHN 0x00035000
331
332#define STM32_HAS_DAC2_CH1 FALSE
333#define STM32_HAS_DAC2_CH2 FALSE
334
335/* DMA attributes.*/
336#define STM32_ADVANCED_DMA TRUE
337#define STM32_DMA_SUPPORTS_DMAMUX FALSE
338#define STM32_DMA_SUPPORTS_CSELR TRUE
339#define STM32_DMA1_NUM_CHANNELS 7
340#define STM32_DMA2_NUM_CHANNELS 7
341
342/* ETH attributes.*/
343#define STM32_HAS_ETH FALSE
344
345/* EXTI attributes.*/
346#define STM32_EXTI_NUM_LINES 40
347#define STM32_EXTI_IMR1_MASK 0xFF820000U
348#define STM32_EXTI_IMR2_MASK 0xFFFFFF87U
349
350/* Flash attributes.*/
351#define STM32_FLASH_NUMBER_OF_BANKS 1
352#if !defined(STM32_FLASH_SECTORS_PER_BANK) || defined(__DOXYGEN__)
353#define STM32_FLASH_SECTORS_PER_BANK 256 /* Maximum, can be redefined.*/
354#endif
355
356/* GPIO attributes.*/
357#define STM32_HAS_GPIOA TRUE
358#define STM32_HAS_GPIOB TRUE
359#define STM32_HAS_GPIOC TRUE
360#define STM32_HAS_GPIOD TRUE
361#define STM32_HAS_GPIOE TRUE
362#define STM32_HAS_GPIOF FALSE
363#define STM32_HAS_GPIOG FALSE
364#define STM32_HAS_GPIOH TRUE
365#define STM32_HAS_GPIOI FALSE
366#define STM32_HAS_GPIOJ FALSE
367#define STM32_HAS_GPIOK FALSE
368#define STM32_GPIO_EN_MASK (RCC_AHB2ENR_GPIOAEN | \
369 RCC_AHB2ENR_GPIOBEN | \
370 RCC_AHB2ENR_GPIOCEN | \
371 RCC_AHB2ENR_GPIODEN | \
372 RCC_AHB2ENR_GPIOEEN | \
373 RCC_AHB2ENR_GPIOHEN)
374
375/* I2C attributes.*/
376#define STM32_HAS_I2C1 TRUE
377#define STM32_I2C1_RX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 7) |\
378 STM32_DMA_STREAM_ID_MSK(2, 6))
379#define STM32_I2C1_RX_DMA_CHN 0x03500000
380#define STM32_I2C1_TX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 6) |\
381 STM32_DMA_STREAM_ID_MSK(2, 7))
382#define STM32_I2C1_TX_DMA_CHN 0x05300000
383
384#define STM32_HAS_I2C2 TRUE
385#define STM32_I2C2_RX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 5))
386#define STM32_I2C2_RX_DMA_CHN 0x00030000
387#define STM32_I2C2_TX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 4))
388#define STM32_I2C2_TX_DMA_CHN 0x00003000
389
390#define STM32_HAS_I2C3 TRUE
391#define STM32_I2C3_RX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 3))
392#define STM32_I2C3_RX_DMA_CHN 0x00000300
393#define STM32_I2C3_TX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 2))
394#define STM32_I2C3_TX_DMA_CHN 0x00000030
395
396#define STM32_HAS_I2C4 FALSE
397
398/* QUADSPI attributes.*/
399#define STM32_HAS_QUADSPI1 TRUE
400#define STM32_QUADSPI1_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 5) |\
401 STM32_DMA_STREAM_ID_MSK(2, 7))
402#define STM32_QUADSPI1_DMA_CHN 0x03050000
403
404/* SDMMC attributes.*/
405#define STM32_HAS_SDMMC1 TRUE
406#define STM32_SDC_SDMMC1_DMA_MSK (STM32_DMA_STREAM_ID_MSK(2, 4) |\
407 STM32_DMA_STREAM_ID_MSK(2, 5))
408#define STM32_SDC_SDMMC1_DMA_CHN 0x00077000
409
410#define STM32_HAS_SDMMC2 FALSE
411
412/* SPI attributes.*/
413#define STM32_HAS_SPI1 TRUE
414#define STM32_SPI1_SUPPORTS_I2S FALSE
415#define STM32_SPI1_RX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 2) |\
416 STM32_DMA_STREAM_ID_MSK(2, 3))
417#define STM32_SPI1_RX_DMA_CHN 0x00000410
418#define STM32_SPI1_TX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 3) |\
419 STM32_DMA_STREAM_ID_MSK(2, 4))
420#define STM32_SPI1_TX_DMA_CHN 0x00004100
421
422#define STM32_HAS_SPI2 TRUE
423#define STM32_SPI2_SUPPORTS_I2S FALSE
424#define STM32_SPI2_RX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 4))
425#define STM32_SPI2_RX_DMA_CHN 0x00001000
426#define STM32_SPI2_TX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 5))
427#define STM32_SPI2_TX_DMA_CHN 0x00010000
428
429#define STM32_HAS_SPI3 TRUE
430#define STM32_SPI3_SUPPORTS_I2S FALSE
431#define STM32_SPI3_RX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(2, 1))
432#define STM32_SPI3_RX_DMA_CHN 0x00000003
433#define STM32_SPI3_TX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(2, 2))
434#define STM32_SPI3_TX_DMA_CHN 0x00000030
435
436#define STM32_HAS_SPI4 FALSE
437#define STM32_HAS_SPI5 FALSE
438#define STM32_HAS_SPI6 FALSE
439
440/* TIM attributes.*/
441#define STM32_TIM_MAX_CHANNELS 6
442
443#define STM32_HAS_TIM1 TRUE
444#define STM32_TIM1_IS_32BITS FALSE
445#define STM32_TIM1_CHANNELS 6
446
447#define STM32_HAS_TIM2 TRUE
448#define STM32_TIM2_IS_32BITS TRUE
449#define STM32_TIM2_CHANNELS 4
450
451#define STM32_HAS_TIM6 TRUE
452#define STM32_TIM6_IS_32BITS FALSE
453#define STM32_TIM6_CHANNELS 0
454
455#define STM32_HAS_TIM7 TRUE
456#define STM32_TIM7_IS_32BITS FALSE
457#define STM32_TIM7_CHANNELS 0
458
459#define STM32_HAS_TIM15 TRUE
460#define STM32_TIM15_IS_32BITS FALSE
461#define STM32_TIM15_CHANNELS 2
462
463#define STM32_HAS_TIM16 TRUE
464#define STM32_TIM16_IS_32BITS FALSE
465#define STM32_TIM16_CHANNELS 2
466
467#define STM32_HAS_TIM3 FALSE
468#define STM32_HAS_TIM4 FALSE
469#define STM32_HAS_TIM5 FALSE
470#define STM32_HAS_TIM8 FALSE
471#define STM32_HAS_TIM9 FALSE
472#define STM32_HAS_TIM10 FALSE
473#define STM32_HAS_TIM11 FALSE
474#define STM32_HAS_TIM12 FALSE
475#define STM32_HAS_TIM13 FALSE
476#define STM32_HAS_TIM14 FALSE
477#define STM32_HAS_TIM17 FALSE
478#define STM32_HAS_TIM18 FALSE
479#define STM32_HAS_TIM19 FALSE
480#define STM32_HAS_TIM20 FALSE
481#define STM32_HAS_TIM21 FALSE
482#define STM32_HAS_TIM22 FALSE
483
484/* USART attributes.*/
485#define STM32_HAS_USART1 TRUE
486#define STM32_USART1_RX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 5) |\
487 STM32_DMA_STREAM_ID_MSK(2, 7))
488#define STM32_USART1_RX_DMA_CHN 0x02020000
489#define STM32_USART1_TX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 4) |\
490 STM32_DMA_STREAM_ID_MSK(2, 6))
491#define STM32_USART1_TX_DMA_CHN 0x00202000
492
493#define STM32_HAS_USART2 TRUE
494#define STM32_USART2_RX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 6))
495#define STM32_USART2_RX_DMA_CHN 0x00200000
496#define STM32_USART2_TX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 7))
497#define STM32_USART2_TX_DMA_CHN 0x02000000
498
499#define STM32_HAS_USART3 TRUE
500#define STM32_USART3_RX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 3))
501#define STM32_USART3_RX_DMA_CHN 0x00000200
502#define STM32_USART3_TX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 2))
503#define STM32_USART3_TX_DMA_CHN 0x00000020
504
505#define STM32_HAS_LPUART1 TRUE
506
507#define STM32_HAS_UART4 FALSE
508#define STM32_HAS_UART5 FALSE
509#define STM32_HAS_USART6 FALSE
510#define STM32_HAS_UART7 FALSE
511#define STM32_HAS_UART8 FALSE
512
513/* USB attributes.*/
514#define STM32_HAS_USB TRUE
515#define STM32_USB_ACCESS_SCHEME_2x16 TRUE
516#define STM32_USB_PMA_SIZE 1024
517#define STM32_USB_HAS_BCDR TRUE
518
519#define STM32_HAS_OTG1 FALSE
520#define STM32_HAS_OTG2 FALSE
521
522/* IWDG attributes.*/
523#define STM32_HAS_IWDG TRUE
524#define STM32_IWDG_IS_WINDOWED TRUE
525
526/* LTDC attributes.*/
527#define STM32_HAS_LTDC FALSE
528
529/* DMA2D attributes.*/
530#define STM32_HAS_DMA2D FALSE
531
532/* FSMC attributes.*/
533#define STM32_HAS_FSMC TRUE
534
535/* CRC attributes.*/
536#define STM32_HAS_CRC TRUE
537#define STM32_CRC_PROGRAMMABLE TRUE
538
539#endif /* defined(STM32L443xx) */
540
541/*===========================================================================*/
542/* STM32L452xx. */
543/*===========================================================================*/
544
545#if defined(STM32L452xx) || defined(__DOXYGEN__)
546
547/* Clock attributes.*/
548#define STM32_CLOCK_HAS_HSI48 TRUE
549
550/* ADC attributes.*/
551#define STM32_HAS_ADC1 TRUE
552#define STM32_ADC1_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 1) |\
553 STM32_DMA_STREAM_ID_MSK(2, 3))
554#define STM32_ADC1_DMA_CHN 0x00000000
555
556#define STM32_HAS_ADC2 FALSE
557#define STM32_HAS_ADC3 FALSE
558#define STM32_HAS_ADC4 FALSE
559
560/* CAN attributes.*/
561#define STM32_CAN_MAX_FILTERS 14
562#define STM32_HAS_CAN1 TRUE
563#define STM32_HAS_CAN2 FALSE
564#define STM32_HAS_CAN3 FALSE
565
566/* DAC attributes.*/
567#define STM32_HAS_DAC1_CH1 TRUE
568#define STM32_DAC1_CH1_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 3)|\
569 STM32_DMA_STREAM_ID_MSK(2, 4))
570#define STM32_DAC1_CH1_DMA_CHN 0x00003600
571
572#define STM32_HAS_DAC1_CH2 FALSE
573#define STM32_HAS_DAC2_CH1 FALSE
574#define STM32_HAS_DAC2_CH2 FALSE
575
576/* DMA attributes.*/
577#define STM32_ADVANCED_DMA TRUE
578#define STM32_DMA_SUPPORTS_DMAMUX FALSE
579#define STM32_DMA_SUPPORTS_CSELR TRUE
580#define STM32_DMA1_NUM_CHANNELS 7
581#define STM32_DMA2_NUM_CHANNELS 7
582
583/* ETH attributes.*/
584#define STM32_HAS_ETH FALSE
585
586/* EXTI attributes.*/
587#define STM32_EXTI_NUM_LINES 40
588#define STM32_EXTI_IMR1_MASK 0xFF820000U
589#define STM32_EXTI_IMR2_MASK 0xFFFFFF87U
590
591/* GPIO attributes.*/
592#define STM32_HAS_GPIOA TRUE
593#define STM32_HAS_GPIOB TRUE
594#define STM32_HAS_GPIOC TRUE
595#define STM32_HAS_GPIOD TRUE
596#define STM32_HAS_GPIOE TRUE
597#define STM32_HAS_GPIOF FALSE
598#define STM32_HAS_GPIOG FALSE
599#define STM32_HAS_GPIOH TRUE
600#define STM32_HAS_GPIOI FALSE
601#define STM32_HAS_GPIOJ FALSE
602#define STM32_HAS_GPIOK FALSE
603#define STM32_GPIO_EN_MASK (RCC_AHB2ENR_GPIOAEN | \
604 RCC_AHB2ENR_GPIOBEN | \
605 RCC_AHB2ENR_GPIOCEN | \
606 RCC_AHB2ENR_GPIODEN | \
607 RCC_AHB2ENR_GPIOEEN | \
608 RCC_AHB2ENR_GPIOHEN)
609
610/* I2C attributes.*/
611#define STM32_HAS_I2C1 TRUE
612#define STM32_I2C1_RX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 7) |\
613 STM32_DMA_STREAM_ID_MSK(2, 6))
614#define STM32_I2C1_RX_DMA_CHN 0x03500000
615#define STM32_I2C1_TX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 6) |\
616 STM32_DMA_STREAM_ID_MSK(2, 7))
617#define STM32_I2C1_TX_DMA_CHN 0x05300000
618
619#define STM32_HAS_I2C2 TRUE
620#define STM32_I2C2_RX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 5))
621#define STM32_I2C2_RX_DMA_CHN 0x00030000
622#define STM32_I2C2_TX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 4))
623#define STM32_I2C2_TX_DMA_CHN 0x00003000
624
625#define STM32_HAS_I2C3 TRUE
626#define STM32_I2C3_RX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 3))
627#define STM32_I2C3_RX_DMA_CHN 0x00000300
628#define STM32_I2C3_TX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 2))
629#define STM32_I2C3_TX_DMA_CHN 0x00000030
630
631#define STM32_HAS_I2C4 TRUE
632#define STM32_I2C4_RX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(2, 2))
633#define STM32_I2C4_RX_DMA_CHN 0x00000000
634#define STM32_I2C4_TX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(2, 1))
635#define STM32_I2C4_TX_DMA_CHN 0x00000000
636
637/* QUADSPI attributes.*/
638#define STM32_HAS_QUADSPI1 TRUE
639#define STM32_QUADSPI1_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 5) |\
640 STM32_DMA_STREAM_ID_MSK(2, 7))
641#define STM32_QUADSPI1_DMA_CHN 0x03050000
642
643/* SDMMC attributes.*/
644#define STM32_HAS_SDMMC1 TRUE
645#define STM32_SDC_SDMMC1_DMA_MSK (STM32_DMA_STREAM_ID_MSK(2, 4) |\
646 STM32_DMA_STREAM_ID_MSK(2, 5))
647#define STM32_SDC_SDMMC1_DMA_CHN 0x00077000
648
649#define STM32_HAS_SDMMC2 FALSE
650
651/* SPI attributes.*/
652#define STM32_HAS_SPI1 TRUE
653#define STM32_SPI1_SUPPORTS_I2S FALSE
654#define STM32_SPI1_RX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 2) |\
655 STM32_DMA_STREAM_ID_MSK(2, 3))
656#define STM32_SPI1_RX_DMA_CHN 0x00000410
657#define STM32_SPI1_TX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 3) |\
658 STM32_DMA_STREAM_ID_MSK(2, 4))
659#define STM32_SPI1_TX_DMA_CHN 0x00004100
660
661#define STM32_HAS_SPI2 TRUE
662#define STM32_SPI2_SUPPORTS_I2S FALSE
663#define STM32_SPI2_RX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 4))
664#define STM32_SPI2_RX_DMA_CHN 0x00001000
665#define STM32_SPI2_TX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 5))
666#define STM32_SPI2_TX_DMA_CHN 0x00010000
667
668#define STM32_HAS_SPI3 TRUE
669#define STM32_SPI3_SUPPORTS_I2S FALSE
670#define STM32_SPI3_RX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(2, 1))
671#define STM32_SPI3_RX_DMA_CHN 0x00000003
672#define STM32_SPI3_TX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(2, 2))
673#define STM32_SPI3_TX_DMA_CHN 0x00000030
674
675#define STM32_HAS_SPI4 FALSE
676#define STM32_HAS_SPI5 FALSE
677#define STM32_HAS_SPI6 FALSE
678
679/* TIM attributes.*/
680#define STM32_TIM_MAX_CHANNELS 6
681
682#define STM32_HAS_TIM1 TRUE
683#define STM32_TIM1_IS_32BITS FALSE
684#define STM32_TIM1_CHANNELS 6
685
686#define STM32_HAS_TIM2 TRUE
687#define STM32_TIM2_IS_32BITS TRUE
688#define STM32_TIM2_CHANNELS 4
689
690#define STM32_HAS_TIM3 TRUE
691#define STM32_TIM3_IS_32BITS FALSE
692#define STM32_TIM3_CHANNELS 4
693
694#define STM32_HAS_TIM6 TRUE
695#define STM32_TIM6_IS_32BITS FALSE
696#define STM32_TIM6_CHANNELS 0
697
698#define STM32_HAS_TIM15 TRUE
699#define STM32_TIM15_IS_32BITS FALSE
700#define STM32_TIM15_CHANNELS 2
701
702#define STM32_HAS_TIM16 TRUE
703#define STM32_TIM16_IS_32BITS FALSE
704#define STM32_TIM16_CHANNELS 2
705
706#define STM32_HAS_TIM4 FALSE
707#define STM32_HAS_TIM5 FALSE
708#define STM32_HAS_TIM7 FALSE
709#define STM32_HAS_TIM8 FALSE
710#define STM32_HAS_TIM9 FALSE
711#define STM32_HAS_TIM10 FALSE
712#define STM32_HAS_TIM11 FALSE
713#define STM32_HAS_TIM12 FALSE
714#define STM32_HAS_TIM13 FALSE
715#define STM32_HAS_TIM14 FALSE
716#define STM32_HAS_TIM17 FALSE
717#define STM32_HAS_TIM18 FALSE
718#define STM32_HAS_TIM19 FALSE
719#define STM32_HAS_TIM20 FALSE
720#define STM32_HAS_TIM21 FALSE
721#define STM32_HAS_TIM22 FALSE
722
723/* USART attributes.*/
724#define STM32_HAS_USART1 TRUE
725#define STM32_USART1_RX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 5) |\
726 STM32_DMA_STREAM_ID_MSK(2, 7))
727#define STM32_USART1_RX_DMA_CHN 0x02020000
728#define STM32_USART1_TX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 4) |\
729 STM32_DMA_STREAM_ID_MSK(2, 6))
730#define STM32_USART1_TX_DMA_CHN 0x00202000
731
732#define STM32_HAS_USART2 TRUE
733#define STM32_USART2_RX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 6))
734#define STM32_USART2_RX_DMA_CHN 0x00200000
735#define STM32_USART2_TX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 7))
736#define STM32_USART2_TX_DMA_CHN 0x02000000
737
738#define STM32_HAS_USART3 TRUE
739#define STM32_USART3_RX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 3))
740#define STM32_USART3_RX_DMA_CHN 0x00000200
741#define STM32_USART3_TX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 2))
742#define STM32_USART3_TX_DMA_CHN 0x00000020
743
744#define STM32_HAS_UART4 TRUE
745#define STM32_UART4_RX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(2, 5))
746#define STM32_UART4_RX_DMA_CHN 0x00020000
747#define STM32_UART4_TX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(2, 3))
748#define STM32_UART4_TX_DMA_CHN 0x00000200
749
750#define STM32_HAS_LPUART1 TRUE
751
752#define STM32_HAS_UART5 FALSE
753#define STM32_HAS_USART6 FALSE
754#define STM32_HAS_UART7 FALSE
755#define STM32_HAS_UART8 FALSE
756
757/* USB attributes.*/
758#define STM32_HAS_USB TRUE
759#define STM32_USB_ACCESS_SCHEME_2x16 TRUE
760#define STM32_USB_PMA_SIZE 1024
761#define STM32_USB_HAS_BCDR TRUE
762
763#define STM32_HAS_OTG1 FALSE
764#define STM32_HAS_OTG2 FALSE
765
766/* IWDG attributes.*/
767#define STM32_HAS_IWDG TRUE
768#define STM32_IWDG_IS_WINDOWED TRUE
769
770/* LTDC attributes.*/
771#define STM32_HAS_LTDC FALSE
772
773/* DMA2D attributes.*/
774#define STM32_HAS_DMA2D FALSE
775
776/* FSMC attributes.*/
777#define STM32_HAS_FSMC TRUE
778
779/* CRC attributes.*/
780#define STM32_HAS_CRC TRUE
781#define STM32_CRC_PROGRAMMABLE TRUE
782
783#endif /* defined(STM32L452xx) */
784
785/*===========================================================================*/
786/* STM32L476xx, STM32L486xx. */
787/*===========================================================================*/
788
789#if defined(STM32L476xx) || defined(STM32L486xx)
790
791/* Clock attributes.*/
792#define STM32_CLOCK_HAS_HSI48 FALSE
793
794/* ADC attributes.*/
795#define STM32_HAS_ADC1 TRUE
796#define STM32_ADC1_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 1) |\
797 STM32_DMA_STREAM_ID_MSK(2, 3))
798#define STM32_ADC1_DMA_CHN 0x00000000
799
800#define STM32_HAS_ADC2 TRUE
801#define STM32_ADC2_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 2) |\
802 STM32_DMA_STREAM_ID_MSK(2, 4))
803#define STM32_ADC2_DMA_CHN 0x00000000
804
805#define STM32_HAS_ADC3 TRUE
806#define STM32_ADC3_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 3) |\
807 STM32_DMA_STREAM_ID_MSK(2, 5))
808#define STM32_ADC3_DMA_CHN 0x00000000
809
810#define STM32_HAS_ADC4 FALSE
811
812/* CAN attributes.*/
813#define STM32_CAN_MAX_FILTERS 14
814#define STM32_HAS_CAN1 TRUE
815#define STM32_HAS_CAN2 FALSE
816#define STM32_HAS_CAN3 FALSE
817
818/* DAC attributes.*/
819#define STM32_HAS_DAC1_CH1 TRUE
820#define STM32_DAC1_CH1_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 3)|\
821 STM32_DMA_STREAM_ID_MSK(2, 4))
822#define STM32_DAC1_CH1_DMA_CHN 0x00003600
823
824#define STM32_HAS_DAC1_CH2 TRUE
825#define STM32_DAC1_CH2_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 4)|\
826 STM32_DMA_STREAM_ID_MSK(2, 5))
827#define STM32_DAC1_CH2_DMA_CHN 0x00035000
828
829#define STM32_HAS_DAC2_CH1 FALSE
830#define STM32_HAS_DAC2_CH2 FALSE
831
832/* DMA attributes.*/
833#define STM32_ADVANCED_DMA TRUE
834#define STM32_DMA_SUPPORTS_DMAMUX FALSE
835#define STM32_DMA_SUPPORTS_CSELR TRUE
836#define STM32_DMA1_NUM_CHANNELS 7
837#define STM32_DMA2_NUM_CHANNELS 7
838
839/* ETH attributes.*/
840#define STM32_HAS_ETH FALSE
841
842/* EXTI attributes.*/
843#define STM32_EXTI_NUM_LINES 40
844#define STM32_EXTI_IMR1_MASK 0xFF820000U
845#define STM32_EXTI_IMR2_MASK 0xFFFFFF87U
846
847/* Flash attributes.*/
848#define STM32_FLASH_NUMBER_OF_BANKS 2
849#if !defined(STM32_FLASH_SECTORS_PER_BANK) || defined(__DOXYGEN__)
850#define STM32_FLASH_SECTORS_PER_BANK 256 /* Maximum, can be redefined.*/
851#endif
852
853/* GPIO attributes.*/
854#define STM32_HAS_GPIOA TRUE
855#define STM32_HAS_GPIOB TRUE
856#define STM32_HAS_GPIOC TRUE
857#define STM32_HAS_GPIOD TRUE
858#define STM32_HAS_GPIOE TRUE
859#define STM32_HAS_GPIOF TRUE
860#define STM32_HAS_GPIOG TRUE
861#define STM32_HAS_GPIOH TRUE
862#define STM32_HAS_GPIOI FALSE
863#define STM32_HAS_GPIOJ FALSE
864#define STM32_HAS_GPIOK FALSE
865#define STM32_GPIO_EN_MASK (RCC_AHB2ENR_GPIOAEN | \
866 RCC_AHB2ENR_GPIOBEN | \
867 RCC_AHB2ENR_GPIOCEN | \
868 RCC_AHB2ENR_GPIODEN | \
869 RCC_AHB2ENR_GPIOEEN | \
870 RCC_AHB2ENR_GPIOFEN | \
871 RCC_AHB2ENR_GPIOGEN | \
872 RCC_AHB2ENR_GPIOHEN)
873
874/* I2C attributes.*/
875#define STM32_HAS_I2C1 TRUE
876#define STM32_I2C1_RX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 7) |\
877 STM32_DMA_STREAM_ID_MSK(2, 6))
878#define STM32_I2C1_RX_DMA_CHN 0x03500000
879#define STM32_I2C1_TX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 6) |\
880 STM32_DMA_STREAM_ID_MSK(2, 7))
881#define STM32_I2C1_TX_DMA_CHN 0x05300000
882
883#define STM32_HAS_I2C2 TRUE
884#define STM32_I2C2_RX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 5))
885#define STM32_I2C2_RX_DMA_CHN 0x00030000
886#define STM32_I2C2_TX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 4))
887#define STM32_I2C2_TX_DMA_CHN 0x00003000
888
889#define STM32_HAS_I2C3 TRUE
890#define STM32_I2C3_RX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 3))
891#define STM32_I2C3_RX_DMA_CHN 0x00000300
892#define STM32_I2C3_TX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 2))
893#define STM32_I2C3_TX_DMA_CHN 0x00000030
894
895#define STM32_HAS_I2C4 FALSE
896
897/* QUADSPI attributes.*/
898#define STM32_HAS_QUADSPI1 TRUE
899#define STM32_QUADSPI1_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 5) |\
900 STM32_DMA_STREAM_ID_MSK(2, 7))
901#define STM32_QUADSPI1_DMA_CHN 0x03050000
902
903/* SDMMC attributes.*/
904#define STM32_HAS_SDMMC1 TRUE
905#define STM32_SDC_SDMMC1_DMA_MSK (STM32_DMA_STREAM_ID_MSK(2, 4) |\
906 STM32_DMA_STREAM_ID_MSK(2, 5))
907#define STM32_SDC_SDMMC1_DMA_CHN 0x00077000
908
909#define STM32_HAS_SDMMC2 FALSE
910
911/* SPI attributes.*/
912#define STM32_HAS_SPI1 TRUE
913#define STM32_SPI1_SUPPORTS_I2S FALSE
914#define STM32_SPI1_RX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 2) |\
915 STM32_DMA_STREAM_ID_MSK(2, 3))
916#define STM32_SPI1_RX_DMA_CHN 0x00000410
917#define STM32_SPI1_TX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 3) |\
918 STM32_DMA_STREAM_ID_MSK(2, 4))
919#define STM32_SPI1_TX_DMA_CHN 0x00004100
920
921#define STM32_HAS_SPI2 TRUE
922#define STM32_SPI2_SUPPORTS_I2S FALSE
923#define STM32_SPI2_RX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 4))
924#define STM32_SPI2_RX_DMA_CHN 0x00001000
925#define STM32_SPI2_TX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 5))
926#define STM32_SPI2_TX_DMA_CHN 0x00010000
927
928#define STM32_HAS_SPI3 TRUE
929#define STM32_SPI3_SUPPORTS_I2S FALSE
930#define STM32_SPI3_RX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(2, 1))
931#define STM32_SPI3_RX_DMA_CHN 0x00000003
932#define STM32_SPI3_TX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(2, 2))
933#define STM32_SPI3_TX_DMA_CHN 0x00000030
934
935#define STM32_HAS_SPI4 FALSE
936#define STM32_HAS_SPI5 FALSE
937#define STM32_HAS_SPI6 FALSE
938
939/* TIM attributes.*/
940#define STM32_TIM_MAX_CHANNELS 6
941
942#define STM32_HAS_TIM1 TRUE
943#define STM32_TIM1_IS_32BITS FALSE
944#define STM32_TIM1_CHANNELS 6
945
946#define STM32_HAS_TIM2 TRUE
947#define STM32_TIM2_IS_32BITS TRUE
948#define STM32_TIM2_CHANNELS 4
949
950#define STM32_HAS_TIM3 TRUE
951#define STM32_TIM3_IS_32BITS FALSE
952#define STM32_TIM3_CHANNELS 4
953
954#define STM32_HAS_TIM4 TRUE
955#define STM32_TIM4_IS_32BITS FALSE
956#define STM32_TIM4_CHANNELS 4
957
958#define STM32_HAS_TIM5 TRUE
959#define STM32_TIM5_IS_32BITS TRUE
960#define STM32_TIM5_CHANNELS 4
961
962#define STM32_HAS_TIM6 TRUE
963#define STM32_TIM6_IS_32BITS FALSE
964#define STM32_TIM6_CHANNELS 0
965
966#define STM32_HAS_TIM7 TRUE
967#define STM32_TIM7_IS_32BITS FALSE
968#define STM32_TIM7_CHANNELS 0
969
970#define STM32_HAS_TIM8 TRUE
971#define STM32_TIM8_IS_32BITS FALSE
972#define STM32_TIM8_CHANNELS 6
973
974#define STM32_HAS_TIM15 TRUE
975#define STM32_TIM15_IS_32BITS FALSE
976#define STM32_TIM15_CHANNELS 2
977
978#define STM32_HAS_TIM16 TRUE
979#define STM32_TIM16_IS_32BITS FALSE
980#define STM32_TIM16_CHANNELS 2
981
982#define STM32_HAS_TIM17 TRUE
983#define STM32_TIM17_IS_32BITS FALSE
984#define STM32_TIM17_CHANNELS 2
985
986#define STM32_HAS_TIM9 FALSE
987#define STM32_HAS_TIM10 FALSE
988#define STM32_HAS_TIM11 FALSE
989#define STM32_HAS_TIM12 FALSE
990#define STM32_HAS_TIM13 FALSE
991#define STM32_HAS_TIM14 FALSE
992#define STM32_HAS_TIM18 FALSE
993#define STM32_HAS_TIM19 FALSE
994#define STM32_HAS_TIM20 FALSE
995#define STM32_HAS_TIM21 FALSE
996#define STM32_HAS_TIM22 FALSE
997
998/* USART attributes.*/
999#define STM32_HAS_USART1 TRUE
1000#define STM32_USART1_RX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 5) |\
1001 STM32_DMA_STREAM_ID_MSK(2, 7))
1002#define STM32_USART1_RX_DMA_CHN 0x02020000
1003#define STM32_USART1_TX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 4) |\
1004 STM32_DMA_STREAM_ID_MSK(2, 6))
1005#define STM32_USART1_TX_DMA_CHN 0x00202000
1006
1007#define STM32_HAS_USART2 TRUE
1008#define STM32_USART2_RX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 6))
1009#define STM32_USART2_RX_DMA_CHN 0x00200000
1010#define STM32_USART2_TX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 7))
1011#define STM32_USART2_TX_DMA_CHN 0x02000000
1012
1013#define STM32_HAS_USART3 TRUE
1014#define STM32_USART3_RX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 3))
1015#define STM32_USART3_RX_DMA_CHN 0x00000200
1016#define STM32_USART3_TX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 2))
1017#define STM32_USART3_TX_DMA_CHN 0x00000020
1018
1019#define STM32_HAS_UART4 TRUE
1020#define STM32_UART4_RX_DMA_MSK STM32_DMA_STREAM_ID_MSK(2, 5)
1021#define STM32_UART4_RX_DMA_CHN 0x00020000
1022#define STM32_UART4_TX_DMA_MSK STM32_DMA_STREAM_ID_MSK(2, 3)
1023#define STM32_UART4_TX_DMA_CHN 0x00000200
1024
1025#define STM32_HAS_UART5 TRUE
1026#define STM32_UART5_RX_DMA_MSK STM32_DMA_STREAM_ID_MSK(2, 2)
1027#define STM32_UART5_RX_DMA_CHN 0x00000020
1028#define STM32_UART5_TX_DMA_MSK STM32_DMA_STREAM_ID_MSK(2, 1)
1029#define STM32_UART5_TX_DMA_CHN 0x00000002
1030
1031#define STM32_HAS_LPUART1 TRUE
1032
1033#define STM32_HAS_USART6 FALSE
1034#define STM32_HAS_UART7 FALSE
1035#define STM32_HAS_UART8 FALSE
1036
1037/* USB attributes.*/
1038#define STM32_OTG_SEQUENCE_WORKAROUND
1039#define STM32_OTG_STEPPING 2
1040#define STM32_HAS_OTG1 TRUE
1041#define STM32_OTG1_ENDPOINTS 5
1042
1043#define STM32_HAS_OTG2 FALSE
1044#define STM32_HAS_USB FALSE
1045
1046/* IWDG attributes.*/
1047#define STM32_HAS_IWDG TRUE
1048#define STM32_IWDG_IS_WINDOWED TRUE
1049
1050/* LTDC attributes.*/
1051#define STM32_HAS_LTDC FALSE
1052
1053/* DMA2D attributes.*/
1054#define STM32_HAS_DMA2D FALSE
1055
1056/* FSMC attributes.*/
1057#define STM32_HAS_FSMC TRUE
1058
1059/* CRC attributes.*/
1060#define STM32_HAS_CRC TRUE
1061#define STM32_CRC_PROGRAMMABLE TRUE
1062
1063#endif /* defined(STM32L476xx) */
1064
1065/*===========================================================================*/
1066/* STM32L496xx, STM32L4A6xx. */
1067/*===========================================================================*/
1068
1069#if defined(STM32L496xx) || defined(STM32L4A6xx)
1070
1071/* Clock attributes.*/
1072#define STM32_CLOCK_HAS_HSI48 FALSE
1073
1074/* ADC attributes.*/
1075#define STM32_HAS_ADC1 TRUE
1076#define STM32_ADC1_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 1) |\
1077 STM32_DMA_STREAM_ID_MSK(2, 3))
1078#define STM32_ADC1_DMA_CHN 0x00000000
1079
1080#define STM32_HAS_ADC2 TRUE
1081#define STM32_ADC2_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 2) |\
1082 STM32_DMA_STREAM_ID_MSK(2, 4))
1083#define STM32_ADC2_DMA_CHN 0x00000000
1084
1085#define STM32_HAS_ADC3 TRUE
1086#define STM32_ADC3_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 3) |\
1087 STM32_DMA_STREAM_ID_MSK(2, 5))
1088#define STM32_ADC3_DMA_CHN 0x00000000
1089
1090#define STM32_HAS_ADC4 FALSE
1091
1092/* CAN attributes.*/
1093#define STM32_CAN_MAX_FILTERS 14
1094#define STM32_HAS_CAN1 TRUE
1095#define STM32_HAS_CAN2 TRUE
1096#define STM32_HAS_CAN3 FALSE
1097
1098/* DAC attributes.*/
1099#define STM32_HAS_DAC1_CH1 TRUE
1100#define STM32_DAC1_CH1_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 3)|\
1101 STM32_DMA_STREAM_ID_MSK(2, 4))
1102#define STM32_DAC1_CH1_DMA_CHN 0x00003600
1103
1104#define STM32_HAS_DAC1_CH2 TRUE
1105#define STM32_DAC1_CH2_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 4)|\
1106 STM32_DMA_STREAM_ID_MSK(2, 5))
1107#define STM32_DAC1_CH2_DMA_CHN 0x00035000
1108
1109#define STM32_HAS_DAC2_CH1 FALSE
1110#define STM32_HAS_DAC2_CH2 FALSE
1111
1112/* DMA attributes.*/
1113#define STM32_ADVANCED_DMA TRUE
1114#define STM32_DMA_SUPPORTS_DMAMUX FALSE
1115#define STM32_DMA_SUPPORTS_CSELR TRUE
1116#define STM32_DMA1_NUM_CHANNELS 7
1117#define STM32_DMA2_NUM_CHANNELS 7
1118
1119/* ETH attributes.*/
1120#define STM32_HAS_ETH FALSE
1121
1122/* EXTI attributes.*/
1123#define STM32_EXTI_NUM_LINES 40
1124#define STM32_EXTI_IMR1_MASK 0xFF820000U
1125#define STM32_EXTI_IMR2_MASK 0xFFFFFF87U
1126
1127/* Flash attributes.*/
1128#define STM32_FLASH_NUMBER_OF_BANKS 2
1129#if !defined(STM32_FLASH_SECTORS_PER_BANK) || defined(__DOXYGEN__)
1130#define STM32_FLASH_SECTORS_PER_BANK 256 /* Maximum, can be redefined.*/
1131#endif
1132
1133/* GPIO attributes.*/
1134#define STM32_HAS_GPIOA TRUE
1135#define STM32_HAS_GPIOB TRUE
1136#define STM32_HAS_GPIOC TRUE
1137#define STM32_HAS_GPIOD TRUE
1138#define STM32_HAS_GPIOE TRUE
1139#define STM32_HAS_GPIOF TRUE
1140#define STM32_HAS_GPIOG TRUE
1141#define STM32_HAS_GPIOH TRUE
1142#define STM32_HAS_GPIOI TRUE
1143#define STM32_HAS_GPIOJ FALSE
1144#define STM32_HAS_GPIOK FALSE
1145#define STM32_GPIO_EN_MASK (RCC_AHB2ENR_GPIOAEN | \
1146 RCC_AHB2ENR_GPIOBEN | \
1147 RCC_AHB2ENR_GPIOCEN | \
1148 RCC_AHB2ENR_GPIODEN | \
1149 RCC_AHB2ENR_GPIOEEN | \
1150 RCC_AHB2ENR_GPIOFEN | \
1151 RCC_AHB2ENR_GPIOGEN | \
1152 RCC_AHB2ENR_GPIOHEN)
1153
1154/* I2C attributes.*/
1155#define STM32_HAS_I2C1 TRUE
1156#define STM32_I2C1_RX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 7) |\
1157 STM32_DMA_STREAM_ID_MSK(2, 6))
1158#define STM32_I2C1_RX_DMA_CHN 0x03500000
1159#define STM32_I2C1_TX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 6) |\
1160 STM32_DMA_STREAM_ID_MSK(2, 7))
1161#define STM32_I2C1_TX_DMA_CHN 0x05300000
1162
1163#define STM32_HAS_I2C2 TRUE
1164#define STM32_I2C2_RX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 5))
1165#define STM32_I2C2_RX_DMA_CHN 0x00030000
1166#define STM32_I2C2_TX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 4))
1167#define STM32_I2C2_TX_DMA_CHN 0x00003000
1168
1169#define STM32_HAS_I2C3 TRUE
1170#define STM32_I2C3_RX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 3))
1171#define STM32_I2C3_RX_DMA_CHN 0x00000300
1172#define STM32_I2C3_TX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 2))
1173#define STM32_I2C3_TX_DMA_CHN 0x00000030
1174
1175#define STM32_HAS_I2C4 TRUE
1176#define STM32_I2C4_RX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(2, 2))
1177#define STM32_I2C4_RX_DMA_CHN 0x00000000
1178#define STM32_I2C4_TX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(2, 1))
1179#define STM32_I2C4_TX_DMA_CHN 0x00000000
1180
1181/* QUADSPI attributes.*/
1182#define STM32_HAS_QUADSPI1 TRUE
1183#define STM32_QUADSPI1_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 5) |\
1184 STM32_DMA_STREAM_ID_MSK(2, 7))
1185#define STM32_QUADSPI1_DMA_CHN 0x03050000
1186
1187/* SDMMC attributes.*/
1188#define STM32_HAS_SDMMC1 TRUE
1189#define STM32_SDC_SDMMC1_DMA_MSK (STM32_DMA_STREAM_ID_MSK(2, 4) |\
1190 STM32_DMA_STREAM_ID_MSK(2, 5))
1191#define STM32_SDC_SDMMC1_DMA_CHN 0x00077000
1192
1193#define STM32_HAS_SDMMC2 FALSE
1194
1195/* SPI attributes.*/
1196#define STM32_HAS_SPI1 TRUE
1197#define STM32_SPI1_SUPPORTS_I2S FALSE
1198#define STM32_SPI1_RX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 2) |\
1199 STM32_DMA_STREAM_ID_MSK(2, 3))
1200#define STM32_SPI1_RX_DMA_CHN 0x00000410
1201#define STM32_SPI1_TX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 3) |\
1202 STM32_DMA_STREAM_ID_MSK(2, 4))
1203#define STM32_SPI1_TX_DMA_CHN 0x00004100
1204
1205#define STM32_HAS_SPI2 TRUE
1206#define STM32_SPI2_SUPPORTS_I2S FALSE
1207#define STM32_SPI2_RX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 4))
1208#define STM32_SPI2_RX_DMA_CHN 0x00001000
1209#define STM32_SPI2_TX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 5))
1210#define STM32_SPI2_TX_DMA_CHN 0x00010000
1211
1212#define STM32_HAS_SPI3 TRUE
1213#define STM32_SPI3_SUPPORTS_I2S FALSE
1214#define STM32_SPI3_RX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(2, 1))
1215#define STM32_SPI3_RX_DMA_CHN 0x00000003
1216#define STM32_SPI3_TX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(2, 2))
1217#define STM32_SPI3_TX_DMA_CHN 0x00000030
1218
1219#define STM32_HAS_SPI4 FALSE
1220#define STM32_HAS_SPI5 FALSE
1221#define STM32_HAS_SPI6 FALSE
1222
1223/* TIM attributes.*/
1224#define STM32_TIM_MAX_CHANNELS 6
1225
1226#define STM32_HAS_TIM1 TRUE
1227#define STM32_TIM1_IS_32BITS FALSE
1228#define STM32_TIM1_CHANNELS 6
1229
1230#define STM32_HAS_TIM2 TRUE
1231#define STM32_TIM2_IS_32BITS TRUE
1232#define STM32_TIM2_CHANNELS 4
1233
1234#define STM32_HAS_TIM3 TRUE
1235#define STM32_TIM3_IS_32BITS FALSE
1236#define STM32_TIM3_CHANNELS 4
1237
1238#define STM32_HAS_TIM4 TRUE
1239#define STM32_TIM4_IS_32BITS FALSE
1240#define STM32_TIM4_CHANNELS 4
1241
1242#define STM32_HAS_TIM5 TRUE
1243#define STM32_TIM5_IS_32BITS TRUE
1244#define STM32_TIM5_CHANNELS 4
1245
1246#define STM32_HAS_TIM6 TRUE
1247#define STM32_TIM6_IS_32BITS FALSE
1248#define STM32_TIM6_CHANNELS 0
1249
1250#define STM32_HAS_TIM7 TRUE
1251#define STM32_TIM7_IS_32BITS FALSE
1252#define STM32_TIM7_CHANNELS 0
1253
1254#define STM32_HAS_TIM8 TRUE
1255#define STM32_TIM8_IS_32BITS FALSE
1256#define STM32_TIM8_CHANNELS 6
1257
1258#define STM32_HAS_TIM15 TRUE
1259#define STM32_TIM15_IS_32BITS FALSE
1260
1261#define STM32_HAS_TIM16 TRUE
1262#define STM32_TIM16_IS_32BITS FALSE
1263
1264#define STM32_HAS_TIM17 TRUE
1265#define STM32_TIM17_IS_32BITS FALSE
1266
1267#define STM32_HAS_TIM9 FALSE
1268#define STM32_HAS_TIM10 FALSE
1269#define STM32_HAS_TIM11 FALSE
1270#define STM32_HAS_TIM12 FALSE
1271#define STM32_HAS_TIM13 FALSE
1272#define STM32_HAS_TIM14 FALSE
1273#define STM32_HAS_TIM18 FALSE
1274#define STM32_HAS_TIM19 FALSE
1275#define STM32_HAS_TIM20 FALSE
1276#define STM32_HAS_TIM21 FALSE
1277#define STM32_HAS_TIM22 FALSE
1278
1279/* USART attributes.*/
1280#define STM32_HAS_USART1 TRUE
1281#define STM32_USART1_RX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 5) |\
1282 STM32_DMA_STREAM_ID_MSK(2, 7))
1283#define STM32_USART1_RX_DMA_CHN 0x02020000
1284#define STM32_USART1_TX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 4) |\
1285 STM32_DMA_STREAM_ID_MSK(2, 6))
1286#define STM32_USART1_TX_DMA_CHN 0x00202000
1287
1288#define STM32_HAS_USART2 TRUE
1289#define STM32_USART2_RX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 6))
1290#define STM32_USART2_RX_DMA_CHN 0x00200000
1291#define STM32_USART2_TX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 7))
1292#define STM32_USART2_TX_DMA_CHN 0x02000000
1293
1294#define STM32_HAS_USART3 TRUE
1295#define STM32_USART3_RX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 3))
1296#define STM32_USART3_RX_DMA_CHN 0x00000200
1297#define STM32_USART3_TX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 2))
1298#define STM32_USART3_TX_DMA_CHN 0x00000020
1299
1300#define STM32_HAS_UART4 TRUE
1301#define STM32_UART4_RX_DMA_MSK STM32_DMA_STREAM_ID_MSK(2, 5)
1302#define STM32_UART4_RX_DMA_CHN 0x00020000
1303#define STM32_UART4_TX_DMA_MSK STM32_DMA_STREAM_ID_MSK(2, 3)
1304#define STM32_UART4_TX_DMA_CHN 0x00000200
1305
1306#define STM32_HAS_UART5 TRUE
1307#define STM32_UART5_RX_DMA_MSK STM32_DMA_STREAM_ID_MSK(2, 2)
1308#define STM32_UART5_RX_DMA_CHN 0x00000020
1309#define STM32_UART5_TX_DMA_MSK STM32_DMA_STREAM_ID_MSK(2, 1)
1310#define STM32_UART5_TX_DMA_CHN 0x00000002
1311
1312#define STM32_HAS_LPUART1 TRUE
1313
1314#define STM32_HAS_USART6 FALSE
1315#define STM32_HAS_UART7 FALSE
1316#define STM32_HAS_UART8 FALSE
1317
1318/* USB attributes.*/
1319#define STM32_OTG_STEPPING 2
1320#define STM32_HAS_OTG1 TRUE
1321#define STM32_OTG1_ENDPOINTS 5
1322
1323#define STM32_HAS_OTG2 FALSE
1324#define STM32_HAS_USB FALSE
1325
1326/* IWDG attributes.*/
1327#define STM32_HAS_IWDG TRUE
1328#define STM32_IWDG_IS_WINDOWED TRUE
1329
1330/* LTDC attributes.*/
1331#define STM32_HAS_LTDC FALSE
1332
1333/* DMA2D attributes.*/
1334#define STM32_HAS_DMA2D TRUE
1335
1336/* FSMC attributes.*/
1337#define STM32_HAS_FSMC TRUE
1338
1339/* CRC attributes.*/
1340#define STM32_HAS_CRC TRUE
1341#define STM32_CRC_PROGRAMMABLE TRUE
1342
1343#endif /* defined(STM32L496xx) */
1344
1345/** @} */
1346
1347#endif /* STM32_REGISTRY_H */
1348
1349/** @} */