WatchdogMSP432E4.h
Go to the documentation of this file.
1 /*
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  */
32 /*!****************************************************************************
33  * @file WatchdogMSP432E4.h
34  *
35  * @brief Watchdog driver implementation for MSP432E4
36  *
37  * The Watchdog header file for MSP432E4 should be included in an application
38  * as follows:
39  * @code
40  * #include <ti/drivers/Watchdog.h>
41  * #include <ti/drivers/watchdog/WatchdogMSP432E4.h>
42  * @endcode
43  *
44  * Refer to @ref Watchdog.h for a complete description of APIs.
45  *
46  * ## Overview #
47  * This Watchdog driver implementation is designed to operate on a MSP432E4
48  * device. Once opened, MSP432E4 Watchdog will count down from the reload
49  * value specified in the WatchdogMSP432E4_HWAttrs. If it times out, the
50  * Watchdog interrupt flag will be set, and a user-provided callback function
51  * will be called. If resets have been enabled in the Watchdog_Params and
52  * the Watchdog Timer is allowed to timeout again while the interrupt flag is
53  * still pending, a reset signal will be generated. To prevent a reset,
54  * Watchdog_clear() must be called to clear the interrupt flag.
55  *
56  * The reload value from which the Watchdog Timer counts down may be changed
57  * during runtime using Watchdog_setReload().
58  *
59  * Watchdog_close() is <b>not</b> supported by this driver implementation.
60  *
61  * By default the Watchdog driver has resets turned on. However, they may be
62  * turned off in the Watchdog_Params which allows the Watchdog Timer to be
63  * used like another timer interrupt. This functionality is <b>not</b>
64  * supported by all platforms, refer to device specific documentation for
65  * details.
66  *
67  * To have a user-defined function run at the warning interrupt, first define
68  * a void-type function that takes a Watchdog_Handle cast to a uintptr_t as an
69  * argument such as the one shown below.
70  *
71  * @code
72  * void callback(uintptr_t handle);
73  *
74  * ...
75  *
76  * Watchdog_Handle handle;
77  * Watchdog_Params params;
78  *
79  * Watchdog_Params_init(&params);
80  * params.callbackFxn = callback;
81  * handle = Watchdog_open(Board_WATCHDOG0, &params);
82  * @endcode
83  ******************************************************************************
84  */
85 #ifndef ti_drivers_watchdog_WatchdogMSP432E4__include
86 #define ti_drivers_watchdog_WatchdogMSP432E4__include
87 
88 #ifdef __cplusplus
89 extern "C" {
90 #endif
91 
92 #include <stdbool.h>
93 #include <stdint.h>
94 
95 #include <ti/drivers/Watchdog.h>
96 
107 /* Add WatchdogMSP432E4_STATUS_* macros here */
108 
121 /* Add WatchdogMSP432E4_CMD_* macros here */
122 
127 
163 typedef struct WatchdogMSP432E4_HWAttrs {
164  uint32_t baseAddr;
165  uint32_t intNum;
166  uint32_t intPriority;
167  uint32_t reloadValue;
169 
175 typedef struct WatchdogMSP432E4_Object {
176  bool isOpen; /* Flag for open/close status */
178 
179 #ifdef __cplusplus
180 }
181 #endif
182 
183 #endif /* ti_drivers_watchdog_WatchdogMSP432E4__include */
uint32_t intNum
Definition: WatchdogMSP432E4.h:165
Watchdog driver interface.
Watchdog hardware attributes for MSP432E4.
Definition: WatchdogMSP432E4.h:163
uint32_t intPriority
Definition: WatchdogMSP432E4.h:166
const Watchdog_FxnTable WatchdogMSP432E4_fxnTable
Watchdog function table for MSP432E4.
uint32_t baseAddr
Definition: WatchdogMSP432E4.h:164
The definition of a Watchdog function table that contains the required set of functions to control a ...
Definition: Watchdog.h:346
uint32_t reloadValue
Definition: WatchdogMSP432E4.h:167
struct WatchdogMSP432E4_HWAttrs WatchdogMSP432E4_HWAttrs
Watchdog hardware attributes for MSP432E4.
bool isOpen
Definition: WatchdogMSP432E4.h:176
Watchdog Object for MSP432E4.
Definition: WatchdogMSP432E4.h:175
struct WatchdogMSP432E4_Object WatchdogMSP432E4_Object
Watchdog Object for MSP432E4.
Copyright 2017, Texas Instruments Incorporated