libopencm3
A free/libre/open-source firmware library for various ARM Cortex-M3 microcontrollers.
|
PAC5xx CCS Driver More...
Data Structures | |
struct | ccs_clk_config |
CCS Clock Configuration structure. More... | |
Functions | |
void | ccs_frclkmux_select (uint32_t sel) |
Select the source for FRCLK. More... | |
void | ccs_rosc_enable (void) |
Enable the 16MHz Ring oscillator. More... | |
void | ccs_rosc_disable (void) |
Disable the 16MHz Ring oscillator. More... | |
void | ccs_sclkmux_select_frclk (void) |
Select FRCLK for SCLK. More... | |
void | ccs_sclkmux_select_pllclk (void) |
Select PLLCLK for SCLK. More... | |
void | ccs_clkfail_enable (void) |
Enable Clock Fail Detection. More... | |
void | ccs_clkfail_disable (void) |
Disable Clock Fail Detection. More... | |
void | ccs_clkfailmux_select_frclk (void) |
Select FRCLK for Clock Fail Detection. More... | |
void | ccs_clkfailmux_select_pllclk (void) |
Select PLLCLK for Clock Fail Detection. More... | |
void | ccs_ldo_enable (void) |
Enable the LDO. More... | |
void | ccs_ldo_disable (void) |
Disable the LDO. More... | |
void | ccs_pclk_enable (void) |
Enable the Peripheral Clock. More... | |
void | ccs_pclk_disable (void) |
Disable the Peripheral Clock. More... | |
void | ccs_aclk_enable (void) |
Enable the Auxiliary Clock. More... | |
void | ccs_aclk_disable (void) |
Disable the Auxiliary Clock. More... | |
void | ccs_adcclk_enable (void) |
Enable the ADC Clock. More... | |
void | ccs_adcclk_disable (void) |
Disable the ADC Clock. More... | |
void | ccs_stclk_sleep_enable (void) |
Enable SysTick clock gating in deep sleep mode. More... | |
void | ccs_stclk_sleep_disable (void) |
Disable SysTick clock gating in deep sleep mode. More... | |
void | ccs_set_pclkdiv (uint32_t div) |
Set the divisor for the Peripheral Clock. More... | |
void | ccs_set_aclkdiv (uint32_t div) |
Set the divisor for the Auxiliary Clock. More... | |
void | ccs_set_hclkdiv (uint32_t div) |
Set the divisor for the AHB Clock. More... | |
void | ccs_pll_enable (void) |
Enable the PLL. More... | |
void | ccs_pll_disable (void) |
Disable the PLL. More... | |
bool | ccs_pll_locked (void) |
Check if the PLL is locked. More... | |
void | ccs_pll_bypass_enable (void) |
Enable the PLL bypass. More... | |
void | ccs_pll_bypass_disable (void) |
Disable the PLL bypass. More... | |
void | ccs_pll_set_outdiv (uint32_t div) |
Set the output divisor. More... | |
void | ccs_pll_set_indiv (uint32_t div) |
Set the PLL input divisor. More... | |
void | ccs_pll_set_fbdiv (uint32_t div) |
Set the PLL feedback divisor. More... | |
void | css_pll_config_enable (uint32_t indiv, uint32_t fbdiv, uint32_t outdiv) |
Configure the CCS PLL, enable it, and wait for lock. More... | |
uint32_t | ccs_get_peripheral_clk_freq (uint32_t periph, uint32_t select) |
Get the clock rate (in Hz) of the specified peripheral. More... | |
void | ccs_reset_clocks (void) |
Restores CCSCTL and CCSPLLCTL registers to default/safe values. More... | |
void | ccs_configure_clocks (const struct ccs_clk_config *config) |
Setup the PAC55xx clocks with the given struct. More... | |
PAC5xx CCS Driver
This library supports the CCS module in the PAC55xx SoC from Qorvo.
LGPL License Terms libopencm3 License
void ccs_aclk_disable | ( | void | ) |
void ccs_aclk_enable | ( | void | ) |
Enable the Auxiliary Clock.
Definition at line 78 of file ccs.c.
References CCS_CTL_ACLKEN, and CCSCTL.
Referenced by ccs_configure_clocks().
void ccs_adcclk_disable | ( | void | ) |
void ccs_adcclk_enable | ( | void | ) |
Enable the ADC Clock.
Definition at line 84 of file ccs.c.
References CCS_CTL_ADCCLKEN, and CCSCTL.
Referenced by ccs_configure_clocks().
void ccs_clkfail_disable | ( | void | ) |
void ccs_clkfail_enable | ( | void | ) |
Enable Clock Fail Detection.
Definition at line 54 of file ccs.c.
References CCS_CTL_CLKFAILEN, and CCSCTL.
void ccs_clkfailmux_select_frclk | ( | void | ) |
void ccs_clkfailmux_select_pllclk | ( | void | ) |
Select PLLCLK for Clock Fail Detection.
Definition at line 63 of file ccs.c.
References CCS_CTL_CLKFAILMUXSEL, and CCSCTL.
void ccs_configure_clocks | ( | const struct ccs_clk_config * | config | ) |
Setup the PAC55xx clocks with the given struct.
[in] | config | CCS Clock configuration struct /ref ccs_clk_config |
Definition at line 184 of file ccs.c.
References ccs_clk_config::aclkdiv, ccs_aclk_enable(), ccs_aclk_frequency, ccs_adcclk_enable(), CCS_CLKREF_FREQ, CCS_CTL_FRCLKMUXSEL_CLKREF, CCS_CTL_FRCLKMUXSEL_EXTCLK, CCS_CTL_FRCLKMUXSEL_ROSC, CCS_CTL_SCLKMUXSEL_FRCLK, CCS_CTL_SCLKMUXSEL_PLLCLK, ccs_extclk_frequency, CCS_EXTCLK_MAX_FREQ, ccs_frclk_frequency, ccs_frclkmux_select(), ccs_hclk_frequency, ccs_pclk_enable(), ccs_pclk_frequency, ccs_pll_clk_frequency, ccs_reset_clocks(), CCS_ROSC_FREQ, ccs_sclk_frequency, ccs_sclkmux_select_frclk(), ccs_sclkmux_select_pllclk(), ccs_set_aclkdiv(), ccs_set_hclkdiv(), ccs_set_pclkdiv(), ccs_stclk_sleep_disable(), cm3_assert_not_reached, css_pll_config_enable(), ccs_clk_config::extclk_frequency, ccs_clk_config::frclk_source, ccs_clk_config::hclkdiv, ccs_clk_config::mem_enable_cache, ccs_clk_config::mem_mclkdiv, ccs_clk_config::mem_mclksel, ccs_clk_config::mem_wstate, memctl_flash_cache_disable(), memctl_flash_cache_enable(), memctl_flash_select_mclk(), memctl_flash_select_roscclk(), memctl_flash_set_mclkdiv(), memctl_flash_set_wstate(), MEMCTL_FLASHLOCK, MEMCTL_FLASHLOCK_ALLOW_MEMCTL_WRITE, MEMCTL_FLASHLOCK_CLEAR, ccs_clk_config::pclkdiv, ccs_clk_config::pll_fbdiv, ccs_clk_config::pll_indiv, ccs_clk_config::pll_outdiv, and ccs_clk_config::sclk_source.
void ccs_frclkmux_select | ( | uint32_t | sel | ) |
Select the source for FRCLK.
[in] | sel | one of:
|
Definition at line 39 of file ccs.c.
References CCS_CTL_FRCLKMUXSEL, CCS_CTL_FRCLKMUXSEL_MASK, and CCSCTL.
Referenced by ccs_configure_clocks().
uint32_t ccs_get_peripheral_clk_freq | ( | uint32_t | periph, |
uint32_t | select | ||
) |
Get the clock rate (in Hz) of the specified peripheral.
This will pull the proper sources out of the clock tree and calculate the clock for the peripheral for return to the user, based on current settings.
[in] | periph | Peripheral base address to get the clock rate for. |
[in] | select | Peripheral-controlled clock select value. Set to 0 when not applicable. |
Definition at line 145 of file ccs.c.
References ADC_BASE, CAN_BASE, ccs_aclk_frequency, ccs_frclk_frequency, ccs_hclk_frequency, ccs_pclk_frequency, CCS_ROSC_FREQ, ccs_sclk_frequency, cm3_assert_not_reached, CRC_BASE, GPTIMERA_BASE, GPTIMERB_BASE, I2C_BASE, MEMCTL_BASE, RTC_BASE, SYS_TICK_BASE, TIMERA_BASE, TIMERB_BASE, TIMERC_BASE, TIMERD_BASE, USARTA_BASE, USARTB_BASE, USARTC_BASE, USARTD_BASE, and WWDT_BASE.
void ccs_ldo_disable | ( | void | ) |
void ccs_ldo_enable | ( | void | ) |
void ccs_pclk_disable | ( | void | ) |
void ccs_pclk_enable | ( | void | ) |
Enable the Peripheral Clock.
Definition at line 72 of file ccs.c.
References CCS_CTL_PCLKEN, and CCSCTL.
Referenced by ccs_configure_clocks().
void ccs_pll_bypass_disable | ( | void | ) |
void ccs_pll_bypass_enable | ( | void | ) |
Enable the PLL bypass.
Definition at line 114 of file ccs.c.
References CCS_PLLCTL_PLLBP, and CCSPLLCTL.
void ccs_pll_disable | ( | void | ) |
Disable the PLL.
Definition at line 108 of file ccs.c.
References CCSPLLCTL.
Referenced by css_pll_config_enable().
void ccs_pll_enable | ( | void | ) |
Enable the PLL.
Definition at line 105 of file ccs.c.
References CCS_PLLCTL_PLLEN, and CCSPLLCTL.
Referenced by css_pll_config_enable().
bool ccs_pll_locked | ( | void | ) |
Check if the PLL is locked.
Definition at line 111 of file ccs.c.
References CCS_PLLCTL_PLLLOCK, and CCSPLLCTL.
Referenced by css_pll_config_enable().
void ccs_pll_set_fbdiv | ( | uint32_t | div | ) |
Set the PLL feedback divisor.
[in] | div | Feedback divisor, 4-16383. |
Definition at line 130 of file ccs.c.
References CCS_PLLCTL_PLLFBDIV, CCS_PLLCTL_PLLFBDIV_MASK, CCSPLLCTL, and cm3_assert_not_reached.
Referenced by css_pll_config_enable().
void ccs_pll_set_indiv | ( | uint32_t | div | ) |
Set the PLL input divisor.
[in] | div | Input divisor, 1-15. |
Definition at line 123 of file ccs.c.
References CCS_PLLCTL_PLLINDIV, CCS_PLLCTL_PLLINDIV_MASK, CCSPLLCTL, and cm3_assert_not_reached.
Referenced by css_pll_config_enable().
void ccs_pll_set_outdiv | ( | uint32_t | div | ) |
Set the output divisor.
[in] | div | Output divisor, one of:
|
Definition at line 120 of file ccs.c.
References CCS_PLLCTL_PLLOUTDIV, CCS_PLLCTL_PLLOUTDIV_MASK, and CCSPLLCTL.
Referenced by css_pll_config_enable().
void ccs_reset_clocks | ( | void | ) |
Restores CCSCTL and CCSPLLCTL registers to default/safe values.
Definition at line 177 of file ccs.c.
References CCS_CTL_ACLKEN, CCS_CTL_ADCCLKEN, CCS_CTL_LDOEN, CCS_CTL_PCLKEN, CCS_CTL_ROSCEN, CCS_CTL_STCLKSLPEN, CCSCTL, and CCSPLLCTL.
Referenced by ccs_configure_clocks().
void ccs_rosc_disable | ( | void | ) |
void ccs_rosc_enable | ( | void | ) |
Enable the 16MHz Ring oscillator.
Definition at line 42 of file ccs.c.
References CCS_CTL_ROSCEN, and CCSCTL.
void ccs_sclkmux_select_frclk | ( | void | ) |
Select FRCLK for SCLK.
Definition at line 48 of file ccs.c.
References CCSCTL.
Referenced by ccs_configure_clocks().
void ccs_sclkmux_select_pllclk | ( | void | ) |
Select PLLCLK for SCLK.
Definition at line 51 of file ccs.c.
References CCS_CTL_SCLKMUXSEL, and CCSCTL.
Referenced by ccs_configure_clocks().
void ccs_set_aclkdiv | ( | uint32_t | div | ) |
Set the divisor for the Auxiliary Clock.
[in] | div | ACLK Divisor: 1-8. |
Definition at line 99 of file ccs.c.
References CCS_CTL_ACLKDIV, and CCSCTL.
Referenced by ccs_configure_clocks().
void ccs_set_hclkdiv | ( | uint32_t | div | ) |
Set the divisor for the AHB Clock.
[in] | div | HCLK Divisor: 1-8. |
Definition at line 102 of file ccs.c.
References CCS_CTL_HCLKDIV, and CCSCTL.
Referenced by ccs_configure_clocks().
void ccs_set_pclkdiv | ( | uint32_t | div | ) |
Set the divisor for the Peripheral Clock.
[in] | div | PCLK Divisor: 1-8. |
Definition at line 96 of file ccs.c.
References CCS_CTL_PCLKDIV, and CCSCTL.
Referenced by ccs_configure_clocks().
void ccs_stclk_sleep_disable | ( | void | ) |
Disable SysTick clock gating in deep sleep mode.
Definition at line 93 of file ccs.c.
References CCSCTL.
Referenced by ccs_configure_clocks().
void ccs_stclk_sleep_enable | ( | void | ) |
Enable SysTick clock gating in deep sleep mode.
Definition at line 90 of file ccs.c.
References CCS_CTL_STCLKSLPEN, and CCSCTL.
void css_pll_config_enable | ( | uint32_t | indiv, |
uint32_t | fbdiv, | ||
uint32_t | outdiv | ||
) |
Configure the CCS PLL, enable it, and wait for lock.
[in] | indiv | Input divisor, 1-15. |
[in] | fbdiv | Feedback divisor, 4-16383. |
[in] | outdiv | Output divisor, one of:
|
Definition at line 137 of file ccs.c.
References ccs_pll_disable(), ccs_pll_enable(), ccs_pll_locked(), ccs_pll_set_fbdiv(), ccs_pll_set_indiv(), and ccs_pll_set_outdiv().
Referenced by ccs_configure_clocks().