libopencm3
A free/libre/open-source firmware library for various ARM Cortex-M3 microcontrollers.
rcc.c File Reference
Include dependency graph for rcc.c:

Go to the source code of this file.

Functions

void rcc_osc_on (enum rcc_osc osc)
 
void rcc_osc_off (enum rcc_osc osc)
 
bool rcc_is_osc_ready (enum rcc_osc osc)
 Is the given oscillator ready? More...
 
void rcc_wait_for_osc_ready (enum rcc_osc osc)
 Wait for Oscillator Ready. More...
 
void rcc_css_enable (void)
 
void rcc_css_disable (void)
 
void rcc_css_int_clear (void)
 
int rcc_css_int_flag (void)
 
void rcc_set_sysclk_source (enum rcc_osc osc)
 Set the Source for the System Clock. More...
 
enum rcc_osc rcc_system_clock_source (void)
 Return the clock source which is used as system clock. More...
 
void rcc_wait_for_sysclk_status (enum rcc_osc osc)
 Wait until system clock switched to given oscillator. More...
 
void rcc_set_pll_source (uint32_t pllsrc)
 Configure pll source. More...
 
void rcc_set_main_pll (uint32_t source, uint32_t pllm, uint32_t plln, uint32_t pllp, uint32_t pllq, uint32_t pllr)
 Configure pll source and output frequencies. More...
 
void rcc_enable_pllp (bool enable)
 Enable PLL P clock output. More...
 
void rcc_enable_pllq (bool enable)
 Enable PLL Q clock output. More...
 
void rcc_enable_pllr (bool enable)
 Enable PLL R clock output. More...
 
void rcc_set_ppre (uint32_t ppre)
 Configure APB peripheral clock prescaler. More...
 
void rcc_set_hpre (uint32_t hpre)
 Configure AHB peripheral clock prescaler. More...
 
void rcc_set_hsisys_div (uint32_t hsidiv)
 Configure HSI16 clock division factor to feed SYSCLK. More...
 
void rcc_set_mcopre (uint32_t mcopre)
 Configure mco prescaler. More...
 
void rcc_clock_setup (const struct rcc_clock_scale *clock)
 Setup sysclock with desired source (HSE/HSI/PLL/LSE/LSI). More...
 
void rcc_set_rng_clk_div (uint32_t rng_div)
 Setup RNG Peripheral Clock Divider. More...
 
void rcc_set_peripheral_clk_sel (uint32_t periph, uint32_t sel)
 Set the peripheral clock source. More...
 
static uint32_t rcc_get_clksel_freq (uint8_t shift)
 
uint32_t rcc_get_usart_clk_freq (uint32_t usart)
 Get the peripheral clock speed for the USART at base specified. More...
 
uint32_t rcc_get_timer_clk_freq (uint32_t timer)
 Get the peripheral clock speed for the Timer at base specified. More...
 
uint32_t rcc_get_i2c_clk_freq (uint32_t i2c)
 Get the peripheral clock speed for the I2C device at base specified. More...
 
uint32_t rcc_get_spi_clk_freq (uint32_t spi)
 Get the peripheral clock speed for the SPI device at base specified. More...
 

Variables

uint32_t rcc_ahb_frequency = 16000000
 
uint32_t rcc_apb1_frequency = 16000000
 
const struct rcc_clock_scale rcc_clock_config [RCC_CLOCK_CONFIG_END]