Specifications
Understanding the Kernel Environmen
t
9-19
sor. Only interrupt requests at level 4 or higher are presented to the processor. All other
requests are ignored until the same processor lowers the interrupt level. A device driver
can be programmed to temporarily raise the processor Interrupt Priority Level (IPL) to
block undesirable interrupts. Thereafter, the driver lowers the processor’s IPL to its previ-
ous level.
The processor priority level adjustment functions are as follows (see spl(D3)):
splbase Block no interrupts to the processor (same as spl0)
spltimeout Block functions scheduled by itimeout and dtimeout
(see “Timing and Timeout Routines” for an explanation of
these routines)
spldisk Block disk device interrupts
splstr Block STREAMS interrupts
spltty Used by a TTY driver to protect critical code—spltty is
mapped to splstr
splhi Block all hardware interrupts, including the clock—should
be used sparingly
spln Block all interrupts at or below the value of n, where n
ranges from 0 to 8
spl0 Equivalent to splbase
spl8 Equivalent to splhi
splx Restore the processor’s interrupt priority level
Timing and Timeout Routines 9
The kernel provides the following timing and timeout routines for timing and timeout pur-
poses:
timeout(D3) Execute a function after a specified length of time
itimeout(D3) Execute a function after a specified length of time
dtimeout(D3) Execute a function on a specified processor at a specified
interrupt priority level after a specified length of time
untimeout(D3) Cancel previous timeout request
timeout(func, arg, interval) can be used in a character device driver in which interrupts
cannot be used to acknowledge a device operation or signal an event. It can be used as an
alternative to a busy wait to schedule a function after a reasonable amount of time. After
receiving a RESET ioctl command, a driver can schedule the completion of the reset
operation by scheduling a routine to do so after one second.