Nut/OS  4.10.3
API Reference
pm.h File Reference

Power Manager driver. More...

#include <arch/avr32.h>
#include <avr32/io.h>
#include "preprocessor.h"
Include dependency graph for pm.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  pm_freq_param_t
 Input and output parameters when initializing PM clocks using pm_configure_clocks(). More...

Defines

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

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)
void pm_bod_enable_irq (volatile avr32_pm_t *pm)
 Enables the Brown-Out Detector interrupt.
void pm_bod_disable_irq (volatile avr32_pm_t *pm)
 Disables the Brown-Out Detector interrupt.
void pm_bod_clear_irq (volatile avr32_pm_t *pm)
 Clears the Brown-Out Detector interrupt flag.
unsigned long pm_bod_get_irq_status (volatile avr32_pm_t *pm)
 Gets the Brown-Out Detector interrupt flag.
unsigned long pm_bod_get_irq_enable_bit (volatile avr32_pm_t *pm)
 Gets the Brown-Out Detector interrupt enable status.
unsigned long pm_bod_get_level (volatile avr32_pm_t *pm)
 Gets the triggering threshold of the Brown-Out Detector.
unsigned long pm_read_gplp (volatile avr32_pm_t *pm, unsigned long gplp)
 Read the content of the PM GPLP registers.
void pm_write_gplp (volatile avr32_pm_t *pm, unsigned long gplp, unsigned long value)
 Write into the PM GPLP registers.
long pm_enable_module (volatile avr32_pm_t *pm, unsigned long module)
 Enable the clock of a module.
long pm_disable_module (volatile avr32_pm_t *pm, unsigned long module)
 Disable the clock of a module.
int pm_configure_clocks (pm_freq_param_t *param)
 Automatically configure the CPU, PBA, PBB, and HSB clocks according to the user wishes.
void pm_configure_usb_clock (void)
 Automatically configure the USB clock.

Detailed Description

Power Manager driver.

Copyright (C) 2001-2010 by egnite Software GmbH

All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the copyright holders nor the names of contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

For additional information see http://www.ethernut.de/

Portions Copyright Atmel Corporation, see the following note.

  • Compiler: IAR EWAVR32 and GNU GCC for AVR32
  • Supported devices: All AVR32 devices.
  • AppNote:
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:
modeSleep mode:
  • AVR32_PM_SMODE_IDLE: Idle;
  • AVR32_PM_SMODE_FROZEN: Frozen;
  • AVR32_PM_SMODE_STANDBY: Standby;
  • AVR32_PM_SMODE_STOP: Stop;
  • AVR32_PM_SMODE_DEEP_STOP: DeepStop;
  • AVR32_PM_SMODE_STATIC: Static.

Definition at line 103 of file pm.h.

#define PM_FREQ_STATUS_FAIL   (-1)

Definition at line 122 of file pm.h.

#define PM_FREQ_STATUS_OK   (0)

Definition at line 123 of file pm.h.


Function Documentation

__inline__ unsigned int pm_get_reset_cause ( volatile avr32_pm_t *  pm)

Gets the MCU reset cause.

Parameters:
pmBase 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 136 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:
pmBase address of the Power Manager (i.e. &AVR32_PM)

Definition at line 198 of file pm.c.

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:
pmBase address of the Power Manager (i.e. &AVR32_PM)
fosc0Oscillator 0 crystal frequency (Hz)

Definition at line 204 of file pm.c.

Referenced by pm_switch_to_osc0().

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:
pmBase address of the Power Manager (i.e. &AVR32_PM)
startupClock 0 startup time. AVR32_PM_OSCCTRL0_STARTUP_x_RCOSC.

Definition at line 213 of file pm.c.

References pm_enable_clk0_no_wait(), and pm_wait_for_clk0_ready().

Referenced by pm_switch_to_osc0().

Here is the call graph for this function:

void pm_disable_clk0 ( volatile avr32_pm_t *  pm)

This function will disable the oscillator 0.

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

Definition at line 220 of file pm.c.

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:
pmBase address of the Power Manager (i.e. &AVR32_PM)
startupClock 0 startup time, for which the function does not wait. AVR32_PM_OSCCTRL0_STARTUP_x_RCOSC.

Definition at line 226 of file pm.c.

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

Referenced by pm_enable_clk0().

void pm_wait_for_clk0_ready ( volatile avr32_pm_t *  pm)

This function will wait until the Osc0 clock is ready.

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

Definition at line 239 of file pm.c.

Referenced by pm_enable_clk0().

void pm_enable_osc1_ext_clock ( volatile avr32_pm_t *  pm)

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

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

Definition at line 261 of file pm.c.

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:
pmBase address of the Power Manager (i.e. &AVR32_PM)
fosc1Oscillator 1 crystal frequency (Hz)

Definition at line 267 of file pm.c.

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:
pmBase address of the Power Manager (i.e. &AVR32_PM)
startupClock 1 startup time. AVR32_PM_OSCCTRL1_STARTUP_x_RCOSC.

Definition at line 276 of file pm.c.

References pm_enable_clk1_no_wait(), and pm_wait_for_clk1_ready().

Here is the call graph for this function:

void pm_disable_clk1 ( volatile avr32_pm_t *  pm)

This function will disable the oscillator 1.

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

Definition at line 283 of file pm.c.

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:
pmBase address of the Power Manager (i.e. &AVR32_PM)
startupClock 1 startup time, for which the function does not wait. AVR32_PM_OSCCTRL1_STARTUP_x_RCOSC.

Definition at line 289 of file pm.c.

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

Referenced by pm_enable_clk1().

void pm_wait_for_clk1_ready ( volatile avr32_pm_t *  pm)

This function will wait until the Osc1 clock is ready.

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

Definition at line 302 of file pm.c.

Referenced by pm_enable_clk1().

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:
pmBase address of the Power Manager (i.e. &AVR32_PM)

Definition at line 324 of file pm.c.

void pm_enable_osc32_crystal ( volatile avr32_pm_t *  pm)

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

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

Definition at line 330 of file pm.c.

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:
pmBase address of the Power Manager (i.e. &AVR32_PM)
startupClock 32 kHz startup time. AVR32_PM_OSCCTRL32_STARTUP_x_RCOSC.

Definition at line 336 of file pm.c.

References pm_enable_clk32_no_wait(), and pm_wait_for_clk32_ready().

Here is the call graph for this function:

void pm_disable_clk32 ( volatile avr32_pm_t *  pm)

This function will disable the oscillator 32.

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

Definition at line 343 of file pm.c.

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:
pmBase address of the Power Manager (i.e. &AVR32_PM)
startupClock 32 kHz startup time, for which the function does not wait. AVR32_PM_OSCCTRL32_STARTUP_x_RCOSC.

Definition at line 349 of file pm.c.

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

Referenced by pm_enable_clk32().

void pm_wait_for_clk32_ready ( volatile avr32_pm_t *  pm)

This function will wait until the osc32 clock is ready.

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

Definition at line 361 of file pm.c.

Referenced by pm_enable_clk32().

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:
pmBase address of the Power Manager (i.e. &AVR32_PM)
pbadivPeripheral Bus A clock divisor enable
pbaselPeripheral Bus A select
pbbdivPeripheral Bus B clock divisor enable
pbbselPeripheral Bus B select
hsbdivHigh Speed Bus clock divisor enable (CPU clock = HSB clock)
hsbselHigh Speed Bus select (CPU clock = HSB clock )

Definition at line 367 of file pm.c.

References u_avr32_pm_cksel_t::cksel, and u_avr32_pm_cksel_t::CKSEL.

Referenced by NutInit().

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:
pmBase address of the Power Manager (i.e. &AVR32_PM)
gcgeneric clock number (0 for gc0...)
osc_or_pllUse OSC (=0) or PLL (=1)
pll_oscSelect Osc0/PLL0 or Osc1/PLL1
divenGeneric clock divisor enable
divGeneric clock divisor

Definition at line 393 of file pm.c.

References u_avr32_pm_gcctrl_t::gcctrl, and u_avr32_pm_gcctrl_t::GCCTRL.

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

This function will enable a generic clock.

Parameters:
pmBase address of the Power Manager (i.e. &AVR32_PM)
gcgeneric clock number (0 for gc0...)

Definition at line 411 of file pm.c.

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

This function will disable a generic clock.

Parameters:
pmBase address of the Power Manager (i.e. &AVR32_PM)
gcgeneric clock number (0 for gc0...)

Definition at line 418 of file pm.c.

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:
pmBase address of the Power Manager (i.e. &AVR32_PM)
pllPLL number(0 for PLL0, 1 for PLL1)
mulPLL MUL in the PLL formula
divPLL DIV in the PLL formula
oscOSC number (0 for osc0, 1 for osc1)
lockcountPLL lockount

Definition at line 425 of file pm.c.

References u_avr32_pm_pll_t::pll, and u_avr32_pm_pll_t::PLL.

Referenced by NutInit().

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:
pmBase address of the Power Manager (i.e. &AVR32_PM)
pllPLL number(0 for PLL0, 1 for PLL1)
pll_freqSet to 1 for VCO frequency range 80-180MHz, set to 0 for VCO frequency range 160-240Mhz.
pll_div2Divide the PLL output frequency by 2 (this settings does not change the FVCO value)
pll_wbwdisable1 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.

Definition at line 443 of file pm.c.

References u_avr32_pm_pll_t::pll, and u_avr32_pm_pll_t::PLL.

Referenced by NutInit().

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

This function will get a PLL option.

Parameters:
pmBase address of the Power Manager (i.e. &AVR32_PM)
pllPLL number(0 for PLL0, 1 for PLL1)
Returns:
Option

Definition at line 455 of file pm.c.

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

This function will enable a PLL.

Parameters:
pmBase address of the Power Manager (i.e. &AVR32_PM)
pllPLL number(0 for PLL0, 1 for PLL1)

Definition at line 462 of file pm.c.

Referenced by NutInit().

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

This function will disable a PLL.

Parameters:
pmBase address of the Power Manager (i.e. &AVR32_PM)
pllPLL number(0 for PLL0, 1 for PLL1)

Definition at line 469 of file pm.c.

void pm_wait_for_pll0_locked ( volatile avr32_pm_t *  pm)

This function will wait for PLL0 locked.

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

Definition at line 476 of file pm.c.

Referenced by NutInit().

void pm_wait_for_pll1_locked ( volatile avr32_pm_t *  pm)

This function will wait for PLL1 locked.

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

Definition at line 482 of file pm.c.

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

This function will switch the power manager main clock.

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

Definition at line 488 of file pm.c.

References u_avr32_pm_mcctrl_t::mcctrl, and u_avr32_pm_mcctrl_t::MCCTRL.

Referenced by NutInit(), and pm_switch_to_osc0().

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:
pmBase address of the Power Manager (i.e. &AVR32_PM)
fosc0Oscillator 0 crystal frequency (Hz)
startupCrystal 0 startup time. AVR32_PM_OSCCTRL0_STARTUP_x_RCOSC.

Definition at line 499 of file pm.c.

References pm_enable_clk0(), pm_enable_osc0_crystal(), and pm_switch_to_clock().

Referenced by NutInit().

Here is the call graph for this function:

void pm_bod_enable_irq ( volatile avr32_pm_t *  pm)

Enables the Brown-Out Detector interrupt.

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

Definition at line 507 of file pm.c.

void pm_bod_disable_irq ( volatile avr32_pm_t *  pm)

Disables the Brown-Out Detector interrupt.

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

Definition at line 512 of file pm.c.

References Disable_global_interrupt, Enable_global_interrupt, and Is_global_interrupt_enabled.

void pm_bod_clear_irq ( volatile avr32_pm_t *  pm)

Clears the Brown-Out Detector interrupt flag.

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

Definition at line 523 of file pm.c.

unsigned long pm_bod_get_irq_status ( volatile avr32_pm_t *  pm)

Gets the Brown-Out Detector interrupt flag.

Parameters:
pmBase address of the Power Manager (i.e. &AVR32_PM).
Return values:
0No BOD interrupt.
1BOD interrupt pending.

Definition at line 529 of file pm.c.

unsigned long pm_bod_get_irq_enable_bit ( volatile avr32_pm_t *  pm)

Gets the Brown-Out Detector interrupt enable status.

Parameters:
pmBase address of the Power Manager (i.e. &AVR32_PM).
Return values:
0BOD interrupt disabled.
1BOD interrupt enabled.

Definition at line 535 of file pm.c.

unsigned long pm_bod_get_level ( volatile avr32_pm_t *  pm)

Gets the triggering threshold of the Brown-Out Detector.

Parameters:
pmBase address of the Power Manager (i.e. &AVR32_PM).
Returns:
Triggering threshold of the BOD. See the electrical characteristics in the part datasheet for actual voltage levels.

Definition at line 541 of file pm.c.

unsigned long pm_read_gplp ( volatile avr32_pm_t *  pm,
unsigned long  gplp 
)

Read the content of the PM GPLP registers.

Parameters:
pmBase address of the Power Manager (i.e. &AVR32_PM)
gplpGPLP register index (0,1,... depending on the number of GPLP registers for a given part)
Returns:
The content of the chosen GPLP register.

Definition at line 547 of file pm.c.

void pm_write_gplp ( volatile avr32_pm_t *  pm,
unsigned long  gplp,
unsigned long  value 
)

Write into the PM GPLP registers.

Parameters:
pmBase address of the Power Manager (i.e. &AVR32_PM)
gplpGPLP register index (0,1,... depending on the number of GPLP registers for a given part)
valueValue to write

Definition at line 553 of file pm.c.

long pm_enable_module ( volatile avr32_pm_t *  pm,
unsigned long  module 
)

Enable the clock of a module.

Parameters:
pmBase address of the Power Manager (i.e. &AVR32_PM)
moduleThe module to clock (use one of the defines in the part-specific header file under "toolchain folder"/avr32/inc(lude)/avr32/; depending on the clock domain, look for the sections "CPU clocks", "HSB clocks", "PBx clocks")
Returns:
Status.
Return values:
0Success.
<0An error occured.

Definition at line 559 of file pm.c.

References PASS.

long pm_disable_module ( volatile avr32_pm_t *  pm,
unsigned long  module 
)

Disable the clock of a module.

Parameters:
pmBase address of the Power Manager (i.e. &AVR32_PM)
moduleThe module to shut down (use one of the defines in the part-specific header file under "toolchain folder"/avr32/inc(lude)/avr32/; depending on the clock domain, look for the sections "CPU clocks", "HSB clocks", "PBx clocks")
Returns:
Status.
Return values:
0Success.
<0An error occured.

Definition at line 572 of file pm.c.

References PASS.

int pm_configure_clocks ( pm_freq_param_t param)

Automatically configure the CPU, PBA, PBB, and HSB clocks according to the user wishes.

This function needs some parameters stored in a pm_freq_param_t structure:

  • cpu_f and pba_f are the wanted frequencies,
  • osc0_f is the oscillator 0 on-board frequency (e.g. FOSC0),
  • osc0_startup is the oscillator 0 startup time (e.g. OSC0_STARTUP).

The function will then configure the clocks using the following rules:

  • It first try to find a valid PLL frequency (the highest possible value to avoid jitter) in order to satisfy the CPU frequency,
  • It optimizes the configuration depending the various divide stages,
  • Then, the PBA frequency is configured from the CPU freq.
  • Note that HSB and PBB are configured with the same frequency as CPU.
  • Note also that the number of wait states of the flash read accesses is automatically set-up depending the CPU frequency. As a consequence, the application needs the FLASHC driver to compile.

The CPU, HSB and PBA frequencies programmed after configuration are stored back into cpu_f and pba_f.

Parameters:
parampointer on the configuration structure.
Return values:
PM_FREQ_STATUS_OKMode successfully initialized.
PM_FREQ_STATUS_FAILThe configuration can not be done.
void pm_configure_usb_clock ( void  )

Automatically configure the USB clock.

USB clock is configured to 48MHz, using the PLL1 from the Oscillator0, assuming a 12 MHz crystal is connected to it.