MSP430 DriverLib for MSP430i2xx Devices  2.91.13.01
wdt.h
1 //*****************************************************************************
2 //
3 // wdt.h - Driver for the WDT Module.
4 //
5 //*****************************************************************************
6 
7 #ifndef __MSP430WARE_WDT_H__
8 #define __MSP430WARE_WDT_H__
9 
10 #include "inc/hw_memmap.h"
11 
12 #ifdef __MSP430_HAS_WDT__
13 
14 //*****************************************************************************
15 //
16 // If building with a C++ compiler, make all of the definitions in this header
17 // have a C binding.
18 //
19 //*****************************************************************************
20 #ifdef __cplusplus
21 extern "C"
22 {
23 #endif
24 
25 //*****************************************************************************
26 //
27 // The following are values that can be passed to the clockSelect parameter for
28 // functions: WDT_initWatchdogTimer(), and WDT_initIntervalTimer().
29 //
30 //*****************************************************************************
31 #define WDT_CLOCKSOURCE_SMCLK (0x00)
32 #define WDT_CLOCKSOURCE_ACLK (WDTSSEL)
33 
34 //*****************************************************************************
35 //
36 // The following are values that can be passed to the clockDivider parameter
37 // for functions: WDT_initWatchdogTimer(), and WDT_initIntervalTimer().
38 //
39 //*****************************************************************************
40 #define WDT_CLOCKDIVIDER_32K (0x00)
41 #define WDT_CLOCKDIVIDER_8192 (WDTIS0)
42 #define WDT_CLOCKDIVIDER_512 (WDTIS1)
43 #define WDT_CLOCKDIVIDER_64 (WDTIS0 | WDTIS1)
44 
45 //*****************************************************************************
46 //
47 // Prototypes for the APIs.
48 //
49 //*****************************************************************************
50 
51 //*****************************************************************************
52 //
53 //! \brief Holds the Watchdog Timer.
54 //!
55 //! This function stops the watchdog timer from running, that way no interrupt
56 //! or PUC is asserted.
57 //!
58 //! \param baseAddress is the base address of the WDT module.
59 //!
60 //! \return None
61 //
62 //*****************************************************************************
63 extern void WDT_hold(uint16_t baseAddress);
64 
65 //*****************************************************************************
66 //
67 //! \brief Starts the Watchdog Timer.
68 //!
69 //! This function starts the watchdog timer functionality to start counting
70 //! again.
71 //!
72 //! \param baseAddress is the base address of the WDT module.
73 //!
74 //! \return None
75 //
76 //*****************************************************************************
77 extern void WDT_start(uint16_t baseAddress);
78 
79 //*****************************************************************************
80 //
81 //! \brief Resets the timer counter of the Watchdog Timer.
82 //!
83 //! This function resets the watchdog timer to 0x0000h.
84 //!
85 //! \param baseAddress is the base address of the WDT module.
86 //!
87 //! \return None
88 //
89 //*****************************************************************************
90 extern void WDT_resetTimer(uint16_t baseAddress);
91 
92 //*****************************************************************************
93 //
94 //! \brief Sets the clock source for the Watchdog Timer in watchdog mode.
95 //!
96 //! This function sets the watchdog timer in watchdog mode, which will cause a
97 //! PUC when the timer overflows. When in the mode, a PUC can be avoided with a
98 //! call to WDT_resetTimer() before the timer runs out.
99 //!
100 //! \param baseAddress is the base address of the WDT module.
101 //! \param clockSelect is the clock source that the watchdog timer will use.
102 //! Valid values are:
103 //! - \b WDT_CLOCKSOURCE_SMCLK [Default]
104 //! - \b WDT_CLOCKSOURCE_ACLK
105 //! \n Modified bits are \b WDTSSEL of \b WDTCTL register.
106 //! \param clockDivider is the divider of the clock source, in turn setting the
107 //! watchdog timer interval.
108 //! Valid values are:
109 //! - \b WDT_CLOCKDIVIDER_32K [Default]
110 //! - \b WDT_CLOCKDIVIDER_8192
111 //! - \b WDT_CLOCKDIVIDER_512
112 //! - \b WDT_CLOCKDIVIDER_64
113 //! \n Modified bits are \b WDTIS and \b WDTHOLD of \b WDTCTL register.
114 //!
115 //! \return None
116 //
117 //*****************************************************************************
118 extern void WDT_initWatchdogTimer(uint16_t baseAddress,
119  uint8_t clockSelect,
120  uint8_t clockDivider);
121 
122 //*****************************************************************************
123 //
124 //! \brief Sets the clock source for the Watchdog Timer in timer interval mode.
125 //!
126 //! This function sets the watchdog timer as timer interval mode, which will
127 //! assert an interrupt without causing a PUC.
128 //!
129 //! \param baseAddress is the base address of the WDT module.
130 //! \param clockSelect is the clock source that the watchdog timer will use.
131 //! Valid values are:
132 //! - \b WDT_CLOCKSOURCE_SMCLK [Default]
133 //! - \b WDT_CLOCKSOURCE_ACLK
134 //! \n Modified bits are \b WDTSSEL of \b WDTCTL register.
135 //! \param clockDivider is the divider of the clock source, in turn setting the
136 //! watchdog timer interval.
137 //! Valid values are:
138 //! - \b WDT_CLOCKDIVIDER_32K [Default]
139 //! - \b WDT_CLOCKDIVIDER_8192
140 //! - \b WDT_CLOCKDIVIDER_512
141 //! - \b WDT_CLOCKDIVIDER_64
142 //! \n Modified bits are \b WDTIS and \b WDTHOLD of \b WDTCTL register.
143 //!
144 //! \return None
145 //
146 //*****************************************************************************
147 extern void WDT_initIntervalTimer(uint16_t baseAddress,
148  uint8_t clockSelect,
149  uint8_t clockDivider);
150 
151 //*****************************************************************************
152 //
153 // Mark the end of the C bindings section for C++ compilers.
154 //
155 //*****************************************************************************
156 #ifdef __cplusplus
157 }
158 #endif
159 
160 #endif
161 #endif // __MSP430WARE_WDT_H__
void WDT_start(uint16_t baseAddress)
Starts the Watchdog Timer.
Definition: wdt.c:30
void WDT_initWatchdogTimer(uint16_t baseAddress, uint8_t clockSelect, uint8_t clockDivider)
Sets the clock source for the Watchdog Timer in watchdog mode.
Definition: wdt.c:48
void WDT_resetTimer(uint16_t baseAddress)
Resets the timer counter of the Watchdog Timer.
Definition: wdt.c:39
void WDT_hold(uint16_t baseAddress)
Holds the Watchdog Timer.
Definition: wdt.c:21
void WDT_initIntervalTimer(uint16_t baseAddress, uint8_t clockSelect, uint8_t clockDivider)
Sets the clock source for the Watchdog Timer in timer interval mode.
Definition: wdt.c:56

Copyright 2020, Texas Instruments Incorporated