Macros | Enumerations | Functions
Sleep manager

Macros

#define CONFIG_SLEEPMGR_ENABLE
 Configuration symbol for enabling the sleep manager. More...
 

Enumerations

enum  sleepmgr_mode {
  SLEEPMGR_ACTIVE = 0, SLEEPMGR_SLEEP_WFE, SLEEPMGR_SLEEP_WFI, SLEEPMGR_WAIT_FAST,
  SLEEPMGR_WAIT, SLEEPMGR_BACKUP, SLEEPMGR_NR_OF_MODES
}
 Sleep mode locks. More...
 

Functions

static void sleepmgr_enter_sleep (void)
 Go to sleep in the deepest allowed mode. More...
 
static enum sleepmgr_mode sleepmgr_get_sleep_mode (void)
 Retrieves the deepest allowable sleep mode. More...
 
static void sleepmgr_init (void)
 Initialize the lock counts. More...
 
static void sleepmgr_lock_mode (enum sleepmgr_mode mode)
 Increase lock count for a sleep mode. More...
 
static void sleepmgr_unlock_mode (enum sleepmgr_mode mode)
 Decrease lock count for a sleep mode. More...
 

Detailed Description

The sleep manager is a service for ensuring that the device is not put to sleep in deeper sleep modes than the system (e.g., peripheral drivers, services or the application) allows at any given time.

It is based on the use of lock counting for the individual sleep modes, and will put the device to sleep in the shallowest sleep mode that has a non-zero lock count. The drivers/services/application can change these counts by use of sleepmgr_lock_mode and sleepmgr_unlock_mode. Refer to sleepmgr_mode for a list of the sleep modes available for locking, and the device datasheet for information on their effect.

The application must supply the file conf_sleepmgr.h.

For the sleep manager to be enabled, the symbol CONFIG_SLEEPMGR_ENABLE must be defined, e.g., in conf_sleepmgr.h. If this symbol is not defined, the functions are replaced with dummy functions and no RAM is used.

Macro Definition Documentation

◆ CONFIG_SLEEPMGR_ENABLE

#define CONFIG_SLEEPMGR_ENABLE

Configuration symbol for enabling the sleep manager.

If this symbol is not defined, the functions of this service are replaced with dummy functions. This is useful for reducing code size and execution time if the sleep manager is not needed in the application.

This symbol may be defined in conf_sleepmgr.h.

Definition at line 40 of file conf_sleepmgr.h.

Enumeration Type Documentation

◆ sleepmgr_mode

Sleep mode locks.

Identifiers for the different sleep mode locks.

Enumerator
SLEEPMGR_ACTIVE 

Active mode.

SLEEPMGR_SLEEP_WFE 

WFE sleep mode. Potential Wake Up sources: fast startup events (USB, RTC, RTT, WKUPs), interrupt, and events.

SLEEPMGR_SLEEP_WFI 

WFI sleep mode. Potential Wake Up sources: fast startup events and interrupt.

SLEEPMGR_WAIT_FAST 

Wait mode, wakeup fast (in 3ms). XTAL is not disabled when sleep. Potential Wake Up sources: fast startup events

SLEEPMGR_WAIT 

Wait mode. Potential Wake Up sources: fast startup events

SLEEPMGR_BACKUP 

Backup mode. Potential Wake Up sources: WKUPs, SM, RTT, RTC.

SLEEPMGR_NR_OF_MODES 

Definition at line 53 of file sam/sleepmgr.h.

Function Documentation

◆ sleepmgr_enter_sleep()

sleepmgr_enter_sleep ( void  )
inlinestatic

Go to sleep in the deepest allowed mode.

Searches through the sleep mode lock counts, starting at the shallowest sleep mode, until the first non-zero lock count is found. The device is then put to sleep in the sleep mode that corresponds to the lock.

Note
This function enables interrupts before going to sleep, and will leave them enabled upon return. This also applies if sleep is skipped due to ACTIVE mode being locked.

Definition at line 235 of file sleepmgr.h.

◆ sleepmgr_get_sleep_mode()

static enum sleepmgr_mode sleepmgr_get_sleep_mode ( void  )
inlinestatic

Retrieves the deepest allowable sleep mode.

Searches through the sleep mode lock counts, starting at the shallowest sleep mode, until the first non-zero lock count is found. The deepest allowable sleep mode is then returned.

Definition at line 200 of file sleepmgr.h.

◆ sleepmgr_init()

static void sleepmgr_init ( void  )
inlinestatic

Initialize the lock counts.

Sets all lock counts to 0, except the very last one, which is set to 1. This is done to simplify the algorithm for finding the deepest allowable sleep mode in sleepmgr_enter_sleep.

Definition at line 117 of file sleepmgr.h.

◆ sleepmgr_lock_mode()

static void sleepmgr_lock_mode ( enum sleepmgr_mode  mode)
inlinestatic

Increase lock count for a sleep mode.

Increases the lock count for mode to ensure that the sleep manager does not put the device to sleep in the deeper sleep modes.

Parameters
modeSleep mode to lock.

Definition at line 137 of file sleepmgr.h.

◆ sleepmgr_unlock_mode()

static void sleepmgr_unlock_mode ( enum sleepmgr_mode  mode)
inlinestatic

Decrease lock count for a sleep mode.

Decreases the lock count for mode. If the lock count reaches 0, the sleep manager can put the device to sleep in the deeper sleep modes.

Parameters
modeSleep mode to unlock.

Definition at line 169 of file sleepmgr.h.



inertial_sense_ros
Author(s):
autogenerated on Sun Feb 28 2021 03:18:00