libopencm3
A free/libre/open-source firmware library for various ARM Cortex-M3 microcontrollers.
rcc.c
Go to the documentation of this file.
1/** @defgroup rcc_file RCC peripheral API
2
3@ingroup peripheral_apis
4
5@brief <b>libopencm3 GD32F1x0 Reset and Clock Control</b>
6
7@version 1.0.0
8
9@author @htmlonly &copy; @endhtmlonly 2009
10Federico Ruiz-Ugalde <memeruiz at gmail dot com>
11@author @htmlonly &copy; @endhtmlonly 2009 Uwe Hermann <uwe@hermann-uwe.de>
12@author @htmlonly &copy; @endhtmlonly 2010 Thomas Otto <tommi@viadmin.org>
13
14@date 18 August 2012
15
16This library supports the Reset and Clock Control System in the GD32F1x0
17series of ARM Cortex Microcontrollers by GigaDevice.
18
19@note Full support for F170 and F190 devices is not yet provided.
20
21Clock settings and resets for many peripherals are given here rather than in
22the corresponding peripheral library.
23
24The library also provides a number of common configurations for the processor
25system clock. Not all possible configurations are included.
26
27LGPL License Terms @ref lgpl_license
28 */
29/*
30 * This file is part of the libopencm3 project.
31 *
32 * Copyright (C) 2019 Icenowy Zheng <icenowy@aosc.io>
33 * Copyright (C) 2009 Federico Ruiz-Ugalde <memeruiz at gmail dot com>
34 * Copyright (C) 2009 Uwe Hermann <uwe@hermann-uwe.de>
35 * Copyright (C) 2010 Thomas Otto <tommi@viadmin.org>
36 *
37 * This library is free software: you can redistribute it and/or modify
38 * it under the terms of the GNU Lesser General Public License as published by
39 * the Free Software Foundation, either version 3 of the License, or
40 * (at your option) any later version.
41 *
42 * This library is distributed in the hope that it will be useful,
43 * but WITHOUT ANY WARRANTY; without even the implied warranty of
44 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
45 * GNU Lesser General Public License for more details.
46 *
47 * You should have received a copy of the GNU Lesser General Public License
48 * along with this library. If not, see <http://www.gnu.org/licenses/>.
49 */
50
51/**@{*/
52
54#include <libopencm3/gd32/rcc.h>
56
57/** Set the default clock frequencies */
58uint32_t rcc_apb1_frequency = 8000000;
59uint32_t rcc_apb2_frequency = 8000000;
60uint32_t rcc_ahb_frequency = 8000000;
61
63 { /* 48MHz */
65 .hpre = RCC_CFGR_HPRE_NODIV,
66 .ppre1 = RCC_CFGR_PPRE_DIV2,
67 .ppre2 = RCC_CFGR_PPRE_NODIV,
68 .adcpre = RCC_CFGR_ADCPRE_DIV8,
69 .use_hse = false,
70 .ahb_frequency = 48000000,
71 .apb1_frequency = 24000000,
72 .apb2_frequency = 48000000,
73 },
74 { /* 64MHz */
76 .hpre = RCC_CFGR_HPRE_NODIV,
77 .ppre1 = RCC_CFGR_PPRE_DIV2,
78 .ppre2 = RCC_CFGR_PPRE_NODIV,
79 .adcpre = RCC_CFGR_ADCPRE_DIV8,
80 .use_hse = false,
81 .ahb_frequency = 64000000,
82 .apb1_frequency = 32000000,
83 .apb2_frequency = 64000000,
84 }
85};
86
88 { /* 72MHz */
90 .hpre = RCC_CFGR_HPRE_NODIV,
91 .ppre1 = RCC_CFGR_PPRE_DIV2,
92 .ppre2 = RCC_CFGR_PPRE_NODIV,
93 .adcpre = RCC_CFGR_ADCPRE_DIV8,
95 .use_hse = true,
96 .pll_hse_prediv = RCC_CFGR2_PREDIV_NODIV,
97 .ahb_frequency = 72000000,
98 .apb1_frequency = 36000000,
99 .apb2_frequency = 72000000,
100 },
101};
102
103/*---------------------------------------------------------------------------*/
104/** @brief RCC Clear the Oscillator Ready Interrupt Flag
105
106Clear the interrupt flag that was set when a clock oscillator became ready to
107use.
108
109@param[in] osc Oscillator ID
110*/
111
113{
114 switch (osc) {
115 case RCC_PLL:
117 break;
118 case RCC_HSE:
120 break;
121 case RCC_HSI:
123 break;
124 case RCC_LSE:
126 break;
127 case RCC_LSI:
129 break;
130 }
131}
132
133/*---------------------------------------------------------------------------*/
134/** @brief RCC Enable the Oscillator Ready Interrupt
135
136@param[in] osc Oscillator ID
137*/
138
140{
141 switch (osc) {
142 case RCC_PLL:
144 break;
145 case RCC_HSE:
147 break;
148 case RCC_HSI:
150 break;
151 case RCC_LSE:
153 break;
154 case RCC_LSI:
156 break;
157 }
158}
159
160/*---------------------------------------------------------------------------*/
161/** @brief RCC Disable the Oscillator Ready Interrupt
162
163@param[in] osc Oscillator ID
164*/
165
167{
168 switch (osc) {
169 case RCC_PLL:
170 RCC_CIR &= ~RCC_CIR_PLLRDYIE;
171 break;
172 case RCC_HSE:
173 RCC_CIR &= ~RCC_CIR_HSERDYIE;
174 break;
175 case RCC_HSI:
176 RCC_CIR &= ~RCC_CIR_HSIRDYIE;
177 break;
178 case RCC_LSE:
179 RCC_CIR &= ~RCC_CIR_LSERDYIE;
180 break;
181 case RCC_LSI:
182 RCC_CIR &= ~RCC_CIR_LSIRDYIE;
183 break;
184 }
185}
186
187/*---------------------------------------------------------------------------*/
188/** @brief RCC Read the Oscillator Ready Interrupt Flag
189
190@param[in] osc Oscillator ID
191@returns int. Boolean value for flag set.
192*/
193
195{
196 switch (osc) {
197 case RCC_PLL:
198 return ((RCC_CIR & RCC_CIR_PLLRDYF) != 0);
199 break;
200 case RCC_HSE:
201 return ((RCC_CIR & RCC_CIR_HSERDYF) != 0);
202 break;
203 case RCC_HSI:
204 return ((RCC_CIR & RCC_CIR_HSIRDYF) != 0);
205 break;
206 case RCC_LSE:
207 return ((RCC_CIR & RCC_CIR_LSERDYF) != 0);
208 break;
209 case RCC_LSI:
210 return ((RCC_CIR & RCC_CIR_LSIRDYF) != 0);
211 break;
212 }
213
215}
216
217/*---------------------------------------------------------------------------*/
218/** @brief RCC Clear the Clock Security System Interrupt Flag
219
220*/
221
223{
225}
226
227/*---------------------------------------------------------------------------*/
228/** @brief RCC Read the Clock Security System Interrupt Flag
229
230@returns int. Boolean value for flag set.
231*/
232
234{
235 return ((RCC_CIR & RCC_CIR_CSSF) != 0);
236}
237
238/*---------------------------------------------------------------------------*/
239/** @brief RCC Wait for Oscillator Ready.
240
241@param[in] osc Oscillator ID
242*/
243
245{
246 switch (osc) {
247 case RCC_PLL:
248 while ((RCC_CR & RCC_CR_PLLRDY) == 0);
249 break;
250 case RCC_HSE:
251 while ((RCC_CR & RCC_CR_HSERDY) == 0);
252 break;
253 case RCC_HSI:
254 while ((RCC_CR & RCC_CR_HSIRDY) == 0);
255 break;
256 case RCC_LSE:
257 while ((RCC_BDCR & RCC_BDCR_LSERDY) == 0);
258 break;
259 case RCC_LSI:
260 while ((RCC_CSR & RCC_CSR_LSIRDY) == 0);
261 break;
262 }
263}
264
265/*---------------------------------------------------------------------------*/
266/** @brief RCC Turn on an Oscillator.
267
268Enable an oscillator and power on. Each oscillator requires an amount of time
269to settle to a usable state. Refer to datasheets for time delay information. A
270status flag is available to indicate when the oscillator becomes ready (see
271@ref rcc_osc_ready_int_flag and @ref rcc_wait_for_osc_ready).
272
273@note The LSE clock is in the backup domain and cannot be enabled until the
274backup domain write protection has been removed (see @ref
275pwr_disable_backup_domain_write_protect).
276
277@param[in] osc Oscillator ID
278*/
279
280void rcc_osc_on(enum rcc_osc osc)
281{
282 switch (osc) {
283 case RCC_PLL:
285 break;
286 case RCC_HSE:
288 break;
289 case RCC_HSI:
291 break;
292 case RCC_LSE:
294 break;
295 case RCC_LSI:
297 break;
298 }
299}
300
301/*---------------------------------------------------------------------------*/
302/** @brief RCC Turn off an Oscillator.
303
304Disable an oscillator and power off.
305
306@note An oscillator cannot be turned off if it is selected as the system clock.
307@note The LSE clock is in the backup domain and cannot be disabled until the
308backup domain write protection has been removed (see
309@ref pwr_disable_backup_domain_write_protect) or the backup domain has been
310(see reset @ref rcc_backupdomain_reset).
311
312@param[in] osc Oscillator ID
313*/
314
315void rcc_osc_off(enum rcc_osc osc)
316{
317 switch (osc) {
318 case RCC_PLL:
319 RCC_CR &= ~RCC_CR_PLLON;
320 break;
321 case RCC_HSE:
322 RCC_CR &= ~RCC_CR_HSEON;
323 break;
324 case RCC_HSI:
325 RCC_CR &= ~RCC_CR_HSION;
326 break;
327 case RCC_LSE:
328 RCC_BDCR &= ~RCC_BDCR_LSEON;
329 break;
330 case RCC_LSI:
331 RCC_CSR &= ~RCC_CSR_LSION;
332 break;
333 }
334}
335
336/*---------------------------------------------------------------------------*/
337/** @brief RCC Enable the Clock Security System.
338
339*/
340
342{
344}
345
346/*---------------------------------------------------------------------------*/
347/** @brief RCC Disable the Clock Security System.
348
349*/
350
352{
353 RCC_CR &= ~RCC_CR_CSSON;
354}
355
356/*---------------------------------------------------------------------------*/
357/** @brief RCC Set the Source for the System Clock.
358
359@param[in] clk System Clock Selection @ref rcc_cfgr_scs
360*/
361
362void rcc_set_sysclk_source(uint32_t clk)
363{
364 RCC_CFGR = (RCC_CFGR & ~RCC_CFGR_SW) |
365 (clk << RCC_CFGR_SW_SHIFT);
366}
367
368/*---------------------------------------------------------------------------*/
369/** @brief RCC Set the PLL Multiplication Factor.
370
371@note This only has effect when the PLL is disabled.
372
373@param[in] mul PLL multiplication factor @ref rcc_cfgr_pmf
374*/
375
377{
378 RCC_CFGR = (RCC_CFGR & ~RCC_CFGR_PLLMUL_0_3 & ~RCC_CFGR_PLLMUL_4) |
379 ((mul & 0xf) << RCC_CFGR_PLLMUL_0_3_SHIFT) |
380 ((!!(mul & 0x10)) << RCC_CFGR_PLLMUL_4_SHIFT);
381}
382
383/*---------------------------------------------------------------------------*/
384/** @brief RCC Set the PLL Clock Source.
385
386@note This only has effect when the PLL is disabled.
387
388@param[in] pllsrc PLL clock source @ref rcc_cfgr_pcs
389*/
390
391void rcc_set_pll_source(uint32_t pllsrc)
392{
393 RCC_CFGR = (RCC_CFGR & ~RCC_CFGR_PLLSRC) |
394 (pllsrc << 16);
395}
396
397/*---------------------------------------------------------------------------*/
398/** @brief RCC Set the HSE Frequency Divider used as PLL Clock Source.
399
400@note This only has effect when the PLL is disabled.
401
402@param[in] pllxtpre HSE division factor @ref rcc_cfgr_hsepre
403*/
404
405void rcc_set_pllxtpre(uint32_t pllxtpre)
406{
407 RCC_CFGR = (RCC_CFGR & ~RCC_CFGR_PLLXTPRE) |
408 (pllxtpre << 17);
409}
410
411/*---------------------------------------------------------------------------*/
412/** @brief RCC RTC Clock Enabled Flag
413
414@returns uint32_t. Nonzero if the RTC Clock is enabled.
415*/
416
418{
419 return RCC_BDCR & RCC_BDCR_RTCEN;
420}
421
422/*---------------------------------------------------------------------------*/
423/** @brief RCC Enable the RTC clock
424
425*/
426
428{
430}
431
432/*---------------------------------------------------------------------------*/
433/** @brief RCC Set the Source for the RTC clock
434
435@param[in] clock_source RTC clock source. Only HSE/128, LSE and LSI.
436*/
437
438void rcc_set_rtc_clock_source(enum rcc_osc clock_source)
439{
440 uint32_t reg32;
441
442 switch (clock_source) {
443 case RCC_LSE:
444 /* Turn the LSE on and wait while it stabilises. */
446 while ((reg32 = (RCC_BDCR & RCC_BDCR_LSERDY)) == 0);
447
448 /* Choose LSE as the RTC clock source. */
449 RCC_BDCR &= ~((1 << 8) | (1 << 9));
450 RCC_BDCR |= (1 << 8);
451 break;
452 case RCC_LSI:
453 /* Turn the LSI on and wait while it stabilises. */
455 while ((reg32 = (RCC_CSR & RCC_CSR_LSIRDY)) == 0);
456
457 /* Choose LSI as the RTC clock source. */
458 RCC_BDCR &= ~((1 << 8) | (1 << 9));
459 RCC_BDCR |= (1 << 9);
460 break;
461 case RCC_HSE:
462 /* Turn the HSE on and wait while it stabilises. */
464 while ((reg32 = (RCC_CR & RCC_CR_HSERDY)) == 0);
465
466 /* Choose HSE as the RTC clock source. */
467 RCC_BDCR &= ~((1 << 8) | (1 << 9));
468 RCC_BDCR |= (1 << 9) | (1 << 8);
469 break;
470 case RCC_PLL:
471 case RCC_HSI:
472 /* Unusable clock source, here to prevent warnings. */
473 /* Turn off clock sources to RTC. */
474 RCC_BDCR &= ~((1 << 8) | (1 << 9));
475 break;
476 }
477}
478
479/*---------------------------------------------------------------------------*/
480/** @brief ADC Setup the A/D Clock
481
482The ADC's have a common clock prescale setting.
483
484@param[in] adcpre Prescale divider taken from @ref rcc_cfgr_adcpre
485*/
486
487void rcc_set_adcpre(uint32_t adcpre)
488{
489 RCC_CFGR = (RCC_CFGR & ~RCC_CFGR_ADCPRE) |
491}
492
493/*---------------------------------------------------------------------------*/
494/** @brief RCC Set the APB2 Prescale Factor.
495
496@param[in] ppre2 APB2 prescale factor @ref rcc_cfgr_apb2pre
497*/
498
499void rcc_set_ppre2(uint32_t ppre2)
500{
501 RCC_CFGR = (RCC_CFGR & ~RCC_CFGR_PPRE2) |
503}
504
505/*---------------------------------------------------------------------------*/
506/** @brief RCC Set the APB1 Prescale Factor.
507
508@note The APB1 clock frequency must not exceed 36MHz.
509
510@param[in] ppre1 APB1 prescale factor @ref rcc_cfgr_apb1pre
511*/
512
513void rcc_set_ppre1(uint32_t ppre1)
514{
515 RCC_CFGR = (RCC_CFGR & ~RCC_CFGR_PPRE1) |
517
518}
519
520/*---------------------------------------------------------------------------*/
521/** @brief RCC Set the AHB Prescale Factor.
522
523@param[in] hpre AHB prescale factor @ref rcc_cfgr_ahbpre
524*/
525
526void rcc_set_hpre(uint32_t hpre)
527{
528 RCC_CFGR = (RCC_CFGR & ~RCC_CFGR_HPRE) |
530
531}
532
533/*---------------------------------------------------------------------------*/
534/** @brief RCC Set the USB Prescale Factor.
535
536The prescale factor can be set to 1 (no prescale) for use when the PLL clock is
53748MHz, or 1.5 to generate the 48MHz USB clock from a 64MHz PLL clock.
538
539@note This bit cannot be reset while the USB clock is enabled.
540
541@param[in] usbpre USB prescale factor @ref rcc_cfgr_usbpre
542*/
543
544void rcc_set_usbpre(uint32_t usbpre)
545{
546 RCC_CFGR = (RCC_CFGR & ~RCC_CFGR_USBPRE) | usbpre;
547}
548
549void rcc_set_prediv(uint32_t prediv)
550{
551 RCC_CFGR2 = (RCC_CFGR2 & ~RCC_CFGR2_PREDIV) | prediv;
552}
553
554/*---------------------------------------------------------------------------*/
555/** @brief RCC Get the System Clock Source.
556
557@returns Unsigned int32. System clock source:
558@li 00 indicates HSE
559@li 01 indicates LSE
560@li 02 indicates PLL
561*/
562
564{
565 /* Return the clock source which is used as system clock. */
567}
568
569/*---------------------------------------------------------------------------*/
570/*
571 * These functions are setting up the whole clock system for the most common
572 * input clock and output clock configurations.
573 */
574/*---------------------------------------------------------------------------*/
575/**
576 * Setup clocks to run from PLL.
577 * The arguments provide the pll source, multipliers, dividers, all that's
578 * needed to establish a system clock.
579 * @param clock clock information structure
580 */
581void rcc_clock_setup_pll(const struct rcc_clock_scale *clock)
582{
583 if (clock->use_hse) {
584 /* Enable external high-speed oscillator. */
588 } else {
589 /* Enable internal high-speed oscillator. */
593 }
594
595 /*
596 * Set prescalers for AHB, ADC, APB1, APB2 and USB.
597 * Do this before touching the PLL (TODO: why?).
598 */
599 rcc_set_hpre(clock->hpre);
600 rcc_set_ppre1(clock->ppre1);
601 rcc_set_ppre2(clock->ppre2);
602
603 rcc_set_adcpre(clock->adcpre);
604 if (clock->use_hse)
605 rcc_set_usbpre(clock->usbpre);
606
607 /* Set the PLL multiplication factor. */
609
610 if (clock->use_hse) {
611 /* Select HSE as PLL source. */
613
614 /*
615 * External frequency undivided before entering PLL
616 * (only valid/needed for HSE).
617 */
619 } else {
620 /* Select HSI/2 as PLL source. */
622 }
623
624 /* Enable PLL oscillator and wait for it to stabilize. */
627
628 /* Select PLL as SYSCLK source. */
630
631 /* Set the peripheral clock frequencies used */
635}
636
637/*---------------------------------------------------------------------------*/
638/** @brief RCC Reset the Backup Domain
639
640The backup domain registers are reset to disable RTC controls and clear user
641data.
642*/
643
645{
646 /* Set the backup domain software reset. */
648
649 /* Clear the backup domain software reset. */
650 RCC_BDCR &= ~RCC_BDCR_BDRST;
651}
652
653/**@}*/
654
#define cm3_assert_not_reached()
Check if unreachable code is reached.
Definition: assert.h:102
#define RCC_CFGR_ADCPRE_DIV8
#define RCC_CFGR_HPRE_NODIV
#define RCC_CFGR_PPRE_DIV2
#define RCC_CFGR_PPRE_NODIV
#define RCC_CFGR_PLLSRC_HSE_CLK
#define RCC_CFGR_PLLSRC_HSI_CLK_DIV2
#define RCC_CFGR_PLLMUL_PLL_CLK_MUL16
#define RCC_CFGR_PLLMUL_PLL_CLK_MUL9
#define RCC_CFGR_PLLMUL_PLL_CLK_MUL12
#define RCC_CFGR_SW_SYSCLKSEL_HSICLK
#define RCC_CFGR_SW_SYSCLKSEL_PLLCLK
#define RCC_CFGR_SW_SYSCLKSEL_HSECLK
#define RCC_CFGR_USBPRE_PLL_CLK_DIV1_5
#define RCC_BDCR_LSEON
#define RCC_CIR_PLLRDYF
#define RCC_CIR
Definition: gd32/f1x0/rcc.h:48
#define RCC_CIR_HSERDYF
#define RCC_CIR_LSERDYC
#define RCC_CFGR_PPRE2_SHIFT
#define RCC_CFGR_SWS
#define RCC_CIR_PLLRDYIE
#define RCC_CIR_PLLRDYC
#define RCC_BDCR_BDRST
#define RCC_CR
Definition: gd32/f1x0/rcc.h:46
#define RCC_CFGR_PLLMUL_4_SHIFT
Definition: gd32/f1x0/rcc.h:90
#define RCC_CIR_CSSC
#define RCC_CFGR_PLLMUL_0_3_SHIFT
#define RCC_CIR_HSERDYIE
#define RCC_CFGR2
Definition: gd32/f1x0/rcc.h:57
rcc_osc
#define RCC_CIR_LSERDYIE
#define RCC_CSR
Definition: gd32/f1x0/rcc.h:55
#define RCC_BDCR_RTCEN
#define RCC_CSR_LSION
#define RCC_CR_HSERDY
Definition: gd32/f1x0/rcc.h:68
#define RCC_CIR_LSIRDYIE
#define RCC_CFGR2_PREDIV_NODIV
#define RCC_CFGR
Definition: gd32/f1x0/rcc.h:47
#define RCC_CIR_HSERDYC
#define RCC_CIR_LSIRDYC
#define RCC_CR_HSIRDY
Definition: gd32/f1x0/rcc.h:72
#define RCC_CFGR_SWS_SHIFT
#define RCC_BDCR_LSERDY
#define RCC_CSR_LSIRDY
#define RCC_BDCR
Definition: gd32/f1x0/rcc.h:54
#define RCC_CFGR_HPRE_SHIFT
#define RCC_CIR_LSERDYF
#define RCC_CFGR_SW_SHIFT
#define RCC_CIR_HSIRDYIE
#define RCC_CIR_LSIRDYF
#define RCC_CR_CSSON
Definition: gd32/f1x0/rcc.h:66
#define RCC_CR_PLLON
Definition: gd32/f1x0/rcc.h:65
#define RCC_CIR_HSIRDYC
#define RCC_CIR_HSIRDYF
#define RCC_CIR_CSSF
#define RCC_CR_HSEON
Definition: gd32/f1x0/rcc.h:69
#define RCC_CFGR_ADCPRE_SHIFT
#define RCC_CR_HSION
Definition: gd32/f1x0/rcc.h:73
#define RCC_CR_PLLRDY
Definition: gd32/f1x0/rcc.h:64
#define RCC_CFGR_PPRE1_SHIFT
@ RCC_HSI
@ RCC_LSI
@ RCC_PLL
@ RCC_LSE
@ RCC_HSE
int rcc_osc_ready_int_flag(enum rcc_osc osc)
RCC Read the Oscillator Ready Interrupt Flag.
Definition: rcc.c:194
int rcc_css_int_flag(void)
RCC Read the Clock Security System Interrupt Flag.
Definition: rcc.c:233
void rcc_set_adcpre(uint32_t adcpre)
ADC Setup the A/D Clock.
Definition: rcc.c:487
void rcc_set_rtc_clock_source(enum rcc_osc clock_source)
RCC Set the Source for the RTC clock.
Definition: rcc.c:438
void rcc_osc_ready_int_clear(enum rcc_osc osc)
RCC Clear the Oscillator Ready Interrupt Flag.
Definition: rcc.c:112
void rcc_wait_for_osc_ready(enum rcc_osc osc)
RCC Wait for Oscillator Ready.
Definition: rcc.c:244
void rcc_css_disable(void)
RCC Disable the Clock Security System.
Definition: rcc.c:351
void rcc_set_sysclk_source(uint32_t clk)
RCC Set the Source for the System Clock.
Definition: rcc.c:362
const struct rcc_clock_scale rcc_hsi_configs[]
Definition: rcc.c:62
uint32_t rcc_apb2_frequency
Definition: rcc.c:59
void rcc_set_pll_source(uint32_t pllsrc)
RCC Set the PLL Clock Source.
Definition: rcc.c:391
uint32_t rcc_system_clock_source(void)
RCC Get the System Clock Source.
Definition: rcc.c:563
void rcc_clock_setup_pll(const struct rcc_clock_scale *clock)
Setup clocks to run from PLL.
Definition: rcc.c:581
void rcc_set_prediv(uint32_t prediv)
Definition: rcc.c:549
void rcc_osc_ready_int_enable(enum rcc_osc osc)
RCC Enable the Oscillator Ready Interrupt.
Definition: rcc.c:139
void rcc_osc_ready_int_disable(enum rcc_osc osc)
RCC Disable the Oscillator Ready Interrupt.
Definition: rcc.c:166
void rcc_osc_on(enum rcc_osc osc)
RCC Turn on an Oscillator.
Definition: rcc.c:280
uint32_t rcc_ahb_frequency
Definition: rcc.c:60
void rcc_osc_off(enum rcc_osc osc)
RCC Turn off an Oscillator.
Definition: rcc.c:315
void rcc_set_pll_multiplication_factor(uint32_t mul)
RCC Set the PLL Multiplication Factor.
Definition: rcc.c:376
void rcc_backupdomain_reset(void)
RCC Reset the Backup Domain.
Definition: rcc.c:644
uint32_t rcc_apb1_frequency
Set the default clock frequencies.
Definition: rcc.c:58
void rcc_set_ppre1(uint32_t ppre1)
RCC Set the APB1 Prescale Factor.
Definition: rcc.c:513
void rcc_css_int_clear(void)
RCC Clear the Clock Security System Interrupt Flag.
Definition: rcc.c:222
void rcc_enable_rtc_clock(void)
RCC Enable the RTC clock.
Definition: rcc.c:427
void rcc_set_ppre2(uint32_t ppre2)
RCC Set the APB2 Prescale Factor.
Definition: rcc.c:499
const struct rcc_clock_scale rcc_hse8_configs[]
Definition: rcc.c:87
void rcc_set_usbpre(uint32_t usbpre)
RCC Set the USB Prescale Factor.
Definition: rcc.c:544
void rcc_css_enable(void)
RCC Enable the Clock Security System.
Definition: rcc.c:341
void rcc_set_hpre(uint32_t hpre)
RCC Set the AHB Prescale Factor.
Definition: rcc.c:526
void rcc_set_pllxtpre(uint32_t pllxtpre)
RCC Set the HSE Frequency Divider used as PLL Clock Source.
Definition: rcc.c:405
uint32_t rcc_rtc_clock_enabled_flag(void)
RCC RTC Clock Enabled Flag.
Definition: rcc.c:417
uint32_t apb1_frequency
uint32_t ahb_frequency
uint8_t pll_hse_prediv
uint32_t apb2_frequency