summaryrefslogtreecommitdiffstats
path: root/cpukit/score/include/rtems/score/timecounter.h
diff options
context:
space:
mode:
Diffstat (limited to 'cpukit/score/include/rtems/score/timecounter.h')
-rw-r--r--cpukit/score/include/rtems/score/timecounter.h27
1 files changed, 25 insertions, 2 deletions
diff --git a/cpukit/score/include/rtems/score/timecounter.h b/cpukit/score/include/rtems/score/timecounter.h
index 0d17cc7ce3..33de269ec8 100644
--- a/cpukit/score/include/rtems/score/timecounter.h
+++ b/cpukit/score/include/rtems/score/timecounter.h
@@ -26,6 +26,8 @@
#include <sys/time.h>
#include <sys/timetc.h>
+#include <rtems/score/isrlock.h>
+
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
@@ -161,6 +163,21 @@ void _Timecounter_Install( struct timecounter *tc );
void _Timecounter_Tick( void );
/**
+ * @brief Lock to protect the timecounter mechanic.
+ */
+ISR_LOCK_DECLARE( extern, _Timecounter_Lock )
+
+/**
+ * @brief Acquires the timecounter lock.
+ *
+ * @param[in] lock_context The lock context.
+ *
+ * See _Timecounter_Tick_simple().
+ */
+#define _Timecounter_Acquire( lock_context ) \
+ _ISR_lock_ISR_disable_and_acquire( &_Timecounter_Lock, lock_context )
+
+/**
* @brief Performs a simple timecounter tick.
*
* This is a special purpose tick function for simple timecounter to support
@@ -169,8 +186,14 @@ void _Timecounter_Tick( void );
* @param[in] delta The time in timecounter ticks elapsed since the last call
* to _Timecounter_Tick_simple().
* @param[in] offset The current value of the timecounter.
- */
-void _Timecounter_Tick_simple( uint32_t delta, uint32_t offset );
+ * @param[in] lock_context The lock context of the corresponding
+ * _Timecounter_Acquire().
+ */
+void _Timecounter_Tick_simple(
+ uint32_t delta,
+ uint32_t offset,
+ ISR_lock_Context *lock_context
+);
/**
* @brief The wall clock time in seconds.