29 #ifndef PMC_H_INCLUDED 30 #define PMC_H_INCLUDED 43 #define PMC_MASK_STATUS0 (0xFFFFFFFC) 46 #define PMC_MASK_STATUS1 (0xFFFFFFFF) 49 #define PMC_TIMEOUT (2048) 52 #define PMC_CKGR_MOR_KEY_VALUE CKGR_MOR_KEY(0x37) 55 #define SUPC_KEY_VALUE ((uint32_t) 0xA5) 58 #define PMC_XTAL_STARTUP_TIME (0x3F) 61 #define PMC_FAST_STARTUP_Msk (0xFFFFu) 64 #define PMC_WPMR_WPKEY_VALUE PMC_WPMR_WPKEY((uint32_t) 0x504D43) 67 #define PMC_OSC_XTAL 0 70 #define PMC_OSC_BYPASS 1 89 #if (SAM3S_SERIES || SAM4S_SERIES) 90 uint32_t pmc_switch_mck_to_pllbck(uint32_t ul_pres);
92 #if (SAM3XA_SERIES || SAM3U_SERIES) 93 uint32_t pmc_switch_mck_to_upllck(uint32_t ul_pres);
134 #if (SAM3S_SERIES || SAM4S_SERIES) 135 void pmc_enable_pllbck(uint32_t mulb, uint32_t pllbcount, uint32_t divb);
136 void pmc_disable_pllbck(
void);
137 uint32_t pmc_is_locked_pllbck(
void);
140 #if (SAM3XA_SERIES || SAM3U_SERIES) 141 void pmc_enable_upll_clock(
void);
142 void pmc_disable_upll_clock(
void);
143 uint32_t pmc_is_locked_upll(
void);
175 #if (SAM3S_SERIES || SAM4S_SERIES) 176 uint32_t pmc_switch_pck_to_pllbck(uint32_t ul_id, uint32_t ul_pres);
178 #if (SAM3XA_SERIES || SAM3U_SERIES) 179 uint32_t pmc_switch_pck_to_upllck(uint32_t ul_id, uint32_t ul_pres);
195 #if (SAM3S_SERIES || SAM3XA_SERIES || SAM4S_SERIES) 196 void pmc_switch_udpck_to_pllack(uint32_t ul_usbdiv);
198 #if (SAM3S_SERIES || SAM4S_SERIES) 199 void pmc_switch_udpck_to_pllbck(uint32_t ul_usbdiv);
202 void pmc_switch_udpck_to_upllck(uint32_t ul_usbdiv);
204 #if (SAM3S_SERIES || SAM3XA_SERIES || SAM4S_SERIES) 205 void pmc_enable_udpck(
void);
206 void pmc_disable_udpck(
void);
void pmc_switch_mainck_to_xtal(uint32_t ul_bypass)
Switch main clock source selection to external Xtal/Bypass. The function may switch MCK to SCLK if MC...
Definition: pmc.c:355
void pmc_enable_all_pck(void)
Enable all programmable clocks.
Definition: pmc.c:812
void pmc_disable_all_pck(void)
Disable all programmable clocks.
Definition: pmc.c:820
uint32_t pmc_get_interrupt_mask(void)
Get PMC interrupt mask.
Definition: pmc.c:929
void pmc_enable_interrupt(uint32_t ul_sources)
Enable PMC interrupts.
Definition: pmc.c:909
uint32_t pmc_is_periph_clk_enabled(uint32_t ul_id)
Check if the specified peripheral clock is enabled.
Definition: pmc.c:609
void pmc_switch_sclk_to_32kxtal(uint32_t ul_bypass)
Switch slow clock source selection to external 32k (Xtal or Bypass).
Definition: pmc.c:258
uint32_t pmc_switch_mck_to_pllack(uint32_t ul_pres)
Switch master clock source selection to PLLA clock.
Definition: pmc.c:155
void pmc_clr_fast_startup_input(uint32_t ul_inputs)
Clear the wake-up inputs for fast startup mode registers (remove event generation).
Definition: pmc.c:960
void pmc_mck_set_prescaler(uint32_t ul_pres)
Set the prescaler of the MCK.
Definition: pmc.c:67
void pmc_osc_disable_xtal(uint32_t ul_bypass)
Disable the external Xtal.
Definition: pmc.c:378
void pmc_osc_enable_fastrc(uint32_t ul_rc)
Enable fast RC oscillator.
Definition: pmc.c:325
uint32_t pmc_get_writeprotect_status(void)
Return write protect status.
Definition: pmc.c:1035
uint32_t pmc_enable_periph_clk(uint32_t ul_id)
Enable the specified peripheral clock.
Definition: pmc.c:518
void pmc_enable_all_periph_clk(void)
Enable all peripheral clocks.
Definition: pmc.c:574
void pmc_disable_interrupt(uint32_t ul_sources)
Disable PMC interrupts.
Definition: pmc.c:919
void pmc_enable_waitmode(void)
Enable Wait Mode. Enter condition: WFE + (SLEEPDEEP bit = 0) + (LPM bit = 1)
Definition: pmc.c:988
void pmc_set_fast_startup_input(uint32_t ul_inputs)
Set the wake-up inputs for fast startup mode registers (event generation).
Definition: pmc.c:949
void pmc_enable_pllack(uint32_t mula, uint32_t pllacount, uint32_t diva)
Enable PLLA clock.
Definition: pmc.c:409
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...
Definition: pmc.c:397
uint32_t pmc_switch_pck_to_mainck(uint32_t ul_id, uint32_t ul_pres)
Switch programmable clock source selection to main clock.
Definition: pmc.c:696
void pmc_enable_sleepmode(uint8_t uc_type)
Enable Sleep Mode. Enter condition: (WFE or WFI) + (SLEEPDEEP bit = 0) + (LPM bit = 0) ...
Definition: pmc.c:972
void pmc_osc_disable_fastrc(void)
Disable the internal fast RC.
Definition: pmc.c:337
uint32_t pmc_switch_pck_to_pllack(uint32_t ul_id, uint32_t ul_pres)
Switch programmable clock source selection to PLLA clock.
Definition: pmc.c:720
void pmc_disable_pllack(void)
Disable PLLA clock.
Definition: pmc.c:422
void pmc_switch_mainck_to_fastrc(uint32_t ul_moscrcf)
Switch main clock source selection to internal fast RC.
Definition: pmc.c:290
uint32_t pmc_is_pck_enabled(uint32_t ul_id)
Check if the specified programmable clock is enabled.
Definition: pmc.c:833
void pmc_pck_set_prescaler(uint32_t ul_id, uint32_t ul_pres)
Set the prescaler for the specified programmable clock.
Definition: pmc.c:641
uint32_t pmc_switch_mck_to_mainck(uint32_t ul_pres)
Switch master clock source selection to main clock.
Definition: pmc.c:123
void pmc_mck_set_source(uint32_t ul_source)
Set the source of the MCK.
Definition: pmc.c:79
uint32_t pmc_get_status(void)
Get current status.
Definition: pmc.c:939
void pmc_pck_set_source(uint32_t ul_id, uint32_t ul_source)
Set the source oscillator for the specified programmable clock.
Definition: pmc.c:655
void pmc_set_writeprotect(uint32_t ul_enable)
Enable or disable write protect of PMC registers.
Definition: pmc.c:1020
void pmc_disable_pck(uint32_t ul_id)
Disable the specified programmable clock.
Definition: pmc.c:804
uint32_t pmc_disable_periph_clk(uint32_t ul_id)
Disable the specified peripheral clock.
Definition: pmc.c:550
void pmc_enable_backupmode(void)
Enable Backup Mode. Enter condition: WFE + (SLEEPDEEP bit = 1)
Definition: pmc.c:1009
uint32_t pmc_switch_mck_to_sclk(uint32_t ul_pres)
Switch master clock source selection to slow clock.
Definition: pmc.c:94
void pmc_disable_all_periph_clk(void)
Disable all peripheral clocks.
Definition: pmc.c:588
uint32_t pmc_switch_pck_to_sclk(uint32_t ul_id, uint32_t ul_pres)
Switch programmable clock source selection to slow clock.
Definition: pmc.c:672
void pmc_enable_pck(uint32_t ul_id)
Enable the specified programmable clock.
Definition: pmc.c:794
uint32_t pmc_is_locked_pllack(void)
Is PLLA locked?
Definition: pmc.c:433
uint32_t pmc_osc_is_ready_32kxtal(void)
Check if the external 32k Xtal is ready.
Definition: pmc.c:275