1 /* --COPYRIGHT--,BSD 2 * Copyright (c) 2017, Texas Instruments Incorporated 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 9 * * Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 11 * 12 * * Redistributions in binary form must reproduce the above copyright 13 * notice, this list of conditions and the following disclaimer in the 14 * documentation and/or other materials provided with the distribution. 15 * 16 * * Neither the name of Texas Instruments Incorporated nor the names of 17 * its contributors may be used to endorse or promote products derived 18 * from this software without specific prior written permission. 19 * 20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 22 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 23 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 24 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 25 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 26 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 27 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 28 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 29 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 30 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 * --/COPYRIGHT--*/ 32 #ifndef __PSS_H__ 33 #define __PSS_H__ 34 35 //***************************************************************************** 36 // 37 //! \addtogroup pss_api 38 //! @{ 39 // 40 //***************************************************************************** 41 42 //***************************************************************************** 43 // 44 // If building with a C++ compiler, make all of the definitions in this header 45 // have a C binding. 46 // 47 //***************************************************************************** 48 #ifdef __cplusplus 49 extern "C" 50 { 51 #endif 52 53 #include <stdint.h> 54 #include <ti/devices/msp432p4xx/inc/msp.h> 55 #include <stdbool.h> 56 57 //***************************************************************************** 58 // 59 // Control specific variables 60 // 61 //***************************************************************************** 62 #define PSS_KEY_VALUE PSS_KEY_KEY_VAL 63 64 #define PSS_SVSMH PSS_IE_SVSMHIE 65 66 #define PSS_FULL_PERFORMANCE_MODE 0x01 67 #define PSS_NORMAL_PERFORMANCE_MODE 0x00 68 69 //***************************************************************************** 70 // 71 // Prototypes for the APIs. 72 // 73 //***************************************************************************** 74 75 //***************************************************************************** 76 // 77 //! Enables output of the High Side interrupt flag on the device \b SVMHOUT pin 78 //! 79 //! \param activeLow True if the signal should be logic low when SVSMHIFG 80 //! is set. False if signal should be high when \b SVSMHIFG is set. 81 //! 82 //! \return None. 83 // 84 //***************************************************************************** 85 extern void PSS_enableHighSidePinToggle(bool activeLow); 86 87 //***************************************************************************** 88 // 89 //! Disables output of the High Side interrupt flag on the device \b SVMHOUT pin 90 //! 91 //! \return None. 92 // 93 //***************************************************************************** 94 extern void PSS_disableHighSidePinToggle(void); 95 96 //***************************************************************************** 97 // 98 //! Enables high side voltage supervisor/monitor. 99 //! 100 //! \return None. 101 // 102 //***************************************************************************** 103 extern void PSS_enableHighSide(void); 104 105 //***************************************************************************** 106 // 107 //! Disables high side voltage supervisor/monitor. 108 //! 109 //! \return None. 110 // 111 //***************************************************************************** 112 extern void PSS_disableHighSide(void); 113 114 //***************************************************************************** 115 // 116 //! Sets the performance mode of the high side regulator. Full performance 117 //! mode allows for the best response times while normal performance mode is 118 //! optimized for the lowest possible current consumption. 119 //! 120 //! \param powerMode is the performance mode to set. Valid values are one of 121 //! the following: 122 //! - \b PSS_FULL_PERFORMANCE_MODE, 123 //! - \b PSS_NORMAL_PERFORMANCE_MODE 124 //! 125 //! \return None. 126 // 127 //***************************************************************************** 128 extern void PSS_setHighSidePerformanceMode(uint_fast8_t powerMode); 129 130 //***************************************************************************** 131 // 132 //! Gets the performance mode of the high side voltage regulator. Refer to the 133 //! user's guide for specific information about information about the different 134 //! performance modes. 135 //! 136 //! \return Performance mode of the voltage regulator 137 // 138 //***************************************************************************** 139 extern uint_fast8_t PSS_getHighSidePerformanceMode(void); 140 141 //***************************************************************************** 142 // 143 //! Sets the high side voltage supervisor to monitor mode 144 //! 145 //! \return None. 146 // 147 //***************************************************************************** 148 extern void PSS_enableHighSideMonitor(void); 149 150 //***************************************************************************** 151 // 152 //! Switches the high side of the power supply system to be a supervisor instead 153 //! of a monitor 154 //! 155 //! \return None. 156 // 157 //***************************************************************************** 158 extern void PSS_disableHighSideMonitor(void); 159 160 //***************************************************************************** 161 // 162 //! Sets the voltage level at which the high side of the device voltage 163 //! regulator triggers a reset. This value is represented as an unsigned eight 164 //! bit integer where only the lowest three bits are most significant. 165 //! 166 //! \param triggerVoltage Voltage level in which high side supervisor/monitor 167 //! triggers a reset. See the device specific data sheet for details 168 //! on these voltage levels. 169 //! 170 //! Typical values will vary from part to part (so it is very important to 171 //! check the SVSH section of the data sheet. For reference only, the typical 172 //! MSP432 101 values are listed below: 173 //! - 0 --> 1.57V 174 //! - 1 --> 1.62V 175 //! - 2 --> 1.83V 176 //! - 3 --> 2V 177 //! - 4 --> 2.25V 178 //! - 5 --> 2.4V 179 //! - 6 --> 2.6V 180 //! - 7 --> 2.8V 181 //! 182 //! \return None. 183 // 184 //***************************************************************************** 185 extern void PSS_setHighSideVoltageTrigger(uint_fast8_t triggerVoltage); 186 187 //***************************************************************************** 188 // 189 //! Returns the voltage level at which the high side of the device voltage 190 //! regulator triggers a reset. 191 //! 192 //! \return The voltage level that the high side voltage supervisor/monitor 193 //! triggers a reset. This value is represented as an unsigned eight 194 //! bit integer where only the lowest three bits are most significant. 195 //! See \link PSS_setHighSideVoltageTrigger \endlink for information regarding 196 //! the return value 197 // 198 //***************************************************************************** 199 extern uint_fast8_t PSS_getHighSideVoltageTrigger(void); 200 201 //***************************************************************************** 202 // 203 //! Enables the power supply system interrupt source. 204 //! 205 //! \return None. 206 // 207 //***************************************************************************** 208 extern void PSS_enableInterrupt(void); 209 210 //***************************************************************************** 211 // 212 //! Disables the power supply system interrupt source. 213 //! 214 //! \return None. 215 // 216 //***************************************************************************** 217 extern void PSS_disableInterrupt(void); 218 219 //***************************************************************************** 220 // 221 //! Gets the current interrupt status. 222 //! 223 //! \return The current interrupt status ( \b PSS_SVSMH ) 224 //! 225 //***************************************************************************** 226 extern uint32_t PSS_getInterruptStatus(void); 227 228 //***************************************************************************** 229 // 230 //! Clears power supply system interrupt source. 231 //! 232 //! \return None. 233 // 234 //***************************************************************************** 235 extern void PSS_clearInterruptFlag(void); 236 237 238 //***************************************************************************** 239 // 240 //! Enables the "forced" mode of the DCDC regulator. In this mode, the fail 241 //! safe mechanism that disables the regulator to LDO mode when the supply 242 //! voltage falls below the minimum supply voltage required for DCDC operation 243 //! is turned off. 244 //! 245 //! \return None. 246 // 247 //***************************************************************************** 248 extern void PSS_enableForcedDCDCOperation(void); 249 250 251 //***************************************************************************** 252 // 253 //! Disables the "forced" mode of the DCDC regulator. In this mode, the fail 254 //! safe mechanism that disables the regulator to LDO mode when the supply 255 //! voltage falls below the minimum supply voltage required for DCDC operation 256 //! is turned on. 257 //! 258 //! \return None. 259 // 260 //***************************************************************************** 261 extern void PSS_disableForcedDCDCOperation(void); 262 263 //***************************************************************************** 264 // 265 //! Registers an interrupt handler for the power supply system interrupt. 266 //! 267 //! \param intHandler is a pointer to the function to be called when the power 268 //! supply system interrupt occurs. 269 //! 270 //! This function registers the handler to be called when a power supply system 271 //! interrupt occurs. This function enables the global interrupt in the 272 //! interrupt controller; specific PSS interrupts must be enabled 273 //! via PSS_enableInterrupt(). It is the interrupt handler's responsibility to 274 //! clear the interrupt source via PSS_clearInterruptFlag(). 275 //! 276 //! \sa Interrupt_registerInterrupt() for important information about 277 //! registering interrupt handlers. 278 //! 279 //! \return None. 280 // 281 //***************************************************************************** 282 extern void PSS_registerInterrupt(void (*intHandler)(void)); 283 284 //***************************************************************************** 285 // 286 //! Unregisters the interrupt handler for the power supply system 287 //! 288 //! This function unregisters the handler to be called when a power supply 289 //! system interrupt occurs. This function also masks off the interrupt in the 290 //! interrupt controller so that the interrupt handler no longer is called. 291 //! 292 //! \sa Interrupt_registerInterrupt() for important information about 293 //! registering interrupt handlers. 294 //! 295 //! \return None. 296 // 297 //***************************************************************************** 298 extern void PSS_unregisterInterrupt(void); 299 300 //***************************************************************************** 301 // 302 // Mark the end of the C bindings section for C++ compilers. 303 // 304 //***************************************************************************** 305 #ifdef __cplusplus 306 } 307 #endif 308 309 //***************************************************************************** 310 // 311 // Close the Doxygen group. 312 //! @} 313 // 314 //***************************************************************************** 315 316 #endif // __PSS_H__ 317