The Power Management Controller (PMC) optimizes power consumption by controlling all system and user peripheral clocks. The PMC enables/disables the clock inputs to many of the peripherals and the Cortex-M Processor.
Functions | |
void | pmc_clr_fast_startup_input (uint32_t ul_inputs) |
Clear the wake-up inputs for fast startup mode registers (remove event generation). More... | |
void | pmc_cp_clr_fast_startup_input (uint32_t ul_inputs) |
Clear the wake-up inputs of coprocessor for fast startup mode registers (remove event generation). More... | |
void | pmc_cp_set_fast_startup_input (uint32_t ul_inputs) |
Set the wake-up inputs of coprocessor for fast startup mode registers (event generation). More... | |
void | pmc_cpck_set_prescaler (uint32_t ul_pres) |
Set the prescaler for the Coprocessor Master Clock. More... | |
void | pmc_cpck_set_source (uint32_t ul_source) |
Set the source for the Coprocessor Master Clock. More... | |
void | pmc_disable_all_pck (void) |
Disable all programmable clocks. More... | |
void | pmc_disable_all_periph_clk (void) |
Disable all peripheral clocks. More... | |
void | pmc_disable_clock_failure_detector (void) |
Disable Clock Failure Detector. More... | |
void | pmc_disable_cpbmck (void) |
Disable Coprocessor Bus Master Clocks. More... | |
void | pmc_disable_cpck (void) |
Disable Coprocessor Clocks. More... | |
void | pmc_disable_interrupt (uint32_t ul_sources) |
Disable PMC interrupts. More... | |
void | pmc_disable_pck (uint32_t ul_id) |
Disable the specified programmable clock. More... | |
uint32_t | pmc_disable_periph_clk (uint32_t ul_id) |
Disable the specified peripheral clock. More... | |
void | pmc_disable_pllack (void) |
Disable PLLA clock. More... | |
void | pmc_disable_pllbck (void) |
Disable PLLB clock. More... | |
void | pmc_disable_sclk_osc_freq_monitor (void) |
Disable Slow Crystal Oscillator Frequency Monitoring. More... | |
uint32_t | pmc_disable_sleepwalking (uint32_t ul_id) |
Disable the sleepwalking of specified peripheral. More... | |
void | pmc_disable_udpck (void) |
Disable UDP (USB) clock. More... | |
void | pmc_disable_upll_clock (void) |
Disable UPLL clock. More... | |
void | pmc_enable_all_pck (void) |
Enable all programmable clocks. More... | |
void | pmc_enable_all_periph_clk (void) |
Enable all peripheral clocks. More... | |
void | pmc_enable_backupmode (void) |
Enable Backup Mode. More... | |
void | pmc_enable_clock_failure_detector (void) |
Enable Clock Failure Detector. More... | |
void | pmc_enable_cpbmck (void) |
Enable Coprocessor Bus Master Clocks. More... | |
void | pmc_enable_cpck (void) |
Enable Coprocessor Clocks. More... | |
void | pmc_enable_interrupt (uint32_t ul_sources) |
Enable PMC interrupts. More... | |
void | pmc_enable_pck (uint32_t ul_id) |
Enable the specified programmable clock. More... | |
uint32_t | pmc_enable_periph_clk (uint32_t ul_id) |
Enable the specified peripheral clock. More... | |
void | pmc_enable_pllack (uint32_t mula, uint32_t pllacount, uint32_t diva) |
Enable PLLA clock. More... | |
void | pmc_enable_pllbck (uint32_t mulb, uint32_t pllbcount, uint32_t divb) |
Enable PLLB clock. More... | |
void | pmc_enable_sclk_osc_freq_monitor (void) |
Enable Slow Crystal Oscillator Frequency Monitoring. More... | |
void | pmc_enable_sleepmode (uint8_t uc_type) |
Enable Sleep Mode. More... | |
uint32_t | pmc_enable_sleepwalking (uint32_t ul_id) |
Enable the specified peripheral clock. More... | |
void | pmc_enable_udpck (void) |
Enable UDP (USB) clock. More... | |
void | pmc_enable_uhpck (void) |
Enable UHP (USB) clock. More... | |
void | pmc_enable_upll_clock (void) |
Enable UPLL clock. More... | |
void | pmc_enable_waitmode (void) |
Enable Wait Mode. More... | |
uint32_t | pmc_get_active_status0 (void) |
Return peripheral active status. More... | |
uint32_t | pmc_get_active_status1 (void) |
Return peripheral active status. More... | |
uint32_t | pmc_get_interrupt_mask (void) |
Get PMC interrupt mask. More... | |
uint32_t | pmc_get_mainck_config (void) |
Get Main clock source configuration. More... | |
uint32_t | pmc_get_pllack_config (void) |
Get PLLA clock configuration. More... | |
uint32_t | pmc_get_slck_config (void) |
Get Slow clock source configuration. More... | |
uint32_t | pmc_get_sleepwalking_status0 (void) |
Return peripheral sleepwalking enable status. More... | |
uint32_t | pmc_get_sleepwalking_status1 (void) |
Return peripheral sleepwalking enable status. More... | |
uint32_t | pmc_get_status (void) |
Get current status. More... | |
uint32_t | pmc_get_upllckdiv_config (void) |
Get UPLLCKDIV configuration. More... | |
uint32_t | pmc_get_writeprotect_status (void) |
Return write protect status. More... | |
bool | pmc_is_cpbmck_enabled (void) |
Check if the Coprocessor Bus Master Clocks is enabled. More... | |
bool | pmc_is_cpck_enabled (void) |
Check if the Coprocessor Clocks is enabled. More... | |
uint32_t | pmc_is_locked_pllack (void) |
Is PLLA locked? More... | |
uint32_t | pmc_is_locked_pllbck (void) |
Is PLLB locked? More... | |
uint32_t | pmc_is_locked_upll (void) |
Is UPLL locked? More... | |
uint32_t | pmc_is_pck_enabled (uint32_t ul_id) |
Check if the specified programmable clock is enabled. More... | |
uint32_t | pmc_is_periph_clk_enabled (uint32_t ul_id) |
Check if the specified peripheral clock is enabled. More... | |
void | pmc_mainck_osc_select (uint32_t ul_xtal_rc) |
Select Main Crystal or internal RC as main clock source. More... | |
void | pmc_mck_set_division (uint32_t ul_div) |
Set the division of the MCK. More... | |
void | pmc_mck_set_prescaler (uint32_t ul_pres) |
Set the prescaler of the MCK. More... | |
void | pmc_mck_set_source (uint32_t ul_source) |
Set the source of the MCK. More... | |
void | pmc_osc_bypass_main_xtal (void) |
Bypass main XTAL. More... | |
void | pmc_osc_disable_fastrc (void) |
Disable the internal fast RC. More... | |
void | pmc_osc_disable_main_xtal (void) |
Disable the main Xtal. More... | |
void | pmc_osc_disable_xtal (uint32_t ul_bypass) |
Disable the external Xtal. More... | |
void | pmc_osc_enable_fastrc (uint32_t ul_rc) |
Enable fast RC oscillator. More... | |
void | pmc_osc_enable_main_xtal (uint32_t ul_xtal_startup_time) |
Enable main XTAL oscillator. More... | |
uint32_t | pmc_osc_is_bypassed_main_xtal (void) |
Check if the main crystal is bypassed. More... | |
uint32_t | pmc_osc_is_ready_32kxtal (void) |
Check if the external 32k Xtal is ready. More... | |
uint32_t | pmc_osc_is_ready_fastrc (void) |
Check if the main fastrc is ready. More... | |
uint32_t | pmc_osc_is_ready_main_xtal (void) |
Check if the main crystal is ready. More... | |
uint32_t | pmc_osc_is_ready_mainck (void) |
Check if the MAINCK is ready. More... | |
void | pmc_pck_set_prescaler (uint32_t ul_id, uint32_t ul_pres) |
Set the prescaler for the specified programmable clock. More... | |
void | pmc_pck_set_source (uint32_t ul_id, uint32_t ul_source) |
Set the source oscillator for the specified programmable clock. More... | |
void | pmc_set_fast_startup_input (uint32_t ul_inputs) |
Set the wake-up inputs for fast startup mode registers (event generation). More... | |
void | pmc_set_flash_in_wait_mode (uint32_t ul_flash_state) |
Set the embedded flash state in wait mode. More... | |
void | pmc_set_writeprotect (uint32_t ul_enable) |
Enable or disable write protect of PMC registers. More... | |
void | pmc_switch_mainck_to_fastrc (uint32_t ul_moscrcf) |
Switch main clock source selection to internal fast RC. More... | |
void | pmc_switch_mainck_to_xtal (uint32_t ul_bypass, uint32_t ul_xtal_startup_time) |
Switch main clock source selection to external Xtal/Bypass. More... | |
uint32_t | pmc_switch_mck_to_mainck (uint32_t ul_pres) |
Switch master clock source selection to main clock. More... | |
uint32_t | pmc_switch_mck_to_pllack (uint32_t ul_pres) |
Switch master clock source selection to PLLA clock. More... | |
uint32_t | pmc_switch_mck_to_pllbck (uint32_t ul_pres) |
Switch master clock source selection to PLLB clock. More... | |
uint32_t | pmc_switch_mck_to_sclk (uint32_t ul_pres) |
Switch master clock source selection to slow clock. More... | |
uint32_t | pmc_switch_mck_to_upllck (uint32_t ul_pres) |
Switch master clock source selection to UPLL clock. More... | |
uint32_t | pmc_switch_pck_to_mainck (uint32_t ul_id, uint32_t ul_pres) |
Switch programmable clock source selection to main clock. More... | |
uint32_t | pmc_switch_pck_to_mck (uint32_t ul_id, uint32_t ul_pres) |
Switch programmable clock source selection to mck. More... | |
uint32_t | pmc_switch_pck_to_pllack (uint32_t ul_id, uint32_t ul_pres) |
Switch programmable clock source selection to PLLA clock. More... | |
uint32_t | pmc_switch_pck_to_pllbck (uint32_t ul_id, uint32_t ul_pres) |
Switch programmable clock source selection to PLLB clock. More... | |
uint32_t | pmc_switch_pck_to_sclk (uint32_t ul_id, uint32_t ul_pres) |
Switch programmable clock source selection to slow clock. More... | |
uint32_t | pmc_switch_pck_to_upllck (uint32_t ul_id, uint32_t ul_pres) |
Switch programmable clock source selection to UPLL clock. More... | |
void | pmc_switch_sclk_to_32kxtal (uint32_t ul_bypass) |
Switch slow clock source selection to external 32k (Xtal or Bypass). More... | |
void | pmc_switch_udpck_to_pllack (uint32_t ul_usbdiv) |
Switch UDP (USB) clock source selection to PLLA clock. More... | |
void | pmc_switch_udpck_to_pllbck (uint32_t ul_usbdiv) |
Switch UDP (USB) clock source selection to PLLB clock. More... | |
void | pmc_switch_udpck_to_upllck (uint32_t ul_usbdiv) |
Switch UDP (USB) clock source selection to UPLL clock. More... | |
void | pmc_switch_uhpck_to_pllack (uint32_t ul_usbdiv) |
Switch UHP (USB) clock source selection to PLLA clock. More... | |
void | pmc_switch_uhpck_to_pllbck (uint32_t ul_usbdiv) |
Switch UHP (USB) clock source selection to PLLB clock. More... | |
Variables | |
static uint32_t | ul_flash_in_wait_mode = PMC_WAIT_MODE_FLASH_DEEP_POWERDOWN |
void pmc_clr_fast_startup_input | ( | uint32_t | ul_inputs | ) |
Clear the wake-up inputs for fast startup mode registers (remove event generation).
ul_inputs | Wake up inputs to disable. |
References PMC_FAST_STARTUP_Msk.
void pmc_cp_clr_fast_startup_input | ( | uint32_t | ul_inputs | ) |
Clear the wake-up inputs of coprocessor for fast startup mode registers (remove event generation).
ul_inputs | Wake up inputs to disable. |
References PMC_FAST_STARTUP_Msk.
void pmc_cp_set_fast_startup_input | ( | uint32_t | ul_inputs | ) |
Set the wake-up inputs of coprocessor for fast startup mode registers (event generation).
ul_inputs | Wake up inputs to enable. |
References PMC_FAST_STARTUP_Msk.
void pmc_cpck_set_prescaler | ( | uint32_t | ul_pres | ) |
Set the prescaler for the Coprocessor Master Clock.
ul_pres | Prescaler value. |
void pmc_cpck_set_source | ( | uint32_t | ul_source | ) |
Set the source for the Coprocessor Master Clock.
ul_source | Source selection value. |
void pmc_disable_all_pck | ( | void | ) |
Disable all programmable clocks.
void pmc_disable_all_periph_clk | ( | void | ) |
Disable all peripheral clocks.
References pmc_disable_periph_clk(), PMC_MASK_STATUS0, and PMC_MASK_STATUS1.
void pmc_disable_clock_failure_detector | ( | void | ) |
Disable Clock Failure Detector.
References CKGR_MOR_KEY_PASSWD.
void pmc_disable_cpbmck | ( | void | ) |
Disable Coprocessor Bus Master Clocks.
void pmc_disable_cpck | ( | void | ) |
Disable Coprocessor Clocks.
void pmc_disable_interrupt | ( | uint32_t | ul_sources | ) |
Disable PMC interrupts.
ul_sources | Interrupt sources bit map. |
void pmc_disable_pck | ( | uint32_t | ul_id | ) |
Disable the specified programmable clock.
ul_id | Id of the programmable clock. |
Referenced by genclk_disable().
uint32_t pmc_disable_periph_clk | ( | uint32_t | ul_id | ) |
Disable the specified peripheral clock.
ul_id | Peripheral ID (ID_xxx). |
0 | Success. |
1 | Invalid parameter. |
References MAX_PERIPH_ID.
Referenced by pmc_disable_all_periph_clk(), and sysclk_disable_peripheral_clock().
void pmc_disable_pllack | ( | void | ) |
Disable PLLA clock.
Referenced by pll_config_write(), pll_disable(), pll_enable(), and pmc_enable_pllack().
void pmc_disable_pllbck | ( | void | ) |
Disable PLLB clock.
Referenced by pmc_enable_pllbck().
void pmc_disable_sclk_osc_freq_monitor | ( | void | ) |
Disable Slow Crystal Oscillator Frequency Monitoring.
References CKGR_MOR_KEY_PASSWD.
uint32_t pmc_disable_sleepwalking | ( | uint32_t | ul_id | ) |
Disable the sleepwalking of specified peripheral.
ul_id | Peripheral ID (ID_xxx). |
0 | Success. |
1 | Invalid parameter. |
Referenced by pmc_enable_sleepwalking().
void pmc_disable_udpck | ( | void | ) |
Disable UDP (USB) clock.
Referenced by sysclk_disable_usb().
void pmc_disable_upll_clock | ( | void | ) |
Disable UPLL clock.
void pmc_enable_all_pck | ( | void | ) |
Enable all programmable clocks.
void pmc_enable_all_periph_clk | ( | void | ) |
Enable all peripheral clocks.
References pmc_enable_periph_clk(), PMC_MASK_STATUS0, and PMC_MASK_STATUS1.
void pmc_enable_backupmode | ( | void | ) |
Enable Backup Mode.
Enter condition: WFE/(VROFF bit = 1) + (SLEEPDEEP bit = 1)
References SUPC_CR_KEY_PASSWD, SUPC_MR_KEY_PASSWD, and UNUSED.
void pmc_enable_clock_failure_detector | ( | void | ) |
Enable Clock Failure Detector.
References CKGR_MOR_KEY_PASSWD.
void pmc_enable_cpbmck | ( | void | ) |
Enable Coprocessor Bus Master Clocks.
void pmc_enable_cpck | ( | void | ) |
Enable Coprocessor Clocks.
void pmc_enable_interrupt | ( | uint32_t | ul_sources | ) |
Enable PMC interrupts.
ul_sources | Interrupt sources bit map. |
void pmc_enable_pck | ( | uint32_t | ul_id | ) |
Enable the specified programmable clock.
ul_id | Id of the programmable clock. |
Referenced by genclk_enable().
uint32_t pmc_enable_periph_clk | ( | uint32_t | ul_id | ) |
Enable the specified peripheral clock.
ul_id | Peripheral ID (ID_xxx). |
0 | Success. |
1 | Invalid parameter. |
References MAX_PERIPH_ID.
Referenced by configure_buttons(), pmc_enable_all_periph_clk(), and sysclk_enable_peripheral_clock().
void pmc_enable_pllack | ( | uint32_t | mula, |
uint32_t | pllacount, | ||
uint32_t | diva | ||
) |
Enable PLLA clock.
mula | PLLA multiplier. |
pllacount | PLLA counter. |
diva | Divider. |
References pmc_disable_pllack().
void pmc_enable_pllbck | ( | uint32_t | mulb, |
uint32_t | pllbcount, | ||
uint32_t | divb | ||
) |
Enable PLLB clock.
mulb | PLLB multiplier. |
pllbcount | PLLB counter. |
divb | Divider. |
References pmc_disable_pllbck().
void pmc_enable_sclk_osc_freq_monitor | ( | void | ) |
Enable Slow Crystal Oscillator Frequency Monitoring.
References CKGR_MOR_KEY_PASSWD.
void pmc_enable_sleepmode | ( | uint8_t | uc_type | ) |
Enable Sleep Mode.
Enter condition: (WFE or WFI) + (SLEEPDEEP bit = 0) + (LPM bit = 0)
uc_type | 0 for wait for interrupt, 1 for wait for event. |
References UNUSED.
uint32_t pmc_enable_sleepwalking | ( | uint32_t | ul_id | ) |
Enable the specified peripheral clock.
ul_id | Peripheral ID (ID_xxx). |
0 | Success. |
1 | Fail. |
References pmc_disable_sleepwalking(), pmc_get_active_status0(), and pmc_get_active_status1().
void pmc_enable_udpck | ( | void | ) |
Enable UDP (USB) clock.
Referenced by sysclk_enable_usb().
void pmc_enable_uhpck | ( | void | ) |
Enable UHP (USB) clock.
void pmc_enable_upll_clock | ( | void | ) |
Enable UPLL clock.
Referenced by sysclk_enable_usb().
void pmc_enable_waitmode | ( | void | ) |
Enable Wait Mode.
Enter condition: (WAITMODE bit = 1) + FLPM
References CKGR_MOR_KEY_PASSWD, PMC_WAIT_MODE_FLASH_IDLE, and ul_flash_in_wait_mode.
uint32_t pmc_get_active_status0 | ( | void | ) |
Return peripheral active status.
Referenced by pmc_enable_sleepwalking().
uint32_t pmc_get_active_status1 | ( | void | ) |
Return peripheral active status.
Referenced by pmc_enable_sleepwalking().
uint32_t pmc_get_interrupt_mask | ( | void | ) |
Get PMC interrupt mask.
uint32_t pmc_get_mainck_config | ( | void | ) |
Get Main clock source configuration.
Main | Clock Source Oscillator Selection and Main RC Oscillator Frequency Selection values. |
Referenced by genclk_get_frequency_hz().
uint32_t pmc_get_pllack_config | ( | void | ) |
Get PLLA clock configuration.
PLLA | Multiplier and PLLA Front End Divider values. |
Referenced by genclk_get_frequency_hz().
uint32_t pmc_get_slck_config | ( | void | ) |
Get Slow clock source configuration.
Crystal | Oscillator Select value. |
Referenced by genclk_get_frequency_hz().
uint32_t pmc_get_sleepwalking_status0 | ( | void | ) |
Return peripheral sleepwalking enable status.
uint32_t pmc_get_sleepwalking_status1 | ( | void | ) |
Return peripheral sleepwalking enable status.
uint32_t pmc_get_status | ( | void | ) |
Get current status.
uint32_t pmc_get_upllckdiv_config | ( | void | ) |
Get UPLLCKDIV configuration.
UPLL | Divider by 2 value. |
Referenced by genclk_get_frequency_hz().
uint32_t pmc_get_writeprotect_status | ( | void | ) |
Return write protect status.
bool pmc_is_cpbmck_enabled | ( | void | ) |
Check if the Coprocessor Bus Master Clocks is enabled.
0 | Coprocessor Bus Master Clocks is disabled. |
1 | Coprocessor Bus Master Clocks is enabled. |
bool pmc_is_cpck_enabled | ( | void | ) |
Check if the Coprocessor Clocks is enabled.
0 | Coprocessor Clocks is disabled. |
1 | Coprocessor Clocks is enabled. |
uint32_t pmc_is_locked_pllack | ( | void | ) |
uint32_t pmc_is_locked_pllbck | ( | void | ) |
Is PLLB locked?
0 | Not locked. |
1 | Locked. |
uint32_t pmc_is_locked_upll | ( | void | ) |
uint32_t pmc_is_pck_enabled | ( | uint32_t | ul_id | ) |
Check if the specified programmable clock is enabled.
ul_id | Id of the programmable clock. |
0 | Programmable clock is disabled or unknown. |
1 | Programmable clock is enabled. |
uint32_t pmc_is_periph_clk_enabled | ( | uint32_t | ul_id | ) |
Check if the specified peripheral clock is enabled.
ul_id | Peripheral ID (ID_xxx). |
0 | Peripheral clock is disabled or unknown. |
1 | Peripheral clock is enabled. |
References MAX_PERIPH_ID.
void pmc_mainck_osc_select | ( | uint32_t | ul_xtal_rc | ) |
Select Main Crystal or internal RC as main clock source.
ul_xtal_rc | 0 internal RC is selected, otherwise Main Crystal. |
References CKGR_MOR_KEY_PASSWD.
void pmc_mck_set_division | ( | uint32_t | ul_div | ) |
void pmc_mck_set_prescaler | ( | uint32_t | ul_pres | ) |
Set the prescaler of the MCK.
ul_pres | Prescaler value. |
Referenced by sysclk_set_prescalers().
void pmc_mck_set_source | ( | uint32_t | ul_source | ) |
Set the source of the MCK.
ul_source | Source selection value. |
Referenced by sysclk_set_source().
void pmc_osc_bypass_main_xtal | ( | void | ) |
Bypass main XTAL.
References CKGR_MOR_KEY_PASSWD.
void pmc_osc_disable_fastrc | ( | void | ) |
void pmc_osc_disable_main_xtal | ( | void | ) |
Disable the main Xtal.
References CKGR_MOR_KEY_PASSWD.
void pmc_osc_disable_xtal | ( | uint32_t | ul_bypass | ) |
Disable the external Xtal.
ul_bypass | 0 for Xtal, 1 for bypass. |
References CKGR_MOR_KEY_PASSWD.
Referenced by osc_disable().
void pmc_osc_enable_fastrc | ( | uint32_t | ul_rc | ) |
Enable fast RC oscillator.
ul_rc | Fast RC oscillator(4/8/12Mhz). |
References CKGR_MOR_KEY_PASSWD.
void pmc_osc_enable_main_xtal | ( | uint32_t | ul_xtal_startup_time | ) |
Enable main XTAL oscillator.
ul_xtal_startup_time | Xtal start-up time, in number of slow clocks. |
References CKGR_MOR_KEY_PASSWD.
uint32_t pmc_osc_is_bypassed_main_xtal | ( | void | ) |
Check if the main crystal is bypassed.
0 | Xtal is bypassed, otherwise not. |
uint32_t pmc_osc_is_ready_32kxtal | ( | void | ) |
Check if the external 32k Xtal is ready.
1 | External 32k Xtal is ready. |
0 | External 32k Xtal is not ready. |
Referenced by osc_is_ready().
uint32_t pmc_osc_is_ready_fastrc | ( | void | ) |
Check if the main fastrc is ready.
0 | Xtal is not ready, otherwise ready. |
uint32_t pmc_osc_is_ready_main_xtal | ( | void | ) |
Check if the main crystal is ready.
0 | main crystal is not ready, otherwise ready. |
uint32_t pmc_osc_is_ready_mainck | ( | void | ) |
Check if the MAINCK is ready.
Depending on MOSCEL, MAINCK can be one of Xtal, bypass or internal RC.
1 | Xtal is ready. |
0 | Xtal is not ready. |
Referenced by osc_is_ready().
void pmc_pck_set_prescaler | ( | uint32_t | ul_id, |
uint32_t | ul_pres | ||
) |
Set the prescaler for the specified programmable clock.
ul_id | Peripheral ID. |
ul_pres | Prescaler value. |
void pmc_pck_set_source | ( | uint32_t | ul_id, |
uint32_t | ul_source | ||
) |
Set the source oscillator for the specified programmable clock.
ul_id | Peripheral ID. |
ul_source | Source selection value. |
void pmc_set_fast_startup_input | ( | uint32_t | ul_inputs | ) |
Set the wake-up inputs for fast startup mode registers (event generation).
ul_inputs | Wake up inputs to enable. |
References PMC_FAST_STARTUP_Msk.
void pmc_set_flash_in_wait_mode | ( | uint32_t | ul_flash_state | ) |
Set the embedded flash state in wait mode.
ul_flash_state | PMC_WAIT_MODE_FLASH_STANDBY flash in standby mode, PMC_WAIT_MODE_FLASH_DEEP_POWERDOWN flash in deep power down mode. |
void pmc_set_writeprotect | ( | uint32_t | ul_enable | ) |
Enable or disable write protect of PMC registers.
ul_enable | 1 to enable, 0 to disable. |
References PMC_WPMR_WPKEY_PASSWD.
void pmc_switch_mainck_to_fastrc | ( | uint32_t | ul_moscrcf | ) |
Switch main clock source selection to internal fast RC.
ul_moscrcf | Fast RC oscillator(4/8/12Mhz). |
0 | Success. |
1 | Timeout error. |
2 | Invalid frequency. |
References CKGR_MOR_KEY_PASSWD.
Referenced by osc_enable().
void pmc_switch_mainck_to_xtal | ( | uint32_t | ul_bypass, |
uint32_t | ul_xtal_startup_time | ||
) |
Switch main clock source selection to external Xtal/Bypass.
ul_bypass | 0 for Xtal, 1 for bypass. |
0 | Success. |
1 | Timeout error. |
References CKGR_MOR_KEY_PASSWD.
Referenced by osc_enable().
uint32_t pmc_switch_mck_to_mainck | ( | uint32_t | ul_pres | ) |
Switch master clock source selection to main clock.
ul_pres | Processor clock prescaler. |
0 | Success. |
1 | Timeout error. |
References PMC_TIMEOUT.
Referenced by sysclk_init().
uint32_t pmc_switch_mck_to_pllack | ( | uint32_t | ul_pres | ) |
Switch master clock source selection to PLLA clock.
ul_pres | Processor clock prescaler. |
0 | Success. |
1 | Timeout error. |
References PMC_TIMEOUT.
Referenced by sysclk_init().
uint32_t pmc_switch_mck_to_pllbck | ( | uint32_t | ul_pres | ) |
Switch master clock source selection to PLLB clock.
ul_pres | Processor clock prescaler. |
0 | Success. |
1 | Timeout error. |
References PMC_TIMEOUT.
uint32_t pmc_switch_mck_to_sclk | ( | uint32_t | ul_pres | ) |
Switch master clock source selection to slow clock.
ul_pres | Processor clock prescaler. |
0 | Success. |
1 | Timeout error. |
References PMC_TIMEOUT.
Referenced by sysclk_init().
uint32_t pmc_switch_mck_to_upllck | ( | uint32_t | ul_pres | ) |
Switch master clock source selection to UPLL clock.
ul_pres | Processor clock prescaler. |
0 | Success. |
1 | Timeout error. |
References PMC_TIMEOUT.
Referenced by sysclk_init().
uint32_t pmc_switch_pck_to_mainck | ( | uint32_t | ul_id, |
uint32_t | ul_pres | ||
) |
Switch programmable clock source selection to main clock.
ul_id | Id of the programmable clock. |
ul_pres | Programmable clock prescaler. |
0 | Success. |
1 | Timeout error. |
References PMC_TIMEOUT.
uint32_t pmc_switch_pck_to_mck | ( | uint32_t | ul_id, |
uint32_t | ul_pres | ||
) |
Switch programmable clock source selection to mck.
ul_id | Id of the programmable clock. |
ul_pres | Programmable clock prescaler. |
0 | Success. |
1 | Timeout error. |
References PMC_TIMEOUT.
uint32_t pmc_switch_pck_to_pllack | ( | uint32_t | ul_id, |
uint32_t | ul_pres | ||
) |
Switch programmable clock source selection to PLLA clock.
ul_id | Id of the programmable clock. |
ul_pres | Programmable clock prescaler. |
0 | Success. |
1 | Timeout error. |
References PMC_TIMEOUT.
uint32_t pmc_switch_pck_to_pllbck | ( | uint32_t | ul_id, |
uint32_t | ul_pres | ||
) |
Switch programmable clock source selection to PLLB clock.
ul_id | Id of the programmable clock. |
ul_pres | Programmable clock prescaler. |
0 | Success. |
1 | Timeout error. |
References PMC_TIMEOUT.
uint32_t pmc_switch_pck_to_sclk | ( | uint32_t | ul_id, |
uint32_t | ul_pres | ||
) |
Switch programmable clock source selection to slow clock.
ul_id | Id of the programmable clock. |
ul_pres | Programmable clock prescaler. |
0 | Success. |
1 | Timeout error. |
References PMC_TIMEOUT.
uint32_t pmc_switch_pck_to_upllck | ( | uint32_t | ul_id, |
uint32_t | ul_pres | ||
) |
Switch programmable clock source selection to UPLL clock.
ul_id | Id of the programmable clock. |
ul_pres | Programmable clock prescaler. |
0 | Success. |
1 | Timeout error. |
References PMC_TIMEOUT.
void pmc_switch_sclk_to_32kxtal | ( | uint32_t | ul_bypass | ) |
Switch slow clock source selection to external 32k (Xtal or Bypass).
ul_bypass | 0 for Xtal, 1 for bypass. |
References SUPC_CR_KEY_PASSWD, and SUPC_MR_KEY_PASSWD.
Referenced by osc_enable().
void pmc_switch_udpck_to_pllack | ( | uint32_t | ul_usbdiv | ) |
Switch UDP (USB) clock source selection to PLLA clock.
ul_usbdiv | Clock divisor. |
Referenced by sysclk_enable_usb().
void pmc_switch_udpck_to_pllbck | ( | uint32_t | ul_usbdiv | ) |
Switch UDP (USB) clock source selection to PLLB clock.
ul_usbdiv | Clock divisor. |
void pmc_switch_udpck_to_upllck | ( | uint32_t | ul_usbdiv | ) |
Switch UDP (USB) clock source selection to UPLL clock.
ul_usbdiv | Clock divisor. |
Referenced by sysclk_enable_usb().
void pmc_switch_uhpck_to_pllack | ( | uint32_t | ul_usbdiv | ) |
Switch UHP (USB) clock source selection to PLLA clock.
ul_usbdiv | Clock divisor. |
void pmc_switch_uhpck_to_pllbck | ( | uint32_t | ul_usbdiv | ) |
Switch UHP (USB) clock source selection to PLLB clock.
ul_usbdiv | Clock divisor. |
|
static |
Referenced by pmc_enable_waitmode().