Hard delays in device drivers
Mike Massa
massa at aurora.cis.upenn.edu
Thu May 16 12:10:31 AEST 1991
In article <5393 at atexnet.Atex.Kodak.COM> kjl at atex.kodak.com writes:
>O.K. - I'm doing my first device driver for the RS/6000. I'm trying
>to find out how to insert a time delay for a few microseconds into my
>device initialization routine. On SunOS (*shudder*) there's a
>"DELAY()" macro which does this. Does anybody out there know how to
>accomplish the same thing for AIX?
>
The delay() kernel service will suspend a process for some number of timer
ticks (resolution = 0.01 sec). If you need finer resolution, you could
start a timer with tstart(), put the process to sleep with e_sleep(),
and have the timeout handler function call e_wakeup() to restart your process
and then exit. You specify the timeout time in nanoseconds with tstart(),
although I don't know what the resolution is. Quite frankly, the latter is an
awful lot of work if you can afford to wait a hundreth of a second. If you do
use tstart() look closely at the timerbuf structure, the argument to the
timeout handler is a *timerbuf_t, not the argument you specify in the
timerbuf.
--
Mike Massa
University of Pennsylvania
Distributed Systems Laboratory
More information about the Comp.unix.aix
mailing list