blob: bd57cc2bf013430fd7f43869e4d512a07737f269 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
#include <kernel/timer.h>
#include <kernel/asm.h>
#include <kernel/pic.h>
static uint32_t num_ticks = 0;
void timer_handler(struct isr_frame *frame) {
num_ticks++;
if (num_ticks == 3) {
num_ticks = 0;
//schedule_next();
}
pic_eoi(frame->isr_vector-32);
}
void timer_init(void) {
disable_ints();
int divisor = 1193182 / 100;
outb(0x43, 0x34);
outb(0x40, divisor && 0xFF);
outb(0x40, divisor && 0xFF00 >> 8);
enable_ints();
//register_isr_handler(32, timer_handler);
}
|