feat: implement basic timer

This commit is contained in:
Liam Kerr 2026-05-01 23:14:44 +01:00
parent f76ca1ee31
commit ebdd572f8e
6 changed files with 83 additions and 4 deletions

23
src/kernel/timer.h Normal file
View file

@ -0,0 +1,23 @@
#ifndef TIMER_H
#define TIMER_H
#include <stdint.h>
extern _Atomic uint64_t sys_ticks;
extern const uint64_t tick_delta;
// Initialize timer (1ms ticks)
void timer_init();
// Increment the system tick counter
void timer_tick();
// Get current time in milliseconds
uint64_t timer_get_ms();
// Delay for 'ms' milliseconds (blocking)
void delay_ms(uint64_t ms);
// Sleep for 'ms' milliseconds (non-blocking, if possible)
void sleep_ms(uint64_t ms);
#endif