libopencm3
A free/libre/open-source firmware library for various ARM Cortex-M3 microcontrollers.
f2/rcc.h
Go to the documentation of this file.
1/** @defgroup rcc_defines RCC Defines
2 *
3 * @brief <b>Defined Constants and Types for the STM32F2xx Reset and Clock
4 * Control</b>
5 *
6 * @ingroup STM32F2xx_defines
7 *
8 * @version 1.0.0
9 *
10 * @author @htmlonly &copy; @endhtmlonly 2009
11 * Federico Ruiz-Ugalde <memeruiz at gmail dot com>
12 * @author @htmlonly &copy; @endhtmlonly 2009
13 * Uwe Hermann <uwe@hermann-uwe.de>
14 * @author @htmlonly &copy; @endhtmlonly 2011
15 * Fergus Noble <fergusnoble@gmail.com>
16 *
17 * @date 18 August 2012
18 *
19 * LGPL License Terms @ref lgpl_license
20 * */
21/*
22 * This file is part of the libopencm3 project.
23 *
24 * Copyright (C) 2009 Uwe Hermann <uwe@hermann-uwe.de>
25 * Copyright (C) 2009 Federico Ruiz-Ugalde <memeruiz at gmail dot com>
26 * Copyright (C) 2011 Fergus Noble <fergusnoble@gmail.com>
27 *
28 * This library is free software: you can redistribute it and/or modify
29 * it under the terms of the GNU Lesser General Public License as published by
30 * the Free Software Foundation, either version 3 of the License, or
31 * (at your option) any later version.
32 *
33 * This library is distributed in the hope that it will be useful,
34 * but WITHOUT ANY WARRANTY; without even the implied warranty of
35 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
36 * GNU Lesser General Public License for more details.
37 *
38 * You should have received a copy of the GNU Lesser General Public License
39 * along with this library. If not, see <http://www.gnu.org/licenses/>.
40 */
41/**@{*/
42
43#ifndef LIBOPENCM3_RCC_H
44#define LIBOPENCM3_RCC_H
45
46/* --- RCC registers ------------------------------------------------------- */
47
48#define RCC_CR MMIO32(RCC_BASE + 0x00)
49#define RCC_PLLCFGR MMIO32(RCC_BASE + 0x04)
50#define RCC_CFGR MMIO32(RCC_BASE + 0x08)
51#define RCC_CIR MMIO32(RCC_BASE + 0x0c)
52#define RCC_AHB1RSTR MMIO32(RCC_BASE + 0x10)
53#define RCC_AHB2RSTR MMIO32(RCC_BASE + 0x14)
54#define RCC_AHB3RSTR MMIO32(RCC_BASE + 0x18)
55/* RCC_BASE + 0x1c Reserved */
56#define RCC_APB1RSTR MMIO32(RCC_BASE + 0x20)
57#define RCC_APB2RSTR MMIO32(RCC_BASE + 0x24)
58/* RCC_BASE + 0x28 Reserved */
59/* RCC_BASE + 0x2c Reserved */
60#define RCC_AHB1ENR MMIO32(RCC_BASE + 0x30)
61#define RCC_AHB2ENR MMIO32(RCC_BASE + 0x34)
62#define RCC_AHB3ENR MMIO32(RCC_BASE + 0x38)
63/* RCC_BASE + 0x3c Reserved */
64#define RCC_APB1ENR MMIO32(RCC_BASE + 0x40)
65#define RCC_APB2ENR MMIO32(RCC_BASE + 0x44)
66/* RCC_BASE + 0x48 Reserved */
67/* RCC_BASE + 0x4c Reserved */
68#define RCC_AHB1LPENR MMIO32(RCC_BASE + 0x50)
69#define RCC_AHB2LPENR MMIO32(RCC_BASE + 0x54)
70#define RCC_AHB3LPENR MMIO32(RCC_BASE + 0x58)
71/* RCC_BASE + 0x5c Reserved */
72#define RCC_APB1LPENR MMIO32(RCC_BASE + 0x60)
73#define RCC_APB2LPENR MMIO32(RCC_BASE + 0x64)
74/* RCC_BASE + 0x68 Reserved */
75/* RCC_BASE + 0x6c Reserved */
76#define RCC_BDCR MMIO32(RCC_BASE + 0x70)
77#define RCC_CSR MMIO32(RCC_BASE + 0x74)
78/* RCC_BASE + 0x78 Reserved */
79/* RCC_BASE + 0x7c Reserved */
80#define RCC_SSCGR MMIO32(RCC_BASE + 0x80)
81#define RCC_PLLI2SCFGR MMIO32(RCC_BASE + 0x84)
82
83/* --- RCC_CR values ------------------------------------------------------- */
84
85#define RCC_CR_PLLI2SRDY (1 << 27)
86#define RCC_CR_PLLI2SON (1 << 26)
87#define RCC_CR_PLLRDY (1 << 25)
88#define RCC_CR_PLLON (1 << 24)
89#define RCC_CR_CSSON (1 << 19)
90#define RCC_CR_HSEBYP (1 << 18)
91#define RCC_CR_HSERDY (1 << 17)
92#define RCC_CR_HSEON (1 << 16)
93/* HSICAL: [15:8] */
94/* HSITRIM: [7:3] */
95#define RCC_CR_HSIRDY (1 << 1)
96#define RCC_CR_HSION (1 << 0)
97
98/* --- RCC_PLLCFGR values -------------------------------------------------- */
99
100/* PLLQ: [27:24] */
101#define RCC_PLLCFGR_PLLQ_SHIFT 24
102#define RCC_PLLCFGR_PLLSRC (1 << 22)
103/* PLLP: [17:16] */
104#define RCC_PLLCFGR_PLLP_SHIFT 16
105/* PLLN: [14:6] */
106#define RCC_PLLCFGR_PLLN_SHIFT 6
107/* PLLM: [5:0] */
108#define RCC_PLLCFGR_PLLM_SHIFT 0
109
110/* --- RCC_CFGR values ----------------------------------------------------- */
111
112/* MCO2: Microcontroller clock output 2 */
113#define RCC_CFGR_MCO2_SHIFT 30
114#define RCC_CFGR_MCO2_SYSCLK 0x0
115#define RCC_CFGR_MCO2_PLLI2S 0x1
116#define RCC_CFGR_MCO2_HSE 0x2
117#define RCC_CFGR_MCO2_PLL 0x3
118
119/* MCO1/2PRE: MCO Prescalers */
120#define RCC_CFGR_MCO2PRE_SHIFT 27
121#define RCC_CFGR_MCO1PRE_SHIFT 24
122#define RCC_CFGR_MCOPRE_DIV_NONE 0x0
123#define RCC_CFGR_MCOPRE_DIV_2 0x4
124#define RCC_CFGR_MCOPRE_DIV_3 0x5
125#define RCC_CFGR_MCOPRE_DIV_4 0x6
126#define RCC_CFGR_MCOPRE_DIV_5 0x7
127
128/* I2SSRC: I2S clock selection */
129#define RCC_CFGR_I2SSRC (1 << 23)
130
131/* MCO1: Microcontroller clock output 1 */
132#define RCC_CFGR_MCO1_SHIFT 21
133#define RCC_CFGR_MCO1_MASK 0x3
134#define RCC_CFGR_MCO1_HSI 0x0
135#define RCC_CFGR_MCO1_LSE 0x1
136#define RCC_CFGR_MCO1_HSE 0x2
137#define RCC_CFGR_MCO1_PLL 0x3
138#define RCC_CFGR_MCO_SHIFT RCC_CFGR_MCO1_SHIFT
139#define RCC_CFGR_MCO_MASK RCC_CFGR_MCO1_MASK
140
141/* RTCPRE: HSE division factor for RTC clock */
142#define RCC_CFGR_RTCPRE_SHIFT 16
143#define RCC_CFGR_RTCPRE_MASK 0x1f
144
145#define RCC_CFGR_PPRE2_SHIFT 13
146#define RCC_CFGR_PPRE2_MASK 0x7
147#define RCC_CFGR_PPRE1_SHIFT 10
148#define RCC_CFGR_PPRE1_MASK 0x7
149/** @defgroup rcc_cfgr_apbxpre RCC_CFGR APBx prescale factors
150 * These can be used for both APB1 and APB2 prescaling
151 * @{
152 */
153#define RCC_CFGR_PPRE_NODIV 0x0
154#define RCC_CFGR_PPRE_DIV2 0x4
155#define RCC_CFGR_PPRE_DIV4 0x5
156#define RCC_CFGR_PPRE_DIV8 0x6
157#define RCC_CFGR_PPRE_DIV16 0x7
158/**@}*/
159
160#define RCC_CFGR_HPRE_SHIFT 4
161#define RCC_CFGR_HPRE_MASK 0xf
162/** @defgroup rcc_cfgr_ahbpre RCC_CFGR AHB prescale factors
163@{*/
164#define RCC_CFGR_HPRE_NODIV 0x0
165#define RCC_CFGR_HPRE_DIV2 (0x8 + 0)
166#define RCC_CFGR_HPRE_DIV4 (0x8 + 1)
167#define RCC_CFGR_HPRE_DIV8 (0x8 + 2)
168#define RCC_CFGR_HPRE_DIV16 (0x8 + 3)
169#define RCC_CFGR_HPRE_DIV64 (0x8 + 4)
170#define RCC_CFGR_HPRE_DIV128 (0x8 + 5)
171#define RCC_CFGR_HPRE_DIV256 (0x8 + 6)
172#define RCC_CFGR_HPRE_DIV512 (0x8 + 7)
173/**@}*/
174
175/* SWS: System clock switch status */
176#define RCC_CFGR_SWS_SHIFT 2
177#define RCC_CFGR_SWS_MASK 0x3
178#define RCC_CFGR_SWS_HSI 0x0
179#define RCC_CFGR_SWS_HSE 0x1
180#define RCC_CFGR_SWS_PLL 0x2
181
182/* SW: System clock switch */
183#define RCC_CFGR_SW_SHIFT 0
184#define RCC_CFGR_SW_HSI 0x0
185#define RCC_CFGR_SW_HSE 0x1
186#define RCC_CFGR_SW_PLL 0x2
187
188/** Older compatible definitions to ease migration
189 * @defgroup rcc_cfgr_deprecated RCC_CFGR Deprecated dividers
190 * @deprecated Use _CFGR_xPRE_DIVn form instead, across all families
191 * @{
192 */
193#define RCC_CFGR_PPRE_DIV_NONE 0x0
194#define RCC_CFGR_PPRE_DIV_2 0x4
195#define RCC_CFGR_PPRE_DIV_4 0x5
196#define RCC_CFGR_PPRE_DIV_8 0x6
197#define RCC_CFGR_PPRE_DIV_16 0x7
198
199#define RCC_CFGR_HPRE_DIV_NONE 0x0
200#define RCC_CFGR_HPRE_DIV_2 (0x8 + 0)
201#define RCC_CFGR_HPRE_DIV_4 (0x8 + 1)
202#define RCC_CFGR_HPRE_DIV_8 (0x8 + 2)
203#define RCC_CFGR_HPRE_DIV_16 (0x8 + 3)
204#define RCC_CFGR_HPRE_DIV_64 (0x8 + 4)
205#define RCC_CFGR_HPRE_DIV_128 (0x8 + 5)
206#define RCC_CFGR_HPRE_DIV_256 (0x8 + 6)
207#define RCC_CFGR_HPRE_DIV_512 (0x8 + 7)
208/**@}*/
209
210/* --- RCC_CIR values ------------------------------------------------------ */
211
212/* Clock security system interrupt clear bit */
213#define RCC_CIR_CSSC (1 << 23)
214
215/* OSC ready interrupt clear bits */
216#define RCC_CIR_PLLI2SRDYC (1 << 21)
217#define RCC_CIR_PLLRDYC (1 << 20)
218#define RCC_CIR_HSERDYC (1 << 19)
219#define RCC_CIR_HSIRDYC (1 << 18)
220#define RCC_CIR_LSERDYC (1 << 17)
221#define RCC_CIR_LSIRDYC (1 << 16)
222
223/* OSC ready interrupt enable bits */
224#define RCC_CIR_PLLI2SRDYIE (1 << 13)
225#define RCC_CIR_PLLRDYIE (1 << 12)
226#define RCC_CIR_HSERDYIE (1 << 11)
227#define RCC_CIR_HSIRDYIE (1 << 10)
228#define RCC_CIR_LSERDYIE (1 << 9)
229#define RCC_CIR_LSIRDYIE (1 << 8)
230
231/* Clock security system interrupt flag bit */
232#define RCC_CIR_CSSF (1 << 7)
233
234/* OSC ready interrupt flag bits */
235#define RCC_CIR_PLLI2SRDYF (1 << 5)
236#define RCC_CIR_PLLRDYF (1 << 4)
237#define RCC_CIR_HSERDYF (1 << 3)
238#define RCC_CIR_HSIRDYF (1 << 2)
239#define RCC_CIR_LSERDYF (1 << 1)
240#define RCC_CIR_LSIRDYF (1 << 0)
241
242/** @defgroup rcc_ahbrstr_rst RCC_AHBxRSTR reset values (full set)
243@{*/
244/** @defgroup rcc_ahb1rstr_rst RCC_AHB1RSTR reset values
245@{*/
246#define RCC_AHB1RSTR_OTGHSRST (1 << 29)
247#define RCC_AHB1RSTR_ETHMACRST (1 << 25)
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_GPIOIRST (1 << 8)
252#define RCC_AHB1RSTR_GPIOHRST (1 << 7)
253#define RCC_AHB1RSTR_GPIOGRST (1 << 6)
254#define RCC_AHB1RSTR_GPIOFRST (1 << 5)
255#define RCC_AHB1RSTR_GPIOERST (1 << 4)
256#define RCC_AHB1RSTR_GPIODRST (1 << 3)
257#define RCC_AHB1RSTR_GPIOCRST (1 << 2)
258#define RCC_AHB1RSTR_GPIOBRST (1 << 1)
259#define RCC_AHB1RSTR_GPIOARST (1 << 0)
260/**@}*/
261
262/** @addtogroup deprecated_201802_rcc Deprecated 2018
263 * @deprecated replace zzz_IOPxRST with zzz_GPIOxRST
264 * @{
265 */
266#define RCC_AHB1RSTR_IOPIRST RCC_AHB1RSTR_GPIOIRST
267#define RCC_AHB1RSTR_IOPHRST RCC_AHB1RSTR_GPIOHRST
268#define RCC_AHB1RSTR_IOPGRST RCC_AHB1RSTR_GPIOGRST
269#define RCC_AHB1RSTR_IOPFRST RCC_AHB1RSTR_GPIOFRST
270#define RCC_AHB1RSTR_IOPERST RCC_AHB1RSTR_GPIOERST
271#define RCC_AHB1RSTR_IOPDRST RCC_AHB1RSTR_GPIODRST
272#define RCC_AHB1RSTR_IOPCRST RCC_AHB1RSTR_GPIOCRST
273#define RCC_AHB1RSTR_IOPBRST RCC_AHB1RSTR_GPIOBRST
274#define RCC_AHB1RSTR_IOPARST RCC_AHB1RSTR_GPIOARST
275/**@}*/
276
277/** @defgroup rcc_ahb2rstr_rst RCC_AHB2RSTR reset values
278@{*/
279#define RCC_AHB2RSTR_OTGFSRST (1 << 7)
280#define RCC_AHB2RSTR_RNGRST (1 << 6)
281#define RCC_AHB2RSTR_HASHRST (1 << 5)
282#define RCC_AHB2RSTR_CRYPRST (1 << 4)
283#define RCC_AHB2RSTR_DCMIRST (1 << 0)
284/**@}*/
285
286/** @defgroup rcc_ahb3rstr_rst RCC_AHB3RSTR reset values
287@{*/
288#define RCC_AHB3RSTR_FSMCRST (1 << 0)
289/**@}*/
290/**@}*/
291
292/** @defgroup rcc_apb1rstr_rst RCC_APB1RSTR reset values
293@{*/
294#define RCC_APB1RSTR_DACRST (1 << 29)
295#define RCC_APB1RSTR_PWRRST (1 << 28)
296#define RCC_APB1RSTR_CAN2RST (1 << 26)
297#define RCC_APB1RSTR_CAN1RST (1 << 25)
298#define RCC_APB1RSTR_I2C3RST (1 << 23)
299#define RCC_APB1RSTR_I2C2RST (1 << 22)
300#define RCC_APB1RSTR_I2C1RST (1 << 21)
301#define RCC_APB1RSTR_UART5RST (1 << 20)
302#define RCC_APB1RSTR_UART4RST (1 << 19)
303#define RCC_APB1RSTR_USART3RST (1 << 18)
304#define RCC_APB1RSTR_USART2RST (1 << 17)
305#define RCC_APB1RSTR_SPI3RST (1 << 15)
306#define RCC_APB1RSTR_SPI2RST (1 << 14)
307#define RCC_APB1RSTR_WWDGRST (1 << 11)
308#define RCC_APB1RSTR_TIM14RST (1 << 8)
309#define RCC_APB1RSTR_TIM13RST (1 << 7)
310#define RCC_APB1RSTR_TIM12RST (1 << 6)
311#define RCC_APB1RSTR_TIM7RST (1 << 5)
312#define RCC_APB1RSTR_TIM6RST (1 << 4)
313#define RCC_APB1RSTR_TIM5RST (1 << 3)
314#define RCC_APB1RSTR_TIM4RST (1 << 2)
315#define RCC_APB1RSTR_TIM3RST (1 << 1)
316#define RCC_APB1RSTR_TIM2RST (1 << 0)
317/**@}*/
318
319/** @defgroup rcc_apb2rstr_rst RCC_APB2RSTR reset values
320@{*/
321#define RCC_APB2RSTR_TIM11RST (1 << 18)
322#define RCC_APB2RSTR_TIM10RST (1 << 17)
323#define RCC_APB2RSTR_TIM9RST (1 << 16)
324#define RCC_APB2RSTR_SYSCFGRST (1 << 14)
325#define RCC_APB2RSTR_SPI1RST (1 << 12)
326#define RCC_APB2RSTR_SDIORST (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)
332/**@}*/
333
334/** @defgroup rcc_ahbenr_en RCC_AHBxENR enable values (full set)
335@{*/
336/** @defgroup rcc_ahb1enr_en RCC_AHB1ENR enable values
337@{*/
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_DMA2EN (1 << 22)
345#define RCC_AHB1ENR_DMA1EN (1 << 21)
346#define RCC_AHB1ENR_BKPSRAMEN (1 << 18)
347#define RCC_AHB1ENR_CRCEN (1 << 12)
348#define RCC_AHB1ENR_GPIOIEN (1 << 8)
349#define RCC_AHB1ENR_GPIOHEN (1 << 7)
350#define RCC_AHB1ENR_GPIOGEN (1 << 6)
351#define RCC_AHB1ENR_GPIOFEN (1 << 5)
352#define RCC_AHB1ENR_GPIOEEN (1 << 4)
353#define RCC_AHB1ENR_GPIODEN (1 << 3)
354#define RCC_AHB1ENR_GPIOCEN (1 << 2)
355#define RCC_AHB1ENR_GPIOBEN (1 << 1)
356#define RCC_AHB1ENR_GPIOAEN (1 << 0)
357/**@}*/
358
359/** @addtogroup deprecated_201802_rcc Deprecated 2018
360 * @deprecated replace zzz_IOPxEN with zzz_GPIOxEN
361 * @{
362 */
363#define RCC_AHB1ENR_IOPIEN RCC_AHB1ENR_GPIOIEN
364#define RCC_AHB1ENR_IOPHEN RCC_AHB1ENR_GPIOHEN
365#define RCC_AHB1ENR_IOPGEN RCC_AHB1ENR_GPIOGEN
366#define RCC_AHB1ENR_IOPFEN RCC_AHB1ENR_GPIOFEN
367#define RCC_AHB1ENR_IOPEEN RCC_AHB1ENR_GPIOEEN
368#define RCC_AHB1ENR_IOPDEN RCC_AHB1ENR_GPIODEN
369#define RCC_AHB1ENR_IOPCEN RCC_AHB1ENR_GPIOCEN
370#define RCC_AHB1ENR_IOPBEN RCC_AHB1ENR_GPIOBEN
371#define RCC_AHB1ENR_IOPAEN RCC_AHB1ENR_GPIOAEN
372/**@}*/
373
374/** @defgroup rcc_ahb2enr_en RCC_AHB2ENR enable values
375@{*/
376#define RCC_AHB2ENR_OTGFSEN (1 << 7)
377#define RCC_AHB2ENR_RNGEN (1 << 6)
378#define RCC_AHB2ENR_HASHEN (1 << 5)
379#define RCC_AHB2ENR_CRYPEN (1 << 4)
380#define RCC_AHB2ENR_DCMIEN (1 << 0)
381/**@}*/
382
383/** @defgroup rcc_ahb3enr_en RCC_AHB3ENR enable values
384@{*/
385#define RCC_AHB3ENR_FSMCEN (1 << 0)
386/**@}*/
387/**@}*/
388
389/** @defgroup rcc_apb1enr_en RCC_APB1ENR enable values
390@{*/
391#define RCC_APB1ENR_DACEN (1 << 29)
392#define RCC_APB1ENR_PWREN (1 << 28)
393#define RCC_APB1ENR_CAN2EN (1 << 26)
394#define RCC_APB1ENR_CAN1EN (1 << 25)
395#define RCC_APB1ENR_I2C3EN (1 << 23)
396#define RCC_APB1ENR_I2C2EN (1 << 22)
397#define RCC_APB1ENR_I2C1EN (1 << 21)
398#define RCC_APB1ENR_UART5EN (1 << 20)
399#define RCC_APB1ENR_UART4EN (1 << 19)
400#define RCC_APB1ENR_USART3EN (1 << 18)
401#define RCC_APB1ENR_USART2EN (1 << 17)
402#define RCC_APB1ENR_SPI3EN (1 << 15)
403#define RCC_APB1ENR_SPI2EN (1 << 14)
404#define RCC_APB1ENR_WWDGEN (1 << 11)
405#define RCC_APB1ENR_TIM14EN (1 << 8)
406#define RCC_APB1ENR_TIM13EN (1 << 7)
407#define RCC_APB1ENR_TIM12EN (1 << 6)
408#define RCC_APB1ENR_TIM7EN (1 << 5)
409#define RCC_APB1ENR_TIM6EN (1 << 4)
410#define RCC_APB1ENR_TIM5EN (1 << 3)
411#define RCC_APB1ENR_TIM4EN (1 << 2)
412#define RCC_APB1ENR_TIM3EN (1 << 1)
413#define RCC_APB1ENR_TIM2EN (1 << 0)
414/**@}*/
415
416/** @defgroup rcc_apb2enr_en RCC_APB2ENR enable values
417@{*/
418#define RCC_APB2ENR_TIM11EN (1 << 18)
419#define RCC_APB2ENR_TIM10EN (1 << 17)
420#define RCC_APB2ENR_TIM9EN (1 << 16)
421#define RCC_APB2ENR_SYSCFGEN (1 << 14)
422#define RCC_APB2ENR_SPI1EN (1 << 12)
423#define RCC_APB2ENR_SDIOEN (1 << 11)
424#define RCC_APB2ENR_ADC3EN (1 << 10)
425#define RCC_APB2ENR_ADC2EN (1 << 9)
426#define RCC_APB2ENR_ADC1EN (1 << 8)
427#define RCC_APB2ENR_USART6EN (1 << 5)
428#define RCC_APB2ENR_USART1EN (1 << 4)
429#define RCC_APB2ENR_TIM8EN (1 << 1)
430#define RCC_APB2ENR_TIM1EN (1 << 0)
431/**@}*/
432
433/* --- RCC_AHB1LPENR values ------------------------------------------------- */
434
435#define RCC_AHB1LPENR_OTGHSULPILPEN (1 << 30)
436#define RCC_AHB1LPENR_OTGHSLPEN (1 << 29)
437#define RCC_AHB1LPENR_ETHMACPTPLPEN (1 << 28)
438#define RCC_AHB1LPENR_ETHMACRXLPEN (1 << 27)
439#define RCC_AHB1LPENR_ETHMACTXLPEN (1 << 26)
440#define RCC_AHB1LPENR_ETHMACLPEN (1 << 25)
441#define RCC_AHB1LPENR_DMA2LPEN (1 << 22)
442#define RCC_AHB1LPENR_DMA1LPEN (1 << 21)
443#define RCC_AHB1LPENR_BKPSRAMLPEN (1 << 18)
444#define RCC_AHB1LPENR_SRAM2LPEN (1 << 17)
445#define RCC_AHB1LPENR_SRAM1LPEN (1 << 16)
446#define RCC_AHB1LPENR_FLITFLPEN (1 << 15)
447#define RCC_AHB1LPENR_CRCLPEN (1 << 12)
448#define RCC_AHB1LPENR_GPIOILPEN (1 << 8)
449#define RCC_AHB1LPENR_GPIOHLPEN (1 << 7)
450#define RCC_AHB1LPENR_GPIOGLPEN (1 << 6)
451#define RCC_AHB1LPENR_GPIOFLPEN (1 << 5)
452#define RCC_AHB1LPENR_GPIOELPEN (1 << 4)
453#define RCC_AHB1LPENR_GPIODLPEN (1 << 3)
454#define RCC_AHB1LPENR_GPIOCLPEN (1 << 2)
455#define RCC_AHB1LPENR_GPIOBLPEN (1 << 1)
456#define RCC_AHB1LPENR_GPIOALPEN (1 << 0)
457
458/** @addtogroup deprecated_201802_rcc Deprecated 2018
459 * @deprecated replace zzz_IOPxLPEN with zzz_GPIOxLPEN
460 * @{
461 */
462#define RCC_AHB1LPENR_IOPILPEN RCC_AHB1LPENR_GPIOILPEN
463#define RCC_AHB1LPENR_IOPHLPEN RCC_AHB1LPENR_GPIOHLPEN
464#define RCC_AHB1LPENR_IOPGLPEN RCC_AHB1LPENR_GPIOGLPEN
465#define RCC_AHB1LPENR_IOPFLPEN RCC_AHB1LPENR_GPIOFLPEN
466#define RCC_AHB1LPENR_IOPELPEN RCC_AHB1LPENR_GPIOELPEN
467#define RCC_AHB1LPENR_IOPDLPEN RCC_AHB1LPENR_GPIODLPEN
468#define RCC_AHB1LPENR_IOPCLPEN RCC_AHB1LPENR_GPIOCLPEN
469#define RCC_AHB1LPENR_IOPBLPEN RCC_AHB1LPENR_GPIOBLPEN
470#define RCC_AHB1LPENR_IOPALPEN RCC_AHB1LPENR_GPIOALPEN
471/**@}*/
472
473/* --- RCC_AHB2LPENR values ------------------------------------------------- */
474
475#define RCC_AHB2LPENR_OTGFSLPEN (1 << 7)
476#define RCC_AHB2LPENR_RNGLPEN (1 << 6)
477#define RCC_AHB2LPENR_HASHLPEN (1 << 5)
478#define RCC_AHB2LPENR_CRYPLPEN (1 << 4)
479#define RCC_AHB2LPENR_DCMILPEN (1 << 0)
480
481/* --- RCC_AHB3LPENR values ------------------------------------------------- */
482
483#define RCC_AHB3LPENR_FSMCLPEN (1 << 0)
484
485/* --- RCC_APB1LPENR values ------------------------------------------------- */
486
487#define RCC_APB1LPENR_DACLPEN (1 << 29)
488#define RCC_APB1LPENR_PWRLPEN (1 << 28)
489#define RCC_APB1LPENR_CAN2LPEN (1 << 26)
490#define RCC_APB1LPENR_CAN1LPEN (1 << 25)
491#define RCC_APB1LPENR_I2C3LPEN (1 << 23)
492#define RCC_APB1LPENR_I2C2LPEN (1 << 22)
493#define RCC_APB1LPENR_I2C1LPEN (1 << 21)
494#define RCC_APB1LPENR_UART5LPEN (1 << 20)
495#define RCC_APB1LPENR_UART4LPEN (1 << 19)
496#define RCC_APB1LPENR_USART3LPEN (1 << 18)
497#define RCC_APB1LPENR_USART2LPEN (1 << 17)
498#define RCC_APB1LPENR_SPI3LPEN (1 << 15)
499#define RCC_APB1LPENR_SPI2LPEN (1 << 14)
500#define RCC_APB1LPENR_WWDGLPEN (1 << 11)
501#define RCC_APB1LPENR_TIM14LPEN (1 << 8)
502#define RCC_APB1LPENR_TIM13LPEN (1 << 7)
503#define RCC_APB1LPENR_TIM12LPEN (1 << 6)
504#define RCC_APB1LPENR_TIM7LPEN (1 << 5)
505#define RCC_APB1LPENR_TIM6LPEN (1 << 4)
506#define RCC_APB1LPENR_TIM5LPEN (1 << 3)
507#define RCC_APB1LPENR_TIM4LPEN (1 << 2)
508#define RCC_APB1LPENR_TIM3LPEN (1 << 1)
509#define RCC_APB1LPENR_TIM2LPEN (1 << 0)
510
511/* --- RCC_APB2LPENR values ------------------------------------------------- */
512
513#define RCC_APB2LPENR_TIM11LPEN (1 << 18)
514#define RCC_APB2LPENR_TIM10LPEN (1 << 17)
515#define RCC_APB2LPENR_TIM9LPEN (1 << 16)
516#define RCC_APB2LPENR_SYSCFGLPEN (1 << 14)
517#define RCC_APB2LPENR_SPI1LPEN (1 << 12)
518#define RCC_APB2LPENR_SDIOLPEN (1 << 11)
519#define RCC_APB2LPENR_ADC3LPEN (1 << 10)
520#define RCC_APB2LPENR_ADC2LPEN (1 << 9)
521#define RCC_APB2LPENR_ADC1LPEN (1 << 8)
522#define RCC_APB2LPENR_USART6LPEN (1 << 5)
523#define RCC_APB2LPENR_USART1LPEN (1 << 4)
524#define RCC_APB2LPENR_TIM8LPEN (1 << 1)
525#define RCC_APB2LPENR_TIM1LPEN (1 << 0)
526
527/* --- RCC_BDCR values ----------------------------------------------------- */
528
529#define RCC_BDCR_BDRST (1 << 16)
530#define RCC_BDCR_RTCEN (1 << 15)
531/* RCC_BDCR[9:8]: RTCSEL */
532#define RCC_BDCR_LSEBYP (1 << 2)
533#define RCC_BDCR_LSERDY (1 << 1)
534#define RCC_BDCR_LSEON (1 << 0)
535
536/* --- RCC_CSR values ------------------------------------------------------ */
537
538#define RCC_CSR_LPWRRSTF (1 << 31)
539#define RCC_CSR_WWDGRSTF (1 << 30)
540#define RCC_CSR_IWDGRSTF (1 << 29)
541#define RCC_CSR_SFTRSTF (1 << 28)
542#define RCC_CSR_PORRSTF (1 << 27)
543#define RCC_CSR_PINRSTF (1 << 26)
544#define RCC_CSR_BORRSTF (1 << 25)
545#define RCC_CSR_RMVF (1 << 24)
546#define RCC_CSR_RESET_FLAGS (RCC_CSR_LPWRRSTF | RCC_CSR_WWDGRSTF |\
547 RCC_CSR_IWDGRSTF | RCC_CSR_SFTRSTF | RCC_CSR_PORRSTF |\
548 RCC_CSR_PINRSTF | RCC_CSR_BORRSTF)
549#define RCC_CSR_LSIRDY (1 << 1)
550#define RCC_CSR_LSION (1 << 0)
551
552/* --- RCC_SSCGR values ---------------------------------------------------- */
553
554/* PLL spread spectrum clock generation documented in Datasheet. */
555
556#define RCC_SSCGR_SSCGEN (1 << 31)
557#define RCC_SSCGR_SPREADSEL (1 << 30)
558/* RCC_SSCGR[27:16]: INCSTEP */
559#define RCC_SSCGR_INCSTEP_SHIFT 16
560/* RCC_SSCGR[15:0]: MODPER */
561#define RCC_SSCGR_MODPER_SHIFT 15
562
563/* --- RCC_PLLI2SCFGR values ----------------------------------------------- */
564
565/* RCC_PLLI2SCFGR[30:28]: PLLI2SR */
566#define RCC_PLLI2SCFGR_PLLI2SR_SHIFT 28
567/* RCC_PLLI2SCFGR[14:6]: PLLI2SN */
568#define RCC_PLLI2SCFGR_PLLI2SN_SHIFT 6
569
570/* --- Variable definitions ------------------------------------------------ */
571extern uint32_t rcc_ahb_frequency;
572extern uint32_t rcc_apb1_frequency;
573extern uint32_t rcc_apb2_frequency;
574
575/* --- Function prototypes ------------------------------------------------- */
576
581
583 uint8_t pllm;
584 uint16_t plln;
585 uint8_t pllp;
586 uint8_t pllq;
587 uint32_t flash_config;
588 uint8_t hpre;
589 uint8_t ppre1;
590 uint8_t ppre2;
593};
594
596
602 RCC_LSI
604
605#define _REG_BIT(base, bit) (((base) << 5) + (bit))
606
608 /* AHB1 peripherals */
609 RCC_GPIOA = _REG_BIT(0x30, 0),
610 RCC_GPIOB = _REG_BIT(0x30, 1),
611 RCC_GPIOC = _REG_BIT(0x30, 2),
612 RCC_GPIOD = _REG_BIT(0x30, 3),
613 RCC_GPIOE = _REG_BIT(0x30, 4),
614 RCC_GPIOF = _REG_BIT(0x30, 5),
615 RCC_GPIOG = _REG_BIT(0x30, 6),
616 RCC_GPIOH = _REG_BIT(0x30, 7),
617 RCC_GPIOI = _REG_BIT(0x30, 8),
618 RCC_CRC = _REG_BIT(0x30, 12),
620 RCC_DMA1 = _REG_BIT(0x30, 21),
621 RCC_DMA2 = _REG_BIT(0x30, 22),
622 RCC_ETHMAC = _REG_BIT(0x30, 25),
626 RCC_OTGHS = _REG_BIT(0x30, 29),
628
629 /* AHB2 peripherals */
630 RCC_DCMI = _REG_BIT(0x34, 0),
631 RCC_CRYP = _REG_BIT(0x34, 4),
632 RCC_HASH = _REG_BIT(0x34, 5),
633 RCC_RNG = _REG_BIT(0x34, 6),
634 RCC_OTGFS = _REG_BIT(0x34, 7),
635
636 /* AHB3 peripherals */
637 RCC_FSMC = _REG_BIT(0x38, 0),
638
639 /* APB1 peripherals */
640 RCC_TIM2 = _REG_BIT(0x40, 0),
641 RCC_TIM3 = _REG_BIT(0x40, 1),
642 RCC_TIM4 = _REG_BIT(0x40, 2),
643 RCC_TIM5 = _REG_BIT(0x40, 3),
644 RCC_TIM6 = _REG_BIT(0x40, 4),
645 RCC_TIM7 = _REG_BIT(0x40, 5),
646 RCC_TIM12 = _REG_BIT(0x40, 6),
647 RCC_TIM13 = _REG_BIT(0x40, 7),
648 RCC_TIM14 = _REG_BIT(0x40, 8),
649 RCC_WWDG = _REG_BIT(0x40, 11),
650 RCC_SPI2 = _REG_BIT(0x40, 14),
651 RCC_SPI3 = _REG_BIT(0x40, 15),
652 RCC_USART2 = _REG_BIT(0x40, 17),
653 RCC_USART3 = _REG_BIT(0x40, 18),
654 RCC_UART4 = _REG_BIT(0x40, 19),
655 RCC_UART5 = _REG_BIT(0x40, 20),
656 RCC_I2C1 = _REG_BIT(0x40, 21),
657 RCC_I2C2 = _REG_BIT(0x40, 22),
658 RCC_I2C3 = _REG_BIT(0x40, 23),
659 RCC_CAN1 = _REG_BIT(0x40, 25),
660 RCC_CAN2 = _REG_BIT(0x40, 26),
661 RCC_PWR = _REG_BIT(0x40, 28),
662 RCC_DAC = _REG_BIT(0x40, 29),
663
664 /* APB2 peripherals */
665 RCC_TIM1 = _REG_BIT(0x44, 0),
666 RCC_TIM8 = _REG_BIT(0x44, 1),
669 RCC_ADC1 = _REG_BIT(0x44, 8),
670 RCC_ADC2 = _REG_BIT(0x44, 9),
671 RCC_ADC3 = _REG_BIT(0x44, 10),
672 RCC_SDIO = _REG_BIT(0x44, 11),
673 RCC_SPI1 = _REG_BIT(0x44, 12),
674 RCC_SYSCFG = _REG_BIT(0x44, 14),
675 RCC_TIM9 = _REG_BIT(0x44, 16),
676 RCC_TIM10 = _REG_BIT(0x44, 17),
677 RCC_TIM11 = _REG_BIT(0x44, 18),
678
679 /* Extended peripherals */
680 RCC_RTC = _REG_BIT(0x70, 15),/* BDCR[15] */
681
682 /* AHB1 peripherals */
683 SCC_GPIOA = _REG_BIT(0x50, 0),
684 SCC_GPIOB = _REG_BIT(0x50, 1),
685 SCC_GPIOC = _REG_BIT(0x50, 2),
686 SCC_GPIOD = _REG_BIT(0x50, 3),
687 SCC_GPIOE = _REG_BIT(0x50, 4),
688 SCC_GPIOF = _REG_BIT(0x50, 5),
689 SCC_GPIOG = _REG_BIT(0x50, 6),
690 SCC_GPIOH = _REG_BIT(0x50, 7),
691 SCC_GPIOI = _REG_BIT(0x50, 8),
692 SCC_CRC = _REG_BIT(0x50, 12),
693 SCC_FLTIF = _REG_BIT(0x50, 15),
694 SCC_SRAM1 = _REG_BIT(0x50, 16),
695 SCC_SRAM2 = _REG_BIT(0x50, 17),
697 SCC_DMA1 = _REG_BIT(0x50, 21),
698 SCC_DMA2 = _REG_BIT(0x50, 22),
699 SCC_ETHMAC = _REG_BIT(0x50, 25),
703 SCC_OTGHS = _REG_BIT(0x50, 29),
705
706 /* AHB2 peripherals */
707 SCC_DCMI = _REG_BIT(0x54, 0),
708 SCC_CRYP = _REG_BIT(0x54, 4),
709 SCC_HASH = _REG_BIT(0x54, 5),
710 SCC_RNG = _REG_BIT(0x54, 6),
711 SCC_OTGFS = _REG_BIT(0x54, 7),
712
713 /* AHB3 peripherals */
714 SCC_FSMC = _REG_BIT(0x58, 0),
715
716 /* APB1 peripherals */
717 SCC_TIM2 = _REG_BIT(0x60, 0),
718 SCC_TIM3 = _REG_BIT(0x60, 1),
719 SCC_TIM4 = _REG_BIT(0x60, 2),
720 SCC_TIM5 = _REG_BIT(0x60, 3),
721 SCC_TIM6 = _REG_BIT(0x60, 4),
722 SCC_TIM7 = _REG_BIT(0x60, 5),
723 SCC_TIM12 = _REG_BIT(0x60, 6),
724 SCC_TIM13 = _REG_BIT(0x60, 7),
725 SCC_TIM14 = _REG_BIT(0x60, 8),
726 SCC_WWDG = _REG_BIT(0x60, 11),
727 SCC_SPI2 = _REG_BIT(0x60, 14),
728 SCC_SPI3 = _REG_BIT(0x60, 15),
729 SCC_USART2 = _REG_BIT(0x60, 17),
730 SCC_USART3 = _REG_BIT(0x60, 18),
731 SCC_UART4 = _REG_BIT(0x60, 19),
732 SCC_UART5 = _REG_BIT(0x60, 20),
733 SCC_I2C1 = _REG_BIT(0x60, 21),
734 SCC_I2C2 = _REG_BIT(0x60, 22),
735 SCC_I2C3 = _REG_BIT(0x60, 23),
736 SCC_CAN1 = _REG_BIT(0x60, 25),
737 SCC_CAN2 = _REG_BIT(0x60, 26),
738 SCC_PWR = _REG_BIT(0x60, 28),
739 SCC_DAC = _REG_BIT(0x60, 29),
740
741 /* APB2 peripherals */
742 SCC_TIM1 = _REG_BIT(0x64, 0),
743 SCC_TIM8 = _REG_BIT(0x64, 1),
746 SCC_ADC1 = _REG_BIT(0x64, 8),
747 SCC_ADC2 = _REG_BIT(0x64, 9),
748 SCC_ADC3 = _REG_BIT(0x64, 10),
749 SCC_SDIO = _REG_BIT(0x64, 11),
750 SCC_SPI1 = _REG_BIT(0x64, 12),
751 SCC_SYSCFG = _REG_BIT(0x64, 14),
752 SCC_TIM9 = _REG_BIT(0x64, 16),
753 SCC_TIM10 = _REG_BIT(0x64, 17),
754 SCC_TIM11 = _REG_BIT(0x64, 18),
755};
756
758 /* AHB1 peripherals */
759 RST_GPIOA = _REG_BIT(0x10, 0),
760 RST_GPIOB = _REG_BIT(0x10, 1),
761 RST_GPIOC = _REG_BIT(0x10, 2),
762 RST_GPIOD = _REG_BIT(0x10, 3),
763 RST_GPIOE = _REG_BIT(0x10, 4),
764 RST_GPIOF = _REG_BIT(0x10, 5),
765 RST_GPIOG = _REG_BIT(0x10, 6),
766 RST_GPIOH = _REG_BIT(0x10, 7),
767 RST_GPIOI = _REG_BIT(0x10, 8),
768 RST_CRC = _REG_BIT(0x10, 12),
769 RST_DMA1 = _REG_BIT(0x10, 21),
770 RST_DMA2 = _REG_BIT(0x10, 22),
771 RST_ETHMAC = _REG_BIT(0x10, 25),
772 RST_OTGHS = _REG_BIT(0x10, 29),
773
774 /* AHB2 peripherals */
775 RST_DCMI = _REG_BIT(0x14, 0),
776 RST_CRYP = _REG_BIT(0x14, 4),
777 RST_HASH = _REG_BIT(0x14, 5),
778 RST_RNG = _REG_BIT(0x14, 6),
779 RST_OTGFS = _REG_BIT(0x14, 7),
780
781 /* AHB3 peripherals */
782 RST_FSMC = _REG_BIT(0x18, 0),
783
784 /* APB1 peripherals */
785 RST_TIM2 = _REG_BIT(0x20, 0),
786 RST_TIM3 = _REG_BIT(0x20, 1),
787 RST_TIM4 = _REG_BIT(0x20, 2),
788 RST_TIM5 = _REG_BIT(0x20, 3),
789 RST_TIM6 = _REG_BIT(0x20, 4),
790 RST_TIM7 = _REG_BIT(0x20, 5),
791 RST_TIM12 = _REG_BIT(0x20, 6),
792 RST_TIM13 = _REG_BIT(0x20, 7),
793 RST_TIM14 = _REG_BIT(0x20, 8),
794 RST_WWDG = _REG_BIT(0x20, 11),
795 RST_SPI2 = _REG_BIT(0x20, 14),
796 RST_SPI3 = _REG_BIT(0x20, 15),
797 RST_USART2 = _REG_BIT(0x20, 17),
798 RST_USART3 = _REG_BIT(0x20, 18),
799 RST_UART4 = _REG_BIT(0x20, 19),
800 RST_UART5 = _REG_BIT(0x20, 20),
801 RST_I2C1 = _REG_BIT(0x20, 21),
802 RST_I2C2 = _REG_BIT(0x20, 22),
803 RST_I2C3 = _REG_BIT(0x20, 23),
804 RST_CAN1 = _REG_BIT(0x20, 25),
805 RST_CAN2 = _REG_BIT(0x20, 26),
806 RST_PWR = _REG_BIT(0x20, 28),
807 RST_DAC = _REG_BIT(0x20, 29),
808
809 /* APB2 peripherals */
810 RST_TIM1 = _REG_BIT(0x24, 0),
811 RST_TIM8 = _REG_BIT(0x24, 1),
814 RST_ADC = _REG_BIT(0x24, 8),
815 RST_SDIO = _REG_BIT(0x24, 11),
816 RST_SPI1 = _REG_BIT(0x24, 12),
817 RST_SYSCFG = _REG_BIT(0x24, 14),
818 RST_TIM9 = _REG_BIT(0x24, 16),
819 RST_TIM10 = _REG_BIT(0x24, 17),
820 RST_TIM11 = _REG_BIT(0x24, 18),
821};
822
823#undef _REG_BIT
824
826
828
829void rcc_osc_ready_int_clear(enum rcc_osc osc);
830void rcc_osc_ready_int_enable(enum rcc_osc osc);
832int rcc_osc_ready_int_flag(enum rcc_osc osc);
833void rcc_css_int_clear(void);
834int rcc_css_int_flag(void);
836void rcc_osc_on(enum rcc_osc osc);
837void rcc_osc_off(enum rcc_osc osc);
838void rcc_css_enable(void);
839void rcc_css_disable(void);
840void rcc_set_sysclk_source(uint32_t clk);
841void rcc_set_pll_source(uint32_t pllsrc);
842void rcc_set_ppre2(uint32_t ppre2);
843void rcc_set_ppre1(uint32_t ppre1);
844void rcc_set_hpre(uint32_t hpre);
845void rcc_set_rtcpre(uint32_t rtcpre);
846void rcc_set_main_pll_hsi(uint32_t pllm, uint32_t plln, uint32_t pllp,
847 uint32_t pllq);
848void rcc_set_main_pll_hse(uint32_t pllm, uint32_t plln, uint32_t pllp,
849 uint32_t pllq);
850uint32_t rcc_system_clock_source(void);
851void rcc_clock_setup_hse_3v3(const struct rcc_clock_scale *clock);
852void rcc_backupdomain_reset(void);
853uint32_t rcc_get_usart_clk_freq(uint32_t usart);
854uint32_t rcc_get_timer_clk_freq(uint32_t timer);
855uint32_t rcc_get_i2c_clk_freq(uint32_t i2c);
856uint32_t rcc_get_spi_clk_freq(uint32_t spi);
857
859
860#endif
861/**@}*/
862
#define END_DECLS
Definition: common.h:34
#define BEGIN_DECLS
Definition: common.h:33
int rcc_osc_ready_int_flag(enum rcc_osc osc)
Definition: rcc.c:130
void rcc_clock_setup_hse_3v3(const struct rcc_clock_scale *clock)
Definition: rcc.c:337
int rcc_css_int_flag(void)
Definition: rcc.c:158
void rcc_osc_ready_int_clear(enum rcc_osc osc)
Definition: rcc.c:67
void rcc_css_disable(void)
Definition: rcc.c:253
uint32_t rcc_get_spi_clk_freq(uint32_t spi)
Get the peripheral clock speed for the SPI device at base specified.
Definition: rcc.c:437
void rcc_set_sysclk_source(uint32_t clk)
Definition: rcc.c:258
uint32_t rcc_apb2_frequency
Definition: rcc.c:49
void rcc_set_pll_source(uint32_t pllsrc)
Definition: rcc.c:267
uint32_t rcc_get_timer_clk_freq(uint32_t timer)
Get the peripheral clock speed for the Timer at base specified.
Definition: rcc.c:410
uint32_t rcc_system_clock_source(void)
Definition: rcc.c:331
const struct rcc_clock_scale rcc_hse_8mhz_3v3[RCC_CLOCK_3V3_END]
Definition: rcc.c:51
uint32_t rcc_get_usart_clk_freq(uint32_t usart)
Get the peripheral clock speed for the USART at base specified.
Definition: rcc.c:397
rcc_periph_rst
Definition: f2/rcc.h:757
rcc_periph_clken
Definition: f2/rcc.h:607
void rcc_set_rtcpre(uint32_t rtcpre)
Definition: rcc.c:303
void rcc_osc_ready_int_enable(enum rcc_osc osc)
Definition: rcc.c:88
rcc_osc
Definition: f2/rcc.h:597
void rcc_osc_ready_int_disable(enum rcc_osc osc)
Definition: rcc.c:109
void rcc_osc_on(enum rcc_osc osc)
Definition: rcc.c:206
#define _REG_BIT(base, bit)
Definition: f2/rcc.h:605
uint32_t rcc_ahb_frequency
Definition: rcc.c:47
void rcc_osc_off(enum rcc_osc osc)
Definition: rcc.c:227
uint32_t rcc_get_i2c_clk_freq(uint32_t i2c)
Get the peripheral clock speed for the I2C device at base specified.
Definition: rcc.c:428
rcc_clock_3v3
Definition: f2/rcc.h:577
void rcc_backupdomain_reset(void)
Definition: rcc.c:383
uint32_t rcc_apb1_frequency
Definition: rcc.c:48
void rcc_wait_for_sysclk_status(enum rcc_osc osc)
Definition: rcc.c:185
void rcc_set_ppre1(uint32_t ppre1)
Definition: rcc.c:285
void rcc_css_int_clear(void)
Definition: rcc.c:153
void rcc_set_ppre2(uint32_t ppre2)
Definition: rcc.c:276
void rcc_set_main_pll_hse(uint32_t pllm, uint32_t plln, uint32_t pllp, uint32_t pllq)
Definition: rcc.c:321
void rcc_set_main_pll_hsi(uint32_t pllm, uint32_t plln, uint32_t pllp, uint32_t pllq)
Definition: rcc.c:312
void rcc_css_enable(void)
Definition: rcc.c:248
void rcc_set_hpre(uint32_t hpre)
Definition: rcc.c:294
@ RST_DMA2
Definition: f2/rcc.h:770
@ RST_FSMC
Definition: f2/rcc.h:782
@ RST_DMA1
Definition: f2/rcc.h:769
@ RST_SPI1
Definition: f2/rcc.h:816
@ RST_I2C3
Definition: f2/rcc.h:803
@ RST_USART6
Definition: f2/rcc.h:813
@ RST_GPIOI
Definition: f2/rcc.h:767
@ RST_OTGHS
Definition: f2/rcc.h:772
@ RST_GPIOG
Definition: f2/rcc.h:765
@ RST_RNG
Definition: f2/rcc.h:778
@ RST_TIM14
Definition: f2/rcc.h:793
@ RST_GPIOF
Definition: f2/rcc.h:764
@ RST_SPI2
Definition: f2/rcc.h:795
@ RST_GPIOH
Definition: f2/rcc.h:766
@ RST_TIM9
Definition: f2/rcc.h:818
@ RST_UART4
Definition: f2/rcc.h:799
@ RST_TIM8
Definition: f2/rcc.h:811
@ RST_TIM3
Definition: f2/rcc.h:786
@ RST_TIM12
Definition: f2/rcc.h:791
@ RST_TIM10
Definition: f2/rcc.h:819
@ RST_DCMI
Definition: f2/rcc.h:775
@ RST_GPIOA
Definition: f2/rcc.h:759
@ RST_ETHMAC
Definition: f2/rcc.h:771
@ RST_GPIOC
Definition: f2/rcc.h:761
@ RST_TIM6
Definition: f2/rcc.h:789
@ RST_GPIOB
Definition: f2/rcc.h:760
@ RST_TIM1
Definition: f2/rcc.h:810
@ RST_SPI3
Definition: f2/rcc.h:796
@ RST_CRYP
Definition: f2/rcc.h:776
@ RST_USART3
Definition: f2/rcc.h:798
@ RST_DAC
Definition: f2/rcc.h:807
@ RST_ADC
Definition: f2/rcc.h:814
@ RST_TIM13
Definition: f2/rcc.h:792
@ RST_TIM7
Definition: f2/rcc.h:790
@ RST_TIM2
Definition: f2/rcc.h:785
@ RST_CAN2
Definition: f2/rcc.h:805
@ RST_CRC
Definition: f2/rcc.h:768
@ RST_GPIOD
Definition: f2/rcc.h:762
@ RST_TIM4
Definition: f2/rcc.h:787
@ RST_TIM5
Definition: f2/rcc.h:788
@ RST_SYSCFG
Definition: f2/rcc.h:817
@ RST_UART5
Definition: f2/rcc.h:800
@ RST_GPIOE
Definition: f2/rcc.h:763
@ RST_HASH
Definition: f2/rcc.h:777
@ RST_I2C2
Definition: f2/rcc.h:802
@ RST_CAN1
Definition: f2/rcc.h:804
@ RST_PWR
Definition: f2/rcc.h:806
@ RST_USART1
Definition: f2/rcc.h:812
@ RST_SDIO
Definition: f2/rcc.h:815
@ RST_WWDG
Definition: f2/rcc.h:794
@ RST_I2C1
Definition: f2/rcc.h:801
@ RST_USART2
Definition: f2/rcc.h:797
@ RST_OTGFS
Definition: f2/rcc.h:779
@ RST_TIM11
Definition: f2/rcc.h:820
@ SCC_CRC
Definition: f2/rcc.h:692
@ SCC_TIM14
Definition: f2/rcc.h:725
@ RCC_TIM8
Definition: f2/rcc.h:666
@ SCC_TIM8
Definition: f2/rcc.h:743
@ SCC_SPI3
Definition: f2/rcc.h:728
@ RCC_UART5
Definition: f2/rcc.h:655
@ RCC_RNG
Definition: f2/rcc.h:633
@ SCC_TIM11
Definition: f2/rcc.h:754
@ RCC_TIM9
Definition: f2/rcc.h:675
@ RCC_FSMC
Definition: f2/rcc.h:637
@ SCC_CAN2
Definition: f2/rcc.h:737
@ SCC_GPIOD
Definition: f2/rcc.h:686
@ SCC_TIM12
Definition: f2/rcc.h:723
@ RCC_SPI2
Definition: f2/rcc.h:650
@ RCC_WWDG
Definition: f2/rcc.h:649
@ SCC_TIM1
Definition: f2/rcc.h:742
@ RCC_TIM3
Definition: f2/rcc.h:641
@ SCC_SPI2
Definition: f2/rcc.h:727
@ RCC_SDIO
Definition: f2/rcc.h:672
@ RCC_TIM1
Definition: f2/rcc.h:665
@ RCC_ETHMACPTP
Definition: f2/rcc.h:625
@ SCC_ETHMACTX
Definition: f2/rcc.h:700
@ SCC_UART4
Definition: f2/rcc.h:731
@ RCC_CAN2
Definition: f2/rcc.h:660
@ SCC_SRAM1
Definition: f2/rcc.h:694
@ RCC_GPIOA
Definition: f2/rcc.h:609
@ SCC_GPIOH
Definition: f2/rcc.h:690
@ SCC_RNG
Definition: f2/rcc.h:710
@ RCC_RTC
Definition: f2/rcc.h:680
@ SCC_TIM13
Definition: f2/rcc.h:724
@ SCC_GPIOA
Definition: f2/rcc.h:683
@ SCC_ADC2
Definition: f2/rcc.h:747
@ SCC_DMA2
Definition: f2/rcc.h:698
@ RCC_TIM2
Definition: f2/rcc.h:640
@ SCC_USART6
Definition: f2/rcc.h:745
@ SCC_TIM6
Definition: f2/rcc.h:721
@ SCC_ADC1
Definition: f2/rcc.h:746
@ RCC_BKPSRAM
Definition: f2/rcc.h:619
@ SCC_TIM2
Definition: f2/rcc.h:717
@ SCC_TIM3
Definition: f2/rcc.h:718
@ SCC_TIM9
Definition: f2/rcc.h:752
@ RCC_GPIOG
Definition: f2/rcc.h:615
@ RCC_GPIOH
Definition: f2/rcc.h:616
@ RCC_TIM10
Definition: f2/rcc.h:676
@ RCC_CAN1
Definition: f2/rcc.h:659
@ SCC_FSMC
Definition: f2/rcc.h:714
@ RCC_PWR
Definition: f2/rcc.h:661
@ RCC_CRC
Definition: f2/rcc.h:618
@ RCC_ETHMACRX
Definition: f2/rcc.h:624
@ SCC_USART2
Definition: f2/rcc.h:729
@ RCC_TIM14
Definition: f2/rcc.h:648
@ RCC_OTGHSULPI
Definition: f2/rcc.h:627
@ RCC_OTGHS
Definition: f2/rcc.h:626
@ SCC_USART3
Definition: f2/rcc.h:730
@ SCC_I2C2
Definition: f2/rcc.h:734
@ RCC_USART1
Definition: f2/rcc.h:667
@ SCC_WWDG
Definition: f2/rcc.h:726
@ SCC_PWR
Definition: f2/rcc.h:738
@ SCC_SYSCFG
Definition: f2/rcc.h:751
@ RCC_TIM4
Definition: f2/rcc.h:642
@ RCC_I2C1
Definition: f2/rcc.h:656
@ RCC_ADC2
Definition: f2/rcc.h:670
@ SCC_DCMI
Definition: f2/rcc.h:707
@ RCC_TIM13
Definition: f2/rcc.h:647
@ SCC_DAC
Definition: f2/rcc.h:739
@ SCC_ETHMAC
Definition: f2/rcc.h:699
@ RCC_ADC1
Definition: f2/rcc.h:669
@ SCC_SRAM2
Definition: f2/rcc.h:695
@ SCC_SPI1
Definition: f2/rcc.h:750
@ RCC_DCMI
Definition: f2/rcc.h:630
@ SCC_DMA1
Definition: f2/rcc.h:697
@ SCC_ETHMACRX
Definition: f2/rcc.h:701
@ SCC_ADC3
Definition: f2/rcc.h:748
@ RCC_ETHMACTX
Definition: f2/rcc.h:623
@ RCC_USART2
Definition: f2/rcc.h:652
@ SCC_GPIOE
Definition: f2/rcc.h:687
@ RCC_ADC3
Definition: f2/rcc.h:671
@ RCC_TIM12
Definition: f2/rcc.h:646
@ SCC_USART1
Definition: f2/rcc.h:744
@ RCC_USART3
Definition: f2/rcc.h:653
@ SCC_I2C1
Definition: f2/rcc.h:733
@ RCC_TIM5
Definition: f2/rcc.h:643
@ RCC_SPI1
Definition: f2/rcc.h:673
@ RCC_SYSCFG
Definition: f2/rcc.h:674
@ SCC_GPIOC
Definition: f2/rcc.h:685
@ RCC_HASH
Definition: f2/rcc.h:632
@ RCC_ETHMAC
Definition: f2/rcc.h:622
@ RCC_I2C2
Definition: f2/rcc.h:657
@ SCC_HASH
Definition: f2/rcc.h:709
@ RCC_GPIOB
Definition: f2/rcc.h:610
@ RCC_TIM7
Definition: f2/rcc.h:645
@ RCC_GPIOF
Definition: f2/rcc.h:614
@ SCC_GPIOF
Definition: f2/rcc.h:688
@ SCC_OTGFS
Definition: f2/rcc.h:711
@ SCC_ETHMACPTP
Definition: f2/rcc.h:702
@ RCC_GPIOC
Definition: f2/rcc.h:611
@ SCC_FLTIF
Definition: f2/rcc.h:693
@ RCC_CRYP
Definition: f2/rcc.h:631
@ RCC_TIM6
Definition: f2/rcc.h:644
@ RCC_UART4
Definition: f2/rcc.h:654
@ SCC_CAN1
Definition: f2/rcc.h:736
@ SCC_TIM5
Definition: f2/rcc.h:720
@ SCC_I2C3
Definition: f2/rcc.h:735
@ SCC_GPIOB
Definition: f2/rcc.h:684
@ RCC_DMA1
Definition: f2/rcc.h:620
@ RCC_GPIOI
Definition: f2/rcc.h:617
@ RCC_SPI3
Definition: f2/rcc.h:651
@ SCC_GPIOI
Definition: f2/rcc.h:691
@ SCC_GPIOG
Definition: f2/rcc.h:689
@ RCC_DAC
Definition: f2/rcc.h:662
@ RCC_GPIOD
Definition: f2/rcc.h:612
@ SCC_OTGHS
Definition: f2/rcc.h:703
@ SCC_CRYP
Definition: f2/rcc.h:708
@ SCC_SDIO
Definition: f2/rcc.h:749
@ RCC_I2C3
Definition: f2/rcc.h:658
@ RCC_GPIOE
Definition: f2/rcc.h:613
@ RCC_OTGFS
Definition: f2/rcc.h:634
@ SCC_OTGHSULPI
Definition: f2/rcc.h:704
@ SCC_BKPSRAM
Definition: f2/rcc.h:696
@ SCC_UART5
Definition: f2/rcc.h:732
@ SCC_TIM7
Definition: f2/rcc.h:722
@ RCC_USART6
Definition: f2/rcc.h:668
@ RCC_DMA2
Definition: f2/rcc.h:621
@ RCC_TIM11
Definition: f2/rcc.h:677
@ SCC_TIM4
Definition: f2/rcc.h:719
@ SCC_TIM10
Definition: f2/rcc.h:753
@ RCC_HSI
Definition: f2/rcc.h:600
@ RCC_LSI
Definition: f2/rcc.h:602
@ RCC_PLL
Definition: f2/rcc.h:598
@ RCC_LSE
Definition: f2/rcc.h:601
@ RCC_HSE
Definition: f2/rcc.h:599
@ RCC_CLOCK_3V3_120MHZ
Definition: f2/rcc.h:578
@ RCC_CLOCK_3V3_END
Definition: f2/rcc.h:579
uint8_t ppre1
Definition: f2/rcc.h:589
uint8_t pllq
Definition: f2/rcc.h:586
uint8_t ppre2
Definition: f2/rcc.h:590
uint8_t pllp
Definition: f2/rcc.h:585
uint32_t apb1_frequency
Definition: f2/rcc.h:591
uint8_t pllm
Definition: f2/rcc.h:583
uint16_t plln
Definition: f2/rcc.h:584
uint32_t flash_config
Definition: f2/rcc.h:587
uint8_t hpre
Definition: f2/rcc.h:588
uint32_t apb2_frequency
Definition: f2/rcc.h:592