1/* @title: TSC */
2#pragma once
3#include <stdbool.h>
4#include <stdint.h>
5#include <types/types.h>
6
7struct tsc_globals {
8 bool use_tsc;
9 int64_t max_warp;
10 uint64_t min_rtt;
11};
12
13extern struct tsc_globals tsc_global;
14
15struct clock *tsc_clock_init(freq_hz_t freq_hz);
16freq_hz_t tsc_calibrate_hpet(void);
17bool tsc_sync_check_bsp(cpu_id_t ap_cpu);
18void tsc_sync_check_ap(cpu_id_t self);
19void tsc_sync_check_all_aps(void);
20bool tsc_should_use_tsc(void);
21bool tsc_has_invariant(void);
22uint64_t tsc_clock_read(struct clock *clk);
23