Information Technology Reference
In-Depth Information
operating system. The kernel invokes the func-
tions exported by a driver to requests its services.
Similarly, a driver invokes functions imported
from the kernel to request its services. For ex-
ample, Figure 1(a) shows the kernel calling into a
sound-card driver to play a tone; in response, the
sound driver converts the request into a sequence
of I/O instructions that direct the sound card to
emit a sound.
In addition to processing I/O requests, drivers
also handle configuration requests. Configura-
tion requests can change both driver and device
behavior for future I/O requests. As examples,
applications may configure the bandwidth of a
network card or the volume of a sound card.
In practice, most device drivers are members
of a class , which is defined by its interface. Code
that can invoke one driver in the class can invoke
any driver in the class. For example, all network
drivers obey the same kernel-driver interface, and
all sound-card drivers obey the same kernel-driver
interface, so no new kernel or application code is
needed to invoke new drivers in these classes. This
class orientation allows the OS and applications to
be device-independent, as the details of a specific
device are hidden from view in the driver.
In Linux, there are approximately 20 common
classes of drivers. However, not all drivers fit into
classes; a driver may extend the interface for a class
with proprietary functions, in effect creating a new
sub-class of drivers. Drivers may also define their
own semantics for standard interface functions,
known only to applications written specifically for
the driver. In this case, the driver is in a class by
itself. In practice, most common drivers, such as
network, sound, and storage drivers, implement
only the standard interfaces.
Device drivers are either request-oriented or
connection-oriented . Request-oriented drivers,
such as network drivers and block storage driv-
Figure 1. (a) a sound device driver, showing the common interface to the kernel and to all sound drivers,
(b) states of a network driver and sound driver
Search WWH ::




Custom Search