From 21bcfa6b707403a43ea8ac4a285114951cf29059 Mon Sep 17 00:00:00 2001 From: Ada Christine Date: Fri, 18 Feb 2022 17:24:17 +0000 Subject: timer callback interface --- kc/core/timer.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'kc/core/timer.h') diff --git a/kc/core/timer.h b/kc/core/timer.h index 6960a4b..b41aa35 100644 --- a/kc/core/timer.h +++ b/kc/core/timer.h @@ -5,6 +5,14 @@ #define TIMER_MICROSECOND 1000000ULL #define TIMER_NANOSECOND 1000000000ULL +typedef int (*timer_callback)(uint64_t nanoseconds); + +struct timer_callback_list +{ + timer_callback func; + struct timer_callback_list *next; +}; + struct timer_source { const char *name; @@ -15,6 +23,9 @@ struct timer_source void (*set_frequency)(uint32_t frequency); uint32_t (*get_frequency)(void); + int (*append_callback)(timer_callback func); + void (*delete_callback)(timer_callback func); + uint64_t (*nanoseconds_elapsed)(void); uint64_t (*nanoseconds_delta)(void); }; -- cgit v1.3.1-1-g115d