summaryrefslogtreecommitdiff
path: root/bsp/maxim/libraries/MAX32660PeriphDriver/Include/lp.h
blob: 7339b6fdbf1af8076e0f98b89d6ac74017563134 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
/**
 * @file    lp.h
 * @brief   Low power function prototypes and data types.
 */


/* ****************************************************************************
 * Copyright (C) 2017 Maxim Integrated Products, Inc., All Rights Reserved.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the "Software"),
 * to deal in the Software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 * and/or sell copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included
 * in all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
 * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES
 * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 * OTHER DEALINGS IN THE SOFTWARE.
 *
 * Except as contained in this notice, the name of Maxim Integrated
 * Products, Inc. shall not be used except as stated in the Maxim Integrated
 * Products, Inc. Branding Policy.
 *
 * The mere transfer of this software does not imply any licenses
 * of trade secrets, proprietary technology, copyrights, patents,
 * trademarks, maskwork rights, or any other form of intellectual
 * property whatsoever. Maxim Integrated Products, Inc. retains all
 * ownership rights.
 *
 * $Date: 2018-09-26 08:48:30 -0500 (Wed, 26 Sep 2018) $
 * $Revision: 38105 $
 *
 *************************************************************************** */
 
// Define to prevent redundant inclusion 
#ifndef _LP_H_
#define _LP_H_

/***** Includes *****/
#include "gpio.h"
#include "pwrseq_regs.h"

#ifdef __cplusplus
extern "C" {
#endif

/** @brief System reset0 enumeration. Used in SYS_PeriphReset0 function */
typedef enum {
    LP_OVR_0_9       = MXC_S_PWRSEQ_LP_CTRL_OVR_0_9V,         /**< Reset DMA */
    LP_OVR_1_0       = MXC_S_PWRSEQ_LP_CTRL_OVR_1_0V,         /**< Reset DMA */
    LP_OVR_1_1       = MXC_S_PWRSEQ_LP_CTRL_OVR_1_1V,         /**< Reset DMA */
} lp_ovr_t;

/**
 * @brief 	   Clears the low power wakeup flags
 */	
void LP_ClearWakeStatus(void);

/**
 * @brief      Enables power to RAM addresses 0x20010000-0x20017FFF.
 */
void LP_EnableSRAM3(void);

/**
 * @brief      Enables power to RAM addresses 0x20008000-0x2000FFFF.
 */
void LP_EnableSRAM2(void);

/**
 * @brief      Enables power to RAM addresses 0x20004000-0x20007FFF.
 */
void LP_EnableSRAM1(void);

/**
 * @brief      Enables power to RAM addresses 0x20000000-0x20003FFF.
 */
void LP_EnableSRAM0(void);

/**
 * @brief      Disables power to RAM addresses 0x20010000-0x20017FFF. The contents of the RAM are destroyed.
 */
void LP_DisableSRAM3(void);

/**
 * @brief      Disables power to RAM addresses 0x20008000-0x2000FFFF. The contents of the RAM are destroyed.
 */
void LP_DisableSRAM2(void);

/**
 * @brief      Disables power to RAM addresses 0x20004000-0x20007FFF. The contents of the RAM are destroyed.
 */
void LP_DisableSRAM1(void);

/**
 * @brief      Disables power to RAM addresses 0x20000000-0x20003FFF. The contents of the RAM are destroyed.
 */
void LP_DisableSRAM0(void);

/**
 * @brief      Places the instruction cache in light sleep mode. Data will be unavailable for read/write operations but will be retained.
 */
void LP_EnableICacheLightSleep(void);

/**
 * @brief      Places addresses 0x20010000 to 0x20017FFF of the RAM in light sleep mode. Data will be unavailable for read/write operations but will be retained.
 */
void LP_EnableSysRAM3LightSleep(void);

/**
 * @brief      Places addresses 0x20008000 to 0x2000FFFF of the RAM in light sleep mode. Data will be unavailable for read/write operations but will be retained.
 */
void LP_EnableSysRAM2LightSleep(void);

/**
 * @brief      Places addresses 0x20004000 to 0x20007FFF of the RAM in light sleep mode. Data will be unavailable for read/write operations but will be retained.
 */
void LP_EnableSysRAM1LightSleep(void);

/**
 * @brief      Places addresses 0x20000000 to 0x20003FFF of the RAM in light sleep mode. Data will be unavailable for read/write operations but will be retained.
 */
void LP_EnableSysRAM0LightSleep(void);

/**
 * @brief      Places the instruction cache in active mode.
 */
void LP_DisableICacheLightSleep(void);

/**
 * @brief      Places addresses 0x20010000 to 0x20017FFF of the RAM in active mode.
 */
void LP_DisableSysRAM3LightSleep(void);

/**
 * @brief      Places addresses 0x20008000 to 0x2000FFFF of the RAM in active mode.
 */
void LP_DisableSysRAM2LightSleep(void);

/**
 * @brief      Places addresses 0x20004000 to 0x20007FFF of the RAM in active mode.
 */
void LP_DisableSysRAM1LightSleep(void);

/**
 * @brief      Places addresses 0x20000000 to 0x20003FFF of the RAM in active mode.
 */
void LP_DisableSysRAM0LightSleep(void);

/**
 * @brief      Enables the selected GPIO port and its selected pins to wake up the device from any low power mode.  
 *             Call this function multiple times to enable pins on multiple ports.  This function does not configure
 *             the GPIO pins nor does it setup their interrupt functionality.
 * @param      wu_pins      The port and pins to configure as wakeup sources.  Only the gpio and mask fields of the
 *                          structure are used.  The func and pad fields are ignored.
 */
void LP_EnableGPIOWakeup(const gpio_cfg_t *wu_pins);

/**
 * @brief      Disables the selected GPIO port and its selected pins as a wake up source.  
 *             Call this function multiple times to disable pins on multiple ports.
 * @param      wu_pins      The port and pins to disable as wakeup sources.  Only the gpio and mask fields of the
 *                          structure are used.  The func and pad fields are ignored.
 */
void LP_DisableGPIOWakeup(const gpio_cfg_t *wu_pins);

/**
 * @brief      Enables the RTC alarm to wake up the device from any low power mode.  
 */
void LP_EnableRTCAlarmWakeup(void);

/**
 * @brief      Disables the RTC alarm from waking up the device.  
 */
void LP_DisableRTCAlarmWakeup(void);

/**
 * @brief      Places the device into SLEEP mode.  This function returns once any interrupt occurs. 
 * @note 	   LP_ClearWakeStatus should be called before this function, to avoid immediately waking up again
 */
void LP_EnterSleepMode(void);

/**
 * @brief      Places the device into DEEPSLEEP mode.  This function returns once an RTC or external interrupt occur. 
 * @note      LP_ClearWakeStatus should be called before this function, to avoid immediately waking up again
*/
void LP_EnterDeepSleepMode(void);

/**
 * @brief      Places the device into BACKUP mode.  CPU state is not maintained in this mode, so this function never returns.  
 *             Instead, the device will restart once an RTC or external interrupt occur. 
 * @note       LP_ClearWakeStatus should be called before this function, to avoid immediately waking up again
 */
void LP_EnterBackupMode(void);

/**
 * @brief      Places the device into Shutdown mode.  CPU state is not maintained in this mode, so this function never returns.  
 *             Instead, the device will restart once an RTC, USB wakeup, or external interrupt occur. 
 */
void LP_EnterShutDownMode(void);

/**
 * @brief      Set operating voltage and change the clock to match the new voltage. 
 * @param	   system reset configuration struct
 */
void LP_SetOperatingVoltage(lp_ovr_t ovr);

/**
 * @brief      Enables Data Retention to RAM addresses 0x20000000-0x20003FFF.
 */
void LP_EnableSRamRet0(void);

/**
 * @brief      Disables Data Retention to RAM addresses 0x20000000-0x20003FFF. 
 */
void LP_DisableSRamRet0(void);

/**
 * @brief      Enables Data Retention to RAM addresses 0x20004000-0x20007FFF.
 */
void LP_EnableSRamRet1(void);

/**
 * @brief      Disables Data Retention to RAM addresses 0x20004000-0x20007FFF.
 */
void LP_DisableSRamRet1(void);

/**
 * @brief      Enables Data Retention to RAM addresses 0x20008000-0x2000FFFF.
 */
void LP_EnableSRamRet2(void);

/**
 * @brief      Disables Data Retention to RAM addresses 0x20008000-0x2000FFFF.
 */
void LP_DisableSRamRet2(void);

/**
 * @brief      Enables Data Retention to RAM addresses 0x20010000-0x20017FFF.
 */
void LP_EnableSRamRet3(void);

/**
 * @brief      Disables Data Retention to RAM addresses 0x20010000-0x20017FFF.
 */
void LP_DisableSRamRet3(void);

/**
 * @brief      Enables Bypassing the hardware detection of an external supply on V CORE enables a faster wakeup time.
 */
void LP_EnableBlockDetect(void);

/**
 * @brief      Disables Bypassing the hardware detection of an external supply on V CORE enables a faster wakeup time
 */
void LP_DisableBlockDetect(void);

/**
 * @brief      RAM Retention Regulator Enable for BACKUP Mode
 */
void LP_EnableRamRetReg(void);

/**
 * @brief      RAM Retention Regulator Disabels for BACKUP Mode
 */
void LP_DisableRamRetReg(void);

/**
 * @brief      Enables Fast wake up from deepsleep 
 */
void LP_EnableFastWk(void);

/**
 * @brief      Disables Fast wake up from deepsleep
 */
void LP_DisableFastWk(void);

/**
 * @brief      Turns on band gap during deepsleep and backup mode. 
 */
void LP_EnableBandGap(void);

/**
 * @brief      Turns off band gap during deepsleep and backup mode.
 */
void LP_DisableBandGap(void);

/**
 * @brief     Enables signal for power on reset when the device is int DEEPSLEEP or BACKUP mode
 */
void LP_EnableVCorePORSignal(void);

/**
 * @brief     Disables signal for power on reset when the device is int DEEPSLEEP or BACKUP mode 
 */
void LP_DisableVCorePORSignal(void);

/**
 * @brief     Enables signal for power on reset when the device is int DEEPSLEEP or BACKUP mode
 */
void LP_EnableLDO(void);

/**
 * @brief     Disables signal for power on reset when the device is int DEEPSLEEP or BACKUP mode 
 */
void LP_DisableLDO(void);

/**
 * @brief     Enables V CORE Supply Voltage Monitor 
 */
void LP_EnableVCoreSVM(void);

/**
 * @brief     Disables V CORE Supply Voltage Monitor 
 */
void LP_DisableVCoreSVM(void);


/**
 * @brief     Enables VDDIO Power-On-Reset Monitor 
 */
void LP_EnableVDDIOPorMonitor(void);

/**
 * @brief     Disables VDDIO Power-On-Reset Monitor  
 */
void LP_DisableVDDIOPorMonitor(void);


#ifdef __cplusplus
}
#endif

#endif /* _LP_H_ */