xref: /aosp_15_r20/external/coreboot/tests/stubs/timestamp.c (revision b9411a12aaaa7e1e6a6fb7c5e057f44ee179a49c)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #include "stubs/timestamp.h"
4 
5 static uint64_t timestamp_value = 0;
6 static int timestamp_tick_freq_mhz_value = 1;
7 
8 /* Provides way to control timestamp value */
dummy_timestamp_set(uint64_t v)9 void dummy_timestamp_set(uint64_t v)
10 {
11 	timestamp_value = v;
12 }
13 
14 /* Provides way to control timestamp tick frequency MHz value */
dummy_timestamp_tick_freq_mhz_set(int v)15 void dummy_timestamp_tick_freq_mhz_set(int v)
16 {
17 	timestamp_tick_freq_mhz_value = v;
18 }
19 
20 /* Reimplementation of timestamp getter to control behaviour */
timestamp_get(void)21 uint64_t timestamp_get(void)
22 {
23 	return timestamp_value;
24 }
25 
timestamp_tick_freq_mhz(void)26 int timestamp_tick_freq_mhz(void)
27 {
28 	return timestamp_tick_freq_mhz_value;
29 }
30