From 57479629094a7b1a13a6fb03c3162cb53367022c Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Fri, 20 Oct 2017 07:29:22 +0200 Subject: score: _Watchdog_Per_CPU_lazy_insert_monotonic() Update #3117. Update #3182. --- cpukit/score/include/rtems/score/watchdogimpl.h | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'cpukit/score/include/rtems/score/watchdogimpl.h') diff --git a/cpukit/score/include/rtems/score/watchdogimpl.h b/cpukit/score/include/rtems/score/watchdogimpl.h index b3f396b7a3..1fa67f3961 100644 --- a/cpukit/score/include/rtems/score/watchdogimpl.h +++ b/cpukit/score/include/rtems/score/watchdogimpl.h @@ -425,6 +425,31 @@ RTEMS_INLINE_ROUTINE uint64_t _Watchdog_Per_CPU_insert_ticks( return expire; } +RTEMS_INLINE_ROUTINE bool _Watchdog_Per_CPU_lazy_insert_monotonic( + Watchdog_Control *the_watchdog, + Per_CPU_Control *cpu, + uint64_t expire +) +{ + ISR_lock_Context lock_context; + Watchdog_Header *header; + bool insert; + + header = &cpu->Watchdog.Header[ PER_CPU_WATCHDOG_MONOTONIC ]; + + _Watchdog_Set_CPU( the_watchdog, cpu ); + + _Watchdog_Per_CPU_acquire_critical( cpu, &lock_context ); + insert = ( expire > cpu->Watchdog.ticks ); + + if ( insert ) { + _Watchdog_Insert(header, the_watchdog, expire); + } + + _Watchdog_Per_CPU_release_critical( cpu, &lock_context ); + return insert; +} + RTEMS_INLINE_ROUTINE uint64_t _Watchdog_Per_CPU_insert_realtime( Watchdog_Control *the_watchdog, Per_CPU_Control *cpu, -- cgit v1.2.3