Driver section separation
This commit is contained in:
21
src/drivers/timer.c
Normal file
21
src/drivers/timer.c
Normal file
@@ -0,0 +1,21 @@
|
||||
#include "../kernel/system.h"
|
||||
#include "../libc/stdio.h"
|
||||
|
||||
volatile unsigned long global_ticks = 0;
|
||||
|
||||
void timer_handler()
|
||||
{
|
||||
global_ticks++;
|
||||
}
|
||||
|
||||
void timer_install()
|
||||
{
|
||||
irq_install_handler(0, timer_handler);
|
||||
}
|
||||
|
||||
void delay(int ticks)
|
||||
{
|
||||
unsigned long eticks;
|
||||
eticks = global_ticks + ticks;
|
||||
while (global_ticks < eticks);
|
||||
}
|
||||
Reference in New Issue
Block a user