31#ifndef LIBOPENCM3_RCC_H
32#define LIBOPENCM3_RCC_H
38#define RCC_CR MMIO32(RCC_BASE + 0x00)
39#define RCC_ICSCR MMIO32(RCC_BASE + 0x04)
40#define RCC_CFGR MMIO32(RCC_BASE + 0x08)
41#define RCC_PLLCFGR MMIO32(RCC_BASE + 0x0c)
42#define RCC_CIER MMIO32(RCC_BASE + 0x18)
43#define RCC_CIFR MMIO32(RCC_BASE + 0x1c)
44#define RCC_CICR MMIO32(RCC_BASE + 0x20)
45#define RCC_IOPRSTR_OFFSET 0x24
46#define RCC_IOPRSTR MMIO32(RCC_BASE + RCC_IOPRSTR_OFFSET)
47#define RCC_AHBRSTR_OFFSET 0x28
48#define RCC_AHBRSTR MMIO32(RCC_BASE + RCC_AHBRSTR_OFFSET)
49#define RCC_APBRSTR1_OFFSET 0x2c
50#define RCC_APBRSTR1 MMIO32(RCC_BASE + RCC_APBRSTR1_OFFSET)
51#define RCC_APBRSTR2_OFFSET 0x30
52#define RCC_APBRSTR2 MMIO32(RCC_BASE + RCC_APBRSTR2_OFFSET)
53#define RCC_IOPENR_OFFSET 0x34
54#define RCC_IOPENR MMIO32(RCC_BASE + RCC_IOPENR_OFFSET)
55#define RCC_AHBENR_OFFSET 0x38
56#define RCC_AHBENR MMIO32(RCC_BASE + RCC_AHBENR_OFFSET)
57#define RCC_APBENR1_OFFSET 0x3c
58#define RCC_APBENR1 MMIO32(RCC_BASE + RCC_APBENR1_OFFSET)
59#define RCC_APBENR2_OFFSET 0x40
60#define RCC_APBENR2 MMIO32(RCC_BASE + RCC_APBENR2_OFFSET)
61#define RCC_IOPSMENR_OFFSET 0x44
62#define RCC_IOPSMENR MMIO32(RCC_BASE + RCC_IOPSMENR_OFFSET)
63#define RCC_AHBSMENR_OFFSET 0x48
64#define RCC_AHBSMENR MMIO32(RCC_BASE + RCC_AHBSMENR_OFFSET)
65#define RCC_APBSMENR1_OFFSET 0x4c
66#define RCC_APBSMENR1 MMIO32(RCC_BASE + RCC_APBSMENR1_OFFSET)
67#define RCC_APBSMENR2_OFFSET 0x50
68#define RCC_APBSMENR2 MMIO32(RCC_BASE + RCC_APBSMENR2_OFFSET)
69#define RCC_CCIPR MMIO32(RCC_BASE + 0x54)
70#define RCC_BDCR MMIO32(RCC_BASE + 0x5c)
71#define RCC_CSR MMIO32(RCC_BASE + 0x60)
76#define RCC_CR_PLLRDY (1 << 25)
77#define RCC_CR_PLLON (1 << 24)
78#define RCC_CR_CSSON (1 << 19)
79#define RCC_CR_HSEBYP (1 << 18)
80#define RCC_CR_HSERDY (1 << 17)
81#define RCC_CR_HSEON (1 << 16)
83#define RCC_CR_HSIDIV_SHIFT 11
84#define RCC_CR_HSIDIV_MASK 0x7
89#define RCC_CR_HSIDIV_DIV1 0
90#define RCC_CR_HSIDIV_DIV2 1
91#define RCC_CR_HSIDIV_DIV4 2
92#define RCC_CR_HSIDIV_DIV8 3
93#define RCC_CR_HSIDIV_DIV16 4
94#define RCC_CR_HSIDIV_DIV32 5
95#define RCC_CR_HSIDIV_DIV64 6
96#define RCC_CR_HSIDIV_DIV128 7
99#define RCC_CR_HSIRDY (1 << 10)
100#define RCC_CR_HSIKERON (1 << 9)
101#define RCC_CR_HSION (1 << 8)
107#define RCC_ICSCR_HSITRIM_SHIFT 8
108#define RCC_ICSCR_HSITRIM_MASK 0x1f
109#define RCC_ICSCR_HSICAL_SHIFT 0
110#define RCC_ICSCR_HSICAL_MASK 0xff
116#define RCC_CFGR_MCOPRE_SHIFT 28
117#define RCC_CFGR_MCOPRE_MASK 0x7
122#define RCC_CFGR_MCOPRE_DIV1 0
123#define RCC_CFGR_MCOPRE_DIV2 1
124#define RCC_CFGR_MCOPRE_DIV4 2
125#define RCC_CFGR_MCOPRE_DIV8 3
126#define RCC_CFGR_MCOPRE_DIV16 4
127#define RCC_CFGR_MCOPRE_DIV32 5
128#define RCC_CFGR_MCOPRE_DIV64 6
129#define RCC_CFGR_MCOPRE_DIV128 7
132#define RCC_CFGR_MCO_SHIFT 24
133#define RCC_CFGR_MCO_MASK 0xf
139#define RCC_CFGR_MCO_NOCLK 0x0
140#define RCC_CFGR_MCO_SYSCLK 0x1
141#define RCC_CFGR_MCO_HSI16 0x3
142#define RCC_CFGR_MCO_HSE 0x4
143#define RCC_CFGR_MCO_PLLRCLK 0x5
144#define RCC_CFGR_MCO_LSI 0x6
145#define RCC_CFGR_MCO_LSE 0x7
148#define RCC_CFGR_PPRE_MASK 0x7
149#define RCC_CFGR_PPRE_SHIFT 12
155#define RCC_CFGR_PPRE_NODIV 0x0
156#define RCC_CFGR_PPRE_DIV2 0x4
157#define RCC_CFGR_PPRE_DIV4 0x5
158#define RCC_CFGR_PPRE_DIV8 0x6
159#define RCC_CFGR_PPRE_DIV16 0x7
162#define RCC_CFGR_HPRE_MASK 0xf
163#define RCC_CFGR_HPRE_SHIFT 8
168#define RCC_CFGR_HPRE_NODIV 0x0
169#define RCC_CFGR_HPRE_DIV2 0x8
170#define RCC_CFGR_HPRE_DIV4 0x9
171#define RCC_CFGR_HPRE_DIV8 0xa
172#define RCC_CFGR_HPRE_DIV16 0xb
173#define RCC_CFGR_HPRE_DIV64 0xc
174#define RCC_CFGR_HPRE_DIV128 0xd
175#define RCC_CFGR_HPRE_DIV256 0xe
176#define RCC_CFGR_HPRE_DIV512 0xf
179#define RCC_CFGR_SWS_MASK 0x3
180#define RCC_CFGR_SWS_SHIFT 3
185#define RCC_CFGR_SWS_HSISYS 0x0
186#define RCC_CFGR_SWS_HSE 0x1
187#define RCC_CFGR_SWS_PLLRCLK 0x2
188#define RCC_CFGR_SWS_LSI 0x3
189#define RCC_CFGR_SWS_LSE 0x4
192#define RCC_CFGR_SW_MASK 0x3
193#define RCC_CFGR_SW_SHIFT 0
198#define RCC_CFGR_SW_HSISYS 0x0
199#define RCC_CFGR_SW_HSE 0x1
200#define RCC_CFGR_SW_PLLRCLK 0x2
201#define RCC_CFGR_SW_LSI 0x3
202#define RCC_CFGR_SW_LSE 0x4
210#define RCC_PLLCFGR_PLLR_SHIFT 29
211#define RCC_PLLCFGR_PLLR_MASK 0x7
216#define RCC_PLLCFGR_PLLR_DIV(x) ((x)-1)
219#define RCC_PLLCFGR_PLLREN (1<<28)
221#define RCC_PLLCFGR_PLLQ_SHIFT 25
222#define RCC_PLLCFGR_PLLQ_MASK 0x7
227#define RCC_PLLCFGR_PLLQ_DIV(x) ((x)-1)
230#define RCC_PLLCFGR_PLLQEN (1 << 24)
232#define RCC_PLLCFGR_PLLP_SHIFT 17
233#define RCC_PLLCFGR_PLLP_MASK 0x1f
238#define RCC_PLLCFGR_PLLP_DIV(x) ((x)-1)
241#define RCC_PLLCFGR_PLLPEN (1 << 16)
243#define RCC_PLLCFGR_PLLN_SHIFT 0x8
244#define RCC_PLLCFGR_PLLN_MASK 0x7f
248#define RCC_PLLCFGR_PLLN_MUL(x) (x)
251#define RCC_PLLCFGR_PLLM_SHIFT 0x4
252#define RCC_PLLCFGR_PLLM_MASK 0x7
256#define RCC_PLLCFGR_PLLM_DIV(x) ((x)-1)
259#define RCC_PLLCFGR_PLLSRC_SHIFT 0
260#define RCC_PLLCFGR_PLLSRC_MASK 0x3
265#define RCC_PLLCFGR_PLLSRC_NONE 0
266#define RCC_PLLCFGR_PLLSRC_HSI16 2
267#define RCC_PLLCFGR_PLLSRC_HSE 3
273#define RCC_CIER_PLLRDYIE (1 << 5)
274#define RCC_CIER_HSERDYIE (1 << 4)
275#define RCC_CIER_HSIRDYIE (1 << 3)
276#define RCC_CIER_LSERDYIE (1 << 1)
277#define RCC_CIER_LSIRDYIE (1 << 0)
282#define RCC_CIFR_LSECSSF (1 << 9)
283#define RCC_CIFR_CSSF (1 << 8)
284#define RCC_CIFR_PLLRDYF (1 << 5)
285#define RCC_CIFR_HSERDYF (1 << 4)
286#define RCC_CIFR_HSIRDYF (1 << 3)
287#define RCC_CIFR_LSERDYF (1 << 1)
288#define RCC_CIFR_LSIRDYF (1 << 0)
293#define RCC_CICR_LSECSSC (1 << 9)
294#define RCC_CICR_CSSC (1 << 8)
295#define RCC_CICR_PLLRDYC (1 << 5)
296#define RCC_CICR_HSERDYC (1 << 4)
297#define RCC_CICR_HSIRDYC (1 << 3)
298#define RCC_CICR_LSERDYC (1 << 1)
299#define RCC_CICR_LSIRDYC (1 << 0)
304#define RCC_AHBRSTR_RNGRST (1 << 18)
305#define RCC_AHBRSTR_AESRST (1 << 16)
306#define RCC_AHBRSTR_CRCRST (1 << 12)
307#define RCC_AHBRSTR_FLASHRST (1 << 8)
308#define RCC_AHBRSTR_DMA2RST (1 << 1)
309#define RCC_AHBRSTR_DMA1RST (1 << 0)
310#define RCC_AHBRSTR_DMARST RCC_AHBRSTR_DMA1RST
317#define RCC_APBRSTR1_LPTIM1RST (1 << 31)
318#define RCC_APBRSTR1_LPTIM2RST (1 << 30)
319#define RCC_APBRSTR1_DAC1RST (1 << 29)
320#define RCC_APBRSTR1_PWRRST (1 << 28)
321#define RCC_APBRSTR1_DBGRST (1 << 27)
322#define RCC_APBRSTR1_UCPD2RST (1 << 26)
323#define RCC_APBRSTR1_UCPD1RST (1 << 25)
324#define RCC_APBRSTR1_CECRST (1 << 24)
325#define RCC_APBRSTR1_I2C3RST (1 << 23)
326#define RCC_APBRSTR1_I2C2RST (1 << 22)
327#define RCC_APBRSTR1_I2C1RST (1 << 21)
328#define RCC_APBRSTR1_LPUART1RST (1 << 20)
329#define RCC_APBRSTR1_USART4RST (1 << 19)
330#define RCC_APBRSTR1_USART3RST (1 << 18)
331#define RCC_APBRSTR1_USART2RST (1 << 17)
332#define RCC_APBRSTR1_CRSRST (1 << 16)
333#define RCC_APBRSTR1_SPI3RST (1 << 15)
334#define RCC_APBRSTR1_SPI2RST (1 << 14)
335#define RCC_APBRSTR1_USBRST (1 << 13)
336#define RCC_APBRSTR1_FDCANRST (1 << 12)
337#define RCC_APBRSTR1_USART6RST (1 << 9)
338#define RCC_APBRSTR1_USART5RST (1 << 8)
339#define RCC_APBRSTR1_LPUART2RST (1 << 7)
340#define RCC_APBRSTR1_TIM7RST (1 << 5)
341#define RCC_APBRSTR1_TIM6RST (1 << 4)
342#define RCC_APBRSTR1_TIM4RST (1 << 2)
343#define RCC_APBRSTR1_TIM3RST (1 << 1)
344#define RCC_APBRSTR1_TIM2RST (1 << 0)
349#define RCC_APBRSTR2_ADCRST (1 << 20)
350#define RCC_APBRSTR2_TIM17RST (1 << 18)
351#define RCC_APBRSTR2_TIM16RST (1 << 17)
352#define RCC_APBRSTR2_TIM15RST (1 << 16)
353#define RCC_APBRSTR2_TIM14RST (1 << 15)
354#define RCC_APBRSTR2_USART1RST (1 << 14)
355#define RCC_APBRSTR2_SPI1RST (1 << 12)
356#define RCC_APBRSTR2_TIM1RST (1 << 11)
357#define RCC_APBRSTR2_SYSCFGRST (1 << 0)
363#define RCC_AHBENR_RNGEN (1 << 18)
364#define RCC_AHBENR_AESEN (1 << 16)
365#define RCC_AHBENR_CRCEN (1 << 12)
366#define RCC_AHBENR_FLASHEN (1 << 8)
367#define RCC_AHBENR_DMA2EN (1 << 1)
368#define RCC_AHBENR_DMA1EN (1 << 0)
369#define RCC_AHBENR_DMAEN RCC_AHBENR_DMA1EN
376#define RCC_APBENR1_LPTIM1EN (1 << 31)
377#define RCC_APBENR1_LPTIM2EN (1 << 30)
378#define RCC_APBENR1_DAC1EN (1 << 29)
379#define RCC_APBENR1_PWREN (1 << 28)
380#define RCC_APBENR1_DBGEN (1 << 27)
381#define RCC_APBENR1_UCPD2EN (1 << 26)
382#define RCC_APBENR1_UCPD1EN (1 << 25)
383#define RCC_APBENR1_CECEN (1 << 24)
384#define RCC_APBENR1_I2C2EN (1 << 22)
385#define RCC_APBENR1_I2C1EN (1 << 21)
386#define RCC_APBENR1_LPUART1EN (1 << 20)
387#define RCC_APBENR1_USART4EN (1 << 19)
388#define RCC_APBENR1_USART3EN (1 << 18)
389#define RCC_APBENR1_USART2EN (1 << 17)
390#define RCC_APBENR1_SPI2EN (1 << 14)
391#define RCC_APBENR1_WWDGEN (1 << 11)
392#define RCC_APBENR1_RTCAPBEN (1 << 10)
393#define RCC_APBENR1_TIM7EN (1 << 5)
394#define RCC_APBENR1_TIM6EN (1 << 4)
395#define RCC_APBENR1_TIM3EN (1 << 1)
396#define RCC_APBENR1_TIM2EN (1 << 0)
401#define RCC_APBENR2_ADCEN (1 << 20)
402#define RCC_APBENR2_TIM17EN (1 << 18)
403#define RCC_APBENR2_TIM16EN (1 << 17)
404#define RCC_APBENR2_TIM16EN (1 << 17)
405#define RCC_APBENR2_TIM15EN (1 << 16)
406#define RCC_APBENR2_TIM14EN (1 << 15)
407#define RCC_APBENR2_USART1EN (1 << 14)
408#define RCC_APBENR2_SPI1EN (1 << 12)
409#define RCC_APBENR2_TIM1EN (1 << 11)
410#define RCC_APBENR2_SYSCFGEN (1 << 0)
416#define RCC_AHBSMENR_RNGSMEN (1 << 18)
417#define RCC_AHBSMENR_AESSMEN (1 << 16)
418#define RCC_AHBSMENR_CRCSMEN (1 << 12)
419#define RCC_AHBSMENR_SRAMSMEN (1 << 9)
420#define RCC_AHBSMENR_FLASHSMEN (1 << 8)
421#define RCC_AHBSMENR_DMASMEN (1 << 0)
426#define RCC_APBSMENR1_LPTIM1SMEN (1 << 31)
427#define RCC_APBSMENR1_LPTIM2SMEN (1 << 30)
428#define RCC_APBSMENR1_DAC1SMEN (1 << 29)
429#define RCC_APBSMENR1_PWRSMEN (1 << 28)
430#define RCC_APBSMENR1_DBGSMEN (1 << 27)
431#define RCC_APBSMENR1_UCPD2SMEN (1 << 26)
432#define RCC_APBSMENR1_UCPD1SMEN (1 << 25)
433#define RCC_APBSMENR1_CECSMEN (1 << 24)
434#define RCC_APBSMENR1_I2C2SMEN (1 << 22)
435#define RCC_APBSMENR1_I2C1SMEN (1 << 21)
436#define RCC_APBSMENR1_LPUART1SMEN (1 << 20)
437#define RCC_APBSMENR1_USART4SMEN (1 << 19)
438#define RCC_APBSMENR1_USART3SMEN (1 << 18)
439#define RCC_APBSMENR1_USART2SMEN (1 << 17)
440#define RCC_APBSMENR1_SPI2SMEN (1 << 14)
441#define RCC_APBSMENR1_WWDGSMEN (1 << 11)
442#define RCC_APBSMENR1_RTCAPBSMEN (1 << 10)
443#define RCC_APBSMENR1_TIM7SMEN (1 << 5)
444#define RCC_APBSMENR1_TIM6SMEN (1 << 4)
445#define RCC_APBSMENR1_TIM3SMEN (1 << 1)
446#define RCC_APBSMENR1_TIM2SMEN (1 << 0)
451#define RCC_APBSMENR2_ADCSMEN (1 << 20)
452#define RCC_APBSMENR2_TIM17SMEN (1 << 18)
453#define RCC_APBSMENR2_TIM16SMEN (1 << 17)
454#define RCC_APBSMENR2_TIM15SMEN (1 << 16)
455#define RCC_APBSMENR2_TIM14SMEN (1 << 15)
456#define RCC_APBSMENR2_USART1SMEN (1 << 14)
457#define RCC_APBSMENR2_SPI1SMEN (1 << 12)
458#define RCC_APBSMENR2_TIM1SMEN (1 << 11)
459#define RCC_APBSMENR2_SYSCFGSMEN (1 << 0)
465#define RCC_CCIPR_ADCSEL_MASK 0x3
466#define RCC_CCIPR_ADCSEL_SHIFT 30
469#define RCC_CCIPR_ADCSEL_SYSCLK 0
470#define RCC_CCIPR_ADCSEL_PLLPCLK 1
471#define RCC_CCIPR_ADCSEL_HSI16 2
474#define RCC_CCIPR_RNGDIV_MASK 0x3
475#define RCC_CCIPR_RNGDIV_SHIFT 28
478#define RCC_CCIPR_RNGDIV_1 0
479#define RCC_CCIPR_RNGDIV_2 1
480#define RCC_CCIPR_RNGDIV_4 2
481#define RCC_CCIPR_RNGDIV_8 3
484#define RCC_CCIPR_RNGSEL_MASK 0x3
485#define RCC_CCIPR_RNGSEL_SHIFT 26
488#define RCC_CCIPR_RNGSEL_NONE 0
489#define RCC_CCIPR_RNGSEL_HSI16 1
490#define RCC_CCIPR_RNGSEL_SYSCLK 2
491#define RCC_CCIPR_RNGSEL_PLLQCLK 3
494#define RCC_CCIPR_TIM15SEL_MASK 0x1
495#define RCC_CCIPR_TIM15SEL_SHIFT 24
498#define RCC_CCIPR_TIM15SEL_TIMPCLK 0
499#define RCC_CCIPR_TIM15SEL_PLLQCLK 1
502#define RCC_CCIPR_TIM1SEL_MASK 0x1
503#define RCC_CCIPR_TIM1SEL_SHIFT 22
506#define RCC_CCIPR_TIM1SEL_TIMPCLK 0
507#define RCC_CCIPR_TIM1SEL_PLLQCLK 1
510#define RCC_CCIPR_LPTIM2SEL_MASK 0x3
511#define RCC_CCIPR_LPTIM2SEL_SHIFT 20
514#define RCC_CCIPR_LPTIM2SEL_PCLK 0
515#define RCC_CCIPR_LPTIM2SEL_LSI 1
516#define RCC_CCIPR_LPTIM2SEL_HSI16 2
517#define RCC_CCIPR_LPTIM2SEL_LSE 3
520#define RCC_CCIPR_LPTIM1SEL_MASK 0x3
521#define RCC_CCIPR_LPTIM1SEL_SHIFT 18
524#define RCC_CCIPR_LPTIM1SEL_PCLK 0
525#define RCC_CCIPR_LPTIM1SEL_LSI 1
526#define RCC_CCIPR_LPTIM1SEL_HSI16 2
527#define RCC_CCIPR_LPTIM1SEL_LSE 3
530#define RCC_CCIPR_I2S1SEL_MASK 0x3
531#define RCC_CCIPR_I2S1SEL_SHIFT 14
534#define RCC_CCIPR_I2S1SEL_SYSCLK 0
535#define RCC_CCIPR_I2S1SEL_PLLPLCK 1
536#define RCC_CCIPR_I2S1SEL_HSI16 2
537#define RCC_CCIPR_I2S1SEL_I2S_CKIN 3
540#define RCC_CCIPR_I2CxSEL_MASK 0x3
541#define RCC_CCIPR_I2C1SEL_SHIFT 12
542#define RCC_CCIPR_I2C2SEL_SHIFT 14
545#define RCC_CCIPR_I2CxSEL_PCLK 0
546#define RCC_CCIPR_I2CxSEL_SYSCLK 1
547#define RCC_CCIPR_I2CxSEL_HSI16 2
550#define RCC_CCIPR_LPUARTxSEL_MASK 0x3
551#define RCC_CCIPR_LPUART1SEL_SHIFT 10
552#define RCC_CCIPR_LPUART2SEL_SHIFT 8
555#define RCC_CCIPR_LPUARTxSEL_PCLK 0
556#define RCC_CCIPR_LPUARTxSEL_SYSCLK 1
557#define RCC_CCIPR_LPUARTxSEL_HSI16 2
558#define RCC_CCIPR_LPUARTxSEL_LSE 3
561#define RCC_CCIPR_CECSEL_MASK 0x1
562#define RCC_CCIPR_CECSEL_SHIFT 6
565#define RCC_CCIPR_CECSEL_HSI16 0
566#define RCC_CCIPR_CECSEL_LSE 1
569#define RCC_CCIPR_USARTxSEL_MASK RCC_CCIPR_LPUARTxSEL_MASK
570#define RCC_CCIPR_USART3SEL_SHIFT 4
571#define RCC_CCIPR_USART2SEL_SHIFT 2
572#define RCC_CCIPR_USART1SEL_SHIFT 0
575#define RCC_CCIPR_USARTxSEL_PCLK RCC_CCIPR_LPUARTxSEL_PCLK
576#define RCC_CCIPR_USARTxSEL_SYSCLK RCC_CCIPR_LPUARTxSEL_SYSCLK
577#define RCC_CCIPR_USARTxSEL_HSI16 RCC_CCIPR_LPUARTxSEL_HSI16
578#define RCC_CCIPR_USARTxSEL_LSE RCC_CCIPR_LPUARTxSEL_LSE
585#define RCC_BDCR_LSCOSEL (1 << 25)
586#define RCC_BDCR_LSCOEN (1 << 24)
587#define RCC_BDCR_BDRST (1 << 16)
588#define RCC_BDCR_RTCEN (1 << 15)
590#define RCC_BDCR_RTCSEL_SHIFT 8
591#define RCC_BDCR_RTCSEL_MASK 0x3
594#define RCC_BDCR_RTCSEL_NONE 0
595#define RCC_BDCR_RTCSEL_LSE 1
596#define RCC_BDCR_RTCSEL_LSI 2
597#define RCC_BDCR_RTCSEL_HSE_DIV32 3
600#define RCC_BDCR_LSEDRV_SHIFT 3
601#define RCC_BDCR_LSEDRV_MASK 0x3
604#define RCC_BDCR_LSEDRV_LOW 0
605#define RCC_BDCR_LSEDRV_MEDLOW 1
606#define RCC_BDCR_LSEDRV_MEDHIGH 2
607#define RCC_BDCR_LSEDRV_HIGH 3
610#define RCC_BDCR_LSEBYP (1 << 2)
611#define RCC_BDCR_LSERDY (1 << 1)
612#define RCC_BDCR_LSEON (1 << 0)
617#define RCC_CSR_LPWRRSTF (1 << 31)
618#define RCC_CSR_WWDGRSTF (1 << 30)
619#define RCC_CSR_IWDGRSTF (1 << 29)
620#define RCC_CSR_SFTRSTF (1 << 28)
621#define RCC_CSR_PWRRSTF (1 << 27)
622#define RCC_CSR_PINRSTF (1 << 26)
623#define RCC_CSR_OBLRSTF (1 << 25)
624#define RCC_CSR_RMVF (1 << 23)
625#define RCC_CSR_LSIRDY (1 << 1)
626#define RCC_CSR_LSION (1 << 0)
637#define rcc_apb2_frequency rcc_apb1_frequency
641#define _REG_BIT(offset, bit) (((offset) << 5) + (bit))
872void rcc_set_main_pll(uint32_t source, uint32_t pllm, uint32_t plln, uint32_t pllp, uint32_t pllq, uint32_t pllr);
void rcc_set_ppre(uint32_t ppre)
Configure APB peripheral clock prescaler.
void rcc_enable_pllr(bool enable)
Enable PLL R clock output.
int rcc_css_int_flag(void)
void rcc_enable_pllp(bool enable)
Enable PLL P clock output.
void rcc_set_main_pll(uint32_t source, uint32_t pllm, uint32_t plln, uint32_t pllp, uint32_t pllq, uint32_t pllr)
Configure pll source and output frequencies.
void rcc_css_disable(void)
enum rcc_osc rcc_system_clock_source(void)
Return the clock source which is used as system clock.
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_pll_source(uint32_t pllsrc)
Configure pll source.
uint32_t rcc_get_timer_clk_freq(uint32_t timer)
Get the peripheral clock speed for the Timer at base specified.
uint32_t rcc_get_usart_clk_freq(uint32_t usart)
Get the peripheral clock speed for the USART at base specified.
void rcc_set_hsisys_div(uint32_t hsidiv)
Configure HSI16 clock division factor to feed SYSCLK.
void rcc_enable_pllq(bool enable)
Enable PLL Q clock output.
void rcc_set_peripheral_clk_sel(uint32_t periph, uint32_t sel)
Set the peripheral clock source.
void rcc_osc_on(enum rcc_osc osc)
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_clock_setup(const struct rcc_clock_scale *clock)
Setup sysclock with desired source (HSE/HSI/PLL/LSE/LSI).
const struct rcc_clock_scale rcc_clock_config[RCC_CLOCK_CONFIG_END]
#define _REG_BIT(offset, bit)
uint32_t rcc_apb1_frequency
void rcc_wait_for_sysclk_status(enum rcc_osc osc)
Wait until system clock switched to given oscillator.
void rcc_css_int_clear(void)
void rcc_set_rng_clk_div(uint32_t rng_div)
Setup RNG Peripheral Clock Divider.
void rcc_css_enable(void)
void rcc_set_hpre(uint32_t hpre)
Configure AHB peripheral clock prescaler.
void rcc_set_mcopre(uint32_t mcopre)
Configure mco prescaler.
void rcc_set_sysclk_source(enum rcc_osc osc)
Set the Source for the System Clock.
@ RCC_CLOCK_CONFIG_HSE_12MHZ_PLL_64MHZ
@ RCC_CLOCK_CONFIG_HSI_PLL_32MHZ
@ RCC_CLOCK_CONFIG_HSI_4MHZ
@ RCC_CLOCK_CONFIG_LSI_32KHZ
@ RCC_CLOCK_CONFIG_HSI_PLL_64MHZ
@ RCC_CLOCK_CONFIG_HSI_16MHZ
#define RCC_AHBRSTR_OFFSET
#define RCC_APBSMENR2_OFFSET
#define RCC_APBSMENR1_OFFSET
#define RCC_IOPRSTR_OFFSET
#define RCC_APBENR2_OFFSET
#define RCC_AHBSMENR_OFFSET
#define RCC_AHBENR_OFFSET
#define RCC_APBRSTR1_OFFSET
#define RCC_IOPSMENR_OFFSET
#define RCC_APBRSTR2_OFFSET
#define RCC_APBENR1_OFFSET
#define RCC_IOPENR_OFFSET
enum pwr_vos_scale voltage_scale
enum rcc_osc sysclock_source