39#ifndef LIBOPENCM3_RCC_H
40#define LIBOPENCM3_RCC_H
48#define RCC_CR MMIO32(RCC_BASE + 0x00)
49#define RCC_ICSCR MMIO32(RCC_BASE + 0x04)
51#define RCC_CFGR MMIO32(RCC_BASE + 0x08)
53#define RCC_PLLCFGR MMIO32(RCC_BASE + 0x0c)
54#define RCC_PLLSAI1_CFGR MMIO32(RCC_BASE + 0x10)
55#define RCC_PLLSAI2_CFGR MMIO32(RCC_BASE + 0x14)
57#define RCC_CIER MMIO32(RCC_BASE + 0x18)
59#define RCC_CIFR MMIO32(RCC_BASE + 0x1c)
61#define RCC_CICR MMIO32(RCC_BASE + 0x20)
62#define RCC_AHB1RSTR_OFFSET 0x28
63#define RCC_AHB1RSTR MMIO32(RCC_BASE + RCC_AHB1RSTR_OFFSET)
64#define RCC_AHB2RSTR_OFFSET 0x2c
65#define RCC_AHB2RSTR MMIO32(RCC_BASE + RCC_AHB2RSTR_OFFSET)
66#define RCC_AHB3RSTR_OFFSET 0x30
67#define RCC_AHB3RSTR MMIO32(RCC_BASE + RCC_AHB3RSTR_OFFSET)
68#define RCC_APB1RSTR1_OFFSET 0x38
69#define RCC_APB1RSTR1 MMIO32(RCC_BASE + RCC_APB1RSTR1_OFFSET)
70#define RCC_APB1RSTR2_OFFSET 0x3c
71#define RCC_APB1RSTR2 MMIO32(RCC_BASE + RCC_APB1RSTR2_OFFSET)
72#define RCC_APB2RSTR_OFFSET 0x40
73#define RCC_APB2RSTR MMIO32(RCC_BASE + RCC_APB2RSTR_OFFSET)
74#define RCC_AHB1ENR_OFFSET 0x48
75#define RCC_AHB1ENR MMIO32(RCC_BASE + RCC_AHB1ENR_OFFSET)
76#define RCC_AHB2ENR_OFFSET 0x4c
77#define RCC_AHB2ENR MMIO32(RCC_BASE + RCC_AHB2ENR_OFFSET)
78#define RCC_AHB3ENR_OFFSET 0x50
79#define RCC_AHB3ENR MMIO32(RCC_BASE + RCC_AHB3ENR_OFFSET)
80#define RCC_APB1ENR1_OFFSET 0x58
81#define RCC_APB1ENR1 MMIO32(RCC_BASE + RCC_APB1ENR1_OFFSET)
82#define RCC_APB1ENR2_OFFSET 0x5c
83#define RCC_APB1ENR2 MMIO32(RCC_BASE + RCC_APB1ENR2_OFFSET)
84#define RCC_APB2ENR_OFFSET 0x60
85#define RCC_APB2ENR MMIO32(RCC_BASE + RCC_APB2ENR_OFFSET)
86#define RCC_AHB1SMENR_OFFSET 0x68
87#define RCC_AHB1SMENR MMIO32(RCC_BASE + RCC_AHB1SMENR_OFFSET)
88#define RCC_AHB2SMENR_OFFSET 0x6c
89#define RCC_AHB2SMENR MMIO32(RCC_BASE + RCC_AHB2SMENR_OFFSET)
90#define RCC_AHB3SMENR_OFFSET 0x70
91#define RCC_AHB3SMENR MMIO32(RCC_BASE + RCC_AHB3SMENR_OFFSET)
92#define RCC_APB1SMENR1_OFFSET 0x78
93#define RCC_APB1SMENR1 MMIO32(RCC_BASE + RCC_APB1SMENR1_OFFSET)
94#define RCC_APB1SMENR2_OFFSET 0x7c
95#define RCC_APB1SMENR2 MMIO32(RCC_BASE + RCC_APB1SMENR2_OFFSET)
96#define RCC_APB2SMENR_OFFSET 0x80
97#define RCC_APB2SMENR MMIO32(RCC_BASE + RCC_APB2SMENR_OFFSET)
98#define RCC_CCIPR MMIO32(RCC_BASE + 0x88)
100#define RCC_BDCR MMIO32(RCC_BASE + 0x90)
102#define RCC_CSR MMIO32(RCC_BASE + 0x94)
103#define RCC_CRRCR MMIO32(RCC_BASE + 0x98)
104#define RCC_CCIPR2 MMIO32(RCC_BASE + 0x9C)
111#define RCC_CR_PLLSAI2RDY (1 << 29)
112#define RCC_CR_PLLSAI2ON (1 << 28)
113#define RCC_CR_PLLSAI1RDY (1 << 27)
114#define RCC_CR_PLLSAI1ON (1 << 26)
115#define RCC_CR_PLLRDY (1 << 25)
116#define RCC_CR_PLLON (1 << 24)
117#define RCC_CR_CSSON (1 << 19)
118#define RCC_CR_HSEBYP (1 << 18)
119#define RCC_CR_HSERDY (1 << 17)
120#define RCC_CR_HSEON (1 << 16)
121#define RCC_CR_HSIASFS (1 << 11)
122#define RCC_CR_HSIRDY (1 << 10)
123#define RCC_CR_HSIKERON (1 << 9)
124#define RCC_CR_HSION (1 << 8)
134#define RCC_CR_MSIRANGE_SHIFT 4
135#define RCC_CR_MSIRANGE_MASK 0xf
136#define RCC_CR_MSIRANGE_100KHZ 0
137#define RCC_CR_MSIRANGE_200KHZ 1
138#define RCC_CR_MSIRANGE_400KHZ 2
139#define RCC_CR_MSIRANGE_800KHZ 3
140#define RCC_CR_MSIRANGE_1MHZ 4
141#define RCC_CR_MSIRANGE_2MHZ 5
142#define RCC_CR_MSIRANGE_4MHZ 6
143#define RCC_CR_MSIRANGE_8MHZ 7
144#define RCC_CR_MSIRANGE_16MHZ 8
145#define RCC_CR_MSIRANGE_24MHZ 9
146#define RCC_CR_MSIRANGE_32MHZ 10
147#define RCC_CR_MSIRANGE_48MHZ 11
149#define RCC_CR_MSIRGSEL (1 << 3)
150#define RCC_CR_MSIPLLEN (1 << 2)
151#define RCC_CR_MSIRDY (1 << 1)
152#define RCC_CR_MSION (1 << 0)
156#define RCC_CRRCR_HSI48ON (1 << 0)
157#define RCC_CRRCR_HSI48RDY (1 << 1)
161#define RCC_ICSCR_HSITRIM_SHIFT 24
162#define RCC_ICSCR_HSITRIM_MASK 0x1f
163#define RCC_ICSCR_HSICAL_SHIFT 16
164#define RCC_ICSCR_HSICAL_MASK 0xff
166#define RCC_ICSCR_MSITRIM_SHIFT 8
167#define RCC_ICSCR_MSITRIM_MASK 0xff
168#define RCC_ICSCR_MSICAL_SHIFT 0
169#define RCC_ICSCR_MSICAL_MASK 0xff
174#define RCC_CFGR_MCOPRE_DIV1 0
175#define RCC_CFGR_MCOPRE_DIV2 1
176#define RCC_CFGR_MCOPRE_DIV4 2
177#define RCC_CFGR_MCOPRE_DIV8 3
178#define RCC_CFGR_MCOPRE_DIV16 4
179#define RCC_CFGR_MCOPRE_SHIFT 28
180#define RCC_CFGR_MCOPRE_MASK 0x7
183#define RCC_CFGR_MCO_NOCLK 0x0
184#define RCC_CFGR_MCO_SYSCLK 0x1
185#define RCC_CFGR_MCO_MSI 0x2
186#define RCC_CFGR_MCO_HSI16 0x3
187#define RCC_CFGR_MCO_HSE 0x4
188#define RCC_CFGR_MCO_PLL 0x5
189#define RCC_CFGR_MCO_LSI 0x6
190#define RCC_CFGR_MCO_LSE 0x7
191#define RCC_CFGR_MCO_HSI48 0x8
192#define RCC_CFGR_MCO_SHIFT 24
193#define RCC_CFGR_MCO_MASK 0xf
196#define RCC_CFGR_STOPWUCK_MSI (0 << 15)
197#define RCC_CFGR_STOPWUCK_HSI16 (1 << 15)
199#define RCC_CFGR_PPRE1_SHIFT 8
200#define RCC_CFGR_PPRE1_MASK 0x7
201#define RCC_CFGR_PPRE2_SHIFT 11
202#define RCC_CFGR_PPRE2_MASK 0x7
207#define RCC_CFGR_PPRE_NODIV 0x0
208#define RCC_CFGR_PPRE_DIV2 0x4
209#define RCC_CFGR_PPRE_DIV4 0x5
210#define RCC_CFGR_PPRE_DIV8 0x6
211#define RCC_CFGR_PPRE_DIV16 0x7
214#define RCC_CFGR_HPRE_SHIFT 4
215#define RCC_CFGR_HPRE_MASK 0xf
218#define RCC_CFGR_HPRE_NODIV 0x0
219#define RCC_CFGR_HPRE_DIV2 (0x8 + 0)
220#define RCC_CFGR_HPRE_DIV4 (0x8 + 1)
221#define RCC_CFGR_HPRE_DIV8 (0x8 + 2)
222#define RCC_CFGR_HPRE_DIV16 (0x8 + 3)
223#define RCC_CFGR_HPRE_DIV64 (0x8 + 4)
224#define RCC_CFGR_HPRE_DIV128 (0x8 + 5)
225#define RCC_CFGR_HPRE_DIV256 (0x8 + 6)
226#define RCC_CFGR_HPRE_DIV512 (0x8 + 7)
230#define RCC_CFGR_SWS_MSI 0x0
231#define RCC_CFGR_SWS_HSI16 0x1
232#define RCC_CFGR_SWS_HSE 0x2
233#define RCC_CFGR_SWS_PLL 0x3
234#define RCC_CFGR_SWS_MASK 0x3
235#define RCC_CFGR_SWS_SHIFT 2
238#define RCC_CFGR_SW_MSI 0x0
239#define RCC_CFGR_SW_HSI16 0x1
240#define RCC_CFGR_SW_HSE 0x2
241#define RCC_CFGR_SW_PLL 0x3
242#define RCC_CFGR_SW_MASK 0x3
243#define RCC_CFGR_SW_SHIFT 0
246#define RCC_PLLCFGR_PLLR_SHIFT 25
247#define RCC_PLLCFGR_PLLR_MASK 0x3
248#define RCC_PLLCFGR_PLLR_DIV2 0
249#define RCC_PLLCFGR_PLLR_DIV4 1
250#define RCC_PLLCFGR_PLLR_DIV6 2
251#define RCC_PLLCFGR_PLLR_DIV8 3
252#define RCC_PLLCFGR_PLLREN (1<<24)
254#define RCC_PLLCFGR_PLLQ_SHIFT 21
255#define RCC_PLLCFGR_PLLQ_MASK 0x3
256#define RCC_PLLCFGR_PLLQ_DIV2 0
257#define RCC_PLLCFGR_PLLQ_DIV4 1
258#define RCC_PLLCFGR_PLLQ_DIV6 2
259#define RCC_PLLCFGR_PLLQ_DIV8 3
260#define RCC_PLLCFGR_PLLQEN (1 << 20)
263#define RCC_PLLCFGR_PLLP (1 << 17)
264#define RCC_PLLCFGR_PLLP_DIV7 0
265#define RCC_PLLCFGR_PLLP_DIV17 RCC_PLLCFGR_PLLP
266#define RCC_PLLPEN (1 << 16)
272#define RCC_PLLCFGR_PLLN_SHIFT 0x8
273#define RCC_PLLCFGR_PLLN_MASK 0x7f
280#define RCC_PLLCFGR_PLLM_SHIFT 0x4
281#define RCC_PLLCFGR_PLLM_MASK 0x7
282#define RCC_PLLCFGR_PLLM(x) ((x)-1)
285#define RCC_PLLCFGR_PLLSRC_SHIFT 0
286#define RCC_PLLCFGR_PLLSRC_MASK 0x3
287#define RCC_PLLCFGR_PLLSRC_NONE 0
288#define RCC_PLLCFGR_PLLSRC_MSI 1
289#define RCC_PLLCFGR_PLLSRC_HSI16 2
290#define RCC_PLLCFGR_PLLSRC_HSE 3
299#define RCC_CIER_HSI48RDYIE (1 << 10)
300#define RCC_CIER_LSE_CSSIE (1 << 9)
302#define RCC_CIER_PLLSAI2RDYIE (1 << 7)
303#define RCC_CIER_PLLSAI1RDYIE (1 << 6)
304#define RCC_CIER_PLLRDYIE (1 << 5)
305#define RCC_CIER_HSERDYIE (1 << 4)
306#define RCC_CIER_HSIRDYIE (1 << 3)
307#define RCC_CIER_MSIRDYIE (1 << 2)
308#define RCC_CIER_LSERDYIE (1 << 1)
309#define RCC_CIER_LSIRDYIE (1 << 0)
313#define RCC_CIFR_HSI48RDYF (1 << 10)
314#define RCC_CIFR_LSECSSF (1 << 9)
315#define RCC_CIFR_CSSF (1 << 8)
316#define RCC_CIFR_PLLSAI2RDYF (1 << 7)
317#define RCC_CIFR_PLLSAI1RDYF (1 << 6)
318#define RCC_CIFR_PLLRDYF (1 << 5)
319#define RCC_CIFR_HSERDYF (1 << 4)
320#define RCC_CIFR_HSIRDYF (1 << 3)
321#define RCC_CIFR_MSIRDYF (1 << 2)
322#define RCC_CIFR_LSERDYF (1 << 1)
323#define RCC_CIFR_LSIRDYF (1 << 0)
327#define RCC_CICR_HSI48RDYC (1 << 10)
328#define RCC_CICR_LSECSSC (1 << 9)
329#define RCC_CICR_CSSC (1 << 8)
330#define RCC_CICR_PLLSAI2RDYC (1 << 7)
331#define RCC_CICR_PLLSAI1RDYC (1 << 6)
332#define RCC_CICR_PLLRDYC (1 << 5)
333#define RCC_CICR_HSERDYC (1 << 4)
334#define RCC_CICR_HSIRDYC (1 << 3)
335#define RCC_CICR_MSIRDYC (1 << 2)
336#define RCC_CICR_LSERDYC (1 << 1)
337#define RCC_CICR_LSIRDYC (1 << 0)
343#define RCC_AHB1RSTR_TSCRST (1 << 16)
344#define RCC_AHB1RSTR_CRCRST (1 << 12)
345#define RCC_AHB1RSTR_FLASHRST (1 << 8)
346#define RCC_AHB1RSTR_DMA2RST (1 << 1)
347#define RCC_AHB1RSTR_DMA1RST (1 << 0)
352#define RCC_AHB2RSTR_RNGRST (1 << 18)
353#define RCC_AHB2RSTR_AESRST (1 << 16)
354#define RCC_AHB2RSTR_ADCRST (1 << 13)
355#define RCC_AHB2RSTR_OTGFSRST (1 << 12)
356#define RCC_AHB2RSTR_GPIOHRST (1 << 7)
357#define RCC_AHB2RSTR_GPIOGRST (1 << 6)
358#define RCC_AHB2RSTR_GPIOFRST (1 << 5)
359#define RCC_AHB2RSTR_GPIOERST (1 << 4)
360#define RCC_AHB2RSTR_GPIODRST (1 << 3)
361#define RCC_AHB2RSTR_GPIOCRST (1 << 2)
362#define RCC_AHB2RSTR_GPIOBRST (1 << 1)
363#define RCC_AHB2RSTR_GPIOARST (1 << 0)
369#define RCC_AHB3RSTR_QSPIRST (1 << 8)
370#define RCC_AHB3RSTR_FMCRST (1 << 0)
378#define RCC_APB1RSTR1_LPTIM1RST (1 << 31)
379#define RCC_APB1RSTR1_OPAMPRST (1 << 30)
380#define RCC_APB1RSTR1_DAC1RST (1 << 29)
381#define RCC_APB1RSTR1_PWRRST (1 << 28)
382#define RCC_APB1RSTR1_CAN2RST (1 << 26)
383#define RCC_APB1RSTR1_CAN1RST (1 << 25)
384#define RCC_APB1RSTR1_I2C3RST (1 << 23)
385#define RCC_APB1RSTR1_I2C2RST (1 << 22)
386#define RCC_APB1RSTR1_I2C1RST (1 << 21)
387#define RCC_APB1RSTR1_UART5RST (1 << 20)
388#define RCC_APB1RSTR1_UART4RST (1 << 19)
389#define RCC_APB1RSTR1_USART3RST (1 << 18)
390#define RCC_APB1RSTR1_USART2RST (1 << 17)
391#define RCC_APB1RSTR1_SPI3RST (1 << 15)
392#define RCC_APB1RSTR1_SPI2RST (1 << 14)
393#define RCC_APB1RSTR1_LCDRST (1 << 9)
394#define RCC_APB1RSTR1_TIM7RST (1 << 5)
395#define RCC_APB1RSTR1_TIM6RST (1 << 4)
396#define RCC_APB1RSTR1_TIM5RST (1 << 3)
397#define RCC_APB1RSTR1_TIM4RST (1 << 2)
398#define RCC_APB1RSTR1_TIM3RST (1 << 1)
399#define RCC_APB1RSTR1_TIM2RST (1 << 0)
404#define RCC_APB1RSTR2_LPTIM2RST (1 << 5)
405#define RCC_APB1RSTR2_SWPMI1RST (1 << 2)
406#define RCC_APB1RSTR2_LPUART1RST (1 << 0)
412#define RCC_APB2RSTR_DFSDMRST (1 << 24)
413#define RCC_APB2RSTR_SAI2RST (1 << 22)
414#define RCC_APB2RSTR_SAI1RST (1 << 21)
415#define RCC_APB2RSTR_TIM17RST (1 << 18)
416#define RCC_APB2RSTR_TIM16RST (1 << 17)
417#define RCC_APB2RSTR_TIM15RST (1 << 16)
418#define RCC_APB2RSTR_USART1RST (1 << 14)
419#define RCC_APB2RSTR_TIM8RST (1 << 13)
420#define RCC_APB2RSTR_SPI1RST (1 << 12)
421#define RCC_APB2RSTR_TIM1RST (1 << 11)
422#define RCC_APB2RSTR_SDMMC1RST (1 << 10)
424#define RCC_APB2RSTR_SYSCFGRST (1 << 0)
435#define RCC_AHB1ENR_TSCEN (1 << 16)
436#define RCC_AHB1ENR_CRCEN (1 << 12)
437#define RCC_AHB1ENR_FLASHEN (1 << 8)
438#define RCC_AHB1ENR_DMA2EN (1 << 1)
439#define RCC_AHB1ENR_DMA1EN (1 << 0)
448#define RCC_AHB2ENR_RNGEN (1 << 18)
449#define RCC_AHB2ENR_AESEN (1 << 16)
450#define RCC_AHB2ENR_ADCEN (1 << 13)
451#define RCC_AHB2ENR_OTGFSEN (1 << 12)
452#define RCC_AHB2ENR_GPIOHEN (1 << 7)
453#define RCC_AHB2ENR_GPIOGEN (1 << 6)
454#define RCC_AHB2ENR_GPIOFEN (1 << 5)
455#define RCC_AHB2ENR_GPIOEEN (1 << 4)
456#define RCC_AHB2ENR_GPIODEN (1 << 3)
457#define RCC_AHB2ENR_GPIOCEN (1 << 2)
458#define RCC_AHB2ENR_GPIOBEN (1 << 1)
459#define RCC_AHB2ENR_GPIOAEN (1 << 0)
468#define RCC_AHB3ENR_QSPIEN (1 << 8)
469#define RCC_AHB3ENR_FMCEN (1 << 0)
482#define RCC_APB1ENR1_LPTIM1EN (1 << 31)
483#define RCC_APB1ENR1_OPAMPEN (1 << 30)
484#define RCC_APB1ENR1_DAC1EN (1 << 29)
485#define RCC_APB1ENR1_PWREN (1 << 28)
486#define RCC_APB1ENR1_CAN2EN (1 << 26)
487#define RCC_APB1ENR1_CAN1EN (1 << 25)
488#define RCC_APB1ENR1_I2C3EN (1 << 23)
489#define RCC_APB1ENR1_I2C2EN (1 << 22)
490#define RCC_APB1ENR1_I2C1EN (1 << 21)
491#define RCC_APB1ENR1_UART5EN (1 << 20)
492#define RCC_APB1ENR1_UART4EN (1 << 19)
493#define RCC_APB1ENR1_USART3EN (1 << 18)
494#define RCC_APB1ENR1_USART2EN (1 << 17)
495#define RCC_APB1ENR1_SPI3EN (1 << 15)
496#define RCC_APB1ENR1_SPI2EN (1 << 14)
497#define RCC_APB1ENR1_LCDEN (1 << 9)
498#define RCC_APB1ENR1_TIM7EN (1 << 5)
499#define RCC_APB1ENR1_TIM6EN (1 << 4)
500#define RCC_APB1ENR1_TIM5EN (1 << 3)
501#define RCC_APB1ENR1_TIM4EN (1 << 2)
502#define RCC_APB1ENR1_TIM3EN (1 << 1)
503#define RCC_APB1ENR1_TIM2EN (1 << 0)
512#define RCC_APB1ENR2_LPTIM2EN (1 << 5)
513#define RCC_APB1ENR2_SWPMI1EN (1 << 2)
514#define RCC_APB1ENR2_LPUART1EN (1 << 0)
524#define RCC_APB2ENR_DFSDMEN (1 << 24)
525#define RCC_APB2ENR_SAI2EN (1 << 22)
526#define RCC_APB2ENR_SAI1EN (1 << 21)
527#define RCC_APB2ENR_TIM17EN (1 << 18)
528#define RCC_APB2ENR_TIM16EN (1 << 17)
529#define RCC_APB2ENR_TIM15EN (1 << 16)
530#define RCC_APB2ENR_USART1EN (1 << 14)
531#define RCC_APB2ENR_TIM8EN (1 << 13)
532#define RCC_APB2ENR_SPI1EN (1 << 12)
533#define RCC_APB2ENR_TIM1EN (1 << 11)
534#define RCC_APB2ENR_SDMMC1EN (1 << 10)
535#define RCC_APB2ENR_FWEN (1 << 7)
536#define RCC_APB2ENR_SYSCFGEN (1 << 0)
541#define RCC_AHB1SMENR_TSCSMEN (1 << 16)
542#define RCC_AHB1SMENR_CRCSMEN (1 << 12)
543#define RCC_AHB1SMENR_SRAM1SMEN (1 << 9)
544#define RCC_AHB1SMENR_FLASHSMEN (1 << 8)
545#define RCC_AHB1SMENR_DMA2SMEN (1 << 1)
546#define RCC_AHB1SMENR_DMA1SMEN (1 << 0)
550#define RCC_AHB2SMENR_RNGSMEN (1 << 18)
551#define RCC_AHB2SMENR_AESSMEN (1 << 16)
552#define RCC_AHB2SMENR_ADCSMEN (1 << 13)
553#define RCC_AHB2SMENR_OTGFSSMEN (1 << 12)
554#define RCC_AHB2SMENR_SRAM2SMEN (1 << 9)
555#define RCC_AHB2SMENR_GPIOHSMEN (1 << 7)
556#define RCC_AHB2SMENR_GPIOGSMEN (1 << 6)
557#define RCC_AHB2SMENR_GPIOFSMEN (1 << 5)
558#define RCC_AHB2SMENR_GPIOESMEN (1 << 4)
559#define RCC_AHB2SMENR_GPIODSMEN (1 << 3)
560#define RCC_AHB2SMENR_GPIOCSMEN (1 << 2)
561#define RCC_AHB2SMENR_GPIOBSMEN (1 << 1)
562#define RCC_AHB2SMENR_GPIOASMEN (1 << 0)
566#define RCC_AHB3SMENR_QSPISMEN (1 << 8)
567#define RCC_AHB3SMENR_FMCSMEN (1 << 0)
571#define RCC_APB1SMENR1_LPTIM1SMEN (1 << 31)
572#define RCC_APB1SMENR1_OPAMPSMEN (1 << 30)
573#define RCC_APB1SMENR1_DAC1SMEN (1 << 29)
574#define RCC_APB1SMENR1_PWRSMEN (1 << 28)
575#define RCC_APB1SMENR1_CAN2SMEN (1 << 26)
576#define RCC_APB1SMENR1_CAN1SMEN (1 << 25)
577#define RCC_APB1SMENR1_I2C3SMEN (1 << 23)
578#define RCC_APB1SMENR1_I2C2SMEN (1 << 22)
579#define RCC_APB1SMENR1_I2C1SMEN (1 << 21)
580#define RCC_APB1SMENR1_UART5SMEN (1 << 20)
581#define RCC_APB1SMENR1_UART4SMEN (1 << 19)
582#define RCC_APB1SMENR1_USART3SMEN (1 << 18)
583#define RCC_APB1SMENR1_USART2SMEN (1 << 17)
584#define RCC_APB1SMENR1_SPI3SMEN (1 << 15)
585#define RCC_APB1SMENR1_SPI2SMEN (1 << 14)
586#define RCC_APB1SMENR1_WWDGSMEN (1 << 11)
587#define RCC_APB1SMENR1_LCDSMEN (1 << 9)
588#define RCC_APB1SMENR1_TIM7SMEN (1 << 5)
589#define RCC_APB1SMENR1_TIM6SMEN (1 << 4)
590#define RCC_APB1SMENR1_TIM5SMEN (1 << 3)
591#define RCC_APB1SMENR1_TIM4SMEN (1 << 2)
592#define RCC_APB1SMENR1_TIM3SMEN (1 << 1)
593#define RCC_APB1SMENR1_TIM2SMEN (1 << 0)
597#define RCC_APB1SMENR2_LPTIM2SMEN (1 << 5)
598#define RCC_APB1SMENR2_SWPMI1SMEN (1 << 2)
599#define RCC_APB1SMENR2_LPUART1SMEN (1 << 0)
603#define RCC_APB2SMENR_DFSDMSMEN (1 << 24)
604#define RCC_APB2SMENR_SAI2SMEN (1 << 22)
605#define RCC_APB2SMENR_SAI1SMEN (1 << 21)
606#define RCC_APB2SMENR_TIM17SMEN (1 << 18)
607#define RCC_APB2SMENR_TIM16SMEN (1 << 17)
608#define RCC_APB2SMENR_TIM15SMEN (1 << 16)
609#define RCC_APB2SMENR_USART1SMEN (1 << 14)
610#define RCC_APB2SMENR_TIM8SMEN (1 << 13)
611#define RCC_APB2SMENR_SPI1SMEN (1 << 12)
612#define RCC_APB2SMENR_TIM1SMEN (1 << 11)
613#define RCC_APB2SMENR_SDMMC1SMEN (1 << 10)
614#define RCC_APB2SMENR_SYSCFGSMEN (1 << 0)
618#define RCC_CCIPR_DFSDMSEL (1 << 31)
619#define RCC_CCIPR_SWPMI1SEL (1 << 30)
621#define RCC_CCIPR_ADCSEL_NONE 0
622#define RCC_CCIPR_ADCSEL_PLLSAI1R 1
623#define RCC_CCIPR_ADCSEL_PLLSAI2R 2
624#define RCC_CCIPR_ADCSEL_SYSCLK 3
625#define RCC_CCIPR_ADCSEL_MASK 0x3
626#define RCC_CCIPR_ADCSEL_SHIFT 28
628#define RCC_CCIPR_CLK48SEL_HSI48 0
629#define RCC_CCIPR_CLK48SEL_PLLSAI1Q 1
630#define RCC_CCIPR_CLK48SEL_PLL 2
631#define RCC_CCIPR_CLK48SEL_MSI 3
632#define RCC_CCIPR_CLK48SEL_MASK 0x3
633#define RCC_CCIPR_CLK48SEL_SHIFT 26
635#define RCC_CCIPR_SAIxSEL_PLLSAI1P 0
636#define RCC_CCIPR_SAIxSEL_PLLSAI2P 1
637#define RCC_CCIPR_SAIxSEL_PLL 2
638#define RCC_CCIPR_SAIxSEL_EXT 3
639#define RCC_CCIPR_SAIxSEL_MASK 0x3
640#define RCC_CCIPR_SAI2SEL_SHIFT 24
641#define RCC_CCIPR_SAI1SEL_SHIFT 22
643#define RCC_CCIPR_LPTIMxSEL_APB 0
644#define RCC_CCIPR_LPTIMxSEL_LSI 1
645#define RCC_CCIPR_LPTIMxSEL_HSI16 2
646#define RCC_CCIPR_LPTIMxSEL_LSE 3
647#define RCC_CCIPR_LPTIMxSEL_MASK 0x3
648#define RCC_CCIPR_LPTIM2SEL_SHIFT 20
649#define RCC_CCIPR_LPTIM1SEL_SHIFT 18
651#define RCC_CCIPR_I2CxSEL_APB 0
652#define RCC_CCIPR_I2CxSEL_SYSCLK 1
653#define RCC_CCIPR_I2CxSEL_HSI16 2
654#define RCC_CCIPR_I2CxSEL_MASK 0x3
655#define RCC_CCIPR_I2C4SEL_SHIFT 0
656#define RCC_CCIPR_I2C3SEL_SHIFT 16
657#define RCC_CCIPR_I2C2SEL_SHIFT 14
658#define RCC_CCIPR_I2C1SEL_SHIFT 12
660#define RCC_CCIPR_LPUART1SEL_APB 0
661#define RCC_CCIPR_LPUART1SEL_SYS 1
662#define RCC_CCIPR_LPUART1SEL_HSI16 2
663#define RCC_CCIPR_LPUART1SEL_LSE 3
664#define RCC_CCIPR_LPUART1SEL_MASK 0x3
665#define RCC_CCIPR_LPUART1SEL_SHIFT 10
667#define RCC_CCIPR_USARTxSEL_APB 0
668#define RCC_CCIPR_USARTxSEL_SYSCLK 1
669#define RCC_CCIPR_USARTxSEL_HSI16 2
670#define RCC_CCIPR_USARTxSEL_LSE 3
671#define RCC_CCIPR_USARTxSEL_MASK 0x3
672#define RCC_CCIPR_UARTxSEL_APB RCC_CCIPR_USARTxSEL_APB
673#define RCC_CCIPR_UARTxSEL_SYSCLK RCC_CCIPR_USARTxSEL_SYSCLK
674#define RCC_CCIPR_UARTxSEL_HSI16 RCC_CCIPR_USARTxSEL_HSI16
675#define RCC_CCIPR_UARTxSEL_LSE RCC_CCIPR_USARTxSEL_LSE
676#define RCC_CCIPR_UARTxSEL_MASK RCC_CCIPR_USARTxSEL_MASK
677#define RCC_CCIPR_UART5SEL_SHIFT 8
678#define RCC_CCIPR_UART4SEL_SHIFT 6
679#define RCC_CCIPR_USART3SEL_SHIFT 4
680#define RCC_CCIPR_USART2SEL_SHIFT 2
681#define RCC_CCIPR_USART1SEL_SHIFT 0
685#define RCC_BDCR_LSCOSEL (1 << 25)
686#define RCC_BDCR_LSCOEN (1 << 24)
687#define RCC_BDCR_BDRST (1 << 16)
688#define RCC_BDCR_RTCEN (1 << 15)
690#define RCC_BDCR_RTCSEL_NONE 0
691#define RCC_BDCR_RTCSEL_LSE 1
692#define RCC_BDCR_RTCSEL_LSI 2
693#define RCC_BDCR_RTCSEL_HSEDIV32 3
694#define RCC_BDCR_RTCSEL_SHIFT 8
695#define RCC_BDCR_RTCSEL_MASK 0x3
697#define RCC_BDCR_LSESYSDIS (1 << 7)
698#define RCC_BDCR_LSECSSD (1 << 6)
699#define RCC_BDCR_LSECSSON (1 << 5)
701#define RCC_BDCR_LSEDRV_LOW 0
702#define RCC_BDCR_LSEDRV_MEDLOW 1
703#define RCC_BDCR_LSEDRV_MEDHIGH 2
704#define RCC_BDCR_LSEDRV_HIGH 3
705#define RCC_BDCR_LSEDRV_SHIFT 3
706#define RCC_BDCR_LSEDRV_MASK 0x3
708#define RCC_BDCR_LSEBYP (1 << 2)
709#define RCC_BDCR_LSERDY (1 << 1)
710#define RCC_BDCR_LSEON (1 << 0)
714#define RCC_CSR_LPWRRSTF (1 << 31)
715#define RCC_CSR_WWDGRSTF (1 << 30)
716#define RCC_CSR_IWDGRSTF (1 << 29)
717#define RCC_CSR_SFTRSTF (1 << 28)
718#define RCC_CSR_BORRSTF (1 << 27)
719#define RCC_CSR_PINRSTF (1 << 26)
720#define RCC_CSR_OBLRSTF (1 << 25)
721#define RCC_CSR_FWRSTF (1 << 24)
722#define RCC_CSR_RMVF (1 << 23)
723#define RCC_CSR_RESET_FLAGS (RCC_CSR_LPWRRSTF | RCC_CSR_WWDGRSTF |\
724 RCC_CSR_IWDGRSTF | RCC_CSR_SFTRSTF | RCC_CSR_BORRSTF |\
725 RCC_CSR_PINRSTF | RCC_CSR_OBLRSTF | RCC_CSR_FWRSTF)
732#define RCC_CSR_MSIRANGE_MASK 0xf
733#define RCC_CSR_MSIRANGE_SHIFT 8
734#define RCC_CSR_MSIRANGE_1MHZ 4
735#define RCC_CSR_MSIRANGE_2MHZ 5
736#define RCC_CSR_MSIRANGE_4MHZ 6
737#define RCC_CSR_MSIRANGE_8MHZ 7
740#define RCC_CSR_LSIRDY (1 << 1)
741#define RCC_CSR_LSION (1 << 0)
782#define _REG_BIT(base, bit) (((base) << 5) + (bit))
int rcc_osc_ready_int_flag(enum rcc_osc osc)
void rcc_set_msi_range(uint32_t msi_range)
Set the msi run time range.
int rcc_css_int_flag(void)
void rcc_set_clock48_source(uint32_t clksel)
Set clock source for 48MHz clock.
void rcc_osc_ready_int_clear(enum rcc_osc osc)
void rcc_set_main_pll(uint32_t source, uint32_t pllm, uint32_t plln, uint32_t pllp, uint32_t pllq, uint32_t pllr)
void rcc_css_disable(void)
uint32_t rcc_get_spi_clk_freq(uint32_t spi)
Get the peripheral clock speed for the SPI device at base specified.
void rcc_set_sysclk_source(uint32_t clk)
uint32_t rcc_apb2_frequency
void rcc_set_pll_source(uint32_t pllsrc)
uint32_t rcc_get_timer_clk_freq(uint32_t timer)
Get the peripheral clock speed for the Timer at base specified.
uint32_t rcc_system_clock_source(void)
uint32_t rcc_get_usart_clk_freq(uint32_t usart)
Get the peripheral clock speed for the USART at base specified.
void rcc_clock_setup_pll(const struct rcc_clock_scale *clock)
Setup clocks to run from PLL.
void rcc_osc_ready_int_enable(enum rcc_osc osc)
void rcc_set_rtc_clock_source(enum rcc_osc clk)
Set the source for the RTC clock.
void rcc_pll_output_enable(uint32_t pllout)
Enable PLL Output.
void rcc_disable_rtc_clock(void)
Disable the RTC clock.
void rcc_osc_ready_int_disable(enum rcc_osc osc)
void rcc_osc_on(enum rcc_osc osc)
#define _REG_BIT(base, bit)
uint32_t rcc_ahb_frequency
void rcc_osc_off(enum rcc_osc osc)
uint32_t rcc_get_i2c_clk_freq(uint32_t i2c)
Get the peripheral clock speed for the I2C device at base specified.
void rcc_set_msi_range_standby(uint32_t msi_range)
Set the msi range after reset/standby.
const struct rcc_clock_scale rcc_hsi16_configs[RCC_CLOCK_CONFIG_END]
uint32_t rcc_apb1_frequency
void rcc_wait_for_sysclk_status(enum rcc_osc osc)
void rcc_set_ppre1(uint32_t ppre1)
void rcc_css_int_clear(void)
void rcc_enable_rtc_clock(void)
Enable the RTC clock.
void rcc_set_ppre2(uint32_t ppre2)
void rcc_css_enable(void)
void rcc_set_hpre(uint32_t hpre)
@ RCC_CLOCK_VRANGE1_80MHZ
#define RCC_APB2RSTR_OFFSET
#define RCC_AHB1SMENR_OFFSET
#define RCC_APB1ENR2_OFFSET
#define RCC_AHB3RSTR_OFFSET
#define RCC_AHB1RSTR_OFFSET
#define RCC_APB1ENR1_OFFSET
#define RCC_AHB3ENR_OFFSET
#define RCC_AHB3SMENR_OFFSET
#define RCC_APB1RSTR1_OFFSET
#define RCC_AHB2RSTR_OFFSET
#define RCC_APB2ENR_OFFSET
#define RCC_AHB2ENR_OFFSET
#define RCC_AHB2SMENR_OFFSET
#define RCC_APB1RSTR2_OFFSET
#define RCC_AHB1ENR_OFFSET
enum pwr_vos_scale voltage_scale