Timer IRQ only fires once.
Posted: Tue Jun 24, 2008 10:25 am
Ok, this is weird, one I've setup my timer IRQ, it only ever fires once...
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:
It's seams correct to me...
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:
Which again seems correct, if I pass anything else but 1193180 as pic frequency I only get the "Timer irq called" message, meaning it works, but it's only ever called once... Also if I pass 1193180 as PIT frequency, I get both messages, so it works fine...
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
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