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... | |
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.
#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.
enum sleepmgr_mode |
Sleep mode locks.
Identifiers for the different sleep mode locks.
Definition at line 53 of file sam/sleepmgr.h.
|
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.
Definition at line 235 of file sleepmgr.h.
|
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.
|
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.
|
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.
mode | Sleep mode to lock. |
Definition at line 137 of file sleepmgr.h.
|
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.
mode | Sleep mode to unlock. |
Definition at line 169 of file sleepmgr.h.