TI-RTOS Drivers  tidrivers_full_2_20_00_08
Watchdog.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015-2016, 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  */
104 #ifndef ti_drivers_Watchdog__include
105 #define ti_drivers_Watchdog__include
106 
107 #ifdef __cplusplus
108 extern "C" {
109 #endif
110 
111 
112 #include <stdint.h>
113 
131 #define Watchdog_CMD_RESERVED 32
132 
145 #define Watchdog_STATUS_RESERVED -32
146 
160 #define Watchdog_STATUS_SUCCESS 0
161 
168 #define Watchdog_STATUS_ERROR -1
169 
177 #define Watchdog_STATUS_UNDEFINEDCMD -2
178 
188 /* Add Watchdog_CMD_<commands> here */
189 
198 
207 typedef enum Watchdog_DebugMode {
211 
219 typedef enum Watchdog_ResetMode {
223 
232 typedef void (*Watchdog_Callback)(uintptr_t);
233 
242 typedef struct Watchdog_Params {
249  uintptr_t custom;
252 
257 typedef void (*Watchdog_ClearFxn) (Watchdog_Handle handle);
258 
263 typedef void (*Watchdog_CloseFxn) (Watchdog_Handle handle);
264 
269 typedef int (*Watchdog_ControlFxn) (Watchdog_Handle handle,
270  unsigned int cmd,
271  void *arg);
272 
277 typedef void (*Watchdog_InitFxn) (Watchdog_Handle handle);
278 
283 typedef Watchdog_Handle (*Watchdog_OpenFxn) (Watchdog_Handle handle,
284  Watchdog_Params *params);
285 
290 typedef void (*Watchdog_SetReloadFxn) (Watchdog_Handle handle, uint32_t ticks);
291 
296 typedef uint32_t (*Watchdog_ConvertMsToTicksFxn) (uint32_t milliseconds);
297 
303 typedef struct Watchdog_FxnTable {
312 
324 typedef struct Watchdog_Config {
329 
331  void *object;
332 
334  void const *hwAttrs;
336 
345 extern void Watchdog_clear(Watchdog_Handle handle);
346 
358 extern void Watchdog_close(Watchdog_Handle handle);
359 
397 extern int Watchdog_control(Watchdog_Handle handle,
398  unsigned int cmd,
399  void *arg);
400 
409 extern void Watchdog_init(void);
410 
430 extern Watchdog_Handle Watchdog_open(unsigned int index, Watchdog_Params *params);
431 
443 extern void Watchdog_Params_init(Watchdog_Params *params);
444 
463 extern void Watchdog_setReload(Watchdog_Handle handle, uint32_t ticks);
464 
486 extern uint32_t Watchdog_convertMsToTicks(Watchdog_Handle handle, uint32_t milliseconds);
487 
488 #ifdef __cplusplus
489 }
490 #endif
491 
492 #endif /* ti_drivers_Watchdog__include */
Watchdog_Handle Watchdog_open(unsigned int index, Watchdog_Params *params)
Opens a Watchdog.
Watchdog_Callback callbackFxn
Definition: Watchdog.h:243
Watchdog_DebugMode debugStallMode
Definition: Watchdog.h:247
void Watchdog_clear(Watchdog_Handle handle)
Clears the Watchdog.
Watchdog_ControlFxn watchdogControl
Definition: Watchdog.h:306
Watchdog_Handle(* Watchdog_OpenFxn)(Watchdog_Handle handle, Watchdog_Params *params)
A function pointer to a driver specific implementation of Watchdog_open().
Definition: Watchdog.h:283
Watchdog_ConvertMsToTicksFxn watchdogConvertMsToTicks
Definition: Watchdog.h:310
struct Watchdog_FxnTable Watchdog_FxnTable
The definition of a Watchdog function table that contains the required set of functions to control a ...
Watchdog_ResetMode resetMode
Definition: Watchdog.h:245
Watchdog Parameters.
Definition: Watchdog.h:242
Watchdog_FxnTable const * fxnTablePtr
Definition: Watchdog.h:328
void(* Watchdog_InitFxn)(Watchdog_Handle handle)
A function pointer to a driver specific implementation of Watchdog_init().
Definition: Watchdog.h:277
Definition: Watchdog.h:220
void const * hwAttrs
Definition: Watchdog.h:334
void Watchdog_Params_init(Watchdog_Params *params)
Function to initialize the Watchdog_Params structure to its defaults.
uint32_t(* Watchdog_ConvertMsToTicksFxn)(uint32_t milliseconds)
A function pointer to a driver specific implementation of Watchdog_ConvertMsToTicksFxn().
Definition: Watchdog.h:296
void(* Watchdog_SetReloadFxn)(Watchdog_Handle handle, uint32_t ticks)
A function pointer to a driver specific implementation of Watchdog_setReload().
Definition: Watchdog.h:290
int Watchdog_control(Watchdog_Handle handle, unsigned int cmd, void *arg)
Function performs implementation specific features on a given Watchdog_Handle.
void(* Watchdog_CloseFxn)(Watchdog_Handle handle)
A function pointer to a driver specific implementation of Watchdog_close().
Definition: Watchdog.h:263
Watchdog_DebugMode
Watchdog debug stall settings.
Definition: Watchdog.h:207
Watchdog_OpenFxn watchdogOpen
Definition: Watchdog.h:308
void * object
Definition: Watchdog.h:331
void Watchdog_close(Watchdog_Handle handle)
Function to close a Watchdog peripheral specified by the Watchdog handle.It stops (holds) the Watchdo...
void Watchdog_init(void)
Initializes the Watchdog module.
void(* Watchdog_ClearFxn)(Watchdog_Handle handle)
A function pointer to a driver specific implementation of Watchdog_clear().
Definition: Watchdog.h:257
uint32_t Watchdog_convertMsToTicks(Watchdog_Handle handle, uint32_t milliseconds)
Converts milliseconds to Watchdog clock ticks.
void(* Watchdog_Callback)(uintptr_t)
Watchdog callback pointer.
Definition: Watchdog.h:232
Watchdog Global configuration.
Definition: Watchdog.h:324
Watchdog_ClearFxn watchdogClear
Definition: Watchdog.h:304
struct Watchdog_Config Watchdog_Config
Watchdog Global configuration.
Watchdog_SetReloadFxn watchdogSetReload
Definition: Watchdog.h:309
void Watchdog_setReload(Watchdog_Handle handle, uint32_t ticks)
Sets the Watchdog reload value.
Definition: Watchdog.h:221
The definition of a Watchdog function table that contains the required set of functions to control a ...
Definition: Watchdog.h:303
Watchdog_ResetMode
Watchdog reset mode settings.
Definition: Watchdog.h:219
Definition: Watchdog.h:208
Watchdog_InitFxn watchdogInit
Definition: Watchdog.h:307
int(* Watchdog_ControlFxn)(Watchdog_Handle handle, unsigned int cmd, void *arg)
A function pointer to a driver specific implementation of Watchdog_control().
Definition: Watchdog.h:269
Definition: Watchdog.h:209
uintptr_t custom
Definition: Watchdog.h:249
struct Watchdog_Params Watchdog_Params
Watchdog Parameters.
Watchdog_CloseFxn watchdogClose
Definition: Watchdog.h:305
struct Watchdog_Config * Watchdog_Handle
Watchdog Handle.
Definition: Watchdog.h:197
Copyright 2016, Texas Instruments Incorporated