36#ifndef LIBOPENCM3_RCC_H
37#define LIBOPENCM3_RCC_H
45#define RCC_CR MMIO32(RCC_BASE + 0x00)
46#define RCC_PLLCFGR MMIO32(RCC_BASE + 0x04)
47#define RCC_CFGR MMIO32(RCC_BASE + 0x08)
48#define RCC_CIR MMIO32(RCC_BASE + 0x0c)
49#define RCC_AHB1RSTR MMIO32(RCC_BASE + 0x10)
50#define RCC_AHB2RSTR MMIO32(RCC_BASE + 0x14)
51#define RCC_AHB3RSTR MMIO32(RCC_BASE + 0x18)
52#define RCC_APB1RSTR MMIO32(RCC_BASE + 0x20)
53#define RCC_APB2RSTR MMIO32(RCC_BASE + 0x24)
54#define RCC_AHB1ENR MMIO32(RCC_BASE + 0x30)
55#define RCC_AHB2ENR MMIO32(RCC_BASE + 0x34)
56#define RCC_AHB3ENR MMIO32(RCC_BASE + 0x38)
57#define RCC_APB1ENR MMIO32(RCC_BASE + 0x40)
58#define RCC_APB2ENR MMIO32(RCC_BASE + 0x44)
59#define RCC_AHB1LPENR MMIO32(RCC_BASE + 0x50)
60#define RCC_AHB2LPENR MMIO32(RCC_BASE + 0x54)
61#define RCC_AHB3LPENR MMIO32(RCC_BASE + 0x58)
62#define RCC_APB1LPENR MMIO32(RCC_BASE + 0x60)
63#define RCC_APB2LPENR MMIO32(RCC_BASE + 0x64)
64#define RCC_BDCR MMIO32(RCC_BASE + 0x70)
65#define RCC_CSR MMIO32(RCC_BASE + 0x74)
66#define RCC_SSCGR MMIO32(RCC_BASE + 0x80)
67#define RCC_PLLI2SCFGR MMIO32(RCC_BASE + 0x84)
68#define RCC_PLLSAICFGR MMIO32(RCC_BASE + 0x88)
69#define RCC_DCKCFGR1 MMIO32(RCC_BASE + 0x8C)
70#define RCC_DCKCFGR2 MMIO32(RCC_BASE + 0x90)
74#define RCC_CR_PLLSAIRDY (1 << 29)
75#define RCC_CR_PLLSAION (1 << 28)
76#define RCC_CR_PLLI2SRDY (1 << 27)
77#define RCC_CR_PLLI2SON (1 << 26)
78#define RCC_CR_PLLRDY (1 << 25)
79#define RCC_CR_PLLON (1 << 24)
80#define RCC_CR_CSSON (1 << 19)
81#define RCC_CR_HSEBYP (1 << 18)
82#define RCC_CR_HSERDY (1 << 17)
83#define RCC_CR_HSEON (1 << 16)
84#define RCC_CR_HSICAL_MASK 0xff
85#define RCC_CR_HSICAL_SHIFT 8
86#define RCC_CR_HSITRIM_MASK 0x1f
87#define RCC_CR_HSITRIM_SHIFT 3
88#define RCC_CR_HSIRDY (1 << 1)
89#define RCC_CR_HSION (1 << 0)
93#define RCC_PLLCFGR_PLLQ_MASK 0xf
94#define RCC_PLLCFGR_PLLQ_SHIFT 24
95#define RCC_PLLCFGR_PLLSRC (1 << 22)
96#define RCC_PLLCFGR_PLLP_MASK 0x3
97#define RCC_PLLCFGR_PLLP_SHIFT 16
98#define RCC_PLLCFGR_PLLN_MASK 0x1ff
99#define RCC_PLLCFGR_PLLN_SHIFT 6
100#define RCC_PLLCFGR_PLLM_MASK 0x3f
101#define RCC_PLLCFGR_PLLM_SHIFT 0
106#define RCC_CFGR_MCO2_MASK 0x3
107#define RCC_CFGR_MCO2_SHIFT 30
108#define RCC_CFGR_MCO2_SYSCLK 0x0
109#define RCC_CFGR_MCO2_PLLI2S 0x1
110#define RCC_CFGR_MCO2_HSE 0x2
111#define RCC_CFGR_MCO2_PLL 0x3
114#define RCC_CFGR_MCOPRE_MASK 0x7
115#define RCC_CFGR_MCO2PRE_SHIFT 27
116#define RCC_CFGR_MCO1PRE_SHIFT 24
117#define RCC_CFGR_MCOPRE_DIV_NONE 0x0
118#define RCC_CFGR_MCOPRE_DIV_2 0x4
119#define RCC_CFGR_MCOPRE_DIV_3 0x5
120#define RCC_CFGR_MCOPRE_DIV_4 0x6
121#define RCC_CFGR_MCOPRE_DIV_5 0x7
124#define RCC_CFGR_I2SSRC (1 << 23)
127#define RCC_CFGR_MCO1_MASK 0x3
128#define RCC_CFGR_MCO1_SHIFT 21
129#define RCC_CFGR_MCO1_HSI 0x0
130#define RCC_CFGR_MCO1_LSE 0x1
131#define RCC_CFGR_MCO1_HSE 0x2
132#define RCC_CFGR_MCO1_PLL 0x3
133#define RCC_CFGR_MCO_SHIFT RCC_CFGR_MCO1_SHIFT
134#define RCC_CFGR_MCO_MASK RCC_CFGR_MCO1_MASK
137#define RCC_CFGR_RTCPRE_SHIFT 16
138#define RCC_CFGR_RTCPRE_MASK 0x1f
140#define RCC_CFGR_PPRE2_SHIFT 13
141#define RCC_CFGR_PPRE2_MASK 0x7
142#define RCC_CFGR_PPRE1_SHIFT 10
143#define RCC_CFGR_PPRE1_MASK 0x7
148#define RCC_CFGR_PPRE_NODIV 0x0
149#define RCC_CFGR_PPRE_DIV2 0x4
150#define RCC_CFGR_PPRE_DIV4 0x5
151#define RCC_CFGR_PPRE_DIV8 0x6
152#define RCC_CFGR_PPRE_DIV16 0x7
155#define RCC_CFGR_HPRE_SHIFT 4
156#define RCC_CFGR_HPRE_MASK 0xf
159#define RCC_CFGR_HPRE_NODIV 0x0
160#define RCC_CFGR_HPRE_DIV2 (0x8 + 0)
161#define RCC_CFGR_HPRE_DIV4 (0x8 + 1)
162#define RCC_CFGR_HPRE_DIV8 (0x8 + 2)
163#define RCC_CFGR_HPRE_DIV16 (0x8 + 3)
164#define RCC_CFGR_HPRE_DIV64 (0x8 + 4)
165#define RCC_CFGR_HPRE_DIV128 (0x8 + 5)
166#define RCC_CFGR_HPRE_DIV256 (0x8 + 6)
167#define RCC_CFGR_HPRE_DIV512 (0x8 + 7)
171#define RCC_CFGR_SWS_SHIFT 2
172#define RCC_CFGR_SWS_MASK 0x3
173#define RCC_CFGR_SWS_HSI 0x0
174#define RCC_CFGR_SWS_HSE 0x1
175#define RCC_CFGR_SWS_PLL 0x2
178#define RCC_CFGR_SW_SHIFT 0
179#define RCC_CFGR_SW_MASK 0x3
180#define RCC_CFGR_SW_HSI 0x0
181#define RCC_CFGR_SW_HSE 0x1
182#define RCC_CFGR_SW_PLL 0x2
189#define RCC_CFGR_PPRE_DIV_NONE 0x0
190#define RCC_CFGR_PPRE_DIV_2 0x4
191#define RCC_CFGR_PPRE_DIV_4 0x5
192#define RCC_CFGR_PPRE_DIV_8 0x6
193#define RCC_CFGR_PPRE_DIV_16 0x7
195#define RCC_CFGR_HPRE_DIV_NONE 0x0
196#define RCC_CFGR_HPRE_DIV_2 (0x8 + 0)
197#define RCC_CFGR_HPRE_DIV_4 (0x8 + 1)
198#define RCC_CFGR_HPRE_DIV_8 (0x8 + 2)
199#define RCC_CFGR_HPRE_DIV_16 (0x8 + 3)
200#define RCC_CFGR_HPRE_DIV_64 (0x8 + 4)
201#define RCC_CFGR_HPRE_DIV_128 (0x8 + 5)
202#define RCC_CFGR_HPRE_DIV_256 (0x8 + 6)
203#define RCC_CFGR_HPRE_DIV_512 (0x8 + 7)
209#define RCC_CIR_CSSC (1 << 23)
212#define RCC_CIR_PLLSAIRDYC (1 << 22)
213#define RCC_CIR_PLLI2SRDYC (1 << 21)
214#define RCC_CIR_PLLRDYC (1 << 20)
215#define RCC_CIR_HSERDYC (1 << 19)
216#define RCC_CIR_HSIRDYC (1 << 18)
217#define RCC_CIR_LSERDYC (1 << 17)
218#define RCC_CIR_LSIRDYC (1 << 16)
221#define RCC_CIR_PLLSAIRDYIE (1 << 14)
222#define RCC_CIR_PLLI2SRDYIE (1 << 13)
223#define RCC_CIR_PLLRDYIE (1 << 12)
224#define RCC_CIR_HSERDYIE (1 << 11)
225#define RCC_CIR_HSIRDYIE (1 << 10)
226#define RCC_CIR_LSERDYIE (1 << 9)
227#define RCC_CIR_LSIRDYIE (1 << 8)
230#define RCC_CIR_CSSF (1 << 7)
233#define RCC_CIR_PLLSAIRDYF (1 << 6)
234#define RCC_CIR_PLLI2SRDYF (1 << 5)
235#define RCC_CIR_PLLRDYF (1 << 4)
236#define RCC_CIR_HSERDYF (1 << 3)
237#define RCC_CIR_HSIRDYF (1 << 2)
238#define RCC_CIR_LSERDYF (1 << 1)
239#define RCC_CIR_LSIRDYF (1 << 0)
245#define RCC_AHB1RSTR_OTGHSRST (1 << 29)
246#define RCC_AHB1RSTR_ETHMACRST (1 << 25)
247#define RCC_AHB1RSTR_DMA2DRST (1 << 23)
248#define RCC_AHB1RSTR_DMA2RST (1 << 22)
249#define RCC_AHB1RSTR_DMA1RST (1 << 21)
250#define RCC_AHB1RSTR_CRCRST (1 << 12)
251#define RCC_AHB1RSTR_GPIOKRST (1 << 10)
252#define RCC_AHB1RSTR_GPIOJRST (1 << 9)
253#define RCC_AHB1RSTR_GPIOIRST (1 << 8)
254#define RCC_AHB1RSTR_GPIOHRST (1 << 7)
255#define RCC_AHB1RSTR_GPIOGRST (1 << 6)
256#define RCC_AHB1RSTR_GPIOFRST (1 << 5)
257#define RCC_AHB1RSTR_GPIOERST (1 << 4)
258#define RCC_AHB1RSTR_GPIODRST (1 << 3)
259#define RCC_AHB1RSTR_GPIOCRST (1 << 2)
260#define RCC_AHB1RSTR_GPIOBRST (1 << 1)
261#define RCC_AHB1RSTR_GPIOARST (1 << 0)
266#define RCC_AHB2RSTR_OTGFSRST (1 << 7)
267#define RCC_AHB2RSTR_RNGRST (1 << 6)
268#define RCC_AHB2RSTR_HASHRST (1 << 5)
269#define RCC_AHB2RSTR_CRYPRST (1 << 4)
270#define RCC_AHB2RSTR_DCMIRST (1 << 0)
275#define RCC_AHB3RSTR_QSPIRST (1 << 1)
276#define RCC_AHB3RSTR_FSMCRST (1 << 0)
282#define RCC_APB1RSTR_UART8RST (1 << 31)
283#define RCC_APB1RSTR_UART7RST (1 << 30)
284#define RCC_APB1RSTR_DACRST (1 << 29)
285#define RCC_APB1RSTR_PWRRST (1 << 28)
286#define RCC_APB1RSTR_CECRST (1 << 27)
287#define RCC_APB1RSTR_CAN2RST (1 << 26)
288#define RCC_APB1RSTR_CAN1RST (1 << 25)
289#define RCC_APB1RSTR_I2C4RST (1 << 24)
290#define RCC_APB1RSTR_I2C3RST (1 << 23)
291#define RCC_APB1RSTR_I2C2RST (1 << 22)
292#define RCC_APB1RSTR_I2C1RST (1 << 21)
293#define RCC_APB1RSTR_UART5RST (1 << 20)
294#define RCC_APB1RSTR_UART4RST (1 << 19)
295#define RCC_APB1RSTR_UART3RST (1 << 18)
296#define RCC_APB1RSTR_UART2RST (1 << 17)
297#define RCC_APB1RSTR_SPDIFRXRST (1 << 16)
298#define RCC_APB1RSTR_SPI3RST (1 << 15)
299#define RCC_APB1RSTR_SPI2RST (1 << 14)
300#define RCC_APB1RSTR_WWDGRST (1 << 11)
301#define RCC_APB1RSTR_LPTIM1RST (1 << 9)
302#define RCC_APB1RSTR_TIM14RST (1 << 8)
303#define RCC_APB1RSTR_TIM13RST (1 << 7)
304#define RCC_APB1RSTR_TIM12RST (1 << 6)
305#define RCC_APB1RSTR_TIM7RST (1 << 5)
306#define RCC_APB1RSTR_TIM6RST (1 << 4)
307#define RCC_APB1RSTR_TIM5RST (1 << 3)
308#define RCC_APB1RSTR_TIM4RST (1 << 2)
309#define RCC_APB1RSTR_TIM3RST (1 << 1)
310#define RCC_APB1RSTR_TIM2RST (1 << 0)
315#define RCC_APB2RSTR_LTDCRST (1 << 26)
316#define RCC_APB2RSTR_SAI2RST (1 << 23)
317#define RCC_APB2RSTR_SAI1RST (1 << 22)
318#define RCC_APB2RSTR_SPI6RST (1 << 21)
319#define RCC_APB2RSTR_SPI5RST (1 << 20)
320#define RCC_APB2RSTR_TIM11RST (1 << 18)
321#define RCC_APB2RSTR_TIM10RST (1 << 17)
322#define RCC_APB2RSTR_TIM9RST (1 << 16)
323#define RCC_APB2RSTR_SYSCFGRST (1 << 14)
324#define RCC_APB2RSTR_SPI4RST (1 << 13)
325#define RCC_APB2RSTR_SPI1RST (1 << 12)
326#define RCC_APB2RSTR_SDMMC1RST (1 << 11)
327#define RCC_APB2RSTR_ADCRST (1 << 8)
328#define RCC_APB2RSTR_USART6RST (1 << 5)
329#define RCC_APB2RSTR_USART1RST (1 << 4)
330#define RCC_APB2RSTR_TIM8RST (1 << 1)
331#define RCC_APB2RSTR_TIM1RST (1 << 0)
338#define RCC_AHB1ENR_OTGHSULPIEN (1 << 30)
339#define RCC_AHB1ENR_OTGHSEN (1 << 29)
340#define RCC_AHB1ENR_ETHMACPTPEN (1 << 28)
341#define RCC_AHB1ENR_ETHMACRXEN (1 << 27)
342#define RCC_AHB1ENR_ETHMACTXEN (1 << 26)
343#define RCC_AHB1ENR_ETHMACEN (1 << 25)
344#define RCC_AHB1ENR_DMA2DEN (1 << 23)
345#define RCC_AHB1ENR_DMA2EN (1 << 22)
346#define RCC_AHB1ENR_DMA1EN (1 << 21)
347#define RCC_AHB1ENR_DTCMRAMEN (1 << 20)
348#define RCC_AHB1ENR_BKPSRAMEN (1 << 18)
349#define RCC_AHB1ENR_CRCEN (1 << 12)
350#define RCC_AHB1ENR_GPIOKEN (1 << 10)
351#define RCC_AHB1ENR_GPIOJEN (1 << 9)
352#define RCC_AHB1ENR_GPIOIEN (1 << 8)
353#define RCC_AHB1ENR_GPIOHEN (1 << 7)
354#define RCC_AHB1ENR_GPIOGEN (1 << 6)
355#define RCC_AHB1ENR_GPIOFEN (1 << 5)
356#define RCC_AHB1ENR_GPIOEEN (1 << 4)
357#define RCC_AHB1ENR_GPIODEN (1 << 3)
358#define RCC_AHB1ENR_GPIOCEN (1 << 2)
359#define RCC_AHB1ENR_GPIOBEN (1 << 1)
360#define RCC_AHB1ENR_GPIOAEN (1 << 0)
365#define RCC_AHB2ENR_OTGFSEN (1 << 7)
366#define RCC_AHB2ENR_RNGEN (1 << 6)
367#define RCC_AHB2ENR_HASHEN (1 << 5)
368#define RCC_AHB2ENR_CRYPEN (1 << 4)
369#define RCC_AHB2ENR_DCMIEN (1 << 0)
374#define RCC_AHB3ENR_QSPIEN (1 << 1)
375#define RCC_AHB3ENR_FMCEN (1 << 0)
381#define RCC_APB1ENR_UART8EN (1 << 31)
382#define RCC_APB1ENR_UART7EN (1 << 30)
383#define RCC_APB1ENR_DACEN (1 << 29)
384#define RCC_APB1ENR_PWREN (1 << 28)
385#define RCC_APB1ENR_CECEN (1 << 27)
386#define RCC_APB1ENR_CAN2EN (1 << 26)
387#define RCC_APB1ENR_CAN1EN (1 << 25)
388#define RCC_APB1ENR_I2C4EN (1 << 24)
389#define RCC_APB1ENR_I2C3EN (1 << 23)
390#define RCC_APB1ENR_I2C2EN (1 << 22)
391#define RCC_APB1ENR_I2C1EN (1 << 21)
392#define RCC_APB1ENR_UART5EN (1 << 20)
393#define RCC_APB1ENR_UART4EN (1 << 19)
394#define RCC_APB1ENR_USART3EN (1 << 18)
395#define RCC_APB1ENR_USART2EN (1 << 17)
396#define RCC_APB1ENR_SPIDIFRXEN (1 << 16)
397#define RCC_APB1ENR_SPI3EN (1 << 15)
398#define RCC_APB1ENR_SPI2EN (1 << 14)
399#define RCC_APB1ENR_WWDGEN (1 << 11)
400#define RCC_APB1ENR_LPTIM1EN (1 << 9)
401#define RCC_APB1ENR_TIM14EN (1 << 8)
402#define RCC_APB1ENR_TIM13EN (1 << 7)
403#define RCC_APB1ENR_TIM12EN (1 << 6)
404#define RCC_APB1ENR_TIM7EN (1 << 5)
405#define RCC_APB1ENR_TIM6EN (1 << 4)
406#define RCC_APB1ENR_TIM5EN (1 << 3)
407#define RCC_APB1ENR_TIM4EN (1 << 2)
408#define RCC_APB1ENR_TIM3EN (1 << 1)
409#define RCC_APB1ENR_TIM2EN (1 << 0)
414#define RCC_APB2ENR_LTDCEN (1 << 26)
415#define RCC_APB2ENR_SAI2EN (1 << 23)
416#define RCC_APB2ENR_SAI1EN (1 << 22)
417#define RCC_APB2ENR_SPI6EN (1 << 21)
418#define RCC_APB2ENR_SPI5EN (1 << 20)
419#define RCC_APB2ENR_TIM11EN (1 << 18)
420#define RCC_APB2ENR_TIM10EN (1 << 17)
421#define RCC_APB2ENR_TIM9EN (1 << 16)
422#define RCC_APB2ENR_SYSCFGEN (1 << 14)
423#define RCC_APB2ENR_SPI4EN (1 << 13)
424#define RCC_APB2ENR_SPI1EN (1 << 12)
425#define RCC_APB2ENR_SDMMC1EN (1 << 11)
426#define RCC_APB2ENR_ADC3EN (1 << 10)
427#define RCC_APB2ENR_ADC2EN (1 << 9)
428#define RCC_APB2ENR_ADC1EN (1 << 8)
429#define RCC_APB2ENR_USART6EN (1 << 5)
430#define RCC_APB2ENR_USART1EN (1 << 4)
431#define RCC_APB2ENR_TIM8EN (1 << 1)
432#define RCC_APB2ENR_TIM1EN (1 << 0)
437#define RCC_AHB1LPENR_OTGHSULPILPEN (1 << 30)
438#define RCC_AHB1LPENR_OTGHSLPEN (1 << 29)
439#define RCC_AHB1LPENR_ETHMACPTPLPEN (1 << 28)
440#define RCC_AHB1LPENR_ETHMACRXLPEN (1 << 27)
441#define RCC_AHB1LPENR_ETHMACTXLPEN (1 << 26)
442#define RCC_AHB1LPENR_ETHMACLPEN (1 << 25)
443#define RCC_AHB1LPENR_DMA2DLPEN (1 << 23)
444#define RCC_AHB1LPENR_DMA2LPEN (1 << 22)
445#define RCC_AHB1LPENR_DMA1LPEN (1 << 21)
446#define RCC_AHB1LPENR_DTCMLPEN (1 << 20)
447#define RCC_AHB1LPENR_BKPSRAMLPEN (1 << 18)
448#define RCC_AHB1LPENR_SRAM2LPEN (1 << 17)
449#define RCC_AHB1LPENR_SRAM1LPEN (1 << 16)
450#define RCC_AHB1LPENR_FLITFLPEN (1 << 15)
451#define RCC_AHB1LPENR_AXILPEN (1 << 13)
452#define RCC_AHB1LPENR_CRCLPEN (1 << 12)
453#define RCC_AHB1LPENR_GPIOKLPEN (1 << 10)
454#define RCC_AHB1LPENR_GPIOJLPEN (1 << 9)
455#define RCC_AHB1LPENR_GPIOILPEN (1 << 8)
456#define RCC_AHB1LPENR_GPIOHLPEN (1 << 7)
457#define RCC_AHB1LPENR_GPIOGLPEN (1 << 6)
458#define RCC_AHB1LPENR_GPIOFLPEN (1 << 5)
459#define RCC_AHB1LPENR_GPIOELPEN (1 << 4)
460#define RCC_AHB1LPENR_GPIODLPEN (1 << 3)
461#define RCC_AHB1LPENR_GPIOCLPEN (1 << 2)
462#define RCC_AHB1LPENR_GPIOBLPEN (1 << 1)
463#define RCC_AHB1LPENR_GPIOALPEN (1 << 0)
467#define RCC_AHB2LPENR_OTGFSLPEN (1 << 7)
468#define RCC_AHB2LPENR_RNGLPEN (1 << 6)
469#define RCC_AHB2LPENR_HASHLPEN (1 << 5)
470#define RCC_AHB2LPENR_CRYPLPEN (1 << 4)
471#define RCC_AHB2LPENR_DCMILPEN (1 << 0)
475#define RCC_AHB3LPENR_QSPILPEN (1 << 1)
476#define RCC_AHB3LPENR_FMCLPEN (1 << 0)
480#define RCC_APB1LPENR_UART8LPEN (1 << 31)
481#define RCC_APB1LPENR_UART7LPEN (1 << 30)
482#define RCC_APB1LPENR_DACLPEN (1 << 29)
483#define RCC_APB1LPENR_PWRLPEN (1 << 28)
484#define RCC_APB1LPENR_CECLPEN (1 << 27)
485#define RCC_APB1LPENR_CAN2LPEN (1 << 26)
486#define RCC_APB1LPENR_CAN1LPEN (1 << 25)
487#define RCC_APB1LPENR_I2C4LPEN (1 << 24)
488#define RCC_APB1LPENR_I2C3LPEN (1 << 23)
489#define RCC_APB1LPENR_I2C2LPEN (1 << 22)
490#define RCC_APB1LPENR_I2C1LPEN (1 << 21)
491#define RCC_APB1LPENR_UART5LPEN (1 << 20)
492#define RCC_APB1LPENR_UART4LPEN (1 << 19)
493#define RCC_APB1LPENR_USART3LPEN (1 << 18)
494#define RCC_APB1LPENR_USART2LPEN (1 << 17)
495#define RCC_APB1LPENR_SPIDIFRXLPEN (1 << 16)
496#define RCC_APB1LPENR_SPI3LPEN (1 << 15)
497#define RCC_APB1LPENR_SPI2LPEN (1 << 14)
498#define RCC_APB1LPENR_WWDGLPEN (1 << 11)
499#define RCC_APB1LPENR_LPTIM1LPEN (1 << 9)
500#define RCC_APB1LPENR_TIM14LPEN (1 << 8)
501#define RCC_APB1LPENR_TIM13LPEN (1 << 7)
502#define RCC_APB1LPENR_TIM12LPEN (1 << 6)
503#define RCC_APB1LPENR_TIM7LPEN (1 << 5)
504#define RCC_APB1LPENR_TIM6LPEN (1 << 4)
505#define RCC_APB1LPENR_TIM5LPEN (1 << 3)
506#define RCC_APB1LPENR_TIM4LPEN (1 << 2)
507#define RCC_APB1LPENR_TIM3LPEN (1 << 1)
508#define RCC_APB1LPENR_TIM2LPEN (1 << 0)
512#define RCC_APB2LPENR_LTDCLPEN (1 << 26)
513#define RCC_APB2LPENR_SAI2LPEN (1 << 23)
514#define RCC_APB2LPENR_SAI1LPEN (1 << 22)
515#define RCC_APB2LPENR_SPI6LPEN (1 << 21)
516#define RCC_APB2LPENR_SPI5LPEN (1 << 20)
517#define RCC_APB2LPENR_TIM11LPEN (1 << 18)
518#define RCC_APB2LPENR_TIM10LPEN (1 << 17)
519#define RCC_APB2LPENR_TIM9LPEN (1 << 16)
520#define RCC_APB2LPENR_SYSCFGLPEN (1 << 14)
521#define RCC_APB2LPENR_SPI4LPEN (1 << 13)
522#define RCC_APB2LPENR_SPI1LPEN (1 << 12)
523#define RCC_APB2LPENR_SDMMC1LPEN (1 << 11)
524#define RCC_APB2LPENR_ADC3LPEN (1 << 10)
525#define RCC_APB2LPENR_ADC2LPEN (1 << 9)
526#define RCC_APB2LPENR_ADC1LPEN (1 << 8)
527#define RCC_APB2LPENR_USART6LPEN (1 << 5)
528#define RCC_APB2LPENR_USART1LPEN (1 << 4)
529#define RCC_APB2LPENR_TIM8LPEN (1 << 1)
530#define RCC_APB2LPENR_TIM1LPEN (1 << 0)
534#define RCC_BDCR_BDRST (1 << 16)
535#define RCC_BDCR_RTCEN (1 << 15)
536#define RCC_BDCR_RTCSEL_MASK 0x3
537#define RCC_BDCR_RTCSEL_SHIFT 8
538#define RCC_BDCR_RTCSEL_NONE 0
539#define RCC_BDCR_RTCSEL_LSE 1
540#define RCC_BDCR_RTCSEL_LSI 2
541#define RCC_BDCR_RTCSEL_HSE 3
542#define RCC_BDCR_LSEDRV_MASK 0x3
543#define RCC_BDCR_LSEDRV_SHIFT 3
544#define RCC_BDCR_LSEDRV_LOW 0
545#define RCC_BDCR_LSEDRV_MEDH 1
546#define RCC_BDCR_LSEDRV_MEDL 2
547#define RCC_BDCR_LSEDRV_HIGH 3
548#define RCC_BDCR_LSEBYP (1 << 2)
549#define RCC_BDCR_LSERDY (1 << 1)
550#define RCC_BDCR_LSEON (1 << 0)
554#define RCC_CSR_LPWRRSTF (1 << 31)
555#define RCC_CSR_WWDGRSTF (1 << 30)
556#define RCC_CSR_IWDGRSTF (1 << 29)
557#define RCC_CSR_SFTRSTF (1 << 28)
558#define RCC_CSR_PORRSTF (1 << 27)
559#define RCC_CSR_PINRSTF (1 << 26)
560#define RCC_CSR_BORRSTF (1 << 25)
561#define RCC_CSR_RMVF (1 << 24)
562#define RCC_CSR_RESET_FLAGS (RCC_CSR_LPWRRSTF | RCC_CSR_WWDGRSTF |\
563 RCC_CSR_IWDGRSTF | RCC_CSR_SFTRSTF | RCC_CSR_PORRSTF |\
564 RCC_CSR_PINRSTF | RCC_CSR_BORRSTF)
565#define RCC_CSR_LSIRDY (1 << 1)
566#define RCC_CSR_LSION (1 << 0)
570#define RCC_SSCGR_SSCGEN (1 << 31)
571#define RCC_SSCGR_SPREADSEL (1 << 30)
572#define RCC_SSCGR_INCSTEP_MASK 0x7fff
573#define RCC_SSCGR_INCSTEP_SHIFT 13
574#define RCC_SSCGR_MODPER_MASK 0x1fff
575#define RCC_SSCGR_MODPER_SHIFT 0
580#define RCC_PLLI2SCFGR_PLLI2S_MASK 0x7
581#define RCC_PLLI2SCFGR_PLLI2S_SHIFT 28
582#define RCC_PLLI2SCFGR_PLLI2SQ_MASK 0xf
583#define RCC_PLLI2SCFGR_PLLI2SQ_SHIFT 24
584#define RCC_PLLI2SCFGR_PLLI2SP_MASK 0x3
585#define RCC_PLLI2SCFGR_PLLI2SP_SHIFT 16
586#define RCC_PLLI2SCFGR_PLLI2SN_MASK 0x1ff
587#define RCC_PLLI2SCFGR_PLLI2SN_SHIFT 6
591#define RCC_PLLSAICFGR_PLLSAIR_MASK 0x7
592#define RCC_PLLSAICFGR_PLLSAIR_SHIFT 28
593#define RCC_PLLSAICFGR_PLLSAIQ_MASK 0xf
594#define RCC_PLLSAICFGR_PLLSAIQ_SHIFT 24
595#define RCC_PLLSAICFGR_PLLSAIP_MASK 0x3
596#define RCC_PLLSAICFGR_PLLSAIP_SHIFT 16
597#define RCC_PLLSAICFGR_PLLSAIN_MASK 0x1FF
598#define RCC_PLLSAICFGR_PLLSAIN_SHIFT 6
602#define RCC_DCKCFGR1_TIMPRE (1<<24)
603#define RCC_DCKCFGR1_SAI2SEL_MASK 0x3
604#define RCC_DCKCFGR1_SAI2SEL_SHIFT 22
605#define RCC_DCKCFGR1_SAI1SEL_MASK 0x3
606#define RCC_DCKCFGR1_SAI1SEL_SHIFT 20
607#define RCC_DCKCFGR1_PLLSAIDIVR_MASK 0x3
608#define RCC_DCKCFGR1_PLLSAIDIVR_SHIFT 16
609#define RCC_DCKCFGR1_PLLSAIDIVR_DIVR_2 0
610#define RCC_DCKCFGR1_PLLSAIDIVR_DIVR_4 1
611#define RCC_DCKCFGR1_PLLSAIDIVR_DIVR_8 2
612#define RCC_DCKCFGR1_PLLSAIDIVR_DIVR_16 3
613#define RCC_DCKCFGR1_PLLSAIDIVQ_MASK 0x1f
614#define RCC_DCKCFGR1_PLLSAIDIVQ_SHIFT 8
615#define RCC_DCKCFGR1_PLLI2SDIVQ_MASK 0x1f
616#define RCC_DCKCFGR1_PLLI2SDIVQ_SHIFT 0
620#define RCC_DCKCFGR2_SDMMCSEL (1<<28)
621#define RCC_DCKCFGR2_CK48MSEL (1<<27)
622#define RCC_DCKCFGR2_CECSEL (1<<26)
623#define RCC_DCKCFGR2_LPTIM1SEL_MASK 0x3
624#define RCC_DCKCFGR2_LPTIM1SEL_SHIFT 24
625#define RCC_DCKCFGR2_I2CxSEL_MASK 0x3
626#define RCC_DCKCFGR2_I2C4SEL_SHIFT 22
627#define RCC_DCKCFGR2_I2C3SEL_SHIFT 20
628#define RCC_DCKCFGR2_I2C2SEL_SHIFT 18
629#define RCC_DCKCFGR2_I2C1SEL_SHIFT 16
631#define RCC_DCKCFGR2_UARTxSEL_MASK 0x3
636#define RCC_DCKCFGR2_UART8SEL_SHIFT 14
637#define RCC_DCKCFGR2_UART7SEL_SHIFT 12
638#define RCC_DCKCFGR2_USART6SEL_SHIFT 10
639#define RCC_DCKCFGR2_UART5SEL_SHIFT 8
640#define RCC_DCKCFGR2_UART4SEL_SHIFT 6
641#define RCC_DCKCFGR2_UART3SEL_SHIFT 4
642#define RCC_DCKCFGR2_UART2SEL_SHIFT 2
643#define RCC_DCKCFGR2_UART1SEL_SHIFT 0
649#define RCC_DCKCFGR2_UARTxSEL_PCLK 0x0
650#define RCC_DCKCFGR2_UARTxSEL_SYSCLK 0x1
651#define RCC_DCKCFGR2_UARTxSEL_HSI 0x2
652#define RCC_DCKCFGR2_UARTxSEL_LSE 0x3
697#define _REG_BIT(base, bit) (((base) << 5) + (bit))
int rcc_osc_ready_int_flag(enum rcc_osc osc)
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)
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_set_rtcpre(uint32_t rtcpre)
void rcc_osc_ready_int_enable(enum rcc_osc osc)
void rcc_clock_setup_hse(const struct rcc_clock_scale *clock, uint32_t hse_mhz)
const struct rcc_clock_scale rcc_3v3[RCC_CLOCK_3V3_END]
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.
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_ppre2(uint32_t ppre2)
void rcc_set_main_pll_hse(uint32_t pllm, uint32_t plln, uint32_t pllp, uint32_t pllq)
void rcc_set_main_pll_hsi(uint32_t pllm, uint32_t plln, uint32_t pllp, uint32_t pllq)
void rcc_css_enable(void)
void rcc_set_hpre(uint32_t hpre)
void rcc_clock_setup_hsi(const struct rcc_clock_scale *clock)
enum pwr_vos_scale vos_scale
uint32_t flash_waitstates