kernel: add standard clock system

This commit is contained in:
2023-04-28 20:51:51 +01:00
parent 995e364b21
commit 72d8facd47
5 changed files with 123 additions and 35 deletions

27
include/socks/clock.h Normal file
View File

@@ -0,0 +1,27 @@
#ifndef SOCKS_CLOCK_H_
#define SOCKS_CLOCK_H_
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
#define HZ (clock_hz())
typedef uint64_t clock_ticks_t;
extern volatile clock_ticks_t clock_ticks;
extern clock_ticks_t clock_hz(void);
extern void clock_calibrate(clock_ticks_t hz);
extern void clock_advance(clock_ticks_t ticks);
extern void clock_wait(clock_ticks_t ticks);
#ifdef __cplusplus
}
#endif
#endif