Loading...
Searching...
No Matches
pm_layered.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2017 Kaspar Schleiser <kaspar@schleiser.de>
3 *
4 * This file is subject to the terms and conditions of the GNU Lesser
5 * General Public License v2.1. See the file LICENSE in the top level
6 * directory for more details.
7 */
8
35#ifndef PM_LAYERED_H
36#define PM_LAYERED_H
37
38#include <stdint.h>
39#include "periph_cpu.h"
40#include "architecture.h"
41
42#ifdef __cplusplus
43extern "C" {
44#endif
45
46#ifndef PROVIDES_PM_OFF
47#define PROVIDES_PM_OFF
48#endif
49
50#ifndef PROVIDES_PM_SET_LOWEST
51#define PROVIDES_PM_SET_LOWEST
52#endif
53
57typedef struct {
58 uint8_t blockers[PM_NUM_MODES];
59} WORD_ALIGNED pm_blocker_t;
60
66#ifdef MODULE_PM_LAYERED
67void pm_block(unsigned mode);
68#else
69static inline void pm_block(unsigned mode) { (void)mode; }
70#endif
71
77#ifdef MODULE_PM_LAYERED
78void pm_unblock(unsigned mode);
79#else
80static inline void pm_unblock(unsigned mode) { (void)mode; }
81#endif
82
93void pm_set(unsigned mode);
94
102pm_blocker_t pm_get_blocker(void);
103
104#ifdef __cplusplus
105}
106#endif
107
108#endif /* PM_LAYERED_H */
Platform-independent access to architecture details.
static void pm_unblock(unsigned mode)
Unblock a power mode.
Definition pm_layered.h:80
void pm_set(unsigned mode)
Switches the MCU to a new power mode.
pm_blocker_t pm_get_blocker(void)
Get currently blocked PM modes.
static void pm_block(unsigned mode)
Block a power mode.
Definition pm_layered.h:69
Power Management mode blocker typedef.
Definition pm_layered.h:57