Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!swrinde!cs.utexas.edu!sun-barr!lll-winken!cert!netnews.upenn.edu!aurora.cis.upenn.edu!massa From: massa@aurora.cis.upenn.edu (Mike Massa) Newsgroups: comp.unix.aix Subject: Re: Hard delays in device drivers Keywords: delay Message-ID: <43210@netnews.upenn.edu> Date: 16 May 91 02:10:31 GMT References: <5393@atexnet.Atex.Kodak.COM> Sender: news@netnews.upenn.edu Organization: University of Pennsylvania Lines: 23 Nntp-Posting-Host: aurora.cis.upenn.edu In article <5393@atexnet.Atex.Kodak.COM> kjl@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