[PATCH 13/16] score: _Watchdog_Per_CPU_lazy_insert_monotonic()

Sebastian Huber sebastian.huber at embedded-brains.de
Mon Oct 23 13:53:44 UTC 2017


Update #3117.
Update #3182.
---
 cpukit/score/include/rtems/score/watchdogimpl.h | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

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,
-- 
2.12.3



More information about the devel mailing list