diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2015-04-10 16:19:48 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2015-04-13 13:39:26 +0200 |
commit | 54cf0e34c5d6b8be0ce136eac7c4e11c1d487d7f (patch) | |
tree | fb6485f659b1fe4204893e9d442f7e5deda96db3 /cpukit/score/include/rtems/score/watchdogimpl.h | |
parent | score: Split _Watchdog_Adjust() (diff) | |
download | rtems-54cf0e34c5d6b8be0ce136eac7c4e11c1d487d7f.tar.bz2 |
score: Add Watchdog_Header
This type is intended to encapsulate all state to manage a watchdog
chain.
Update #2307.
Diffstat (limited to 'cpukit/score/include/rtems/score/watchdogimpl.h')
-rw-r--r-- | cpukit/score/include/rtems/score/watchdogimpl.h | 62 |
1 files changed, 43 insertions, 19 deletions
diff --git a/cpukit/score/include/rtems/score/watchdogimpl.h b/cpukit/score/include/rtems/score/watchdogimpl.h index 9eb0951949..67a2d69cf3 100644 --- a/cpukit/score/include/rtems/score/watchdogimpl.h +++ b/cpukit/score/include/rtems/score/watchdogimpl.h @@ -53,6 +53,16 @@ extern "C" { } /** + * @brief Watchdog header. + */ +typedef struct { + /** + * @brief The chain of active or transient watchdogs. + */ + Chain_Control Watchdogs; +} Watchdog_Header; + +/** * @brief Watchdog synchronization level. * * This used for synchronization purposes @@ -73,14 +83,14 @@ SCORE_EXTERN volatile uint32_t _Watchdog_Sync_count; * * This is the watchdog chain which is managed at ticks. */ -SCORE_EXTERN Chain_Control _Watchdog_Ticks_chain; +SCORE_EXTERN Watchdog_Header _Watchdog_Ticks_header; /** * @brief Watchdog chain which is managed at second boundaries. * * This is the watchdog chain which is managed at second boundaries. */ -SCORE_EXTERN Chain_Control _Watchdog_Seconds_chain; +SCORE_EXTERN Watchdog_Header _Watchdog_Seconds_header; /** * @brief Initialize the watchdog handler. @@ -112,7 +122,7 @@ Watchdog_States _Watchdog_Remove ( * @param[in] units The units of ticks to adjust. */ void _Watchdog_Adjust_backward( - Chain_Control *header, + Watchdog_Header *header, Watchdog_Interval units ); @@ -126,7 +136,7 @@ void _Watchdog_Adjust_backward( * @param[in] units The units of ticks to adjust. */ void _Watchdog_Adjust_forward( - Chain_Control *header, + Watchdog_Header *header, Watchdog_Interval units ); @@ -145,9 +155,9 @@ void _Watchdog_Adjust_forward( * @note This always adjusts forward. */ void _Watchdog_Adjust_to_chain( - Chain_Control *header, - Watchdog_Interval units_arg, - Chain_Control *to_fire + Watchdog_Header *header, + Watchdog_Interval units_arg, + Chain_Control *to_fire ); @@ -163,8 +173,8 @@ void _Watchdog_Adjust_to_chain( * @param[in] the_watchdog is the watchdog to insert */ void _Watchdog_Insert ( - Chain_Control *header, - Watchdog_Control *the_watchdog + Watchdog_Header *header, + Watchdog_Control *the_watchdog ); /** @@ -178,7 +188,7 @@ void _Watchdog_Insert ( * @param[in] header is the watchdog chain to tickle */ void _Watchdog_Tickle ( - Chain_Control *header + Watchdog_Header *header ); /** @@ -250,7 +260,7 @@ RTEMS_INLINE_ROUTINE void _Watchdog_Deactivate( RTEMS_INLINE_ROUTINE void _Watchdog_Tickle_ticks( void ) { - _Watchdog_Tickle( &_Watchdog_Ticks_chain ); + _Watchdog_Tickle( &_Watchdog_Ticks_header ); } @@ -262,7 +272,7 @@ RTEMS_INLINE_ROUTINE void _Watchdog_Tickle_ticks( void ) RTEMS_INLINE_ROUTINE void _Watchdog_Tickle_seconds( void ) { - _Watchdog_Tickle( &_Watchdog_Seconds_chain ); + _Watchdog_Tickle( &_Watchdog_Seconds_header ); } @@ -281,7 +291,7 @@ RTEMS_INLINE_ROUTINE void _Watchdog_Insert_ticks( the_watchdog->initial = units; - _Watchdog_Insert( &_Watchdog_Ticks_chain, the_watchdog ); + _Watchdog_Insert( &_Watchdog_Ticks_header, the_watchdog ); } @@ -300,7 +310,7 @@ RTEMS_INLINE_ROUTINE void _Watchdog_Insert_seconds( the_watchdog->initial = units; - _Watchdog_Insert( &_Watchdog_Seconds_chain, the_watchdog ); + _Watchdog_Insert( &_Watchdog_Seconds_header, the_watchdog ); } @@ -318,7 +328,7 @@ RTEMS_INLINE_ROUTINE void _Watchdog_Reset( (void) _Watchdog_Remove( the_watchdog ); - _Watchdog_Insert( &_Watchdog_Ticks_chain, the_watchdog ); + _Watchdog_Insert( &_Watchdog_Ticks_header, the_watchdog ); } @@ -356,11 +366,11 @@ RTEMS_INLINE_ROUTINE Watchdog_Control *_Watchdog_Previous( */ RTEMS_INLINE_ROUTINE Watchdog_Control *_Watchdog_First( - Chain_Control *header + Watchdog_Header *header ) { - return ( (Watchdog_Control *) _Chain_First( header ) ); + return ( (Watchdog_Control *) _Chain_First( &header->Watchdogs ) ); } @@ -370,12 +380,26 @@ RTEMS_INLINE_ROUTINE Watchdog_Control *_Watchdog_First( */ RTEMS_INLINE_ROUTINE Watchdog_Control *_Watchdog_Last( - Chain_Control *header + Watchdog_Header *header ) { - return ( (Watchdog_Control *) _Chain_Last( header ) ); + return ( (Watchdog_Control *) _Chain_Last( &header->Watchdogs ) ); + +} + +RTEMS_INLINE_ROUTINE bool _Watchdog_Is_empty( + const Watchdog_Header *header +) +{ + return _Chain_Is_empty( &header->Watchdogs ); +} +RTEMS_INLINE_ROUTINE void _Watchdog_Header_initialize( + Watchdog_Header *header +) +{ + _Chain_Initialize_empty( &header->Watchdogs ); } /** @} */ |