RTEMS
5.0.0
|
Files | |
file | watchdog.h |
Constants and Structures Associated with Watchdog Timers. | |
file | watchdogticks.h |
file | watchdoginsert.c |
Watchdog Insert. | |
file | watchdogremove.c |
Remove Watchdog. | |
file | watchdogtickssinceboot.c |
Watchdog Ticks Since Boot. | |
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. More... | |
#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. More... | |
#define | WATCHDOG_MAX_SECONDS 0x3ffffffff |
The maximum number of seconds representable in the nanoseconds watchdog format. More... | |
#define | WATCHDOG_NO_TIMEOUT 0 |
Special watchdog ticks value to indicate an infinite wait. | |
Typedefs | |
typedef struct Watchdog_Control | Watchdog_Control |
typedef void | Watchdog_Service_routine |
Return type from a Watchdog Service Routine. More... | |
typedef Watchdog_Service_routine(* | Watchdog_Service_routine_entry) (Watchdog_Control *) |
Pointer to a watchdog service routine. More... | |
typedef uint32_t | Watchdog_Interval |
Type is used to specify the length of intervals. More... | |
Enumerations | |
enum | Watchdog_State { WATCHDOG_SCHEDULED_BLACK, WATCHDOG_SCHEDULED_RED, WATCHDOG_INACTIVE, WATCHDOG_PENDING } |
Watchdog states. More... | |
Functions | |
RTEMS_INLINE_ROUTINE void | _Watchdog_Header_initialize (Watchdog_Header *header) |
RTEMS_INLINE_ROUTINE Watchdog_Control * | _Watchdog_Header_first (const Watchdog_Header *header) |
RTEMS_INLINE_ROUTINE void | _Watchdog_Header_destroy (Watchdog_Header *header) |
void | _Watchdog_Tick (struct Per_CPU_Control *cpu) |
Performs a watchdog tick. More... | |
RTEMS_INLINE_ROUTINE Watchdog_State | _Watchdog_Get_state (const Watchdog_Control *the_watchdog) |
RTEMS_INLINE_ROUTINE void | _Watchdog_Set_state (Watchdog_Control *the_watchdog, Watchdog_State state) |
RTEMS_INLINE_ROUTINE Per_CPU_Control * | _Watchdog_Get_CPU (const Watchdog_Control *the_watchdog) |
RTEMS_INLINE_ROUTINE void | _Watchdog_Set_CPU (Watchdog_Control *the_watchdog, Per_CPU_Control *cpu) |
RTEMS_INLINE_ROUTINE void | _Watchdog_Preinitialize (Watchdog_Control *the_watchdog, Per_CPU_Control *cpu) |
Pre-initializes a watchdog. More... | |
RTEMS_INLINE_ROUTINE void | _Watchdog_Initialize (Watchdog_Control *the_watchdog, Watchdog_Service_routine_entry routine) |
Initializes a watchdog with a new service routine. More... | |
void | _Watchdog_Do_tickle (Watchdog_Header *header, Watchdog_Control *first, uint64_t now, ISR_lock_Context *lock_context) |
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. More... | |
void | _Watchdog_Remove (Watchdog_Header *header, Watchdog_Control *the_watchdog) |
In case the watchdog is scheduled, then it is removed from the set of scheduled watchdogs. More... | |
RTEMS_INLINE_ROUTINE uint64_t | _Watchdog_Cancel (Watchdog_Header *header, Watchdog_Control *the_watchdog, uint64_t now) |
In case the watchdog is scheduled, then it is removed from the set of scheduled watchdogs. More... | |
RTEMS_INLINE_ROUTINE bool | _Watchdog_Is_scheduled (const Watchdog_Control *the_watchdog) |
RTEMS_INLINE_ROUTINE void | _Watchdog_Next_first (Watchdog_Header *header, Watchdog_Control *the_watchdog) |
RTEMS_INLINE_ROUTINE bool | _Watchdog_Is_valid_timespec (const struct timespec *ts) |
RTEMS_INLINE_ROUTINE bool | _Watchdog_Is_valid_interval_timespec (const struct timespec *ts) |
RTEMS_INLINE_ROUTINE const struct timespec * | _Watchdog_Future_timespec (struct timespec *now, const struct timespec *delta) |
RTEMS_INLINE_ROUTINE bool | _Watchdog_Is_far_future_timespec (const struct timespec *ts) |
RTEMS_INLINE_ROUTINE uint64_t | _Watchdog_Ticks_from_seconds (uint32_t seconds) |
RTEMS_INLINE_ROUTINE uint64_t | _Watchdog_Ticks_from_timespec (const struct timespec *ts) |
RTEMS_INLINE_ROUTINE uint64_t | _Watchdog_Ticks_from_sbintime (int64_t sbt) |
RTEMS_INLINE_ROUTINE void | _Watchdog_Per_CPU_acquire_critical (Per_CPU_Control *cpu, ISR_lock_Context *lock_context) |
RTEMS_INLINE_ROUTINE void | _Watchdog_Per_CPU_release_critical (Per_CPU_Control *cpu, ISR_lock_Context *lock_context) |
RTEMS_INLINE_ROUTINE uint64_t | _Watchdog_Per_CPU_insert_ticks (Watchdog_Control *the_watchdog, Per_CPU_Control *cpu, Watchdog_Interval ticks) |
RTEMS_INLINE_ROUTINE uint64_t | _Watchdog_Per_CPU_insert (Watchdog_Control *the_watchdog, Per_CPU_Control *cpu, Watchdog_Header *header, uint64_t expire) |
RTEMS_INLINE_ROUTINE void | _Watchdog_Per_CPU_remove (Watchdog_Control *the_watchdog, Per_CPU_Control *cpu, Watchdog_Header *header) |
RTEMS_INLINE_ROUTINE void | _Watchdog_Per_CPU_remove_ticks (Watchdog_Control *the_watchdog) |
Variables | |
volatile Watchdog_Interval | _Watchdog_Ticks_since_boot |
The watchdog ticks counter. More... | |
const uint32_t | _Watchdog_Nanoseconds_per_tick |
The watchdog nanoseconds per tick. More... | |
const uint32_t | _Watchdog_Ticks_per_second |
The watchdog ticks per second. More... | |
This handler encapsulates functionality related to the scheduling of watchdog functions to be called at specific times in the future.
#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.
#define WATCHDOG_INITIALIZER | ( | routine | ) |
Watchdog initializer for static initialization.
The processor of this watchdog is set to processor with index zero.
#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 uint32_t Watchdog_Interval |
Type is used to specify the length of intervals.
This type is used to specify the length of intervals.
typedef void Watchdog_Service_routine |
Return type from a Watchdog Service Routine.
This type defines the return type from a Watchdog Service Routine.
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.
enum Watchdog_State |
Watchdog states.
RTEMS_INLINE_ROUTINE uint64_t _Watchdog_Cancel | ( | Watchdog_Header * | header, |
Watchdog_Control * | the_watchdog, | ||
uint64_t | now | ||
) |
In case the watchdog is scheduled, then it is removed from the set of scheduled watchdogs.
The watchdog must be initialized before this call.
0 | The now time is greater than or equal to the expiration time of the watchdog. |
other | The difference of the now and expiration time. |
RTEMS_INLINE_ROUTINE void _Watchdog_Initialize | ( | Watchdog_Control * | the_watchdog, |
Watchdog_Service_routine_entry | routine | ||
) |
Initializes a watchdog with a new service routine.
The watchdog must be inactive.
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.
RTEMS_INLINE_ROUTINE void _Watchdog_Preinitialize | ( | Watchdog_Control * | the_watchdog, |
Per_CPU_Control * | cpu | ||
) |
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().
[in] | the_watchdog | The uninitialized watchdog. |
void _Watchdog_Remove | ( | Watchdog_Header * | header, |
Watchdog_Control * | the_watchdog | ||
) |
In case the watchdog is scheduled, then it is removed from the set of scheduled watchdogs.
The watchdog must be initialized before this call.
void _Watchdog_Tick | ( | struct Per_CPU_Control * | cpu | ) |
Performs a watchdog tick.
cpu | The processor for this watchdog tick. |
const uint32_t _Watchdog_Nanoseconds_per_tick |
The watchdog nanoseconds per tick.
This constant is defined by the application configuration via <rtems/confdefs.h>.
const uint32_t _Watchdog_Ticks_per_second |
The watchdog ticks per second.
This constant is defined by the application configuration via <rtems/confdefs.h>.
volatile Watchdog_Interval _Watchdog_Ticks_since_boot |
The watchdog ticks counter.
With a 1ms watchdog tick, this counter overflows after 50 days since boot.