[Prev][Next][Index][Thread]

Re: RTC instead of PIT (on x86)



> From: Simon Nieuviarts <snieuvia@ensisun.imag.fr>
> Subject: RTC instead of PIT (on x86)
> 
> I have already read somewhere (certainly Linux) that the RTC could be used
> instead of the PIT to do programmable interrupts. Is it possible in OSKit
> to replace the use of the PIT by the use of the RTC ? I would like the
> network drivers and libraries to work without using the PIT. It would
> leave this timer freely programmable by client applications of our kernel.

Sure, this should mostly work. I'm not entirely sure what you are trying to
do, but that aside, take a look at oskit/dev/arm32/timer.c and rtclock.c.
You will notice that the DNARD oskit port does exactly this; uses the RTC
instead of the PIT for the periodic timer. You can find more oskit code
that programs the RTC in oskit/kern/x86/pc/profil.c.

Note that the RTC runs at power of 2 steps, so you cannot easily get a 100
ticks per second clock like you can with the PIT. I did not address this
problem correctly in the DNARD code, so we don't keep exact time. To get
exact time, you will need to make a few minor changes ...

Lbs

---------------------------------------------------------------------------
Leigh B. Stoller                     Computer Science - Flux Research Group
stoller@cs.utah.edu                  University of Utah
http://www.cs.utah.edu/~stoller      Salt Lake City, Utah 84112
---------------------------------------------------------------------------