'\"macro stdmacro
.if n .pH ddi_dki.drv_usecwait @(#)drv_usecwait	40.5 of 10/10/89
.\" Copyright 1989 AT&T
.de IX
.ie '\\n(.z'' .tm .Index: \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9	\\n%
.el \\!.IX \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
..
.nr X
.if \nX=0 .ds x} drv_usecwait D3DK "" "DDI/DKI" "\&"
.if \nX=1 .ds x} drv_usecwait D3DK "" "DDI/DKI"
.if \nX=2 .ds x} drv_usecwait D3DK "" "\&"
.if \nX=3 .ds x} drv_usecwait "" "" "\&"
.TH \*(x}
.IX "\f4drv_usecwait\fP(D3DK)"
.SH NAME
\f4drv_usecwait\f1 \- busy-wait for specified interval
.SH SYNOPSIS
.nf
.na
\f4#include <sys/types.h>
#include <sys/ddi.h>

.sp 0.5
void drv_usecwait(clock_t \f2microsecs\f4);\f1
.ad
.fi
.SH ARGUMENT
.RS 0n 10
.IP "\f2microsecs\f1" 10n
The number of microseconds to busy-wait.
.RE
.SH DESCRIPTION
The kernel function \f4delay\f1(D3DK) can be used by a driver to delay for a
specified number of system ticks (given by parameter \f4HZ\f1 in
\f4sys/param.h\f1, which indicates how many system ticks occur
per second).  There are two limitations: (1) the granularity of the
wait time is limited to \f41/HZ\f1 second, which may be more time
than is needed for the delay, and (2) \f4delay\f1(D3DK) may only be
invoked with user context and hence cannot be used at interrupt time
or system initialization.
.P
Often, drivers need to delay for only a few microseconds, waiting for
a write to a device register to be picked up by the device. In this
case, even with user context, \f4delay\f1(D3DK) produces too long a wait
period. The function \f4drv_usecwait\f1 is provided to give drivers 
a means of busy-waiting for a specified microsecond count. The amount
of time spent busy-waiting may be greater than the microsecond count
but will minimally be the number of microseconds specified.
.P
Note that the driver wastes processor time by making this call since
\f4drv_usecwait\f1 does not invoke sleep 
but simply busy-waits. The driver should only
make calls to \f4drv_usecwait\f1 as needed, and only for as much time as
needed.  \f4drv_usecwait\f1 does not raise the processor interrupt level;
if the driver wishes to mask out interrupts, it is its
responsibility to set the priority level before the call and restore
it to its original value afterward.
.SH RETURN VALUE
None 
.SH LEVEL
Base or Interrupt
.SH SEE ALSO
.na
\f4delay\f1(D3DK),
\f4timeout\f1(D3DK),
\f4untimeout\f1(D3DK)
.ad
