Kernel Functions for Drivers drvusecwait(9F)
NAME
drvusecwait - busy-wait for specified interval
SYNOPSIS
#include
#include
void drvusecwait(clockt microsecs);
INTERFACE LEVEL
Architecture independent level 1 (DI/DKI).
PARAMETERS
microsecs The number of microseconds to busy-wait.
DESCRIPTION
The drvusecwait() function gives 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.
delay(9F) can be used by a driver to delay for a specified
number of system ticks, but it has two limitations. First,
the granularity of the wait time is limited to one clock
tick, which may be more time than is needed for the delay.
Second, delay(9F) can be invoked from user or kernel context
and hence cannot be used at interrupt time or system ini-
tialization.
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 in user context, delay(9F)
produces too long a wait period.
CONTEXT
The drvusecwait() function can be called from user, inter-
rupt, or kernel context.
SEE ALSO
delay(9F), timeout(9F), untimeout(9F)
Writing Device Drivers
SunOS 5.11 Last change: 16 Jan 2006 1
Kernel Functions for Drivers drvusecwait(9F)
NOTES
The driver wastes processor time by making this call since
drvusecwait() does not block but simply busy-waits. The
driver should only make calls to drvusecwait() as needed,
and only for as much time as needed. The drvusecwait()
function does not mask out interrupts.
SunOS 5.11 Last change: 16 Jan 2006 2
|