Any Ideas?
IRQ Handler
Code: Select all
void irq_handler(registers_t regs) {
if (regs.int_no >= 40) {
outb(0xA0, 0x20);
}
outb(0x20, 0x20);
if (__interrupt_handlers[regs.int_no] != 0) {
__isr_t handler = __interrupt_handlers[regs.int_no];
handler(regs);
}
}
Code: Select all
uint32_t ticks = 0;
void __timer_init(uint32_t freq) {
__register_interrupt_handler(IRQ0, &__timer_callback);
uint32_t divisor = 1193180 / freq;
outb(0x43, 0x36);
uint8_t l = (uint8_t) (divisor & 0xFF);
uint8_t h = (uint8_t) ((divisor >> 8) & 0xFF);
outb(0x40, l);
outb(0x40, h);
}
void __timer_callback(registers_t regs) {
ticks++;
printf("Tick\n");
}