Atmel Software Framework

sleep.c File Reference

Sleep mode access.

Copyright (c) 2012-2016 Atmel Corporation. All rights reserved.

#include <compiler.h>
#include "sleep.h"
#include "pmc.h"
#include "board.h"

Macros

#define EFC0   EFC
 

Functions

bool pmc_is_wakeup_clocks_restored (void)
 Check if clocks are restored after wakeup (For WAIT mode. More...
 
static __always_inline void pmc_restore_clock_setting (const uint32_t osc_setting, const uint32_t pll0_setting, const uint32_t pll1_setting, const uint32_t mck_setting, const uint32_t fmr_setting)
 Restore clock settings. More...
 
static __always_inline void pmc_save_clock_settings (uint32_t *p_osc_setting, uint32_t *p_pll0_setting, uint32_t *p_pll1_setting, uint32_t *p_mck_setting, uint32_t *p_fmr_setting, const bool disable_xtal)
 Save clock settings and shutdown PLLs. More...
 
void pmc_sleep (int sleep_mode)
 Enter sleep mode. More...
 
void pmc_wait_wakeup_clocks_restore (pmc_callback_wakeup_clocks_restored_t callback)
 

Variables

static volatile bool b_is_sleep_clock_used = false
 If clocks are switched for some sleep mode. More...
 
static pmc_callback_wakeup_clocks_restored_t callback_clocks_restored = NULL
 Callback invoked once when clocks are restored. More...
 

static __always_inline void pmc_restore_clock_setting ( const uint32_t  osc_setting,
const uint32_t  pll0_setting,
const uint32_t  pll1_setting,
const uint32_t  mck_setting,
const uint32_t  fmr_setting 
)
static

Restore clock settings.

References CKGR_MOR_KEY_PASSWD, EFC0, and UNUSED.

Referenced by pmc_sleep().

static __always_inline void pmc_save_clock_settings ( uint32_t *  p_osc_setting,
uint32_t *  p_pll0_setting,
uint32_t *  p_pll1_setting,
uint32_t *  p_mck_setting,
uint32_t *  p_fmr_setting,
const bool  disable_xtal 
)
static

Save clock settings and shutdown PLLs.

References CKGR_MOR_KEY_PASSWD, EFC0, pmc_disable_pllack(), pmc_disable_pllbck(), and pmc_disable_upll_clock().

Referenced by pmc_sleep().

volatile bool b_is_sleep_clock_used = false
static

If clocks are switched for some sleep mode.

Referenced by pmc_is_wakeup_clocks_restored().

pmc_callback_wakeup_clocks_restored_t callback_clocks_restored = NULL
static

Callback invoked once when clocks are restored.

Referenced by pmc_sleep().