libopencm3
A free/libre/open-source firmware library for various ARM Cortex-M3 microcontrollers.
l4/rcc.h
Go to the documentation of this file.
1/** @defgroup rcc_defines RCC Defines
2 *
3 * @ingroup STM32L4xx_defines
4 *
5 * @brief <b>Defined Constants and Types for the STM32L4xx Reset and Clock
6 * Control</b>
7 *
8 * @version 1.0.0
9 *
10 * @author @htmlonly &copy; @endhtmlonly 2015 Karl Palsson <karlp@tweak.net.au>
11 *
12 * @date 12 November 2015
13 *
14 * LGPL License Terms @ref lgpl_license
15 * */
16
17/*
18 * This file is part of the libopencm3 project.
19 *
20 * Copyright (C) 2015 Karl Palsson <karlp@tweak.net.au>
21 *
22 * This library is free software: you can redistribute it and/or modify
23 * it under the terms of the GNU Lesser General Public License as published by
24 * the Free Software Foundation, either version 3 of the License, or
25 * (at your option) any later version.
26 *
27 * This library is distributed in the hope that it will be useful,
28 * but WITHOUT ANY WARRANTY; without even the implied warranty of
29 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30 * GNU Lesser General Public License for more details.
31 *
32 * You should have received a copy of the GNU Lesser General Public License
33 * along with this library. If not, see <http://www.gnu.org/licenses/>.
34 *
35 */
36
37/**@{*/
38
39#ifndef LIBOPENCM3_RCC_H
40#define LIBOPENCM3_RCC_H
41
43
44/** @defgroup rcc_registers RCC Registers
45 * @brief Reset / Clock Control Registers
46 @{*/
47 /** Clock control register */
48#define RCC_CR MMIO32(RCC_BASE + 0x00)
49#define RCC_ICSCR MMIO32(RCC_BASE + 0x04)
50 /** Clock Configuration register */
51#define RCC_CFGR MMIO32(RCC_BASE + 0x08)
52/** PLL Configuration register */
53#define RCC_PLLCFGR MMIO32(RCC_BASE + 0x0c)
54#define RCC_PLLSAI1_CFGR MMIO32(RCC_BASE + 0x10)
55#define RCC_PLLSAI2_CFGR MMIO32(RCC_BASE + 0x14)
56/** Clock interrupt enable register */
57#define RCC_CIER MMIO32(RCC_BASE + 0x18)
58/** Clock interrupt flag resiger */
59#define RCC_CIFR MMIO32(RCC_BASE + 0x1c)
60/** Clock interrupt clear register */
61#define RCC_CICR MMIO32(RCC_BASE + 0x20)
62#define RCC_AHB1RSTR_OFFSET 0x28
63#define RCC_AHB1RSTR MMIO32(RCC_BASE + RCC_AHB1RSTR_OFFSET)
64#define RCC_AHB2RSTR_OFFSET 0x2c
65#define RCC_AHB2RSTR MMIO32(RCC_BASE + RCC_AHB2RSTR_OFFSET)
66#define RCC_AHB3RSTR_OFFSET 0x30
67#define RCC_AHB3RSTR MMIO32(RCC_BASE + RCC_AHB3RSTR_OFFSET)
68#define RCC_APB1RSTR1_OFFSET 0x38
69#define RCC_APB1RSTR1 MMIO32(RCC_BASE + RCC_APB1RSTR1_OFFSET)
70#define RCC_APB1RSTR2_OFFSET 0x3c
71#define RCC_APB1RSTR2 MMIO32(RCC_BASE + RCC_APB1RSTR2_OFFSET)
72#define RCC_APB2RSTR_OFFSET 0x40
73#define RCC_APB2RSTR MMIO32(RCC_BASE + RCC_APB2RSTR_OFFSET)
74#define RCC_AHB1ENR_OFFSET 0x48
75#define RCC_AHB1ENR MMIO32(RCC_BASE + RCC_AHB1ENR_OFFSET)
76#define RCC_AHB2ENR_OFFSET 0x4c
77#define RCC_AHB2ENR MMIO32(RCC_BASE + RCC_AHB2ENR_OFFSET)
78#define RCC_AHB3ENR_OFFSET 0x50
79#define RCC_AHB3ENR MMIO32(RCC_BASE + RCC_AHB3ENR_OFFSET)
80#define RCC_APB1ENR1_OFFSET 0x58
81#define RCC_APB1ENR1 MMIO32(RCC_BASE + RCC_APB1ENR1_OFFSET)
82#define RCC_APB1ENR2_OFFSET 0x5c
83#define RCC_APB1ENR2 MMIO32(RCC_BASE + RCC_APB1ENR2_OFFSET)
84#define RCC_APB2ENR_OFFSET 0x60
85#define RCC_APB2ENR MMIO32(RCC_BASE + RCC_APB2ENR_OFFSET)
86#define RCC_AHB1SMENR_OFFSET 0x68
87#define RCC_AHB1SMENR MMIO32(RCC_BASE + RCC_AHB1SMENR_OFFSET)
88#define RCC_AHB2SMENR_OFFSET 0x6c
89#define RCC_AHB2SMENR MMIO32(RCC_BASE + RCC_AHB2SMENR_OFFSET)
90#define RCC_AHB3SMENR_OFFSET 0x70
91#define RCC_AHB3SMENR MMIO32(RCC_BASE + RCC_AHB3SMENR_OFFSET)
92#define RCC_APB1SMENR1_OFFSET 0x78
93#define RCC_APB1SMENR1 MMIO32(RCC_BASE + RCC_APB1SMENR1_OFFSET)
94#define RCC_APB1SMENR2_OFFSET 0x7c
95#define RCC_APB1SMENR2 MMIO32(RCC_BASE + RCC_APB1SMENR2_OFFSET)
96#define RCC_APB2SMENR_OFFSET 0x80
97#define RCC_APB2SMENR MMIO32(RCC_BASE + RCC_APB2SMENR_OFFSET)
98#define RCC_CCIPR MMIO32(RCC_BASE + 0x88)
99/** Backup Domain control register */
100#define RCC_BDCR MMIO32(RCC_BASE + 0x90)
101/** Clock control and status register */
102#define RCC_CSR MMIO32(RCC_BASE + 0x94)
103#define RCC_CRRCR MMIO32(RCC_BASE + 0x98)
104#define RCC_CCIPR2 MMIO32(RCC_BASE + 0x9C)
105/** @}*/
106
107/** @defgroup rcc_cr_values RCC_CR values
108 * @ingroup rcc_registers
109 * @brief Clock Control register values
110 @{*/
111#define RCC_CR_PLLSAI2RDY (1 << 29)
112#define RCC_CR_PLLSAI2ON (1 << 28)
113#define RCC_CR_PLLSAI1RDY (1 << 27)
114#define RCC_CR_PLLSAI1ON (1 << 26)
115#define RCC_CR_PLLRDY (1 << 25)
116#define RCC_CR_PLLON (1 << 24)
117#define RCC_CR_CSSON (1 << 19)
118#define RCC_CR_HSEBYP (1 << 18)
119#define RCC_CR_HSERDY (1 << 17)
120#define RCC_CR_HSEON (1 << 16)
121#define RCC_CR_HSIASFS (1 << 11)
122#define RCC_CR_HSIRDY (1 << 10)
123#define RCC_CR_HSIKERON (1 << 9)
124#define RCC_CR_HSION (1 << 8)
125/** @}*/
126
127/** @defgroup rcc_cr_msirange MSI Range
128 * @ingroup STM32L4xx_rcc_defines
129 * @brief Range of the MSI oscillator
130Twelve frequency ranges are available: 100 kHz, 200 kHz, 400 kHz, 800 kHz,
1311 MHz, 2 MHz, 4 MHz (default value), 8 MHz, 16 MHz, 24 MHz, 32 MHz and 48 MHz
132@sa rcc_csr_msirange
133@{*/
134#define RCC_CR_MSIRANGE_SHIFT 4
135#define RCC_CR_MSIRANGE_MASK 0xf
136#define RCC_CR_MSIRANGE_100KHZ 0
137#define RCC_CR_MSIRANGE_200KHZ 1
138#define RCC_CR_MSIRANGE_400KHZ 2
139#define RCC_CR_MSIRANGE_800KHZ 3
140#define RCC_CR_MSIRANGE_1MHZ 4
141#define RCC_CR_MSIRANGE_2MHZ 5
142#define RCC_CR_MSIRANGE_4MHZ 6
143#define RCC_CR_MSIRANGE_8MHZ 7
144#define RCC_CR_MSIRANGE_16MHZ 8
145#define RCC_CR_MSIRANGE_24MHZ 9
146#define RCC_CR_MSIRANGE_32MHZ 10
147#define RCC_CR_MSIRANGE_48MHZ 11
148/**@}*/
149#define RCC_CR_MSIRGSEL (1 << 3)
150#define RCC_CR_MSIPLLEN (1 << 2)
151#define RCC_CR_MSIRDY (1 << 1)
152#define RCC_CR_MSION (1 << 0)
153
154/* --- RCC_CRRCR values ---------------------------------------------------- */
155
156#define RCC_CRRCR_HSI48ON (1 << 0)
157#define RCC_CRRCR_HSI48RDY (1 << 1)
158
159/* --- RCC_ICSCR values ---------------------------------------------------- */
160
161#define RCC_ICSCR_HSITRIM_SHIFT 24
162#define RCC_ICSCR_HSITRIM_MASK 0x1f
163#define RCC_ICSCR_HSICAL_SHIFT 16
164#define RCC_ICSCR_HSICAL_MASK 0xff
165
166#define RCC_ICSCR_MSITRIM_SHIFT 8
167#define RCC_ICSCR_MSITRIM_MASK 0xff
168#define RCC_ICSCR_MSICAL_SHIFT 0
169#define RCC_ICSCR_MSICAL_MASK 0xff
170
171/* --- RCC_CFGR values ----------------------------------------------------- */
172
173/* MCOPRE */
174#define RCC_CFGR_MCOPRE_DIV1 0
175#define RCC_CFGR_MCOPRE_DIV2 1
176#define RCC_CFGR_MCOPRE_DIV4 2
177#define RCC_CFGR_MCOPRE_DIV8 3
178#define RCC_CFGR_MCOPRE_DIV16 4
179#define RCC_CFGR_MCOPRE_SHIFT 28
180#define RCC_CFGR_MCOPRE_MASK 0x7
181
182/* MCO: Microcontroller clock output */
183#define RCC_CFGR_MCO_NOCLK 0x0
184#define RCC_CFGR_MCO_SYSCLK 0x1
185#define RCC_CFGR_MCO_MSI 0x2
186#define RCC_CFGR_MCO_HSI16 0x3
187#define RCC_CFGR_MCO_HSE 0x4
188#define RCC_CFGR_MCO_PLL 0x5
189#define RCC_CFGR_MCO_LSI 0x6
190#define RCC_CFGR_MCO_LSE 0x7
191#define RCC_CFGR_MCO_HSI48 0x8
192#define RCC_CFGR_MCO_SHIFT 24
193#define RCC_CFGR_MCO_MASK 0xf
194
195/* Wakeup from stop clock selection */
196#define RCC_CFGR_STOPWUCK_MSI (0 << 15)
197#define RCC_CFGR_STOPWUCK_HSI16 (1 << 15)
198
199#define RCC_CFGR_PPRE1_SHIFT 8
200#define RCC_CFGR_PPRE1_MASK 0x7
201#define RCC_CFGR_PPRE2_SHIFT 11
202#define RCC_CFGR_PPRE2_MASK 0x7
203/** @defgroup rcc_cfgr_apbxpre RCC_CFGR APBx prescale factors
204 * These can be used for both APB1 and APB2 prescaling
205 * @{
206 */
207#define RCC_CFGR_PPRE_NODIV 0x0
208#define RCC_CFGR_PPRE_DIV2 0x4
209#define RCC_CFGR_PPRE_DIV4 0x5
210#define RCC_CFGR_PPRE_DIV8 0x6
211#define RCC_CFGR_PPRE_DIV16 0x7
212/**@}*/
213
214#define RCC_CFGR_HPRE_SHIFT 4
215#define RCC_CFGR_HPRE_MASK 0xf
216/** @defgroup rcc_cfgr_ahbpre RCC_CFGR AHB prescale factors
217@{*/
218#define RCC_CFGR_HPRE_NODIV 0x0
219#define RCC_CFGR_HPRE_DIV2 (0x8 + 0)
220#define RCC_CFGR_HPRE_DIV4 (0x8 + 1)
221#define RCC_CFGR_HPRE_DIV8 (0x8 + 2)
222#define RCC_CFGR_HPRE_DIV16 (0x8 + 3)
223#define RCC_CFGR_HPRE_DIV64 (0x8 + 4)
224#define RCC_CFGR_HPRE_DIV128 (0x8 + 5)
225#define RCC_CFGR_HPRE_DIV256 (0x8 + 6)
226#define RCC_CFGR_HPRE_DIV512 (0x8 + 7)
227/**@}*/
228
229/* SWS: System clock switch status */
230#define RCC_CFGR_SWS_MSI 0x0
231#define RCC_CFGR_SWS_HSI16 0x1
232#define RCC_CFGR_SWS_HSE 0x2
233#define RCC_CFGR_SWS_PLL 0x3
234#define RCC_CFGR_SWS_MASK 0x3
235#define RCC_CFGR_SWS_SHIFT 2
236
237/* SW: System clock switch */
238#define RCC_CFGR_SW_MSI 0x0
239#define RCC_CFGR_SW_HSI16 0x1
240#define RCC_CFGR_SW_HSE 0x2
241#define RCC_CFGR_SW_PLL 0x3
242#define RCC_CFGR_SW_MASK 0x3
243#define RCC_CFGR_SW_SHIFT 0
244
245/* --- RCC_PLLCFGR - PLL Configuration Register */
246#define RCC_PLLCFGR_PLLR_SHIFT 25
247#define RCC_PLLCFGR_PLLR_MASK 0x3
248#define RCC_PLLCFGR_PLLR_DIV2 0
249#define RCC_PLLCFGR_PLLR_DIV4 1
250#define RCC_PLLCFGR_PLLR_DIV6 2
251#define RCC_PLLCFGR_PLLR_DIV8 3
252#define RCC_PLLCFGR_PLLREN (1<<24)
253
254#define RCC_PLLCFGR_PLLQ_SHIFT 21
255#define RCC_PLLCFGR_PLLQ_MASK 0x3
256#define RCC_PLLCFGR_PLLQ_DIV2 0
257#define RCC_PLLCFGR_PLLQ_DIV4 1
258#define RCC_PLLCFGR_PLLQ_DIV6 2
259#define RCC_PLLCFGR_PLLQ_DIV8 3
260#define RCC_PLLCFGR_PLLQEN (1 << 20)
261
262/* Division for PLLSAI3CLK, 0 == 7, 1 == 17 */
263#define RCC_PLLCFGR_PLLP (1 << 17)
264#define RCC_PLLCFGR_PLLP_DIV7 0
265#define RCC_PLLCFGR_PLLP_DIV17 RCC_PLLCFGR_PLLP
266#define RCC_PLLPEN (1 << 16)
267
268/** @defgroup rcc_pllcfgr_plln RCC_PLLCFGR PLLN values
269@ingroup STM32L4xx_rcc_defines
270 * Allowed values 8 <= n <= 86
271@{*/
272#define RCC_PLLCFGR_PLLN_SHIFT 0x8
273#define RCC_PLLCFGR_PLLN_MASK 0x7f
274/**@}*/
275
276/** @defgroup rcc_pllcfgr_pllm RCC_PLLCFGR PLLM values
277@ingroup STM32L4xx_rcc_defines
278 * Allowed values 1 <= m <= 8
279@{*/
280#define RCC_PLLCFGR_PLLM_SHIFT 0x4
281#define RCC_PLLCFGR_PLLM_MASK 0x7
282#define RCC_PLLCFGR_PLLM(x) ((x)-1)
283/**@}*/
284
285#define RCC_PLLCFGR_PLLSRC_SHIFT 0
286#define RCC_PLLCFGR_PLLSRC_MASK 0x3
287#define RCC_PLLCFGR_PLLSRC_NONE 0
288#define RCC_PLLCFGR_PLLSRC_MSI 1
289#define RCC_PLLCFGR_PLLSRC_HSI16 2
290#define RCC_PLLCFGR_PLLSRC_HSE 3
291
292/* --- RCC_PLLSAI1CFGR ----------------------------------------------------- */
293/* TODO */
294/* --- RCC_PLLSAI2CFGR ----------------------------------------------------- */
295/* TODO */
296
297/* --- RCC_CIER - Clock interrupt enable register -------------------------- */
298
299#define RCC_CIER_HSI48RDYIE (1 << 10)
300#define RCC_CIER_LSE_CSSIE (1 << 9)
301/* OSC ready interrupt enable bits */
302#define RCC_CIER_PLLSAI2RDYIE (1 << 7)
303#define RCC_CIER_PLLSAI1RDYIE (1 << 6)
304#define RCC_CIER_PLLRDYIE (1 << 5)
305#define RCC_CIER_HSERDYIE (1 << 4)
306#define RCC_CIER_HSIRDYIE (1 << 3)
307#define RCC_CIER_MSIRDYIE (1 << 2)
308#define RCC_CIER_LSERDYIE (1 << 1)
309#define RCC_CIER_LSIRDYIE (1 << 0)
310
311/* --- RCC_CIFR - Clock interrupt flag register */
312
313#define RCC_CIFR_HSI48RDYF (1 << 10)
314#define RCC_CIFR_LSECSSF (1 << 9)
315#define RCC_CIFR_CSSF (1 << 8)
316#define RCC_CIFR_PLLSAI2RDYF (1 << 7)
317#define RCC_CIFR_PLLSAI1RDYF (1 << 6)
318#define RCC_CIFR_PLLRDYF (1 << 5)
319#define RCC_CIFR_HSERDYF (1 << 4)
320#define RCC_CIFR_HSIRDYF (1 << 3)
321#define RCC_CIFR_MSIRDYF (1 << 2)
322#define RCC_CIFR_LSERDYF (1 << 1)
323#define RCC_CIFR_LSIRDYF (1 << 0)
324
325/* --- RCC_CICR - Clock interrupt clear register */
326
327#define RCC_CICR_HSI48RDYC (1 << 10)
328#define RCC_CICR_LSECSSC (1 << 9)
329#define RCC_CICR_CSSC (1 << 8)
330#define RCC_CICR_PLLSAI2RDYC (1 << 7)
331#define RCC_CICR_PLLSAI1RDYC (1 << 6)
332#define RCC_CICR_PLLRDYC (1 << 5)
333#define RCC_CICR_HSERDYC (1 << 4)
334#define RCC_CICR_HSIRDYC (1 << 3)
335#define RCC_CICR_MSIRDYC (1 << 2)
336#define RCC_CICR_LSERDYC (1 << 1)
337#define RCC_CICR_LSIRDYC (1 << 0)
338
339/** @defgroup rcc_ahbrstr_rst RCC_AHBxRSTR reset values (full set)
340@{*/
341/** @defgroup rcc_ahb1rstr_rst RCC_AHB1RSTR reset values
342@{*/
343#define RCC_AHB1RSTR_TSCRST (1 << 16)
344#define RCC_AHB1RSTR_CRCRST (1 << 12)
345#define RCC_AHB1RSTR_FLASHRST (1 << 8)
346#define RCC_AHB1RSTR_DMA2RST (1 << 1)
347#define RCC_AHB1RSTR_DMA1RST (1 << 0)
348/**@}*/
349
350/** @defgroup rcc_ahb2rstr_rst RCC_AHB2RSTR reset values
351@{*/
352#define RCC_AHB2RSTR_RNGRST (1 << 18)
353#define RCC_AHB2RSTR_AESRST (1 << 16)
354#define RCC_AHB2RSTR_ADCRST (1 << 13)
355#define RCC_AHB2RSTR_OTGFSRST (1 << 12)
356#define RCC_AHB2RSTR_GPIOHRST (1 << 7)
357#define RCC_AHB2RSTR_GPIOGRST (1 << 6)
358#define RCC_AHB2RSTR_GPIOFRST (1 << 5)
359#define RCC_AHB2RSTR_GPIOERST (1 << 4)
360#define RCC_AHB2RSTR_GPIODRST (1 << 3)
361#define RCC_AHB2RSTR_GPIOCRST (1 << 2)
362#define RCC_AHB2RSTR_GPIOBRST (1 << 1)
363#define RCC_AHB2RSTR_GPIOARST (1 << 0)
364
365/**@}*/
366
367/** @defgroup rcc_ahb3rstr_rst RCC_AHB3RSTR reset values
368@{*/
369#define RCC_AHB3RSTR_QSPIRST (1 << 8)
370#define RCC_AHB3RSTR_FMCRST (1 << 0)
371/**@}*/
372/**@}*/
373
374/** @defgroup rcc_apb1rstr_rst RCC_APB1RSTRx reset values (full set)
375@{*/
376/** @defgroup rcc_apb1rstr1_rst RCC_APB1RSTR1 reset values
377@{*/
378#define RCC_APB1RSTR1_LPTIM1RST (1 << 31)
379#define RCC_APB1RSTR1_OPAMPRST (1 << 30)
380#define RCC_APB1RSTR1_DAC1RST (1 << 29)
381#define RCC_APB1RSTR1_PWRRST (1 << 28)
382#define RCC_APB1RSTR1_CAN2RST (1 << 26)
383#define RCC_APB1RSTR1_CAN1RST (1 << 25)
384#define RCC_APB1RSTR1_I2C3RST (1 << 23)
385#define RCC_APB1RSTR1_I2C2RST (1 << 22)
386#define RCC_APB1RSTR1_I2C1RST (1 << 21)
387#define RCC_APB1RSTR1_UART5RST (1 << 20)
388#define RCC_APB1RSTR1_UART4RST (1 << 19)
389#define RCC_APB1RSTR1_USART3RST (1 << 18)
390#define RCC_APB1RSTR1_USART2RST (1 << 17)
391#define RCC_APB1RSTR1_SPI3RST (1 << 15)
392#define RCC_APB1RSTR1_SPI2RST (1 << 14)
393#define RCC_APB1RSTR1_LCDRST (1 << 9)
394#define RCC_APB1RSTR1_TIM7RST (1 << 5)
395#define RCC_APB1RSTR1_TIM6RST (1 << 4)
396#define RCC_APB1RSTR1_TIM5RST (1 << 3)
397#define RCC_APB1RSTR1_TIM4RST (1 << 2)
398#define RCC_APB1RSTR1_TIM3RST (1 << 1)
399#define RCC_APB1RSTR1_TIM2RST (1 << 0)
400/**@}*/
401
402/** @defgroup rcc_apb1rstr2_rst RCC_APB1RSTR2 reset values
403@{*/
404#define RCC_APB1RSTR2_LPTIM2RST (1 << 5)
405#define RCC_APB1RSTR2_SWPMI1RST (1 << 2)
406#define RCC_APB1RSTR2_LPUART1RST (1 << 0)
407/**@}*/
408/**@}*/
409
410/** @defgroup rcc_apb2rstr_rst RCC_APB2RSTR reset values
411@{*/
412#define RCC_APB2RSTR_DFSDMRST (1 << 24)
413#define RCC_APB2RSTR_SAI2RST (1 << 22)
414#define RCC_APB2RSTR_SAI1RST (1 << 21)
415#define RCC_APB2RSTR_TIM17RST (1 << 18)
416#define RCC_APB2RSTR_TIM16RST (1 << 17)
417#define RCC_APB2RSTR_TIM15RST (1 << 16)
418#define RCC_APB2RSTR_USART1RST (1 << 14)
419#define RCC_APB2RSTR_TIM8RST (1 << 13)
420#define RCC_APB2RSTR_SPI1RST (1 << 12)
421#define RCC_APB2RSTR_TIM1RST (1 << 11)
422#define RCC_APB2RSTR_SDMMC1RST (1 << 10)
423/* Suspect FW_RST at bit 7 to match APB2_ENR ... */
424#define RCC_APB2RSTR_SYSCFGRST (1 << 0)
425/**@}*/
426
427/* --- RCC_AHB1ENR values --------------------------------------------------- */
428
429/** @defgroup rcc_ahbenr_en RCC_AHBxENR enable values (full set)
430 *@{*/
431/** @defgroup rcc_ahb1enr_en RCC_AHB1ENR enable values
432@ingroup STM32L4xx_rcc_defines
433
434@{*/
435#define RCC_AHB1ENR_TSCEN (1 << 16)
436#define RCC_AHB1ENR_CRCEN (1 << 12)
437#define RCC_AHB1ENR_FLASHEN (1 << 8)
438#define RCC_AHB1ENR_DMA2EN (1 << 1)
439#define RCC_AHB1ENR_DMA1EN (1 << 0)
440/**@}*/
441
442/* --- RCC_AHB2ENR values --------------------------------------------------- */
443
444/** @defgroup rcc_ahb2enr_en RCC_AHB2ENR enable values
445@ingroup STM32L4xx_rcc_defines
446
447@{*/
448#define RCC_AHB2ENR_RNGEN (1 << 18)
449#define RCC_AHB2ENR_AESEN (1 << 16)
450#define RCC_AHB2ENR_ADCEN (1 << 13)
451#define RCC_AHB2ENR_OTGFSEN (1 << 12)
452#define RCC_AHB2ENR_GPIOHEN (1 << 7)
453#define RCC_AHB2ENR_GPIOGEN (1 << 6)
454#define RCC_AHB2ENR_GPIOFEN (1 << 5)
455#define RCC_AHB2ENR_GPIOEEN (1 << 4)
456#define RCC_AHB2ENR_GPIODEN (1 << 3)
457#define RCC_AHB2ENR_GPIOCEN (1 << 2)
458#define RCC_AHB2ENR_GPIOBEN (1 << 1)
459#define RCC_AHB2ENR_GPIOAEN (1 << 0)
460/**@}*/
461
462/* --- RCC_AHB3ENR values --------------------------------------------------- */
463
464/** @defgroup rcc_ahb3enr_en RCC_AHB3ENR enable values
465@ingroup STM32L4xx_rcc_defines
466
467@{*/
468#define RCC_AHB3ENR_QSPIEN (1 << 8)
469#define RCC_AHB3ENR_FMCEN (1 << 0)
470/**@}*/
471
472/**@}*/
473
474/* --- RCC_APB1ENR1 values -------------------------------------------------- */
475
476/** @defgroup rcc_apb1enr_en RCC_APB1ENRx enable values (full set)
477 *@{*/
478/** @defgroup rcc_apb1enr1_en RCC_APB1ENR1 enable values
479@ingroup STM32L4xx_rcc_defines
480
481@{*/
482#define RCC_APB1ENR1_LPTIM1EN (1 << 31)
483#define RCC_APB1ENR1_OPAMPEN (1 << 30)
484#define RCC_APB1ENR1_DAC1EN (1 << 29)
485#define RCC_APB1ENR1_PWREN (1 << 28)
486#define RCC_APB1ENR1_CAN2EN (1 << 26)
487#define RCC_APB1ENR1_CAN1EN (1 << 25)
488#define RCC_APB1ENR1_I2C3EN (1 << 23)
489#define RCC_APB1ENR1_I2C2EN (1 << 22)
490#define RCC_APB1ENR1_I2C1EN (1 << 21)
491#define RCC_APB1ENR1_UART5EN (1 << 20)
492#define RCC_APB1ENR1_UART4EN (1 << 19)
493#define RCC_APB1ENR1_USART3EN (1 << 18)
494#define RCC_APB1ENR1_USART2EN (1 << 17)
495#define RCC_APB1ENR1_SPI3EN (1 << 15)
496#define RCC_APB1ENR1_SPI2EN (1 << 14)
497#define RCC_APB1ENR1_LCDEN (1 << 9)
498#define RCC_APB1ENR1_TIM7EN (1 << 5)
499#define RCC_APB1ENR1_TIM6EN (1 << 4)
500#define RCC_APB1ENR1_TIM5EN (1 << 3)
501#define RCC_APB1ENR1_TIM4EN (1 << 2)
502#define RCC_APB1ENR1_TIM3EN (1 << 1)
503#define RCC_APB1ENR1_TIM2EN (1 << 0)
504/**@}*/
505
506/* --- RCC_APB1ENR2 values -------------------------------------------------- */
507
508/** @defgroup rcc_apb1enr2_en RCC_APB1ENR2 enable values
509@ingroup STM32L4xx_rcc_defines
510
511@{*/
512#define RCC_APB1ENR2_LPTIM2EN (1 << 5)
513#define RCC_APB1ENR2_SWPMI1EN (1 << 2)
514#define RCC_APB1ENR2_LPUART1EN (1 << 0)
515/**@}*/
516/**@}*/
517
518/* --- RCC_APB2ENR values -------------------------------------------------- */
519
520/** @defgroup rcc_apb2enr_en RCC_APB2ENR enable values
521@ingroup STM32L4xx_rcc_defines
522
523@{*/
524#define RCC_APB2ENR_DFSDMEN (1 << 24)
525#define RCC_APB2ENR_SAI2EN (1 << 22)
526#define RCC_APB2ENR_SAI1EN (1 << 21)
527#define RCC_APB2ENR_TIM17EN (1 << 18)
528#define RCC_APB2ENR_TIM16EN (1 << 17)
529#define RCC_APB2ENR_TIM15EN (1 << 16)
530#define RCC_APB2ENR_USART1EN (1 << 14)
531#define RCC_APB2ENR_TIM8EN (1 << 13)
532#define RCC_APB2ENR_SPI1EN (1 << 12)
533#define RCC_APB2ENR_TIM1EN (1 << 11)
534#define RCC_APB2ENR_SDMMC1EN (1 << 10)
535#define RCC_APB2ENR_FWEN (1 << 7)
536#define RCC_APB2ENR_SYSCFGEN (1 << 0)
537/**@}*/
538
539/* --- RCC_AHB1SMENR - AHB1 periph clock in sleep mode --------------------- */
540
541#define RCC_AHB1SMENR_TSCSMEN (1 << 16)
542#define RCC_AHB1SMENR_CRCSMEN (1 << 12)
543#define RCC_AHB1SMENR_SRAM1SMEN (1 << 9)
544#define RCC_AHB1SMENR_FLASHSMEN (1 << 8)
545#define RCC_AHB1SMENR_DMA2SMEN (1 << 1)
546#define RCC_AHB1SMENR_DMA1SMEN (1 << 0)
547
548/* --- RCC_AHB2SMENR - AHB2 periph clock in sleep mode --------------------- */
549
550#define RCC_AHB2SMENR_RNGSMEN (1 << 18)
551#define RCC_AHB2SMENR_AESSMEN (1 << 16)
552#define RCC_AHB2SMENR_ADCSMEN (1 << 13)
553#define RCC_AHB2SMENR_OTGFSSMEN (1 << 12)
554#define RCC_AHB2SMENR_SRAM2SMEN (1 << 9)
555#define RCC_AHB2SMENR_GPIOHSMEN (1 << 7)
556#define RCC_AHB2SMENR_GPIOGSMEN (1 << 6)
557#define RCC_AHB2SMENR_GPIOFSMEN (1 << 5)
558#define RCC_AHB2SMENR_GPIOESMEN (1 << 4)
559#define RCC_AHB2SMENR_GPIODSMEN (1 << 3)
560#define RCC_AHB2SMENR_GPIOCSMEN (1 << 2)
561#define RCC_AHB2SMENR_GPIOBSMEN (1 << 1)
562#define RCC_AHB2SMENR_GPIOASMEN (1 << 0)
563
564/* --- RCC_AHB3SMENR - AHB3 periph clock in sleep mode --------------------- */
565
566#define RCC_AHB3SMENR_QSPISMEN (1 << 8)
567#define RCC_AHB3SMENR_FMCSMEN (1 << 0)
568
569/* --- RCC_APB1SMENR1 - APB1 periph clock in sleep mode -------------------- */
570
571#define RCC_APB1SMENR1_LPTIM1SMEN (1 << 31)
572#define RCC_APB1SMENR1_OPAMPSMEN (1 << 30)
573#define RCC_APB1SMENR1_DAC1SMEN (1 << 29)
574#define RCC_APB1SMENR1_PWRSMEN (1 << 28)
575#define RCC_APB1SMENR1_CAN2SMEN (1 << 26)
576#define RCC_APB1SMENR1_CAN1SMEN (1 << 25)
577#define RCC_APB1SMENR1_I2C3SMEN (1 << 23)
578#define RCC_APB1SMENR1_I2C2SMEN (1 << 22)
579#define RCC_APB1SMENR1_I2C1SMEN (1 << 21)
580#define RCC_APB1SMENR1_UART5SMEN (1 << 20)
581#define RCC_APB1SMENR1_UART4SMEN (1 << 19)
582#define RCC_APB1SMENR1_USART3SMEN (1 << 18)
583#define RCC_APB1SMENR1_USART2SMEN (1 << 17)
584#define RCC_APB1SMENR1_SPI3SMEN (1 << 15)
585#define RCC_APB1SMENR1_SPI2SMEN (1 << 14)
586#define RCC_APB1SMENR1_WWDGSMEN (1 << 11)
587#define RCC_APB1SMENR1_LCDSMEN (1 << 9)
588#define RCC_APB1SMENR1_TIM7SMEN (1 << 5)
589#define RCC_APB1SMENR1_TIM6SMEN (1 << 4)
590#define RCC_APB1SMENR1_TIM5SMEN (1 << 3)
591#define RCC_APB1SMENR1_TIM4SMEN (1 << 2)
592#define RCC_APB1SMENR1_TIM3SMEN (1 << 1)
593#define RCC_APB1SMENR1_TIM2SMEN (1 << 0)
594
595/* --- RCC_APB1SMENR2 - APB1 periph clock in sleep mode -------------------- */
596
597#define RCC_APB1SMENR2_LPTIM2SMEN (1 << 5)
598#define RCC_APB1SMENR2_SWPMI1SMEN (1 << 2)
599#define RCC_APB1SMENR2_LPUART1SMEN (1 << 0)
600
601/* --- RCC_APB2SMENR - APB2 periph clock in sleep mode --------------------- */
602
603#define RCC_APB2SMENR_DFSDMSMEN (1 << 24)
604#define RCC_APB2SMENR_SAI2SMEN (1 << 22)
605#define RCC_APB2SMENR_SAI1SMEN (1 << 21)
606#define RCC_APB2SMENR_TIM17SMEN (1 << 18)
607#define RCC_APB2SMENR_TIM16SMEN (1 << 17)
608#define RCC_APB2SMENR_TIM15SMEN (1 << 16)
609#define RCC_APB2SMENR_USART1SMEN (1 << 14)
610#define RCC_APB2SMENR_TIM8SMEN (1 << 13)
611#define RCC_APB2SMENR_SPI1SMEN (1 << 12)
612#define RCC_APB2SMENR_TIM1SMEN (1 << 11)
613#define RCC_APB2SMENR_SDMMC1SMEN (1 << 10)
614#define RCC_APB2SMENR_SYSCFGSMEN (1 << 0)
615
616/* --- RCC_CCIPR - Peripherals independent clock config register ----------- */
617
618#define RCC_CCIPR_DFSDMSEL (1 << 31)
619#define RCC_CCIPR_SWPMI1SEL (1 << 30)
620
621#define RCC_CCIPR_ADCSEL_NONE 0
622#define RCC_CCIPR_ADCSEL_PLLSAI1R 1
623#define RCC_CCIPR_ADCSEL_PLLSAI2R 2
624#define RCC_CCIPR_ADCSEL_SYSCLK 3
625#define RCC_CCIPR_ADCSEL_MASK 0x3
626#define RCC_CCIPR_ADCSEL_SHIFT 28
627
628#define RCC_CCIPR_CLK48SEL_HSI48 0
629#define RCC_CCIPR_CLK48SEL_PLLSAI1Q 1
630#define RCC_CCIPR_CLK48SEL_PLL 2
631#define RCC_CCIPR_CLK48SEL_MSI 3
632#define RCC_CCIPR_CLK48SEL_MASK 0x3
633#define RCC_CCIPR_CLK48SEL_SHIFT 26
634
635#define RCC_CCIPR_SAIxSEL_PLLSAI1P 0
636#define RCC_CCIPR_SAIxSEL_PLLSAI2P 1
637#define RCC_CCIPR_SAIxSEL_PLL 2
638#define RCC_CCIPR_SAIxSEL_EXT 3
639#define RCC_CCIPR_SAIxSEL_MASK 0x3
640#define RCC_CCIPR_SAI2SEL_SHIFT 24
641#define RCC_CCIPR_SAI1SEL_SHIFT 22
642
643#define RCC_CCIPR_LPTIMxSEL_APB 0
644#define RCC_CCIPR_LPTIMxSEL_LSI 1
645#define RCC_CCIPR_LPTIMxSEL_HSI16 2
646#define RCC_CCIPR_LPTIMxSEL_LSE 3
647#define RCC_CCIPR_LPTIMxSEL_MASK 0x3
648#define RCC_CCIPR_LPTIM2SEL_SHIFT 20
649#define RCC_CCIPR_LPTIM1SEL_SHIFT 18
650
651#define RCC_CCIPR_I2CxSEL_APB 0
652#define RCC_CCIPR_I2CxSEL_SYSCLK 1
653#define RCC_CCIPR_I2CxSEL_HSI16 2
654#define RCC_CCIPR_I2CxSEL_MASK 0x3
655#define RCC_CCIPR_I2C4SEL_SHIFT 0
656#define RCC_CCIPR_I2C3SEL_SHIFT 16
657#define RCC_CCIPR_I2C2SEL_SHIFT 14
658#define RCC_CCIPR_I2C1SEL_SHIFT 12
659
660#define RCC_CCIPR_LPUART1SEL_APB 0
661#define RCC_CCIPR_LPUART1SEL_SYS 1
662#define RCC_CCIPR_LPUART1SEL_HSI16 2
663#define RCC_CCIPR_LPUART1SEL_LSE 3
664#define RCC_CCIPR_LPUART1SEL_MASK 0x3
665#define RCC_CCIPR_LPUART1SEL_SHIFT 10
666
667#define RCC_CCIPR_USARTxSEL_APB 0
668#define RCC_CCIPR_USARTxSEL_SYSCLK 1
669#define RCC_CCIPR_USARTxSEL_HSI16 2
670#define RCC_CCIPR_USARTxSEL_LSE 3
671#define RCC_CCIPR_USARTxSEL_MASK 0x3
672#define RCC_CCIPR_UARTxSEL_APB RCC_CCIPR_USARTxSEL_APB
673#define RCC_CCIPR_UARTxSEL_SYSCLK RCC_CCIPR_USARTxSEL_SYSCLK
674#define RCC_CCIPR_UARTxSEL_HSI16 RCC_CCIPR_USARTxSEL_HSI16
675#define RCC_CCIPR_UARTxSEL_LSE RCC_CCIPR_USARTxSEL_LSE
676#define RCC_CCIPR_UARTxSEL_MASK RCC_CCIPR_USARTxSEL_MASK
677#define RCC_CCIPR_UART5SEL_SHIFT 8
678#define RCC_CCIPR_UART4SEL_SHIFT 6
679#define RCC_CCIPR_USART3SEL_SHIFT 4
680#define RCC_CCIPR_USART2SEL_SHIFT 2
681#define RCC_CCIPR_USART1SEL_SHIFT 0
682
683/* --- RCC_BDCR - Backup domain control register --------------------------- */
684
685#define RCC_BDCR_LSCOSEL (1 << 25)
686#define RCC_BDCR_LSCOEN (1 << 24)
687#define RCC_BDCR_BDRST (1 << 16)
688#define RCC_BDCR_RTCEN (1 << 15)
689
690#define RCC_BDCR_RTCSEL_NONE 0
691#define RCC_BDCR_RTCSEL_LSE 1
692#define RCC_BDCR_RTCSEL_LSI 2
693#define RCC_BDCR_RTCSEL_HSEDIV32 3
694#define RCC_BDCR_RTCSEL_SHIFT 8
695#define RCC_BDCR_RTCSEL_MASK 0x3
696
697#define RCC_BDCR_LSESYSDIS (1 << 7)
698#define RCC_BDCR_LSECSSD (1 << 6)
699#define RCC_BDCR_LSECSSON (1 << 5)
700
701#define RCC_BDCR_LSEDRV_LOW 0
702#define RCC_BDCR_LSEDRV_MEDLOW 1
703#define RCC_BDCR_LSEDRV_MEDHIGH 2
704#define RCC_BDCR_LSEDRV_HIGH 3
705#define RCC_BDCR_LSEDRV_SHIFT 3
706#define RCC_BDCR_LSEDRV_MASK 0x3
707
708#define RCC_BDCR_LSEBYP (1 << 2)
709#define RCC_BDCR_LSERDY (1 << 1)
710#define RCC_BDCR_LSEON (1 << 0)
711
712/* --- RCC_CSR - Control/Status register ----------------------------------- */
713
714#define RCC_CSR_LPWRRSTF (1 << 31)
715#define RCC_CSR_WWDGRSTF (1 << 30)
716#define RCC_CSR_IWDGRSTF (1 << 29)
717#define RCC_CSR_SFTRSTF (1 << 28)
718#define RCC_CSR_BORRSTF (1 << 27)
719#define RCC_CSR_PINRSTF (1 << 26)
720#define RCC_CSR_OBLRSTF (1 << 25)
721#define RCC_CSR_FWRSTF (1 << 24)
722#define RCC_CSR_RMVF (1 << 23)
723#define RCC_CSR_RESET_FLAGS (RCC_CSR_LPWRRSTF | RCC_CSR_WWDGRSTF |\
724 RCC_CSR_IWDGRSTF | RCC_CSR_SFTRSTF | RCC_CSR_BORRSTF |\
725 RCC_CSR_PINRSTF | RCC_CSR_OBLRSTF | RCC_CSR_FWRSTF)
726
727/** @defgroup rcc_csr_msirange MSI Range after standby values
728@brief Range of the MSI oscillator after returning from standby
729@ingroup STM32L4xx_rcc_defines
730@sa rcc_cr_msirange
731@{*/
732#define RCC_CSR_MSIRANGE_MASK 0xf
733#define RCC_CSR_MSIRANGE_SHIFT 8
734#define RCC_CSR_MSIRANGE_1MHZ 4
735#define RCC_CSR_MSIRANGE_2MHZ 5
736#define RCC_CSR_MSIRANGE_4MHZ 6
737#define RCC_CSR_MSIRANGE_8MHZ 7
738/**@}*/
739
740#define RCC_CSR_LSIRDY (1 << 1)
741#define RCC_CSR_LSION (1 << 0)
742
744 uint8_t pllm;
745 uint16_t plln;
746 uint8_t pllp;
747 uint8_t pllq;
748 uint8_t pllr;
749 uint8_t pll_source;
750 uint32_t flash_config;
751 uint8_t hpre;
752 uint8_t ppre1;
753 uint8_t ppre2;
758};
759
764
766
767/* --- Variable definitions ------------------------------------------------ */
768
769extern uint32_t rcc_ahb_frequency;
770extern uint32_t rcc_apb1_frequency;
771extern uint32_t rcc_apb2_frequency;
772
773/* --- Function prototypes ------------------------------------------------- */
774
775// Note: RCC_HSI48 not available on all STM32L4 devices
776
780
781
782#define _REG_BIT(base, bit) (((base) << 5) + (bit))
783
785
786 /* AHB1 peripherals */
792
793 /* AHB2 peripherals */
797 RCC_ADC1 = _REG_BIT(RCC_AHB2ENR_OFFSET, 13), /* Compatibility */
807
808 /* AHB3 peripherals */
811
812 /* APB1 peripherals */
837 /* apb1-2 */
841
842 /* APB2 peripherals */
856
857 /* AHB1 peripherals in sleep mode */
864
865 /* AHB2 peripherals in sleep mode */
869 SCC_ADC1 = _REG_BIT(RCC_AHB2SMENR_OFFSET, 13), /* Compatibility */
880
881 /* AHB3 peripherals in sleep mode */
884
885 /* APB1 peripherals in sleep mode */
909 /* apb1-2 */
913
914 /* APB2 peripherals in sleep mode */
927};
928
930 /* AHB1 peripherals */
936
937 /* AHB2 peripherals */
941 RST_ADC1 = _REG_BIT(RCC_AHB2RSTR_OFFSET, 13), /* Compatibility */
951
952 /* AHB3 peripherals */
955
956 /* APB1 peripherals */
981 /* apb1-2 */
985
986 /* APB2 peripherals */
999
1000};
1002
1004
1005void rcc_osc_ready_int_clear(enum rcc_osc osc);
1006void rcc_osc_ready_int_enable(enum rcc_osc osc);
1007void rcc_osc_ready_int_disable(enum rcc_osc osc);
1008int rcc_osc_ready_int_flag(enum rcc_osc osc);
1009void rcc_css_int_clear(void);
1010int rcc_css_int_flag(void);
1011void rcc_wait_for_sysclk_status(enum rcc_osc osc);
1012void rcc_osc_on(enum rcc_osc osc);
1013void rcc_osc_off(enum rcc_osc osc);
1014void rcc_css_enable(void);
1015void rcc_css_disable(void);
1016void rcc_set_sysclk_source(uint32_t clk);
1017void rcc_set_pll_source(uint32_t pllsrc);
1018void rcc_set_ppre2(uint32_t ppre2);
1019void rcc_set_ppre1(uint32_t ppre1);
1020void rcc_set_hpre(uint32_t hpre);
1021void rcc_set_main_pll(uint32_t source, uint32_t pllm, uint32_t plln, uint32_t pllp, uint32_t pllq, uint32_t pllr);
1022uint32_t rcc_system_clock_source(void);
1023void rcc_clock_setup_pll(const struct rcc_clock_scale *clock);
1024void rcc_set_msi_range(uint32_t msi_range);
1025void rcc_set_msi_range_standby(uint32_t msi_range);
1026void rcc_pll_output_enable(uint32_t pllout);
1027void rcc_set_clock48_source(uint32_t clksel);
1028void rcc_enable_rtc_clock(void);
1029void rcc_disable_rtc_clock(void);
1030void rcc_set_rtc_clock_source(enum rcc_osc clk);
1031uint32_t rcc_get_usart_clk_freq(uint32_t usart);
1032uint32_t rcc_get_timer_clk_freq(uint32_t timer);
1033uint32_t rcc_get_i2c_clk_freq(uint32_t i2c);
1034uint32_t rcc_get_spi_clk_freq(uint32_t spi);
1035
1037
1038/**@}*/
1039
1040#endif
#define END_DECLS
Definition: common.h:34
#define BEGIN_DECLS
Definition: common.h:33
pwr_vos_scale
Definition: l4/pwr.h:165
int rcc_osc_ready_int_flag(enum rcc_osc osc)
Definition: rcc.c:150
void rcc_set_msi_range(uint32_t msi_range)
Set the msi run time range.
Definition: rcc.c:448
int rcc_css_int_flag(void)
Definition: rcc.c:184
void rcc_set_clock48_source(uint32_t clksel)
Set clock source for 48MHz clock.
Definition: rcc.c:494
void rcc_osc_ready_int_clear(enum rcc_osc osc)
Definition: rcc.c:69
void rcc_set_main_pll(uint32_t source, uint32_t pllm, uint32_t plln, uint32_t pllp, uint32_t pllq, uint32_t pllr)
Definition: rcc.c:349
void rcc_css_disable(void)
Definition: rcc.c:299
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:629
void rcc_set_sysclk_source(uint32_t clk)
Definition: rcc.c:304
uint32_t rcc_apb2_frequency
Definition: rcc.c:47
void rcc_set_pll_source(uint32_t pllsrc)
Definition: rcc.c:313
uint32_t rcc_get_timer_clk_freq(uint32_t timer)
Get the peripheral clock speed for the Timer at base specified.
Definition: rcc.c:580
uint32_t rcc_system_clock_source(void)
Definition: rcc.c:360
uint32_t rcc_get_usart_clk_freq(uint32_t usart)
Get the peripheral clock speed for the USART at base specified.
Definition: rcc.c:558
void rcc_clock_setup_pll(const struct rcc_clock_scale *clock)
Setup clocks to run from PLL.
Definition: rcc.c:374
rcc_periph_rst
Definition: l4/rcc.h:929
rcc_periph_clken
Definition: l4/rcc.h:784
void rcc_osc_ready_int_enable(enum rcc_osc osc)
Definition: rcc.c:96
void rcc_set_rtc_clock_source(enum rcc_osc clk)
Set the source for the RTC clock.
Definition: rcc.c:516
rcc_osc
Definition: l4/rcc.h:777
void rcc_pll_output_enable(uint32_t pllout)
Enable PLL Output.
Definition: rcc.c:479
void rcc_disable_rtc_clock(void)
Disable the RTC clock.
Definition: rcc.c:508
void rcc_osc_ready_int_disable(enum rcc_osc osc)
Definition: rcc.c:123
void rcc_osc_on(enum rcc_osc osc)
Definition: rcc.c:240
#define _REG_BIT(base, bit)
Definition: l4/rcc.h:782
uint32_t rcc_ahb_frequency
Definition: rcc.c:45
void rcc_osc_off(enum rcc_osc osc)
Definition: rcc.c:267
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:612
void rcc_set_msi_range_standby(uint32_t msi_range)
Set the msi range after reset/standby.
Definition: rcc.c:463
const struct rcc_clock_scale rcc_hsi16_configs[RCC_CLOCK_CONFIG_END]
Definition: rcc.c:49
uint32_t rcc_apb1_frequency
Definition: rcc.c:46
void rcc_wait_for_sysclk_status(enum rcc_osc osc)
Definition: rcc.c:215
void rcc_set_ppre1(uint32_t ppre1)
Definition: rcc.c:331
void rcc_css_int_clear(void)
Definition: rcc.c:179
void rcc_enable_rtc_clock(void)
Enable the RTC clock.
Definition: rcc.c:502
void rcc_set_ppre2(uint32_t ppre2)
Definition: rcc.c:322
void rcc_css_enable(void)
Definition: rcc.c:294
void rcc_set_hpre(uint32_t hpre)
Definition: rcc.c:340
rcc_clock_config_entry
Definition: l4/rcc.h:760
@ RST_CRS
Definition: l4/rcc.h:964
@ RST_DMA2
Definition: l4/rcc.h:934
@ RST_QSPI
Definition: l4/rcc.h:953
@ RST_DMA1
Definition: l4/rcc.h:935
@ RST_LPTIM2
Definition: l4/rcc.h:982
@ RST_SPI1
Definition: l4/rcc.h:995
@ RST_I2C3
Definition: l4/rcc.h:965
@ RST_GPIOG
Definition: l4/rcc.h:944
@ RST_SWPMI1
Definition: l4/rcc.h:983
@ RST_ADC1
Definition: l4/rcc.h:941
@ RST_TIM16
Definition: l4/rcc.h:991
@ RST_TSC
Definition: l4/rcc.h:931
@ RST_SAI1
Definition: l4/rcc.h:989
@ RST_RNG
Definition: l4/rcc.h:938
@ RST_GPIOF
Definition: l4/rcc.h:945
@ RST_AES
Definition: l4/rcc.h:939
@ RST_OPAMP
Definition: l4/rcc.h:958
@ RST_SPI2
Definition: l4/rcc.h:973
@ RST_GPIOH
Definition: l4/rcc.h:943
@ RST_UART4
Definition: l4/rcc.h:969
@ RST_TIM8
Definition: l4/rcc.h:994
@ RST_TIM15
Definition: l4/rcc.h:992
@ RST_FLASH
Definition: l4/rcc.h:933
@ RST_TIM3
Definition: l4/rcc.h:979
@ RST_TIM17
Definition: l4/rcc.h:990
@ RST_LPTIM1
Definition: l4/rcc.h:957
@ RST_GPIOA
Definition: l4/rcc.h:950
@ RST_GPIOC
Definition: l4/rcc.h:948
@ RST_TIM6
Definition: l4/rcc.h:976
@ RST_GPIOB
Definition: l4/rcc.h:949
@ RST_TIM1
Definition: l4/rcc.h:996
@ RST_SPI3
Definition: l4/rcc.h:972
@ RST_USART3
Definition: l4/rcc.h:970
@ RST_ADC
Definition: l4/rcc.h:940
@ RST_TIM7
Definition: l4/rcc.h:975
@ RST_TIM2
Definition: l4/rcc.h:980
@ RST_CAN2
Definition: l4/rcc.h:962
@ RST_CRC
Definition: l4/rcc.h:932
@ RST_GPIOD
Definition: l4/rcc.h:947
@ RST_USB
Definition: l4/rcc.h:961
@ RST_DFSDM
Definition: l4/rcc.h:987
@ RST_SDMMC1
Definition: l4/rcc.h:997
@ RST_TIM4
Definition: l4/rcc.h:978
@ RST_TIM5
Definition: l4/rcc.h:977
@ RST_SYSCFG
Definition: l4/rcc.h:998
@ RST_UART5
Definition: l4/rcc.h:968
@ RST_GPIOE
Definition: l4/rcc.h:946
@ RST_I2C2
Definition: l4/rcc.h:966
@ RST_CAN1
Definition: l4/rcc.h:963
@ RST_PWR
Definition: l4/rcc.h:960
@ RST_USART1
Definition: l4/rcc.h:993
@ RST_SAI2
Definition: l4/rcc.h:988
@ RST_I2C1
Definition: l4/rcc.h:967
@ RST_LPUART1
Definition: l4/rcc.h:984
@ RST_DAC1
Definition: l4/rcc.h:959
@ RST_LCD
Definition: l4/rcc.h:974
@ RST_FMC
Definition: l4/rcc.h:954
@ RST_USART2
Definition: l4/rcc.h:971
@ RST_OTGFS
Definition: l4/rcc.h:942
@ SCC_CRC
Definition: l4/rcc.h:859
@ RCC_TIM8
Definition: l4/rcc.h:850
@ RCC_CRS
Definition: l4/rcc.h:820
@ SCC_TIM8
Definition: l4/rcc.h:922
@ SCC_SPI3
Definition: l4/rcc.h:899
@ RCC_SAI1
Definition: l4/rcc.h:845
@ RCC_UART5
Definition: l4/rcc.h:824
@ RCC_RNG
Definition: l4/rcc.h:794
@ RCC_FLASH
Definition: l4/rcc.h:789
@ RCC_FMC
Definition: l4/rcc.h:810
@ SCC_CAN2
Definition: l4/rcc.h:890
@ SCC_GPIOD
Definition: l4/rcc.h:876
@ RCC_SPI2
Definition: l4/rcc.h:829
@ SCC_TIM1
Definition: l4/rcc.h:924
@ RCC_TIM3
Definition: l4/rcc.h:835
@ SCC_SPI2
Definition: l4/rcc.h:900
@ SCC_QSPI
Definition: l4/rcc.h:882
@ RCC_LCD
Definition: l4/rcc.h:830
@ SCC_TIM16
Definition: l4/rcc.h:919
@ RCC_TIM1
Definition: l4/rcc.h:852
@ SCC_OPAMP
Definition: l4/rcc.h:887
@ SCC_UART4
Definition: l4/rcc.h:896
@ SCC_ADC
Definition: l4/rcc.h:868
@ SCC_SDMMC1
Definition: l4/rcc.h:925
@ RCC_CAN2
Definition: l4/rcc.h:818
@ SCC_LPTIM2
Definition: l4/rcc.h:910
@ SCC_SRAM1
Definition: l4/rcc.h:860
@ RCC_OPAMP
Definition: l4/rcc.h:814
@ RCC_GPIOA
Definition: l4/rcc.h:806
@ SCC_GPIOH
Definition: l4/rcc.h:872
@ SCC_RNG
Definition: l4/rcc.h:866
@ RCC_TIM17
Definition: l4/rcc.h:846
@ SCC_GPIOA
Definition: l4/rcc.h:879
@ RCC_SDMMC1
Definition: l4/rcc.h:853
@ SCC_DMA2
Definition: l4/rcc.h:862
@ RCC_SAI2
Definition: l4/rcc.h:844
@ RCC_TIM2
Definition: l4/rcc.h:836
@ SCC_TIM6
Definition: l4/rcc.h:904
@ SCC_ADC1
Definition: l4/rcc.h:869
@ RCC_QSPI
Definition: l4/rcc.h:809
@ SCC_TIM2
Definition: l4/rcc.h:908
@ SCC_SWPMI1
Definition: l4/rcc.h:911
@ SCC_LPUART1
Definition: l4/rcc.h:912
@ SCC_TIM3
Definition: l4/rcc.h:907
@ RCC_GPIOG
Definition: l4/rcc.h:800
@ RCC_GPIOH
Definition: l4/rcc.h:799
@ RCC_CAN1
Definition: l4/rcc.h:819
@ RCC_PWR
Definition: l4/rcc.h:816
@ RCC_SWPMI1
Definition: l4/rcc.h:839
@ RCC_CRC
Definition: l4/rcc.h:788
@ SCC_USART2
Definition: l4/rcc.h:898
@ SCC_USART3
Definition: l4/rcc.h:897
@ SCC_I2C2
Definition: l4/rcc.h:893
@ RCC_USART1
Definition: l4/rcc.h:849
@ SCC_WWDG
Definition: l4/rcc.h:901
@ SCC_PWR
Definition: l4/rcc.h:889
@ RCC_DAC1
Definition: l4/rcc.h:815
@ SCC_SYSCFG
Definition: l4/rcc.h:926
@ SCC_TIM15
Definition: l4/rcc.h:920
@ RCC_TIM4
Definition: l4/rcc.h:834
@ RCC_I2C1
Definition: l4/rcc.h:823
@ SCC_LCD
Definition: l4/rcc.h:902
@ RCC_ADC1
Definition: l4/rcc.h:797
@ SCC_SRAM2
Definition: l4/rcc.h:871
@ SCC_SPI1
Definition: l4/rcc.h:923
@ RCC_TSC
Definition: l4/rcc.h:787
@ SCC_DMA1
Definition: l4/rcc.h:863
@ RCC_USB
Definition: l4/rcc.h:817
@ RCC_FW
Definition: l4/rcc.h:854
@ RCC_USART2
Definition: l4/rcc.h:827
@ SCC_GPIOE
Definition: l4/rcc.h:875
@ RCC_TIM16
Definition: l4/rcc.h:847
@ SCC_USART1
Definition: l4/rcc.h:921
@ RCC_USART3
Definition: l4/rcc.h:826
@ SCC_TIM17
Definition: l4/rcc.h:918
@ SCC_I2C1
Definition: l4/rcc.h:894
@ RCC_TIM5
Definition: l4/rcc.h:833
@ SCC_DFSDM
Definition: l4/rcc.h:915
@ SCC_SAI2
Definition: l4/rcc.h:916
@ RCC_SPI1
Definition: l4/rcc.h:851
@ RCC_SYSCFG
Definition: l4/rcc.h:855
@ SCC_GPIOC
Definition: l4/rcc.h:877
@ RCC_LPTIM2
Definition: l4/rcc.h:838
@ SCC_TSC
Definition: l4/rcc.h:858
@ RCC_I2C2
Definition: l4/rcc.h:822
@ SCC_FLASH
Definition: l4/rcc.h:861
@ RCC_AES
Definition: l4/rcc.h:795
@ RCC_GPIOB
Definition: l4/rcc.h:805
@ RCC_TIM7
Definition: l4/rcc.h:831
@ RCC_LPTIM1
Definition: l4/rcc.h:813
@ RCC_GPIOF
Definition: l4/rcc.h:801
@ SCC_GPIOF
Definition: l4/rcc.h:874
@ SCC_OTGFS
Definition: l4/rcc.h:870
@ RCC_GPIOC
Definition: l4/rcc.h:804
@ RCC_TIM6
Definition: l4/rcc.h:832
@ RCC_UART4
Definition: l4/rcc.h:825
@ SCC_CAN1
Definition: l4/rcc.h:891
@ SCC_TIM5
Definition: l4/rcc.h:905
@ SCC_I2C3
Definition: l4/rcc.h:892
@ SCC_GPIOB
Definition: l4/rcc.h:878
@ RCC_DMA1
Definition: l4/rcc.h:791
@ RCC_SPI3
Definition: l4/rcc.h:828
@ SCC_DAC1
Definition: l4/rcc.h:888
@ SCC_GPIOG
Definition: l4/rcc.h:873
@ RCC_GPIOD
Definition: l4/rcc.h:803
@ RCC_TIM15
Definition: l4/rcc.h:848
@ SCC_FMC
Definition: l4/rcc.h:883
@ RCC_I2C3
Definition: l4/rcc.h:821
@ RCC_GPIOE
Definition: l4/rcc.h:802
@ RCC_ADC
Definition: l4/rcc.h:796
@ SCC_SAI1
Definition: l4/rcc.h:917
@ RCC_OTGFS
Definition: l4/rcc.h:798
@ SCC_UART5
Definition: l4/rcc.h:895
@ SCC_TIM7
Definition: l4/rcc.h:903
@ RCC_DMA2
Definition: l4/rcc.h:790
@ SCC_LPTIM1
Definition: l4/rcc.h:886
@ SCC_AES
Definition: l4/rcc.h:867
@ SCC_TIM4
Definition: l4/rcc.h:906
@ RCC_DFSDM
Definition: l4/rcc.h:843
@ RCC_LPUART1
Definition: l4/rcc.h:840
@ RCC_HSI48
Definition: l4/rcc.h:778
@ RCC_LSI
Definition: l4/rcc.h:778
@ RCC_PLL
Definition: l4/rcc.h:778
@ RCC_MSI
Definition: l4/rcc.h:778
@ RCC_LSE
Definition: l4/rcc.h:778
@ RCC_HSE
Definition: l4/rcc.h:778
@ RCC_HSI16
Definition: l4/rcc.h:778
@ RCC_CLOCK_VRANGE1_80MHZ
Definition: l4/rcc.h:761
@ RCC_CLOCK_CONFIG_END
Definition: l4/rcc.h:762
#define RCC_APB2RSTR_OFFSET
Definition: l4/rcc.h:72
#define RCC_AHB1SMENR_OFFSET
Definition: l4/rcc.h:86
#define RCC_APB1ENR2_OFFSET
Definition: l4/rcc.h:82
#define RCC_AHB3RSTR_OFFSET
Definition: l4/rcc.h:66
#define RCC_AHB1RSTR_OFFSET
Definition: l4/rcc.h:62
#define RCC_APB1ENR1_OFFSET
Definition: l4/rcc.h:80
#define RCC_AHB3ENR_OFFSET
Definition: l4/rcc.h:78
#define RCC_AHB3SMENR_OFFSET
Definition: l4/rcc.h:90
#define RCC_APB1RSTR1_OFFSET
Definition: l4/rcc.h:68
#define RCC_AHB2RSTR_OFFSET
Definition: l4/rcc.h:64
#define RCC_APB2ENR_OFFSET
Definition: l4/rcc.h:84
#define RCC_AHB2ENR_OFFSET
Definition: l4/rcc.h:76
#define RCC_AHB2SMENR_OFFSET
Definition: l4/rcc.h:88
#define RCC_APB1RSTR2_OFFSET
Definition: l4/rcc.h:70
#define RCC_AHB1ENR_OFFSET
Definition: l4/rcc.h:74
uint8_t ppre1
Definition: l4/rcc.h:752
uint8_t pllq
Definition: l4/rcc.h:747
uint8_t ppre2
Definition: l4/rcc.h:753
uint8_t pllp
Definition: l4/rcc.h:746
uint32_t apb1_frequency
Definition: l4/rcc.h:756
uint8_t pllm
Definition: l4/rcc.h:744
uint32_t ahb_frequency
Definition: l4/rcc.h:755
uint16_t plln
Definition: l4/rcc.h:745
enum pwr_vos_scale voltage_scale
Definition: l4/rcc.h:754
uint8_t pllr
Definition: l4/rcc.h:748
uint32_t flash_config
Definition: l4/rcc.h:750
uint8_t hpre
Definition: l4/rcc.h:751
uint32_t apb2_frequency
Definition: l4/rcc.h:757
uint8_t pll_source
Definition: l4/rcc.h:749