1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
RIOT/core/include/arch/lpm_arch.h
2014-05-26 14:54:23 +02:00

94 lines
2.3 KiB
C

/*
* Copyright (C) 2014 Freie Universität Berlin
*
* This file is subject to the terms and conditions of the GNU Lesser General
* Public License. See the file LICENSE in the top level directory for more
* details.
*/
/**
* @ingroup core_arch
* @{
*
* @file lpm_arch.h
* @brief Architecture dependent interface for power mode management
*
* This file acts as a wrapper between the kernels power management interface and the architecture
* dependent implementation of power management.
*
* @author Hauke Petersen <hauke.petersen@fu-berlin.de>
*/
#ifndef __LPM_ARCH_H
#define __LPM_ARCH_H
/**
* @brief Define the mapping between the architecture independent interfaces
and the kernel internal interfaces
*
* This mapping is done for compatibility of existing platforms,
* new platforms should always use the *_arch_* interfaces.
* @{
*/
#ifdef COREIF_NG
#define lpm_init lpm_arch_init
#define lpm_set lpm_arch_set
#define lpm_get lpm_arch_get
#define lpm_awake lpm_arch_awake
#define lpm_begin_awake lpm_arch_begin_awake
#define lpm_end_awake lpm_arch_end_awake
#endif
/** @} */
/**
* @name Available power modes
*/
enum lpm_mode {
LPM_ON, /**< MCU is active */
LPM_IDLE, /**< MCU is idle */
LPM_SLEEP, /**< MCU in sleep mode */
LPM_POWERDOWN, /**< MCU is powered down */
LPM_OFF, /**< MCU is off */
LPM_UNKNOWN = -1 /**< status unknown/unavailable */
};
/**
* @brief Initialize the controller power management
*/
void lpm_arch_init(void);
/**
* @brief Try to set the controller to a given power mode
*
* @param[in] target the desired power mode
*
* @return the power mode that was actually set
*/
enum lpm_mode lpm_arch_set(enum lpm_mode target);
/**
* @brief Get the controller's current power mode
*
* @return the power mode the controller is currently in
*/
enum lpm_mode lpm_arch_get(void);
/**
* @brief Wakeup the controller from a low-power sleep mode
*/
void lpm_arch_awake(void);
/**
* @brief This hook is called on the beginning of a wake-up phase
*/
void lpm_arch_begin_awake(void);
/**
* @brief This hook is called on the end of a wake-up phase
*/
void lpm_arch_end_awake(void);
#endif /* __LPM_ARCH_H */
/** @} */