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 while 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) |
Get HFCLK clock source. More... | |
void | cmu_set_usbclk_source (enum cmu_osc osc) |
Set USBCLK clock source. More... | |
void | cmu_wait_for_usbclk_selected (enum cmu_osc osc) |
Wait while USBCLK is not selected. More... | |
void cmu_disable_lock | ( | void | ) |
Disable CMU registers lock.
Definition at line 39 of file cmu.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.c.
References CMU_LOCK, and CMU_LOCK_LOCKKEY_LOCK.
enum cmu_osc cmu_get_hfclk_source | ( | void | ) |
Get HFCLK clock source.
enum | cmu_osc Oscillator name |
Definition at line 251 of file cmu.c.
References CMU_STATUS, CMU_STATUS_HFRCOSEL, CMU_STATUS_HFXOSEL, CMU_STATUS_LFRCOSEL, CMU_STATUS_LFXOSEL, CMU_STATUS_USHFRCODIV2SEL, HFRCO, HFXO, LFRCO, LFXO, and USHFRCODIV2.
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.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 123 of file cmu.c.
References AUXHFRCO, CMU_OSCENCMD, CMU_OSCENCMD_AUXHFRCODIS, CMU_OSCENCMD_HFRCODIS, CMU_OSCENCMD_HFXODIS, CMU_OSCENCMD_LFRCODIS, CMU_OSCENCMD_LFXODIS, CMU_OSCENCMD_USHFRCODIS, HFRCO, HFXO, LFRCO, LFXO, and USHFRCO.
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.c.
References AUXHFRCO, CMU_OSCENCMD, CMU_OSCENCMD_AUXHFRCOEN, CMU_OSCENCMD_HFRCOEN, CMU_OSCENCMD_HFXOEN, CMU_OSCENCMD_LFRCOEN, CMU_OSCENCMD_LFXOEN, CMU_OSCENCMD_USHFRCOEN, HFRCO, HFXO, LFRCO, LFXO, and USHFRCO.
Referenced by efm32hg_usbd_init().
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 156 of file cmu.c.
References AUXHFRCO, CMU_STATUS, CMU_STATUS_AUXHFRCORDY, CMU_STATUS_HFRCORDY, CMU_STATUS_HFXORDY, CMU_STATUS_LFRCORDY, CMU_STATUS_LFXORDY, CMU_STATUS_USHFRCORDY, HFRCO, HFXO, LFRCO, LFXO, and USHFRCO.
void cmu_periph_clock_disable | ( | enum cmu_periph_clken | clken | ) |
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.c.
References _CMU_BIT, and _CMU_REG.
Referenced by efm32hg_usbd_init().
void cmu_set_hfclk_source | ( | enum cmu_osc | osc | ) |
Set HFCLK clock source.
[in] | osc | enum cmu_osc Oscillator name |
Definition at line 223 of file cmu.c.
References CMU_CMD, CMU_CMD_HFCLKSEL_HFRCO, CMU_CMD_HFCLKSEL_HFXO, CMU_CMD_HFCLKSEL_LFRCO, CMU_CMD_HFCLKSEL_LFXO, CMU_CMD_HFCLKSEL_USHFRCODIV2, HFRCO, HFXO, LFRCO, LFXO, and USHFRCODIV2.
void cmu_set_usbclk_source | ( | enum cmu_osc | osc | ) |
Set USBCLK clock source.
osc | Oscillator name |
Definition at line 274 of file cmu.c.
References CMU_CMD, CMU_CMD_USBCCLKSEL_LFRCO, CMU_CMD_USBCCLKSEL_LFXO, CMU_CMD_USBCCLKSEL_USHFRCO, LFRCO, LFXO, and USHFRCO.
Referenced by efm32hg_usbd_init().
void cmu_wait_for_osc_ready | ( | enum cmu_osc | osc | ) |
Wait while oscillator is not ready.
[in] | osc | enum cmu_osc Oscillator name |
Definition at line 189 of file cmu.c.
References AUXHFRCO, CMU_STATUS, CMU_STATUS_AUXHFRCORDY, CMU_STATUS_HFRCORDY, CMU_STATUS_HFXORDY, CMU_STATUS_LFRCORDY, CMU_STATUS_LFXORDY, CMU_STATUS_USHFRCORDY, HFRCO, HFXO, LFRCO, LFXO, and USHFRCO.
Referenced by efm32hg_usbd_init().
void cmu_wait_for_usbclk_selected | ( | enum cmu_osc | osc | ) |
Wait while USBCLK is not selected.
[in] | osc | enum cmu_osc Oscillator name |
Definition at line 296 of file cmu.c.
References CMU_STATUS, CMU_STATUS_USBCLFRCOSEL, CMU_STATUS_USBCLFXOSEL, CMU_STATUS_USBCUSHFRCOSEL, LFRCO, LFXO, and USHFRCO.
Referenced by efm32hg_usbd_init().