IRQ0 ? How would I setup the clock?
IRQ0 ? How would I setup the clock?
I have read a lot about the IRQ0 but how would I actually go about setting it up in C? I have pretty lost with that right now, i've viewed other peoples but it doesn't really just answer, how can i get a simple clock, like that just counts seconds, no hours, etc?
Re:IRQ0 ? How would I setup the clock?
Set up your IDT. Write some assembly code which will save registers, call a C function, then restore registers. Write a handler for IRQ 0 which looks like:
There are examples elsewhere of how to set up an IDT, write interrupt wrapper routines, and change the clock rate.
Code: Select all
void irq0_handler(void)
{
elapsed_ticks++;
}
unsigned get_system_uptime(void)
{
// assumes default rate of 18.2 Hz (91/5 = 18.2)
return (elapsed_ticks * 5) / 91;
}
Re:IRQ0 ? How would I setup the clock?
oh it does....( I think by now I should Remember to read better )