PIT/HPET without interrupts?
Posted: Fri Jun 27, 2008 9:52 pm
I've been looking over some of the datasheets for both the PIT and the HPET and I can not figure out how to initialise a timer frequency and (without interrupts) read back a time later one after the clock has been running. What I would like to do is to get a timer to run and then be able to poll the chip for the amount of time passed since start. The only way I know how to and I could find in google was to use an IRQ to update variables and ACk the IRQ, but I would like to do this without any interrupts.
Possible? I think so.
Documented? Who knows.
btw: I tried to implement a PIT routine that setup the PIT like so:
but that doesnt work, and it actually locks up my OS.
Possible? I think so.
Documented? Who knows.
btw: I tried to implement a PIT routine that setup the PIT like so:
Code: Select all
outportb(0x43, 0x56); // load the control byte
outportb(0x42, 1); // load very fast divisor
//////////////////////////////
outportb(0x43, 0x80); // counter latch command
unsigned short time_start;
time_start = inportb(0x42) & 0xFF;
time_start += ((inportb(0x42) << 8) & 0xFF00);
/*
---------DO LOTS OF STUFF--------
*/
outportb(0x43, 0x80); // counter latch command
unsigned short time_end;
time_end= inportb(0x42) & 0xFF;
time_end += ((inportb(0x42) << 8) & 0xFF00);
printf("time elapsed: %u \n", time_end - time_start);
but that doesnt work, and it actually locks up my OS.