2013-11-27 16:28:31 +01:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2013 Freie Universität Berlin
|
|
|
|
*
|
2014-08-23 15:43:13 +02:00
|
|
|
* This file is subject to the terms and conditions of the GNU Lesser
|
|
|
|
* General Public License v2.1. See the file LICENSE in the top level
|
|
|
|
* directory for more details.
|
2010-09-22 15:10:42 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
2013-11-27 16:28:31 +01:00
|
|
|
* @defgroup core_lpm Power Management
|
|
|
|
* @ingroup core
|
|
|
|
* @brief The kernels power management interface
|
|
|
|
* @{
|
2010-09-22 15:10:42 +02:00
|
|
|
*
|
2013-11-27 16:28:31 +01:00
|
|
|
* @file lpm.h
|
|
|
|
* @brief Power management interface
|
2010-09-22 15:10:42 +02:00
|
|
|
*
|
|
|
|
* This interface needs to be implemented for each platform.
|
|
|
|
*
|
2013-11-27 16:28:31 +01:00
|
|
|
* @author Freie Universität Berlin, Computer Systems & Telematics
|
2010-09-22 15:10:42 +02:00
|
|
|
*/
|
|
|
|
|
2013-11-27 16:28:31 +01:00
|
|
|
#ifndef LPM_H_
|
|
|
|
#define LPM_H_
|
2010-09-22 15:10:42 +02:00
|
|
|
|
2014-10-09 01:18:16 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2014-03-17 17:59:06 +01:00
|
|
|
#include "arch/lpm_arch.h"
|
2010-09-22 15:10:42 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Initialization of power management (including clock setup)
|
|
|
|
*
|
|
|
|
* This function is invoked once during boot.
|
|
|
|
*/
|
|
|
|
void lpm_init(void);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Switches the MCU to a new power mode
|
|
|
|
* @param[in] target Target power mode
|
2013-12-19 12:35:04 +01:00
|
|
|
* @return The previous power mode
|
2010-09-22 15:10:42 +02:00
|
|
|
*/
|
|
|
|
enum lpm_mode lpm_set(enum lpm_mode target);
|
|
|
|
|
2014-04-01 15:32:36 +02:00
|
|
|
/**
|
|
|
|
* @brief Switches the MCU to active power mode LPM_ON
|
|
|
|
*/
|
2010-09-22 15:10:42 +02:00
|
|
|
void lpm_awake(void);
|
|
|
|
|
2014-04-01 15:32:36 +02:00
|
|
|
/**
|
|
|
|
* @brief Begin to switch MCU to active power mode.
|
|
|
|
*/
|
2010-09-22 15:10:42 +02:00
|
|
|
void lpm_begin_awake(void);
|
2014-04-01 15:32:36 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Finish to switch MCU to active power mode.
|
|
|
|
*/
|
2010-09-22 15:10:42 +02:00
|
|
|
void lpm_end_awake(void);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Returns the current power mode
|
|
|
|
* @return Current power mode
|
|
|
|
*/
|
|
|
|
enum lpm_mode lpm_get(void);
|
|
|
|
|
2014-10-09 01:18:16 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2014-04-01 15:32:36 +02:00
|
|
|
#endif /* __LPM_H_ */
|
2014-03-17 17:59:06 +01:00
|
|
|
/** @} */
|