1 /** 2 * @file lp.h 3 * @brief Low power function prototypes and data types. 4 */ 5 6 7 /* **************************************************************************** 8 * Copyright (C) 2017 Maxim Integrated Products, Inc., All Rights Reserved. 9 * 10 * Permission is hereby granted, free of charge, to any person obtaining a 11 * copy of this software and associated documentation files (the "Software"), 12 * to deal in the Software without restriction, including without limitation 13 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 14 * and/or sell copies of the Software, and to permit persons to whom the 15 * Software is furnished to do so, subject to the following conditions: 16 * 17 * The above copyright notice and this permission notice shall be included 18 * in all copies or substantial portions of the Software. 19 * 20 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 21 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 22 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 23 * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES 24 * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 25 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 26 * OTHER DEALINGS IN THE SOFTWARE. 27 * 28 * Except as contained in this notice, the name of Maxim Integrated 29 * Products, Inc. shall not be used except as stated in the Maxim Integrated 30 * Products, Inc. Branding Policy. 31 * 32 * The mere transfer of this software does not imply any licenses 33 * of trade secrets, proprietary technology, copyrights, patents, 34 * trademarks, maskwork rights, or any other form of intellectual 35 * property whatsoever. Maxim Integrated Products, Inc. retains all 36 * ownership rights. 37 * 38 * $Date: 2018-09-26 08:48:30 -0500 (Wed, 26 Sep 2018) $ 39 * $Revision: 38105 $ 40 * 41 *************************************************************************** */ 42 43 // Define to prevent redundant inclusion 44 #ifndef _LP_H_ 45 #define _LP_H_ 46 47 /***** Includes *****/ 48 #include "gpio.h" 49 #include "pwrseq_regs.h" 50 51 #ifdef __cplusplus 52 extern "C" { 53 #endif 54 55 /** @brief System reset0 enumeration. Used in SYS_PeriphReset0 function */ 56 typedef enum { 57 LP_OVR_0_9 = MXC_S_PWRSEQ_LP_CTRL_OVR_0_9V, /**< Reset DMA */ 58 LP_OVR_1_0 = MXC_S_PWRSEQ_LP_CTRL_OVR_1_0V, /**< Reset DMA */ 59 LP_OVR_1_1 = MXC_S_PWRSEQ_LP_CTRL_OVR_1_1V, /**< Reset DMA */ 60 } lp_ovr_t; 61 62 /** 63 * @brief Clears the low power wakeup flags 64 */ 65 void LP_ClearWakeStatus(void); 66 67 /** 68 * @brief Enables power to RAM addresses 0x20010000-0x20017FFF. 69 */ 70 void LP_EnableSRAM3(void); 71 72 /** 73 * @brief Enables power to RAM addresses 0x20008000-0x2000FFFF. 74 */ 75 void LP_EnableSRAM2(void); 76 77 /** 78 * @brief Enables power to RAM addresses 0x20004000-0x20007FFF. 79 */ 80 void LP_EnableSRAM1(void); 81 82 /** 83 * @brief Enables power to RAM addresses 0x20000000-0x20003FFF. 84 */ 85 void LP_EnableSRAM0(void); 86 87 /** 88 * @brief Disables power to RAM addresses 0x20010000-0x20017FFF. The contents of the RAM are destroyed. 89 */ 90 void LP_DisableSRAM3(void); 91 92 /** 93 * @brief Disables power to RAM addresses 0x20008000-0x2000FFFF. The contents of the RAM are destroyed. 94 */ 95 void LP_DisableSRAM2(void); 96 97 /** 98 * @brief Disables power to RAM addresses 0x20004000-0x20007FFF. The contents of the RAM are destroyed. 99 */ 100 void LP_DisableSRAM1(void); 101 102 /** 103 * @brief Disables power to RAM addresses 0x20000000-0x20003FFF. The contents of the RAM are destroyed. 104 */ 105 void LP_DisableSRAM0(void); 106 107 /** 108 * @brief Places the instruction cache in light sleep mode. Data will be unavailable for read/write operations but will be retained. 109 */ 110 void LP_EnableICacheLightSleep(void); 111 112 /** 113 * @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. 114 */ 115 void LP_EnableSysRAM3LightSleep(void); 116 117 /** 118 * @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. 119 */ 120 void LP_EnableSysRAM2LightSleep(void); 121 122 /** 123 * @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. 124 */ 125 void LP_EnableSysRAM1LightSleep(void); 126 127 /** 128 * @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. 129 */ 130 void LP_EnableSysRAM0LightSleep(void); 131 132 /** 133 * @brief Places the instruction cache in active mode. 134 */ 135 void LP_DisableICacheLightSleep(void); 136 137 /** 138 * @brief Places addresses 0x20010000 to 0x20017FFF of the RAM in active mode. 139 */ 140 void LP_DisableSysRAM3LightSleep(void); 141 142 /** 143 * @brief Places addresses 0x20008000 to 0x2000FFFF of the RAM in active mode. 144 */ 145 void LP_DisableSysRAM2LightSleep(void); 146 147 /** 148 * @brief Places addresses 0x20004000 to 0x20007FFF of the RAM in active mode. 149 */ 150 void LP_DisableSysRAM1LightSleep(void); 151 152 /** 153 * @brief Places addresses 0x20000000 to 0x20003FFF of the RAM in active mode. 154 */ 155 void LP_DisableSysRAM0LightSleep(void); 156 157 /** 158 * @brief Enables the selected GPIO port and its selected pins to wake up the device from any low power mode. 159 * Call this function multiple times to enable pins on multiple ports. This function does not configure 160 * the GPIO pins nor does it setup their interrupt functionality. 161 * @param wu_pins The port and pins to configure as wakeup sources. Only the gpio and mask fields of the 162 * structure are used. The func and pad fields are ignored. 163 */ 164 void LP_EnableGPIOWakeup(const gpio_cfg_t *wu_pins); 165 166 /** 167 * @brief Disables the selected GPIO port and its selected pins as a wake up source. 168 * Call this function multiple times to disable pins on multiple ports. 169 * @param wu_pins The port and pins to disable as wakeup sources. Only the gpio and mask fields of the 170 * structure are used. The func and pad fields are ignored. 171 */ 172 void LP_DisableGPIOWakeup(const gpio_cfg_t *wu_pins); 173 174 /** 175 * @brief Enables the RTC alarm to wake up the device from any low power mode. 176 */ 177 void LP_EnableRTCAlarmWakeup(void); 178 179 /** 180 * @brief Disables the RTC alarm from waking up the device. 181 */ 182 void LP_DisableRTCAlarmWakeup(void); 183 184 /** 185 * @brief Places the device into SLEEP mode. This function returns once any interrupt occurs. 186 * @note LP_ClearWakeStatus should be called before this function, to avoid immediately waking up again 187 */ 188 void LP_EnterSleepMode(void); 189 190 /** 191 * @brief Places the device into DEEPSLEEP mode. This function returns once an RTC or external interrupt occur. 192 * @note LP_ClearWakeStatus should be called before this function, to avoid immediately waking up again 193 */ 194 void LP_EnterDeepSleepMode(void); 195 196 /** 197 * @brief Places the device into BACKUP mode. CPU state is not maintained in this mode, so this function never returns. 198 * Instead, the device will restart once an RTC or external interrupt occur. 199 * @note LP_ClearWakeStatus should be called before this function, to avoid immediately waking up again 200 */ 201 void LP_EnterBackupMode(void); 202 203 /** 204 * @brief Places the device into Shutdown mode. CPU state is not maintained in this mode, so this function never returns. 205 * Instead, the device will restart once an RTC, USB wakeup, or external interrupt occur. 206 */ 207 void LP_EnterShutDownMode(void); 208 209 /** 210 * @brief Set operating voltage and change the clock to match the new voltage. 211 * @param system reset configuration struct 212 */ 213 void LP_SetOperatingVoltage(lp_ovr_t ovr); 214 215 /** 216 * @brief Enables Data Retention to RAM addresses 0x20000000-0x20003FFF. 217 */ 218 void LP_EnableSRamRet0(void); 219 220 /** 221 * @brief Disables Data Retention to RAM addresses 0x20000000-0x20003FFF. 222 */ 223 void LP_DisableSRamRet0(void); 224 225 /** 226 * @brief Enables Data Retention to RAM addresses 0x20004000-0x20007FFF. 227 */ 228 void LP_EnableSRamRet1(void); 229 230 /** 231 * @brief Disables Data Retention to RAM addresses 0x20004000-0x20007FFF. 232 */ 233 void LP_DisableSRamRet1(void); 234 235 /** 236 * @brief Enables Data Retention to RAM addresses 0x20008000-0x2000FFFF. 237 */ 238 void LP_EnableSRamRet2(void); 239 240 /** 241 * @brief Disables Data Retention to RAM addresses 0x20008000-0x2000FFFF. 242 */ 243 void LP_DisableSRamRet2(void); 244 245 /** 246 * @brief Enables Data Retention to RAM addresses 0x20010000-0x20017FFF. 247 */ 248 void LP_EnableSRamRet3(void); 249 250 /** 251 * @brief Disables Data Retention to RAM addresses 0x20010000-0x20017FFF. 252 */ 253 void LP_DisableSRamRet3(void); 254 255 /** 256 * @brief Enables Bypassing the hardware detection of an external supply on V CORE enables a faster wakeup time. 257 */ 258 void LP_EnableBlockDetect(void); 259 260 /** 261 * @brief Disables Bypassing the hardware detection of an external supply on V CORE enables a faster wakeup time 262 */ 263 void LP_DisableBlockDetect(void); 264 265 /** 266 * @brief RAM Retention Regulator Enable for BACKUP Mode 267 */ 268 void LP_EnableRamRetReg(void); 269 270 /** 271 * @brief RAM Retention Regulator Disabels for BACKUP Mode 272 */ 273 void LP_DisableRamRetReg(void); 274 275 /** 276 * @brief Enables Fast wake up from deepsleep 277 */ 278 void LP_EnableFastWk(void); 279 280 /** 281 * @brief Disables Fast wake up from deepsleep 282 */ 283 void LP_DisableFastWk(void); 284 285 /** 286 * @brief Turns on band gap during deepsleep and backup mode. 287 */ 288 void LP_EnableBandGap(void); 289 290 /** 291 * @brief Turns off band gap during deepsleep and backup mode. 292 */ 293 void LP_DisableBandGap(void); 294 295 /** 296 * @brief Enables signal for power on reset when the device is int DEEPSLEEP or BACKUP mode 297 */ 298 void LP_EnableVCorePORSignal(void); 299 300 /** 301 * @brief Disables signal for power on reset when the device is int DEEPSLEEP or BACKUP mode 302 */ 303 void LP_DisableVCorePORSignal(void); 304 305 /** 306 * @brief Enables signal for power on reset when the device is int DEEPSLEEP or BACKUP mode 307 */ 308 void LP_EnableLDO(void); 309 310 /** 311 * @brief Disables signal for power on reset when the device is int DEEPSLEEP or BACKUP mode 312 */ 313 void LP_DisableLDO(void); 314 315 /** 316 * @brief Enables V CORE Supply Voltage Monitor 317 */ 318 void LP_EnableVCoreSVM(void); 319 320 /** 321 * @brief Disables V CORE Supply Voltage Monitor 322 */ 323 void LP_DisableVCoreSVM(void); 324 325 326 /** 327 * @brief Enables VDDIO Power-On-Reset Monitor 328 */ 329 void LP_EnableVDDIOPorMonitor(void); 330 331 /** 332 * @brief Disables VDDIO Power-On-Reset Monitor 333 */ 334 void LP_DisableVDDIOPorMonitor(void); 335 336 337 #ifdef __cplusplus 338 } 339 #endif 340 341 #endif /* _LP_H_ */ 342