1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

remove obsolete lpm code

This commit is contained in:
Kaspar Schleiser 2017-01-09 17:07:03 +01:00
parent 280a200377
commit 0194091673
44 changed files with 12 additions and 2189 deletions

View File

@ -29,7 +29,6 @@
#include "lpc23xx.h" /* LPC23XX/24xx Peripheral Registers */
#include "cpu.h"
#include "lpm.h"
#include "VIC.h"
#include "ssp0-board.h"
#include "smb380-board.h"
@ -142,8 +141,6 @@ uint8_t SMB380_HystereseFunctionSample(int16_t *value)
static void SMB380_simple_interrupthandler(void)
{
lpm_awake();
SMB380_getAcceleration(SMB380_X_AXIS, NULL, &simple_buffer[0]);
SMB380_getAcceleration(SMB380_Y_AXIS, NULL, &simple_buffer[1]);
SMB380_getAcceleration(SMB380_Z_AXIS, NULL, &simple_buffer[2]);
@ -249,8 +246,6 @@ static void SMB380_extIntHandler(void)
{
int16_t accInt[4];
lpm_awake(); //initializes clock
SMB380_getAcceleration(SMB380_X_AXIS, NULL, &accInt[0]);
SMB380_getAcceleration(SMB380_Y_AXIS, NULL, &accInt[1]);
SMB380_getAcceleration(SMB380_Z_AXIS, NULL, &accInt[2]);
@ -1021,7 +1016,6 @@ void SMB380_enableNewDataInt(void)
* prevent deep sleep, reason: 400 µs wake-up time is to long for 3kHz
* interrupts
*/
SETBIT(lpm_prevent_sleep, LPM_PREVENT_SLEEP_ACCSENSOR);
SMB380_Prepare();
SMB380_ssp_write(SMB380_CONTROL4, 0, SMB380_READ_REGISTER);
uReg = SMB380_ssp_read();
@ -1050,7 +1044,6 @@ void SMB380_disableNewDataInt(void)
* enable deep sleep, reason: 400 µs wake-up time was to long for 3kHz
* interrupts
*/
CLRBIT(lpm_prevent_sleep, LPM_PREVENT_SLEEP_ACCSENSOR);
irq_restore(cpsr);
}

View File

@ -29,7 +29,6 @@
//#include "mma7455l-board.h"
#include "gpioint.h"
#include <stdio.h>
#include "lpm.h"
//uint16_t sampleRateMMA7455L;
//uint16_t interruptTicksMMA7455L;

View File

@ -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 */
}

View File

@ -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 */
/** @} */

View File

@ -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_ */
/** @} */

View File

@ -1,5 +1,6 @@
/*
* Copyright (C) 2013 Freie Universität Berlin
* Copyright (C) 2016 Kaspar Schleiser <kaspar@schleiser.de>
* 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
@ -24,7 +25,6 @@
#include "kernel_init.h"
#include "sched.h"
#include "thread.h"
#include "lpm.h"
#include "irq.h"
#include "log.h"
@ -39,8 +39,6 @@
#include <auto_init.h>
#endif
volatile int lpm_prevent_sleep = 0;
extern int main(void);
static void *main_trampoline(void *arg)
{
@ -66,14 +64,6 @@ static void *idle_thread(void *arg)
(void) arg;
while (1) {
if (lpm_prevent_sleep) {
lpm_set(LPM_IDLE);
}
else {
lpm_set(LPM_IDLE);
/* lpm_set(LPM_SLEEP); */
/* lpm_set(LPM_POWERDOWN); */
}
}
return NULL;

View File

@ -28,7 +28,6 @@
#include "kernel_defines.h"
#include "cpu.h"
#include "irq.h"
#include "lpm.h"
#include "panic.h"
#include "arch/panic_arch.h"
#include "reboot.h"

View File

@ -17,14 +17,10 @@
* @author Oliver Hahm <oliver.hahm@inria.fr>
*/
#include "lpm.h"
void panic_arch(void)
{
#ifdef DEVELHELP
/* enter infinite loop, into deepest possible sleep mode */
while (1) {
lpm_set(LPM_OFF);
}
// TODO
#endif
}

View File

@ -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 */
}

View File

@ -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 */
}

View File

@ -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 */
}

View File

@ -17,16 +17,13 @@
*/
#include <avr/wdt.h>
#include "lpm.h"
void panic_arch(void)
{
wdt_disable();
#ifdef DEVELHELP
/* enter infinite loop, into deepest possible sleep mode */
while (1) {
lpm_set(LPM_OFF);
}
// TODO
#endif
}

View File

@ -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)
{
}

View File

@ -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)
{
}

View File

@ -21,7 +21,6 @@
*/
#include "cpu.h"
#include "lpm.h"
#include "log.h"
#ifdef DEVELHELP
@ -42,9 +41,9 @@ void panic_arch(void)
print_ipsr();
/* The bkpt instruction will signal to the debugger to break here. */
__asm__("bkpt #0");
/* enter infinite loop, into deepest possible sleep mode */
while (1) {
lpm_set(LPM_OFF);
}
#endif
/* turn off device if possible */
// TODO
while (1) { }
}

View File

@ -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 */
}

View File

@ -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 */
}

View File

@ -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 */
}

View File

@ -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 */
}

View File

@ -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 */
}
/** @} */

View File

@ -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 */
}

View File

@ -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 */
}

View File

@ -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;
}
/*---------------------------------------------------------------------------*/
/** @} */

View File

@ -17,7 +17,6 @@
#include "periph/rtc.h"
#include "VIC.h"
#include "lpc2387.h"
#include "lpm.h"
#define ENABLE_DEBUG (0)
#include "debug.h"
@ -164,8 +163,6 @@ void rtc_poweroff(void)
void RTC_IRQHandler(void)
{
lpm_begin_awake();
if (RTC_ILR & ILR_RTSSF) {
/* sub second interrupt (does not need flag-clearing) */
}
@ -179,7 +176,6 @@ void RTC_IRQHandler(void)
_cb(_cb_arg);
}
DEBUG("Ring\n");
lpm_end_awake();
}
VICVectAddr = 0; /* Acknowledge Interrupt */

View File

@ -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) { }

View File

@ -112,7 +112,6 @@ void msp430_cpu_init(void)
{
irq_disable();
init_ports();
// lpm_init();
irq_enable();
if ((uintptr_t)cur_break & 1) { /* Workaround for msp430-ld bug!*/

View File

@ -18,7 +18,6 @@
*/
#include "cpu.h"
#include "lpm.h"
void panic_arch(void)
{
@ -26,9 +25,6 @@ void panic_arch(void)
WDTCTL = WDTPW | WDTHOLD;
#ifdef DEVELHELP
/* enter infinite loop, into deepest possible sleep mode */
while (1) {
lpm_set(LPM_OFF);
}
// TODO
#endif
}

View File

@ -38,8 +38,6 @@
#include "irq.h"
#include "cpu.h"
#include "lpm.h"
#include "native_internal.h"
#define ENABLE_DEBUG (0)
@ -448,7 +446,7 @@ static void native_shutdown(int sig, siginfo_t *info, void *context)
(void)info;
(void)context;
lpm_set(LPM_OFF);
// TODO: poweroff
}
/**

View File

@ -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
* @{
* @file
* @author Ludwig Knüpfer <ludwig.knuepfer@fu-berlin.de>
* @}
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <err.h>
#include "lpm.h"
#include "debug.h"
#include "cpu.h"
#include "native_internal.h"
static enum lpm_mode native_lpm;
void lpm_init(void)
{
DEBUG("lpm_init()\n");
native_lpm = LPM_ON;
return;
}
void _native_lpm_sleep(void)
{
_native_in_syscall++; // no switching here
real_pause();
_native_in_syscall--;
if (_native_sigpend > 0) {
DEBUG("\n\n\t\treturn from syscall, calling native_irq_handler\n\n");
_native_in_syscall++;
_native_syscall_leave();
}
}
/**
* LPM_IDLE uses sleep() to wait for interrupts
* LPM_OFF exits process
* other modes not supported at the moment
*/
enum lpm_mode lpm_set(enum lpm_mode target)
{
enum lpm_mode last_lpm;
//DEBUG("lpm_set(%i)\n", target);
last_lpm = native_lpm;
native_lpm = target;
switch(native_lpm) { /* @contiki :-p */
case LPM_ON:
break;
case LPM_IDLE:
//DEBUG("lpm_set(): pause()\n");
//pause();
_native_lpm_sleep();
break;
/* XXX: unfinished modes: */
case LPM_SLEEP:
/*TODO: implement*/
printf("XXX: lpm_set(): LPM_SLEEP not implemented\n");
//sigsuspend();
case LPM_POWERDOWN:
/*TODO: implement*/
printf("XXX: lpm_set(): LPM_POWERDOWN not implemented\n");
//sigsuspend();
case LPM_OFF:
printf("lpm_set(): exit()\n");
real_exit(EXIT_SUCCESS);
default:
DEBUG("XXX: unsupported power mode: %i\n", native_lpm);
real_exit(EXIT_FAILURE);
}
return last_lpm;
}
void lpm_awake(void)
{
DEBUG("XXX: lpm_awake()\n");
native_lpm = LPM_ON;
return;
}
void lpm_begin_awake(void)
{
DEBUG("XXX: lpm_begin_awake()\n");
return;
}
void lpm_end_awake(void)
{
DEBUG("XXX: lpm_end_awake()\n");
native_lpm = LPM_ON;
return;
}
enum lpm_mode lpm_get(void)
{
return native_lpm;
}

View File

@ -1,74 +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_nrf51822
* @{
*
* @file
* @brief Implementation of the kernels power management interface
*
* @author Hauke Petersen <hauke.petersen@fu-berlin.de>
* @author Frank Holtz <frank-riot2015@holtznet.de>
*
* @}
*/
#include "cpu.h"
#include "arch/lpm_arch.h"
void lpm_arch_init(void)
{
/* TODO: needs to be implemented */
}
enum lpm_mode lpm_arch_set(enum lpm_mode target)
{
switch (target) {
/* wait for next interrupt */
case LPM_IDLE:
case LPM_SLEEP:
case LPM_POWERDOWN:
__DSB();
__WFI();
break;
case LPM_OFF:
/* Switch of RAM and power off */
NRF_POWER->RAMON = 0;
NRF_POWER->SYSTEMOFF = 1;
break;
/* do nothing here */
case LPM_UNKNOWN:
case LPM_ON:
default:
break;
}
return 0;
}
enum lpm_mode lpm_arch_get(void)
{
/* TODO: needs to be implemented */
return 0;
}
void lpm_arch_awake(void)
{
/* TODO: needs to be implemented */
}
void lpm_arch_begin_awake(void)
{
/* TODO: needs to be implemented */
}
void lpm_arch_end_awake(void)
{
/* TODO: needs to be implemented */
}

View File

@ -1,72 +0,0 @@
/*
* Copyright (C) 2016 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_nrf52
* @{
*
* @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: needs to be implemented */
}
enum lpm_mode lpm_arch_set(enum lpm_mode target)
{
switch (target) {
/* wait for next interrupt */
case LPM_IDLE:
case LPM_SLEEP:
case LPM_POWERDOWN:
__DSB();
__WFI();
break;
case LPM_OFF:
NRF_POWER->SYSTEMOFF = 1;
break;
/* do nothing here */
case LPM_UNKNOWN:
case LPM_ON:
default:
break;
}
return 0;
}
enum lpm_mode lpm_arch_get(void)
{
/* TODO: needs to be implemented */
return 0;
}
void lpm_arch_awake(void)
{
/* TODO: needs to be implemented */
}
void lpm_arch_begin_awake(void)
{
/* TODO: needs to be implemented */
}
void lpm_arch_end_awake(void)
{
/* TODO: needs to be implemented */
}

View File

@ -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_sam3
* @{
*
* @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)
{
(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
}

View File

@ -1,126 +0,0 @@
/*
* Copyright (C) 2014 Freie Universität Berlin
* Copyright (C) 2015 Saurabh Singh
*
* 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_samd21
* @{
*
* @file
* @brief Implementation of the kernels power management interface
*
* @author Thomas Eichinger <thomas.eichinger@fu-berlin.de>
* @author Saurabh Singh <saurabh@cezy.co>
*
* @}
*/
#include "cpu.h"
#include "arch/lpm_arch.h"
enum system_sleepmode {
/**
* Idle 0 mode.
* Potential Wake Up sources: Synchronous(APB, AHB), asynchronous.
*/
SYSTEM_SLEEPMODE_IDLE_0,
/**
* Idle 1 mode.
* Potential Wake Up sources: Synchronous (APB), asynchronous
*/
SYSTEM_SLEEPMODE_IDLE_1,
/**
* Idle 2 mode.
* Potential Wake Up sources: Asynchronous
*/
SYSTEM_SLEEPMODE_IDLE_2,
/**
* Standby mode.
* Potential Wake Up sources: Asynchronous
*/
SYSTEM_SLEEPMODE_STANDBY,
};
static enum lpm_mode current_mode;
static void start_lpm(void);
void lpm_arch_init(void)
{
current_mode = LPM_ON;
}
enum lpm_mode lpm_arch_set(enum lpm_mode target)
{
enum lpm_mode last_mode = current_mode;
switch (target) {
case LPM_ON: /* Run mode */
current_mode = LPM_ON;
break;
case LPM_IDLE: /* Sleep mode Idle 0 */
current_mode = LPM_IDLE;
/* Idle Mode 0 */
SCB->SCR &= ~SCB_SCR_SLEEPDEEP_Msk;
PM->SLEEP.reg = SYSTEM_SLEEPMODE_IDLE_0;
start_lpm();
break;
case LPM_SLEEP: /* Sleep mode Idle 1 */
current_mode = LPM_SLEEP;
/* Idle Mode 1 */
SCB->SCR &= ~SCB_SCR_SLEEPDEEP_Msk;
PM->SLEEP.reg = SYSTEM_SLEEPMODE_IDLE_1;
start_lpm();
break;
case LPM_POWERDOWN: /* Sleep mode Idle 2 */
/* Idle Mode 2 */
current_mode = LPM_POWERDOWN;
SCB->SCR &= ~SCB_SCR_SLEEPDEEP_Msk;
PM->SLEEP.reg = SYSTEM_SLEEPMODE_IDLE_2;
start_lpm();
break;
case LPM_OFF: /* Standby Mode - Potential Wake Up sources: Asynchronous */
current_mode = LPM_OFF;
/* Standby Mode */
SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk;
start_lpm();
break;
default:
break;
}
return last_mode;
}
static void start_lpm(void)
{
/* Executes a device DSB (Data Synchronization Barrier) */
__DSB();
/* Enter standby mode */
__WFI();
}
enum lpm_mode lpm_arch_get(void)
{
return current_mode;
}
void lpm_arch_awake(void)
{
if (current_mode == LPM_SLEEP) {
/* Re-init */
cpu_init();
}
current_mode = LPM_ON;
}
/** Not needed */
void lpm_arch_begin_awake(void){ }
/** Not needed */
void lpm_arch_end_awake(void){ }

View File

@ -18,8 +18,6 @@
* @}
*/
#include "arch/lpm_arch.h"
#include "cpu.h"
static void _gclk_setup(int gclk, uint32_t reg)
@ -68,6 +66,4 @@ void cpu_init(void)
/* Setup GCLK generators */
_gclk_setup(0, GCLK_GENCTRL_GENEN | GCLK_GENCTRL_SRC_OSC16M);
_gclk_setup(1, GCLK_GENCTRL_GENEN | GCLK_GENCTRL_SRC_OSCULP32K);
lpm_arch_init();
}

View File

@ -1,95 +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_saml21
* @{
*
* @file lpm_arch.c
* @brief Implementation of the kernels power management interface
*
* @author Thomas Eichinger <thomas.eichinger@fu-berlin.de>
*
* @}
*/
#include <stdio.h>
#include "lpm.h"
#include "arch/lpm_arch.h"
#include "cpu.h"
#define ENABLE_DEBUG 0
#include "debug.h"
void lpm_arch_init(void)
{
MCLK->APBAMASK.reg |= MCLK_APBAMASK_PM;
PM->CTRLA.reg = PM_CTRLA_MASK & (~PM_CTRLA_IORET);
SUPC->BOD33.bit.ENABLE=0;
lpm_prevent_sleep = 1;
}
enum lpm_mode lpm_arch_set(enum lpm_mode target)
{
uint32_t mode;
switch(target) {
case LPM_IDLE:
DEBUG("lpm_arch_set(): setting IDLE mode.\n");
mode = PM_SLEEPCFG_SLEEPMODE_IDLE2;
break;
case LPM_SLEEP:
DEBUG("lpm_arch_set(): setting STANDBY mode.\n");
mode = PM_SLEEPCFG_SLEEPMODE_STANDBY;
break;
case LPM_POWERDOWN:
DEBUG("lpm_arch_set(): setting BACKUP mode.\n");
mode = PM_SLEEPCFG_SLEEPMODE_BACKUP;
break;
default:
DEBUG("lpm_arch_set(): unhandled low-power mode.\n");
return 0;
}
/* write sleep configuration */
PM->SLEEPCFG.bit.SLEEPMODE = mode;
/* make sure value has been set */
while (PM->SLEEPCFG.bit.SLEEPMODE != mode) {}
/* ensure all memory accesses have completed */
__DSB();
/* go to sleep mode (issue wait-for-interrupt instruction) */
__WFI();
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
}

View File

@ -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_stm32f0
* @{
*
* @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 */
}

View File

@ -1,98 +0,0 @@
/*
* Copyright (C) 2015 Engineering-Spirit
*
* 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_stm32f1
* @{
*
* @file
* @brief Implementation of the kernels power management interface
*
* @author Nick v. IJzendoorn <nijzndoorn@engineering-spirit.nl>
*
* @}
*/
#include "cpu.h"
#include "arch/lpm_arch.h"
static enum lpm_mode current_mode = LPM_UNKNOWN;
void lpm_arch_init(void)
{
current_mode = LPM_ON;
}
enum lpm_mode lpm_arch_set(enum lpm_mode target)
{
enum lpm_mode last_mode = current_mode;
switch (target) {
case LPM_ON: /* STM Run mode */
current_mode = LPM_ON;
break;
case LPM_IDLE: /* STM Sleep mode */
current_mode = LPM_IDLE;
/* Reset SLEEPDEEP bit of system control block */
SCB->SCR &= ~(SCB_SCR_SLEEPDEEP_Msk);
/* Enter sleep mode */
__WFI();
break;
case LPM_SLEEP: /* STM Stop mode */
current_mode = LPM_SLEEP;
/* Clear PDDS and LPDS bits to enter stop mode on */
/* deepsleep with voltage regulator on */
PWR->CR &= ~(PWR_CR_PDDS | PWR_CR_LPDS);
/* Set SLEEPDEEP bit of system control block */
SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk;
/* Enter stop mode */
__WFI();
break;
case LPM_POWERDOWN: /* STM Standby mode */
/* Fall-through */
case LPM_OFF: /* STM Standby mode */
current_mode = LPM_POWERDOWN;
/* Set PDDS to enter standby mode on deepsleep and clear flags */
PWR->CR |= (PWR_CR_PDDS | PWR_CR_CWUF | PWR_CR_CSBF);
/* Enable WKUP pin to use for wakeup from standby mode */
PWR->CSR |= PWR_CSR_EWUP;
/* Set SLEEPDEEP bit of system control block */
SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk;
#if defined ( __CC_ARM )
/* Ensure that store operations are completed */
__force_stores();
#endif
/* Enter standby mode */
__WFI();
break;
default:
break;
}
return last_mode;
}
enum lpm_mode lpm_arch_get(void)
{
return current_mode;
}
void lpm_arch_awake(void)
{
if (current_mode == LPM_SLEEP) {
/* After stop mode, the clock system needs to be reconfigured */
cpu_init();
}
current_mode = LPM_ON;
}
/** Not provided */
inline void lpm_arch_begin_awake(void) { }
/** Not provided */
inline void lpm_arch_end_awake(void) { }

View File

@ -1,98 +0,0 @@
/*
* Copyright (C) 2015 Engineering-Spirit
*
* 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_stm32f2
* @{
*
* @file
* @brief Implementation of the kernels power management interface
*
* @author Nick v. IJzendoorn <nijzndoorn@engineering-spirit.nl>
*
* @}
*/
#include "cpu.h"
#include "arch/lpm_arch.h"
static enum lpm_mode current_mode = LPM_UNKNOWN;
void lpm_arch_init(void)
{
current_mode = LPM_ON;
}
enum lpm_mode lpm_arch_set(enum lpm_mode target)
{
enum lpm_mode last_mode = current_mode;
switch (target) {
case LPM_ON: /* STM Run mode */
current_mode = LPM_ON;
break;
case LPM_IDLE: /* STM Sleep mode */
current_mode = LPM_IDLE;
/* Reset SLEEPDEEP bit of system control block */
SCB->SCR &= ~(SCB_SCR_SLEEPDEEP_Msk);
/* Enter sleep mode */
__WFI();
break;
case LPM_SLEEP: /* STM Stop mode */
current_mode = LPM_SLEEP;
/* Clear PDDS and LPDS bits to enter stop mode on */
/* deepsleep with voltage regulator on */
PWR->CR &= ~(PWR_CR_PDDS | PWR_CR_LPDS);
/* Set SLEEPDEEP bit of system control block */
SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk;
/* Enter stop mode */
__WFI();
break;
case LPM_POWERDOWN: /* STM Standby mode */
/* Fall-through */
case LPM_OFF: /* STM Standby mode */
current_mode = LPM_POWERDOWN;
/* Set PDDS to enter standby mode on deepsleep and clear flags */
PWR->CR |= (PWR_CR_PDDS | PWR_CR_CWUF | PWR_CR_CSBF);
/* Enable WKUP pin to use for wakeup from standby mode */
PWR->CSR |= PWR_CSR_EWUP;
/* Set SLEEPDEEP bit of system control block */
SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk;
#if defined ( __CC_ARM )
/* Ensure that store operations are completed */
__force_stores();
#endif
/* Enter standby mode */
__WFI();
break;
default:
break;
}
return last_mode;
}
enum lpm_mode lpm_arch_get(void)
{
return current_mode;
}
void lpm_arch_awake(void)
{
if (current_mode == LPM_SLEEP) {
/* After stop mode, the clock system needs to be reconfigured */
cpu_init();
}
current_mode = LPM_ON;
}
/** Not provided */
inline void lpm_arch_begin_awake(void) { }
/** Not provided */
inline void lpm_arch_end_awake(void) { }

View File

@ -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_stm32f3
* @{
*
* @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 */
}

View File

@ -1,98 +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_stm32f4
* @{
*
* @file
* @brief Implementation of the kernels power management interface
*
* @author Fabian Nack <nack@inf.fu-berlin.de>
*
* @}
*/
#include "cpu.h"
#include "arch/lpm_arch.h"
static enum lpm_mode current_mode = LPM_UNKNOWN;
void lpm_arch_init(void)
{
current_mode = LPM_ON;
}
enum lpm_mode lpm_arch_set(enum lpm_mode target)
{
enum lpm_mode last_mode = current_mode;
switch (target) {
case LPM_ON: /* STM Run mode */
current_mode = LPM_ON;
break;
case LPM_IDLE: /* STM Sleep mode */
current_mode = LPM_IDLE;
/* Reset SLEEPDEEP bit of system control block */
SCB->SCR &= ~(SCB_SCR_SLEEPDEEP_Msk);
/* Enter sleep mode */
__WFI();
break;
case LPM_SLEEP: /* STM Stop mode */
current_mode = LPM_SLEEP;
/* Clear PDDS and LPDS bits to enter stop mode on */
/* deepsleep with voltage regulator on */
PWR->CR &= ~(PWR_CR_PDDS | PWR_CR_LPDS);
/* Set SLEEPDEEP bit of system control block */
SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk;
/* Enter stop mode */
__WFI();
break;
case LPM_POWERDOWN: /* STM Standby mode */
/* Fall-through */
case LPM_OFF: /* STM Standby mode */
current_mode = LPM_POWERDOWN;
/* Set PDDS to enter standby mode on deepsleep and clear flags */
PWR->CR |= (PWR_CR_PDDS | PWR_CR_CWUF | PWR_CR_CSBF);
/* Enable WKUP pin to use for wakeup from standby mode */
PWR->CSR |= PWR_CSR_EWUP;
/* Set SLEEPDEEP bit of system control block */
SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk;
#if defined ( __CC_ARM )
/* Ensure that store operations are completed */
__force_stores();
#endif
/* Enter standby mode */
__WFI();
break;
default:
break;
}
return last_mode;
}
enum lpm_mode lpm_arch_get(void)
{
return current_mode;
}
void lpm_arch_awake(void)
{
if (current_mode == LPM_SLEEP) {
/* After stop mode, the clock system needs to be reconfigured */
cpu_init();
}
current_mode = LPM_ON;
}
/** Not provided */
inline void lpm_arch_begin_awake(void) { }
/** Not provided */
inline void lpm_arch_end_awake(void) { }

View File

@ -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_stm32l1
* @{
*
* @file
* @brief Implementation of the kernel's lpm 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 */
}

View File

@ -17,15 +17,12 @@
*/
#include "x86_reboot.h"
#include "lpm.h"
void panic_arch(void)
{
#if DEVELHELP
/* enter infinite loop, into deepest possible sleep mode */
while (1) {
lpm_set(LPM_OFF);
}
// TODO
#else
x86_shutdown();
#endif

View File

@ -23,7 +23,6 @@
#include <errno.h>
#include <stdio.h>
#include "thread.h"
#include "lpm.h"
/* One stack for all threads. DON'T TRY THIS AT HOME!! */
static char dummy_stack[THREAD_STACKSIZE_DEFAULT];
@ -49,6 +48,6 @@ int main(void)
if (-EOVERFLOW == thr_id) {
puts("Thread creation successful aborted\n");
}
lpm_set(LPM_OFF);
return 0;
}

View File

@ -9,7 +9,6 @@
#include "map.h"
#include "embUnit.h"
#include "lpm.h"
#include "xtimer.h"
#define UNCURRY(FUN, ARGS) FUN(ARGS)