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 08/22/14 at 14:39:47

rtems: Inline rtems_clock_get_ticks_since_boot()

Update documentation.

  • Property mode set to 100644
File size: 4.0 KB
RevLine 
[20f02c6]1/**
[11874561]2 *  @file  rtems/score/watchdog.h
[ac7d5ef0]3 *
[1dbbc0c]4 *  @brief Constants and Structures Associated with Watchdog Timers
5 *
[ac7d5ef0]6 *  This include file contains all the constants and structures associated
7 *  with watchdog timers.   This Handler provides mechanisms which can be
[baff4da]8 *  used to initialize and manipulate watchdog timers.
9 */
10
11/*
[4b72da4]12 *  COPYRIGHT (c) 1989-2009.
[ac7d5ef0]13 *  On-Line Applications Research Corporation (OAR).
14 *
[98e4ebf5]15 *  The license and distribution terms for this file may be
16 *  found in the file LICENSE in this distribution or at
[c499856]17 *  http://www.rtems.org/license/LICENSE.
[ac7d5ef0]18 */
19
[092f142a]20#ifndef _RTEMS_SCORE_WATCHDOG_H
21#define _RTEMS_SCORE_WATCHDOG_H
[ac7d5ef0]22
[4b48ece0]23#include <rtems/score/object.h>
24
25#ifdef __cplusplus
26extern "C" {
27#endif
28
[baff4da]29/**
30 *  @defgroup ScoreWatchdog Watchdog Handler
31 *
[d8cd045c]32 *  @ingroup Score
33 *
[6a07436]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.
[baff4da]39 */
40/**@{*/
41
[4b72da4]42/**
[1dbbc0c]43 *  @brief Type is used to specify the length of intervals.
[baff4da]44 *
45 *  This type is used to specify the length of intervals.
46 */
[d6154c7]47typedef uint32_t   Watchdog_Interval;
[ac7d5ef0]48
[4b72da4]49/**
[1dbbc0c]50 *  @brief Return type from a Watchdog Service Routine.
[20f02c6]51 *
[baff4da]52 *  This type defines the return type from a Watchdog Service Routine.
[ac7d5ef0]53 */
[3a4ae6c]54typedef void Watchdog_Service_routine;
[ac7d5ef0]55
[4b72da4]56/**
[1dbbc0c]57 *  @brief Pointer to a watchdog service routine.
[baff4da]58 *
59 *  This type define a pointer to a watchdog service routine.
60 */
[3a4ae6c]61typedef Watchdog_Service_routine ( *Watchdog_Service_routine_entry )(
[ac7d5ef0]62                 Objects_Id,
63                 void *
64             );
65
[4b72da4]66/**
[1dbbc0c]67 *  @brief The constant for indefinite wait.
[baff4da]68 *
69 *  This is the constant for indefinite wait.  It is actually an
70 *  illegal interval.
[ac7d5ef0]71 */
[3a4ae6c]72#define WATCHDOG_NO_TIMEOUT  0
[ac7d5ef0]73
[4b72da4]74/**
[1dbbc0c]75 *  @brief Set of the states which a watchdog timer may be at any given time.
[baff4da]76 *
77 *  This enumerated type is the set of the states in which a
[ac7d5ef0]78 *  watchdog timer may be at any given time.
79 */
80
81typedef enum {
[baff4da]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
[ac7d5ef0]94} Watchdog_States;
95
[4b72da4]96/**
[1dbbc0c]97 *  @brief The control block used to manage each watchdog timer.
[baff4da]98 *
[ac7d5ef0]99 *  The following record defines the control block used
100 *  to manage each watchdog timer.
101 */
102typedef struct {
[6a07436]103  /** This field is a Chain Node structure and allows this to be placed on
104   *  chains for set management.
105   */
[48e34595]106  Chain_Node                      Node;
[6a07436]107  /** This field is the state of the watchdog. */
[48e34595]108  Watchdog_States                 state;
[6a07436]109  /** This field is the initially requested interval. */
[48e34595]110  Watchdog_Interval               initial;
[6a07436]111  /** This field is the remaining portion of the interval. */
[48e34595]112  Watchdog_Interval               delta_interval;
[6a07436]113  /** This field is the number of system clock ticks when this was scheduled. */
[48e34595]114  Watchdog_Interval               start_time;
[6a07436]115  /** This field is the number of system clock ticks when this was suspended. */
[48e34595]116  Watchdog_Interval               stop_time;
[6a07436]117  /** This field is the function to invoke. */
[3a4ae6c]118  Watchdog_Service_routine_entry  routine;
[6a07436]119  /** This field is the Id to pass as an argument to the routine. */
[48e34595]120  Objects_Id                      id;
[6a07436]121  /** This field is an untyped pointer to user data that is passed to the
122   *  watchdog handler routine.
123   */
[48e34595]124  void                           *user_data;
[ac7d5ef0]125}   Watchdog_Control;
126
[f553c6e]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
[4b48ece0]134/**@}*/
[ac7d5ef0]135
136#ifdef __cplusplus
137}
138#endif
139
140#endif
[b10825c]141/* end of include file */
Note: See TracBrowser for help on using the repository browser.