Microchip® Advanced Software Framework

pm.c File Reference
#include "compiler.h"
#include "pm.h"

Data Structures

union  u_avr32_pm_bgcr_t
 
union  u_avr32_pm_bod_t
 
union  u_avr32_pm_cksel_t
 
union  u_avr32_pm_gcctrl_t
 
union  u_avr32_pm_icr_t
 
union  u_avr32_pm_idr_t
 
union  u_avr32_pm_ier_t
 
union  u_avr32_pm_mcctrl_t
 
union  u_avr32_pm_oscctrl0_t
 
union  u_avr32_pm_oscctrl1_t
 
union  u_avr32_pm_oscctrl32_t
 
union  u_avr32_pm_pll_t
 
union  u_avr32_pm_rccr_t
 
union  u_avr32_pm_vregcr_t
 

Functions

void pm_bod_clear_irq (volatile avr32_pm_t *pm)
 Clears the Brown-Out Detector interrupt flag. More...
 
void pm_bod_disable_irq (volatile avr32_pm_t *pm)
 Disables the Brown-Out Detector interrupt. More...
 
void pm_bod_enable_irq (volatile avr32_pm_t *pm)
 Enables the Brown-Out Detector interrupt. More...
 
unsigned long pm_bod_get_irq_enable_bit (volatile avr32_pm_t *pm)
 Gets the Brown-Out Detector interrupt enable status. More...
 
unsigned long pm_bod_get_irq_status (volatile avr32_pm_t *pm)
 Gets the Brown-Out Detector interrupt flag. More...
 
unsigned long pm_bod_get_level (volatile avr32_pm_t *pm)
 Gets the triggering threshold of the Brown-Out Detector. More...
 
void pm_cksel (volatile avr32_pm_t *pm, unsigned int pbadiv, unsigned int pbasel, unsigned int pbbdiv, unsigned int pbbsel, unsigned int hsbdiv, unsigned int hsbsel)
 This function will select all the power manager clocks. More...
 
void pm_cksel_get (volatile avr32_pm_t *pm, unsigned long *p_cksel)
 This function returns the cksel (Clock Select). More...
 
void pm_cksel_set (volatile avr32_pm_t *pm, unsigned long cksel)
 This function set the cksel (Clock Select). More...
 
void pm_disable_clk0 (volatile avr32_pm_t *pm)
 This function will disable the oscillator 0. More...
 
void pm_disable_clk1 (volatile avr32_pm_t *pm)
 This function will disable the oscillator 1. More...
 
void pm_disable_clk32 (volatile avr32_pm_t *pm)
 This function will disable the oscillator 32. More...
 
long pm_disable_module (volatile avr32_pm_t *pm, unsigned long module)
 Disable the clock of a module. More...
 
void pm_enable_clk0 (volatile avr32_pm_t *pm, unsigned int startup)
 This function will enable the oscillator 0 to be used with a startup time. More...
 
void pm_enable_clk0_no_wait (volatile avr32_pm_t *pm, unsigned int startup)
 This function will enable the oscillator 0 to be used with no startup time. More...
 
void pm_enable_clk1 (volatile avr32_pm_t *pm, unsigned int startup)
 This function will enable the oscillator 1 to be used with a startup time. More...
 
void pm_enable_clk1_no_wait (volatile avr32_pm_t *pm, unsigned int startup)
 This function will enable the oscillator 1 to be used with no startup time. More...
 
void pm_enable_clk32 (volatile avr32_pm_t *pm, unsigned int startup)
 This function will enable the oscillator 32 to be used with a startup time. More...
 
void pm_enable_clk32_no_wait (volatile avr32_pm_t *pm, unsigned int startup)
 This function will enable the oscillator 32 to be used with no startup time. More...
 
long pm_enable_module (volatile avr32_pm_t *pm, unsigned long module)
 Enable the clock of a module. More...
 
void pm_enable_osc0_crystal (volatile avr32_pm_t *pm, unsigned int fosc0)
 This function will enable the crystal mode of the oscillator 0. More...
 
void pm_enable_osc0_ext_clock (volatile avr32_pm_t *pm)
 This function will enable the external clock mode of the oscillator 0. More...
 
void pm_enable_osc1_crystal (volatile avr32_pm_t *pm, unsigned int fosc1)
 This function will enable the crystal mode of the oscillator 1. More...
 
void pm_enable_osc1_ext_clock (volatile avr32_pm_t *pm)
 This function will enable the external clock mode of the oscillator 1. More...
 
void pm_enable_osc32_crystal (volatile avr32_pm_t *pm)
 This function will enable the crystal mode of the 32-kHz oscillator. More...
 
void pm_enable_osc32_ext_clock (volatile avr32_pm_t *pm)
 This function will enable the external clock mode of the 32-kHz oscillator. More...
 
void pm_gc_disable (volatile avr32_pm_t *pm, unsigned int gc)
 This function will disable a generic clock. More...
 
void pm_gc_enable (volatile avr32_pm_t *pm, unsigned int gc)
 This function will enable a generic clock. More...
 
void pm_gc_setup (volatile avr32_pm_t *pm, unsigned int gc, unsigned int osc_or_pll, unsigned int pll_osc, unsigned int diven, unsigned int div)
 This function will setup a generic clock. More...
 
unsigned long pm_get_clock (volatile avr32_pm_t *pm)
 This function returns the power manager main clock. More...
 
void pm_pll_disable (volatile avr32_pm_t *pm, unsigned int pll)
 This function will disable a PLL. More...
 
void pm_pll_enable (volatile avr32_pm_t *pm, unsigned int pll)
 This function will enable a PLL. More...
 
unsigned int pm_pll_get_option (volatile avr32_pm_t *pm, unsigned int pll)
 This function will get a PLL option. More...
 
void pm_pll_set_option (volatile avr32_pm_t *pm, unsigned int pll, unsigned int pll_freq, unsigned int pll_div2, unsigned int pll_wbwdisable)
 This function will set a PLL option. More...
 
void pm_pll_setup (volatile avr32_pm_t *pm, unsigned int pll, unsigned int mul, unsigned int div, unsigned int osc, unsigned int lockcount)
 This function will setup a PLL. More...
 
unsigned long pm_read_gplp (volatile avr32_pm_t *pm, unsigned long gplp)
 Read the content of the PM GPLP registers. More...
 
static void pm_set_osc0_mode (volatile avr32_pm_t *pm, unsigned int mode)
 Sets the mode of the oscillator 0. More...
 
static void pm_set_osc1_mode (volatile avr32_pm_t *pm, unsigned int mode)
 Sets the mode of the oscillator 1. More...
 
static void pm_set_osc32_mode (volatile avr32_pm_t *pm, unsigned int mode)
 Sets the mode of the 32-kHz oscillator. More...
 
void pm_switch_to_clock (volatile avr32_pm_t *pm, unsigned long clock)
 This function will switch the power manager main clock. More...
 
void pm_switch_to_osc0 (volatile avr32_pm_t *pm, unsigned int fosc0, unsigned int startup)
 Switch main clock to clock Osc0 (crystal mode) More...
 
void pm_wait_for_clk0_ready (volatile avr32_pm_t *pm)
 This function will wait until the Osc0 clock is ready. More...
 
void pm_wait_for_clk1_ready (volatile avr32_pm_t *pm)
 This function will wait until the Osc1 clock is ready. More...
 
void pm_wait_for_clk32_ready (volatile avr32_pm_t *pm)
 This function will wait until the osc32 clock is ready. More...
 
void pm_wait_for_pll0_locked (volatile avr32_pm_t *pm)
 This function will wait for PLL0 locked. More...
 
void pm_wait_for_pll1_locked (volatile avr32_pm_t *pm)
 This function will wait for PLL1 locked. More...
 
void pm_write_gplp (volatile avr32_pm_t *pm, unsigned long gplp, unsigned long value)
 Write into the PM GPLP registers. More...
 

static void pm_set_osc0_mode ( volatile avr32_pm_t *  pm,
unsigned int  mode 
)
static

Sets the mode of the oscillator 0.

Parameters
pmBase address of the Power Manager (i.e. &AVR32_PM).
modeOscillator 0 mode (i.e. AVR32_PM_OSCCTRL0_MODE_x).

References u_avr32_pm_oscctrl0_t::oscctrl0, and u_avr32_pm_oscctrl0_t::OSCCTRL0.

Referenced by pm_enable_osc0_crystal(), and pm_enable_osc0_ext_clock().

static void pm_set_osc1_mode ( volatile avr32_pm_t *  pm,
unsigned int  mode 
)
static

Sets the mode of the oscillator 1.

Parameters
pmBase address of the Power Manager (i.e. &AVR32_PM).
modeOscillator 1 mode (i.e. AVR32_PM_OSCCTRL1_MODE_x).

References u_avr32_pm_oscctrl1_t::oscctrl1, and u_avr32_pm_oscctrl1_t::OSCCTRL1.

Referenced by pm_enable_osc1_crystal(), and pm_enable_osc1_ext_clock().

static void pm_set_osc32_mode ( volatile avr32_pm_t *  pm,
unsigned int  mode 
)
static

Sets the mode of the 32-kHz oscillator.

Parameters
pmBase address of the Power Manager (i.e. &AVR32_PM).
mode32-kHz oscillator mode (i.e. AVR32_PM_OSCCTRL32_MODE_x).

References u_avr32_pm_oscctrl32_t::oscctrl32, and u_avr32_pm_oscctrl32_t::OSCCTRL32.

Referenced by pm_enable_osc32_crystal(), and pm_enable_osc32_ext_clock().