libopencm3
A free/libre/open-source firmware library for various ARM Cortex-M3 microcontrollers.
|
Defined Constants and Types for the STM32L0xx Reset and Clock Control More...
Data Structures | |
struct | rcc_clock_scale |
Modules | |
PLLDIV PLL division factor | |
PLLMUL PLL multiplication factor | |
RCC_CFGR APBx prescale factors | |
These can be used for both APB1 and APB2 prescaling. | |
RCC_CFGR AHB prescale Factors | |
RCC_CFGR Deprecated dividers | |
Older compatible definitions to ease migration. | |
RCC_AHBRSTR reset values | |
RCC_APB2RSTR reset values | |
RCC_APB1RSTR reset values | |
RCC_APHBENR enable values | |
RCC_APPB2ENR enable values | |
RCC_APB1ENR enable values | |
I2C Clock source selections | |
I2C for clock source selecting | |
UART Clock source selections | |
UART for clock source selecting | |
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... | |
void | rcc_peripheral_enable_clock (volatile uint32_t *reg, uint32_t en) |
RCC Enable Peripheral Clocks. More... | |
void | rcc_peripheral_disable_clock (volatile uint32_t *reg, uint32_t en) |
RCC Disable Peripheral Clocks. More... | |
void | rcc_peripheral_reset (volatile uint32_t *reg, uint32_t reset) |
RCC Reset Peripherals. More... | |
void | rcc_peripheral_clear_reset (volatile uint32_t *reg, uint32_t clear_reset) |
RCC Remove Reset on Peripherals. More... | |
void | rcc_periph_clock_enable (enum rcc_periph_clken clken) |
Enable Peripheral Clock in running mode. More... | |
void | rcc_periph_clock_disable (enum rcc_periph_clken clken) |
Disable Peripheral Clock in running mode. More... | |
void | rcc_periph_reset_pulse (enum rcc_periph_rst rst) |
Reset Peripheral, pulsed. More... | |
void | rcc_periph_reset_hold (enum rcc_periph_rst rst) |
Reset Peripheral, hold. More... | |
void | rcc_periph_reset_release (enum rcc_periph_rst rst) |
Reset Peripheral, release. More... | |
void | rcc_set_mco (uint32_t mcosrc) |
Select the source of Microcontroller Clock Output. More... | |
void | rcc_osc_bypass_enable (enum rcc_osc osc) |
RCC Enable Bypass. More... | |
void | rcc_osc_bypass_disable (enum rcc_osc osc) |
RCC Disable Bypass. More... | |
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... | |
uint16_t | rcc_get_div_from_hpre (uint8_t div_val) |
This will return the divisor 1/2/4/8/16/64/128/256/512 which is set as a 4-bit value, typically used for hpre and other prescalers. More... | |
Variables | |
uint32_t | rcc_ahb_frequency |
uint32_t | rcc_apb1_frequency |
uint32_t | rcc_apb2_frequency |
Defined Constants and Types for the STM32L0xx Reset and Clock Control
LGPL License Terms libopencm3 License
#define RCC_CCIPR_LPUARTxSEL_HSI RCC_CCIPR_USARTxSEL_HSI |
#define RCC_CCIPR_LPUARTxSEL_LSE RCC_CCIPR_USARTxSEL_LSE |
#define RCC_CCIPR_LPUARTxSEL_PCLK RCC_CCIPR_USARTxSEL_PCLK |
#define RCC_CCIPR_LPUARTxSEL_SYSCK RCC_CCIPR_USARTxSEL_SYSCLK |
#define RCC_CCIPR_USARTxSEL_MASK RCC_CCIPR_LPUARTxSEL_MASK |
#define RCC_CSR_RESET_FLAGS |
enum rcc_osc |
enum rcc_periph_clken |
enum rcc_periph_rst |
void rcc_clock_setup_pll | ( | const struct rcc_clock_scale * | clock | ) |
RCC Setup PLL and use it as Sysclk source.
[in] | clock | full struct with desired parameters |
Definition at line 580 of file rcc.c.
References rcc_clock_scale::ahb_frequency, rcc_clock_scale::apb1_frequency, rcc_clock_scale::apb2_frequency, flash_prefetch_enable(), flash_set_ws(), rcc_clock_scale::flash_waitstates, rcc_clock_scale::hpre, rcc_clock_scale::pll_div, rcc_clock_scale::pll_mul, rcc_clock_scale::pll_source, rcc_clock_scale::ppre1, rcc_clock_scale::ppre2, pwr_set_vos_scale(), rcc_ahb_frequency, rcc_apb1_frequency, rcc_apb2_frequency, RCC_CFGR_PLLSRC_HSE_CLK, RCC_HSE, RCC_HSI16, rcc_is_osc_ready(), rcc_osc_off(), rcc_osc_on(), rcc_periph_clock_enable(), RCC_PLL, RCC_PWR, rcc_set_hpre(), rcc_set_pll_divider(), rcc_set_pll_multiplier(), rcc_set_pll_source(), rcc_set_ppre1(), rcc_set_ppre2(), rcc_set_sysclk_source(), rcc_wait_for_osc_ready(), and rcc_clock_scale::voltage_scale.
uint16_t rcc_get_div_from_hpre | ( | uint8_t | div_val | ) |
This will return the divisor 1/2/4/8/16/64/128/256/512 which is set as a 4-bit value, typically used for hpre and other prescalers.
div_val | Masked and shifted divider value from register (e.g. RCC_CFGR) |
Definition at line 260 of file rcc_common_all.c.
Referenced by rcc_uart_i2c_clksel_freq_hz().
uint32_t rcc_get_i2c_clk_freq | ( | uint32_t | i2c | ) |
Get the peripheral clock speed for the I2C device at base specified.
i2c | Base address of I2C to get clock frequency for. |
Definition at line 552 of file rcc.c.
References I2C1_BASE, I2C3_BASE, rcc_apb1_frequency, RCC_CCIPR_I2C1SEL_SHIFT, RCC_CCIPR_I2C3SEL_SHIFT, and rcc_uart_i2c_clksel_freq_hz().
uint32_t rcc_get_spi_clk_freq | ( | uint32_t | spi | ) |
Get the peripheral clock speed for the SPI device at base specified.
spi | Base address of SPI device to get clock frequency for (e.g. SPI1_BASE). |
Definition at line 567 of file rcc.c.
References rcc_apb1_frequency, rcc_apb2_frequency, and SPI1_BASE.
uint32_t rcc_get_timer_clk_freq | ( | uint32_t | timer | ) |
Get the peripheral clock speed for the Timer at base specified.
timer | Base address of TIM to get clock frequency for. |
Definition at line 533 of file rcc.c.
References rcc_apb1_frequency, rcc_apb2_frequency, RCC_CFGR, RCC_CFGR_PPRE1_MASK, RCC_CFGR_PPRE1_NODIV, RCC_CFGR_PPRE1_SHIFT, RCC_CFGR_PPRE2_MASK, RCC_CFGR_PPRE2_NODIV, RCC_CFGR_PPRE2_SHIFT, TIM2_BASE, and TIM7_BASE.
uint32_t rcc_get_usart_clk_freq | ( | uint32_t | usart | ) |
Get the peripheral clock speed for the USART at base specified.
usart | Base address of USART to get clock frequency for. |
Definition at line 518 of file rcc.c.
References LPUART1_BASE, rcc_apb1_frequency, rcc_apb2_frequency, RCC_CCIPR_LPUART1SEL_SHIFT, RCC_CCIPR_USART1SEL_SHIFT, RCC_CCIPR_USART2SEL_SHIFT, rcc_uart_i2c_clksel_freq_hz(), and USART1_BASE.
Referenced by usart_set_baudrate().
bool rcc_is_osc_ready | ( | enum rcc_osc | osc | ) |
Is the given oscillator ready?
osc | Oscillator ID |
Definition at line 237 of file rcc.c.
References RCC_CR, RCC_CR_HSERDY, RCC_CR_HSI16RDY, RCC_CR_MSIRDY, RCC_CR_PLLRDY, RCC_CRRCR, RCC_CRRCR_HSI48RDY, RCC_CSR, RCC_CSR_LSERDY, RCC_CSR_LSIRDY, RCC_HSE, RCC_HSI16, RCC_HSI48, RCC_LSE, RCC_LSI, RCC_MSI, and RCC_PLL.
Referenced by rcc_clock_setup_pll(), and rcc_wait_for_osc_ready().
void rcc_osc_bypass_disable | ( | enum rcc_osc | osc | ) |
RCC Disable Bypass.
Re-enable the internal clock (high speed and low speed clocks only). The internal clock must be disabled (see rcc_osc_off) for this to have effect.
[in] | osc | Oscillator ID. Only HSE and LSE have effect. |
Definition at line 238 of file rcc_common_all.c.
void rcc_osc_bypass_enable | ( | enum rcc_osc | osc | ) |
RCC Enable Bypass.
Enable an external clock to bypass the internal clock (high speed and low speed clocks only). The external clock must be enabled (see rcc_osc_on) and the internal clock must be disabled (see rcc_osc_off) for this to have effect.
[in] | osc | Oscillator ID. Only HSE and LSE have effect. |
Definition at line 208 of file rcc_common_all.c.
References RCC_CR, RCC_CR_HSEBYP, RCC_CSR, RCC_CSR_LSEBYP, RCC_HSE, and RCC_LSE.
void rcc_osc_off | ( | enum rcc_osc | osc | ) |
void rcc_osc_on | ( | enum rcc_osc | osc | ) |
Definition at line 47 of file rcc.c.
References RCC_CR, RCC_CR_HSEON, RCC_CR_HSI16ON, RCC_CR_MSION, RCC_CR_PLLON, RCC_CRRCR, RCC_CRRCR_HSI48ON, RCC_CSR, RCC_CSR_LSEON, RCC_CSR_LSION, RCC_HSE, RCC_HSI16, RCC_HSI48, RCC_LSE, RCC_LSI, RCC_MSI, and RCC_PLL.
Referenced by rcc_clock_setup_pll().
void rcc_osc_ready_int_clear | ( | enum rcc_osc | osc | ) |
RCC Clear the Oscillator Ready Interrupt Flag.
Clear the interrupt flag that was set when a clock oscillator became ready to use.
[in] | osc | Oscillator ID |
Definition at line 110 of file rcc.c.
References RCC_CICR, RCC_CICR_HSERDYC, RCC_CICR_HSI16RDYC, RCC_CICR_HSI48RDYC, RCC_CICR_LSERDYC, RCC_CICR_LSIRDYC, RCC_CICR_MSIRDYC, RCC_CICR_PLLRDYC, RCC_HSE, RCC_HSI16, RCC_HSI48, RCC_LSE, RCC_LSI, RCC_MSI, and RCC_PLL.
void rcc_osc_ready_int_disable | ( | enum rcc_osc | osc | ) |
void rcc_osc_ready_int_enable | ( | enum rcc_osc | osc | ) |
RCC Enable the Oscillator Ready Interrupt.
[in] | osc | Oscillator ID |
Definition at line 142 of file rcc.c.
References RCC_CIER, RCC_CIER_HSERDYIE, RCC_CIER_HSI16RDYIE, RCC_CIER_HSI48RDYIE, RCC_CIER_LSERDYIE, RCC_CIER_LSIRDYIE, RCC_CIER_MSIRDYIE, RCC_CIER_PLLRDYIE, RCC_HSE, RCC_HSI16, RCC_HSI48, RCC_LSE, RCC_LSI, RCC_MSI, and RCC_PLL.
int rcc_osc_ready_int_flag | ( | enum rcc_osc | osc | ) |
RCC Read the Oscillator Ready Interrupt Flag.
[in] | osc | Oscillator ID |
Definition at line 207 of file rcc.c.
References cm3_assert_not_reached, RCC_CIFR, RCC_CIFR_HSERDYF, RCC_CIFR_HSI16RDYF, RCC_CIFR_HSI48RDYF, RCC_CIFR_LSERDYF, RCC_CIFR_LSIRDYF, RCC_CIFR_MSIRDYF, RCC_CIFR_PLLRDYF, RCC_HSE, RCC_HSI16, RCC_HSI48, RCC_LSE, RCC_LSI, RCC_MSI, and RCC_PLL.
void rcc_periph_clock_disable | ( | enum rcc_periph_clken | clken | ) |
Disable Peripheral Clock in running mode.
Disable the clock on particular peripheral.
[in] | clken | rcc_periph_clken Peripheral RCC |
For available constants, see rcc_periph_clken (RCC_UART1 for example)
Definition at line 139 of file rcc_common_all.c.
References _RCC_REG.
void rcc_periph_clock_enable | ( | enum rcc_periph_clken | clken | ) |
Enable Peripheral Clock in running mode.
Enable the clock on particular peripheral.
[in] | clken | rcc_periph_clken Peripheral RCC |
For available constants, see rcc_periph_clken (RCC_UART1 for example)
Definition at line 127 of file rcc_common_all.c.
References _RCC_BIT, and _RCC_REG.
Referenced by crs_autotrim_usb_enable(), rcc_clock_setup_pll(), and st_usbfs_v2_usbd_init().
void rcc_periph_reset_hold | ( | enum rcc_periph_rst | rst | ) |
Reset Peripheral, hold.
Reset particular peripheral, and hold in reset state.
[in] | rst | rcc_periph_rst Peripheral reset |
For available constants, see rcc_periph_rst (RST_UART1 for example)
Definition at line 166 of file rcc_common_all.c.
void rcc_periph_reset_pulse | ( | enum rcc_periph_rst | rst | ) |
Reset Peripheral, pulsed.
Reset particular peripheral, and restore to working state.
[in] | rst | rcc_periph_rst Peripheral reset |
For available constants, see rcc_periph_rst (RST_UART1 for example)
Definition at line 152 of file rcc_common_all.c.
void rcc_periph_reset_release | ( | enum rcc_periph_rst | rst | ) |
Reset Peripheral, release.
Restore peripheral from reset state to working state.
[in] | rst | rcc_periph_rst Peripheral reset |
For available constants, see rcc_periph_rst (RST_UART1 for example)
Definition at line 179 of file rcc_common_all.c.
References _RCC_REG.
void rcc_peripheral_clear_reset | ( | volatile uint32_t * | reg, |
uint32_t | clear_reset | ||
) |
RCC Remove Reset on Peripherals.
Remove the reset on particular peripherals. There are three registers involved, each one controlling reset of peripherals associated with the AHB, APB1 and APB2 respectively. Several peripherals could have the reset removed simultaneously only if they are controlled by the same register.
[in] | *reg | Unsigned int32. Pointer to a Reset Register (either RCC_AHBENR, RCC_APB1ENR or RCC_APB2ENR) |
[in] | clear_reset | Unsigned int32. Logical OR of all resets to be removed:
|
Definition at line 111 of file rcc_common_all.c.
void rcc_peripheral_disable_clock | ( | volatile uint32_t * | reg, |
uint32_t | en | ||
) |
RCC Disable Peripheral Clocks.
Disable the clock on particular peripherals. There are three registers involved, each one controlling the enabling of clocks associated with the AHB, APB1 and APB2 respectively. Several peripherals could be disabled simultaneously only if they are controlled by the same register.
[in] | *reg | Unsigned int32. Pointer to a Clock Enable Register (either RCC_AHBENR, RCC_APB1ENR or RCC_APB2ENR) |
[in] | en | Unsigned int32. Logical OR of all enables to be used for disabling.
|
Definition at line 66 of file rcc_common_all.c.
void rcc_peripheral_enable_clock | ( | volatile uint32_t * | reg, |
uint32_t | en | ||
) |
RCC Enable Peripheral Clocks.
Enable the clock on particular peripherals. There are three registers involved, each one controlling the enabling of clocks associated with the AHB, APB1 and APB2 respectively. Several peripherals could be enabled simultaneously only if they are controlled by the same register.
[in] | *reg | Unsigned int32. Pointer to a Clock Enable Register (either RCC_AHBENR, RCC_APB1ENR or RCC_APB2ENR) |
[in] | en | Unsigned int32. Logical OR of all enables to be set
|
Definition at line 44 of file rcc_common_all.c.
void rcc_peripheral_reset | ( | volatile uint32_t * | reg, |
uint32_t | reset | ||
) |
RCC Reset Peripherals.
Reset particular peripherals. There are three registers involved, each one controlling reset of peripherals associated with the AHB, APB1 and APB2 respectively. Several peripherals could be reset simultaneously only if they are controlled by the same register.
[in] | *reg | Unsigned int32. Pointer to a Reset Register (either RCC_AHBENR, RCC_APB1ENR or RCC_APB2ENR) |
[in] | reset | Unsigned int32. Logical OR of all resets.
|
Definition at line 88 of file rcc_common_all.c.
void rcc_set_hpre | ( | uint32_t | hpre | ) |
RCC Set the AHB Prescale Factor.
[in] | hpre | Unsigned int32. AHB prescale factor RCC_CFGR AHB prescale Factors |
Definition at line 387 of file rcc.c.
References RCC_CFGR, RCC_CFGR_HPRE_MASK, and RCC_CFGR_HPRE_SHIFT.
Referenced by rcc_clock_setup_pll().
void rcc_set_hsi48_source_pll | ( | void | ) |
void rcc_set_hsi48_source_rc48 | ( | void | ) |
RCC Set HSI48 clock source to the RC48 (CRS)
Definition at line 266 of file rcc.c.
References RCC_CCIPR, and RCC_CCIPR_HSI48SEL.
void rcc_set_lptim1_sel | ( | uint32_t | lptim1_sel | ) |
Set the LPTIM1 clock source.
lptim1_sel | peripheral clock source rcc_ccpipr_lptim1sel |
Definition at line 409 of file rcc.c.
References RCC_CCIPR, RCC_CCIPR_LPTIM1SEL_MASK, and RCC_CCIPR_LPTIM1SEL_SHIFT.
void rcc_set_lpuart1_sel | ( | uint32_t | lpuart1_sel | ) |
Set the LPUART1 clock source.
lpuart1_sel | periphral clock source rcc_ccpipr_lpuart1sel |
Definition at line 421 of file rcc.c.
References RCC_CCIPR, RCC_CCIPR_LPTIM1SEL_SHIFT, and RCC_CCIPR_LPUARTxSEL_MASK.
void rcc_set_mco | ( | uint32_t | mcosrc | ) |
Select the source of Microcontroller Clock Output.
Exact sources available depend on your target. On devices with multiple MCO pins, this function controls MCO1
[in] | mcosrc | the unshifted source bits |
Definition at line 191 of file rcc_common_all.c.
References RCC_CFGR, RCC_CFGR_MCO_MASK, and RCC_CFGR_MCO_SHIFT.
void rcc_set_msi_range | ( | uint32_t | msi_range | ) |
Set the range of the MSI oscillator.
msi_range | desired range rcc_icscr_msirange |
Definition at line 398 of file rcc.c.
References RCC_ICSCR, RCC_ICSCR_MSIRANGE_MASK, and RCC_ICSCR_MSIRANGE_SHIFT.
void rcc_set_peripheral_clk_sel | ( | uint32_t | periph, |
uint32_t | sel | ||
) |
Set the peripheral clock source.
periph | peripheral of desire, eg XXX_BASE |
sel | peripheral clock source |
Definition at line 454 of file rcc.c.
References I2C1_BASE, I2C3_BASE, LPTIM1_BASE, LPUART1_BASE, RCC_CCIPR, RCC_CCIPR_I2C1SEL_SHIFT, RCC_CCIPR_I2C3SEL_SHIFT, RCC_CCIPR_I2CxSEL_MASK, RCC_CCIPR_LPTIM1SEL_MASK, RCC_CCIPR_LPTIM1SEL_SHIFT, RCC_CCIPR_LPUART1SEL_SHIFT, RCC_CCIPR_LPUARTxSEL_MASK, RCC_CCIPR_USART1SEL_SHIFT, RCC_CCIPR_USART2SEL_SHIFT, RCC_CCIPR_USARTxSEL_MASK, USART1_BASE, and USART2_BASE.
void rcc_set_pll_divider | ( | uint32_t | factor | ) |
RCC Set the PLL Division Factor.
[in] | factor | PLL multiplication factor PLLDIV PLL division factor |
Definition at line 331 of file rcc.c.
References RCC_CFGR, RCC_CFGR_PLLDIV_MASK, and RCC_CFGR_PLLDIV_SHIFT.
Referenced by rcc_clock_setup_pll().
void rcc_set_pll_multiplier | ( | uint32_t | factor | ) |
RCC Set the PLL Multiplication Factor.
[in] | factor | PLL multiplication factor PLLMUL PLL multiplication factor |
Definition at line 315 of file rcc.c.
References RCC_CFGR, RCC_CFGR_PLLMUL_MASK, and RCC_CFGR_PLLMUL_SHIFT.
Referenced by rcc_clock_setup_pll().
void rcc_set_pll_source | ( | uint32_t | pllsrc | ) |
Set the pll source.
pllsrc | RCC_CFGR_PLLSRC_HSI16_CLK or RCC_CFGR_PLLSRC_HSE_CLK |
Definition at line 342 of file rcc.c.
References RCC_CFGR, and RCC_CFGR_PLLSRC_HSE_CLK.
Referenced by rcc_clock_setup_pll().
void rcc_set_ppre1 | ( | uint32_t | ppre | ) |
RCC Set the APB1 Prescale Factor.
[in] | ppre | APB prescale factor rcc_cfgr_apb1pre |
Definition at line 359 of file rcc.c.
References RCC_CFGR, RCC_CFGR_PPRE1_MASK, and RCC_CFGR_PPRE1_SHIFT.
Referenced by rcc_clock_setup_pll().
void rcc_set_ppre2 | ( | uint32_t | ppre | ) |
RCC Set the APB2 Prescale Factor.
[in] | ppre | APB prescale factor rcc_cfgr_apb2pre |
Definition at line 374 of file rcc.c.
References RCC_CFGR, RCC_CFGR_PPRE2_MASK, and RCC_CFGR_PPRE2_SHIFT.
Referenced by rcc_clock_setup_pll().
void rcc_set_sysclk_source | ( | enum rcc_osc | osc | ) |
RCC Set the Source for the System Clock.
[in] | osc | Oscillator ID. Only HSE, HSI16, MSI and PLL have effect. |
Definition at line 285 of file rcc.c.
References RCC_CFGR, RCC_CFGR_SW_HSE, RCC_CFGR_SW_HSI16, RCC_CFGR_SW_MSI, RCC_CFGR_SW_PLL, RCC_HSE, RCC_HSI16, RCC_HSI48, RCC_LSE, RCC_LSI, RCC_MSI, and RCC_PLL.
Referenced by rcc_clock_setup_pll().
void rcc_set_usart1_sel | ( | uint32_t | usart1_sel | ) |
Set the USART1 clock source.
usart1_sel | periphral clock source rcc_ccpipr_usart1sel |
Definition at line 432 of file rcc.c.
References RCC_CCIPR, RCC_CCIPR_USART1SEL_SHIFT, and RCC_CCIPR_USARTxSEL_MASK.
void rcc_set_usart2_sel | ( | uint32_t | usart2_sel | ) |
Set the USART2 clock source.
usart2_sel | periphral clock source rcc_ccpipr_usartxsel |
Definition at line 443 of file rcc.c.
References RCC_CCIPR, RCC_CCIPR_USART2SEL_SHIFT, and RCC_CCIPR_USARTxSEL_MASK.
void rcc_wait_for_osc_ready | ( | enum rcc_osc | osc | ) |
Wait for Oscillator Ready.
Block until the hardware indicates that the Oscillator is ready.
osc | Oscillator ID |
Definition at line 258 of file rcc.c.
References rcc_is_osc_ready().
Referenced by rcc_clock_setup_pll().
|
extern |
Definition at line 43 of file rcc.c.
Referenced by rcc_clock_setup_pll(), and rcc_uart_i2c_clksel_freq_hz().
|
extern |
Definition at line 44 of file rcc.c.
Referenced by rcc_clock_setup_pll(), rcc_get_i2c_clk_freq(), rcc_get_spi_clk_freq(), rcc_get_timer_clk_freq(), and rcc_get_usart_clk_freq().
|
extern |
Definition at line 45 of file rcc.c.
Referenced by rcc_clock_setup_pll(), rcc_get_spi_clk_freq(), rcc_get_timer_clk_freq(), and rcc_get_usart_clk_freq().