pmu_11xx.h
Go to the documentation of this file.
1 /*
2  * @brief LPC11xx PMU chip driver
3  *
4  * @note
5  * Copyright(C) NXP Semiconductors, 2012
6  * All rights reserved.
7  *
8  * @par
9  * Software that is described herein is for illustrative purposes only
10  * which provides customers with programming information regarding the
11  * LPC products. This software is supplied "AS IS" without any warranties of
12  * any kind, and NXP Semiconductors and its licensor disclaim any and
13  * all warranties, express or implied, including all implied warranties of
14  * merchantability, fitness for a particular purpose and non-infringement of
15  * intellectual property rights. NXP Semiconductors assumes no responsibility
16  * or liability for the use of the software, conveys no license or rights under any
17  * patent, copyright, mask work right, or any other intellectual property rights in
18  * or to any products. NXP Semiconductors reserves the right to make changes
19  * in the software without notification. NXP Semiconductors also makes no
20  * representation or warranty that such application will be suitable for the
21  * specified use without further testing or modification.
22  *
23  * @par
24  * Permission to use, copy, modify, and distribute this software and its
25  * documentation is hereby granted, under NXP Semiconductors' and its
26  * licensor's relevant copyrights in the software, without fee, provided that it
27  * is used in conjunction with NXP Semiconductors microcontrollers. This
28  * copyright, permission, and disclaimer notice must appear in all copies of
29  * this code.
30  */
31 
32 #ifndef __PMU_11XX_H_
33 #define __PMU_11XX_H_
34 
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38 
47 #if defined(CHIP_LPC11AXX) || defined(CHIP_LPC11CXX) || defined(CHIP_LPC11EXX) || defined(CHIP_LPC11UXX) || defined(CHIP_LPC1125)
48 #if defined(CHIP_LPC1125)
49 #error "LPC1125 support for the PMU driver is not ready"
50 #endif
51 
55 typedef struct {
56  __IO uint32_t PCON;
57  __IO uint32_t GPREG[4];
58 } LPC_PMU_T;
59 
63 typedef enum CHIP_PMU_MCUPOWER {
64  PMU_MCU_SLEEP = 0,
65 #if defined(CHIP_LPC11AXX) || defined(CHIP_LPC11EXX) || defined(CHIP_LPC11UXX)
66  PMU_MCU_DEEP_SLEEP,
67  PMU_MCU_POWER_DOWN,
68  PMU_MCU_DEEP_PWRDOWN
69 #elif defined(CHIP_LPC11CXX)
70  PMU_MCU_DEEP_PWRDOWN = 3
71 #endif
72 } CHIP_PMU_MCUPOWER_T;
73 
77 #define PMU_PCON_PM_SLEEP (0x0)
78 #if defined(CHIP_LPC11AXX) || defined(CHIP_LPC11EXX) || defined(CHIP_LPC11UXX)
79 #define PMU_PCON_PM_DEEPSLEEP (0x1)
80 #define PMU_PCON_PM_POWERDOWN (0x2)
81 #define PMU_PCON_PM_DEEPPOWERDOWN (0x3)
82 #elif defined(CHIP_LPC11CXX)
83 #define PMU_PCON_PM_DEEPPOWERDOWN (0x2)
84 #endif
85 #define PMU_PCON_SLEEPFLAG (1 << 8)
86 #define PMU_PCON_DPDFLAG (1 << 11)
95 STATIC INLINE void Chip_PMU_WriteGPREG(LPC_PMU_T *pPMU, uint8_t regIndex, uint32_t value)
96 {
97  pPMU->GPREG[regIndex] = value;
98 }
99 
106 STATIC INLINE uint32_t Chip_PMU_ReadGPREG(LPC_PMU_T *pPMU, uint8_t regIndex)
107 {
108  return pPMU->GPREG[regIndex];
109 }
110 
118 void Chip_PMU_SleepState(LPC_PMU_T *pPMU);
119 
120 #if defined(CHIP_LPC11AXX) || defined(CHIP_LPC11EXX) || defined(CHIP_LPC11UXX)
121 
130 void Chip_PMU_DeepSleepState(LPC_PMU_T *pPMU);
131 
142 void Chip_PMU_PowerDownState(LPC_PMU_T *pPMU);
143 #endif
144 
156 void Chip_PMU_DeepPowerDownState(LPC_PMU_T *pPMU);
157 
164 void Chip_PMU_Sleep(LPC_PMU_T *pPMU, CHIP_PMU_MCUPOWER_T SleepMode);
165 
173 STATIC INLINE uint32_t Chip_PMU_GetSleepFlags(LPC_PMU_T *pPMU)
174 {
175  return (pPMU->PCON & (PMU_PCON_SLEEPFLAG | PMU_PCON_DPDFLAG));
176 }
177 
186 STATIC INLINE void Chip_PMU_ClearSleepFlags(LPC_PMU_T *pPMU, uint32_t flags)
187 {
188  pPMU->PCON &= ~flags;
189 }
190 
191 #endif /* defined(CHIP_LPC11AXX) || defined(CHIP_LPC11CXX) || ... */
192 
197 #ifdef __cplusplus
198 }
199 #endif
200 
201 #endif /* __PMU_11XX_H_ */
uavcan::uint32_t
std::uint32_t uint32_t
Definition: std.hpp:26
__IO
#define __IO
Definition: core_cm0.h:154
INLINE
#define INLINE
Definition: lpc_types.h:205
uavcan::uint8_t
std::uint8_t uint8_t
Definition: std.hpp:24
STATIC
#define STATIC
Definition: lpc_types.h:140


uavcan_communicator
Author(s):
autogenerated on Fri Dec 13 2024 03:10:02