source: rtems/cpukit/score/include/rtems/score/watchdog.h @ f553c6e

4.115
Last change on this file since f553c6e was f553c6e, checked in by Sebastian Huber <sebastian.huber@…>, on Aug 22, 2014 at 2:39:47 PM

rtems: Inline rtems_clock_get_ticks_since_boot()

Update documentation.

  • Property mode set to 100644
File size: 4.0 KB
Line 
1/**
2 *  @file  rtems/score/watchdog.h
3 *
4 *  @brief Constants and Structures Associated with Watchdog Timers
5 *
6 *  This include file contains all the constants and structures associated
7 *  with watchdog timers.   This Handler provides mechanisms which can be
8 *  used to initialize and manipulate watchdog timers.
9 */
10
11/*
12 *  COPYRIGHT (c) 1989-2009.
13 *  On-Line Applications Research Corporation (OAR).
14 *
15 *  The license and distribution terms for this file may be
16 *  found in the file LICENSE in this distribution or at
17 *  http://www.rtems.org/license/LICENSE.
18 */
19
20#ifndef _RTEMS_SCORE_WATCHDOG_H
21#define _RTEMS_SCORE_WATCHDOG_H
22
23#include <rtems/score/object.h>
24
25#ifdef __cplusplus
26extern "C" {
27#endif
28
29/**
30 *  @defgroup ScoreWatchdog Watchdog Handler
31 *
32 *  @ingroup Score
33 *
34 *  This handler encapsulates functionality related to the scheduling of
35 *  watchdog functions to be called at specific times in the future.
36 *
37 *  @note This handler does not have anything to do with hardware watchdog
38 *        timers.
39 */
40/**@{*/
41
42/**
43 *  @brief Type is used to specify the length of intervals.
44 *
45 *  This type is used to specify the length of intervals.
46 */
47typedef uint32_t   Watchdog_Interval;
48
49/**
50 *  @brief Return type from a Watchdog Service Routine.
51 *
52 *  This type defines the return type from a Watchdog Service Routine.
53 */
54typedef void Watchdog_Service_routine;
55
56/**
57 *  @brief Pointer to a watchdog service routine.
58 *
59 *  This type define a pointer to a watchdog service routine.
60 */
61typedef Watchdog_Service_routine ( *Watchdog_Service_routine_entry )(
62                 Objects_Id,
63                 void *
64             );
65
66/**
67 *  @brief The constant for indefinite wait.
68 *
69 *  This is the constant for indefinite wait.  It is actually an
70 *  illegal interval.
71 */
72#define WATCHDOG_NO_TIMEOUT  0
73
74/**
75 *  @brief Set of the states which a watchdog timer may be at any given time.
76 *
77 *  This enumerated type is the set of the states in which a
78 *  watchdog timer may be at any given time.
79 */
80
81typedef enum {
82  /** This is the state when the watchdog is off all chains */
83  WATCHDOG_INACTIVE,
84  /** This is the state when the watchdog is off all chains, but we are
85   *  currently searching for the insertion point.
86   */
87  WATCHDOG_BEING_INSERTED,
88  /** This is the state when the watchdog is on a chain, and allowed to fire. */
89  WATCHDOG_ACTIVE,
90  /** This is the state when the watchdog is on a chain, but we should
91   *  remove without firing if it expires.
92   */
93  WATCHDOG_REMOVE_IT
94} Watchdog_States;
95
96/**
97 *  @brief The control block used to manage each watchdog timer.
98 *
99 *  The following record defines the control block used
100 *  to manage each watchdog timer.
101 */
102typedef struct {
103  /** This field is a Chain Node structure and allows this to be placed on
104   *  chains for set management.
105   */
106  Chain_Node                      Node;
107  /** This field is the state of the watchdog. */
108  Watchdog_States                 state;
109  /** This field is the initially requested interval. */
110  Watchdog_Interval               initial;
111  /** This field is the remaining portion of the interval. */
112  Watchdog_Interval               delta_interval;
113  /** This field is the number of system clock ticks when this was scheduled. */
114  Watchdog_Interval               start_time;
115  /** This field is the number of system clock ticks when this was suspended. */
116  Watchdog_Interval               stop_time;
117  /** This field is the function to invoke. */
118  Watchdog_Service_routine_entry  routine;
119  /** This field is the Id to pass as an argument to the routine. */
120  Objects_Id                      id;
121  /** This field is an untyped pointer to user data that is passed to the
122   *  watchdog handler routine.
123   */
124  void                           *user_data;
125}   Watchdog_Control;
126
127/**
128 * @brief The watchdog ticks counter.
129 *
130 * With a 1ms watchdog tick, this counter overflows after 50 days since boot.
131 */
132SCORE_EXTERN volatile Watchdog_Interval _Watchdog_Ticks_since_boot;
133
134/**@}*/
135
136#ifdef __cplusplus
137}
138#endif
139
140#endif
141/* end of include file */
Note: See TracBrowser for help on using the repository browser.