libopencm3
A free/libre/open-source firmware library for various ARM Cortex-M3 microcontrollers.
pwr_common_v2.h
Go to the documentation of this file.
1/** @addtogroup pwr_defines
2
3@author @htmlonly &copy; @endhtmlonly 2011 Stephen Caudle <scaudle@doceme.com>
4@author @htmlonly &copy; @endhtmlonly 2012 Karl Palsson <karlp@tweak.net.au>
5 */
6/*
7 * This file is part of the libopencm3 project.
8 *
9 * Copyright (C) 2011 Stephen Caudle <scaudle@doceme.com>
10 * Copyright (C) 2012 Karl Palsson <karlp@tweak.net.au>
11 *
12 * This library is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License as published by
14 * the Free Software Foundation, either version 3 of the License, or
15 * (at your option) any later version.
16 *
17 * This library is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU Lesser General Public License for more details.
21 *
22 * You should have received a copy of the GNU Lesser General Public License
23 * along with this library. If not, see <http://www.gnu.org/licenses/>.
24 */
25
26#ifndef LIBOPENCM3_PWR_COMMON_V2_H
27#define LIBOPENCM3_PWR_COMMON_V2_H
28
30
31/* --- PWR_CR values ------------------------------------------------------- */
32
33/* Bits [31:15]: Reserved */
34
35/* LPRUN: Low power run mode */
36#define PWR_CR_LPRUN (1 << 14)
37
38/* VOS[12:11]: Regulator voltage scaling output selection */
39#define PWR_CR_VOS_LSB 11
40/** @defgroup pwr_vos Voltage Scaling Output level selection
41@ingroup pwr_defines
42
43@{*/
44#define PWR_CR_VOS_RANGE1 (0x1 << PWR_CR_VOS_LSB)
45#define PWR_CR_VOS_RANGE2 (0x2 << PWR_CR_VOS_LSB)
46#define PWR_CR_VOS_RANGE3 (0x3 << PWR_CR_VOS_LSB)
47/**@}*/
48#define PWR_CR_VOS_MASK (0x3 << PWR_CR_VOS_LSB)
49
50/* FWU: Fast wakeup */
51#define PWR_CR_FWU (1 << 10)
52
53/* ULP: Ultralow power mode */
54#define PWR_CR_ULP (1 << 9)
55
56/* LPSDSR: Low-power deepsleep/sleep/low power run */
57#define PWR_CR_LPSDSR (1 << 0) /* masks common PWR_CR_LPDS */
58
59/* --- PWR_CSR values ------------------------------------------------------- */
60
61/* EWUP2: Enable WKUP2 pin */
62#define PWR_CSR_EWUP2 (1 << 9)
63
64/* EWUP1: Enable WKUP1 pin */
65#define PWR_CSR_EWUP1 PWR_CSR_EWUP
66
67/* REGLPF : Regulator LP flag */
68#define PWR_CSR_REGLPF (1 << 5)
69
70/* VOSF: Voltage Scaling select flag */
71#define PWR_CSR_VOSF (1 << 4)
72
73/* VREFINTRDYF: Internal voltage reference (VREFINT) ready flag */
74#define PWR_CSR_VREFINTRDYF (1 << 3)
75
76
77
78/* --- Function prototypes ------------------------------------------------- */
79
80/** Voltage scales for internal regulator
81 */
83 /** high performance, highest voltage */
85 /** medium performance, flash operational but slow */
87 /** low performance, no flash erase/program */
89};
90
92
93void pwr_set_vos_scale(enum pwr_vos_scale scale);
94
96
97#endif
98
#define END_DECLS
Definition: common.h:34
#define BEGIN_DECLS
Definition: common.h:33
void pwr_set_vos_scale(enum pwr_vos_scale scale)
Definition: pwr_common_v2.c:29
pwr_vos_scale
Voltage scales for internal regulator.
Definition: pwr_common_v2.h:82
@ PWR_SCALE1
high performance, highest voltage
Definition: pwr_common_v2.h:84
@ PWR_SCALE2
medium performance, flash operational but slow
Definition: pwr_common_v2.h:86
@ PWR_SCALE3
low performance, no flash erase/program
Definition: pwr_common_v2.h:88