]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/CORTEX_M4F_MSP432_LaunchPad_IAR_CCS_Keil/driverlib/reset.h
c8d060c6296db662983470defefb50a865c664a1
[freertos] / FreeRTOS / Demo / CORTEX_M4F_MSP432_LaunchPad_IAR_CCS_Keil / driverlib / reset.h
1 /*
2  * -------------------------------------------
3  *    MSP432 DriverLib - v01_04_00_18 
4  * -------------------------------------------
5  *
6  * --COPYRIGHT--,BSD,BSD
7  * Copyright (c) 2015, Texas Instruments Incorporated
8  * All rights reserved.
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted provided that the following conditions
12  * are met:
13  *
14  * *  Redistributions of source code must retain the above copyright
15  *    notice, this list of conditions and the following disclaimer.
16  *
17  * *  Redistributions in binary form must reproduce the above copyright
18  *    notice, this list of conditions and the following disclaimer in the
19  *    documentation and/or other materials provided with the distribution.
20  *
21  * *  Neither the name of Texas Instruments Incorporated nor the names of
22  *    its contributors may be used to endorse or promote products derived
23  *    from this software without specific prior written permission.
24  *
25  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
26  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
27  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
29  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
32  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
33  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
34  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
35  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36  * --/COPYRIGHT--*/
37 #ifndef __RESET_H__
38 #define __RESET_H__
39
40 //*****************************************************************************
41 //
42 //! \addtogroup reset_api
43 //! @{
44 //
45 //*****************************************************************************
46
47 //*****************************************************************************
48 //
49 // If building with a C++ compiler, make all of the definitions in this header
50 // have a C binding.
51 //
52 //*****************************************************************************
53 #ifdef __cplusplus
54 extern "C"
55 {
56 #endif
57
58 #include <msp.h>
59 #include <stdint.h>
60
61 //*****************************************************************************
62 //
63 // Control specific variables 
64 //
65 //*****************************************************************************
66 #define RESET_KEY   0x6900
67 #define RESET_HARD_RESET RSTCTL_RESET_REQ_HARD_REQ
68 #define RESET_SOFT_RESET RSTCTL_RESET_REQ_SOFT_REQ
69
70 #define RESET_SRC_0 RSTCTL_HARDRESET_CLR_SRC0
71 #define RESET_SRC_1 RSTCTL_HARDRESET_CLR_SRC1
72 #define RESET_SRC_2 RSTCTL_HARDRESET_CLR_SRC2
73 #define RESET_SRC_3 RSTCTL_HARDRESET_CLR_SRC3
74 #define RESET_SRC_4 RSTCTL_HARDRESET_CLR_SRC4
75 #define RESET_SRC_5 RSTCTL_HARDRESET_CLR_SRC5
76 #define RESET_SRC_6 RSTCTL_HARDRESET_CLR_SRC6
77 #define RESET_SRC_7 RSTCTL_HARDRESET_CLR_SRC7
78 #define RESET_SRC_8 RSTCTL_HARDRESET_CLR_SRC8
79 #define RESET_SRC_9 RSTCTL_HARDRESET_CLR_SRC9
80 #define RESET_SRC_10 RSTCTL_HARDRESET_CLR_SRC10
81 #define RESET_SRC_11 RSTCTL_HARDRESET_CLR_SRC11
82 #define RESET_SRC_12 RSTCTL_HARDRESET_CLR_SRC12
83 #define RESET_SRC_13 RSTCTL_HARDRESET_CLR_SRC13
84 #define RESET_SRC_14 RSTCTL_HARDRESET_CLR_SRC14
85 #define RESET_SRC_15 RSTCTL_HARDRESET_CLR_SRC15
86
87 #define RESET_VCCDET    RSTCTL_PSSRESET_CLR_BGREF
88 #define RESET_SVSH_TRIP RSTCTL_PSSRESET_CLR_SVSMH
89 #define RESET_SVSL_TRIP RSTCTL_PSSRESET_CLR_SVSL
90 #define RESET_BGREF_BAD RSTCTL_PSSRESET_CLR_BGREF
91
92 #define RESET_SD0   RSTCTL_PCMRESET_CLR_LPM35
93 #define RESET_SD1   RSTCTL_PCMRESET_CLR_LPM45
94
95 //*****************************************************************************
96 //
97 // Prototypes for the APIs.
98 //
99 //*****************************************************************************
100
101 //*****************************************************************************
102 //
103 //! Initiates a soft system reset.
104 //!
105 //! \return none
106 //
107 //*****************************************************************************
108 extern void ResetCtl_initiateSoftReset(void);
109
110 //*****************************************************************************
111 //
112 //! Initiates a soft system reset with a particular source given. This source
113 //! is generic and can be assigned by the user.
114 //!
115 //! \param source Source of the reset. Valid values are:
116 //!             - \b RESET_SRC_0,
117 //!             - \b RESET_SRC_1,
118 //!             - \b RESET_SRC_2,
119 //!             - \b RESET_SRC_3,
120 //!             - \b RESET_SRC_4,
121 //!             - \b RESET_SRC_5,
122 //!             - \b RESET_SRC_6,
123 //!             - \b RESET_SRC_7,
124 //!             - \b RESET_SRC_8,
125 //!             - \b RESET_SRC_9,
126 //!             - \b RESET_SRC_10,
127 //!             - \b RESET_SRC_11,
128 //!             - \b RESET_SRC_12,
129 //!             - \b RESET_SRC_13,
130 //!             - \b RESET_SRC_14,
131 //!             - \b RESET_SRC_15
132 //!
133 //! \return none
134 //
135 //*****************************************************************************
136 extern void ResetCtl_initiateSoftResetWithSource(uint32_t source);
137
138 //*****************************************************************************
139 //
140 //! Retrieves previous soft reset sources
141 //!
142 //! \return the bitwise or of previous reset sources. These sources must be
143 //! cleared using the \link ResetCtl_clearSoftResetSource \endlink function to
144 //! be cleared.
145 //! Possible values include:
146 //!             - \b RESET_SRC_0,
147 //!             - \b RESET_SRC_1,
148 //!             - \b RESET_SRC_2,
149 //!             - \b RESET_SRC_3,
150 //!             - \b RESET_SRC_4,
151 //!             - \b RESET_SRC_5,
152 //!             - \b RESET_SRC_6,
153 //!             - \b RESET_SRC_7,
154 //!             - \b RESET_SRC_8,
155 //!             - \b RESET_SRC_9,
156 //!             - \b RESET_SRC_10,
157 //!             - \b RESET_SRC_11,
158 //!             - \b RESET_SRC_12,
159 //!             - \b RESET_SRC_13,
160 //!             - \b RESET_SRC_14,
161 //!             - \b RESET_SRC_15
162 //
163 //*****************************************************************************
164 extern uint32_t ResetCtl_getSoftResetSource(void);
165
166 //*****************************************************************************
167 //
168 //! Clears the reset sources associated with at soft reset
169 //!
170 //! \param mask - Bitwise OR of any of the following values:
171 //!             - \b RESET_SRC_0,
172 //!             - \b RESET_SRC_1,
173 //!             - \b RESET_SRC_2,
174 //!             - \b RESET_SRC_3,
175 //!             - \b RESET_SRC_4,
176 //!             - \b RESET_SRC_5,
177 //!             - \b RESET_SRC_6,
178 //!             - \b RESET_SRC_7,
179 //!             - \b RESET_SRC_8,
180 //!             - \b RESET_SRC_9,
181 //!             - \b RESET_SRC_10,
182 //!             - \b RESET_SRC_11,
183 //!             - \b RESET_SRC_12,
184 //!             - \b RESET_SRC_13,
185 //!             - \b RESET_SRC_14,
186 //!             - \b RESET_SRC_15
187 //!
188 //! \return none
189 //
190 //*****************************************************************************
191 extern void ResetCtl_clearSoftResetSource(uint32_t mask);
192
193 //*****************************************************************************
194 //
195 //! Initiates a hard system reset.
196 //!
197 //! \return none
198 //
199 //*****************************************************************************
200 extern void ResetCtl_initiateHardReset(void);
201
202 //*****************************************************************************
203 //
204 //! Initiates a hard system reset with a particular source given. This source
205 //! is generic and can be assigned by the user.
206 //!
207 //! \param source - Valid values are one the following values:
208 //!             - \b RESET_SRC_0,
209 //!             - \b RESET_SRC_1,
210 //!             - \b RESET_SRC_2,
211 //!             - \b RESET_SRC_3,
212 //!             - \b RESET_SRC_4,
213 //!             - \b RESET_SRC_5,
214 //!             - \b RESET_SRC_6,
215 //!             - \b RESET_SRC_7,
216 //!             - \b RESET_SRC_8,
217 //!             - \b RESET_SRC_9,
218 //!             - \b RESET_SRC_10,
219 //!             - \b RESET_SRC_11,
220 //!             - \b RESET_SRC_12,
221 //!             - \b RESET_SRC_13,
222 //!             - \b RESET_SRC_14,
223 //!             - \b RESET_SRC_15
224 //! \return none
225 //
226 //*****************************************************************************
227 extern void ResetCtl_initiateHardResetWithSource(uint32_t source);
228
229 //*****************************************************************************
230 //
231 //! Retrieves previous hard reset sources
232 //!
233 //! \return the bitwise or of previous reset sources. These sources must be
234 //! cleared using the \link ResetCtl_clearHardResetSource \endlink function to
235 //! be cleared.
236 //! Possible values include:
237 //!             - \b RESET_SRC_0,
238 //!             - \b RESET_SRC_1,
239 //!             - \b RESET_SRC_2,
240 //!             - \b RESET_SRC_3,
241 //!             - \b RESET_SRC_4,
242 //!             - \b RESET_SRC_5,
243 //!             - \b RESET_SRC_6,
244 //!             - \b RESET_SRC_7,
245 //!             - \b RESET_SRC_8,
246 //!             - \b RESET_SRC_9,
247 //!             - \b RESET_SRC_10,
248 //!             - \b RESET_SRC_11,
249 //!             - \b RESET_SRC_12,
250 //!             - \b RESET_SRC_13,
251 //!             - \b RESET_SRC_14,
252 //!             - \b RESET_SRC_15
253 //
254 //*****************************************************************************
255 extern uint32_t ResetCtl_getHardResetSource(void);
256
257 //*****************************************************************************
258 //
259 //! Clears the reset sources associated with at hard reset
260 //!
261 //! \param mask - Bitwise OR of any of the following values:
262 //!             - \b RESET_SRC_0,
263 //!             - \b RESET_SRC_1,
264 //!             - \b RESET_SRC_2,
265 //!             - \b RESET_SRC_3,
266 //!             - \b RESET_SRC_4,
267 //!             - \b RESET_SRC_5,
268 //!             - \b RESET_SRC_6,
269 //!             - \b RESET_SRC_7,
270 //!             - \b RESET_SRC_8,
271 //!             - \b RESET_SRC_9,
272 //!             - \b RESET_SRC_10,
273 //!             - \b RESET_SRC_11,
274 //!             - \b RESET_SRC_12,
275 //!             - \b RESET_SRC_13,
276 //!             - \b RESET_SRC_14,
277 //!             - \b RESET_SRC_15
278 //!
279 //! \return none
280 //
281 //*****************************************************************************
282 extern void ResetCtl_clearHardResetSource(uint32_t mask);
283
284 //*****************************************************************************
285 //
286 //! Indicates the last cause of a power-on reset (POR) due to PSS operation.
287 //! Note that the bits returned from this function may be set in different
288 //! combinations. When a cold power up occurs, the value of all the values ORed
289 //! together could be returned as a cold power up causes these conditions.
290 //!
291 //! \return  Bitwise OR of any of the following values:
292 //!                 - RESET_VCCDET,
293 //!                 - RESET_SVSH_TRIP,
294 //!                 - RESET_SVSL_TRIP,
295 //!                 - RESET_BGREF_BAD
296 //
297 //*****************************************************************************
298 extern uint32_t ResetCtl_getPSSSource(void);
299
300 //*****************************************************************************
301 //
302 //! Clears the  PSS reset source flags
303 //!
304 //! \return none
305 //
306 //*****************************************************************************
307 extern void ResetCtl_clearPSSFlags(void);
308
309 //*****************************************************************************
310 //
311 //! Indicates the last cause of a power-on reset (POR) due to PCM operation.
312 //!
313 //! \return  Bitwise OR of any of the following values:
314 //!                 - RESET_SD0,
315 //!                 - RESET_SD1
316 //
317 //*****************************************************************************
318 extern uint32_t ResetCtl_getPCMSource(void);
319
320 //*****************************************************************************
321 //
322 //! Clears the corresponding PCM reset source flags
323 //!
324 //! \return none
325 //
326 //*****************************************************************************
327 extern void ResetCtl_clearPCMFlags(void);
328
329 //*****************************************************************************
330 //
331 // Mark the end of the C bindings section for C++ compilers.
332 //
333 //*****************************************************************************
334 #ifdef __cplusplus
335 }
336 #endif
337
338 //*****************************************************************************
339 //
340 // Close the Doxygen group.
341 //! @}
342 //
343 //*****************************************************************************
344
345 #endif // __RESET_H__