Loading...
Searching...
No Matches
pm_layered.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2017 Kaspar Schleiser <kaspar@schleiser.de>
3 * SPDX-License-Identifier: LGPL-2.1-only
4 */
5
6#pragma once
7
33
34#include <stdint.h>
35#include "periph_cpu.h"
36#include "architecture.h"
37
38#ifdef __cplusplus
39extern "C" {
40#endif
41
42#ifndef PROVIDES_PM_OFF
43#define PROVIDES_PM_OFF
44#endif
45
46#ifndef PROVIDES_PM_SET_LOWEST
47#define PROVIDES_PM_SET_LOWEST
48#endif
49
53typedef struct {
54 uint8_t blockers[PM_NUM_MODES];
55} WORD_ALIGNED pm_blocker_t;
56
62#ifdef MODULE_PM_LAYERED
63void pm_block(unsigned mode);
64#else
65static inline void pm_block(unsigned mode) { (void)mode; }
66#endif
67
73#ifdef MODULE_PM_LAYERED
74void pm_unblock(unsigned mode);
75#else
76static inline void pm_unblock(unsigned mode) { (void)mode; }
77#endif
78
89void pm_set(unsigned mode);
90
98pm_blocker_t pm_get_blocker(void);
99
100#ifdef __cplusplus
101}
102#endif
103
Platform-independent access to architecture details.
#define WORD_ALIGNED
Type qualifier to use to align data on word boundaries.
static void pm_unblock(unsigned mode)
Unblock a power mode.
Definition pm_layered.h:76
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:65
uint8_t blockers[PM_NUM_MODES]
number of blockers for the mode
Definition pm_layered.h:54