Device Driver Interfaces
|
|
Device drivers allow user programs and the kernel to communicate with a system's devices. Drivers provide high-level abstractions to user applications while handling the low-level device-specific I/O and interrupts. Drivers are frequently called the 'translators' between programs and devices.
There are thousands of devices in existence. One shouldn't expect the kernel to contain the code to support them all. If the kernel provides the necessary interface to device drivers, they can be written for new devices without having to recompile the entire kernel, or worse: rewriting most of the kernel.
Contents |
Device Driver Interfaces
Design
|
|
Interface provided by the kernel for a device driver
The kernel must provide an interface for IPC and reserving/releasing system resources. Because drivers may compete for resources with each other at times, proper synchronization may be needed, depending on the interface. There should also be a way to register drivers and their devices so that the kernel and other drivers know what exists in the system.
I/O
- memory maps (address ranges)
- I/O ports
- IRQs
- DMA addresses
IPC
- send/receive/forward driver requests
Modules (optional)
- loading/unloading
- querying
Device Registrar
- registration
- querying
Uniform Driver Interface
- Main article: Uniform Driver Interface
Project UDI is a driver interface intended to be binary portable or source portable when running on different CPU architectures. It is not very widespread (however, neither are EDI or CDI); for example, due to philosophical concerns, Linux did not embrace UDI. However, several members of the community are striving to popularize UDI again since it would be of a huge benefit to hobby operating systems. You are strongly encouraged to participate by implenting a UDI environment and writing drivers.
Extensible Driver Interface
- Main article: Extensible Driver Interface
EDI is a driver interface intended to be source code portable and fairly simple in implementation (also, limited in functionality), so that hobby small hobby OSes may share driver code base.
Interface for communicating with a device driver
The way a program which needs access to a device uses to communicate with the device driver. Devices may be represented as elements in a file namespace (Linux), object namespace, or a namespace dedicated for devices (Windows NT).
Interface provided by the device driver
The interface provided by the driver allowing the rest of the system access device it manages. It may consist of a protocol of ioctl() calls to the device file.
