46#ifndef LIBOPENCM3_RCC_H
47#define LIBOPENCM3_RCC_H
55#define RCC_CR MMIO32(RCC_BASE + 0x00)
57#define RCC_PLLCFGR MMIO32(RCC_BASE + 0x04)
59#define RCC_CFGR MMIO32(RCC_BASE + 0x08)
61#define RCC_CIR MMIO32(RCC_BASE + 0x0c)
63#define RCC_AHB1RSTR MMIO32(RCC_BASE + 0x10)
65#define RCC_AHB2RSTR MMIO32(RCC_BASE + 0x14)
67#define RCC_AHB3RSTR MMIO32(RCC_BASE + 0x18)
70#define RCC_APB1RSTR MMIO32(RCC_BASE + 0x20)
72#define RCC_APB2RSTR MMIO32(RCC_BASE + 0x24)
76#define RCC_AHB1ENR MMIO32(RCC_BASE + 0x30)
78#define RCC_AHB2ENR MMIO32(RCC_BASE + 0x34)
80#define RCC_AHB3ENR MMIO32(RCC_BASE + 0x38)
83#define RCC_APB1ENR MMIO32(RCC_BASE + 0x40)
85#define RCC_APB2ENR MMIO32(RCC_BASE + 0x44)
89#define RCC_AHB1LPENR MMIO32(RCC_BASE + 0x50)
91#define RCC_AHB2LPENR MMIO32(RCC_BASE + 0x54)
93#define RCC_AHB3LPENR MMIO32(RCC_BASE + 0x58)
96#define RCC_APB1LPENR MMIO32(RCC_BASE + 0x60)
98#define RCC_APB2LPENR MMIO32(RCC_BASE + 0x64)
102#define RCC_BDCR MMIO32(RCC_BASE + 0x70)
104#define RCC_CSR MMIO32(RCC_BASE + 0x74)
108#define RCC_SSCGR MMIO32(RCC_BASE + 0x80)
110#define RCC_PLLI2SCFGR MMIO32(RCC_BASE + 0x84)
112#define RCC_PLLSAICFGR MMIO32(RCC_BASE + 0x88)
114#define RCC_DCKCFGR MMIO32(RCC_BASE + 0x8C)
116#define RCC_CKGATENR MMIO32(RCC_BASE + 0x90)
118#define RCC_DCKCFGR2 MMIO32(RCC_BASE + 0x94)
125#define RCC_CR_PLLSAIRDY (1 << 29)
126#define RCC_CR_PLLSAION (1 << 28)
127#define RCC_CR_PLLI2SRDY (1 << 27)
128#define RCC_CR_PLLI2SON (1 << 26)
129#define RCC_CR_PLLRDY (1 << 25)
130#define RCC_CR_PLLON (1 << 24)
131#define RCC_CR_CSSON (1 << 19)
132#define RCC_CR_HSEBYP (1 << 18)
133#define RCC_CR_HSERDY (1 << 17)
134#define RCC_CR_HSEON (1 << 16)
137#define RCC_CR_HSITRIM_SHIFT 3
138#define RCC_CR_HSITRIM_MASK 0x1f
139#define RCC_CR_HSIRDY (1 << 1)
140#define RCC_CR_HSION (1 << 0)
148#define RCC_PLLCFGR_PLLR_SHIFT 28
149#define RCC_PLLCFGR_PLLR_MASK 0x7
151#define RCC_PLLCFGR_PLLQ_SHIFT 24
152#define RCC_PLLCFGR_PLLQ_MASK 0xf
153#define RCC_PLLCFGR_PLLSRC (1 << 22)
155#define RCC_PLLCFGR_PLLP_SHIFT 16
156#define RCC_PLLCFGR_PLLP_MASK 0x3
158#define RCC_PLLCFGR_PLLN_SHIFT 6
159#define RCC_PLLCFGR_PLLN_MASK 0x1ff
161#define RCC_PLLCFGR_PLLM_SHIFT 0
162#define RCC_PLLCFGR_PLLM_MASK 0x3f
170#define RCC_CFGR_MCO2_SHIFT 30
171#define RCC_CFGR_MCO2_MASK 0x3
172#define RCC_CFGR_MCO2_SYSCLK 0x0
173#define RCC_CFGR_MCO2_PLLI2S 0x1
174#define RCC_CFGR_MCO2_HSE 0x2
175#define RCC_CFGR_MCO2_PLL 0x3
178#define RCC_CFGR_MCO2PRE_SHIFT 27
179#define RCC_CFGR_MCO2PRE_MASK 0x7
180#define RCC_CFGR_MCO1PRE_SHIFT 24
181#define RCC_CFGR_MCO1PRE_MASK 0x7
182#define RCC_CFGR_MCOPRE_DIV_NONE 0x0
183#define RCC_CFGR_MCOPRE_DIV_2 0x4
184#define RCC_CFGR_MCOPRE_DIV_3 0x5
185#define RCC_CFGR_MCOPRE_DIV_4 0x6
186#define RCC_CFGR_MCOPRE_DIV_5 0x7
189#define RCC_CFGR_PLLSRC_HSI_CLK 0x0
190#define RCC_CFGR_PLLSRC_HSE_CLK 0x1
193#define RCC_CFGR_I2SSRC (1 << 23)
196#define RCC_CFGR_MCO1_SHIFT 21
197#define RCC_CFGR_MCO1_MASK 0x3
198#define RCC_CFGR_MCO1_HSI 0x0
199#define RCC_CFGR_MCO1_LSE 0x1
200#define RCC_CFGR_MCO1_HSE 0x2
201#define RCC_CFGR_MCO1_PLL 0x3
202#define RCC_CFGR_MCO_SHIFT RCC_CFGR_MCO1_SHIFT
203#define RCC_CFGR_MCO_MASK RCC_CFGR_MCO1_MASK
206#define RCC_CFGR_RTCPRE_SHIFT 16
207#define RCC_CFGR_RTCPRE_MASK 0x1f
209#define RCC_CFGR_PPRE2_SHIFT 13
210#define RCC_CFGR_PPRE2_MASK 0x7
211#define RCC_CFGR_PPRE1_SHIFT 10
212#define RCC_CFGR_PPRE1_MASK 0x7
217#define RCC_CFGR_PPRE_NODIV 0x0
218#define RCC_CFGR_PPRE_DIV2 0x4
219#define RCC_CFGR_PPRE_DIV4 0x5
220#define RCC_CFGR_PPRE_DIV8 0x6
221#define RCC_CFGR_PPRE_DIV16 0x7
224#define RCC_CFGR_HPRE_SHIFT 4
225#define RCC_CFGR_HPRE_MASK 0xf
228#define RCC_CFGR_HPRE_NODIV 0x0
229#define RCC_CFGR_HPRE_DIV2 (0x8 + 0)
230#define RCC_CFGR_HPRE_DIV4 (0x8 + 1)
231#define RCC_CFGR_HPRE_DIV8 (0x8 + 2)
232#define RCC_CFGR_HPRE_DIV16 (0x8 + 3)
233#define RCC_CFGR_HPRE_DIV64 (0x8 + 4)
234#define RCC_CFGR_HPRE_DIV128 (0x8 + 5)
235#define RCC_CFGR_HPRE_DIV256 (0x8 + 6)
236#define RCC_CFGR_HPRE_DIV512 (0x8 + 7)
240#define RCC_CFGR_SWS_SHIFT 2
241#define RCC_CFGR_SWS_MASK 0x3
242#define RCC_CFGR_SWS_HSI 0x0
243#define RCC_CFGR_SWS_HSE 0x1
244#define RCC_CFGR_SWS_PLL 0x2
247#define RCC_CFGR_SW_SHIFT 0
248#define RCC_CFGR_SW_HSI 0x0
249#define RCC_CFGR_SW_HSE 0x1
250#define RCC_CFGR_SW_PLL 0x2
258#define RCC_CFGR_PPRE_DIV_NONE 0x0
259#define RCC_CFGR_PPRE_DIV_2 0x4
260#define RCC_CFGR_PPRE_DIV_4 0x5
261#define RCC_CFGR_PPRE_DIV_8 0x6
262#define RCC_CFGR_PPRE_DIV_16 0x7
264#define RCC_CFGR_HPRE_DIV_NONE 0x0
265#define RCC_CFGR_HPRE_DIV_2 (0x8 + 0)
266#define RCC_CFGR_HPRE_DIV_4 (0x8 + 1)
267#define RCC_CFGR_HPRE_DIV_8 (0x8 + 2)
268#define RCC_CFGR_HPRE_DIV_16 (0x8 + 3)
269#define RCC_CFGR_HPRE_DIV_64 (0x8 + 4)
270#define RCC_CFGR_HPRE_DIV_128 (0x8 + 5)
271#define RCC_CFGR_HPRE_DIV_256 (0x8 + 6)
272#define RCC_CFGR_HPRE_DIV_512 (0x8 + 7)
280#define RCC_CIR_CSSC (1 << 23)
283#define RCC_CIR_PLLSAIRDYC (1 << 22)
284#define RCC_CIR_PLLI2SRDYC (1 << 21)
285#define RCC_CIR_PLLRDYC (1 << 20)
286#define RCC_CIR_HSERDYC (1 << 19)
287#define RCC_CIR_HSIRDYC (1 << 18)
288#define RCC_CIR_LSERDYC (1 << 17)
289#define RCC_CIR_LSIRDYC (1 << 16)
292#define RCC_CIR_PLLSAIRDYIE (1 << 14)
293#define RCC_CIR_PLLI2SRDYIE (1 << 13)
294#define RCC_CIR_PLLRDYIE (1 << 12)
295#define RCC_CIR_HSERDYIE (1 << 11)
296#define RCC_CIR_HSIRDYIE (1 << 10)
297#define RCC_CIR_LSERDYIE (1 << 9)
298#define RCC_CIR_LSIRDYIE (1 << 8)
301#define RCC_CIR_CSSF (1 << 7)
304#define RCC_CIR_PLLSAIRDYF (1 << 6)
305#define RCC_CIR_PLLI2SRDYF (1 << 5)
306#define RCC_CIR_PLLRDYF (1 << 4)
307#define RCC_CIR_HSERDYF (1 << 3)
308#define RCC_CIR_HSIRDYF (1 << 2)
309#define RCC_CIR_LSERDYF (1 << 1)
310#define RCC_CIR_LSIRDYF (1 << 0)
317#define RCC_AHB1RSTR_OTGHSRST (1 << 29)
318#define RCC_AHB1RSTR_ETHMACRST (1 << 25)
319#define RCC_AHB1RSTR_DMA2DRST (1 << 23)
320#define RCC_AHB1RSTR_DMA2RST (1 << 22)
321#define RCC_AHB1RSTR_DMA1RST (1 << 21)
322#define RCC_AHB1RSTR_CRCRST (1 << 12)
323#define RCC_AHB1RSTR_GPIOKRST (1 << 10)
324#define RCC_AHB1RSTR_GPIOJRST (1 << 9)
325#define RCC_AHB1RSTR_GPIOIRST (1 << 8)
326#define RCC_AHB1RSTR_GPIOHRST (1 << 7)
327#define RCC_AHB1RSTR_GPIOGRST (1 << 6)
328#define RCC_AHB1RSTR_GPIOFRST (1 << 5)
329#define RCC_AHB1RSTR_GPIOERST (1 << 4)
330#define RCC_AHB1RSTR_GPIODRST (1 << 3)
331#define RCC_AHB1RSTR_GPIOCRST (1 << 2)
332#define RCC_AHB1RSTR_GPIOBRST (1 << 1)
333#define RCC_AHB1RSTR_GPIOARST (1 << 0)
340#define RCC_AHB1RSTR_IOPKRST RCC_AHB1RSTR_GPIOKRST
341#define RCC_AHB1RSTR_IOPJRST RCC_AHB1RSTR_GPIOJRST
342#define RCC_AHB1RSTR_IOPIRST RCC_AHB1RSTR_GPIOIRST
343#define RCC_AHB1RSTR_IOPHRST RCC_AHB1RSTR_GPIOHRST
344#define RCC_AHB1RSTR_IOPGRST RCC_AHB1RSTR_GPIOGRST
345#define RCC_AHB1RSTR_IOPFRST RCC_AHB1RSTR_GPIOFRST
346#define RCC_AHB1RSTR_IOPERST RCC_AHB1RSTR_GPIOERST
347#define RCC_AHB1RSTR_IOPDRST RCC_AHB1RSTR_GPIODRST
348#define RCC_AHB1RSTR_IOPCRST RCC_AHB1RSTR_GPIOCRST
349#define RCC_AHB1RSTR_IOPBRST RCC_AHB1RSTR_GPIOBRST
350#define RCC_AHB1RSTR_IOPARST RCC_AHB1RSTR_GPIOARST
355#define RCC_AHB2RSTR_OTGFSRST (1 << 7)
356#define RCC_AHB2RSTR_RNGRST (1 << 6)
357#define RCC_AHB2RSTR_HASHRST (1 << 5)
358#define RCC_AHB2RSTR_CRYPRST (1 << 4)
359#define RCC_AHB2RSTR_DCMIRST (1 << 0)
364#define RCC_AHB3RSTR_QSPIRST (1 << 1)
365#define RCC_AHB3RSTR_FSMCRST (1 << 0)
371#define RCC_APB1RSTR_UART8RST (1 << 31)
372#define RCC_APB1RSTR_UART7RST (1 << 30)
373#define RCC_APB1RSTR_DACRST (1 << 29)
374#define RCC_APB1RSTR_PWRRST (1 << 28)
375#define RCC_APB1RSTR_CAN2RST (1 << 26)
376#define RCC_APB1RSTR_CAN1RST (1 << 25)
377#define RCC_APB1RSTR_I2C3RST (1 << 23)
378#define RCC_APB1RSTR_I2C2RST (1 << 22)
379#define RCC_APB1RSTR_I2C1RST (1 << 21)
380#define RCC_APB1RSTR_UART5RST (1 << 20)
381#define RCC_APB1RSTR_UART4RST (1 << 19)
382#define RCC_APB1RSTR_USART3RST (1 << 18)
383#define RCC_APB1RSTR_USART2RST (1 << 17)
384#define RCC_APB1RSTR_SPI3RST (1 << 15)
385#define RCC_APB1RSTR_SPI2RST (1 << 14)
386#define RCC_APB1RSTR_WWDGRST (1 << 11)
387#define RCC_APB1RSTR_TIM14RST (1 << 8)
388#define RCC_APB1RSTR_TIM13RST (1 << 7)
389#define RCC_APB1RSTR_TIM12RST (1 << 6)
390#define RCC_APB1RSTR_TIM7RST (1 << 5)
391#define RCC_APB1RSTR_TIM6RST (1 << 4)
392#define RCC_APB1RSTR_TIM5RST (1 << 3)
393#define RCC_APB1RSTR_TIM4RST (1 << 2)
394#define RCC_APB1RSTR_TIM3RST (1 << 1)
395#define RCC_APB1RSTR_TIM2RST (1 << 0)
400#define RCC_APB2RSTR_DSIRST (1 << 27)
401#define RCC_APB2RSTR_LTDCRST (1 << 26)
402#define RCC_APB2RSTR_SAI1RST (1 << 22)
403#define RCC_APB2RSTR_SPI6RST (1 << 21)
404#define RCC_APB2RSTR_SPI5RST (1 << 20)
405#define RCC_APB2RSTR_TIM11RST (1 << 18)
406#define RCC_APB2RSTR_TIM10RST (1 << 17)
407#define RCC_APB2RSTR_TIM9RST (1 << 16)
408#define RCC_APB2RSTR_SYSCFGRST (1 << 14)
409#define RCC_APB2RSTR_SPI4RST (1 << 13)
410#define RCC_APB2RSTR_SPI1RST (1 << 12)
411#define RCC_APB2RSTR_SDIORST (1 << 11)
412#define RCC_APB2RSTR_ADCRST (1 << 8)
413#define RCC_APB2RSTR_USART6RST (1 << 5)
414#define RCC_APB2RSTR_USART1RST (1 << 4)
415#define RCC_APB2RSTR_TIM8RST (1 << 1)
416#define RCC_APB2RSTR_TIM1RST (1 << 0)
423#define RCC_AHB1ENR_OTGHSULPIEN (1 << 30)
424#define RCC_AHB1ENR_OTGHSEN (1 << 29)
425#define RCC_AHB1ENR_ETHMACPTPEN (1 << 28)
426#define RCC_AHB1ENR_ETHMACRXEN (1 << 27)
427#define RCC_AHB1ENR_ETHMACTXEN (1 << 26)
428#define RCC_AHB1ENR_ETHMACEN (1 << 25)
429#define RCC_AHB1ENR_DMA2DEN (1 << 23)
430#define RCC_AHB1ENR_DMA2EN (1 << 22)
431#define RCC_AHB1ENR_DMA1EN (1 << 21)
432#define RCC_AHB1ENR_CCMDATARAMEN (1 << 20)
433#define RCC_AHB1ENR_BKPSRAMEN (1 << 18)
434#define RCC_AHB1ENR_CRCEN (1 << 12)
435#define RCC_AHB1ENR_GPIOKEN (1 << 10)
436#define RCC_AHB1ENR_GPIOJEN (1 << 9)
437#define RCC_AHB1ENR_GPIOIEN (1 << 8)
438#define RCC_AHB1ENR_GPIOHEN (1 << 7)
439#define RCC_AHB1ENR_GPIOGEN (1 << 6)
440#define RCC_AHB1ENR_GPIOFEN (1 << 5)
441#define RCC_AHB1ENR_GPIOEEN (1 << 4)
442#define RCC_AHB1ENR_GPIODEN (1 << 3)
443#define RCC_AHB1ENR_GPIOCEN (1 << 2)
444#define RCC_AHB1ENR_GPIOBEN (1 << 1)
445#define RCC_AHB1ENR_GPIOAEN (1 << 0)
452#define RCC_AHB1ENR_IOPKEN RCC_AHB1ENR_GPIOKEN
453#define RCC_AHB1ENR_IOPJEN RCC_AHB1ENR_GPIOJEN
454#define RCC_AHB1ENR_IOPIEN RCC_AHB1ENR_GPIOIEN
455#define RCC_AHB1ENR_IOPHEN RCC_AHB1ENR_GPIOHEN
456#define RCC_AHB1ENR_IOPGEN RCC_AHB1ENR_GPIOGEN
457#define RCC_AHB1ENR_IOPFEN RCC_AHB1ENR_GPIOFEN
458#define RCC_AHB1ENR_IOPEEN RCC_AHB1ENR_GPIOEEN
459#define RCC_AHB1ENR_IOPDEN RCC_AHB1ENR_GPIODEN
460#define RCC_AHB1ENR_IOPCEN RCC_AHB1ENR_GPIOCEN
461#define RCC_AHB1ENR_IOPBEN RCC_AHB1ENR_GPIOBEN
462#define RCC_AHB1ENR_IOPAEN RCC_AHB1ENR_GPIOAEN
467#define RCC_AHB2ENR_OTGFSEN (1 << 7)
468#define RCC_AHB2ENR_RNGEN (1 << 6)
469#define RCC_AHB2ENR_HASHEN (1 << 5)
470#define RCC_AHB2ENR_CRYPEN (1 << 4)
471#define RCC_AHB2ENR_DCMIEN (1 << 0)
476#define RCC_AHB3ENR_QSPIEN (1 << 1)
477#define RCC_AHB3ENR_FSMCEN (1 << 0)
479#define RCC_AHB3ENR_FMCEN (1 << 0)
485#define RCC_APB1ENR_UART8EN (1 << 31)
486#define RCC_APB1ENR_UART7EN (1 << 30)
487#define RCC_APB1ENR_DACEN (1 << 29)
488#define RCC_APB1ENR_PWREN (1 << 28)
489#define RCC_APB1ENR_CAN2EN (1 << 26)
490#define RCC_APB1ENR_CAN1EN (1 << 25)
491#define RCC_APB1ENR_I2C3EN (1 << 23)
492#define RCC_APB1ENR_I2C2EN (1 << 22)
493#define RCC_APB1ENR_I2C1EN (1 << 21)
494#define RCC_APB1ENR_UART5EN (1 << 20)
495#define RCC_APB1ENR_UART4EN (1 << 19)
496#define RCC_APB1ENR_USART3EN (1 << 18)
497#define RCC_APB1ENR_USART2EN (1 << 17)
498#define RCC_APB1ENR_SPI3EN (1 << 15)
499#define RCC_APB1ENR_SPI2EN (1 << 14)
500#define RCC_APB1ENR_WWDGEN (1 << 11)
501#define RCC_APB1ENR_TIM14EN (1 << 8)
502#define RCC_APB1ENR_TIM13EN (1 << 7)
503#define RCC_APB1ENR_TIM12EN (1 << 6)
504#define RCC_APB1ENR_TIM7EN (1 << 5)
505#define RCC_APB1ENR_TIM6EN (1 << 4)
506#define RCC_APB1ENR_TIM5EN (1 << 3)
507#define RCC_APB1ENR_TIM4EN (1 << 2)
508#define RCC_APB1ENR_TIM3EN (1 << 1)
509#define RCC_APB1ENR_TIM2EN (1 << 0)
514#define RCC_APB2ENR_DSIEN (1 << 27)
515#define RCC_APB2ENR_LTDCEN (1 << 26)
516#define RCC_APB2ENR_SAI1EN (1 << 22)
517#define RCC_APB2ENR_SPI6EN (1 << 21)
518#define RCC_APB2ENR_SPI5EN (1 << 20)
519#define RCC_APB2ENR_TIM11EN (1 << 18)
520#define RCC_APB2ENR_TIM10EN (1 << 17)
521#define RCC_APB2ENR_TIM9EN (1 << 16)
522#define RCC_APB2ENR_SYSCFGEN (1 << 14)
523#define RCC_APB2ENR_SPI4EN (1 << 13)
524#define RCC_APB2ENR_SPI1EN (1 << 12)
525#define RCC_APB2ENR_SDIOEN (1 << 11)
526#define RCC_APB2ENR_ADC3EN (1 << 10)
527#define RCC_APB2ENR_ADC2EN (1 << 9)
528#define RCC_APB2ENR_ADC1EN (1 << 8)
529#define RCC_APB2ENR_USART6EN (1 << 5)
530#define RCC_APB2ENR_USART1EN (1 << 4)
531#define RCC_APB2ENR_TIM8EN (1 << 1)
532#define RCC_APB2ENR_TIM1EN (1 << 0)
537#define RCC_AHB1LPENR_OTGHSULPILPEN (1 << 30)
538#define RCC_AHB1LPENR_OTGHSLPEN (1 << 29)
539#define RCC_AHB1LPENR_ETHMACPTPLPEN (1 << 28)
540#define RCC_AHB1LPENR_ETHMACRXLPEN (1 << 27)
541#define RCC_AHB1LPENR_ETHMACTXLPEN (1 << 26)
542#define RCC_AHB1LPENR_ETHMACLPEN (1 << 25)
543#define RCC_AHB1LPENR_DMA2DLPEN (1 << 23)
544#define RCC_AHB1LPENR_DMA2LPEN (1 << 22)
545#define RCC_AHB1LPENR_DMA1LPEN (1 << 21)
546#define RCC_AHB1LPENR_SRAM3LPEN (1 << 19)
547#define RCC_AHB1LPENR_BKPSRAMLPEN (1 << 18)
548#define RCC_AHB1LPENR_SRAM2LPEN (1 << 17)
549#define RCC_AHB1LPENR_SRAM1LPEN (1 << 16)
550#define RCC_AHB1LPENR_FLITFLPEN (1 << 15)
551#define RCC_AHB1LPENR_CRCLPEN (1 << 12)
552#define RCC_AHB1LPENR_GPIOKLPEN (1 << 10)
553#define RCC_AHB1LPENR_GPIOJLPEN (1 << 9)
554#define RCC_AHB1LPENR_GPIOILPEN (1 << 8)
555#define RCC_AHB1LPENR_GPIOHLPEN (1 << 7)
556#define RCC_AHB1LPENR_GPIOGLPEN (1 << 6)
557#define RCC_AHB1LPENR_GPIOFLPEN (1 << 5)
558#define RCC_AHB1LPENR_GPIOELPEN (1 << 4)
559#define RCC_AHB1LPENR_GPIODLPEN (1 << 3)
560#define RCC_AHB1LPENR_GPIOCLPEN (1 << 2)
561#define RCC_AHB1LPENR_GPIOBLPEN (1 << 1)
562#define RCC_AHB1LPENR_GPIOALPEN (1 << 0)
568#define RCC_AHB1LPENR_IOPKLPEN RCC_AHB1LPENR_GPIOKLPEN
569#define RCC_AHB1LPENR_IOPJLPEN RCC_AHB1LPENR_GPIOJLPEN
570#define RCC_AHB1LPENR_IOPILPEN RCC_AHB1LPENR_GPIOILPEN
571#define RCC_AHB1LPENR_IOPHLPEN RCC_AHB1LPENR_GPIOHLPEN
572#define RCC_AHB1LPENR_IOPGLPEN RCC_AHB1LPENR_GPIOGLPEN
573#define RCC_AHB1LPENR_IOPFLPEN RCC_AHB1LPENR_GPIOFLPEN
574#define RCC_AHB1LPENR_IOPELPEN RCC_AHB1LPENR_GPIOELPEN
575#define RCC_AHB1LPENR_IOPDLPEN RCC_AHB1LPENR_GPIODLPEN
576#define RCC_AHB1LPENR_IOPCLPEN RCC_AHB1LPENR_GPIOCLPEN
577#define RCC_AHB1LPENR_IOPBLPEN RCC_AHB1LPENR_GPIOBLPEN
578#define RCC_AHB1LPENR_IOPALPEN RCC_AHB1LPENR_GPIOALPEN
583#define RCC_AHB2LPENR_OTGFSLPEN (1 << 7)
584#define RCC_AHB2LPENR_RNGLPEN (1 << 6)
585#define RCC_AHB2LPENR_HASHLPEN (1 << 5)
586#define RCC_AHB2LPENR_CRYPLPEN (1 << 4)
587#define RCC_AHB2LPENR_DCMILPEN (1 << 0)
591#define RCC_AHB3LPENR_QSPIEN (1 << 1)
592#define RCC_AHB3LPENR_FSMCLPEN (1 << 0)
593#define RCC_AHB3LPENR_FMCLPEN (1 << 0)
599#define RCC_APB1LPENR_UART8EN (1 << 31)
600#define RCC_APB1LPENR_UART7EN (1 << 30)
601#define RCC_APB1LPENR_DACLPEN (1 << 29)
602#define RCC_APB1LPENR_PWRLPEN (1 << 28)
603#define RCC_APB1LPENR_CAN2LPEN (1 << 26)
604#define RCC_APB1LPENR_CAN1LPEN (1 << 25)
605#define RCC_APB1LPENR_I2C3LPEN (1 << 23)
606#define RCC_APB1LPENR_I2C2LPEN (1 << 22)
607#define RCC_APB1LPENR_I2C1LPEN (1 << 21)
608#define RCC_APB1LPENR_UART5LPEN (1 << 20)
609#define RCC_APB1LPENR_UART4LPEN (1 << 19)
610#define RCC_APB1LPENR_USART3LPEN (1 << 18)
611#define RCC_APB1LPENR_USART2LPEN (1 << 17)
612#define RCC_APB1LPENR_SPI3LPEN (1 << 15)
613#define RCC_APB1LPENR_SPI2LPEN (1 << 14)
614#define RCC_APB1LPENR_WWDGLPEN (1 << 11)
615#define RCC_APB1LPENR_TIM14LPEN (1 << 8)
616#define RCC_APB1LPENR_TIM13LPEN (1 << 7)
617#define RCC_APB1LPENR_TIM12LPEN (1 << 6)
618#define RCC_APB1LPENR_TIM7LPEN (1 << 5)
619#define RCC_APB1LPENR_TIM6LPEN (1 << 4)
620#define RCC_APB1LPENR_TIM5LPEN (1 << 3)
621#define RCC_APB1LPENR_TIM4LPEN (1 << 2)
622#define RCC_APB1LPENR_TIM3LPEN (1 << 1)
623#define RCC_APB1LPENR_TIM2LPEN (1 << 0)
627#define RCC_APB2LPENR_DSILPEN (1 << 27)
628#define RCC_APB2LPENR_LTDCLPEN (1 << 26)
629#define RCC_APB2LPENR_SAI1LPEN (1 << 22)
630#define RCC_APB2LPENR_SPI6LPEN (1 << 21)
631#define RCC_APB2LPENR_SPI5LPEN (1 << 20)
632#define RCC_APB2LPENR_TIM11LPEN (1 << 18)
633#define RCC_APB2LPENR_TIM10LPEN (1 << 17)
634#define RCC_APB2LPENR_TIM9LPEN (1 << 16)
635#define RCC_APB2LPENR_SYSCFGLPEN (1 << 14)
636#define RCC_APB2LPENR_SPI1LPEN (1 << 12)
637#define RCC_APB2LPENR_SDIOLPEN (1 << 11)
638#define RCC_APB2LPENR_ADC3LPEN (1 << 10)
639#define RCC_APB2LPENR_ADC2LPEN (1 << 9)
640#define RCC_APB2LPENR_ADC1LPEN (1 << 8)
641#define RCC_APB2LPENR_USART6LPEN (1 << 5)
642#define RCC_APB2LPENR_USART1LPEN (1 << 4)
643#define RCC_APB2LPENR_TIM8LPEN (1 << 1)
644#define RCC_APB2LPENR_TIM1LPEN (1 << 0)
651#define RCC_BDCR_BDRST (1 << 16)
652#define RCC_BDCR_RTCEN (1 << 15)
654#define RCC_BDCR_RTCSEL_SHIFT 8
655#define RCC_BDCR_RTCSEL_MASK 0x3
656#define RCC_BDCR_RTCSEL_NONE 0
657#define RCC_BDCR_RTCSEL_LSE 1
658#define RCC_BDCR_RTCSEL_LSI 2
659#define RCC_BDCR_RTCSEL_HSE 3
660#define RCC_BDCR_LSEMOD (1 << 3)
661#define RCC_BDCR_LSEBYP (1 << 2)
662#define RCC_BDCR_LSERDY (1 << 1)
663#define RCC_BDCR_LSEON (1 << 0)
670#define RCC_CSR_LPWRRSTF (1 << 31)
671#define RCC_CSR_WWDGRSTF (1 << 30)
672#define RCC_CSR_IWDGRSTF (1 << 29)
673#define RCC_CSR_SFTRSTF (1 << 28)
674#define RCC_CSR_PORRSTF (1 << 27)
675#define RCC_CSR_PINRSTF (1 << 26)
676#define RCC_CSR_BORRSTF (1 << 25)
677#define RCC_CSR_RMVF (1 << 24)
678#define RCC_CSR_RESET_FLAGS (RCC_CSR_LPWRRSTF | RCC_CSR_WWDGRSTF |\
679 RCC_CSR_IWDGRSTF | RCC_CSR_SFTRSTF | RCC_CSR_PORRSTF |\
680 RCC_CSR_PINRSTF | RCC_CSR_BORRSTF)
681#define RCC_CSR_LSIRDY (1 << 1)
682#define RCC_CSR_LSION (1 << 0)
691#define RCC_SSCGR_SSCGEN (1 << 31)
692#define RCC_SSCGR_SPREADSEL (1 << 30)
694#define RCC_SSCGR_INCSTEP_SHIFT 13
695#define RCC_SSCGR_INCSTEP_MASK 0x7fff
697#define RCC_SSCGR_MODPER_SHIFT 0
698#define RCC_SSCGR_MODPER_MASK 0x1fff
708#define RCC_PLLI2SCFGR_PLLI2SR_SHIFT 28
709#define RCC_PLLI2SCFGR_PLLI2SR_MASK 0x7
711#define RCC_PLLI2SCFGR_PLLI2SQ_SHIFT 24
712#define RCC_PLLI2SCFGR_PLLI2SQ_MASK 0xf
714#define RCC_PLLI2SCFGR_PLLI2SN_SHIFT 6
715#define RCC_PLLI2SCFGR_PLLI2SN_MASK 0x1ff
720#define RCC_PLLSAICFGR_PLLSAIR_SHIFT 28
721#define RCC_PLLSAICFGR_PLLSAIR_MASK 0x7
724#define RCC_PLLSAICFGR_PLLSAIQ_SHIFT 24
725#define RCC_PLLSAICFGR_PLLSAIQ_MASK 0xF
728#define RCC_PLLSAICFGR_PLLSAIP_SHIFT 16
729#define RCC_PLLSAICFGR_PLLSAIP_MASK 0x3
733#define RCC_PLLSAICFGR_PLLSAIP_DIV2 0x0
734#define RCC_PLLSAICFGR_PLLSAIP_DIV4 0x1
735#define RCC_PLLSAICFGR_PLLSAIP_DIV6 0x2
736#define RCC_PLLSAICFGR_PLLSAIP_DIV8 0x3
740#define RCC_PLLSAICFGR_PLLSAIN_SHIFT 6
741#define RCC_PLLSAICFGR_PLLSAIN_MASK 0x1FF
745#define RCC_DCKCFGR_DSISEL (1 << 29)
746#define RCC_DCKCFGR_SDMMCSEL (1 << 28)
747#define RCC_DCKCFGR_48MSEL (1 << 27)
748#define RCC_DCKCFGR_TIMPRE (1 << 24)
750#define RCC_DCKCFGR_SAI1BSRC_SHIFT 22
751#define RCC_DCKCFGR_SAI1BSRC_MASK 0x3
753#define RCC_DCKCFGR_SAI1ASRC_SHIFT 20
754#define RCC_DCKCFGR_SAI1ASRC_MASK 0x3
757#define RCC_DCKCFGR_SAI1SRC_SAIQ 0x0
758#define RCC_DCKCFGR_SAI1SRC_I2SQ 0x1
759#define RCC_DCKCFGR_SAI1SRC_ALT 0x2
760#define RCC_DCKCFGR_SAI1SRC_ERROR 0x3
762#define RCC_DCKCFGR_PLLSAIDIVR_SHIFT 16
763#define RCC_DCKCFGR_PLLSAIDIVR_MASK 0x3
764#define RCC_DCKCFGR_PLLSAIDIVR_DIVR_2 0x0
765#define RCC_DCKCFGR_PLLSAIDIVR_DIVR_4 0x1
766#define RCC_DCKCFGR_PLLSAIDIVR_DIVR_8 0x2
767#define RCC_DCKCFGR_PLLSAIDIVR_DIVR_16 0x3
769#define RCC_DCKCFGR_PLLSAIDIVQ_SHIFT 8
770#define RCC_DCKCFGR_PLLSAIDIVQ_MASK 0x1f
772#define RCC_DCKCFGR_PLLI2SDIVQ_SHIFT 0
773#define RCC_DCKCFGR_PLLI2SDIVQ_MASK 0x1f
780#define RCC_CKGATENR_EVTCL_CKEN (1<<7)
781#define RCC_CKGATENR_RCC_CKEN (1<<6)
782#define RCC_CKGATENR_FLITF_CKEN (1<<5)
783#define RCC_CKGATENR_SRAM_CKEN (1<<4)
784#define RCC_CKGATENR_SPARE_CKEN (1<<3)
785#define RCC_CKGATENR_CM4DBG_CKEN (1<<2)
786#define RCC_CKGATENR_AHB2APB2_CKEN (1<<1)
787#define RCC_CKGATENR_AHB2APB1_CKEN (1<<0)
838#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_osc_ready_int_clear(enum rcc_osc osc)
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)
void rcc_pllsai_postscalers(uint8_t q, uint8_t r)
Set the dedicated dividers after the PLLSAI configuration.
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)
const struct rcc_clock_scale rcc_hse_8mhz_3v3[RCC_CLOCK_3V3_END]
void rcc_plli2s_config(uint16_t n, uint8_t r)
Set the dividers for the PLLI2S clock outputs.
uint32_t rcc_get_usart_clk_freq(uint32_t usart)
Get the peripheral clock speed for the USART at base specified.
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_set_rtcpre(uint32_t rtcpre)
const struct rcc_clock_scale rcc_hse_25mhz_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)
void rcc_set_main_pll_hse(uint32_t pllm, uint32_t plln, uint32_t pllp, uint32_t pllq, uint32_t pllr)
Reconfigures the main PLL for a HSE source.
uint32_t rcc_get_i2c_clk_freq(uint32_t i2c)
Get the peripheral clock speed for the I2C device at base specified.
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_pllsai_config(uint16_t n, uint16_t p, uint16_t q, uint16_t r)
Set the dividers for the PLLSAI clock outputs divider p is only available on F4x9 parts,...
void rcc_set_ppre2(uint32_t ppre2)
void rcc_set_main_pll_hsi(uint32_t pllm, uint32_t plln, uint32_t pllp, uint32_t pllq, uint32_t pllr)
Reconfigures the main PLL for a HSI source.
void rcc_css_enable(void)
void rcc_set_hpre(uint32_t hpre)
const struct rcc_clock_scale rcc_hse_16mhz_3v3[RCC_CLOCK_3V3_END]
enum pwr_vos_scale voltage_scale