[rtems commit] score: _Watchdog_Per_CPU_lazy_insert_monotonic()

Sebastian Huber sebh at rtems.org
Tue Oct 24 08:22:16 UTC 2017


Module:    rtems
Branch:    master
Commit:    57479629094a7b1a13a6fb03c3162cb53367022c
Changeset: http://git.rtems.org/rtems/commit/?id=57479629094a7b1a13a6fb03c3162cb53367022c

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Fri Oct 20 07:29:22 2017 +0200

score: _Watchdog_Per_CPU_lazy_insert_monotonic()

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 b3f396b..1fa67f3 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,



More information about the vc mailing list