#pragma once

#include "libs/types.h"

typedef u32 (*task_func)(void);

typedef struct _task {
	u64 time;
	struct _task *next;
	u32 (*handler)(void);
} task_t;

typedef struct _timer {
	u64 time;
	struct _timer *prev;
	struct _timer *next;
	void (*handler)(struct _timer *timer);
} timer_t;

#define MAX_TASK 8
u64 get_mseconds(void);
u32 get_seconds(void);
void timer_post(timer_t *timer, u32 delay);
void timer_cancel(timer_t *timer);
void task_add(task_t *task);
void task_run(void);
void task_udelay(u32 delay);
task_t *task_start(task_func func, u32 delay);
