5 microsecond delays in device driver - how?

Paul Slootman slootman at dri.nl
Mon Apr 8 04:35:38 AEST 1991


Hi,

I have a question concerning  the  use  of  clock  interrupts  in
device  drivers (for now, I'm restricting myself to SCO Xenix and
SCO Unix).

I have to generate a delay of around 5 to  10  microseconds  many
times.  I will have to do this by busy waiting (right?). A longer
delay is not a problem for the device, but because it has  to  be
done  thousands  (!)  of  times for each device access, I want to
keep the delay as short as possible. As a result, simply  looping
a number of times that will be sufficient for all CPU speeds etc.
is not an option.

What I was thinking about doing was using the clock interrupt  in
some  way  to  measure  how  many  times a loop could be executed
between two clock interrupts. This would  be  done  once  in  the
xxinit() function. Knowing how many loops can be done between two
clock ticks, I could figure out how often to loop to get a  delay
of a few microseconds.

I understand the system clock  is  not  yet  initialized  at  the
moment  the xxinit() functions are called. I presume I could thus
use the clock myself, to do what I described above. How can I, on
the  assumption  that what I propose would work? If not, what are
my other options?

One last note: I received a tip that there might be a function in
Unix called "tenmicrosec". How many other systems have this?  How
reliable is it?

Please email; I'll summarize to the comp.unix.internals group  if
anything interesting comes out of this.

Paul.
-- 
 =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
: slootman at dri.nl            :          Don't hit the keys so hard, :
: ...!hp4nl!dri500!slootman  :                             it hurts :
 =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=



More information about the Comp.unix.wizards mailing list