summaryrefslogtreecommitdiff
path: root/tests/stubs/timestamp.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/stubs/timestamp.c')
-rw-r--r--tests/stubs/timestamp.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/stubs/timestamp.c b/tests/stubs/timestamp.c
new file mode 100644
index 0000000000..3fd739f6f5
--- /dev/null
+++ b/tests/stubs/timestamp.c
@@ -0,0 +1,29 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#include "stubs/timestamp.h"
+
+static uint64_t timestamp_value = 0;
+static int timestamp_tick_freq_mhz_value = 1;
+
+/* Provides way to control timestamp value */
+void dummy_timestamp_set(uint64_t v)
+{
+ timestamp_value = v;
+}
+
+/* Provides way to control timestamp tick frequency MHz value */
+void dummy_timestamp_tick_freq_mhz_set(int v)
+{
+ timestamp_tick_freq_mhz_value = v;
+}
+
+/* Reimplementation of timestamp getter to control behaviour */
+uint64_t timestamp_get(void)
+{
+ return timestamp_value;
+}
+
+int timestamp_tick_freq_mhz(void)
+{
+ return timestamp_tick_freq_mhz_value;
+}