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

native: support add periph/pm support

This commit is contained in:
Kaspar Schleiser 2017-01-09 17:41:58 +01:00
parent 92f6fc6888
commit 4291c1f839
3 changed files with 34 additions and 8 deletions

View File

@ -0,0 +1 @@
FEATURES_PROVIDED += periph_pm

View File

@ -37,6 +37,7 @@
#include "irq.h"
#include "cpu.h"
#include "periph/pm.h"
#include "native_internal.h"
@ -446,7 +447,7 @@ static void native_shutdown(int sig, siginfo_t *info, void *context)
(void)info;
(void)context;
// TODO: poweroff
pm_off();
}
/**

View File

@ -1,28 +1,52 @@
/*
* Copyright (C) 2016 Kaspar Schleiser <kaspar@schleiser.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.
* 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 native_cpu
* @ingroup native_cpu
* @{
*
* @file
* @brief native reboot() implementation
* @brief native Power Management implementation
*
* @author Kaspar Schleiser <kaspar@schleiser.de>
* @}
*/
#include <err.h>
#include <stdio.h>
#include <stdlib.h>
#include "periph/pm.h"
#include "native_internal.h"
#include "netdev2_tap.h"
#include "tty_uart.h"
void reboot(void)
#define ENABLE_DEBUG (0)
#include "debug.h"
void pm_set_lowest(void)
{
_native_in_syscall++; // no switching here
real_pause();
_native_in_syscall--;
if (_native_sigpend > 0) {
_native_in_syscall++;
_native_syscall_leave();
}
}
void pm_off(void)
{
puts("\nnative: exiting");
real_exit(EXIT_SUCCESS);
}
void pm_reboot(void)
{
printf("\n\n\t\t!! REBOOT !!\n\n");