]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/CORTEX_M4F_MSP432_LaunchPad_IAR_CCS_Keil/driverlib/wdt_a.h
Update MSP432 projects to use updated driver library files.
[freertos] / FreeRTOS / Demo / CORTEX_M4F_MSP432_LaunchPad_IAR_CCS_Keil / driverlib / wdt_a.h
1 /*
2  * -------------------------------------------
3  *    MSP432 DriverLib - v3_10_00_09 
4  * -------------------------------------------
5  *
6  * --COPYRIGHT--,BSD,BSD
7  * Copyright (c) 2014, 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 __WATCHDOG_H__
38 #define __WATCHDOG_H__
39
40 //*****************************************************************************
41 //
42 //! \addtogroup wdt_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 #include "sysctl.h"
61
62 #define WDT_A_HARD_RESET SYSCTL_HARD_RESET
63 #define WDT_A_SOFT_RESET SYSCTL_SOFT_RESET
64
65 //*****************************************************************************
66 //
67 // The following are values that can be passed to the clockSelect parameter for
68 // functions: WDT_A_watchdogTimerInit(), and WDT_A_intervalTimerInit().
69 //
70 //*****************************************************************************
71 #define WDT_A_CLOCKSOURCE_SMCLK                                     (WDT_A_CTL_SSEL_0)
72 #define WDT_A_CLOCKSOURCE_ACLK                                      (WDT_A_CTL_SSEL_1)
73 #define WDT_A_CLOCKSOURCE_VLOCLK                                    (WDT_A_CTL_SSEL_2)
74 #define WDT_A_CLOCKSOURCE_XCLK                                      (WDT_A_CTL_SSEL_3)
75 #define WDT_A_CLOCKSOURCE_BCLK                                      (WDT_A_CTL_SSEL_4)
76
77 //*****************************************************************************
78 //
79 // The following are values that can be passed to the clockDivider parameter
80 // for functions: WDT_A_watchdogTimerInit(), and WDT_A_intervalTimerInit().
81 //
82 //*****************************************************************************
83 #define WDT_A_CLOCKDIVIDER_2G                                         (WDT_A_CTL_IS_0)
84 #define WDT_A_CLOCKDIVIDER_128M                                       (WDT_A_CTL_IS_1)
85 #define WDT_A_CLOCKDIVIDER_8192K                                      (WDT_A_CTL_IS_2)
86 #define WDT_A_CLOCKDIVIDER_512K                                       (WDT_A_CTL_IS_3)
87 #define WDT_A_CLOCKDIVIDER_32K                                        (WDT_A_CTL_IS_4)
88 #define WDT_A_CLOCKDIVIDER_8192                                       (WDT_A_CTL_IS_5)
89 #define WDT_A_CLOCKDIVIDER_512                                        (WDT_A_CTL_IS_6)
90 #define WDT_A_CLOCKDIVIDER_64                                         (WDT_A_CTL_IS_7)
91 #define WDT_A_CLOCKITERATIONS_2G    WDT_A_CLOCKDIVIDER_2G
92 #define WDT_A_CLOCKITERATIONS_128M  WDT_A_CLOCKDIVIDER_128M
93 #define WDT_A_CLOCKITERATIONS_8192K WDT_A_CLOCKDIVIDER_8192K
94 #define WDT_A_CLOCKITERATIONS_512K  WDT_A_CLOCKDIVIDER_512K
95 #define WDT_A_CLOCKITERATIONS_32K   WDT_A_CLOCKDIVIDER_32K
96 #define WDT_A_CLOCKITERATIONS_8192  WDT_A_CLOCKDIVIDER_8192
97 #define WDT_A_CLOCKITERATIONS_512   WDT_A_CLOCKDIVIDER_512
98 #define WDT_A_CLOCKITERATIONS_64    WDT_A_CLOCKDIVIDER_64
99
100 //*****************************************************************************
101 //
102 // Prototypes for the APIs.
103 //
104 //*****************************************************************************
105
106 //*****************************************************************************
107 //
108 //! Holds the Watchdog Timer.
109 //!
110 //! This function stops the watchdog timer from running. This way no interrupt
111 //! or PUC is asserted.
112 //!
113 //! \return None
114 //
115 //*****************************************************************************
116 extern void WDT_A_holdTimer(void);
117
118 //*****************************************************************************
119 //
120 //! Starts the Watchdog Timer.
121 //!
122 //! This function starts the watchdog timer functionality to start counting.
123 //!
124 //! \return None
125 //
126 //*****************************************************************************
127 extern void WDT_A_startTimer(void);
128
129 //*****************************************************************************
130 //
131 //! Clears the timer counter of the Watchdog Timer.
132 //!
133 //! This function clears the watchdog timer count to 0x0000h. This function
134 //! is used to "service the dog" when operating in watchdog mode.
135 //!
136 //! \return None
137 //
138 //*****************************************************************************
139 extern void WDT_A_clearTimer(void);
140
141 //*****************************************************************************
142 //
143 //! Sets the clock source for the Watchdog Timer in watchdog mode.
144 //!
145 //! \param clockSelect is the clock source that the watchdog timer will use.
146 //!        Valid values are
147 //!        - \b WDT_A_CLOCKSOURCE_SMCLK [Default]
148 //!        - \b WDT_A_CLOCKSOURCE_ACLK
149 //!        - \b WDT_A_CLOCKSOURCE_VLOCLK
150 //!        - \b WDT_A_CLOCKSOURCE_BCLK
151 //! \param clockIterations is the number of clock iterations for a watchdog
152 //!         timeout.
153 //!        Valid values are
154 //!        - \b WDT_A_CLOCKITERATIONS_2G [Default]
155 //!        - \b WDT_A_CLOCKITERATIONS_128M
156 //!        - \b WDT_A_CLOCKITERATIONS_8192K
157 //!        - \b WDT_A_CLOCKITERATIONS_512K
158 //!        - \b WDT_A_CLOCKITERATIONS_32K
159 //!        - \b WDT_A_CLOCKITERATIONS_8192
160 //!        - \b WDT_A_CLOCKITERATIONS_512
161 //!        - \b WDT_A_CLOCKITERATIONS_64
162 //!
163 //! This function sets the watchdog timer in watchdog mode, which will cause a
164 //! PUC when the timer overflows. When in the mode, a PUC can be avoided with a
165 //! call to WDT_A_resetTimer() before the timer runs out.
166 //!
167 //! \return None
168 //
169 //*****************************************************************************
170 extern void WDT_A_initWatchdogTimer(uint_fast8_t clockSelect,
171         uint_fast8_t clockDivider);
172
173 //*****************************************************************************
174 //
175 //! Sets the clock source for the Watchdog Timer in timer interval mode.
176 //!
177 //! \param clockSelect is the clock source that the watchdog timer will use.
178 //!        Valid values are
179 //!        - \b WDT_A_CLOCKSOURCE_SMCLK [Default]
180 //!        - \b WDT_A_CLOCKSOURCE_ACLK
181 //!        - \b WDT_A_CLOCKSOURCE_VLOCLK
182 //!        - \b WDT_A_CLOCKSOURCE_BCLK
183 //! \param clockIterations is the number of clock iterations for a watchdog
184 //!         interval.
185 //!        Valid values are
186 //!        - \b WDT_A_CLOCKITERATIONS_2G [Default]
187 //!        - \b WDT_A_CLOCKITERATIONS_128M
188 //!        - \b WDT_A_CLOCKITERATIONS_8192K
189 //!        - \b WDT_A_CLOCKITERATIONS_512K
190 //!        - \b WDT_A_CLOCKITERATIONS_32K
191 //!        - \b WDT_A_CLOCKITERATIONS_8192
192 //!        - \b WDT_A_CLOCKITERATIONS_512
193 //!        - \b WDT_A_CLOCKITERATIONS_64
194 //!
195 //! This function sets the watchdog timer as timer interval mode, which will
196 //! assert an interrupt without causing a PUC.
197 //!
198 //! \return None
199 //
200 //*****************************************************************************
201 extern void WDT_A_initIntervalTimer(uint_fast8_t clockSelect,
202         uint_fast8_t clockDivider);
203
204 //*****************************************************************************
205 //
206 //! Registers an interrupt handler for the watchdog interrupt.
207 //!
208 //! \param intHandler is a pointer to the function to be called when the
209 //! watchdog interrupt occurs.
210 //!
211 //! \return None.
212 //
213 //*****************************************************************************
214 extern void WDT_A_registerInterrupt(void (*intHandler)(void));
215
216 //*****************************************************************************
217 //
218 //! Unregisters the interrupt handler for the watchdog.
219 //!
220 //! This function unregisters the handler to be called when a watchdog
221 //! interrupt occurs.  This function also masks off the interrupt in the
222 //! interrupt controller so that the interrupt handler no longer is called.
223 //!
224 //! \sa Interrupt_registerInterrupt() for important information about
225 //! registering interrupt handlers.
226 //!
227 //! \return None.
228 //
229 //*****************************************************************************
230 extern void WDT_A_unregisterInterrupt(void);
231
232 //*****************************************************************************
233 //
234 //! Sets the type of RESET that happens when a watchdog password violation
235 //! occurs.
236 //!
237 //! \param resetType The type of reset to set
238 //!
239 //! The \e resetType parameter must be only one of the following values:
240 //!     - \b WDT_A_HARD_RESET
241 //!     - \b WDT_A_SOFT_RESET
242 //!
243 //! \return None.
244 //
245 //
246 //*****************************************************************************
247 extern void WDT_A_setPasswordViolationReset(uint_fast8_t resetType);
248
249 //*****************************************************************************
250 //
251 //! Sets the type of RESET that happens when a watchdog timeout occurs.
252 //!
253 //! \param resetType The type of reset to set
254 //!
255 //! The \e resetType parameter must be only one of the following values:
256 //!     - \b WDT_A_HARD_RESET
257 //!     - \b WDT_A_SOFT_RESET
258 //!
259 //! \return None.
260 //
261 //
262 //*****************************************************************************
263 extern void WDT_A_setTimeoutReset(uint_fast8_t resetType);
264
265 /* Defines for future devices that might have multiple instances */
266 #define WDT_A_holdTimerMultipleTimer(a)  WDT_A_holdTimer()
267 #define WDT_A_startTimerMultipleTimer(a) WDT_A_startTimer()
268 #define WDT_A_resetTimerMultipleTimer(a) WDT_A_clearTimer()
269 #define WDT_A_initWatchdogTimerMultipleTimer(a,b,c) WDT_A_initWatchdogTimer(b,c)
270 #define WDT_A_initIntervalTimerMultipleTimer(a,b,c) WDT_A_initIntervalTimer(b,c)
271 #define WDT_A_registerInterruptMultipleTimer(a,b) WDT_A_registerInterrupt(b)
272 #define WDT_A_unregisterInterruptMultipleTimer(a) WDT_A_unregisterInterrupt()
273
274 /* Backwards compatibility layer */
275 #define WDT_A_hold WDT_A_holdTimerMultipleTimer
276 #define WDT_A_start WDT_A_startTimerMultipleTimer
277 #define WDT_A_resetTimer WDT_A_resetTimerMultipleTimer
278 #define WDT_A_watchdogTimerInit WDT_A_initWatchdogTimerMultipleTimer
279 #define WDT_A_intervalTimerInit WDT_A_initIntervalTimerMultipleTimer
280
281 //*****************************************************************************
282 //
283 // Mark the end of the C bindings section for C++ compilers.
284 //
285 //*****************************************************************************
286 #ifdef __cplusplus
287 }
288 #endif
289
290 //*****************************************************************************
291 //
292 // Close the Doxygen group.
293 //! @}
294 //
295 //*****************************************************************************
296
297 #endif // __WATCHDOG_H__