diff options
| author | Ada Christine <adachristine18@gmail.com> | 2022-02-17 13:40:55 +0000 |
|---|---|---|
| committer | Ada Christine <adachristine18@gmail.com> | 2022-02-17 13:40:55 +0000 |
| commit | 9b63c0000b2e0d9d0a306e56dbc7bc28403e5549 (patch) | |
| tree | 17ef5aa53d37c4232f8efcca97c5f118a96fb96f /kc/core/timer.h | |
| parent | b8ef8b401d9dd1e15f2703eb997fb79a70ae531a (diff) | |
many changes have happned
- updates to panic() interface
- genericized timer interface
- (yet unused) additions to task management
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); |
