#include <cfg/arch.h>#include <arch/cm3.h>#include <arch/cm3/stm/stm32_clk.h>#include <cfg/clock.h>Defines | |
| #define | SYSCLK_SOURCE SYSCLK_HSI |
Functions | |
| int | CtlHseClock (uint8_t ena) |
| Control HSE clock. | |
| int | CtlHsiClock (uint8_t ena) |
| Control HSI clock. | |
| int | CtlPllClock (uint8_t ena) |
| Control PLL clock. | |
| int | SetPllClockSource (int src) |
| Configures the System clock source: HSE or HSI. | |
| int | SetSysClockSource (int src) |
| Configures the System clock source: HSI, HS or PLL. | |
| int | SetSysClock (void) |
| Configures the System clock coming from HSE or HSI oscillator. | |
| uint32_t | SysCtlClockGet (void) |
| requests System clock frequency | |
| #define SYSCLK_SOURCE SYSCLK_HSI |
Referenced by SetSysClock().
| int CtlHseClock | ( | uint8_t | ena | ) |
Control HSE clock.
| ena | 0 disable clock, any other value enable it. |
References HSE_STARTUP_TIMEOUT, rc, RCC, RCC_CR_HSEON, RCC_CR_HSERDY, and RESET.
| int CtlHsiClock | ( | uint8_t | ena | ) |
Control HSI clock.
| ena | 0 disable clock, any other value enable it. |
References HSE_STARTUP_TIMEOUT, rc, RCC, RCC_CR_HSION, RCC_CR_HSIRDY, and RESET.
| int CtlPllClock | ( | uint8_t | ena | ) |
Control PLL clock.
| ena | 0 disable clock, any other value enable it. |
References HSE_STARTUP_TIMEOUT, rc, RCC, RCC_CR_PLLON, RCC_CR_PLLRDY, and RESET.
| int SetPllClockSource | ( | int | src | ) |
Configures the System clock source: HSE or HSI.
| src | is one of PLLCLK_HSE, PLLCLK_HSI. |
References _BI32, CM3BBREG, CtlHseClock(), CtlHsiClock(), ENABLE, PLLCLK_HSE, PLLCLK_HSI, rc, RCC_BASE, and RCC_PLLCFGR_PLLSRC.
| int SetSysClockSource | ( | int | src | ) |
Configures the System clock source: HSI, HS or PLL.
| src | is one of SYSCLK_HSE, SYSCLK_HSI or SYSCLK_PLL. |
References CtlHseClock(), CtlHsiClock(), CtlPllClock(), ENABLE, rc, RCC, RCC_CFGR_SW, RCC_CFGR_SW_HSE, RCC_CFGR_SW_HSI, RCC_CFGR_SW_PLL, RCC_CFGR_SWS, RCC_CFGR_SWS_HSE, RCC_CFGR_SWS_HSI, RCC_CFGR_SWS_PLL, SYSCLK_HSE, SYSCLK_HSI, SYSCLK_PLL, and SystemCoreClockUpdate().
| int SetSysClock | ( | void | ) |
Configures the System clock coming from HSE or HSI oscillator.
Update SystemCoreClock according to Clock Register Values.
Enable HSI/HSE clock and setup HCLK, PCLK2 and PCLK1 prescalers.
| None. |
References rc, RCC, RCC_CFGR_HPRE, RCC_CFGR_HPRE_DIV1, RCC_CFGR_PPRE1, RCC_CFGR_PPRE1_DIV1, RCC_CFGR_PPRE2, RCC_CFGR_PPRE2_DIV1, SetSysClockSource(), and SYSCLK_SOURCE.
| uint32_t SysCtlClockGet | ( | void | ) |
requests System clock frequency
| None |
| None |
References SystemCoreClock, and SystemCoreClockUpdate().