RTEMS 6.1-rc5
Loading...
Searching...
No Matches
Files | Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
Watchdog Handler

This group contains the Watchdog Handler implementation. More...

Files

file  watchdog.h
 This header file provides interfaces of the Watchdog Handler which are used by the implementation and the Application Configuration.
 
file  watchdogimpl.h
 This header file provides interfaces of the Watchdog Handler which are only used by the implementation.
 
file  watchdogticks.h
 This header file provides the interfaces of the Watchdog Handler related to watchdog ticks which are used by the implementation and the Application Configuration.
 
file  watchdoginsert.c
 This source file contains the implementation of _Watchdog_Insert().
 
file  watchdogremove.c
 This source file contains the implementation of _Watchdog_Remove().
 
file  watchdogtick.c
 This source file contains the implementation of _Watchdog_Do_tickle() and _Watchdog_Tick().
 
file  watchdogtickssinceboot.c
 This source file contains the definition of _Watchdog_Ticks_since_boot.
 
file  watchdogtimeslicedefault.c
 This source file contains the default definition of _Watchdog_Ticks_per_timeslice.
 

Data Structures

struct  Watchdog_Header
 The watchdog header to manage scheduled watchdogs. More...
 
struct  Watchdog_Control
 The control block used to manage each watchdog timer. More...
 

Macros

#define WATCHDOG_INITIALIZER(routine)
 Watchdog initializer for static initialization.
 
#define _Watchdog_Tickle(header, first, now, lock, lock_context)    _Watchdog_Do_tickle( header, first, now, lock_context )
 
#define WATCHDOG_MAXIMUM_TICKS   UINT64_MAX
 The maximum watchdog ticks value for the far future.
 
#define WATCHDOG_NANOSECONDS_PER_SECOND   1000000000
 
#define WATCHDOG_BITS_FOR_1E9_NANOSECONDS   30
 The bits necessary to store 1000000000 (= WATCHDOG_NANOSECONDS_PER_SECOND) nanoseconds.
 
#define WATCHDOG_MAX_SECONDS   0x3ffffffff
 The maximum number of seconds representable in the nanoseconds watchdog format.
 
#define WATCHDOG_NO_TIMEOUT   0
 Special watchdog ticks value to indicate an infinite wait.
 
#define WATCHDOG_TICKS_PER_TIMESLICE_DEFAULT   50
 Default value for the watchdog ticks per timeslice.
 

Typedefs

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

Enumerations

enum  Watchdog_State { WATCHDOG_SCHEDULED_BLACK , WATCHDOG_SCHEDULED_RED , WATCHDOG_INACTIVE , WATCHDOG_PENDING }
 Watchdog states. More...
 

Functions

void _Watchdog_Tick (struct Per_CPU_Control *cpu)
 Performs a watchdog tick.
 
void _Watchdog_Do_tickle (Watchdog_Header *header, Watchdog_Control *first, uint64_t now, ISR_lock_Context *lock_context)
 Calls the routine of each not expired watchdog control node.
 
void _Watchdog_Insert (Watchdog_Header *header, Watchdog_Control *the_watchdog, uint64_t expire)
 Inserts a watchdog into the set of scheduled watchdogs according to the specified expiration time.
 
void _Watchdog_Remove (Watchdog_Header *header, Watchdog_Control *the_watchdog)
 In the case the watchdog is scheduled, then it is removed from the set of scheduled watchdogs.
 

Variables

volatile Watchdog_Interval _Watchdog_Ticks_since_boot
 The watchdog ticks counter.
 
const uint32_t _Watchdog_Microseconds_per_tick
 The watchdog microseconds per tick.
 
const uint32_t _Watchdog_Nanoseconds_per_tick
 The watchdog nanoseconds per tick.
 
const uint32_t _Watchdog_Ticks_per_second
 The watchdog ticks per second.
 
const uint32_t _Watchdog_Ticks_per_timeslice
 The watchdog ticks per timeslice.
 

Detailed Description

This group contains the Watchdog Handler implementation.

This handler encapsulates functionality related to the scheduling of watchdog functions to be called at specific times in the future. It provides mechanisms which can be used to initialize and manipulate watchdog timers.

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

Macro Definition Documentation

◆ WATCHDOG_BITS_FOR_1E9_NANOSECONDS

#define WATCHDOG_BITS_FOR_1E9_NANOSECONDS   30

The bits necessary to store 1000000000 (= WATCHDOG_NANOSECONDS_PER_SECOND) nanoseconds.

The expiration time is an unsigned 64-bit integer. To store nanoseconds timeouts we use 30 bits (2**30 == 1073741824) for the nanoseconds and 34 bits for the seconds since UNIX Epoch. This leads to a year 2514 problem.

◆ WATCHDOG_INITIALIZER

#define WATCHDOG_INITIALIZER (   routine)
Value:
{ \
{ { { NULL, NULL, NULL, WATCHDOG_INACTIVE } } }, \
( routine ), \
0 \
}
@ WATCHDOG_INACTIVE
The watchdog is inactive.
Definition: watchdogimpl.h:78

Watchdog initializer for static initialization.

The processor of this watchdog is set to processor with index zero.

See also
_Watchdog_Preinitialize().

◆ WATCHDOG_MAX_SECONDS

#define WATCHDOG_MAX_SECONDS   0x3ffffffff

The maximum number of seconds representable in the nanoseconds watchdog format.

We have 2**34 bits for the seconds part.

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) (Watchdog_Control *)

Pointer to a watchdog service routine.

This type define a pointer to a watchdog service routine.

Enumeration Type Documentation

◆ Watchdog_State

Watchdog states.

Enumerator
WATCHDOG_SCHEDULED_BLACK 

The watchdog is scheduled and a black node in the red-black tree.

WATCHDOG_SCHEDULED_RED 

The watchdog is scheduled and a red node in the red-black tree.

WATCHDOG_INACTIVE 

The watchdog is inactive.

WATCHDOG_PENDING 

The watchdog is on a chain of pending watchdogs.

This state is used by the timer server for example.

Function Documentation

◆ _Watchdog_Do_tickle()

void _Watchdog_Do_tickle ( Watchdog_Header header,
Watchdog_Control first,
uint64_t  now,
ISR_lock_Context lock_context 
)

Calls the routine of each not expired watchdog control node.

Parameters
headerThe watchdog header.
firstThe first watchdog control node.
nowThe current time to check the expiration time against.
lockThe lock that is released before calling the routine and then acquired after the call.
lock_contextThe lock context for the release before calling the routine and for the acquire after.

◆ _Watchdog_Insert()

void _Watchdog_Insert ( Watchdog_Header header,
Watchdog_Control the_watchdog,
uint64_t  expire 
)

Inserts a watchdog into the set of scheduled watchdogs according to the specified expiration time.

The watchdog must be inactive.

Parameters
[in,out]headerThe set of scheduler watchdogs to insert into.
[in,out]the_watchdogThe watchdog to insert.
expireThe expiration time for the watchdog.

◆ _Watchdog_Remove()

void _Watchdog_Remove ( Watchdog_Header header,
Watchdog_Control the_watchdog 
)

In the case the watchdog is scheduled, then it is removed from the set of scheduled watchdogs.

The watchdog must be initialized before this call.

Parameters
[in,out]headerThe scheduled watchdogs.
[in,out]the_watchdogThe watchdog to remove.

◆ _Watchdog_Tick()

void _Watchdog_Tick ( struct Per_CPU_Control cpu)

Performs a watchdog tick.

Parameters
cpuThe processor for this watchdog tick.

Variable Documentation

◆ _Watchdog_Microseconds_per_tick

const uint32_t _Watchdog_Microseconds_per_tick
extern

The watchdog microseconds per tick.

This constant is defined by the application configuration via <rtems/confdefs.h>.

◆ _Watchdog_Nanoseconds_per_tick

const uint32_t _Watchdog_Nanoseconds_per_tick
extern

The watchdog nanoseconds per tick.

This constant is defined by the application configuration via <rtems/confdefs.h>.

◆ _Watchdog_Ticks_per_second

const uint32_t _Watchdog_Ticks_per_second
extern

The watchdog ticks per second.

This constant is defined by the application configuration via <rtems/confdefs.h>.

◆ _Watchdog_Ticks_per_timeslice

const uint32_t _Watchdog_Ticks_per_timeslice
extern

The watchdog ticks per timeslice.

This constant is defined by the application configuration via <rtems/confdefs.h>.

◆ _Watchdog_Ticks_since_boot

volatile Watchdog_Interval _Watchdog_Ticks_since_boot
extern

The watchdog ticks counter.

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