
44 changed files with 12 additions and 2189 deletions
@ -1,53 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2014 René Kijewski <rene.kijewski@fu-berlin.de> |
||||
* |
||||
* 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. |
||||
*/ |
||||
|
||||
/**
|
||||
* @ingroup boards_qemu-i386 |
||||
* @{ |
||||
* |
||||
* @file |
||||
* @brief Low-power mode emulation for qemu-i386. |
||||
* |
||||
* @author René Kijewski <rene.kijewski@fu-berlin.de> |
||||
* |
||||
* @} |
||||
*/ |
||||
|
||||
#include "lpm.h" |
||||
#include "x86_reboot.h" |
||||
|
||||
void lpm_init(void) |
||||
{ |
||||
/* void */ |
||||
} |
||||
|
||||
enum lpm_mode lpm_set(enum lpm_mode target) |
||||
{ |
||||
if (target != LPM_ON) { |
||||
if (target == LPM_POWERDOWN) { |
||||
x86_shutdown(); |
||||
} |
||||
__asm__ volatile ("hlt"); |
||||
} |
||||
return LPM_UNKNOWN; |
||||
} |
||||
|
||||
void lpm_awake(void) |
||||
{ |
||||
/* void */ |
||||
} |
||||
|
||||
void lpm_begin_awake(void) |
||||
{ |
||||
/* void */ |
||||
} |
||||
|
||||
void lpm_end_awake(void) |
||||
{ |
||||
/* void */ |
||||
} |
@ -1,100 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Freie Universität Berlin |
||||
* |
||||
* 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. |
||||
*/ |
||||
|
||||
/**
|
||||
* @ingroup core_arch |
||||
* @{ |
||||
* |
||||
* @file |
||||
* @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 |
||||
|
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
|
||||
/**
|
||||
* @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); |
||||
|
||||
#ifdef __cplusplus |
||||
} |
||||
#endif |
||||
|
||||
#endif /* LPM_ARCH_H */ |
||||
/** @} */ |
@ -1,77 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2013 Freie Universität Berlin |
||||
* |
||||
* 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. |
||||
*/ |
||||
|
||||
/**
|
||||
* @defgroup core_lpm Power Management |
||||
* @ingroup core |
||||
* @brief The kernels power management interface |
||||
* @{ |
||||
* |
||||
* @file |
||||
* @brief Power management interface |
||||
* |
||||
* This interface needs to be implemented for each platform. |
||||
* |
||||
* @author Freie Universität Berlin, Computer Systems & Telematics |
||||
*/ |
||||
|
||||
#ifndef LPM_H_ |
||||
#define LPM_H_ |
||||
|
||||
#include "arch/lpm_arch.h" |
||||
|
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
|
||||
/**
|
||||
* @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 |
||||
* @return The previous power mode |
||||
*/ |
||||
enum lpm_mode lpm_set(enum lpm_mode target); |
||||
|
||||
/**
|
||||
* @brief Switches the MCU to active power mode LPM_ON |
||||
*/ |
||||
void lpm_awake(void); |
||||
|
||||
/**
|
||||
* @brief Begin to switch MCU to active power mode. |
||||
*/ |
||||
void lpm_begin_awake(void); |
||||
|
||||
/**
|
||||
* @brief Finish to switch MCU to active power mode. |
||||
*/ |
||||
void lpm_end_awake(void); |
||||
|
||||
/**
|
||||
* @brief Returns the current power mode |
||||
* @return Current power mode |
||||
*/ |
||||
enum lpm_mode lpm_get(void); |
||||
|
||||
/**
|
||||
* @brief LPM-internal variable |
||||
*/ |
||||
extern volatile int lpm_prevent_sleep; |
||||
|
||||
#ifdef __cplusplus |
||||
} |
||||
#endif |
||||
|
||||
#endif /* __LPM_H_ */ |
||||
/** @} */ |
@ -1,54 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Freie Universität Berlin, Hinnerk van Bruinehsen |
||||
* |
||||
* 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. |
||||
*/ |
||||
|
||||
/**
|
||||
* @ingroup cpu_atmega1281 |
||||
* @{ |
||||
* |
||||
* @file |
||||
* @brief Implementation of the kernels power management interface |
||||
* |
||||
* @author Hinnerk van Bruinehsen <h.v.bruinehsen@fu-berlin.de> |
||||
* |
||||
* @} |
||||
*/ |
||||
|
||||
#include "arch/lpm_arch.h" |
||||
|
||||
void lpm_arch_init(void) |
||||
{ |
||||
/* TODO */ |
||||
} |
||||
|
||||
enum lpm_mode lpm_arch_set(enum lpm_mode target) |
||||
{ |
||||
(void) target; |
||||
/* TODO */ |
||||
return 0; |
||||
} |
||||
|
||||
enum lpm_mode lpm_arch_get(void) |
||||
{ |
||||
/* TODO */ |
||||
return 0; |
||||
} |
||||
|
||||
void lpm_arch_awake(void) |
||||
{ |
||||
/* TODO */ |
||||
} |
||||
|
||||
void lpm_arch_begin_awake(void) |
||||
{ |
||||
/* TODO */ |
||||
} |
||||
|
||||
void lpm_arch_end_awake(void) |
||||
{ |
||||
/* TODO */ |
||||
} |
@ -1,54 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Freie Universität Berlin, Hinnerk van Bruinehsen |
||||
* |
||||
* 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. |
||||
*/ |
||||
|
||||
/**
|
||||
* @ingroup cpu_atmega2560 |
||||
* @{ |
||||
* |
||||
* @file |
||||
* @brief Implementation of the kernels power management interface |
||||
* |
||||
* @author Hinnerk van Bruinehsen <h.v.bruinehsen@fu-berlin.de> |
||||
* |
||||
* @} |
||||
*/ |
||||
|
||||
#include "arch/lpm_arch.h" |
||||
|
||||
void lpm_arch_init(void) |
||||
{ |
||||
/* TODO */ |
||||
} |
||||
|
||||
enum lpm_mode lpm_arch_set(enum lpm_mode target) |
||||
{ |
||||
(void) target; |
||||
/* TODO */ |
||||
return 0; |
||||
} |
||||
|
||||
enum lpm_mode lpm_arch_get(void) |
||||
{ |
||||
/* TODO */ |
||||
return 0; |
||||
} |
||||
|
||||
void lpm_arch_awake(void) |
||||
{ |
||||
/* TODO */ |
||||
} |
||||
|
||||
void lpm_arch_begin_awake(void) |
||||
{ |
||||
/* TODO */ |
||||
} |
||||
|
||||
void lpm_arch_end_awake(void) |
||||
{ |
||||
/* TODO */ |
||||
} |
@ -1,54 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Freie Universität Berlin, Hinnerk van Bruinehsen |
||||
* |
||||
* 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. |
||||
*/ |
||||
|
||||
/**
|
||||
* @ingroup cpu_atmega328p |
||||
* @{ |
||||
* |
||||
* @file |
||||
* @brief Implementation of the kernels power management interface |
||||
* |
||||
* @author Hinnerk van Bruinehsen <h.v.bruinehsen@fu-berlin.de> |
||||
* |
||||
* @} |
||||
*/ |
||||
|
||||
#include "arch/lpm_arch.h" |
||||
|
||||
void lpm_arch_init(void) |
||||
{ |
||||
/* TODO */ |
||||
} |
||||
|
||||
enum lpm_mode lpm_arch_set(enum lpm_mode target) |
||||
{ |
||||
(void) target; |
||||
/* TODO */ |
||||
return 0; |
||||
} |
||||
|
||||
enum lpm_mode lpm_arch_get(void) |
||||
{ |
||||
/* TODO */ |
||||
return 0; |
||||
} |
||||
|
||||
void lpm_arch_awake(void) |
||||
{ |
||||
/* TODO */ |
||||
} |
||||
|
||||
void lpm_arch_begin_awake(void) |
||||
{ |
||||
/* TODO */ |
||||
} |
||||
|
||||
void lpm_arch_end_awake(void) |
||||
{ |
||||
/* TODO */ |
||||
} |
@ -1,48 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Loci Controls Inc. |
||||
* |
||||
* 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. |
||||
*/ |
||||
|
||||
/**
|
||||
* @ingroup cpu_cc2538 |
||||
* @{ |
||||
* |
||||
* @file |
||||
* @brief Implementation of the kernels power management interface |
||||
* |
||||
* @author Ian Martin <ian@locicontrols.com> |
||||
* |
||||
* @} |
||||
*/ |
||||
|
||||
#include "arch/lpm_arch.h" |
||||
|
||||
void lpm_arch_init(void) |
||||
{ |
||||
} |
||||
|
||||
enum lpm_mode lpm_arch_set(enum lpm_mode target) |
||||
{ |
||||
(void) target; |
||||
return 0; |
||||
} |
||||
|
||||
enum lpm_mode lpm_arch_get(void) |
||||
{ |
||||
return 0; |
||||
} |
||||
|
||||
void lpm_arch_awake(void) |
||||
{ |
||||
} |
||||
|
||||
void lpm_arch_begin_awake(void) |
||||
{ |
||||
} |
||||
|
||||
void lpm_arch_end_awake(void) |
||||
{ |
||||
} |
@ -1,45 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2016 Leon George |
||||
* |
||||
* 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. |
||||
*/ |
||||
|
||||
/**
|
||||
* @ingroup cpu_cc26x0 |
||||
* @{ |
||||
* |
||||
* @file |
||||
* @brief implementation of the kernels power management interface |
||||
* |
||||
* @} |
||||
*/ |
||||
|
||||
#include "arch/lpm_arch.h" |
||||
|
||||
void lpm_arch_init(void) |
||||
{ |
||||
} |
||||
|
||||
enum lpm_mode lpm_arch_set(enum lpm_mode target) |
||||
{ |
||||
return 0; |
||||
} |
||||
|
||||
enum lpm_mode lpm_arch_get(void) |
||||
{ |
||||
return 0; |
||||
} |
||||
|
||||
void lpm_arch_awake(void) |
||||
{ |
||||
} |
||||
|
||||
void lpm_arch_begin_awake(void) |
||||
{ |
||||
} |
||||
|
||||
void lpm_arch_end_awake(void) |
||||
{ |
||||
} |
@ -1,53 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2015 Freie Universität Berlin |
||||
* |
||||
* 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. |
||||
*/ |
||||
|
||||
/**
|
||||
* @ingroup cpu_ezr32wg |
||||
* @{ |
||||
* |
||||
* @file |
||||
* @brief Implementation of the kernels power management interface |
||||
* |
||||
* @author Hauke Petersen <hauke.peterse@fu-berlin.de> |
||||
* |
||||
* @} |
||||
*/ |
||||
|
||||
#include "arch/lpm_arch.h" |
||||
|
||||
void lpm_arch_init(void) |
||||
{ |
||||
/* TODO */ |
||||
} |
||||
|
||||
enum lpm_mode lpm_arch_set(enum lpm_mode target) |
||||
{ |
||||
/* TODO */ |
||||
return 0; |
||||
} |
||||
|
||||
enum lpm_mode lpm_arch_get(void) |
||||
{ |
||||
/* TODO */ |
||||
return 0; |
||||
} |
||||
|
||||
void lpm_arch_awake(void) |
||||
{ |
||||
/* TODO */ |
||||
} |
||||
|
||||
void lpm_arch_begin_awake(void) |
||||
{ |
||||
/* TODO */ |
||||
} |
||||
|
||||
void lpm_arch_end_awake(void) |
||||
{ |
||||
/* TODO */ |
||||
} |
@ -1,81 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Eistec AB |
||||
* |
||||
* 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. |
||||
*/ |
||||
|
||||
/**
|
||||
* @ingroup cpu_k60 |
||||
* @{ |
||||
* |
||||
* @file |
||||
* @brief Implementation of the kernel's power management interface |
||||
* |
||||
* @author Joakim Nohlgård <joakim.nohlgard@eistec.se> |
||||
* |
||||
* @} |
||||
*/ |
||||
|
||||
#include "cpu.h" |
||||
#include "arch/lpm_arch.h" |
||||
|
||||
static inline void wait(void) |
||||
{ |
||||
/* Clear the SLEEPDEEP bit to make sure we go into WAIT (sleep) mode instead
|
||||
* of deep sleep. |
||||
*/ |
||||
SCB->SCR &= ~SCB_SCR_SLEEPDEEP_Msk; |
||||
|
||||
/* WFI instruction will start entry into WAIT mode */ |
||||
__WFI(); |
||||
} |
||||
|
||||
void lpm_arch_init(void) |
||||
{ |
||||
/* Stub waiting for https://github.com/RIOT-OS/RIOT/pull/2605 */ |
||||
} |
||||
|
||||
enum lpm_mode lpm_arch_set(enum lpm_mode target) |
||||
{ |
||||
switch (target) { |
||||
case LPM_ON: |
||||
/* MCU is active, do not go to low power */ |
||||
break; |
||||
|
||||
case LPM_IDLE: |
||||
case LPM_SLEEP: |
||||
case LPM_POWERDOWN: |
||||
case LPM_OFF: |
||||
wait(); |
||||
break; |
||||
|
||||
case LPM_UNKNOWN: |
||||
default: |
||||
break; |
||||
} |
||||
|
||||
return 0; |
||||
} |
||||
|
||||
enum lpm_mode lpm_arch_get(void) |
||||
{ |
||||
/* TODO */ |
||||
return LPM_ON; |
||||
} |
||||
|
||||
void lpm_arch_awake(void) |
||||
{ |
||||
/* TODO */ |
||||
} |
||||
|
||||
void lpm_arch_begin_awake(void) |
||||
{ |
||||
/* TODO */ |
||||
} |
||||
|
||||
void lpm_arch_end_awake(void) |
||||
{ |
||||
/* TODO */ |
||||
} |
@ -1,53 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Freie Universität Berlin |
||||
* |
||||
* 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. |
||||
*/ |
||||
|
||||
/**
|
||||
* @ingroup cpu_k64f |
||||
* @{ |
||||
* |
||||
* @file |
||||
* @brief Implementation of the kernels power management interface |
||||
* |
||||
* @author Hauke Petersen <hauke.petersen@fu-berlin.de> |
||||
* |
||||
* @} |
||||
*/ |
||||
|
||||
#include "arch/lpm_arch.h" |
||||
|
||||
void lpm_arch_init(void) |
||||
{ |
||||
/* TODO */ |
||||
} |
||||
|
||||
enum lpm_mode lpm_arch_set(enum lpm_mode target) |
||||
{ |
||||
/* TODO */ |
||||
return 0; |
||||
} |
||||
|
||||
enum lpm_mode lpm_arch_get(void) |
||||
{ |
||||
/* TODO */ |
||||
return 0; |
||||
} |
||||
|
||||
void lpm_arch_awake(void) |
||||
{ |
||||
/* TODO */ |
||||
} |
||||
|
||||
void lpm_arch_begin_awake(void) |
||||
{ |
||||
/* TODO */ |
||||
} |
||||
|
||||
void lpm_arch_end_awake(void) |
||||
{ |
||||
/* TODO */ |
||||
} |
@ -1,53 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Freie Universität Berlin |
||||
* |
||||
* 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. |
||||
*/ |
||||
|
||||
/**
|
||||
* @ingroup cpu_kw2x |
||||
* @{ |
||||
* |
||||
* @file |
||||
* @brief Implementation of the kernels power management interface |
||||
* |
||||
* @author Hauke Petersen <hauke.petersen@fu-berlin.de> |
||||
* |
||||
* @} |
||||
*/ |
||||
|
||||
#include "arch/lpm_arch.h" |
||||
|
||||
void lpm_arch_init(void) |
||||
{ |
||||
/* TODO */ |
||||
} |
||||
|
||||
enum lpm_mode lpm_arch_set(enum lpm_mode target) |
||||
{ |
||||
/* TODO */ |
||||
return 0; |
||||
} |
||||
|
||||
enum lpm_mode lpm_arch_get(void) |
||||
{ |
||||
/* TODO */ |
||||
return 0; |
||||
} |
||||
|
||||
void lpm_arch_awake(void) |
||||
{ |
||||
/* TODO */ |
||||
} |
||||
|
||||
void lpm_arch_begin_awake(void) |
||||
{ |
||||
/* TODO */ |
||||
} |
||||
|
||||
void lpm_arch_end_awake(void) |
||||
{ |
||||
/* TODO */ |
||||
} |
@ -1,53 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2015 Rakendra Thapa <rakendrathapa@gmail.com |
||||
* |
||||
* 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. |
||||
*/ |
||||
|
||||
/**
|
||||
* @ingroup cpu_lm4f120 |
||||
* @{ |
||||
* |
||||
* @file lpm_arch.c |
||||
* @brief Implementation of the kernels power management interface |
||||
* |
||||
* @author Rakendra Thapa <rakendrathapa@gmail.com> |
||||
*/ |
||||
|
||||
#include "cpu.h" |
||||
#include "arch/lpm_arch.h" |
||||
|
||||
void lpm_arch_init(void) |
||||
{ |
||||
/* TODO */ |
||||
} |
||||
|
||||
enum lpm_mode lpm_arch_set(enum lpm_mode target) |
||||
{ |
||||
/* TODO */ |
||||
return 0; |
||||
} |
||||
|
||||
enum lpm_mode lpm_arch_get(void) |
||||
{ |
||||
/* TODO */ |
||||
return 0; |
||||
} |
||||
|
||||
void lpm_arch_awake(void) |
||||
{ |
||||
/* TODO*/ |
||||
} |
||||
|
||||
void lpm_arch_begin_awake(void) |
||||
{ |
||||
/* TODO */ |
||||
} |
||||
|
||||
void lpm_arch_end_awake(void) |
||||
{ |
||||
/* TODO */ |
||||
} |
||||
/** @} */ |
@ -1,54 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2015 Freie Universität Berlin |
||||
* |
||||
* 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. |
||||
*/ |
||||
|
||||
/**
|
||||
* @ingroup cpu_lpc11u34 |
||||
* @{ |
||||
* |
||||
* @file |
||||
* @brief Implementation of the kernels power management interface |
||||
* |
||||
* @author Paul RATHGEB <paul.rathgeb@skynet.be> |
||||
* |
||||
* @} |
||||
*/ |
||||
|
||||
#include "cpu.h" |
||||
#include "arch/lpm_arch.h" |
||||
|
||||
void lpm_arch_init(void) |
||||
{ |
||||
/* TODO */ |
||||
} |
||||
|
||||
enum lpm_mode lpm_arch_set(enum lpm_mode target) |
||||
{ |
||||
/* TODO */ |
||||
return 0; |
||||
} |
||||
|
||||
enum lpm_mode lpm_arch_get(void) |
||||
{ |
||||
/* TODO */ |
||||
return 0; |
||||
} |
||||
|
||||
void lpm_arch_awake(void) |
||||
{ |
||||
/* TODO*/ |
||||
} |
||||
|
||||
void lpm_arch_begin_awake(void) |
||||
{ |
||||
/* TODO */ |
||||
} |
||||
|
||||
void lpm_arch_end_awake(void) |
||||
{ |
||||
/* TODO */ |
||||
} |
@ -1,54 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Freie Universität Berlin |
||||
* |
||||
* 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. |
||||
*/ |
||||
|
||||
/**
|
||||
* @ingroup cpu_lpc1768 |
||||
* @{ |
||||
* |
||||
* @file |
||||
* @brief Implementation of the kernels power management interface |
||||
* |
||||
* @author Hauke Petersen <hauke.petersen@fu-berlin.de> |
||||
* |
||||
* @} |
||||
*/ |
||||
|
||||
#include "cpu.h" |
||||
#include "arch/lpm_arch.h" |
||||
|
||||
void lpm_arch_init(void) |
||||
{ |
||||
/* TODO */ |
||||
} |
||||
|
||||
enum lpm_mode lpm_arch_set(enum lpm_mode target) |
||||
{ |
||||
/* TODO */ |
||||
return 0; |
||||
} |
||||
|
||||
enum lpm_mode lpm_arch_get(void) |
||||
{ |
||||
/* TODO */ |
||||
return 0; |
||||
} |
||||
|
||||
void lpm_arch_awake(void) |
||||
{ |
||||
/* TODO*/ |
||||
} |
||||
|
||||
void lpm_arch_begin_awake(void) |
||||
{ |
||||
/* TODO */ |
||||
} |
||||
|
||||
void lpm_arch_end_awake(void) |
||||
{ |
||||
/* TODO */ |
||||
} |
@ -1,118 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2013, Freie Universitaet Berlin (FUB). All rights reserved. |
||||
* |
||||
* 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. |
||||
*/ |
||||
|
||||
/**
|
||||
* @ingroup lpc2387 |
||||
* @ingroup lpm |
||||
* @{ |
||||
*/ |
||||
|
||||
/**
|
||||
* @file |
||||
* @brief LPC2387 Low-Power management |
||||
* @ingroup lpc2387 |
||||
* |
||||
* @author Heiko Will |
||||
* @version $Revision$ |
||||
* |
||||
* @note $Id$ |
||||
*/ |
||||
|
||||
#include <stdio.h> |
||||
#include <stdint.h> |
||||
#include "lpc23xx.h" |
||||
#include "lpc2387.h" |
||||
#include "lpm.h" |
||||
|
||||
/* lpm is accessed before memory init and initialized separately through code */ |
||||
__attribute__((section(".noinit"))) |
||||
static enum lpm_mode lpm; |
||||
|
||||
extern void init_clks1(void); |
||||
extern void init_clks2(void); |
||||
|
||||
#define ENABLE_DEBUG (0) |
||||
#include "debug.h" |
||||
|
||||
void lpm_init(void) |
||||
{ |
||||
lpm = LPM_ON; |
||||
} |
||||
|
||||
#define LPM_DEBUG (1) |
||||
|
||||
void lpm_begin_awake(void) |
||||
{ |
||||
if (lpm >= LPM_SLEEP) { // wake up from deep sleep
|
||||
init_clks1(); |
||||
} |
||||
} |
||||
|
||||
void lpm_end_awake(void) |
||||
{ |
||||
if (lpm >= LPM_SLEEP) { // wake up from deep sleep
|
||||
init_clks2(); |
||||
} |
||||
|
||||
lpm = LPM_ON; |
||||
} |
||||
|
||||
void lpm_awake(void) |
||||
{ |
||||
#if LPM_DEBUG |
||||
unsigned long usec = RTC_CTC; |
||||
#endif |
||||
|
||||
if (lpm >= LPM_SLEEP) { // wake up from deep sleep
|
||||
/* benchmark */ |
||||
init_clks1(); |
||||
init_clks2(); |
||||
/* Debug tests */ |
||||
#if LPM_DEBUG |
||||
usec = RTC_CTC - usec; |
||||
DEBUG("Wakeup in %lu usecs\n", usec * 31); |
||||
#endif |
||||
} |
||||
|
||||
lpm = LPM_ON; |
||||
} |
||||
|
||||
enum lpm_mode lpm_set(enum lpm_mode target) |
||||
{ |
||||
unsigned target_flags; |
||||
enum lpm_mode last_lpm = lpm; |
||||
|
||||
/* calculate target mcu power mode */ |
||||
if (target == LPM_IDLE) { |
||||
target_flags = PM_IDLE; |
||||
} |
||||
else if (target == LPM_SLEEP) { |
||||
target_flags = PM_SLEEP; |
||||
} |
||||
else if (target == LPM_POWERDOWN) { |
||||
target_flags = PM_POWERDOWN; |
||||
} |
||||
else { |
||||
target_flags = 0; |
||||
} |
||||
|
||||
lpm = target; |
||||
|
||||
DEBUG("# LPM power down %u -> %u\n", lpm, target); |
||||
|
||||
PCON |= target_flags; // set target power mode
|
||||
return last_lpm; |
||||
} |
||||
/*---------------------------------------------------------------------------*/ |
||||
enum lpm_mode |
||||
lpm_get(void) |
||||
{ |
||||
return lpm; |
||||
} |
||||
/*---------------------------------------------------------------------------*/ |
||||
/** @} */ |
@ -1,128 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Freie Universität Berlin |
||||
* |
||||
* 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. |
||||
*/ |
||||
|
||||
/**
|
||||
* @ingroup cpu |
||||
* @{ |
||||
* |
||||
* @file |
||||
* @brief low-power mode implementation for MSP430 MCUs |
||||
* |
||||
* @author Kévin Roussel <Kevin.Roussel@inria.fr> |
||||
* @author Ludwig Knüpfer <ludwig.knuepfer@fu-berlin.de> |
||||
* @author Thomas Eichinger <thomas.eichinger@fu-berlin.de> |
||||
* |
||||
* @} |
||||
*/ |
||||
|
||||
#include <assert.h> |
||||
#include <stdio.h> |
||||
#if (__GNUC__ >= 4) && (__GNUC_MINOR__ > 5) |
||||
#include <intrinsics.h> // MSP430-gcc compiler instrinsics |
||||
#endif |
||||
|
||||
#include "board.h" |
||||
#include <msp430.h> |
||||
|
||||
#include "lpm.h" |
||||
|
||||
/* Initialise the MSP430 power-saving mechanisms. */ |
||||
void lpm_init(void) |
||||
{ |
||||
/* nothing to initialize on MSP430s: everything is done by fiddling
|
||||
with 4 bits of the status register (SR). */ |
||||
|
||||
/* just ensure MCU is fully up and running at start */ |
||||
lpm_awake(); |
||||
} |
||||
|
||||
/* Change the current power-saving mode. */ |
||||
enum lpm_mode lpm_set(enum lpm_mode target) |
||||
{ |
||||
enum lpm_mode last_mode = lpm_get(); |
||||
|
||||
/* ensure that interrupts are enabled before going to sleep,
|
||||
or we're bound to hang our MCU! */ |
||||
assert((target == LPM_ON) || (__read_status_register() & GIE)); |
||||
|
||||
switch (target) { |
||||
case LPM_ON: |
||||
/* fully running MCU */ |
||||
__bic_status_register(CPUOFF | OSCOFF | SCG0 | SCG1); |
||||
break; |
||||
case LPM_IDLE: |
||||
/* lightest mode => LPM0 mode of MSP430 */ |
||||
__bic_status_register(OSCOFF | SCG0 | SCG1); |
||||
/* only stops CPU block */ |
||||
__bis_status_register(CPUOFF); |
||||
break; |
||||
case LPM_SLEEP: |
||||
/* mid-level mode => LPM1 mode of MSP430 */ |
||||
__bic_status_register(OSCOFF | SCG1); |
||||
/* stops CPU and master clock blocks */ |
||||
__bis_status_register(CPUOFF | SCG0); |
||||
break; |
||||
case LPM_POWERDOWN: |
||||
/* deep-level mode => LPM3 mode of MSP430 */ |
||||
__bic_status_register(OSCOFF); |
||||
/* stops all blocks except auxiliary clock (timers) */ |
||||
__bis_status_register(CPUOFF | SCG0 | SCG1); |
||||
break; |
||||
case LPM_OFF: |
||||
/* MCU totally down (LPM4), only RESET or NMI can resume execution */ |
||||
__bis_status_register(CPUOFF | OSCOFF | SCG0 | SCG1); |
||||
/* all blocks off */ |
||||
break; |
||||
default: |
||||
assert(0); /* abort if NDEBUG is not defined */ |
||||
break; |
||||
} |
||||
|
||||
return last_mode; |
||||
} |
||||
|
||||
#define LPM_MASK_SR (CPUOFF | OSCOFF | SCG0 | SCG1) |
||||
|
||||
/* Return the current LPM mode of the MSP430 MCU. */ |
||||
enum lpm_mode lpm_get(void) |
||||
{ |
||||
enum lpm_mode current_mode = LPM_UNKNOWN; |
||||
|
||||
unsigned int current_sr = __read_status_register(); |
||||
switch (current_sr & LPM_MASK_SR) { |
||||
case CPUOFF + OSCOFF + SCG0 + SCG1: /* MSP430's LPM4 */ |
||||
current_mode = LPM_OFF; |
||||
break; |
||||
case CPUOFF + SCG0 + SCG1: /* MSP430's LPM3 */ |
||||
case CPUOFF + SCG1: /* MSP430's LPM2 */ |
||||
current_mode = LPM_POWERDOWN; |
||||
break; |
||||
case CPUOFF + SCG0: /* MSP430's LPM1 */ |
||||
current_mode = LPM_SLEEP; |
||||
break; |
||||
case CPUOFF: /* MSP430's LPM1 */ |
||||
current_mode = LPM_IDLE; |
||||
break; |
||||
case 0: /* MSP430 active */ |
||||
current_mode = LPM_ON; |
||||
break; |
||||
} |
||||
|
||||
return current_mode; |
||||
} |
||||
|
||||
/* resume the MSP430 MCU */ |
||||
inline void lpm_awake(void) |
||||
{ |
||||
/* disable all power savings mechanisms */ |
||||
__bic_status_register(CPUOFF | OSCOFF | SCG0 | SCG1); |
||||
} |
||||
|
||||
/* the following two functions have no actual role to play MSP430s */ |
||||
inline void lpm_begin_awake(void) { } |
||||
inline void lpm_end_awake(void) { } |
@ -1,123 +0,0 @@
|
||||
/**
|
||||
* Native CPU lpm.h implementation |
||||
* |
||||
* Uses system calls to emulate CPU power modes. |
||||
* |
||||
* Copyright (C) 2013 Ludwig Knüpfer <ludwig.knuepfer@fu-berlin.de> |
||||
* |
||||
* 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. |
||||
* |
||||
* @ingroup lpm |
||||
* @ingroup native_cpu |
||||
|