[20f02c6] | 1 | /** |
---|
[ccc6695] | 2 | * @file |
---|
| 3 | * |
---|
| 4 | * @ingroup ScoreWatchdog |
---|
[ac7d5ef0] | 5 | * |
---|
[1dbbc0c] | 6 | * @brief Constants and Structures Associated with Watchdog Timers |
---|
| 7 | * |
---|
[ac7d5ef0] | 8 | * This include file contains all the constants and structures associated |
---|
| 9 | * with watchdog timers. This Handler provides mechanisms which can be |
---|
[baff4da] | 10 | * used to initialize and manipulate watchdog timers. |
---|
| 11 | */ |
---|
| 12 | |
---|
| 13 | /* |
---|
[4b72da4] | 14 | * COPYRIGHT (c) 1989-2009. |
---|
[ac7d5ef0] | 15 | * On-Line Applications Research Corporation (OAR). |
---|
| 16 | * |
---|
[98e4ebf5] | 17 | * The license and distribution terms for this file may be |
---|
| 18 | * found in the file LICENSE in this distribution or at |
---|
[c499856] | 19 | * http://www.rtems.org/license/LICENSE. |
---|
[ac7d5ef0] | 20 | */ |
---|
| 21 | |
---|
[092f142a] | 22 | #ifndef _RTEMS_SCORE_WATCHDOG_H |
---|
| 23 | #define _RTEMS_SCORE_WATCHDOG_H |
---|
[ac7d5ef0] | 24 | |
---|
[03b900d] | 25 | #include <rtems/score/basedefs.h> |
---|
| 26 | #include <rtems/score/chain.h> |
---|
| 27 | #include <rtems/score/rbtree.h> |
---|
| 28 | |
---|
| 29 | struct Per_CPU_Control; |
---|
[4b48ece0] | 30 | |
---|
| 31 | #ifdef __cplusplus |
---|
| 32 | extern "C" { |
---|
| 33 | #endif |
---|
| 34 | |
---|
[baff4da] | 35 | /** |
---|
| 36 | * @defgroup ScoreWatchdog Watchdog Handler |
---|
| 37 | * |
---|
[d8cd045c] | 38 | * @ingroup Score |
---|
| 39 | * |
---|
[6a07436] | 40 | * This handler encapsulates functionality related to the scheduling of |
---|
| 41 | * watchdog functions to be called at specific times in the future. |
---|
| 42 | * |
---|
| 43 | * @note This handler does not have anything to do with hardware watchdog |
---|
| 44 | * timers. |
---|
[baff4da] | 45 | */ |
---|
| 46 | /**@{*/ |
---|
| 47 | |
---|
[03b900d] | 48 | typedef struct Watchdog_Control Watchdog_Control; |
---|
| 49 | |
---|
[4b72da4] | 50 | /** |
---|
[1dbbc0c] | 51 | * @brief Return type from a Watchdog Service Routine. |
---|
[20f02c6] | 52 | * |
---|
[baff4da] | 53 | * This type defines the return type from a Watchdog Service Routine. |
---|
[ac7d5ef0] | 54 | */ |
---|
[3a4ae6c] | 55 | typedef void Watchdog_Service_routine; |
---|
[ac7d5ef0] | 56 | |
---|
[4b72da4] | 57 | /** |
---|
[1dbbc0c] | 58 | * @brief Pointer to a watchdog service routine. |
---|
[baff4da] | 59 | * |
---|
| 60 | * This type define a pointer to a watchdog service routine. |
---|
| 61 | */ |
---|
[03b900d] | 62 | typedef Watchdog_Service_routine |
---|
| 63 | ( *Watchdog_Service_routine_entry )( Watchdog_Control * ); |
---|
[ac7d5ef0] | 64 | |
---|
[4b72da4] | 65 | /** |
---|
[03b900d] | 66 | * @brief The watchdog header to manage scheduled watchdogs. |
---|
[ac7d5ef0] | 67 | */ |
---|
[03b900d] | 68 | typedef struct { |
---|
| 69 | /** |
---|
| 70 | * @brief Red-black tree of scheduled watchdogs sorted by expiration time. |
---|
| 71 | */ |
---|
| 72 | RBTree_Control Watchdogs; |
---|
[ac7d5ef0] | 73 | |
---|
[03b900d] | 74 | /** |
---|
| 75 | * @brief The scheduled watchdog with the earliest expiration time or NULL in |
---|
| 76 | * case no watchdog is scheduled. |
---|
[baff4da] | 77 | */ |
---|
[03b900d] | 78 | RBTree_Node *first; |
---|
| 79 | } Watchdog_Header; |
---|
[ac7d5ef0] | 80 | |
---|
[4b72da4] | 81 | /** |
---|
[1dbbc0c] | 82 | * @brief The control block used to manage each watchdog timer. |
---|
[baff4da] | 83 | * |
---|
[ac7d5ef0] | 84 | * The following record defines the control block used |
---|
| 85 | * to manage each watchdog timer. |
---|
| 86 | */ |
---|
[03b900d] | 87 | struct Watchdog_Control { |
---|
| 88 | /** |
---|
| 89 | * @brief Nodes for the watchdog. |
---|
[6a07436] | 90 | */ |
---|
[03b900d] | 91 | union { |
---|
| 92 | /** |
---|
| 93 | * @brief this field is a red-black tree node structure and allows this to |
---|
| 94 | * be placed on a red-black tree used to manage the scheduled watchdogs. |
---|
| 95 | */ |
---|
| 96 | RBTree_Node RBTree; |
---|
| 97 | |
---|
| 98 | /** |
---|
| 99 | * @brief this field is a chain node structure and allows this to be placed |
---|
| 100 | * on a chain used to manage pending watchdogs by the timer server. |
---|
| 101 | */ |
---|
| 102 | Chain_Node Chain; |
---|
| 103 | } Node; |
---|
| 104 | |
---|
| 105 | #if defined(RTEMS_SMP) |
---|
| 106 | /** @brief This field references the processor of this watchdog control. */ |
---|
| 107 | struct Per_CPU_Control *cpu; |
---|
| 108 | #endif |
---|
| 109 | |
---|
| 110 | /** @brief This field is the function to invoke. */ |
---|
| 111 | Watchdog_Service_routine_entry routine; |
---|
| 112 | |
---|
| 113 | /** @brief This field is the expiration time point. */ |
---|
| 114 | uint64_t expire; |
---|
| 115 | }; |
---|
[ac7d5ef0] | 116 | |
---|
[4b48ece0] | 117 | /**@}*/ |
---|
[ac7d5ef0] | 118 | |
---|
| 119 | #ifdef __cplusplus |
---|
| 120 | } |
---|
| 121 | #endif |
---|
| 122 | |
---|
| 123 | #endif |
---|
[b10825c] | 124 | /* end of include file */ |
---|