42 #if (SAM3S || SAM3U || SAM3N || SAM3XA || SAM4S || SAM4E || SAM4N || SAM4C || SAMG || SAM4CP || SAM4CM || SAMV71 || SAMV70 || SAMS70 || SAME70)    45 # include "xmega/sleepmgr.h"    47 # include "uc3/sleepmgr.h"    49 # include "sam4l/sleepmgr.h"    51 # include "mega/sleepmgr.h"    52 #elif (SAMD20 || SAMD21 || SAMR21 || SAMD11 || SAMDA1)    53 # include "samd/sleepmgr.h"    54 #elif (SAML21 || SAML22 || SAMR30 || SAMR34 || SAMR35)    55 # include "saml/sleepmgr.h"    57 # include "samc/sleepmgr.h"    59 # error Unsupported device.    99 #if defined(__DOXYGEN__) && !defined(CONFIG_SLEEPMGR_ENABLE)   100 #  define CONFIG_SLEEPMGR_ENABLE   119 #ifdef CONFIG_SLEEPMGR_ENABLE   123                 sleepmgr_locks[i] = 0;
   125         sleepmgr_locks[SLEEPMGR_NR_OF_MODES - 1] = 1;
   139 #ifdef CONFIG_SLEEPMGR_ENABLE   142         if(sleepmgr_locks[mode] >= 0xff) {
   152         ++sleepmgr_locks[mode];
   171 #ifdef CONFIG_SLEEPMGR_ENABLE   174         if(sleepmgr_locks[mode] == 0) {
   184         --sleepmgr_locks[mode];
   204 #ifdef CONFIG_SLEEPMGR_ENABLE   205         uint8_t *lock_ptr = sleepmgr_locks;
   208         while (!(*lock_ptr)) {
   237 #ifdef CONFIG_SLEEPMGR_ENABLE #define cpu_irq_disable()
Disable interrupts globally. 
 
#define UNUSED(v)
Marking v as a unused parameter or value. 
 
static void sleepmgr_init(void)
Initialize the lock counts. 
 
static irqflags_t cpu_irq_save(void)
Get and clear the global interrupt flags. 
 
static void sleepmgr_sleep(const enum sleepmgr_mode sleep_mode)
 
static void cpu_irq_restore(irqflags_t flags)
Restore global interrupt flags. 
 
Commonly used includes, types and macros. 
 
Atmel part identification macros. 
 
static enum sleepmgr_mode sleepmgr_get_sleep_mode(void)
Retrieves the deepest allowable sleep mode. 
 
static void sleepmgr_enter_sleep(void)
Go to sleep in the deepest allowed mode. 
 
SAM3/SAM4 Sleep manager implementation. 
 
sleepmgr_mode
Sleep mode locks. 
 
uint32_t irqflags_t
Type used for holding state of interrupt flag. 
 
static void sleepmgr_lock_mode(enum sleepmgr_mode mode)
Increase lock count for a sleep mode. 
 
#define Assert(expr)
This macro is used to test fatal errors. 
 
static void sleepmgr_unlock_mode(enum sleepmgr_mode mode)
Decrease lock count for a sleep mode. 
 
#define cpu_irq_enable()
Enable interrupts globally.