libopencm3
A free/libre/open-source firmware library for various ARM Cortex-M3 microcontrollers.
pwr.h
Go to the documentation of this file.
1/** @defgroup pwr_defines Power Defines
2
3@brief <b>Defined Constants and Types for the LPC17xx Power Control</b>
4
5@ingroup LPC17xx_defines
6
7@version 1.0.0
8
9@author @htmlonly &copy; @endhtmlonly 2013 Silvio Gissi <silvio.gissi@outlook.com>
10
11@date 17 August 2013
12
13LGPL License Terms @ref lgpl_license
14 */
15/*
16 * This file is part of the libopencm3 project.
17 *
18 * Copyright (C) 2012 Silvio Gissi <silvio.gissi@outlook.com>
19 *
20 * This library is free software: you can redistribute it and/or modify
21 * it under the terms of the GNU Lesser General Public License as published by
22 * the Free Software Foundation, either version 3 of the License, or
23 * (at your option) any later version.
24 *
25 * This library is distributed in the hope that it will be useful,
26 * but WITHOUT ANY WARRANTY; without even the implied warranty of
27 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28 * GNU Lesser General Public License for more details.
29 *
30 * You should have received a copy of the GNU Lesser General Public License
31 * along with this library. If not, see <http://www.gnu.org/licenses/>.
32 */
33
34#ifndef LPC17XX_POWER_H
35#define LPC17XX_POWER_H
36
39
40/* --- Clock registers ----------------------------------------------------- */
41/* Power Control */
42#define PWR_PCON MMIO32(SYSCON_BASE + 0x0c0)
43#define PWR_PCONP MMIO32(SYSCON_BASE + 0x0c4)
44
45/* PWR_PCON Values */
46#define PWR_PCON_MODE_SLEEP 0x00
47#define PWR_PCON_MODE_POWER_DOWN 0x01
48/* PWR_PCON_MODE_RESERVED 0x02*/
49#define PWR_PCON_MODE_DEEPSLEEP 0x03
50#define PWR_PCON_BODRPM (1 << 2)
51#define PWR_PCON_BOGD (1 << 3)
52#define PWR_PCON_BORD (1 << 4)
53/* Reserved: [7:5] */
54#define PWR_PCON_SMFLAG (1 << 8)
55#define PWR_PCON_DSFLAG (1 << 9)
56#define PWR_PCON_PDFLAG (1 << 10)
57#define PWR_PCON_DPDFLAG (1 << 11)
58/* Reserved: [31:12] */
59
60/* PWR_PCONP Values */
61/* Reserved: [0] */
62#define PWR_PCONP_TIMER0 (1 << 1)
63#define PWR_PCONP_TIMER1 (1 << 2)
64#define PWR_PCONP_UART0 (1 << 3)
65#define PWR_PCONP_UART1 (1 << 4)
66/* Reserved: [5] */
67#define PWR_PCONP_PWM1 (1 << 6)
68#define PWR_PCONP_I2C0 (1 << 7)
69#define PWR_PCONP_SPI (1 << 8)
70#define PWR_PCONP_RTC (1 << 9)
71#define PWR_PCONP_SSP1 (1 << 10)
72/* Reserved: [11] */
73#define PWR_PCONP_ADC (1 << 12)
74#define PWR_PCONP_CAN1 (1 << 13)
75#define PWR_PCONP_CAN2 (1 << 14)
76#define PWR_PCONP_GPIO (1 << 15)
77#define PWR_PCONP_RIT (1 << 16)
78#define PWR_PCONP_MCPWM (1 << 17)
79#define PWR_PCONP_QEI (1 << 18)
80#define PWR_PCONP_I2C1 (1 << 19)
81/* Reserved: [20] */
82#define PWR_PCONP_SSP0 (1 << 21)
83#define PWR_PCONP_TIMER2 (1 << 22)
84#define PWR_PCONP_TIMER3 (1 << 23)
85#define PWR_PCONP_UART2 (1 << 24)
86#define PWR_PCONP_UART3 (1 << 25)
87#define PWR_PCONP_I2C2 (1 << 26)
88#define PWR_PCONP_I2S (1 << 27)
89/* Reserved: [28] */
90#define PWR_PCONP_GPDMA (1 << 29)
91#define PWR_PCONP_ETHERNET (1 << 30)
92#define PWR_PCONP_USB (1 << 31)
93
95
96void pwr_enable_peripherals(uint32_t peripherals);
97void pwr_disable_peripherals(uint32_t peripherals);
98/* TODO Sleep, Deep Sleep, Power Down and Deep Power Down modes */
99
101
102#endif
#define END_DECLS
Definition: common.h:34
#define BEGIN_DECLS
Definition: common.h:33
void pwr_enable_peripherals(uint32_t peripherals)
Definition: pwr.c:37
void pwr_disable_peripherals(uint32_t peripherals)
Definition: pwr.c:42