]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/NXP_Code/drivers/fsl_power.h
b21fadfa759aac2f1f11741c475662eb4a4617fa
[freertos] / FreeRTOS / Demo / CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso / NXP_Code / drivers / fsl_power.h
1 /*\r
2  * Copyright (c) 2017, NXP\r
3  * All rights reserved.\r
4  *\r
5  * SPDX-License-Identifier: BSD-3-Clause\r
6  */\r
7 #ifndef _FSL_POWER_H_\r
8 #define _FSL_POWER_H_\r
9 \r
10 #include "fsl_common.h"\r
11 #include "fsl_device_registers.h"\r
12 #include <stdint.h>\r
13 \r
14 /*!\r
15  * @addtogroup power\r
16  * @{\r
17  */\r
18 /*******************************************************************************\r
19  * Definitions\r
20  ******************************************************************************/\r
21 \r
22 /*! @name Driver version */\r
23 /*@{*/\r
24 /*! @brief power driver version 1.0.0. */\r
25 #define FSL_POWER_DRIVER_VERSION (MAKE_VERSION(1, 0, 0))\r
26 /*@}*/\r
27 \r
28 \r
29 /** @brief  Low Power main structure */\r
30 typedef enum\r
31 {\r
32     VD_AON = 0x0,      /*!< Digital Always On power domain */\r
33     VD_MEM = 0x1,      /*!< Memories (SRAM) power domain   */\r
34     VD_DCDC = 0x2,     /*!< Core logic power domain        */\r
35     VD_DEEPSLEEP = 0x3 /*!< Core logic power domain        */\r
36 } LPC_POWER_DOMAIN_T;\r
37 \r
38 /** @brief  Low Power main structure */\r
39 typedef struct\r
40 {                              /*     */\r
41     __IO uint32_t CFG;         /*!< Low Power Mode Configuration, and miscallenous options  */\r
42     __IO uint32_t PDCTRL0;     /*!< Power Down control : controls power of various modules\r
43                                  in the different Low power modes, including ROM */\r
44     __IO uint32_t SRAMRETCTRL; /*!< Power Down control : controls power SRAM instances\r
45                                  in the different Low power modes */\r
46     __IO uint32_t CPURETCTRL;  /*!< CPU0 retention control : controls CPU retention parameters in POWER DOWN modes */\r
47     __IO uint64_t VOLTAGE;     /*!< Voltage control in Low Power Modes */\r
48     __IO uint64_t WAKEUPSRC;   /*!< Wake up sources control for sleepcon */\r
49     __IO uint64_t WAKEUPINT;   /*!< Wake up sources control for ARM */\r
50     __IO uint32_t HWWAKE;      /*!< Interrupt that can postpone power down modes\r
51                                  in case an interrupt is pending when the processor request deepsleep */\r
52     __IO uint32_t WAKEUPIOSRC; /*!< Wake up I/O sources in DEEP POWER DOWN mode */\r
53     __IO uint32_t TIMERCFG;    /*!< Wake up timers configuration */\r
54     __IO uint32_t TIMERCOUNT;  /*!< Wake up Timer count*/\r
55     __IO uint32_t POWERCYCLE;  /*!< Cancels entry in Low Power mode if set with 0xDEADABBA (might be used by some\r
56                                  interrupt handlers)*/\r
57 } LPC_LOWPOWER_T;\r
58 \r
59 /*   */\r
60 #define LOWPOWER_POWERCYCLE_CANCELLED 0xDEADABBA /*!<    */\r
61 \r
62 /* Low Power modes  */\r
63 #define LOWPOWER_CFG_LPMODE_INDEX                   0\r
64 #define LOWPOWER_CFG_LPMODE_MASK                    (0x3UL << LOWPOWER_CFG_LPMODE_INDEX)\r
65 #define LOWPOWER_CFG_SELCLOCK_INDEX                 2\r
66 #define LOWPOWER_CFG_SELCLOCK_MASK                  (0x1UL << LOWPOWER_CFG_SELCLOCK_INDEX)\r
67 #define LOWPOWER_CFG_SELMEMSUPPLY_INDEX             3\r
68 #define LOWPOWER_CFG_SELMEMSUPPLY_MASK              (0x1UL << LOWPOWER_CFG_SELMEMSUPPLY_INDEX)\r
69 #define LOWPOWER_CFG_MEMLOWPOWERMODE_INDEX          4\r
70 #define LOWPOWER_CFG_MEMLOWPOWERMODE_MASK           (0x1UL << LOWPOWER_CFG_MEMLOWPOWERMODE_INDEX)\r
71 #define LOWPOWER_CFG_LDODEEPSLEEPREF_INDEX          5\r
72 #define LOWPOWER_CFG_LDODEEPSLEEPREF_MASK           (0x1UL << LOWPOWER_CFG_LDODEEPSLEEPREF_INDEX)\r
73 \r
74 #define LOWPOWER_CFG_LPMODE_ACTIVE                  0 /*!< ACTIVE mode          */\r
75 #define LOWPOWER_CFG_LPMODE_DEEPSLEEP               1 /*!< DEEP SLEEP mode      */\r
76 #define LOWPOWER_CFG_LPMODE_POWERDOWN               2 /*!< POWER DOWN mode      */\r
77 #define LOWPOWER_CFG_LPMODE_DEEPPOWERDOWN           3 /*!< DEEP POWER DOWN mode */\r
78 #define LOWPOWER_CFG_LPMODE_SLEEP                   4 /*!< SLEEP mode */\r
79 \r
80 #define LOWPOWER_CFG_SELCLOCK_1MHZ                  0 /*!< The 1 MHz clock is used during the configuration of the PMC */\r
81 #define LOWPOWER_CFG_SELCLOCK_12MHZ                 1 /*!< The 12 MHz clock is used during the configuration of the PMC (to speed up PMC configuration process)*/\r
82 \r
83 #define LOWPOWER_CFG_SELMEMSUPPLY_LDOMEM            0 /*!< In DEEP SLEEP power mode, the Memories are supplied by the LDO_MEM */\r
84 #define LOWPOWER_CFG_SELMEMSUPPLY_LDODEEPSLEEP      1 /*!< In DEEP SLEEP power mode, the Memories are supplied by the LDO_DEEP_SLEEP (or DCDC) */\r
85 \r
86 #define LOWPOWER_CFG_MEMLOWPOWERMODE_SOURCEBIASING  0 /*!< All SRAM instances use "Source Biasing" as low power mode technic (it is recommended to set LDO_MEM as high as possible -- 1.1V typical -- during low power mode) */\r
87 #define LOWPOWER_CFG_MEMLOWPOWERMODE_VOLTAGESCALING 1 /*!< All SRAM instances use "Voltage Scaling" as low power mode technic (it is recommended to set LDO_MEM as low as possible -- down to 0.7V -- during low power mode) */\r
88 \r
89 #define LOWPOWER_CFG_LDODEEPSLEEPREF_FLASHBUFFER    0 /*!< LDO DEEP SLEEP uses Flash Buffer as reference  */\r
90 #define LOWPOWER_CFG_LDODEEPSLEEPREF_BANDGAG0P8V    1 /*!< LDO DEEP SLEEP uses Band Gap 0.8V as reference */\r
91 \r
92 /* CPU Retention Control*/\r
93 #define LOWPOWER_CPURETCTRL_ENA_INDEX               0\r
94 #define LOWPOWER_CPURETCTRL_ENA_MASK                (0x1UL << LOWPOWER_CPURETCTRL_ENA_INDEX)\r
95 #define LOWPOWER_CPURETCTRL_MEMBASE_INDEX           1\r
96 #define LOWPOWER_CPURETCTRL_MEMBASE_MASK            (0x1FFF << LOWPOWER_CPURETCTRL_MEMBASE_INDEX)\r
97 #define LOWPOWER_CPURETCTRL_RETDATALENGTH_INDEX     14\r
98 #define LOWPOWER_CPURETCTRL_RETDATALENGTH_MASK      (0x3FFUL << LOWPOWER_CPURETCTRL_RETDATALENGTH_INDEX)\r
99 \r
100 #define LOWPOWER_CPURETCTRL_ENA_DISABLE             0 /*!< In POWER DOWN mode, CPU Retention is disabled */\r
101 #define LOWPOWER_CPURETCTRL_ENA_ENABLE              1 /*!< In POWER DOWN mode, CPU Retention is enabled  */\r
102 \r
103 /**\r
104  * @brief Analog components power modes control during low power modes\r
105  */\r
106 typedef enum pd_bits\r
107 {\r
108     kPDRUNCFG_PD_DCDC = (1UL << 0),\r
109     kPDRUNCFG_PD_BIAS = (1UL << 1),\r
110     kPDRUNCFG_PD_BODCORE = (1UL << 2),\r
111     kPDRUNCFG_PD_BODVBAT = (1UL << 3),\r
112     kPDRUNCFG_PD_FRO1M = (1UL << 4),\r
113     kPDRUNCFG_PD_FRO192M = (1UL << 5),\r
114     kPDRUNCFG_PD_FRO32K = (1UL << 6),\r
115     kPDRUNCFG_PD_XTAL32K = (1UL << 7),\r
116     kPDRUNCFG_PD_XTAL32M = (1UL << 8),\r
117     kPDRUNCFG_PD_PLL0 = (1UL << 9),\r
118     kPDRUNCFG_PD_PLL1 = (1UL << 10),\r
119     kPDRUNCFG_PD_USB0_PHY = (1UL << 11),\r
120     kPDRUNCFG_PD_USB1_PHY = (1UL << 12),\r
121     kPDRUNCFG_PD_COMP = (1UL << 13),\r
122     kPDRUNCFG_PD_TEMPSENS = (1UL << 14),\r
123     kPDRUNCFG_PD_GPADC = (1UL << 15),\r
124     kPDRUNCFG_PD_LDOMEM = (1UL << 16),\r
125     kPDRUNCFG_PD_LDODEEPSLEEP = (1UL << 17),\r
126     kPDRUNCFG_PD_LDOUSBHS = (1UL << 18),\r
127     kPDRUNCFG_PD_LDOGPADC = (1UL << 19),\r
128     kPDRUNCFG_PD_LDOXO32M = (1UL << 20),\r
129     kPDRUNCFG_PD_LDOFLASHNV = (1UL << 21),\r
130     kPDRUNCFG_PD_RNG = (1UL << 22),\r
131     kPDRUNCFG_PD_PLL0_SSCG = (1UL << 23),\r
132     kPDRUNCFG_PD_ROM = (1UL << 24),\r
133 \r
134     /*\r
135        This enum member has no practical meaning,it is used to avoid MISRA issue,\r
136        user should not trying to use it.\r
137        */\r
138     kPDRUNCFG_ForceUnsigned = 0x80000000U,\r
139 } pd_bit_t;\r
140 \r
141 /**\r
142  * @brief SRAM instances retention control during low power modes\r
143  */\r
144 #define LOWPOWER_SRAMRETCTRL_RETEN_RAMX0            (1UL <<  0)  /*!< Enable SRAMX_0 retention when entering in Low power modes       */\r
145 #define LOWPOWER_SRAMRETCTRL_RETEN_RAMX1            (1UL <<  1)  /*!< Enable SRAMX_1 retention when entering in Low power modes       */\r
146 #define LOWPOWER_SRAMRETCTRL_RETEN_RAMX2            (1UL <<  2)  /*!< Enable SRAMX_2 retention when entering in Low power modes       */\r
147 #define LOWPOWER_SRAMRETCTRL_RETEN_RAMX3            (1UL <<  3)  /*!< Enable SRAMX_3 retention when entering in Low power modes       */\r
148 #define LOWPOWER_SRAMRETCTRL_RETEN_RAM00            (1UL <<  4)  /*!< Enable SRAM0_0 retention when entering in Low power modes       */\r
149 #define LOWPOWER_SRAMRETCTRL_RETEN_RAM01            (1UL <<  5)  /*!< Enable SRAM0_1 retention when entering in Low power modes       */\r
150 #define LOWPOWER_SRAMRETCTRL_RETEN_RAM10            (1UL <<  6)  /*!< Enable SRAM1_0 retention when entering in Low power modes       */\r
151 #define LOWPOWER_SRAMRETCTRL_RETEN_RAM20            (1UL <<  7)  /*!< Enable SRAM2_0 retention when entering in Low power modes       */\r
152 #define LOWPOWER_SRAMRETCTRL_RETEN_RAM30            (1UL <<  8)  /*!< Enable SRAM3_0 retention when entering in Low power modes       */\r
153 #define LOWPOWER_SRAMRETCTRL_RETEN_RAM31            (1UL <<  9)  /*!< Enable SRAM3_1 retention when entering in Low power modes       */\r
154 #define LOWPOWER_SRAMRETCTRL_RETEN_RAM40            (1UL << 10)  /*!< Enable SRAM4_0 retention when entering in Low power modes       */\r
155 #define LOWPOWER_SRAMRETCTRL_RETEN_RAM41            (1UL << 11)  /*!< Enable SRAM4_1 retention when entering in Low power modes       */\r
156 #define LOWPOWER_SRAMRETCTRL_RETEN_RAM42            (1UL << 12)  /*!< Enable SRAM4_2 retention when entering in Low power modes       */\r
157 #define LOWPOWER_SRAMRETCTRL_RETEN_RAM43            (1UL << 13)  /*!< Enable SRAM4_3 retention when entering in Low power modes       */\r
158 #define LOWPOWER_SRAMRETCTRL_RETEN_RAM_USB_HS       (1UL << 14)  /*!< Enable SRAM USB HS retention when entering in Low power modes   */\r
159 #define LOWPOWER_SRAMRETCTRL_RETEN_RAM_PUF          (1UL << 15)  /*!< Enable SRAM PUFF retention when entering in Low power modes     */\r
160 \r
161 /**\r
162  * @brief SRAM Low Power Modes\r
163  */\r
164 \r
165 #define LOWPOWER_SRAM_LPMODE_MASK                   (0xFUL)\r
166 #define LOWPOWER_SRAM_LPMODE_ACTIVE                 (0x6UL) /*!< SRAM functional mode                                */\r
167 #define LOWPOWER_SRAM_LPMODE_SLEEP                  (0xFUL) /*!< SRAM Sleep mode (Data retention, fast wake up)      */\r
168 #define LOWPOWER_SRAM_LPMODE_DEEPSLEEP              (0x8UL) /*!< SRAM Deep Sleep mode (Data retention, slow wake up) */\r
169 #define LOWPOWER_SRAM_LPMODE_SHUTDOWN               (0x9UL) /*!< SRAM Shut Down mode (no data retention)             */\r
170 #define LOWPOWER_SRAM_LPMODE_POWERUP                (0xAUL) /*!< SRAM is powering up                                 */\r
171 \r
172 /*@brief BOD VBAT level */\r
173 typedef enum _power_bod_vbat_level\r
174 {\r
175     kPOWER_BodVbatLevel1000mv = 0,  /*!< Brown out detector VBAT level 1V */\r
176     kPOWER_BodVbatLevel1100mv = 1,  /*!< Brown out detector VBAT level 1.1V */\r
177     kPOWER_BodVbatLevel1200mv = 2,  /*!< Brown out detector VBAT level 1.2V */\r
178     kPOWER_BodVbatLevel1300mv = 3,  /*!< Brown out detector VBAT level 1.3V */\r
179     kPOWER_BodVbatLevel1400mv = 4,  /*!< Brown out detector VBAT level 1.4V */\r
180     kPOWER_BodVbatLevel1500mv = 5,  /*!< Brown out detector VBAT level 1.5V */\r
181     kPOWER_BodVbatLevel1600mv = 6,  /*!< Brown out detector VBAT level 1.6V */\r
182     kPOWER_BodVbatLevel1650mv = 7,  /*!< Brown out detector VBAT level 1.65V */\r
183     kPOWER_BodVbatLevel1700mv = 8,  /*!< Brown out detector VBAT level 1.7V */\r
184     kPOWER_BodVbatLevel1750mv = 9,  /*!< Brown out detector VBAT level 1.75V */\r
185     kPOWER_BodVbatLevel1800mv = 10, /*!< Brown out detector VBAT level 1.8V */\r
186     kPOWER_BodVbatLevel1900mv = 11, /*!< Brown out detector VBAT level 1.9V */\r
187     kPOWER_BodVbatLevel2000mv = 12, /*!< Brown out detector VBAT level 2V */\r
188     kPOWER_BodVbatLevel2100mv = 13, /*!< Brown out detector VBAT level 2.1V */\r
189     kPOWER_BodVbatLevel2200mv = 14, /*!< Brown out detector VBAT level 2.2V */\r
190     kPOWER_BodVbatLevel2300mv = 15, /*!< Brown out detector VBAT level 2.3V */\r
191     kPOWER_BodVbatLevel2400mv = 16, /*!< Brown out detector VBAT level 2.4V */\r
192     kPOWER_BodVbatLevel2500mv = 17, /*!< Brown out detector VBAT level 2.5V */\r
193     kPOWER_BodVbatLevel2600mv = 18, /*!< Brown out detector VBAT level 2.6V */\r
194     kPOWER_BodVbatLevel2700mv = 19, /*!< Brown out detector VBAT level 2.7V */\r
195     kPOWER_BodVbatLevel2806mv = 20, /*!< Brown out detector VBAT level 2.806V */\r
196     kPOWER_BodVbatLevel2900mv = 21, /*!< Brown out detector VBAT level 2.9V */\r
197     kPOWER_BodVbatLevel3000mv = 22, /*!< Brown out detector VBAT level 3.0V */\r
198     kPOWER_BodVbatLevel3100mv = 23, /*!< Brown out detector VBAT level 3.1V */\r
199     kPOWER_BodVbatLevel3200mv = 24, /*!< Brown out detector VBAT level 3.2V */\r
200     kPOWER_BodVbatLevel3300mv = 25, /*!< Brown out detector VBAT level 3.3V */\r
201 } power_bod_vbat_level_t;\r
202 \r
203 /*@brief BOD core level */\r
204 typedef enum _power_bod_core_level\r
205 {\r
206     kPOWER_BodCoreLevel600mv = 0, /*!< Brown out detector core level 600mV */\r
207     kPOWER_BodCoreLevel650mv = 1, /*!< Brown out detector core level 650mV */\r
208     kPOWER_BodCoreLevel700mv = 2, /*!< Brown out detector core level 700mV */\r
209     kPOWER_BodCoreLevel750mv = 3, /*!< Brown out detector core level 750mV */\r
210     kPOWER_BodCoreLevel800mv = 4, /*!< Brown out detector core level 800mV */\r
211     kPOWER_BodCoreLevel850mv = 5, /*!< Brown out detector core level 850mV */\r
212     kPOWER_BodCoreLevel900mv = 6, /*!< Brown out detector core level 900mV */\r
213     kPOWER_BodCoreLevel950mv = 7, /*!< Brown out detector core level 950mV */\r
214 } power_bod_core_level_t;\r
215 \r
216 /*@brief BOD Hysteresis control */\r
217 typedef enum _power_bod_hyst\r
218 {\r
219     kPOWER_BodHystLevel25mv = 0U,  /*!< BOD Hysteresis control level 25mv */\r
220     kPOWER_BodHystLevel50mv = 1U,  /*!< BOD Hysteresis control level 50mv */\r
221     kPOWER_BodHystLevel75mv = 2U,  /*!< BOD Hysteresis control level 75mv */\r
222     kPOWER_BodHystLevel100mv = 3U, /*!< BOD Hysteresis control level 100mv */\r
223 } power_bod_hyst_t;\r
224 \r
225 /**\r
226  * @brief LDO Voltage control in Low Power Modes\r
227  */\r
228 #define LOWPOWER_VOLTAGE_LDO_PMU_INDEX              0\r
229 #define LOWPOWER_VOLTAGE_LDO_PMU_MASK               (0x1FULL << LOWPOWER_VOLTAGE_LDO_PMU_INDEX)\r
230 #define LOWPOWER_VOLTAGE_LDO_MEM_INDEX              5\r
231 #define LOWPOWER_VOLTAGE_LDO_MEM_MASK               (0x1FULL << LOWPOWER_VOLTAGE_LDO_MEM_INDEX)\r
232 #define LOWPOWER_VOLTAGE_LDO_DEEP_SLEEP_INDEX       10\r
233 #define LOWPOWER_VOLTAGE_LDO_DEEP_SLEEP_MASK        (0x7ULL  << LOWPOWER_VOLTAGE_LDO_DEEP_SLEEP_INDEX)\r
234 #define LOWPOWER_VOLTAGE_LDO_PMU_BOOST_INDEX        19\r
235 #define LOWPOWER_VOLTAGE_LDO_PMU_BOOST_MASK         (0x1FULL << LOWPOWER_VOLTAGE_LDO_PMU_BOOST_INDEX)\r
236 #define LOWPOWER_VOLTAGE_LDO_MEM_BOOST_INDEX        24\r
237 #define LOWPOWER_VOLTAGE_LDO_MEM_BOOST_MASK         (0x1FULL << LOWPOWER_VOLTAGE_LDO_MEM_BOOST_INDEX)\r
238 #define LOWPOWER_VOLTAGE_DCDC_INDEX                 29\r
239 #define LOWPOWER_VOLTAGE_DCDC_MASK                  (0xFULL << LOWPOWER_VOLTAGE_DCDC_INDEX)\r
240 \r
241 /**\r
242  * @brief Always On and Memories LDO voltage settings\r
243  */\r
244 \r
245 typedef enum _v_ao\r
246 {\r
247     // V_AO_1P220 1.22                     =      0,  /*!< 1.22  V */\r
248     V_AO_0P700 = 1,  /*!< 0.7   V */\r
249     V_AO_0P725 = 2,  /*!< 0.725 V */\r
250     V_AO_0P750 = 3,  /*!< 0.75  V */\r
251     V_AO_0P775 = 4,  /*!< 0.775 V */\r
252     V_AO_0P800 = 5,  /*!< 0.8   V */\r
253     V_AO_0P825 = 6,  /*!< 0.825 V */\r
254     V_AO_0P850 = 7,  /*!< 0.85  V */\r
255     V_AO_0P875 = 8,  /*!< 0.875 V */\r
256     V_AO_0P900 = 9,  /*!< 0.9   V */\r
257     V_AO_0P960 = 10, /*!< 0.96  V */\r
258     V_AO_0P970 = 11, /*!< 0.97  V */\r
259     V_AO_0P980 = 12, /*!< 0.98  V */\r
260     V_AO_0P990 = 13, /*!< 0.99  V */\r
261     V_AO_1P000 = 14, /*!< 1     V */\r
262     V_AO_1P010 = 15, /*!< 1.01  V */\r
263     V_AO_1P020 = 16, /*!< 1.02  V */\r
264     V_AO_1P030 = 17, /*!< 1.03  V */\r
265     V_AO_1P040 = 18, /*!< 1.04  V */\r
266     V_AO_1P050 = 19, /*!< 1.05  V */\r
267     V_AO_1P060 = 20, /*!< 1.06  V */\r
268     V_AO_1P070 = 21, /*!< 1.07  V */\r
269     V_AO_1P080 = 22, /*!< 1.08  V */\r
270     V_AO_1P090 = 23, /*!< 1.09  V */\r
271     V_AO_1P100 = 24, /*!< 1.1   V */\r
272     V_AO_1P110 = 25, /*!< 1.11  V */\r
273     V_AO_1P120 = 26, /*!< 1.12  V */\r
274     V_AO_1P130 = 27, /*!< 1.13  V */\r
275     V_AO_1P140 = 28, /*!< 1.14  V */\r
276     V_AO_1P150 = 29, /*!< 1.15  V */\r
277     V_AO_1P160 = 30, /*!< 1.16  V */\r
278     V_AO_1P220 = 31  /*!< 1.22  V */\r
279 } v_ao_t;\r
280 \r
281 /**\r
282  * @brief Deep Sleep LDO voltage settings\r
283  */\r
284 typedef enum _v_deepsleep\r
285 {\r
286     V_DEEPSLEEP_0P900 = 0, /*!< 0.9   V */\r
287     V_DEEPSLEEP_0P925 = 1, /*!< 0.925 V */\r
288     V_DEEPSLEEP_0P950 = 2, /*!< 0.95  V */\r
289     V_DEEPSLEEP_0P975 = 3, /*!< 0.975 V */\r
290     V_DEEPSLEEP_1P000 = 4, /*!< 1.000 V */\r
291     V_DEEPSLEEP_1P025 = 5, /*!< 1.025 V */\r
292     V_DEEPSLEEP_1P050 = 6, /*!< 1.050 V */\r
293     V_DEEPSLEEP_1P075 = 7  /*!< 1.075 V */\r
294 } v_deepsleep_t;\r
295 \r
296 /**\r
297  * @brief DCDC voltage settings\r
298  */\r
299 typedef enum _v_dcdc\r
300 {\r
301     V_DCDC_0P950 = 0, /*!< 0.95  V */\r
302     V_DCDC_0P975 = 1, /*!< 0.975 V */\r
303     V_DCDC_1P000 = 2, /*!< 1     V */\r
304     V_DCDC_1P025 = 3, /*!< 1.025 V */\r
305     V_DCDC_1P050 = 4, /*!< 1.050 V */\r
306     V_DCDC_1P075 = 5, /*!< 1.075 V */\r
307     V_DCDC_1P100 = 6, /*!< 1.1   V */\r
308     V_DCDC_1P125 = 7, /*!< 1.125 V */\r
309     V_DCDC_1P150 = 8, /*!< 1.150 V */\r
310     V_DCDC_1P175 = 9, /*!< 1.175 V */\r
311     V_DCDC_1P200 = 10 /*!< 1.2   V */\r
312 } v_dcdc_t;\r
313 /**\r
314  * @brief LDO_FLASH_NV & LDO_USB voltage settings\r
315  */\r
316 typedef enum _v_flashnv\r
317 {\r
318     V_LDOFLASHNV_1P650 = 0,  /*!< 0.95  V */\r
319     V_LDOFLASHNV_1P700 = 1,  /*!< 0.975 V */\r
320     V_LDOFLASHNV_1P750 = 2,  /*!< 1     V */\r
321     V_LDOFLASHNV_0P800 = 3,  /*!< 1.025 V */\r
322     V_LDOFLASHNV_1P850 = 4,  /*!< 1.050 V */\r
323     V_LDOFLASHNV_1P900 = 5,  /*!< 1.075 V */\r
324     V_LDOFLASHNV_1P950 = 6,  /*!< 1.1   V */\r
325     V_LDOFLASHNV_2P000 = 7  /*!< 1.125 V */\r
326 } v_flashnv_t;\r
327 \r
328 /**\r
329  * @brief Low Power Modes Wake up sources\r
330  */\r
331 \r
332 #define WAKEUP_SYS                                  (1ULL <<  0) /*!< [SLEEP, DEEP SLEEP                             ] */ /* WWDT0_IRQ and BOD_IRQ*/\r
333 #define WAKEUP_SDMA0                                (1ULL <<  1) /*!< [SLEEP, DEEP SLEEP                             ] */\r
334 #define WAKEUP_GPIO_GLOBALINT0                      (1ULL <<  2) /*!< [SLEEP, DEEP SLEEP, POWER DOWN                 ] */\r
335 #define WAKEUP_GPIO_GLOBALINT1                      (1ULL <<  3) /*!< [SLEEP, DEEP SLEEP, POWER DOWN                 ] */\r
336 #define WAKEUP_GPIO_INT0_0                          (1ULL <<  4) /*!< [SLEEP, DEEP SLEEP                             ] */\r
337 #define WAKEUP_GPIO_INT0_1                          (1ULL <<  5) /*!< [SLEEP, DEEP SLEEP                             ] */\r
338 #define WAKEUP_GPIO_INT0_2                          (1ULL <<  6) /*!< [SLEEP, DEEP SLEEP                             ] */\r
339 #define WAKEUP_GPIO_INT0_3                          (1ULL <<  7) /*!< [SLEEP, DEEP SLEEP                             ] */\r
340 #define WAKEUP_UTICK                                (1ULL <<  8) /*!< [SLEEP,                                        ] */\r
341 #define WAKEUP_MRT                                  (1ULL <<  9) /*!< [SLEEP,                                        ] */\r
342 #define WAKEUP_CTIMER0                              (1ULL << 10) /*!< [SLEEP, DEEP SLEEP                             ] */\r
343 #define WAKEUP_CTIMER1                              (1ULL << 11) /*!< [SLEEP, DEEP SLEEP                             ] */\r
344 #define WAKEUP_SCT                                  (1ULL << 12) /*!< [SLEEP,                                        ] */\r
345 #define WAKEUP_CTIMER3                              (1ULL << 13) /*!< [SLEEP, DEEP SLEEP                             ] */\r
346 #define WAKEUP_FLEXCOMM0                            (1ULL << 14) /*!< [SLEEP, DEEP SLEEP                             ] */\r
347 #define WAKEUP_FLEXCOMM1                            (1ULL << 15) /*!< [SLEEP, DEEP SLEEP                             ] */\r
348 #define WAKEUP_FLEXCOMM2                            (1ULL << 16) /*!< [SLEEP, DEEP SLEEP                             ] */\r
349 #define WAKEUP_FLEXCOMM3                            (1ULL << 17) /*!< [SLEEP, DEEP SLEEP, POWER DOWN                 ] */\r
350 #define WAKEUP_FLEXCOMM4                            (1ULL << 18) /*!< [SLEEP, DEEP SLEEP                             ] */\r
351 #define WAKEUP_FLEXCOMM5                            (1ULL << 19) /*!< [SLEEP, DEEP SLEEP                             ] */\r
352 #define WAKEUP_FLEXCOMM6                            (1ULL << 20) /*!< [SLEEP, DEEP SLEEP                             ] */\r
353 #define WAKEUP_FLEXCOMM7                            (1ULL << 21) /*!< [SLEEP, DEEP SLEEP                             ] */\r
354 #define WAKEUP_ADC                                  (1ULL << 22) /*!< [SLEEP,                                        ] */\r
355 // reserved                                         (1ULL << 23) /*!< [SLEEP, DEEP SLEEP                             ] */\r
356 #define WAKEUP_ACMP_CAPT                            (1ULL << 24) /*!< [SLEEP, DEEP SLEEP, POWER DOWN                 ] */\r
357 // reserved                                         (1ULL << 25)\r
358 // reserved                                         (1ULL << 26)\r
359 #define WAKEUP_USB0_NEEDCLK                         (1ULL << 27) /*!< [SLEEP, DEEP SLEEP                             ] */\r
360 #define WAKEUP_USB0                                 (1ULL << 28) /*!< [SLEEP, DEEP SLEEP                             ] */\r
361 #define WAKEUP_RTC_LITE_ALARM_WAKEUP                (1ULL << 29) /*!< [SLEEP, DEEP SLEEP, POWER DOWN, DEEP POWER DOWN] */\r
362 #define WAKEUP_EZH_ARCH_B                           (1ULL << 30) /*!< [SLEEP,                                        ] */\r
363 #define WAKEUP_WAKEUP_MAILBOX                       (1ULL << 31) /*!< [SLEEP, DEEP SLEEP, POWER DOWN                 ] */\r
364 #define WAKEUP_GPIO_INT0_4                          (1ULL << 32) /*!< [SLEEP, DEEP SLEEP                             ] */\r
365 #define WAKEUP_GPIO_INT0_5                          (1ULL << 33) /*!< [SLEEP, DEEP SLEEP                             ] */\r
366 #define WAKEUP_GPIO_INT0_6                          (1ULL << 34) /*!< [SLEEP, DEEP SLEEP                             ] */\r
367 #define WAKEUP_GPIO_INT0_7                          (1ULL << 35) /*!< [SLEEP, DEEP SLEEP                             ] */\r
368 #define WAKEUP_CTIMER2                              (1ULL << 36) /*!< [SLEEP, DEEP SLEEP                             ] */\r
369 #define WAKEUP_CTIMER4                              (1ULL << 37) /*!< [SLEEP, DEEP SLEEP                             ] */\r
370 #define WAKEUP_OS_EVENT_TIMER                       (1ULL << 38) /*!< [SLEEP, DEEP SLEEP, POWER DOWN, DEEP POWER DOWN] */\r
371 // reserved                                         (1ULL << 39)\r
372 // reserved                                         (1ULL << 40)\r
373 // reserved                                         (1ULL << 41)\r
374 #define WAKEUP_SDIO                                 (1ULL << 42) /*!< [SLEEP,                                        ] */\r
375 // reserved                                         (1ULL << 43)\r
376 // reserved                                         (1ULL << 44)\r
377 // reserved                                         (1ULL << 45)\r
378 // reserved                                         (1ULL << 46)\r
379 #define WAKEUP_USB1                                 (1ULL << 47) /*!< [SLEEP, DEEP SLEEP                             ] */\r
380 #define WAKEUP_USB1_NEEDCLK                         (1ULL << 48) /*!< [SLEEP, DEEP SLEEP                             ] */\r
381 #define WAKEUP_SEC_HYPERVISOR_CALL                  (1ULL << 49) /*!< [SLEEP,                                        ] */\r
382 #define WAKEUP_SEC_GPIO_INT0_0                      (1ULL << 50) /*!< [SLEEP, DEEP SLEEP                             ] */\r
383 #define WAKEUP_SEC_GPIO_INT0_1                      (1ULL << 51) /*!< [SLEEP, DEEP SLEEP                             ] */\r
384 #define WAKEUP_PLU                                  (1ULL << 52) /*!< [SLEEP, DEEP SLEEP                             ] */\r
385 #define WAKEUP_SEC_VIO                              (1ULL << 53)\r
386 #define WAKEUP_SHA                                  (1ULL << 54) /*!< [SLEEP,                                        ] */\r
387 #define WAKEUP_CASPER                               (1ULL << 55) /*!< [SLEEP,                                        ] */\r
388 #define WAKEUP_PUFF                                 (1ULL << 56) /*!< [SLEEP,                                        ] */\r
389 #define WAKEUP_PQ                                   (1ULL << 57) /*!< [SLEEP,                                        ] */\r
390 #define WAKEUP_SDMA1                                (1ULL << 58) /*!< [SLEEP, DEEP SLEEP                             ] */\r
391 #define WAKEUP_LSPI_HS                              (1ULL << 59) /*!< [SLEEP, DEEP SLEEP                             ] */\r
392 // reserved WAKEUP_PVTVF0_AMBER                     (1ULL << 60)\r
393 // reserved WAKEUP_PVTVF0_RED                       (1ULL << 61)\r
394 // reserved WAKEUP_PVTVF1_AMBER                     (1ULL << 62)\r
395 #define WAKEUP_ALLWAKEUPIOS                         (1ULL << 63) /*!< [                             , DEEP POWER DOWN] */\r
396 \r
397 \r
398 /**\r
399  * @brief Sleep Postpone\r
400  */\r
401 #define LOWPOWER_HWWAKE_FORCED                      (1UL <<  0)  /*!< Force peripheral clocking to stay on during deep-sleep mode. */\r
402 #define LOWPOWER_HWWAKE_PERIPHERALS                 (1UL <<  1)  /*!< Wake for Flexcomms. Any Flexcomm FIFO reaching the level specified by its own TXLVL will cause peripheral clocking to wake up temporarily while the related status is asserted */\r
403 #define LOWPOWER_HWWAKE_SDMA0                       (1UL <<  3)  /*!< Wake for DMA0. DMA0 being busy will cause peripheral clocking to remain running until DMA completes. Used in conjonction with LOWPOWER_HWWAKE_PERIPHERALS */\r
404 #define LOWPOWER_HWWAKE_SDMA1                       (1UL <<  5)  /*!< Wake for DMA1. DMA0 being busy will cause peripheral clocking to remain running until DMA completes. Used in conjonction with LOWPOWER_HWWAKE_PERIPHERALS */\r
405 #define LOWPOWER_HWWAKE_ENABLE_FRO192M              (1UL << 31)  /*!< Need to be set if FRO192M is disable - via PDCTRL0 - in Deep Sleep mode and any of LOWPOWER_HWWAKE_PERIPHERALS, LOWPOWER_HWWAKE_SDMA0 or LOWPOWER_HWWAKE_SDMA1 is set */\r
406 \r
407 /**\r
408  * @brief Wake up I/O sources\r
409  */\r
410 #define LOWPOWER_WAKEUPIOSRC_PIO0_INDEX             0  /*!< Pin P1( 1) */\r
411 #define LOWPOWER_WAKEUPIOSRC_PIO1_INDEX             2  /*!< Pin P0(28) */\r
412 #define LOWPOWER_WAKEUPIOSRC_PIO2_INDEX             4  /*!< Pin P1(18) */\r
413 #define LOWPOWER_WAKEUPIOSRC_PIO3_INDEX             6  /*!< Pin P1(30) */\r
414 \r
415 #define LOWPOWER_WAKEUPIOSRC_DISABLE                0  /*!< Wake up is disable                      */\r
416 #define LOWPOWER_WAKEUPIOSRC_RISING                 1  /*!< Wake up on rising edge                  */\r
417 #define LOWPOWER_WAKEUPIOSRC_FALLING                2  /*!< Wake up on falling edge                 */\r
418 #define LOWPOWER_WAKEUPIOSRC_RISING_FALLING         3  /*!< Wake up on both rising or falling edges */\r
419 \r
420 /**\r
421  * @brief Wake up timers configuration in Low Power Modes\r
422  */\r
423 #define LOWPOWER_TIMERCFG_CTRL_INDEX                0\r
424 #define LOWPOWER_TIMERCFG_CTRL_MASK                 (0x1UL << LOWPOWER_TIMERCFG_CTRL_INDEX)\r
425 #define LOWPOWER_TIMERCFG_TIMER_INDEX               1\r
426 #define LOWPOWER_TIMERCFG_TIMER_MASK                (0x7UL << LOWPOWER_TIMERCFG_TIMER_INDEX)\r
427 #define LOWPOWER_TIMERCFG_OSC32K_INDEX              4\r
428 #define LOWPOWER_TIMERCFG_OSC32K_MASK               (0x1UL << LOWPOWER_TIMERCFG_OSC32K_INDEX)\r
429 \r
430 #define LOWPOWER_TIMERCFG_CTRL_DISABLE              0 /*!< Wake Timer Disable */\r
431 #define LOWPOWER_TIMERCFG_CTRL_ENABLE               1 /*!< Wake Timer Enable  */\r
432 \r
433 /**\r
434  * @brief Primary Wake up timers configuration in Low Power Modes\r
435  */\r
436 #define LOWPOWER_TIMERCFG_TIMER_RTC1KHZ             0 /*!< 1 KHz Real Time Counter (RTC) used as wake up source */\r
437 #define LOWPOWER_TIMERCFG_TIMER_RTC1HZ              1 /*!< 1 Hz Real Time Counter (RTC) used as wake up source  */\r
438 #define LOWPOWER_TIMERCFG_TIMER_OSTIMER             2 /*!< OS Event Timer used as wake up source                */\r
439 \r
440 #define LOWPOWER_TIMERCFG_OSC32K_FRO32KHZ           0 /*!< Wake up Timers uses FRO 32 KHz as clock source      */\r
441 #define LOWPOWER_TIMERCFG_OSC32K_XTAL32KHZ          1 /*!< Wake up Timers uses Chrystal 32 KHz as clock source */\r
442 \r
443 //! @brief Interface for lowpower functions\r
444 typedef struct LowpowerDriverInterface\r
445 {\r
446     void (*power_cycle_cpu_and_flash)(void);\r
447     void (*set_lowpower_mode)(LPC_LOWPOWER_T *p_lowpower_cfg);\r
448 } lowpower_driver_interface_t;\r
449 \r
450 /* Power mode configuration API parameter */\r
451 typedef enum _power_mode_config\r
452 {\r
453     kPmu_Sleep = 0U,\r
454     kPmu_Deep_Sleep = 1U,\r
455     kPmu_PowerDown = 2U,\r
456     kPmu_Deep_PowerDown = 3U,\r
457 } power_mode_cfg_t;\r
458 \r
459 /*******************************************************************************\r
460  * API\r
461  ******************************************************************************/\r
462 \r
463 #ifdef __cplusplus\r
464 extern "C" {\r
465 #endif\r
466 \r
467 /*!\r
468  * @brief API to enable PDRUNCFG bit in the Syscon. Note that enabling the bit powers down the peripheral\r
469  *\r
470  * @param en    peripheral for which to enable the PDRUNCFG bit\r
471  * @return none\r
472  */\r
473 static inline void POWER_EnablePD(pd_bit_t en)\r
474 {\r
475     /* PDRUNCFGSET */\r
476     PMC->PDRUNCFGSET0 = en;\r
477 }\r
478 \r
479 /*!\r
480  * @brief API to disable PDRUNCFG bit in the Syscon. Note that disabling the bit powers up the peripheral\r
481  *\r
482  * @param en    peripheral for which to disable the PDRUNCFG bit\r
483  * @return none\r
484  */\r
485 static inline void POWER_DisablePD(pd_bit_t en)\r
486 {\r
487     /* PDRUNCFGCLR */\r
488     PMC->PDRUNCFGCLR0 = en;\r
489 }\r
490 \r
491 /*!\r
492  * @brief set BOD VBAT level.\r
493  *\r
494  * @param level BOD detect level\r
495  * @param hyst BoD Hysteresis control\r
496  * @param enBodVbatReset VBAT brown out detect reset\r
497  */\r
498 static inline void POWER_SetBodVbatLevel(power_bod_vbat_level_t level, power_bod_hyst_t hyst, bool enBodVbatReset)\r
499 {\r
500     PMC->BODVBAT = (PMC->BODVBAT & (~(PMC_BODVBAT_TRIGLVL_MASK | PMC_BODVBAT_HYST_MASK))) | PMC_BODVBAT_TRIGLVL(level) |\r
501         PMC_BODVBAT_HYST(hyst);\r
502     PMC->RESETCTRL =\r
503         (PMC->RESETCTRL & (~PMC_RESETCTRL_BODVBATRESETENABLE_MASK)) | PMC_RESETCTRL_BODVBATRESETENABLE(enBodVbatReset);\r
504 }\r
505 \r
506 /*!\r
507  * @brief set BOD core level.\r
508  *\r
509  * @param level BOD detect level\r
510  * @param hyst BoD Hysteresis control\r
511  * @param enBodCoreReset core brown out detect reset\r
512  */\r
513 static inline void POWER_SetBodCoreLevel(power_bod_core_level_t level, power_bod_hyst_t hyst, bool enBodCoreReset)\r
514 {\r
515     PMC->BODCORE = (PMC->BODCORE & (~(PMC_BODCORE_TRIGLVL_MASK | PMC_BODCORE_HYST_MASK))) | PMC_BODCORE_TRIGLVL(level) |\r
516         PMC_BODCORE_HYST(hyst);\r
517     PMC->RESETCTRL =\r
518         (PMC->RESETCTRL & (~PMC_RESETCTRL_BODCORERESETENABLE_MASK)) | PMC_RESETCTRL_BODCORERESETENABLE(enBodCoreReset);\r
519 }\r
520 \r
521 /*!\r
522  * @brief API to enable deep sleep bit in the ARM Core.\r
523  *\r
524  * @param none\r
525  * @return none\r
526  */\r
527 static inline void POWER_EnableDeepSleep(void)\r
528 {\r
529     SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk;\r
530 }\r
531 \r
532 /*!\r
533  * @brief API to disable deep sleep bit in the ARM Core.\r
534  *\r
535  * @param none\r
536  * @return none\r
537  */\r
538 static inline void POWER_DisableDeepSleep(void)\r
539 {\r
540     SCB->SCR &= ~SCB_SCR_SLEEPDEEP_Msk;\r
541 }\r
542 \r
543 /*!\r
544  * @brief API to power down flash controller.\r
545  *\r
546  * @param none\r
547  * @return none\r
548  */\r
549 static inline void POWER_PowerDownFlash(void)\r
550 {\r
551 #if !(defined(FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL) && FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL)\r
552         /* TURN OFF clock ip_2113 (only needed for FLASH programming, will be turned on by ROM API) */\r
553         CLOCK_DisableClock(kCLOCK_Flash);\r
554 \r
555         /* TURN OFF clock ip_2113 (only needed for FLASH programming, will be turned on by ROM API) */\r
556         CLOCK_DisableClock(kCLOCK_Fmc);\r
557 #endif /* FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL */\r
558 }\r
559 \r
560 /*!\r
561  * @brief API to power up flash controller.\r
562  *\r
563  * @param none\r
564  * @return none\r
565  */\r
566 static inline void POWER_PowerUpFlash(void)\r
567 {\r
568 #if !(defined(FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL) && FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL)\r
569     /* TURN OFF clock ip_2113 (only needed for FLASH programming, will be turned on by ROM API) */\r
570     CLOCK_EnableClock(kCLOCK_Fmc);\r
571 #endif /* FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL */\r
572 }\r
573 \r
574 /**\r
575  * @brief   Configures and enters in low power mode\r
576  * @param   p_lowpower_cfg: pointer to a structure that contains all low power mode parameters\r
577  * @return  Nothing\r
578  *\r
579  *          !!! IMPORTANT NOTES :\r
580  *           1 - CPU Interrupt Enable registers are updated with p_lowpower_cfg->WAKEUPINT. They are NOT restored by the\r
581  * API.\r
582  *           2 - The Non Maskable Interrupt (NMI) should be disable before calling this API (otherwise, there is a risk\r
583  * of Dead Lock).\r
584  *           3 - The HARD FAULT handler should execute from SRAM. (The Hard fault handler should initiate a full chip\r
585  * reset)\r
586  */\r
587 void POWER_EnterLowPower(LPC_LOWPOWER_T *p_lowpower_cfg);\r
588 \r
589 /**\r
590  * @brief   Shut off the Flash and execute the _WFI(), then power up the Flash after wake-up event\r
591  *  This MUST BE EXECUTED outside the Flash:\r
592  *  either from ROM or from SRAM. The rest could stay in Flash. But, for consistency, it is\r
593  *  preferable to have all functions defined in this file implemented in ROM.\r
594  * @param   None\r
595  * @return  Nothing\r
596  */\r
597 void POWER_CycleCpuAndFlash(void);\r
598 \r
599 /**\r
600  * @brief   Configures and enters in DEEP-SLEEP low power mode\r
601  * @param   exclude_from_pd:\r
602  * @param   sram_retention_ctrl:\r
603  * @param   wakeup_interrupts:\r
604  * @param   hardware_wake_ctrl:\r
605 \r
606  * @return  Nothing\r
607  *\r
608  *          !!! IMPORTANT NOTES :\r
609  0 - CPU0 & System CLock frequency is switched to FRO12MHz and is NOT restored back by the API.\r
610  *           1 - CPU0 Interrupt Enable registers (NVIC->ISER) are modified by this function. They are restored back in case of CPU retention or if POWERDOWN is not taken (for instance because an interrupt is pending).\r
611  *           2 - The Non Maskable Interrupt (NMI) is disabled and its configuration before calling this function will be restored back if POWERDOWN is not taken (for instance because an RTC or OSTIMER interrupt is pending).\r
612  *           3 - The HARD FAULT handler should execute from SRAM. (The Hard fault handler should initiate a full chip reset)\r
613  reset)\r
614  */\r
615 void POWER_EnterDeepSleep(uint32_t exclude_from_pd, uint32_t sram_retention_ctrl, uint64_t wakeup_interrupts,uint32_t hardware_wake_ctrl);\r
616 \r
617 /**\r
618  * @brief   Configures and enters in POWERDOWN low power mode\r
619  * @param   exclude_from_pd:\r
620  * @param   sram_retention_ctrl:\r
621  * @param   wakeup_interrupts:\r
622  * @param   cpu_retention_ctrl:  0 = CPU retention is disable / 1 = CPU retention is enabled, all other values are\r
623  RESERVED.\r
624 \r
625  * @return  Nothing\r
626  *\r
627  *          !!! IMPORTANT NOTES :\r
628  0 - CPU0 & System CLock frequency is switched to FRO12MHz and is NOT restored back by the API.\r
629  *           1 - CPU0 Interrupt Enable registers (NVIC->ISER) are modified by this function. They are restored back in case of CPU retention or if POWERDOWN is not taken (for instance because an interrupt is pending).\r
630  *           2 - The Non Maskable Interrupt (NMI) is disabled and its configuration before calling this function will be restored back if POWERDOWN is not taken (for instance because an RTC or OSTIMER interrupt is pending).\r
631  *           3 - In case of CPU retention, it is the responsability of the user to make sure that SRAM instance containing the stack used to call this function WILL BE preserved during low power (via parameter "sram_retention_ctrl")\r
632  *           4 - The HARD FAULT handler should execute from SRAM. (The Hard fault handler should initiate a full chip reset)\r
633  reset)\r
634  */\r
635 void POWER_EnterPowerDown(uint32_t exclude_from_pd, uint32_t sram_retention_ctrl, uint64_t wakeup_interrupts, uint32_t cpu_retention_ctrl);\r
636 \r
637 /**\r
638  * @brief   Configures and enters in DEEPPOWERDOWN low power mode\r
639  * @param   exclude_from_pd:\r
640  * @param   sram_retention_ctrl:\r
641  * @param   wakeup_interrupts:\r
642  * @param   wakeup_io_ctrl:\r
643 \r
644  * @return  Nothing\r
645  *\r
646  *          !!! IMPORTANT NOTES :\r
647  0 - CPU0 & System CLock frequency is switched to FRO12MHz and is NOT restored back by the API.\r
648  *           1 - CPU0 Interrupt Enable registers (NVIC->ISER) are modified by this function. They are restored back if DEEPPOWERDOWN is not taken (for instance because an RTC or OSTIMER interrupt is pending).\r
649  *           2 - The Non Maskable Interrupt (NMI) is disabled and its configuration before calling this function will be restored back if DEEPPOWERDOWN is not taken (for instance because an RTC or OSTIMER interrupt is pending).\r
650  *           3 - The HARD FAULT handler should execute from SRAM. (The Hard fault handler should initiate a full chip reset)\r
651  */\r
652 void POWER_EnterDeepPowerDown(uint32_t exclude_from_pd, uint32_t sram_retention_ctrl, uint64_t wakeup_interrupts, uint32_t wakeup_io_ctrl);\r
653 \r
654 /**\r
655  * @brief   Configures and enters in SLEEP low power mode\r
656  * @param   :\r
657  * @return  Nothing\r
658  */\r
659 void POWER_EnterSleep(void);\r
660 \r
661 /*!\r
662  * @brief Power Library API to choose normal regulation and set the voltage for the desired operating frequency.\r
663  *\r
664  * @param system_freq_hz  - The desired frequency (in Hertz) at which the part would like to operate,\r
665  *                note that the voltage and flash wait states should be set before changing frequency\r
666  * @return none\r
667  */\r
668 void POWER_SetVoltageForFreq(uint32_t system_freq_hz);\r
669 \r
670 /*!\r
671  * @brief Power Library API to return the library version.\r
672  *\r
673  * @param none\r
674  * @return version number of the power library\r
675  */\r
676 uint32_t POWER_GetLibVersion(void);\r
677 \r
678 /**\r
679  * @brief   Sets board-specific trim values for 16MHz XTAL\r
680  * @param   pi32_32MfXtalIecLoadpF_x100 Load capacitance, pF x 100. For example, 6pF becomes 600, 1.2pF becomes 120\r
681  * @param   pi32_32MfXtalPPcbParCappF_x100 PCB +ve parasitic capacitance, pF x 100. For example, 6pF becomes 600, 1.2pF becomes 120\r
682  * @param   pi32_32MfXtalNPcbParCappF_x100 PCB -ve parasitic capacitance, pF x 100. For example, 6pF becomes 600, 1.2pF becomes 120\r
683  * @return  none\r
684  * @note    Following default Values can be used:\r
685  *          pi32_32MfXtalIecLoadpF_x100    Load capacitance, pF x 100 : 600\r
686  *          pi32_32MfXtalPPcbParCappF_x100 PCB +ve parasitic capacitance, pF x 100 : 20\r
687  *          pi32_32MfXtalNPcbParCappF_x100 PCB -ve parasitic capacitance, pF x 100 : 40\r
688  */\r
689 extern void POWER_Xtal16mhzCapabankTrim(int32_t pi32_16MfXtalIecLoadpF_x100, int32_t pi32_16MfXtalPPcbParCappF_x100, int32_t pi32_16MfXtalNPcbParCappF_x100);\r
690 /**\r
691  * @brief   Sets board-specific trim values for 32kHz XTAL\r
692  * @param   pi32_32kfXtalIecLoadpF_x100 Load capacitance, pF x 100. For example, 6pF becomes 600, 1.2pF becomes 120\r
693  * @param   pi32_32kfXtalPPcbParCappF_x100 PCB +ve parasitic capacitance, pF x 100. For example, 6pF becomes 600, 1.2pF becomes 120\r
694  * @param   pi32_32kfXtalNPcbParCappF_x100 PCB -ve parasitic capacitance, pF x 100. For example, 6pF becomes 600, 1.2pF becomes 120\r
695 \r
696  * @return  none\r
697  * @note    Following default Values can be used:\r
698  *          pi32_32kfXtalIecLoadpF_x100    Load capacitance, pF x 100 : 600\r
699  *          pi32_32kfXtalPPcbParCappF_x100 PCB +ve parasitic capacitance, pF x 100 : 40\r
700  *          pi32_32kfXtalNPcbParCappF_x100 PCB -ve parasitic capacitance, pF x 100 : 40\r
701  */\r
702 extern void POWER_Xtal32khzCapabankTrim(int32_t pi32_32kfXtalIecLoadpF_x100, int32_t pi32_32kfXtalPPcbParCappF_x100, int32_t pi32_32kfXtalNPcbParCappF_x100);\r
703 /**\r
704  * @brief   Enables and sets LDO for 16MHz XTAL\r
705  * @param       none\r
706  * @return  none\r
707  */\r
708 extern void POWER_SetXtal16mhzLdo(void);\r
709 /**\r
710  * @brief   Set up 16-MHz XTAL Trimmings\r
711  * @param       amp Amplitude\r
712  * @param       gm  Transconductance\r
713  * @return  none\r
714  */\r
715 extern void POWER_SetXtal16mhzTrim(uint32_t amp, uint32_t gm);\r
716 #ifdef __cplusplus\r
717     }\r
718 #endif\r
719 \r
720 /**\r
721  * @}\r
722  */\r
723 \r
724 #endif /* _FSL_POWER_H_ */\r