I've checked everything I can think of, I've passed the correct divisor to the pit, interrupts are enabled, I've synced the timer to real time in bochs...
I've tried everything that I can think of, but I still can't figure it out...
Here's the code I use to adjust the PIT frequency:
Code: Select all
void adjust_timer(int hz)
{
int div = 1193180 / hz;
outportb(0x43, 0x36);
outportb(0x40, div & 0xFF);
outportb(0x40, div >> 8);
current_pit_frequency = hz;
return;
};
In main I pass 1193180 to this function so that the PIT fire once a second.... (I've tried a few other values to just in case....)
And here is my handler code:
Code: Select all
void timer_handler()
{
ticks++;
k_printf("\nTimer irq called", 0x07);
if ((ticks % (1193180 / current_pit_frequency)) == 0)
{
k_printf("\nOne second has passed", 0x04);
};
};
I've checked everything that I can think of...., I can't think of anything.
Any suggestions as to what's wrong?
Thanks in advance,
Jules