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

cpu/native: pm: fix build with pm_layered

This commit is contained in:
Benjamin Valentin 2020-12-08 18:13:01 +01:00
parent 229291ef01
commit d7ed3418b5
3 changed files with 28 additions and 1 deletions

View File

@ -32,6 +32,18 @@ extern "C" {
#define CPUID_LEN (4U)
#endif
/**
* @name Power mode configuration
*/
#ifndef PM_NUM_MODES
#define PM_NUM_MODES (1U)
#endif
/**
* @brief We provide our own pm_off() function for the native CPU
*/
#define PROVIDES_PM_LAYERED_OFF
/* GPIO configuration only if the module is available (=Linux) */
#if defined(MODULE_PERIPH_GPIO_LINUX) || defined(DOXYGEN)
#include <linux/gpio.h>

View File

@ -36,7 +36,7 @@
#define ENABLE_DEBUG 0
#include "debug.h"
void pm_set_lowest(void)
static void _native_sleep(void)
{
_native_in_syscall++; /* no switching here */
real_pause();
@ -48,6 +48,20 @@ void pm_set_lowest(void)
}
}
#if !defined(MODULE_PM_LAYERED)
void pm_set_lowest(void)
{
_native_sleep();
}
#endif
void pm_set(unsigned mode)
{
if (mode == 0) {
_native_sleep();
}
}
void pm_off(void)
{
puts("\nnative: exiting");

View File

@ -34,6 +34,7 @@
#ifndef PM_LAYERED_H
#define PM_LAYERED_H
#include <stdint.h>
#include "periph_cpu.h"
#ifdef __cplusplus