diff options
Diffstat (limited to 'kc/core/timer.h')
| -rw-r--r-- | kc/core/timer.h | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/kc/core/timer.h b/kc/core/timer.h index 702d7b6..b70cd70 100644 --- a/kc/core/timer.h +++ b/kc/core/timer.h @@ -1,6 +1,25 @@ #pragma once #include <stdint.h> -uint64_t timer_ticks(void); +#define TIMER_MILLISECOND 1000ULL +#define TIMER_MICROSECOND 1000000ULL +#define TIMER_NANOSECOND 1000000000ULL + +struct timer_source +{ + const char *name; + void (*init)(void); + void (*start)(void); + void (*stop)(void); + + void (*set_frequency)(uint32_t frequency); + uint32_t (*get_frequency)(void); + uint64_t (*nanoseconds_elapsed)(void); + uint64_t (*nanoseconds_delta)(void); +}; + +uint64_t timer_ticks(void); +void timer_sleep(uint64_t usec); +void timer_sleep_until(uint64_t ticks); |
