libopencm3
A free/libre/open-source firmware library for various ARM Cortex-M3 microcontrollers.
|
Macros | |
#define | _CMU_REG(i) MMIO32(CMU_BASE + ((i) >> 5)) |
#define | _CMU_BIT(i) (1 << ((i) & 0x1f)) |
Functions | |
void | cmu_enable_lock (void) |
Enable CMU registers lock. More... | |
void | cmu_disable_lock (void) |
Disable CMU registers lock. More... | |
bool | cmu_get_lock_flag (void) |
Get CMU register lock flag. More... | |
void | cmu_periph_clock_enable (enum cmu_periph_clken clken) |
Enable Peripheral Clock in running mode. More... | |
void | cmu_periph_clock_disable (enum cmu_periph_clken clken) |
Disable Peripheral Clock in running mode. More... | |
void | cmu_osc_on (enum cmu_osc osc) |
Turn on Oscillator. More... | |
void | cmu_osc_off (enum cmu_osc osc) |
Turn off Oscillator. More... | |
bool | cmu_osc_ready_flag (enum cmu_osc osc) |
Get Oscillator read flag. More... | |
void | cmu_wait_for_osc_ready (enum cmu_osc osc) |
Wait till oscillator is not ready. More... | |
void | cmu_set_hfclk_source (enum cmu_osc osc) |
Set HFCLK clock source. More... | |
enum cmu_osc | cmu_get_hfclk_source (void) |
void | cmu_clock_setup_in_hfxo_out_48mhz (void) |
HFXO output 48Mhz and core running at 48Mhz. More... | |
#define _CMU_BIT | ( | i | ) | (1 << ((i) & 0x1f)) |
Definition at line 55 of file cmu_common.c.
Definition at line 54 of file cmu_common.c.
void cmu_clock_setup_in_hfxo_out_48mhz | ( | void | ) |
HFXO output 48Mhz and core running at 48Mhz.
Definition at line 252 of file cmu_common.c.
References CMU_CTRL, CMU_CTRL_HFCLKDIV_MASK, CMU_CTRL_HFCLKDIV_NODIV, CMU_CTRL_HFXOBUFCUR_BOOSTABOVE32MHZ, CMU_CTRL_HFXOBUFCUR_MASK, cmu_get_hfclk_source(), CMU_HFCORECLKDIV, CMU_HFCORECLKDIV_HFCORECLKDIV_NODIV, CMU_HFCORECLKDIV_HFCORECLKLEDIV, cmu_osc_on(), cmu_set_hfclk_source(), cmu_wait_for_osc_ready(), HFXO, MSC_READCTRL, and MSC_READCTRL_MODE_WS2.
void cmu_disable_lock | ( | void | ) |
Disable CMU registers lock.
Definition at line 39 of file cmu_common.c.
References CMU_LOCK, and CMU_LOCK_LOCKKEY_UNLOCK.
void cmu_enable_lock | ( | void | ) |
Enable CMU registers lock.
Definition at line 31 of file cmu_common.c.
References CMU_LOCK, and CMU_LOCK_LOCKKEY_LOCK.
enum cmu_osc cmu_get_hfclk_source | ( | void | ) |
Definition at line 232 of file cmu_common.c.
References CMU_STATUS, CMU_STATUS_HFRCOSEL, CMU_STATUS_HFXOSEL, CMU_STATUS_LFRCOSEL, CMU_STATUS_LFXOSEL, HFRCO, HFXO, LFRCO, and LFXO.
Referenced by cmu_clock_setup_in_hfxo_out_48mhz().
bool cmu_get_lock_flag | ( | void | ) |
Get CMU register lock flag.
true | if flag is set |
false | if flag is not set |
Definition at line 49 of file cmu_common.c.
References CMU_LOCK, CMU_LOCK_LOCKKEY_LOCKED, and CMU_LOCK_LOCKKEY_MASK.
void cmu_osc_off | ( | enum cmu_osc | osc | ) |
Turn off Oscillator.
[in] | osc | enum cmu_osc Oscillator name |
Definition at line 120 of file cmu_common.c.
References AUXHFRCO, CMU_OSCENCMD, CMU_OSCENCMD_AUXHFRCODIS, CMU_OSCENCMD_HFRCODIS, CMU_OSCENCMD_HFXODIS, CMU_OSCENCMD_LFRCODIS, CMU_OSCENCMD_LFXODIS, HFRCO, HFXO, LFRCO, LFXO, and ULFRCO.
void cmu_osc_on | ( | enum cmu_osc | osc | ) |
Turn on Oscillator.
[in] | osc | enum cmu_osc Oscillator name |
Definition at line 92 of file cmu_common.c.
References AUXHFRCO, CMU_OSCENCMD, CMU_OSCENCMD_AUXHFRCOEN, CMU_OSCENCMD_HFRCOEN, CMU_OSCENCMD_HFXOEN, CMU_OSCENCMD_LFRCOEN, CMU_OSCENCMD_LFXOEN, HFRCO, HFXO, LFRCO, LFXO, and ULFRCO.
Referenced by cmu_clock_setup_in_hfxo_out_48mhz().
bool cmu_osc_ready_flag | ( | enum cmu_osc | osc | ) |
Get Oscillator read flag.
[in] | osc | enum cmu_osc Oscillator name |
true | if flag is set |
false | if flag is not set |
Definition at line 150 of file cmu_common.c.
References AUXHFRCO, CMU_STATUS, CMU_STATUS_AUXHFRCORDY, CMU_STATUS_HFRCORDY, CMU_STATUS_HFXORDY, CMU_STATUS_LFRCORDY, CMU_STATUS_LFXORDY, HFRCO, HFXO, LFRCO, LFXO, and ULFRCO.
void cmu_periph_clock_disable | ( | enum cmu_periph_clken | clken | ) |
Disable Peripheral Clock in running mode.
Disable the clock on particular peripheral.
[in] | clken | Peripheral Name |
For available constants, see enum::cmu_periph_clken (CMU_LEUART1 for example)
Definition at line 83 of file cmu_common.c.
References _CMU_REG.
void cmu_periph_clock_enable | ( | enum cmu_periph_clken | clken | ) |
Enable Peripheral Clock in running mode.
Enable the clock on particular peripheral.
[in] | clken | Peripheral Name |
For available constants, see enum::cmu_periph_clken (CMU_LEUART1 for example)
Definition at line 68 of file cmu_common.c.
void cmu_set_hfclk_source | ( | enum cmu_osc | osc | ) |
Set HFCLK clock source.
[in] | osc | enum cmu_osc Oscillator name |
Definition at line 211 of file cmu_common.c.
References CMU_CMD, CMU_CMD_HFCLKSEL_HFRCO, CMU_CMD_HFCLKSEL_HFXO, CMU_CMD_HFCLKSEL_LFRCO, CMU_CMD_HFCLKSEL_LFXO, HFRCO, HFXO, LFRCO, and LFXO.
Referenced by cmu_clock_setup_in_hfxo_out_48mhz().
void cmu_wait_for_osc_ready | ( | enum cmu_osc | osc | ) |
Wait till oscillator is not ready.
[in] | osc | enum cmu_osc Oscillator name |
Definition at line 180 of file cmu_common.c.
References AUXHFRCO, CMU_STATUS, CMU_STATUS_AUXHFRCORDY, CMU_STATUS_HFRCORDY, CMU_STATUS_HFXORDY, CMU_STATUS_LFRCORDY, CMU_STATUS_LFXORDY, HFRCO, HFXO, LFRCO, LFXO, and ULFRCO.
Referenced by cmu_clock_setup_in_hfxo_out_48mhz().