libopencm3
A free/libre/open-source firmware library for various ARM Cortex-M3 microcontrollers.
|
#include <stdbool.h>
#include <stdint.h>
#include <libopencm3/stm32/pwr.h>
#include <libopencm3/stm32/common/rcc_common_all.h>
Go to the source code of this file.
Data Structures | |
struct | rcc_clock_scale |
Enumerations | |
enum | rcc_osc { RCC_PLL , RCC_HSE , RCC_HSI48 , RCC_HSI16 , RCC_MSI , RCC_LSE , RCC_LSI } |
enum | rcc_periph_clken { RCC_GPIOA = _REG_BIT(0x2c, 0) , RCC_GPIOB = _REG_BIT(0x2c, 1) , RCC_GPIOC = _REG_BIT(0x2c, 2) , RCC_GPIOD = _REG_BIT(0x2c, 3) , RCC_GPIOE = _REG_BIT(0x2c, 4) , RCC_GPIOH = _REG_BIT(0x2c, 7) , RCC_DMA = _REG_BIT(0x30, 0) , RCC_MIF = _REG_BIT(0x30, 8) , RCC_CRC = _REG_BIT(0x30, 12) , RCC_TSC = _REG_BIT(0x30, 16) , RCC_RNG = _REG_BIT(0x30, 20) , RCC_CRYPT = _REG_BIT(0x30, 24) , RCC_SYSCFG = _REG_BIT(0x34, 0) , RCC_TIM21 = _REG_BIT(0x34, 2) , RCC_TIM22 = _REG_BIT(0x34, 5) , RCC_FW = _REG_BIT(0x34, 7) , RCC_ADC1 = _REG_BIT(0x34, 9) , RCC_SPI1 = _REG_BIT(0x34, 12) , RCC_USART1 = _REG_BIT(0x34, 14) , RCC_DBG = _REG_BIT(0x34, 22) , RCC_TIM2 = _REG_BIT(0x38, 0) , RCC_TIM3 = _REG_BIT(0x38, 1) , RCC_TIM6 = _REG_BIT(0x38, 4) , RCC_TIM7 = _REG_BIT(0x38, 5) , RCC_LCD = _REG_BIT(0x38, 9) , RCC_WWDG = _REG_BIT(0x38, 11) , RCC_SPI2 = _REG_BIT(0x38, 14) , RCC_USART2 = _REG_BIT(0x38, 17) , RCC_LPUART1 = _REG_BIT(0x38, 18) , RCC_USART4 = _REG_BIT(0x38, 19) , RCC_USART5 = _REG_BIT(0x38, 20) , RCC_I2C1 = _REG_BIT(0x38, 21) , RCC_I2C2 = _REG_BIT(0x38, 22) , RCC_USB = _REG_BIT(0x38, 23) , RCC_CRS = _REG_BIT(0x38, 27) , RCC_PWR = _REG_BIT(0x38, 28) , RCC_DAC = _REG_BIT(0x38, 29) , RCC_I2C3 = _REG_BIT(0x38, 30) , RCC_LPTIM1 = _REG_BIT(0x38, 31) , SCC_GPIOA = _REG_BIT(0x3c, 0) , SCC_GPIOB = _REG_BIT(0x3c, 1) , SCC_GPIOC = _REG_BIT(0x3c, 2) , SCC_GPIOD = _REG_BIT(0x3c, 3) , SCC_GPIOE = _REG_BIT(0x3c, 4) , SCC_GPIOH = _REG_BIT(0x3c, 7) , SCC_DMA = _REG_BIT(0x40, 0) , SCC_MIF = _REG_BIT(0x40, 8) , SCC_SRAM = _REG_BIT(0x40, 12) , SCC_CRC = _REG_BIT(0x40, 12) , SCC_TSC = _REG_BIT(0x40, 16) , SCC_RNG = _REG_BIT(0x40, 20) , SCC_CRYPT = _REG_BIT(0x40, 24) , SCC_SYSCFG = _REG_BIT(0x44, 0) , SCC_TIM21 = _REG_BIT(0x44, 2) , SCC_TIM22 = _REG_BIT(0x44, 5) , SCC_ADC1 = _REG_BIT(0x44, 9) , SCC_SPI1 = _REG_BIT(0x44, 12) , SCC_USART1 = _REG_BIT(0x44, 14) , SCC_DBG = _REG_BIT(0x44, 22) , SCC_TIM2 = _REG_BIT(0x48, 0) , SCC_TIM3 = _REG_BIT(0x48, 1) , SCC_TIM6 = _REG_BIT(0x48, 4) , SCC_TIM7 = _REG_BIT(0x48, 5) , SCC_LCD = _REG_BIT(0x48, 9) , SCC_WWDG = _REG_BIT(0x48, 11) , SCC_SPI2 = _REG_BIT(0x48, 14) , SCC_USART2 = _REG_BIT(0x48, 17) , SCC_LPUART1 = _REG_BIT(0x48, 18) , SCC_USART4 = _REG_BIT(0x48, 19) , SCC_USART5 = _REG_BIT(0x48, 20) , SCC_I2C1 = _REG_BIT(0x48, 21) , SCC_I2C2 = _REG_BIT(0x48, 22) , SCC_USB = _REG_BIT(0x48, 23) , SCC_CRS = _REG_BIT(0x48, 27) , SCC_PWR = _REG_BIT(0x48, 28) , SCC_DAC = _REG_BIT(0x48, 29) , SCC_I2C3 = _REG_BIT(0x48, 30) , SCC_LPTIM1 = _REG_BIT(0x48, 31) } |
enum | rcc_periph_rst { RST_GPIOA = _REG_BIT(0x1c, 0) , RST_GPIOB = _REG_BIT(0x1c, 1) , RST_GPIOC = _REG_BIT(0x1c, 2) , RST_GPIOD = _REG_BIT(0x1c, 3) , RST_GPIOE = _REG_BIT(0x1c, 4) , RST_GPIOH = _REG_BIT(0x1c, 7) , RST_DMA = _REG_BIT(0x20, 0) , RST_MIF = _REG_BIT(0x20, 8) , RST_CRC = _REG_BIT(0x20, 12) , RST_TSC = _REG_BIT(0x20, 16) , RST_RNG = _REG_BIT(0x20, 20) , RST_CRYPT = _REG_BIT(0x20, 24) , RST_SYSCFG = _REG_BIT(0x24, 0) , RST_TIM21 = _REG_BIT(0x24, 2) , RST_TIM22 = _REG_BIT(0x24, 5) , RST_ADC1 = _REG_BIT(0x24, 9) , RST_SPI1 = _REG_BIT(0x24, 12) , RST_USART1 = _REG_BIT(0x24, 14) , RST_DBG = _REG_BIT(0x24, 22) , RST_TIM2 = _REG_BIT(0x28, 0) , RST_TIM3 = _REG_BIT(0x28, 1) , RST_TIM6 = _REG_BIT(0x28, 4) , RST_TIM7 = _REG_BIT(0x28, 5) , RST_LCD = _REG_BIT(0x28, 9) , RST_WWDG = _REG_BIT(0x28, 11) , RST_SPI2 = _REG_BIT(0x28, 14) , RST_USART2 = _REG_BIT(0x28, 17) , RST_LPUART1 = _REG_BIT(0x28, 18) , RST_USART4 = _REG_BIT(0x28, 19) , RST_USART5 = _REG_BIT(0x28, 20) , RST_I2C1 = _REG_BIT(0x28, 21) , RST_I2C2 = _REG_BIT(0x28, 22) , RST_USB = _REG_BIT(0x28, 23) , RST_CRS = _REG_BIT(0x28, 27) , RST_PWR = _REG_BIT(0x28, 28) , RST_DAC = _REG_BIT(0x28, 29) , RST_I2C3 = _REG_BIT(0x28, 30) , RST_LPTIM1 = _REG_BIT(0x28, 31) } |
Functions | |
void | rcc_osc_on (enum rcc_osc osc) |
void | rcc_osc_off (enum rcc_osc osc) |
void | rcc_osc_ready_int_clear (enum rcc_osc osc) |
RCC Clear the Oscillator Ready Interrupt Flag. More... | |
void | rcc_osc_ready_int_enable (enum rcc_osc osc) |
RCC Enable the Oscillator Ready Interrupt. More... | |
void | rcc_osc_ready_int_disable (enum rcc_osc osc) |
RCC Disable the Oscillator Ready Interrupt. More... | |
int | rcc_osc_ready_int_flag (enum rcc_osc osc) |
RCC Read the Oscillator Ready Interrupt Flag. More... | |
void | rcc_set_hsi48_source_rc48 (void) |
RCC Set HSI48 clock source to the RC48 (CRS) More... | |
void | rcc_set_hsi48_source_pll (void) |
RCC Set HSI48 clock source to the PLL. More... | |
void | rcc_set_sysclk_source (enum rcc_osc osc) |
RCC Set the Source for the System Clock. More... | |
void | rcc_set_pll_multiplier (uint32_t factor) |
RCC Set the PLL Multiplication Factor. More... | |
void | rcc_set_pll_divider (uint32_t factor) |
RCC Set the PLL Division Factor. More... | |
void | rcc_set_pll_source (uint32_t pllsrc) |
Set the pll source. More... | |
void | rcc_set_ppre2 (uint32_t ppre2) |
RCC Set the APB2 Prescale Factor. More... | |
void | rcc_set_ppre1 (uint32_t ppre1) |
RCC Set the APB1 Prescale Factor. More... | |
void | rcc_set_hpre (uint32_t hpre) |
RCC Set the AHB Prescale Factor. More... | |
void | rcc_clock_setup_pll (const struct rcc_clock_scale *clock) |
RCC Setup PLL and use it as Sysclk source. More... | |
void | rcc_set_msi_range (uint32_t msi_range) |
Set the range of the MSI oscillator. More... | |
void | rcc_set_peripheral_clk_sel (uint32_t periph, uint32_t sel) |
Set the peripheral clock source. More... | |
void | rcc_set_lptim1_sel (uint32_t lptim1_sel) |
Set the LPTIM1 clock source. More... | |
void | rcc_set_lpuart1_sel (uint32_t lpupart1_sel) |
Set the LPUART1 clock source. More... | |
void | rcc_set_usart1_sel (uint32_t usart1_sel) |
Set the USART1 clock source. More... | |
void | rcc_set_usart2_sel (uint32_t usart2_sel) |
Set the USART2 clock source. More... | |
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 |
uint32_t | rcc_apb1_frequency |
uint32_t | rcc_apb2_frequency |