Functions
Power Management Controller (PMC)

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_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_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_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. Enter condition: WFE/(VROFF bit = 1) + (SLEEPDEEP bit = 1) More...
 
void pmc_enable_clock_failure_detector (void)
 Enable Clock Failure Detector. 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_sleepmode (uint8_t uc_type)
 Enable Sleep Mode. Enter condition: (WFE or WFI) + (SLEEPDEEP bit = 0) + (LPM bit = 0) More...
 
void pmc_enable_waitmode (void)
 Enable Wait Mode. Enter condition: WFE + (SLEEPDEEP bit = 0) + (LPM bit = 1) More...
 
uint32_t pmc_get_interrupt_mask (void)
 Get PMC interrupt mask. More...
 
uint32_t pmc_get_status (void)
 Get current status. More...
 
uint32_t pmc_get_writeprotect_status (void)
 Return write protect status. More...
 
uint32_t pmc_is_locked_pllack (void)
 Is PLLA 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_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. Depending on MOSCEL, MAINCK can be one of Xtal, bypass or internal RC. 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_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_sclk (uint32_t ul_pres)
 Switch master clock source selection to slow 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_sclk (uint32_t ul_id, uint32_t ul_pres)
 Switch programmable clock source selection to slow clock. More...
 
void pmc_switch_sclk_to_32kxtal (uint32_t ul_bypass)
 Switch slow clock source selection to external 32k (Xtal or Bypass). More...
 

Detailed Description

Purpose

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.

Function Documentation

◆ pmc_clr_fast_startup_input()

void pmc_clr_fast_startup_input ( uint32_t  ul_inputs)

Clear the wake-up inputs for fast startup mode registers (remove event generation).

Parameters
ul_inputsWake up inputs to disable.

Definition at line 1308 of file pmc.c.

◆ pmc_disable_all_pck()

void pmc_disable_all_pck ( void  )

Disable all programmable clocks.

Definition at line 1046 of file pmc.c.

◆ pmc_disable_all_periph_clk()

void pmc_disable_all_periph_clk ( void  )

Disable all peripheral clocks.

Definition at line 776 of file pmc.c.

◆ pmc_disable_clock_failure_detector()

void pmc_disable_clock_failure_detector ( void  )

Disable Clock Failure Detector.

Definition at line 1494 of file pmc.c.

◆ pmc_disable_interrupt()

void pmc_disable_interrupt ( uint32_t  ul_sources)

Disable PMC interrupts.

Parameters
ul_sourcesInterrupt sources bit map.

Definition at line 1265 of file pmc.c.

◆ pmc_disable_pck()

void pmc_disable_pck ( uint32_t  ul_id)

Disable the specified programmable clock.

Parameters
ul_idId of the programmable clock.

Definition at line 1030 of file pmc.c.

◆ pmc_disable_periph_clk()

uint32_t pmc_disable_periph_clk ( uint32_t  ul_id)

Disable the specified peripheral clock.

Note
The ID must NOT be shifted (i.e., 1 << ID_xxx).
Parameters
ul_idPeripheral ID (ID_xxx).
Return values
0Success.
1Invalid parameter.

Definition at line 722 of file pmc.c.

◆ pmc_disable_pllack()

void pmc_disable_pllack ( void  )

Disable PLLA clock.

Definition at line 576 of file pmc.c.

◆ pmc_enable_all_pck()

void pmc_enable_all_pck ( void  )

Enable all programmable clocks.

Definition at line 1038 of file pmc.c.

◆ pmc_enable_all_periph_clk()

void pmc_enable_all_periph_clk ( void  )

Enable all peripheral clocks.

Definition at line 755 of file pmc.c.

◆ pmc_enable_backupmode()

void pmc_enable_backupmode ( void  )

Enable Backup Mode. Enter condition: WFE/(VROFF bit = 1) + (SLEEPDEEP bit = 1)

Definition at line 1459 of file pmc.c.

◆ pmc_enable_clock_failure_detector()

void pmc_enable_clock_failure_detector ( void  )

Enable Clock Failure Detector.

Definition at line 1484 of file pmc.c.

◆ pmc_enable_interrupt()

void pmc_enable_interrupt ( uint32_t  ul_sources)

Enable PMC interrupts.

Parameters
ul_sourcesInterrupt sources bit map.

Definition at line 1255 of file pmc.c.

◆ pmc_enable_pck()

void pmc_enable_pck ( uint32_t  ul_id)

Enable the specified programmable clock.

Parameters
ul_idId of the programmable clock.

Definition at line 1020 of file pmc.c.

◆ pmc_enable_periph_clk()

uint32_t pmc_enable_periph_clk ( uint32_t  ul_id)

Enable the specified peripheral clock.

Note
The ID must NOT be shifted (i.e., 1 << ID_xxx).
Parameters
ul_idPeripheral ID (ID_xxx).
Return values
0Success.
1Invalid parameter.

Definition at line 682 of file pmc.c.

◆ pmc_enable_pllack()

void pmc_enable_pllack ( uint32_t  mula,
uint32_t  pllacount,
uint32_t  diva 
)

Enable PLLA clock.

Parameters
mulaPLLA multiplier.
pllacountPLLA counter.
divaDivider.

Definition at line 558 of file pmc.c.

◆ pmc_enable_sleepmode()

void pmc_enable_sleepmode ( uint8_t  uc_type)

Enable Sleep Mode. Enter condition: (WFE or WFI) + (SLEEPDEEP bit = 0) + (LPM bit = 0)

Parameters
uc_type0 for wait for interrupt, 1 for wait for event.
Note
For SAM4S, SAM4C, SAM4CM, SAM4CP, SAMV71 and SAM4E series, since only WFI is effective, uc_type = 1 will be treated as uc_type = 0.

Definition at line 1348 of file pmc.c.

◆ pmc_enable_waitmode()

void pmc_enable_waitmode ( void  )

Enable Wait Mode. Enter condition: WFE + (SLEEPDEEP bit = 0) + (LPM bit = 1)

Definition at line 1433 of file pmc.c.

◆ pmc_get_interrupt_mask()

uint32_t pmc_get_interrupt_mask ( void  )

Get PMC interrupt mask.

Returns
The interrupt mask value.

Definition at line 1275 of file pmc.c.

◆ pmc_get_status()

uint32_t pmc_get_status ( void  )

Get current status.

Returns
The current PMC status.

Definition at line 1285 of file pmc.c.

◆ pmc_get_writeprotect_status()

uint32_t pmc_get_writeprotect_status ( void  )

Return write protect status.

Returns
Return write protect status.

Definition at line 1542 of file pmc.c.

◆ pmc_is_locked_pllack()

uint32_t pmc_is_locked_pllack ( void  )

Is PLLA locked?

Return values
0Not locked.
1Locked.

Definition at line 591 of file pmc.c.

◆ pmc_is_pck_enabled()

uint32_t pmc_is_pck_enabled ( uint32_t  ul_id)

Check if the specified programmable clock is enabled.

Parameters
ul_idId of the programmable clock.
Return values
0Programmable clock is disabled or unknown.
1Programmable clock is enabled.

Definition at line 1059 of file pmc.c.

◆ pmc_is_periph_clk_enabled()

uint32_t pmc_is_periph_clk_enabled ( uint32_t  ul_id)

Check if the specified peripheral clock is enabled.

Note
The ID must NOT be shifted (i.e., 1 << ID_xxx).
Parameters
ul_idPeripheral ID (ID_xxx).
Return values
0Peripheral clock is disabled or unknown.
1Peripheral clock is enabled.

Definition at line 804 of file pmc.c.

◆ pmc_mainck_osc_select()

void pmc_mainck_osc_select ( uint32_t  ul_xtal_rc)

Select Main Crystal or internal RC as main clock source.

Note
This function will not enable/disable RC or Main Crystal.
Parameters
ul_xtal_rc0 internal RC is selected, otherwise Main Crystal.

Definition at line 540 of file pmc.c.

◆ pmc_mck_set_prescaler()

void pmc_mck_set_prescaler ( uint32_t  ul_pres)

Set the prescaler of the MCK.

Parameters
ul_presPrescaler value.

Definition at line 96 of file pmc.c.

◆ pmc_mck_set_source()

void pmc_mck_set_source ( uint32_t  ul_source)

Set the source of the MCK.

Parameters
ul_sourceSource selection value.

Definition at line 139 of file pmc.c.

◆ pmc_osc_bypass_main_xtal()

void pmc_osc_bypass_main_xtal ( void  )

Bypass main XTAL.

Definition at line 430 of file pmc.c.

◆ pmc_osc_disable_fastrc()

void pmc_osc_disable_fastrc ( void  )

Disable the internal fast RC.

Definition at line 393 of file pmc.c.

◆ pmc_osc_disable_main_xtal()

void pmc_osc_disable_main_xtal ( void  )

Disable the main Xtal.

Definition at line 443 of file pmc.c.

◆ pmc_osc_disable_xtal()

void pmc_osc_disable_xtal ( uint32_t  ul_bypass)

Disable the external Xtal.

Parameters
ul_bypass0 for Xtal, 1 for bypass.

Definition at line 509 of file pmc.c.

◆ pmc_osc_enable_fastrc()

void pmc_osc_enable_fastrc ( uint32_t  ul_rc)

Enable fast RC oscillator.

Parameters
ul_rcFast RC oscillator(4/8/12Mhz).

Definition at line 376 of file pmc.c.

◆ pmc_osc_enable_main_xtal()

void pmc_osc_enable_main_xtal ( uint32_t  ul_xtal_startup_time)

Enable main XTAL oscillator.

Parameters
ul_xtal_startup_timeXtal start-up time, in number of slow clocks.

Definition at line 416 of file pmc.c.

◆ pmc_osc_is_bypassed_main_xtal()

uint32_t pmc_osc_is_bypassed_main_xtal ( void  )

Check if the main crystal is bypassed.

Return values
0Xtal is bypassed, otherwise not.

Definition at line 455 of file pmc.c.

◆ pmc_osc_is_ready_32kxtal()

uint32_t pmc_osc_is_ready_32kxtal ( void  )

Check if the external 32k Xtal is ready.

Return values
1External 32k Xtal is ready.
0External 32k Xtal is not ready.

Definition at line 336 of file pmc.c.

◆ pmc_osc_is_ready_fastrc()

uint32_t pmc_osc_is_ready_fastrc ( void  )

Check if the main fastrc is ready.

Return values
0Xtal is not ready, otherwise ready.

Definition at line 406 of file pmc.c.

◆ pmc_osc_is_ready_main_xtal()

uint32_t pmc_osc_is_ready_main_xtal ( void  )

Check if the main crystal is ready.

Note
If main crystal is bypassed, it's always ready.
Return values
0main crystal is not ready, otherwise ready.

Definition at line 467 of file pmc.c.

◆ pmc_osc_is_ready_mainck()

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.

Return values
1Xtal is ready.
0Xtal is not ready.

Definition at line 528 of file pmc.c.

◆ pmc_pck_set_prescaler()

void pmc_pck_set_prescaler ( uint32_t  ul_id,
uint32_t  ul_pres 
)

Set the prescaler for the specified programmable clock.

Parameters
ul_idPeripheral ID.
ul_presPrescaler value.

Definition at line 843 of file pmc.c.

◆ pmc_pck_set_source()

void pmc_pck_set_source ( uint32_t  ul_id,
uint32_t  ul_source 
)

Set the source oscillator for the specified programmable clock.

Parameters
ul_idPeripheral ID.
ul_sourceSource selection value.

Definition at line 857 of file pmc.c.

◆ pmc_set_fast_startup_input()

void pmc_set_fast_startup_input ( uint32_t  ul_inputs)

Set the wake-up inputs for fast startup mode registers (event generation).

Parameters
ul_inputsWake up inputs to enable.

Definition at line 1296 of file pmc.c.

◆ pmc_set_writeprotect()

void pmc_set_writeprotect ( uint32_t  ul_enable)

Enable or disable write protect of PMC registers.

Parameters
ul_enable1 to enable, 0 to disable.

Definition at line 1528 of file pmc.c.

◆ pmc_switch_mainck_to_fastrc()

void pmc_switch_mainck_to_fastrc ( uint32_t  ul_moscrcf)

Switch main clock source selection to internal fast RC.

Parameters
ul_moscrcfFast RC oscillator(4/8/12Mhz).
Return values
0Success.
1Timeout error.
2Invalid frequency.

Definition at line 351 of file pmc.c.

◆ pmc_switch_mainck_to_xtal()

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.

Note
The function may switch MCK to SCLK if MCK source is MAINCK to avoid any system crash.
If used in Xtal mode, the Xtal is automatically enabled.
Parameters
ul_bypass0 for Xtal, 1 for bypass.
Return values
0Success.
1Timeout error.

Definition at line 485 of file pmc.c.

◆ pmc_switch_mck_to_mainck()

uint32_t pmc_switch_mck_to_mainck ( uint32_t  ul_pres)

Switch master clock source selection to main clock.

Parameters
ul_presProcessor clock prescaler.
Return values
0Success.
1Timeout error.

Definition at line 186 of file pmc.c.

◆ pmc_switch_mck_to_pllack()

uint32_t pmc_switch_mck_to_pllack ( uint32_t  ul_pres)

Switch master clock source selection to PLLA clock.

Parameters
ul_presProcessor clock prescaler.
Return values
0Success.
1Timeout error.

Definition at line 218 of file pmc.c.

◆ pmc_switch_mck_to_sclk()

uint32_t pmc_switch_mck_to_sclk ( uint32_t  ul_pres)

Switch master clock source selection to slow clock.

Parameters
ul_presProcessor clock prescaler.
Return values
0Success.
1Timeout error.

Definition at line 154 of file pmc.c.

◆ pmc_switch_pck_to_mainck()

uint32_t pmc_switch_pck_to_mainck ( uint32_t  ul_id,
uint32_t  ul_pres 
)

Switch programmable clock source selection to main clock.

Parameters
ul_idId of the programmable clock.
ul_presProgrammable clock prescaler.
Return values
0Success.
1Timeout error.

Definition at line 898 of file pmc.c.

◆ pmc_switch_pck_to_mck()

uint32_t pmc_switch_pck_to_mck ( uint32_t  ul_id,
uint32_t  ul_pres 
)

Switch programmable clock source selection to mck.

Parameters
ul_idId of the programmable clock.
ul_presProgrammable clock prescaler.
Return values
0Success.
1Timeout error.

Definition at line 1000 of file pmc.c.

◆ pmc_switch_pck_to_pllack()

uint32_t pmc_switch_pck_to_pllack ( uint32_t  ul_id,
uint32_t  ul_pres 
)

Switch programmable clock source selection to PLLA clock.

Parameters
ul_idId of the programmable clock.
ul_presProgrammable clock prescaler.
Return values
0Success.
1Timeout error.

Definition at line 922 of file pmc.c.

◆ pmc_switch_pck_to_sclk()

uint32_t pmc_switch_pck_to_sclk ( uint32_t  ul_id,
uint32_t  ul_pres 
)

Switch programmable clock source selection to slow clock.

Parameters
ul_idId of the programmable clock.
ul_presProgrammable clock prescaler.
Return values
0Success.
1Timeout error.

Definition at line 874 of file pmc.c.

◆ pmc_switch_sclk_to_32kxtal()

void pmc_switch_sclk_to_32kxtal ( uint32_t  ul_bypass)

Switch slow clock source selection to external 32k (Xtal or Bypass).

Note
Switching SCLK back to 32krc is only possible by shutting down the VDDIO power supply.
Parameters
ul_bypass0 for Xtal, 1 for bypass.

Definition at line 319 of file pmc.c.



inertial_sense_ros
Author(s):
autogenerated on Sat Sep 19 2020 03:19:07