00001 00009 /* 00010 * COPYRIGHT (c) 1989-2007. 00011 * On-Line Applications Research Corporation (OAR). 00012 * 00013 * The license and distribution terms for this file may be 00014 * found in the file LICENSE in this distribution or at 00015 * http://www.rtems.com/license/LICENSE. 00016 * 00017 * $Id: watchdog.h,v 1.26 2008/05/31 05:31:18 ralf Exp $ 00018 */ 00019 00020 #ifndef _RTEMS_SCORE_WATCHDOG_H 00021 #define _RTEMS_SCORE_WATCHDOG_H 00022 00034 #include <rtems/score/object.h> 00035 00036 #ifdef __cplusplus 00037 extern "C" { 00038 #endif 00039 00045 #define WATCHDOG_MAXIMUM_INTERVAL ((Watchdog_Interval) 0xffffffff) 00046 00051 typedef uint32_t Watchdog_Interval; 00052 00058 typedef uint32_t (*Watchdog_Nanoseconds_since_last_tick_routine)(void); 00059 00064 typedef void Watchdog_Service_routine; 00065 00070 typedef Watchdog_Service_routine ( *Watchdog_Service_routine_entry )( 00071 Objects_Id, 00072 void * 00073 ); 00074 00080 #define WATCHDOG_NO_TIMEOUT 0 00081 00088 typedef enum { 00090 WATCHDOG_INACTIVE, 00094 WATCHDOG_BEING_INSERTED, 00096 WATCHDOG_ACTIVE, 00100 WATCHDOG_REMOVE_IT 00101 } Watchdog_States; 00102 00110 typedef enum { 00112 WATCHDOG_FORWARD, 00114 WATCHDOG_BACKWARD 00115 } Watchdog_Adjust_directions; 00116 00122 typedef struct { 00126 Chain_Node Node; 00128 Watchdog_States state; 00130 Watchdog_Interval initial; 00132 Watchdog_Interval delta_interval; 00134 Watchdog_Interval start_time; 00136 Watchdog_Interval stop_time; 00138 Watchdog_Service_routine_entry routine; 00140 Objects_Id id; 00144 void *user_data; 00145 } Watchdog_Control; 00146 00152 SCORE_EXTERN volatile uint32_t _Watchdog_Sync_level; 00153 00159 SCORE_EXTERN volatile uint32_t _Watchdog_Sync_count; 00160 00166 SCORE_EXTERN volatile Watchdog_Interval _Watchdog_Ticks_since_boot; 00167 00173 SCORE_EXTERN Watchdog_Nanoseconds_since_last_tick_routine 00174 _Watchdog_Nanoseconds_since_tick_handler; 00175 00180 SCORE_EXTERN Chain_Control _Watchdog_Ticks_chain; 00181 00186 SCORE_EXTERN Chain_Control _Watchdog_Seconds_chain; 00187 00194 void _Watchdog_Handler_initialization( void ); 00195 00204 Watchdog_States _Watchdog_Remove ( 00205 Watchdog_Control *the_watchdog 00206 ); 00207 00217 void _Watchdog_Adjust ( 00218 Chain_Control *header, 00219 Watchdog_Adjust_directions direction, 00220 Watchdog_Interval units 00221 ); 00222 00231 void _Watchdog_Insert ( 00232 Chain_Control *header, 00233 Watchdog_Control *the_watchdog 00234 ); 00235 00244 void _Watchdog_Tickle ( 00245 Chain_Control *header 00246 ); 00247 00248 #ifndef __RTEMS_APPLICATION__ 00249 #include <rtems/score/watchdog.inl> 00250 #endif 00251 00252 #ifdef __cplusplus 00253 } 00254 #endif 00255 00258 #endif 00259 /* end of include file */
1.5.6