mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-10-27 20:58:22 +00:00
timers: use DPCs to handle callbacks
This commit is contained in:
@@ -5,13 +5,15 @@
|
||||
#include <arch/context.h>
|
||||
#include <spinlock.h>
|
||||
#include <stdbool.h>
|
||||
#include <kernel/dpc.h>
|
||||
|
||||
typedef struct timerentry_t {
|
||||
struct timerentry_t *next;
|
||||
time_t absolutetick;
|
||||
time_t repeatus;
|
||||
void *private;
|
||||
void (*func)(void *private, context_t* context);
|
||||
dpcfn_t fn;
|
||||
dpcarg_t arg;
|
||||
dpc_t dpc;
|
||||
} timerentry_t;
|
||||
|
||||
typedef struct {
|
||||
@@ -23,10 +25,11 @@ typedef struct {
|
||||
time_t (*stop)();
|
||||
timerentry_t *queue;
|
||||
} timer_t;
|
||||
|
||||
void timer_resume(timer_t *timer);
|
||||
void timer_stop(timer_t *timer);
|
||||
void timer_isr(timer_t *timer, context_t *context);
|
||||
void timer_insert(timer_t *timer, timerentry_t *entry, time_t us);
|
||||
void timer_insert(timer_t *timer, timerentry_t *entry, dpcfn_t fn, dpcarg_t arg, time_t us, bool repeating);
|
||||
timer_t *timer_new(time_t ticksperus, void (*arm)(time_t), time_t (*stop)());
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user