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 
34 #include <stdint.h>
35 #include "periph_cpu.h"
36 #include "architecture.h"
37 
38 #ifdef __cplusplus
39 extern "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 
53 typedef struct {
54  uint8_t blockers[PM_NUM_MODES];
55 } WORD_ALIGNED pm_blocker_t;
56 
62 #ifdef MODULE_PM_LAYERED
63 void pm_block(unsigned mode);
64 #else
65 static inline void pm_block(unsigned mode) { (void)mode; }
66 #endif
67 
73 #ifdef MODULE_PM_LAYERED
74 void pm_unblock(unsigned mode);
75 #else
76 static inline void pm_unblock(unsigned mode) { (void)mode; }
77 #endif
78 
89 void pm_set(unsigned mode);
90 
98 pm_blocker_t pm_get_blocker(void);
99 
100 #ifdef __cplusplus
101 }
102 #endif
103 
Platform-independent access to architecture details.
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
Power Management mode blocker typedef.
Definition: pm_layered.h:53