Espresso 0.0.0e
This commit is contained in:
21
drivers/timer.c
Normal file
21
drivers/timer.c
Normal file
@ -0,0 +1,21 @@
|
||||
/*#include <drivers/isr.h>
|
||||
#include <drivers/irq.h>
|
||||
|
||||
#include <drivers/timer.h>
|
||||
|
||||
volatile uint32_t tick_count = 0;
|
||||
|
||||
void irq0_handler(regs_t* regs)
|
||||
{
|
||||
tick_count++;
|
||||
}
|
||||
|
||||
void timer_sleep(uint32_t ms)
|
||||
{
|
||||
uint32_t target = tick_count + ms;
|
||||
while (tick_count < target)
|
||||
{
|
||||
asm volatile("hlt");
|
||||
}
|
||||
}
|
||||
*/
|
Reference in New Issue
Block a user