WatchdogCC32XX.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015-2018, 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  */
32 /*!****************************************************************************
33  * @file WatchdogCC32XX.h
34  * @brief Watchdog timer driver implementation for CC32XX
35  *
36  * The Watchdog header file for CC32XX should be included in an application
37  * as follows:
38  * @code
39  * #include <ti/drivers/Watchdog.h>
40  * #include <ti/drivers/watchdog/WatchdogCC32XX.h>
41  * @endcode
42  *
43  * Refer to @ref Watchdog.h for a complete description of APIs.
44  *
45  * This Watchdog driver implementation is designed to operate on a CC32XX
46  * device. Once opened, CC32XX Watchdog will count down from the reload
47  * value specified in the WatchdogCC32XX_HWAttrs. If it times out, the
48  * Watchdog interrupt flag will be set, and a user-provided callback function
49  * will be called. If the Watchdog Timer is allowed to time out again while
50  * the interrupt flag is still pending, a reset signal will be generated.
51  * To prevent a reset, Watchdog_clear() must be called to clear the interrupt
52  * flag.
53  *
54  * The reload value from which the Watchdog Timer counts down may be changed
55  * during runtime using Watchdog_setReload().
56  *
57  * Watchdog_close() is <b>not</b> supported by this driver implementation.
58  *
59  * By default the Watchdog driver has resets turned on. This feature cannot
60  * be disabled.
61  *
62  * To have a user-defined function run at the warning interrupt, first define
63  * a void-type function that takes a Watchdog_Handle cast to a UArg as an
64  * argument. The callback and code to start the Watchdog timer are shown below.
65  *
66  * @code
67  * void watchdogCallback(UArg handle);
68  *
69  * ...
70  *
71  * Watchdog_Handle handle;
72  * Watchdog_Params params;
73  * uint32_t tickValue;
74  *
75  * Watchdog_Params_init(&params);
76  * params.callbackFxn = watchdogCallback;
77  * handle = Watchdog_open(Watchdog_configIndex, &params);
78  * // Set timeout period to 100 ms
79  * tickValue = Watchdog_convertMsToTicks(handle, 100);
80  * Watchdog_setReload(handle, tickValue);
81  *
82  * ...
83  *
84  * void watchdogCallback(UArg handle)
85  * {
86  * // User-defined code here
87  * ...
88  *
89  * }
90  * @endcode
91  *
92  * # Power Driver Usage #
93  *
94  * The watchdog timer driver does not set any power constraints. If the power
95  * driver is enabled, the application will continue to aggressively attempt
96  * to place the device into the lowest power state possible.
97  *
98  * When the device enters Low Power Deep Sleep, the peripheral registers are
99  * reset. After a transition from Low Power Deep Sleep, the watchdog timer will
100  * be re-initialized automatically with the most recently set reload value. If
101  * Watchdog_setReload() was never called, the
102  * #WatchdogCC32XX_HWAttrs.reloadValue is used. With each transition to and
103  * from Low Power Deep Sleep, the watchdog timer is implicitly cleared.
104  *
105  ******************************************************************************
106  */
107 
108 #ifndef ti_drivers_watchdog_WatchdogCC32XX__include
109 #define ti_drivers_watchdog_WatchdogCC32XX__include
110 
111 #ifdef __cplusplus
112 extern "C" {
113 #endif
114 
115 #include <stdint.h>
116 #include <stdbool.h>
117 #include <ti/drivers/Watchdog.h>
118 
129 /* Add WatchdogCC32XX_STATUS_* macros here */
130 
151 #define WatchdogCC32XX_CMD_IS_TIMER_ENABLE (Watchdog_CMD_RESERVED + 0)
152 
153 
161 #define WatchdogCC32XX_CMD_GET_TIMER_VALUE (Watchdog_CMD_RESERVED + 1)
162 
163 
172 #define WatchdogCC32XX_CMD_IS_TIMER_LOCKED (Watchdog_CMD_RESERVED + 2)
173 
174 
183 #define WatchdogCC32XX_CMD_GET_TIMER_RELOAD_VALUE (Watchdog_CMD_RESERVED + 3)
184 
185 
190 
204 typedef struct WatchdogCC32XX_HWAttrs {
205  unsigned int baseAddr;
206  unsigned int intNum;
207  unsigned int intPriority;
208  uint32_t reloadValue;
210 
216 typedef struct WatchdogCC32XX_Object {
218  /*
219  * The reload value can be set at runtime; therefore we can't rely
220  * on the reload value supplied in the HWAttrs after a LPDS transition.
221  */
222  uint32_t reloadValue;
224  bool isOpen;
226 
227 #ifdef __cplusplus
228 }
229 #endif
230 
231 #endif /* ti_drivers_watchdog_WatchdogCC32XX__include */
Watchdog_DebugMode debugMode
Definition: WatchdogCC32XX.h:223
unsigned int intPriority
Definition: WatchdogCC32XX.h:207
uint32_t reloadValue
Definition: WatchdogCC32XX.h:208
Watchdog driver interface.
Watchdog Object for CC32XX.
Definition: WatchdogCC32XX.h:216
struct WatchdogCC32XX_HWAttrs WatchdogCC32XX_HWAttrs
Watchdog hardware attributes for CC32XX.
Watchdog hardware attributes for CC32XX.
Definition: WatchdogCC32XX.h:204
Power_NotifyObj notifyObj
Definition: WatchdogCC32XX.h:217
uint32_t reloadValue
Definition: WatchdogCC32XX.h:222
unsigned int baseAddr
Definition: WatchdogCC32XX.h:205
Power notify object structure.
Definition: Power.h:443
const Watchdog_FxnTable WatchdogCC32XX_fxnTable
Watchdog function table for CC32XX.
The definition of a Watchdog function table that contains the required set of functions to control a ...
Definition: Watchdog.h:362
struct WatchdogCC32XX_Object WatchdogCC32XX_Object
Watchdog Object for CC32XX.
unsigned int intNum
Definition: WatchdogCC32XX.h:206
enum Watchdog_DebugMode_ Watchdog_DebugMode
Watchdog debug stall settings.
bool isOpen
Definition: WatchdogCC32XX.h:224
© Copyright 1995-2019, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale