pm.h File Reference

Power Manager driver. More...

Go to the source code of this file.

Defines

#define SLEEP(mode)   {__asm__ __volatile__ ("sleep "STRINGZ(mode));}
 Sets the MCU in the specified sleep mode.

Functions

INLINE unsigned int pm_get_reset_cause (volatile avr32_pm_t *pm)
 Gets the MCU reset cause.
void pm_enable_osc0_ext_clock (volatile avr32_pm_t *pm)
 This function will enable the external clock mode of the oscillator 0.
void pm_enable_osc0_crystal (volatile avr32_pm_t *pm, unsigned int fosc0)
 This function will enable the crystal mode of the oscillator 0.
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.
void pm_disable_clk0 (volatile avr32_pm_t *pm)
 This function will disable the oscillator 0.
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.
void pm_wait_for_clk0_ready (volatile avr32_pm_t *pm)
 This function will wait until the Osc0 clock is ready.
void pm_enable_osc1_ext_clock (volatile avr32_pm_t *pm)
 This function will enable the external clock mode of the oscillator 1.
void pm_enable_osc1_crystal (volatile avr32_pm_t *pm, unsigned int fosc1)
 This function will enable the crystal mode of the oscillator 1.
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.
void pm_disable_clk1 (volatile avr32_pm_t *pm)
 This function will disable the oscillator 1.
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.
void pm_wait_for_clk1_ready (volatile avr32_pm_t *pm)
 This function will wait until the Osc1 clock is ready.
void pm_enable_osc32_ext_clock (volatile avr32_pm_t *pm)
 This function will enable the external clock mode of the 32-kHz oscillator.
void pm_enable_osc32_crystal (volatile avr32_pm_t *pm)
 This function will enable the crystal mode of the 32-kHz oscillator.
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.
void pm_disable_clk32 (volatile avr32_pm_t *pm)
 This function will disable the oscillator 32.
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.
void pm_wait_for_clk32_ready (volatile avr32_pm_t *pm)
 This function will wait until the osc32 clock is ready.
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.
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.
void pm_gc_enable (volatile avr32_pm_t *pm, unsigned int gc)
 This function will enable a generic clock.
void pm_gc_disable (volatile avr32_pm_t *pm, unsigned int gc)
 This function will disable a generic clock.
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.
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.
unsigned int pm_pll_get_option (volatile avr32_pm_t *pm, unsigned int pll)
 This function will get a PLL option.
void pm_pll_enable (volatile avr32_pm_t *pm, unsigned int pll)
 This function will enable a PLL.
void pm_pll_disable (volatile avr32_pm_t *pm, unsigned int pll)
 This function will disable a PLL.
void pm_wait_for_pll0_locked (volatile avr32_pm_t *pm)
 This function will wait for PLL0 locked.
void pm_wait_for_pll1_locked (volatile avr32_pm_t *pm)
 This function will wait for PLL1 locked.
void pm_switch_to_clock (volatile avr32_pm_t *pm, unsigned long clock)
 This function will switch the power manager main clock.
void pm_switch_to_osc0 (volatile avr32_pm_t *pm, unsigned int fosc0, unsigned int startup)
 Switch main clock to clock Osc0 (crystal mode).


Detailed Description

Power Manager driver.

Author:
Atmel Corporation: http://www.atmel.com
Support and FAQ: http://support.atmel.no/

Definition in file pm.h.


Define Documentation

#define SLEEP ( mode   )     {__asm__ __volatile__ ("sleep "STRINGZ(mode));}

Sets the MCU in the specified sleep mode.

Parameters:
mode Sleep mode:
  • AVR32_PM_SMODE_IDLE: Idle;
  • AVR32_PM_SMODE_FROZEN: Frozen;
  • AVR32_PM_SMODE_STANDBY: Standby;
  • AVR32_PM_SMODE_STOP: Stop;
  • AVR32_PM_SMODE_SHUTDOWN: Shutdown (DeepStop);
  • AVR32_PM_SMODE_STATIC: Static.

Definition at line 62 of file pm.h.


Function Documentation

INLINE unsigned int pm_get_reset_cause ( volatile avr32_pm_t *  pm  ) 

Gets the MCU reset cause.

Parameters:
pm Base address of the Power Manager instance (i.e. &AVR32_PM).
Returns:
The MCU reset cause which can be masked with the AVR32_PM_RCAUSE_x_MASK bit-masks to isolate specific causes.

Definition at line 72 of file pm.h.

void pm_enable_osc0_ext_clock ( volatile avr32_pm_t *  pm  ) 

This function will enable the external clock mode of the oscillator 0.

Parameters:
pm Base address of the Power Manager (i.e. &AVR32_PM)

void pm_enable_osc0_crystal ( volatile avr32_pm_t *  pm,
unsigned int  fosc0 
)

This function will enable the crystal mode of the oscillator 0.

Parameters:
pm Base address of the Power Manager (i.e. &AVR32_PM)
fosc0 Oscillator 0 crystal frequency (Hz)

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.

Parameters:
pm Base address of the Power Manager (i.e. &AVR32_PM)
startup Clock 0 startup time. Time is expressed in term of RCOsc periods (3-bit value)

void pm_disable_clk0 ( volatile avr32_pm_t *  pm  ) 

This function will disable the oscillator 0.

Parameters:
pm Base address of the Power Manager (i.e. &AVR32_PM)

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.

Parameters:
pm Base address of the Power Manager (i.e. &AVR32_PM)
startup Clock 0 startup time. Time is expressed in term of RCOsc periods (3-bit value) but not checked.

void pm_wait_for_clk0_ready ( volatile avr32_pm_t *  pm  ) 

This function will wait until the Osc0 clock is ready.

Parameters:
pm Base address of the Power Manager (i.e. &AVR32_PM)

void pm_enable_osc1_ext_clock ( volatile avr32_pm_t *  pm  ) 

This function will enable the external clock mode of the oscillator 1.

Parameters:
pm Base address of the Power Manager (i.e. &AVR32_PM)

void pm_enable_osc1_crystal ( volatile avr32_pm_t *  pm,
unsigned int  fosc1 
)

This function will enable the crystal mode of the oscillator 1.

Parameters:
pm Base address of the Power Manager (i.e. &AVR32_PM)
fosc1 Oscillator 1 crystal frequency (Hz)

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.

Parameters:
pm Base address of the Power Manager (i.e. &AVR32_PM)
startup Clock 1 startup time. Time is expressed in term of RCOsc periods (3-bit value)

void pm_disable_clk1 ( volatile avr32_pm_t *  pm  ) 

This function will disable the oscillator 1.

Parameters:
pm Base address of the Power Manager (i.e. &AVR32_PM)

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.

Parameters:
pm Base address of the Power Manager (i.e. &AVR32_PM)
startup Clock 1 startup time. Time is expressed in term of RCOsc periods (3-bit value) but not checked.

void pm_wait_for_clk1_ready ( volatile avr32_pm_t *  pm  ) 

This function will wait until the Osc1 clock is ready.

Parameters:
pm Base address of the Power Manager (i.e. &AVR32_PM)

void pm_enable_osc32_ext_clock ( volatile avr32_pm_t *  pm  ) 

This function will enable the external clock mode of the 32-kHz oscillator.

Parameters:
pm Base address of the Power Manager (i.e. &AVR32_PM)

void pm_enable_osc32_crystal ( volatile avr32_pm_t *  pm  ) 

This function will enable the crystal mode of the 32-kHz oscillator.

Parameters:
pm Base address of the Power Manager (i.e. &AVR32_PM)

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.

Parameters:
pm Base address of the Power Manager (i.e. &AVR32_PM)
startup Clock 32 kHz startup time. Time is expressed in term of RCOsc periods (3-bit value)

void pm_disable_clk32 ( volatile avr32_pm_t *  pm  ) 

This function will disable the oscillator 32.

Parameters:
pm Base address of the Power Manager (i.e. &AVR32_PM)

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.

Parameters:
pm Base address of the Power Manager (i.e. &AVR32_PM)
startup Clock 32 kHz startup time. Time is expressed in term of RCOsc periods (3-bit value) but not checked.

void pm_wait_for_clk32_ready ( volatile avr32_pm_t *  pm  ) 

This function will wait until the osc32 clock is ready.

Parameters:
pm Base address of the Power Manager (i.e. &AVR32_PM)

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.

Parameters:
pm Base address of the Power Manager (i.e. &AVR32_PM)
pbadiv Peripheral Bus A clock divisor enable
pbasel Peripheral Bus A select
pbbdiv Peripheral Bus B clock divisor enable
pbbsel Peripheral Bus B select
hsbdiv High Speed Bus clock divisor enable (CPU clock = HSB clock)
hsbsel High Speed Bus select (CPU clock = HSB clock )

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.

Parameters:
pm Base address of the Power Manager (i.e. &AVR32_PM)
gc generic clock number (0 for gc0...)
osc_or_pll Use OSC (=0) or PLL (=1)
pll_osc Select Osc0/PLL0 or Osc1/PLL1
diven Generic clock divisor enable
div Generic clock divisor

void pm_gc_enable ( volatile avr32_pm_t *  pm,
unsigned int  gc 
)

This function will enable a generic clock.

Parameters:
pm Base address of the Power Manager (i.e. &AVR32_PM)
gc generic clock number (0 for gc0...)

void pm_gc_disable ( volatile avr32_pm_t *  pm,
unsigned int  gc 
)

This function will disable a generic clock.

Parameters:
pm Base address of the Power Manager (i.e. &AVR32_PM)
gc generic clock number (0 for gc0...)

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.

Parameters:
pm Base address of the Power Manager (i.e. &AVR32_PM)
pll PLL number(0 for PLL0, 1 for PLL1)
mul PLL MUL in the PLL formula
div PLL DIV in the PLL formula
osc OSC number (0 for osc0, 1 for osc1)
lockcount PLL lockount

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.

Parameters:
pm Base address of the Power Manager (i.e. &AVR32_PM)
pll PLL number(0 for PLL0, 1 for PLL1)
pll_freq Set to 1 for VCO frequency range 80-180MHz, set to 0 for VCO frequency range 160-240Mhz.
pll_div2 Divide the PLL output frequency by 2 (this settings does not change the FVCO value)
pll_wbwdisable 1 Disable the Wide-Bandith Mode (Wide-Bandwith mode allow a faster startup time and out-of-lock time). 0 to enable the Wide-Bandith Mode.

unsigned int pm_pll_get_option ( volatile avr32_pm_t *  pm,
unsigned int  pll 
)

This function will get a PLL option.

Parameters:
pm Base address of the Power Manager (i.e. &AVR32_PM)
pll PLL number(0 for PLL0, 1 for PLL1)
Returns:
Option

void pm_pll_enable ( volatile avr32_pm_t *  pm,
unsigned int  pll 
)

This function will enable a PLL.

Parameters:
pm Base address of the Power Manager (i.e. &AVR32_PM)
pll PLL number(0 for PLL0, 1 for PLL1)

void pm_pll_disable ( volatile avr32_pm_t *  pm,
unsigned int  pll 
)

This function will disable a PLL.

Parameters:
pm Base address of the Power Manager (i.e. &AVR32_PM)
pll PLL number(0 for PLL0, 1 for PLL1)

void pm_wait_for_pll0_locked ( volatile avr32_pm_t *  pm  ) 

This function will wait for PLL0 locked.

Parameters:
pm Base address of the Power Manager (i.e. &AVR32_PM)

void pm_wait_for_pll1_locked ( volatile avr32_pm_t *  pm  ) 

This function will wait for PLL1 locked.

Parameters:
pm Base address of the Power Manager (i.e. &AVR32_PM)

void pm_switch_to_clock ( volatile avr32_pm_t *  pm,
unsigned long  clock 
)

This function will switch the power manager main clock.

Parameters:
pm Base address of the Power Manager (i.e. &AVR32_PM)
clock Clock to be switched on. AVR32_PM_MCSEL_SLOW for RCOsc, AVR32_PM_MCSEL_OSC0 for Osc0, AVR32_PM_MCSEL_PLL0 for PLL0.

void pm_switch_to_osc0 ( volatile avr32_pm_t *  pm,
unsigned int  fosc0,
unsigned int  startup 
)

Switch main clock to clock Osc0 (crystal mode).

Parameters:
pm Base address of the Power Manager (i.e. &AVR32_PM)
fosc0 Oscillator 0 crystal frequency (Hz)
startup Crystal 0 startup time. Time is expressed in term of RCOsc periods (3-bit value)


© 2000-2007 by egnite Software GmbH - visit http://www.ethernut.de/