41#ifndef LIBOPENCM3_RCC_H
42#define LIBOPENCM3_RCC_H
49#define RCC_CR MMIO32(RCC_BASE + 0x00)
50#define RCC_ICSCR MMIO32(RCC_BASE + 0x04)
51#define RCC_CFGR MMIO32(RCC_BASE + 0x08)
52#define RCC_PLLCFGR MMIO32(RCC_BASE + 0x0c)
53#define RCC_CIER MMIO32(RCC_BASE + 0x18)
54#define RCC_CIFR MMIO32(RCC_BASE + 0x1c)
55#define RCC_CICR MMIO32(RCC_BASE + 0x20)
56#define RCC_AHB1RSTR_OFFSET 0x28
57#define RCC_AHB1RSTR MMIO32(RCC_BASE + RCC_AHB1RSTR_OFFSET)
58#define RCC_AHB2RSTR_OFFSET 0x2c
59#define RCC_AHB2RSTR MMIO32(RCC_BASE + RCC_AHB2RSTR_OFFSET)
60#define RCC_AHB3RSTR_OFFSET 0x30
61#define RCC_AHB3RSTR MMIO32(RCC_BASE + RCC_AHB3RSTR_OFFSET)
62#define RCC_APB1RSTR1_OFFSET 0x38
63#define RCC_APB1RSTR1 MMIO32(RCC_BASE + RCC_APB1RSTR1_OFFSET)
64#define RCC_APB1RSTR2_OFFSET 0x3c
65#define RCC_APB1RSTR2 MMIO32(RCC_BASE + RCC_APB1RSTR2_OFFSET)
66#define RCC_APB2RSTR_OFFSET 0x40
67#define RCC_APB2RSTR MMIO32(RCC_BASE + RCC_APB2RSTR_OFFSET)
68#define RCC_AHB1ENR_OFFSET 0x48
69#define RCC_AHB1ENR MMIO32(RCC_BASE + RCC_AHB1ENR_OFFSET)
70#define RCC_AHB2ENR_OFFSET 0x4c
71#define RCC_AHB2ENR MMIO32(RCC_BASE + RCC_AHB2ENR_OFFSET)
72#define RCC_AHB3ENR_OFFSET 0x50
73#define RCC_AHB3ENR MMIO32(RCC_BASE + RCC_AHB3ENR_OFFSET)
74#define RCC_APB1ENR1_OFFSET 0x58
75#define RCC_APB1ENR1 MMIO32(RCC_BASE + RCC_APB1ENR1_OFFSET)
76#define RCC_APB1ENR2_OFFSET 0x5c
77#define RCC_APB1ENR2 MMIO32(RCC_BASE + RCC_APB1ENR2_OFFSET)
78#define RCC_APB2ENR_OFFSET 0x60
79#define RCC_APB2ENR MMIO32(RCC_BASE + RCC_APB2ENR_OFFSET)
80#define RCC_AHB1SMENR_OFFSET 0x68
81#define RCC_AHB1SMENR MMIO32(RCC_BASE + RCC_AHB1SMENR_OFFSET)
82#define RCC_AHB2SMENR_OFFSET 0x6c
83#define RCC_AHB2SMENR MMIO32(RCC_BASE + RCC_AHB2SMENR_OFFSET)
84#define RCC_AHB3SMENR_OFFSET 0x70
85#define RCC_AHB3SMENR MMIO32(RCC_BASE + RCC_AHB3SMENR_OFFSET)
86#define RCC_APB1SMENR1_OFFSET 0x78
87#define RCC_APB1SMENR1 MMIO32(RCC_BASE + RCC_APB1SMENR1_OFFSET)
88#define RCC_APB1SMENR2_OFFSET 0x7c
89#define RCC_APB1SMENR2 MMIO32(RCC_BASE + RCC_APB1SMENR2_OFFSET)
90#define RCC_APB2SMENR_OFFSET 0x80
91#define RCC_APB2SMENR MMIO32(RCC_BASE + RCC_APB2SMENR_OFFSET)
92#define RCC_CCIPR MMIO32(RCC_BASE + 0x88)
93#define RCC_BDCR MMIO32(RCC_BASE + 0x90)
94#define RCC_CSR MMIO32(RCC_BASE + 0x94)
95#define RCC_CRRCR MMIO32(RCC_BASE + 0x98)
96#define RCC_CCIPR2 MMIO32(RCC_BASE + 0x9c)
103#define RCC_CR_PLLRDY (1 << 25)
104#define RCC_CR_PLLON (1 << 24)
105#define RCC_CR_CSSON (1 << 19)
106#define RCC_CR_HSEBYP (1 << 18)
107#define RCC_CR_HSERDY (1 << 17)
108#define RCC_CR_HSEON (1 << 16)
109#define RCC_CR_HSIRDY (1 << 10)
110#define RCC_CR_HSIKERON (1 << 9)
111#define RCC_CR_HSION (1 << 8)
117#define RCC_ICSCR_HSITRIM_SHIFT 24
118#define RCC_ICSCR_HSITRIM_MASK 0x7f
119#define RCC_ICSCR_HSICAL_SHIFT 16
120#define RCC_ICSCR_HSICAL_MASK 0xff
129#define RCC_CFGR_MCOPRE_DIV1 0
130#define RCC_CFGR_MCOPRE_DIV2 1
131#define RCC_CFGR_MCOPRE_DIV4 2
132#define RCC_CFGR_MCOPRE_DIV8 3
133#define RCC_CFGR_MCOPRE_DIV16 4
135#define RCC_CFGR_MCOPRE_SHIFT 28
136#define RCC_CFGR_MCOPRE_MASK 0x7
141#define RCC_CFGR_MCO_NOCLK 0x0
142#define RCC_CFGR_MCO_SYSCLK 0x1
143#define RCC_CFGR_MCO_HSI16 0x3
144#define RCC_CFGR_MCO_HSE 0x4
145#define RCC_CFGR_MCO_PLL 0x5
146#define RCC_CFGR_MCO_LSI 0x6
147#define RCC_CFGR_MCO_LSE 0x7
148#define RCC_CFGR_MCO_HSI48 0x8
150#define RCC_CFGR_MCO_SHIFT 24
151#define RCC_CFGR_MCO_MASK 0xf
156#define RCC_CFGR_PPREx_NODIV 0x0
157#define RCC_CFGR_PPREx_DIV2 0x4
158#define RCC_CFGR_PPREx_DIV4 0x5
159#define RCC_CFGR_PPREx_DIV8 0x6
160#define RCC_CFGR_PPREx_DIV16 0x7
162#define RCC_CFGR_PPRE2_MASK 0x7
163#define RCC_CFGR_PPRE2_SHIFT 11
164#define RCC_CFGR_PPRE1_MASK 0x7
165#define RCC_CFGR_PPRE1_SHIFT 8
171#define RCC_CFGR_HPRE_NODIV 0x0
172#define RCC_CFGR_HPRE_DIV2 0x8
173#define RCC_CFGR_HPRE_DIV4 0x9
174#define RCC_CFGR_HPRE_DIV8 0xa
175#define RCC_CFGR_HPRE_DIV16 0xb
176#define RCC_CFGR_HPRE_DIV64 0xc
177#define RCC_CFGR_HPRE_DIV128 0xd
178#define RCC_CFGR_HPRE_DIV256 0xe
179#define RCC_CFGR_HPRE_DIV512 0xf
181#define RCC_CFGR_HPRE_MASK 0xf
182#define RCC_CFGR_HPRE_SHIFT 4
187#define RCC_CFGR_SWx_HSI16 0x1
188#define RCC_CFGR_SWx_HSE 0x2
189#define RCC_CFGR_SWx_PLL 0x3
191#define RCC_CFGR_SWS_MASK 0x3
192#define RCC_CFGR_SWS_SHIFT 2
193#define RCC_CFGR_SW_MASK 0x3
194#define RCC_CFGR_SW_SHIFT 0
200#define RCC_PLLCFGR_PLLPDIV_MASK 0x1f
201#define RCC_PLLCFGR_PLLPDIV_SHIFT 27
206#define RCC_PLLCFGR_PLLR_DIV2 0
207#define RCC_PLLCFGR_PLLR_DIV4 1
208#define RCC_PLLCFGR_PLLR_DIV6 2
209#define RCC_PLLCFGR_PLLR_DIV8 3
211#define RCC_PLLCFGR_PLLR_SHIFT 25
212#define RCC_PLLCFGR_PLLR_MASK 0x3
214#define RCC_PLLCFGR_PLLREN BIT24
216#define RCC_PLLCFGR_PLLQ_DIV2 0
217#define RCC_PLLCFGR_PLLQ_DIV4 1
218#define RCC_PLLCFGR_PLLQ_DIV6 2
219#define RCC_PLLCFGR_PLLQ_DIV8 3
220#define RCC_PLLCFGR_PLLQ_SHIFT 21
221#define RCC_PLLCFGR_PLLQ_MASK 0x3
223#define RCC_PLLCFGR_PLLQEN BIT20
226#define RCC_PLLCFGR_PLLP BIT17
227#define RCC_PLLCFGR_PLLP_DIV7 0
228#define RCC_PLLCFGR_PLLP_DIV17 RCC_PLLCFGR_PLLP
229#define RCC_PLLCFGR_PLLPEN (1 << 16)
234#define RCC_PLLCFGR_PLLN_SHIFT 8
235#define RCC_PLLCFGR_PLLN_MASK 0x7f
241#define RCC_PLLCFGR_PLLM_SHIFT 0x4
242#define RCC_PLLCFGR_PLLM_MASK 0xf
243#define RCC_PLLCFGR_PLLM(x) ((x)-1)
246#define RCC_PLLCFGR_PLLSRC_NONE 0
247#define RCC_PLLCFGR_PLLSRC_HSI16 2
248#define RCC_PLLCFGR_PLLSRC_HSE 3
249#define RCC_PLLCFGR_PLLSRC_SHIFT 0
250#define RCC_PLLCFGR_PLLSRC_MASK 0x3
258#define RCC_CIER_HSI48RDYIE (1 << 10)
259#define RCC_CIER_LSE_CSSIE (1 << 9)
261#define RCC_CIER_PLLRDYIE (1 << 5)
262#define RCC_CIER_HSERDYIE (1 << 4)
263#define RCC_CIER_HSIRDYIE (1 << 3)
264#define RCC_CIER_LSERDYIE (1 << 1)
265#define RCC_CIER_LSIRDYIE (1 << 0)
271#define RCC_CIFR_HSI48RDYF (1 << 10)
272#define RCC_CIFR_LSECSSF (1 << 9)
273#define RCC_CIFR_CSSF (1 << 8)
274#define RCC_CIFR_PLLRDYF (1 << 5)
275#define RCC_CIFR_HSERDYF (1 << 4)
276#define RCC_CIFR_HSIRDYF (1 << 3)
277#define RCC_CIFR_LSERDYF (1 << 1)
278#define RCC_CIFR_LSIRDYF (1 << 0)
284#define RCC_CICR_HSI48RDYC (1 << 10)
285#define RCC_CICR_LSECSSC (1 << 9)
286#define RCC_CICR_CSSC (1 << 8)
287#define RCC_CICR_PLLRDYC (1 << 5)
288#define RCC_CICR_HSERDYC (1 << 4)
289#define RCC_CICR_HSIRDYC (1 << 3)
290#define RCC_CICR_LSERDYC (1 << 1)
291#define RCC_CICR_LSIRDYC (1 << 0)
298#define RCC_AHB1RSTR_CRCRST (1 << 12)
299#define RCC_AHB1RSTR_FLASHRST (1 << 8)
300#define RCC_AHB1RSTR_FMACRST (1 << 4)
301#define RCC_AHB1RSTR_CORDICRST (1 << 3)
302#define RCC_AHB1RSTR_DMAMUX1RST (1 << 2)
303#define RCC_AHB1RSTR_DMA2RST (1 << 1)
304#define RCC_AHB1RSTR_DMA1RST (1 << 0)
309#define RCC_AHB2RSTR_RNGRST (1 << 26)
310#define RCC_AHB2RSTR_AESRST (1 << 24)
311#define RCC_AHB2RSTR_DAC4RST (1 << 19)
312#define RCC_AHB2RSTR_DAC3RST (1 << 18)
313#define RCC_AHB2RSTR_DAC2RST (1 << 17)
314#define RCC_AHB2RSTR_DAC1RST (1 << 16)
315#define RCC_AHB2RSTR_ADC345RST (1 << 14)
316#define RCC_AHB2RSTR_ADC12RST (1 << 13)
317#define RCC_AHB2RSTR_GPIOGRST (1 << 6)
318#define RCC_AHB2RSTR_GPIOFRST (1 << 5)
319#define RCC_AHB2RSTR_GPIOERST (1 << 4)
320#define RCC_AHB2RSTR_GPIODRST (1 << 3)
321#define RCC_AHB2RSTR_GPIOCRST (1 << 2)
322#define RCC_AHB2RSTR_GPIOBRST (1 << 1)
323#define RCC_AHB2RSTR_GPIOARST (1 << 0)
329#define RCC_AHB3RSTR_QSPIRST (1 << 8)
330#define RCC_AHB3RSTR_FMCRST (1 << 0)
338#define RCC_APB1RSTR1_LPTIM1RST (1 << 31)
339#define RCC_APB1RSTR1_I2C3RST (1 << 30)
340#define RCC_APB1RSTR1_PWRRST (1 << 28)
341#define RCC_APB1RSTR1_FDCANRST (1 << 25)
342#define RCC_APB1RSTR1_USBRST (1 << 23)
343#define RCC_APB1RSTR1_I2C2RST (1 << 22)
344#define RCC_APB1RSTR1_I2C1RST (1 << 21)
345#define RCC_APB1RSTR1_UART5RST (1 << 20)
346#define RCC_APB1RSTR1_UART4RST (1 << 19)
347#define RCC_APB1RSTR1_USART3RST (1 << 18)
348#define RCC_APB1RSTR1_USART2RST (1 << 17)
349#define RCC_APB1RSTR1_SPI3RST (1 << 15)
350#define RCC_APB1RSTR1_SPI2RST (1 << 14)
351#define RCC_APB1RSTR1_CRSRST (1 << 8)
352#define RCC_APB1RSTR1_TIM7RST (1 << 5)
353#define RCC_APB1RSTR1_TIM6RST (1 << 4)
354#define RCC_APB1RSTR1_TIM5RST (1 << 3)
355#define RCC_APB1RSTR1_TIM4RST (1 << 2)
356#define RCC_APB1RSTR1_TIM3RST (1 << 1)
357#define RCC_APB1RSTR1_TIM2RST (1 << 0)
362#define RCC_APB1RSTR2_UCPD1RST (1 << 8)
363#define RCC_APB1RSTR2_I2C4RST (1 << 1)
364#define RCC_APB1RSTR2_LPUART1RST (1 << 0)
370#define RCC_APB2RSTR_HRTIM1RST (1 << 26)
371#define RCC_APB2RSTR_SAI1RST (1 << 21)
372#define RCC_APB2RSTR_TIM20RST (1 << 20)
373#define RCC_APB2RSTR_TIM17RST (1 << 18)
374#define RCC_APB2RSTR_TIM16RST (1 << 17)
375#define RCC_APB2RSTR_TIM15RST (1 << 16)
376#define RCC_APB2RSTR_SPI4RST (1 << 15)
377#define RCC_APB2RSTR_USART1RST (1 << 14)
378#define RCC_APB2RSTR_TIM8RST (1 << 13)
379#define RCC_APB2RSTR_SPI1RST (1 << 12)
380#define RCC_APB2RSTR_TIM1RST (1 << 11)
381#define RCC_APB2RSTR_SYSCFGRST (1 << 0)
388#define RCC_AHB1ENR_CRCEN (1 << 12)
389#define RCC_AHB1ENR_FLASHEN (1 << 8)
390#define RCC_AHB1ENR_FMACEN (1 << 4)
391#define RCC_AHB1ENR_CORDICEN (1 << 3)
392#define RCC_AHB1ENR_DMAMUX1EN (1 << 2)
393#define RCC_AHB1ENR_DMA2EN (1 << 1)
394#define RCC_AHB1ENR_DMA1EN (1 << 0)
399#define RCC_AHB2ENR_RNGEN (1 << 26)
400#define RCC_AHB2ENR_AESEN (1 << 24)
401#define RCC_AHB2ENR_DAC4EN (1 << 19)
402#define RCC_AHB2ENR_DAC3EN (1 << 18)
403#define RCC_AHB2ENR_DAC2EN (1 << 17)
404#define RCC_AHB2ENR_DAC1EN (1 << 16)
405#define RCC_AHB2ENR_ADC345EN (1 << 14)
406#define RCC_AHB2ENR_ADC12EN (1 << 13)
407#define RCC_AHB2ENR_GPIOGEN (1 << 6)
408#define RCC_AHB2ENR_GPIOFEN (1 << 5)
409#define RCC_AHB2ENR_GPIOEEN (1 << 4)
410#define RCC_AHB2ENR_GPIODEN (1 << 3)
411#define RCC_AHB2ENR_GPIOCEN (1 << 2)
412#define RCC_AHB2ENR_GPIOBEN (1 << 1)
413#define RCC_AHB2ENR_GPIOAEN (1 << 0)
418#define RCC_AHB3ENR_QSPIEN (1 << 8)
419#define RCC_AHB3ENR_FMCEN (1 << 0)
428#define RCC_APB1ENR1_LPTIM1EN (1 << 31)
429#define RCC_APB1ENR1_I2C3EN (1 << 30)
430#define RCC_APB1ENR1_PWREN (1 << 28)
431#define RCC_APB1ENR1_FDCANEN (1 << 25)
432#define RCC_APB1ENR1_USBEN (1 << 23)
433#define RCC_APB1ENR1_I2C2EN (1 << 22)
434#define RCC_APB1ENR1_I2C1EN (1 << 21)
435#define RCC_APB1ENR1_UART5EN (1 << 20)
436#define RCC_APB1ENR1_UART4EN (1 << 19)
437#define RCC_APB1ENR1_USART3EN (1 << 18)
438#define RCC_APB1ENR1_USART2EN (1 << 17)
439#define RCC_APB1ENR1_SPI3EN (1 << 15)
440#define RCC_APB1ENR1_SPI2EN (1 << 14)
441#define RCC_APB1ENR1_WWDGEN (1 << 11)
442#define RCC_APB1ENR1_RTCAPBEN (1 << 10)
443#define RCC_APB1ENR1_CRSEN (1 << 8)
444#define RCC_APB1ENR1_TIM7EN (1 << 5)
445#define RCC_APB1ENR1_TIM6EN (1 << 4)
446#define RCC_APB1ENR1_TIM5EN (1 << 3)
447#define RCC_APB1ENR1_TIM4EN (1 << 2)
448#define RCC_APB1ENR1_TIM3EN (1 << 1)
449#define RCC_APB1ENR1_TIM2EN (1 << 0)
454#define RCC_APB1ENR2_UCPD1EN (1 << 8)
455#define RCC_APB1ENR2_I2C4EN (1 << 1)
456#define RCC_APB1ENR2_LPUART1EN (1 << 0)
462#define RCC_APB2ENR_HRTIM1EN (1 << 26)
463#define RCC_APB2ENR_SAI1EN (1 << 21)
464#define RCC_APB2ENR_TIM20EN (1 << 20)
465#define RCC_APB2ENR_TIM17EN (1 << 18)
466#define RCC_APB2ENR_TIM16EN (1 << 17)
467#define RCC_APB2ENR_TIM15EN (1 << 16)
468#define RCC_APB2ENR_SPI4EN (1 << 15)
469#define RCC_APB2ENR_USART1EN (1 << 14)
470#define RCC_APB2ENR_TIM8EN (1 << 13)
471#define RCC_APB2ENR_SPI1EN (1 << 12)
472#define RCC_APB2ENR_TIM1EN (1 << 11)
473#define RCC_APB2ENR_SYSCFGEN (1 << 0)
479#define RCC_AHB1SMENR_CRCSMEN (1 << 12)
480#define RCC_AHB1SMENR_SRAM1SMEN (1 << 9)
481#define RCC_AHB1SMENR_FLASHSMEN (1 << 8)
482#define RCC_AHB1SMENR_FMACSMEN (1 << 4)
483#define RCC_AHB1SMENR_CORFDICSMEN (1 << 3)
484#define RCC_AHB1SMENR_DMAMUX1SMEN (1 << 2)
485#define RCC_AHB1SMENR_DMA2SMEN (1 << 1)
486#define RCC_AHB1SMENR_DMA1SMEN (1 << 0)
492#define RCC_AHB2SMENR_RNGSMEN (1 << 26)
493#define RCC_AHB2SMENR_AESSMEN (1 << 24)
494#define RCC_AHB2SMENR_DAC4SMEN (1 << 19)
495#define RCC_AHB2SMENR_DAC3SMEN (1 << 18)
496#define RCC_AHB2SMENR_DAC2SMEN (1 << 17)
497#define RCC_AHB2SMENR_DAC1SMEN (1 << 16)
498#define RCC_AHB2SMENR_ADC345SMEN (1 << 14)
499#define RCC_AHB2SMENR_ADC12SMEN (1 << 13)
500#define RCC_AHB2SMENR_SRAM2SMEN (1 << 10)
501#define RCC_AHB2SMENR_CCMSRAMSMEN (1 << 9)
502#define RCC_AHB2SMENR_GPIOGSMEN (1 << 6)
503#define RCC_AHB2SMENR_GPIOFSMEN (1 << 5)
504#define RCC_AHB2SMENR_GPIOESMEN (1 << 4)
505#define RCC_AHB2SMENR_GPIODSMEN (1 << 3)
506#define RCC_AHB2SMENR_GPIOCSMEN (1 << 2)
507#define RCC_AHB2SMENR_GPIOBSMEN (1 << 1)
508#define RCC_AHB2SMENR_GPIOASMEN (1 << 0)
514#define RCC_AHB3SMENR_QSPISMEN (1 << 8)
515#define RCC_AHB3SMENR_FMCSMEN (1 << 0)
521#define RCC_APB1SMENR1_LPTIM1SMEN (1 << 31)
522#define RCC_APB1SMENR1_I2C3SMEN (1 << 30)
523#define RCC_APB1SMENR1_PWRSMEN (1 << 28)
524#define RCC_APB1SMENR1_FDCANSMEN (1 << 25)
525#define RCC_APB1SMENR1_USBSMEN (1 << 23)
526#define RCC_APB1SMENR1_I2C2SMEN (1 << 22)
527#define RCC_APB1SMENR1_I2C1SMEN (1 << 21)
528#define RCC_APB1SMENR1_UART5SMEN (1 << 20)
529#define RCC_APB1SMENR1_UART4SMEN (1 << 19)
530#define RCC_APB1SMENR1_USART3SMEN (1 << 18)
531#define RCC_APB1SMENR1_USART2SMEN (1 << 17)
532#define RCC_APB1SMENR1_SPI3SMEN (1 << 15)
533#define RCC_APB1SMENR1_SPI2SMEN (1 << 14)
534#define RCC_APB1SMENR1_WWDGSMEN (1 << 11)
535#define RCC_APB1SMENR1_RTCAPBSMEN (1 << 10)
536#define RCC_APB1SMENR1_TIM7SMEN (1 << 5)
537#define RCC_APB1SMENR1_TIM6SMEN (1 << 4)
538#define RCC_APB1SMENR1_TIM5SMEN (1 << 3)
539#define RCC_APB1SMENR1_TIM4SMEN (1 << 2)
540#define RCC_APB1SMENR1_TIM3SMEN (1 << 1)
541#define RCC_APB1SMENR1_TIM2SMEN (1 << 0)
547#define RCC_APB1SMENR2_UCPD1SMEN (1 << 8)
548#define RCC_APB1SMENR2_I2C4SMEN (1 << 1)
549#define RCC_APB1SMENR2_LPUART1SMEN (1 << 0)
555#define RCC_APB2SMENR_HRTIM1SMEN (1 << 26)
556#define RCC_APB2SMENR_SAI1SMEN (1 << 21)
557#define RCC_APB2SMENR_TIM20SMEN (1 << 20)
558#define RCC_APB2SMENR_TIM17SMEN (1 << 18)
559#define RCC_APB2SMENR_TIM16SMEN (1 << 17)
560#define RCC_APB2SMENR_TIM15SMEN (1 << 16)
561#define RCC_APB2SMENR_SPI4SMEN (1 << 15)
562#define RCC_APB2SMENR_USART1SMEN (1 << 14)
563#define RCC_APB2SMENR_TIM8SMEN (1 << 13)
564#define RCC_APB2SMENR_SPI1SMEN (1 << 12)
565#define RCC_APB2SMENR_TIM1SMEN (1 << 11)
566#define RCC_APB2SMENR_SYSCFGSMEN (1 << 0)
573#define RCC_CCIPR_SEL_MASK 0x3
575#define RCC_CCIPR_ADC345SEL_NONE 0
576#define RCC_CCIPR_ADC345SEL_PLLP 1
577#define RCC_CCIPR_ADC345SEL_SYSCLK 2
578#define RCC_CCIPR_ADC345SEL_SHIFT 30
580#define RCC_CCIPR_ADC12SEL_NONE 0
581#define RCC_CCIPR_ADC12SEL_PLLP 1
582#define RCC_CCIPR_ADC12SEL_SYSCLK 2
583#define RCC_CCIPR_ADC12SEL_SHIFT 28
585#define RCC_CCIPR_CLK48SEL_HSI48 0
586#define RCC_CCIPR_CLK48SEL_PLLQ 2
587#define RCC_CCIPR_CLK48SEL_SHIFT 26
589#define RCC_CCIPR_FDCANSEL_HSE 0
590#define RCC_CCIPR_FDCANSEL_PLLQ 1
591#define RCC_CCIPR_FDCANSEL_PCLK 2
592#define RCC_CCIPR_FDCANSEL_SHIFT 24
594#define RCC_CCIPR_I2S23SEL_SYSCLK 0
595#define RCC_CCIPR_I2S23SEL_PLLQ 1
596#define RCC_CCIPR_I2S23SEL_EXT 2
597#define RCC_CCIPR_I2S23SEL_SHI16 3
598#define RCC_CCIPR_I2S23SEL_SHIFT 22
600#define RCC_CCIPR_SAI1SEL_SYSCLK 0
601#define RCC_CCIPR_SAI1SEL_PLLQ 1
602#define RCC_CCIPR_SAI1SEL_EXT 2
603#define RCC_CCIPR_SAI1SEL_HSI16 3
604#define RCC_CCIPR_SAI1SEL_SHIFT 20
606#define RCC_CCIPR_LPTIM1SEL_PCLK 0
607#define RCC_CCIPR_LPTIM1SEL_LSI 1
608#define RCC_CCIPR_LPTIM1SEL_HSI16 2
609#define RCC_CCIPR_LPTIM1SEL_LSE 3
610#define RCC_CCIPR_LPTIM1SEL_SHIFT 18
612#define RCC_CCIPR_I2CxSEL_PCLK 0
613#define RCC_CCIPR_I2CxSEL_SYSCLK 1
614#define RCC_CCIPR_I2CxSEL_HSI16 2
615#define RCC_CCIPR_I2C3SEL_SHIFT 16
616#define RCC_CCIPR_I2C2SEL_SHIFT 14
617#define RCC_CCIPR_I2C1SEL_SHIFT 12
619#define RCC_CCIPR_USARTxSEL_PCLK 0
620#define RCC_CCIPR_USARTxSEL_SYSCLK 1
621#define RCC_CCIPR_USARTxSEL_HSI16 2
622#define RCC_CCIPR_USARTxSEL_LSE 3
624#define RCC_CCIPR_LPUARTxSEL_PCLK RCC_CCIPR_USARTx_PCLK
625#define RCC_CCIPR_LPUARTxSEL_SYSCLK RCC_CCIPR_USARTx_SYSCLK
626#define RCC_CCIPR_LPUARTxSEL_HSI16 RCC_CCIPR_USARTx_HSI16
627#define RCC_CCIPR_LPUARTxSEL_LSE RCC_CCIPR_USARTx_LSE
628#define RCC_CCIPR_LPUART1SEL_SHIFT 10
630#define RCC_CCIPR_UARTxSEL_PCLK RCC_CCIPR_USARTx_PCLK
631#define RCC_CCIPR_UARTxSEL_SYSCLK RCC_CCIPR_USARTx_SYSCLK
632#define RCC_CCIPR_UARTxSEL_HSI16 RCC_CCIPR_USARTx_HSI16
633#define RCC_CCIPR_UARTxSEL_LSE RCC_CCIPR_USARTx_LSE
634#define RCC_CCIPR_UART5SEL_SHIFT 8
635#define RCC_CCIPR_UART4SEL_SHIFT 6
636#define RCC_CCIPR_USART3SEL_SHIFT 4
637#define RCC_CCIPR_USART2SEL_SHIFT 2
638#define RCC_CCIPR_USART1SEL_SHIFT 0
644#define RCC_CCIPR2_SEL_MASK 0x3
646#define RCC_CCIPR2_QSPI_SYS 0
647#define RCC_CCIPR2_QSPI_HSI16 1
648#define RCC_CCIPR2_QSPI_PLLQ 2
649#define RCC_CCIPR2_QSPI_SHIFT 20
651#define RCC_CCIPR2_I2C4_PCLK 0
652#define RCC_CCIPR2_I2C4_SYS 1
653#define RCC_CCIPR2_I2C4_HSI16 2
654#define RCC_CCIPR2_I2C4_SHIFT 0
661#define RCC_BDCR_LSCOSEL (1 << 25)
662#define RCC_BDCR_LSCOEN (1 << 24)
663#define RCC_BDCR_BDRST (1 << 16)
664#define RCC_BDCR_RTCEN (1 << 15)
666#define RCC_BDCR_RTCSEL_NONE 0
667#define RCC_BDCR_RTCSEL_LSE 1
668#define RCC_BDCR_RTCSEL_LSI 2
669#define RCC_BDCR_RTCSEL_HSEDIV32 3
670#define RCC_BDCR_RTCSEL_SHIFT 8
671#define RCC_BDCR_RTCSEL_MASK 0x3
673#define RCC_BDCR_LSECSSD (1 << 6)
674#define RCC_BDCR_LSECSSON (1 << 5)
676#define RCC_BDCR_LSEDRV_LOW 0
677#define RCC_BDCR_LSEDRV_MEDLOW 1
678#define RCC_BDCR_LSEDRV_MEDHIGH 2
679#define RCC_BDCR_LSEDRV_HIGH 3
680#define RCC_BDCR_LSEDRV_SHIFT 3
681#define RCC_BDCR_LSEDRV_MASK 0x3
683#define RCC_BDCR_LSEBYP (1 << 2)
684#define RCC_BDCR_LSERDY (1 << 1)
685#define RCC_BDCR_LSEON (1 << 0)
691#define RCC_CSR_LPWRRSTF (1 << 31)
692#define RCC_CSR_WWDGRSTF (1 << 30)
693#define RCC_CSR_IWDGRSTF (1 << 29)
694#define RCC_CSR_SFTRSTF (1 << 28)
695#define RCC_CSR_BORRSTF (1 << 27)
696#define RCC_CSR_PINRSTF (1 << 26)
697#define RCC_CSR_OBLRSTF (1 << 25)
698#define RCC_CSR_RMVF (1 << 23)
699#define RCC_CSR_RESET_FLAGS (RCC_CSR_LPWRRSTF | RCC_CSR_WWDGRSTF |\
700 RCC_CSR_IWDGRSTF | RCC_CSR_SFTRSTF | RCC_CSR_BORRSTF |\
701 RCC_CSR_PINRSTF | RCC_CSR_OBLRSTF)
703#define RCC_CSR_LSIRDY (1 << 1)
704#define RCC_CSR_LSION (1 << 0)
710#define RCC_CRRCR_HSI48VAL_MASK 0x1ff
711#define RCC_CRRCR_HSI48VAL_SHIFT 7
713#define RCC_CRRCR_HSI48RDY BIT1
714#define RCC_CRRCR_HSI48ON BIT0
779#define _REG_BIT(base, bit) (((base) << 5) + (bit))
int rcc_osc_ready_int_flag(enum rcc_osc osc)
void rcc_clock_setup_hse_3v3(const struct rcc_clock_scale *clock)
Setup clocks with the HSE.
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_css_disable(void)
void rcc_set_sysclk_source(uint32_t clk)
uint32_t rcc_apb2_frequency
void rcc_set_pll_source(uint32_t pllsrc)
uint32_t rcc_system_clock_source(void)
const struct rcc_clock_scale rcc_hse_8mhz_3v3[RCC_CLOCK_3V3_END]
uint32_t rcc_get_usart_clk_freq(uint32_t usart)
Get the peripheral clock speed for the specified (LP)UxART.
const struct rcc_clock_scale rcc_hsi_configs[RCC_CLOCK_3V3_END]
void rcc_clock_setup_pll(const struct rcc_clock_scale *clock)
Setup clocks to run from PLL.
const struct rcc_clock_scale rcc_hse_12mhz_3v3[RCC_CLOCK_3V3_END]
void rcc_osc_ready_int_enable(enum rcc_osc osc)
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_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_set_main_pll(uint32_t pllsrc, uint32_t pllm, uint32_t plln, uint32_t pllp, uint32_t pllq, uint32_t pllr)
Reconfigures the main PLL for a HSE source.
void rcc_set_ppre2(uint32_t ppre2)
void rcc_css_enable(void)
void rcc_set_hpre(uint32_t hpre)
rcc_clock_source
Enumerations for core system/bus clocks for user/driver/system access to base bus clocks not directly...
const struct rcc_clock_scale rcc_hse_16mhz_3v3[RCC_CLOCK_3V3_END]
#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_APB2SMENR_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_APB1SMENR2_OFFSET
#define RCC_AHB1ENR_OFFSET
#define RCC_APB1SMENR1_OFFSET
enum pwr_vos_scale vos_scale