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 __RESET_H__ 33 #define __RESET_H__ 34 35 //***************************************************************************** 36 // 37 //! \addtogroup reset_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 <ti/devices/msp432p4xx/inc/msp.h> 54 #include <stdint.h> 55 56 //***************************************************************************** 57 // 58 // Control specific variables 59 // 60 //***************************************************************************** 61 #define RESET_KEY 0x6900 62 #define RESET_HARD_RESET RSTCTL_RESET_REQ_HARD_REQ 63 #define RESET_SOFT_RESET RSTCTL_RESET_REQ_SOFT_REQ 64 65 #define RESET_SRC_0 RSTCTL_HARDRESET_CLR_SRC0 66 #define RESET_SRC_1 RSTCTL_HARDRESET_CLR_SRC1 67 #define RESET_SRC_2 RSTCTL_HARDRESET_CLR_SRC2 68 #define RESET_SRC_3 RSTCTL_HARDRESET_CLR_SRC3 69 #define RESET_SRC_4 RSTCTL_HARDRESET_CLR_SRC4 70 #define RESET_SRC_5 RSTCTL_HARDRESET_CLR_SRC5 71 #define RESET_SRC_6 RSTCTL_HARDRESET_CLR_SRC6 72 #define RESET_SRC_7 RSTCTL_HARDRESET_CLR_SRC7 73 #define RESET_SRC_8 RSTCTL_HARDRESET_CLR_SRC8 74 #define RESET_SRC_9 RSTCTL_HARDRESET_CLR_SRC9 75 #define RESET_SRC_10 RSTCTL_HARDRESET_CLR_SRC10 76 #define RESET_SRC_11 RSTCTL_HARDRESET_CLR_SRC11 77 #define RESET_SRC_12 RSTCTL_HARDRESET_CLR_SRC12 78 #define RESET_SRC_13 RSTCTL_HARDRESET_CLR_SRC13 79 #define RESET_SRC_14 RSTCTL_HARDRESET_CLR_SRC14 80 #define RESET_SRC_15 RSTCTL_HARDRESET_CLR_SRC15 81 82 #define RESET_VCCDET RSTCTL_PSSRESET_STAT_VCCDET 83 #define RESET_SVSH_TRIP RSTCTL_PSSRESET_STAT_SVSMH 84 #define RESET_BGREF_BAD RSTCTL_PSSRESET_STAT_BGREF 85 86 #define RESET_LPM35 RSTCTL_PCMRESET_STAT_LPM35 87 #define RESET_LPM45 RSTCTL_PCMRESET_STAT_LPM45 88 89 //***************************************************************************** 90 // 91 // Prototypes for the APIs. 92 // 93 //***************************************************************************** 94 95 //***************************************************************************** 96 // 97 //! Initiates a soft system reset. 98 //! 99 //! \return none 100 // 101 //***************************************************************************** 102 extern void ResetCtl_initiateSoftReset(void); 103 104 //***************************************************************************** 105 // 106 //! Initiates a soft system reset with a particular source given. This source 107 //! is generic and can be assigned by the user. 108 //! 109 //! \param source Source of the reset. Valid values are: 110 //! - \b RESET_SRC_0, 111 //! - \b RESET_SRC_1, 112 //! - \b RESET_SRC_2, 113 //! - \b RESET_SRC_3, 114 //! - \b RESET_SRC_4, 115 //! - \b RESET_SRC_5, 116 //! - \b RESET_SRC_6, 117 //! - \b RESET_SRC_7, 118 //! - \b RESET_SRC_8, 119 //! - \b RESET_SRC_9, 120 //! - \b RESET_SRC_10, 121 //! - \b RESET_SRC_11, 122 //! - \b RESET_SRC_12, 123 //! - \b RESET_SRC_13, 124 //! - \b RESET_SRC_14, 125 //! - \b RESET_SRC_15 126 //! 127 //! \return none 128 // 129 //***************************************************************************** 130 extern void ResetCtl_initiateSoftResetWithSource(uint32_t source); 131 132 //***************************************************************************** 133 // 134 //! Retrieves previous soft reset sources 135 //! 136 //! \return the bitwise or of previous reset sources. These sources must be 137 //! cleared using the \link ResetCtl_clearSoftResetSource \endlink function to 138 //! be cleared. 139 //! Possible values include: 140 //! - \b RESET_SRC_0, 141 //! - \b RESET_SRC_1, 142 //! - \b RESET_SRC_2, 143 //! - \b RESET_SRC_3, 144 //! - \b RESET_SRC_4, 145 //! - \b RESET_SRC_5, 146 //! - \b RESET_SRC_6, 147 //! - \b RESET_SRC_7, 148 //! - \b RESET_SRC_8, 149 //! - \b RESET_SRC_9, 150 //! - \b RESET_SRC_10, 151 //! - \b RESET_SRC_11, 152 //! - \b RESET_SRC_12, 153 //! - \b RESET_SRC_13, 154 //! - \b RESET_SRC_14, 155 //! - \b RESET_SRC_15 156 // 157 //***************************************************************************** 158 extern uint32_t ResetCtl_getSoftResetSource(void); 159 160 //***************************************************************************** 161 // 162 //! Clears the reset sources associated with at soft reset 163 //! 164 //! \param mask - Bitwise OR of any of the following values: 165 //! - \b RESET_SRC_0, 166 //! - \b RESET_SRC_1, 167 //! - \b RESET_SRC_2, 168 //! - \b RESET_SRC_3, 169 //! - \b RESET_SRC_4, 170 //! - \b RESET_SRC_5, 171 //! - \b RESET_SRC_6, 172 //! - \b RESET_SRC_7, 173 //! - \b RESET_SRC_8, 174 //! - \b RESET_SRC_9, 175 //! - \b RESET_SRC_10, 176 //! - \b RESET_SRC_11, 177 //! - \b RESET_SRC_12, 178 //! - \b RESET_SRC_13, 179 //! - \b RESET_SRC_14, 180 //! - \b RESET_SRC_15 181 //! 182 //! \return none 183 // 184 //***************************************************************************** 185 extern void ResetCtl_clearSoftResetSource(uint32_t mask); 186 187 //***************************************************************************** 188 // 189 //! Initiates a hard system reset. 190 //! 191 //! \return none 192 // 193 //***************************************************************************** 194 extern void ResetCtl_initiateHardReset(void); 195 196 //***************************************************************************** 197 // 198 //! Initiates a hard system reset with a particular source given. This source 199 //! is generic and can be assigned by the user. 200 //! 201 //! \param source - Valid values are one the following values: 202 //! - \b RESET_SRC_0, 203 //! - \b RESET_SRC_1, 204 //! - \b RESET_SRC_2, 205 //! - \b RESET_SRC_3, 206 //! - \b RESET_SRC_4, 207 //! - \b RESET_SRC_5, 208 //! - \b RESET_SRC_6, 209 //! - \b RESET_SRC_7, 210 //! - \b RESET_SRC_8, 211 //! - \b RESET_SRC_9, 212 //! - \b RESET_SRC_10, 213 //! - \b RESET_SRC_11, 214 //! - \b RESET_SRC_12, 215 //! - \b RESET_SRC_13, 216 //! - \b RESET_SRC_14, 217 //! - \b RESET_SRC_15 218 //! \return none 219 // 220 //***************************************************************************** 221 extern void ResetCtl_initiateHardResetWithSource(uint32_t source); 222 223 //***************************************************************************** 224 // 225 //! Retrieves previous hard reset sources 226 //! 227 //! \return the bitwise or of previous reset sources. These sources must be 228 //! cleared using the \link ResetCtl_clearHardResetSource \endlink function to 229 //! be cleared. 230 //! Possible values include: 231 //! - \b RESET_SRC_0, 232 //! - \b RESET_SRC_1, 233 //! - \b RESET_SRC_2, 234 //! - \b RESET_SRC_3, 235 //! - \b RESET_SRC_4, 236 //! - \b RESET_SRC_5, 237 //! - \b RESET_SRC_6, 238 //! - \b RESET_SRC_7, 239 //! - \b RESET_SRC_8, 240 //! - \b RESET_SRC_9, 241 //! - \b RESET_SRC_10, 242 //! - \b RESET_SRC_11, 243 //! - \b RESET_SRC_12, 244 //! - \b RESET_SRC_13, 245 //! - \b RESET_SRC_14, 246 //! - \b RESET_SRC_15 247 // 248 //***************************************************************************** 249 extern uint32_t ResetCtl_getHardResetSource(void); 250 251 //***************************************************************************** 252 // 253 //! Clears the reset sources associated with at hard reset 254 //! 255 //! \param mask - Bitwise OR of any of the following values: 256 //! - \b RESET_SRC_0, 257 //! - \b RESET_SRC_1, 258 //! - \b RESET_SRC_2, 259 //! - \b RESET_SRC_3, 260 //! - \b RESET_SRC_4, 261 //! - \b RESET_SRC_5, 262 //! - \b RESET_SRC_6, 263 //! - \b RESET_SRC_7, 264 //! - \b RESET_SRC_8, 265 //! - \b RESET_SRC_9, 266 //! - \b RESET_SRC_10, 267 //! - \b RESET_SRC_11, 268 //! - \b RESET_SRC_12, 269 //! - \b RESET_SRC_13, 270 //! - \b RESET_SRC_14, 271 //! - \b RESET_SRC_15 272 //! 273 //! \return none 274 // 275 //***************************************************************************** 276 extern void ResetCtl_clearHardResetSource(uint32_t mask); 277 278 //***************************************************************************** 279 // 280 //! Indicates the last cause of a power-on reset (POR) due to PSS operation. 281 //! Note that the bits returned from this function may be set in different 282 //! combinations. When a cold power up occurs, the value of all the values ORed 283 //! together could be returned as a cold power up causes these conditions. 284 //! 285 //! \return Bitwise OR of any of the following values: 286 //! - RESET_VCCDET, 287 //! - RESET_SVSH_TRIP, 288 //! - RESET_BGREF_BAD 289 // 290 //***************************************************************************** 291 extern uint32_t ResetCtl_getPSSSource(void); 292 293 //***************************************************************************** 294 // 295 //! Clears the PSS reset source flags 296 //! 297 //! \return none 298 // 299 //***************************************************************************** 300 extern void ResetCtl_clearPSSFlags(void); 301 302 //***************************************************************************** 303 // 304 //! Indicates the last cause of a power-on reset (POR) due to PCM operation. 305 //! 306 //! \return Bitwise OR of any of the following values: 307 //! - RESET_LPM35, 308 //! - RESET_LPM45 309 // 310 //***************************************************************************** 311 extern uint32_t ResetCtl_getPCMSource(void); 312 313 //***************************************************************************** 314 // 315 //! Clears the corresponding PCM reset source flags 316 //! 317 //! \return none 318 // 319 //***************************************************************************** 320 extern void ResetCtl_clearPCMFlags(void); 321 322 //***************************************************************************** 323 // 324 // Mark the end of the C bindings section for C++ compilers. 325 // 326 //***************************************************************************** 327 #ifdef __cplusplus 328 } 329 #endif 330 331 //***************************************************************************** 332 // 333 // Close the Doxygen group. 334 //! @} 335 // 336 //***************************************************************************** 337 338 #endif // __RESET_H__ 339