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

Merge pull request #15588 from benpicco/native/pm_layered

cpu/native: pm: fix build with pm_layered
This commit is contained in:
Francisco 2020-12-10 13:05:45 +01:00 committed by GitHub
commit 7bbe36ff6b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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