RTEMS CPU Kit with SuperCore  4.11.3
Files | Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
Watchdog Handler

This handler encapsulates functionality related to the scheduling of watchdog functions to be called at specific times in the future. More...

Collaboration diagram for Watchdog Handler:

Files

file  watchdog.c
 Watchdog Handler Initialization.
 
file  watchdogadjust.c
 Watchdog Adjust.
 
file  watchdoginsert.c
 Watchdog Insert.
 
file  watchdogremove.c
 Remove Watchdog from List.
 
file  watchdogtickssinceboot.c
 Watchdog Ticks Since Boot.
 

Data Structures

struct  Watchdog_Control
 The control block used to manage each watchdog timer. More...
 
struct  Watchdog_Iterator
 Iterator item to synchronize concurrent insert, remove and tickle operations. More...
 
struct  Watchdog_Header
 Watchdog header. More...
 

Macros

#define WATCHDOG_NO_TIMEOUT   0
 The constant for indefinite wait. More...
 
#define WATCHDOG_INITIALIZER(routine, id, user_data)
 Watchdog initializer for static initialization. More...
 

Typedefs

typedef uint32_t Watchdog_Interval
 Type is used to specify the length of intervals. More...
 
typedef void Watchdog_Service_routine
 Return type from a Watchdog Service Routine. More...
 
typedef Watchdog_Service_routine(* Watchdog_Service_routine_entry) (Objects_Id, void *)
 Pointer to a watchdog service routine. More...
 

Enumerations

enum  Watchdog_States { WATCHDOG_INACTIVE, WATCHDOG_BEING_INSERTED, WATCHDOG_ACTIVE }
 Set of the states which a watchdog timer may be at any given time. More...
 

Functions

RTEMS_INLINE_ROUTINE void _Watchdog_Acquire (Watchdog_Header *header, ISR_lock_Context *lock_context)
 
RTEMS_INLINE_ROUTINE void _Watchdog_Release (Watchdog_Header *header, ISR_lock_Context *lock_context)
 
RTEMS_INLINE_ROUTINE void _Watchdog_Flash (Watchdog_Header *header, ISR_lock_Context *lock_context)
 
void _Watchdog_Handler_initialization (void)
 Initialize the watchdog handler. More...
 
void _Watchdog_Tick (void)
 Triggers a watchdog tick. More...
 
Watchdog_States _Watchdog_Remove (Watchdog_Header *header, Watchdog_Control *the_watchdog)
 Removes the_watchdog from the watchdog chain. More...
 
void _Watchdog_Adjust_backward (Watchdog_Header *header, Watchdog_Interval units)
 Adjusts the header watchdog chain in the backward direction for units ticks. More...
 
void _Watchdog_Adjust_backward_locked (Watchdog_Header *header, Watchdog_Interval units)
 Adjusts the watchdogs in backward direction in a locked context. More...
 
void _Watchdog_Adjust_forward (Watchdog_Header *header, Watchdog_Interval units)
 Adjusts the header watchdog chain in the forward direction for units ticks. More...
 
void _Watchdog_Adjust_forward_locked (Watchdog_Header *header, Watchdog_Interval units, ISR_lock_Context *lock_context)
 Adjusts the watchdogs in forward direction in a locked context. More...
 
void _Watchdog_Insert (Watchdog_Header *header, Watchdog_Control *the_watchdog)
 Inserts the_watchdog into the header watchdog chain for a time of units. More...
 
void _Watchdog_Insert_locked (Watchdog_Header *header, Watchdog_Control *the_watchdog, ISR_lock_Context *lock_context)
 Inserts the watchdog in a locked context. More...
 
void _Watchdog_Tickle (Watchdog_Header *header)
 This routine is invoked at appropriate intervals to update the header watchdog chain. More...
 
RTEMS_INLINE_ROUTINE void _Watchdog_Preinitialize (Watchdog_Control *the_watchdog)
 Pre-initializes a watchdog. More...
 
RTEMS_INLINE_ROUTINE void _Watchdog_Initialize (Watchdog_Control *the_watchdog, Watchdog_Service_routine_entry routine, Objects_Id id, void *user_data)
 This routine initializes the specified watchdog. More...
 
RTEMS_INLINE_ROUTINE bool _Watchdog_Is_active (Watchdog_Control *the_watchdog)
 This routine returns true if the watchdog timer is in the ACTIVE state, and false otherwise.
 
RTEMS_INLINE_ROUTINE void _Watchdog_Activate (Watchdog_Control *the_watchdog)
 This routine activates THE_WATCHDOG timer which is already on a watchdog chain.
 
RTEMS_INLINE_ROUTINE void _Watchdog_Tickle_ticks (void)
 This routine is invoked at each clock tick to update the ticks watchdog chain.
 
RTEMS_INLINE_ROUTINE void _Watchdog_Tickle_seconds (void)
 This routine is invoked at each clock tick to update the seconds watchdog chain.
 
RTEMS_INLINE_ROUTINE void _Watchdog_Insert_ticks (Watchdog_Control *the_watchdog, Watchdog_Interval units)
 This routine inserts THE_WATCHDOG into the ticks watchdog chain for a time of UNITS ticks. More...
 
RTEMS_INLINE_ROUTINE void _Watchdog_Insert_seconds (Watchdog_Control *the_watchdog, Watchdog_Interval units)
 This routine inserts THE_WATCHDOG into the seconds watchdog chain for a time of UNITS seconds. More...
 
RTEMS_INLINE_ROUTINE Watchdog_States _Watchdog_Remove_ticks (Watchdog_Control *the_watchdog)
 
RTEMS_INLINE_ROUTINE Watchdog_States _Watchdog_Remove_seconds (Watchdog_Control *the_watchdog)
 
RTEMS_INLINE_ROUTINE void _Watchdog_Reset_ticks (Watchdog_Control *the_watchdog)
 This routine resets THE_WATCHDOG timer to its state at INSERT time. More...
 
RTEMS_INLINE_ROUTINE Watchdog_Control_Watchdog_Next (Watchdog_Control *the_watchdog)
 This routine returns a pointer to the watchdog timer following THE_WATCHDOG on the watchdog chain.
 
RTEMS_INLINE_ROUTINE Watchdog_Control_Watchdog_Previous (Watchdog_Control *the_watchdog)
 This routine returns a pointer to the watchdog timer preceding THE_WATCHDOG on the watchdog chain.
 
RTEMS_INLINE_ROUTINE Watchdog_Control_Watchdog_First (Watchdog_Header *header)
 This routine returns a pointer to the first watchdog timer on the watchdog chain HEADER.
 
RTEMS_INLINE_ROUTINE Watchdog_Control_Watchdog_Last (Watchdog_Header *header)
 This routine returns a pointer to the last watchdog timer on the watchdog chain HEADER.
 
RTEMS_INLINE_ROUTINE bool _Watchdog_Is_empty (const Watchdog_Header *header)
 
RTEMS_INLINE_ROUTINE void _Watchdog_Header_initialize (Watchdog_Header *header)
 

Variables

volatile Watchdog_Interval _Watchdog_Ticks_since_boot
 The watchdog ticks counter. More...
 
SCORE_EXTERN Watchdog_Header _Watchdog_Ticks_header
 Watchdog chain which is managed at ticks. More...
 
SCORE_EXTERN Watchdog_Header _Watchdog_Seconds_header
 Watchdog chain which is managed at second boundaries. More...
 

Detailed Description

This handler encapsulates functionality related to the scheduling of watchdog functions to be called at specific times in the future.

Note
This handler does not have anything to do with hardware watchdog timers.

Macro Definition Documentation

◆ WATCHDOG_INITIALIZER

#define WATCHDOG_INITIALIZER (   routine,
  id,
  user_data 
)
Value:
{ \
{ NULL, NULL }, \
WATCHDOG_INACTIVE, \
0, 0, 0, 0, \
( routine ), ( id ), ( user_data ) \
}

Watchdog initializer for static initialization.

See also
_Watchdog_Initialize().

◆ WATCHDOG_NO_TIMEOUT

#define WATCHDOG_NO_TIMEOUT   0

The constant for indefinite wait.

This is the constant for indefinite wait. It is actually an illegal interval.

Referenced by _MPCI_Receive_server(), and pthread_mutex_trylock().

Typedef Documentation

◆ Watchdog_Interval

typedef uint32_t Watchdog_Interval

Type is used to specify the length of intervals.

This type is used to specify the length of intervals.

◆ Watchdog_Service_routine

Return type from a Watchdog Service Routine.

This type defines the return type from a Watchdog Service Routine.

◆ Watchdog_Service_routine_entry

typedef Watchdog_Service_routine( * Watchdog_Service_routine_entry) (Objects_Id, void *)

Pointer to a watchdog service routine.

This type define a pointer to a watchdog service routine.

Enumeration Type Documentation

◆ Watchdog_States

Set of the states which a watchdog timer may be at any given time.

This enumerated type is the set of the states in which a watchdog timer may be at any given time.

Enumerator
WATCHDOG_INACTIVE 

This is the state when the watchdog is off all chains.

WATCHDOG_BEING_INSERTED 

This is the state when the watchdog is off all chains, but we are currently searching for the insertion point.

WATCHDOG_ACTIVE 

This is the state when the watchdog is on a chain, and allowed to fire.

Function Documentation

◆ _Watchdog_Adjust_backward()

void _Watchdog_Adjust_backward ( Watchdog_Header header,
Watchdog_Interval  units 
)

Adjusts the header watchdog chain in the backward direction for units ticks.

Parameters
[in]headerThe watchdog chain.
[in]unitsThe units of ticks to adjust.

◆ _Watchdog_Adjust_backward_locked()

void _Watchdog_Adjust_backward_locked ( Watchdog_Header header,
Watchdog_Interval  units 
)

Adjusts the watchdogs in backward direction in a locked context.

The caller must be the owner of the watchdog lock and will be the owner after the call.

Parameters
[in]headerThe watchdog header.
[in]unitsThe units of ticks to adjust.
See also
_Watchdog_Adjust_forward().

◆ _Watchdog_Adjust_forward()

void _Watchdog_Adjust_forward ( Watchdog_Header header,
Watchdog_Interval  units 
)

Adjusts the header watchdog chain in the forward direction for units ticks.

This may lead to several _Watchdog_Tickle() invocations.

Parameters
[in]headerThe watchdog chain.
[in]unitsThe units of ticks to adjust.

◆ _Watchdog_Adjust_forward_locked()

void _Watchdog_Adjust_forward_locked ( Watchdog_Header header,
Watchdog_Interval  units,
ISR_lock_Context lock_context 
)

Adjusts the watchdogs in forward direction in a locked context.

The caller must be the owner of the watchdog lock and will be the owner after the call. This function may release and acquire the watchdog lock internally.

Parameters
[in]headerThe watchdog header.
[in]unitsThe units of ticks to adjust.
[in]lock_contextThe lock context.
See also
_Watchdog_Adjust_forward().

◆ _Watchdog_Handler_initialization()

void _Watchdog_Handler_initialization ( void  )

Initialize the watchdog handler.

This routine initializes the watchdog handler. The watchdog synchronization flag is initialized and the watchdog chains are initialized and emptied.

References _Watchdog_Ticks_since_boot.

◆ _Watchdog_Initialize()

RTEMS_INLINE_ROUTINE void _Watchdog_Initialize ( Watchdog_Control the_watchdog,
Watchdog_Service_routine_entry  routine,
Objects_Id  id,
void *  user_data 
)

This routine initializes the specified watchdog.

The watchdog is made inactive, the watchdog id and handler routine are set to the specified values.

References _Assert, Watchdog_Control::id, Watchdog_Control::routine, Watchdog_Control::state, Watchdog_Control::user_data, and WATCHDOG_INACTIVE.

◆ _Watchdog_Insert()

void _Watchdog_Insert ( Watchdog_Header header,
Watchdog_Control the_watchdog 
)

Inserts the_watchdog into the header watchdog chain for a time of units.

This routine inserts the_watchdog into the header watchdog chain for a time of units. Update the delta interval counters.

Parameters
[in]headeris the_watchdog list to insert the_watchdog on
[in]the_watchdogis the watchdog to insert

Referenced by _Watchdog_Insert_seconds(), and _Watchdog_Insert_ticks().

◆ _Watchdog_Insert_locked()

void _Watchdog_Insert_locked ( Watchdog_Header header,
Watchdog_Control the_watchdog,
ISR_lock_Context lock_context 
)

Inserts the watchdog in a locked context.

The caller must be the owner of the watchdog lock and will be the owner after the call. This function may release and acquire the watchdog lock internally.

Parameters
[in]headerThe watchdog header.
[in]the_watchdogThe watchdog.
[in]lock_contextThe lock context.
See also
_Watchdog_Insert().

References Watchdog_Control::state, and WATCHDOG_INACTIVE.

◆ _Watchdog_Insert_seconds()

RTEMS_INLINE_ROUTINE void _Watchdog_Insert_seconds ( Watchdog_Control the_watchdog,
Watchdog_Interval  units 
)

This routine inserts THE_WATCHDOG into the seconds watchdog chain for a time of UNITS seconds.

The INSERT_MODE indicates whether THE_WATCHDOG is to be activated automatically or later, explicitly by the caller.

References _Watchdog_Insert(), _Watchdog_Seconds_header, Watchdog_Control::initial, and RTEMS_INLINE_ROUTINE.

◆ _Watchdog_Insert_ticks()

RTEMS_INLINE_ROUTINE void _Watchdog_Insert_ticks ( Watchdog_Control the_watchdog,
Watchdog_Interval  units 
)

This routine inserts THE_WATCHDOG into the ticks watchdog chain for a time of UNITS ticks.

The INSERT_MODE indicates whether THE_WATCHDOG is to be activated automatically or later, explicitly by the caller.

References _Watchdog_Insert(), _Watchdog_Ticks_header, and Watchdog_Control::initial.

◆ _Watchdog_Preinitialize()

RTEMS_INLINE_ROUTINE void _Watchdog_Preinitialize ( Watchdog_Control the_watchdog)

Pre-initializes a watchdog.

This routine must be called before a watchdog is used in any way. The exception are statically initialized watchdogs via WATCHDOG_INITIALIZER().

Parameters
[in]the_watchdogThe uninitialized watchdog.

References Watchdog_Control::id, Watchdog_Control::routine, Watchdog_Control::state, Watchdog_Control::user_data, and WATCHDOG_INACTIVE.

Referenced by rtems_rate_monotonic_create(), and rtems_timer_create().

◆ _Watchdog_Remove()

Watchdog_States _Watchdog_Remove ( Watchdog_Header header,
Watchdog_Control the_watchdog 
)

Removes the_watchdog from the watchdog chain.

This routine removes the_watchdog from the watchdog chain on which it resides and returns the state the_watchdog timer was in.

Parameters
[in]headerThe watchdog chain.
[in]the_watchdogwill be removed
Return values
thestate in which the_watchdog was in when removed

◆ _Watchdog_Reset_ticks()

RTEMS_INLINE_ROUTINE void _Watchdog_Reset_ticks ( Watchdog_Control the_watchdog)

This routine resets THE_WATCHDOG timer to its state at INSERT time.

This routine is valid only on interval watchdog timers and is used to make an interval watchdog timer fire "every" so many ticks.

◆ _Watchdog_Tick()

void _Watchdog_Tick ( void  )

Triggers a watchdog tick.

This routine executes TOD, watchdog and scheduler ticks.

References _Scheduler_Tick(), _Thread_Dispatch(), _Thread_Dispatch_is_enabled(), _TOD_Tickle_ticks(), and _Watchdog_Tickle_ticks().

◆ _Watchdog_Tickle()

void _Watchdog_Tickle ( Watchdog_Header header)

This routine is invoked at appropriate intervals to update the header watchdog chain.

This routine is invoked at appropriate intervals to update the header watchdog chain. This routine decrements the delta counter in response to a tick.

Parameters
[in]headeris the watchdog chain to tickle

Referenced by _Watchdog_Tickle_seconds(), and _Watchdog_Tickle_ticks().

Variable Documentation

◆ _Watchdog_Seconds_header

SCORE_EXTERN Watchdog_Header _Watchdog_Seconds_header

Watchdog chain which is managed at second boundaries.

This is the watchdog chain which is managed at second boundaries.

Referenced by _Watchdog_Insert_seconds(), and _Watchdog_Tickle_seconds().

◆ _Watchdog_Ticks_header

SCORE_EXTERN Watchdog_Header _Watchdog_Ticks_header

Watchdog chain which is managed at ticks.

This is the watchdog chain which is managed at ticks.

Referenced by _Watchdog_Insert_ticks(), and _Watchdog_Tickle_ticks().

◆ _Watchdog_Ticks_since_boot

volatile Watchdog_Interval _Watchdog_Ticks_since_boot

The watchdog ticks counter.

With a 1ms watchdog tick, this counter overflows after 50 days since boot.

Referenced by _Scheduler_EDF_Priority_compare(), _Scheduler_EDF_Release_job(), _TOD_Tickle_ticks(), _Watchdog_Handler_initialization(), rtems_clock_get_ticks_since_boot(), and rtems_clock_tick_later().