stm32/f0: more clock helper functions

Add two clock helper defines and functions:
- rcc_set_pll_source: select PLL entry clock source
- rcc_set_pllxtpre: HSE divider for PLL input clock

Signed-off-by: Sergey Matyukevich <geomatsi@gmail.com>
This commit is contained in:
Sergey Matyukevich
2016-12-17 22:10:25 +03:00
committed by Karl Palsson
parent 885d5c6105
commit 1b97ecefff
2 changed files with 35 additions and 1 deletions

View File

@@ -125,11 +125,16 @@ Control</b>
#define RCC_CFGR_PLLMUL_MUL16 (0x0E << RCC_CFGR_PLLMUL_SHIFT)
#define RCC_CFGR_PLLXTPRE (1<<17)
#define RCC_CFGR_PLLXTPRE_HSE_CLK 0x0
#define RCC_CFGR_PLLXTPRE_HSE_CLK_DIV2 0x1
#define RCC_CFGR_PLLSRC (1<<16)
#define RCC_CFGR_PLLSRC_HSI_CLK_DIV2 0x0
#define RCC_CFGR_PLLSRC_HSE_CLK 0x1
#define RCC_CFGR_PLLSRC0 (1<<15)
#define RCC_CFGR_ADCPRE (1<<14)
#define RCC_CFGR_PPRE_SHIFT 8
#define RCC_CFGR_PPRE (7 << RCC_CFGR_PPRE_SHIFT)
#define RCC_CFGR_PPRE_NODIV (0 << RCC_CFGR_PPRE_SHIFT)
@@ -513,6 +518,8 @@ void rcc_set_rtc_clock_source(enum rcc_osc clk);
void rcc_enable_rtc_clock(void);
void rcc_disable_rtc_clock(void);
void rcc_set_pll_multiplication_factor(uint32_t mul);
void rcc_set_pll_source(uint32_t pllsrc);
void rcc_set_pllxtpre(uint32_t pllxtpre);
void rcc_set_ppre(uint32_t ppre);
void rcc_set_hpre(uint32_t hpre);
void rcc_set_prediv(uint32_t prediv);