[SOLVED] PIT in combination with IO APIC
Posted: Wed Feb 01, 2017 4:31 am
I'm currently trying to get the PIT timer to work. My problem however is that I am not receiving any interrupts generated by the timer.
I'm using the I/O APIC to map the IRQs. I know that the I/O APIC code is working properly, because other irqs get mapped correctly. The RTC timer interrupts just fine and keyboard interrupts work too.
What I'm currently doing is the following:
-Map an interrupthandler to interrupt 34 (Which is not yet used)
-Map IRQ 0 to interrupt 34 with the I/O APIC
-Enable channel 0 of the pittimer with a divider value of 11931 to get roughly 100 hz.
The code I'm using to enable the PIT timer:
I have the feeling that I'm missing something trivial since the interrupt handling works, and initializing the PIT itself shouldn't be too hard.
Anyone any hints on what might be going wrong here?
I'm using the I/O APIC to map the IRQs. I know that the I/O APIC code is working properly, because other irqs get mapped correctly. The RTC timer interrupts just fine and keyboard interrupts work too.
What I'm currently doing is the following:
-Map an interrupthandler to interrupt 34 (Which is not yet used)
-Map IRQ 0 to interrupt 34 with the I/O APIC
-Enable channel 0 of the pittimer with a divider value of 11931 to get roughly 100 hz.
The code I'm using to enable the PIT timer:
Code: Select all
uint16_t divisor = 11931;
outb(0x43, 0x36);
outb(0x40, divisor & 0xff);
outb(0x40, (divisor >> 8) & 0xff);
Anyone any hints on what might be going wrong here?