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 
9 #pragma once
10 
37 #include <stdint.h>
38 #include "periph_cpu.h"
39 #include "architecture.h"
40 
41 #ifdef __cplusplus
42 extern "C" {
43 #endif
44 
45 #ifndef PROVIDES_PM_OFF
46 #define PROVIDES_PM_OFF
47 #endif
48 
49 #ifndef PROVIDES_PM_SET_LOWEST
50 #define PROVIDES_PM_SET_LOWEST
51 #endif
52 
56 typedef struct {
57  uint8_t blockers[PM_NUM_MODES];
58 } WORD_ALIGNED pm_blocker_t;
59 
65 #ifdef MODULE_PM_LAYERED
66 void pm_block(unsigned mode);
67 #else
68 static inline void pm_block(unsigned mode) { (void)mode; }
69 #endif
70 
76 #ifdef MODULE_PM_LAYERED
77 void pm_unblock(unsigned mode);
78 #else
79 static inline void pm_unblock(unsigned mode) { (void)mode; }
80 #endif
81 
92 void pm_set(unsigned mode);
93 
101 pm_blocker_t pm_get_blocker(void);
102 
103 #ifdef __cplusplus
104 }
105 #endif
106 
Platform-independent access to architecture details.
static void pm_unblock(unsigned mode)
Unblock a power mode.
Definition: pm_layered.h:79
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:68
Power Management mode blocker typedef.
Definition: pm_layered.h:56