All Topics  
Device driver

 
Device Driver

   Email Print
   Bookmark   Link






 

Device driver



 
 
In computing, a device driver or software driver is a computer program
Computer program

Computer programs are Instruction for a computer. A computer requires programs to function. Moreover, a computer program does not run unless its instructions are executed by a Central processing unit; however, a program may communicate an Algorithm#Formalization of algorithms to people without running....
 allowing higher-level computer programs to interact with a hardware
Hardware

Hardware is a general term that refers to the physical cultural artifacts of a technology. It may also mean the physical components of a computer system, in the form of computer hardware....
 device.

A driver typically communicates with the device through the computer bus
Computer bus

In computer architecture, a bus is a subsystem that transfers data between computer components inside a computer or between computers. Each bus defines its set of connectors to physically plug devices, cards or cables together....
 or communications subsystem to which the hardware is connected. When a calling program invokes a routine
Subroutine

In computer science, a subroutine or subprogram is a portion of computer code within a larger computer program, which performs a specific task and is relatively independent of the remaining code....
 in the driver, the driver issues commands to the device. Once the device sends data back to the driver, the driver may invoke routines in the original calling program.






Discussion
Ask a question about 'Device driver'
Start a new discussion about 'Device driver'
Answer questions from other users
Full Discussion Forum



Encyclopedia


In computing, a device driver or software driver is a computer program
Computer program

Computer programs are Instruction for a computer. A computer requires programs to function. Moreover, a computer program does not run unless its instructions are executed by a Central processing unit; however, a program may communicate an Algorithm#Formalization of algorithms to people without running....
 allowing higher-level computer programs to interact with a hardware
Hardware

Hardware is a general term that refers to the physical cultural artifacts of a technology. It may also mean the physical components of a computer system, in the form of computer hardware....
 device.

A driver typically communicates with the device through the computer bus
Computer bus

In computer architecture, a bus is a subsystem that transfers data between computer components inside a computer or between computers. Each bus defines its set of connectors to physically plug devices, cards or cables together....
 or communications subsystem to which the hardware is connected. When a calling program invokes a routine
Subroutine

In computer science, a subroutine or subprogram is a portion of computer code within a larger computer program, which performs a specific task and is relatively independent of the remaining code....
 in the driver, the driver issues commands to the device. Once the device sends data back to the driver, the driver may invoke routines in the original calling program. Drivers are hardware-dependent and operating-system
Operating system

An operating system is an interface between hardware and applications; it is responsible for the management and coordination of activities and the sharing of the limited resources of the computer....
-specific. They usually provide the interrupt
Interrupt

In computing, an interrupt is an asynchronous communication signal from hardware indicating the need for attention or a synchronous event in software indicating the need for a change in execution....
 handling required for any necessary asynchronous time-dependent hardware interface.

Purpose

A device driver simplifies programming by acting as an abstraction layer
Abstraction layer

An abstraction layer is a way of hiding the implementation details of a particular set of functionality. Software models that use layers of abstraction include the OSI model for computer network Protocol , the OpenGL graphics drawing library, and the byte stream input/output model originated by Unix and adopted by MSDOS, Linux, and most ot...
 between a hardware device and the applications or operating system
Operating system

An operating system is an interface between hardware and applications; it is responsible for the management and coordination of activities and the sharing of the limited resources of the computer....
s that use it. The higher-level application code can be written independently of whatever specific hardware device it will ultimately control, as it can interface with it in a standard way, regardless of the underlying hardware. Every version of a device, such as a printer
Computer printer

File:Lexmark X5100 Series.jpgIn computing, a printer is a peripheral which produces a hard copy of documents stored in computer file form, usually on physical print media such as paper or Transparency ....
, requires its own hardware-specific specialized commands. In contrast, most applications utilize devices (such as sending a file to a printer) by means of high-level device-generic commands such as PRINTLN (print a line). The device-driver accepts these generic high-level commands and breaks them into a series of low-level device-specific commands as required by the device being driven. Furthermore, drivers can provide a level of security as they can run in kernel-mode
Ring (computer security)

In computer science, hierarchical protection domains, often called protection rings, are a mechanism to protect data and functionality from faults and malicious behaviour ....
, thereby protecting the operating system from applications running in user-mode.

Design


Device drivers can be abstracted into logical and physical layer
Physical layer

The Physical Layer is the first and lowest layer in the seven-layer OSI model of computer networking.The Physical Layer comprises the basic hardware transmission technologies of a network....
s. Logical layers process data for a class of devices such as ethernet
Ethernet

Ethernet is a family of Data frame-based computer networking technologies for local area networks . The name comes from the physical concept of the Luminiferous aether....
 ports or disk drives. Physical layers communicate with specific device instances. For example, a serial port
Serial port

In computing, a serial port is a serial communication physical interface through which information transfers in or out one bit at a time ....
 needs to handle standard communication protocols such as XON/XOFF that are common for all serial port hardware. This would be managed by a serial port logical layer. However, the logical layer needs to communicate with a particular serial port chip. 16550 UART
16550 UART

The 16550 UART is an integrated circuit designed for implementing the interface for serial communications. It is frequently used to implement the serial port for IBM PC compatible personal computers, where it is often connected to an RS-232 interface for modems, serial Computer mouse, printers, and similar peripherals....
 hardware differs from PL-011. The physical layer addresses these chip-specific variations. Conventionally, OS requests go to the logical layer first. In turn, the logical layer calls upon the physical layer to implement OS requests in terms understandable by the hardware. Inversely, when a hardware device needs to respond to the OS, it uses the physical layer to speak to the logical layer.

In Linux, device drivers can be built either as parts of the kernel or separately as loadable module
Loadable Kernel Module

In computing, a loadable kernel module is an object file that contains code to extend the running kernel , or so-called base kernel, of an operating system....
s. Makedev includes a list of the devices in Linux: ttyS (terminal), lp (parallel port
Parallel port

A parallel port is a type of interface found on computers for connecting various peripherals. It is also known as a printer port or Centronics#The interface....
), hd (disk), loop (loopback disk device), sound (these include mixer
Mixer

Mixer may refer to:An electronics device:* Electronic mixer, a device for mixing signals* Frequency mixer, a telecommunications device used to alter the carrier frequency of a signal...
, sequencer
Sequencer

A sequencer is something that either generates or analyzes a sequence, or triggers events in timed fashion. The term may mean or refer to:* Sequencer, a 1976 electronic music album by Larry Fast...
, dsp
DSP

The abbreviation DSP can refer to:...
, and audio)...

The Windows
Microsoft Windows

Microsoft Windows is a series of software operating systems and graphical user interfaces produced by Microsoft. Microsoft first introduced an operating environment named Windows in November 1985 as an add-on to MS-DOS in response to the growing interest in graphical user interfaces ....
 .sys files and Linux .ko modules are loadable device drivers. The advantage of loadable device drivers is that they can be loaded only when necessary and then unloaded, thus saving kernel memory.

Development

Writing a device driver requires an in-depth understanding of how the hardware and the software of a given platform function. Drivers operate in a highly privileged environment and can cause disaster if they get things wrong. In contrast, most user-level software on modern operating system
Operating system

An operating system is an interface between hardware and applications; it is responsible for the management and coordination of activities and the sharing of the limited resources of the computer....
s can be stopped without greatly affecting the rest of the system. Even drivers executing in user mode can crash a system if the device is erroneously programmed. These factors make it more difficult and dangerous to diagnose problems.

Thus drivers are usually written by software engineer
Software engineer

A software engineer is a person who applies the principles of software engineering to the design, development, testing, and evaluation of the software and systems that make computers or anything with software such as chips work....
s who come from the companies that develop the hardware. This is because they have better information than most outsiders about the design of their hardware. Moreover, it was traditionally considered in the hardware manufacturer's interest to guarantee that their clients can use their hardware in an optimum way. Typically, the logical device driver (LDD) is written by the operating system vendor, while the physical device driver (PDD) is implemented by the device vendor. But in recent years non-vendors have written numerous device drivers, mainly for use with free operating systems
Free software

Free Software or software libre is software that can be used, studied, and modified without restriction, and which can be copied and redistributed in modified or unmodified form either without restriction, or with minimal restrictions only to ensure that further recipients can also do these things and to prevent consumer-facing hardware...
. In such cases, it is important that the hardware manufacturer provides information on how the device communicates. Although this information can instead be learned by reverse engineering
Reverse engineering

Reverse engineering is the process of discovering the technological principles of a device, object or system through analysis of its structure, function and operation....
, this is much more difficult with hardware than it is with software.

Microsoft has attempted to reduce system instability due to poorly written device drivers by creating a new framework for driver development, called Windows Driver Foundation
Windows Driver Foundation

Windows Driver Foundation is a set of Microsoft tools that aid in the creation of device drivers for Windows 2000 and later versions of Windows....
 (WDF). This includes User-Mode Driver Framework (UMDF) that encourages development of certain types of drivers - primarily those that implement a message-based protocol for communicating with their devices - as user mode drivers. If such drivers malfunction, they do not cause system instability. The Kernel-Mode Driver Framework (KMDF) model continues to allow development of kernel-mode device drivers, but attempts to provide standard implementations of functions that are well known to cause problems, including cancellation of I/O operations, power management, and plug and play device support.

Apple has an open-source framework for developing drivers on Mac OS X
Mac OS X

Mac OS X is a line of computer operating systems developed, marketed, and sold by Apple Inc., and since 2002 has been included with all new Macintosh computer systems....
 called the I/O Kit
I/O Kit

The I/O Kit is an open-source framework in the XNU kernel that helps developers code device drivers for Apple Inc.'s Mac OS X operating system....
.

Kernel-mode vs User-mode

Device drivers, particularly on modern Windows platforms, can run in kernel-mode
CPU modes

CPU modes are operating modes for the central processing unit of some computer architectures that place restrictions on the operations that can be performed by the Process currently running in the CPU....
 (Ring 0
Ring (computer security)

In computer science, hierarchical protection domains, often called protection rings, are a mechanism to protect data and functionality from faults and malicious behaviour ....
) or in user-mode
User space

A conventional operating system usually segregates virtual memory into kernel space and user space. Kernel space is strictly reserved for running the kernel , kernel extensions, and some device drivers....
 (Ring 3
Ring (computer security)

In computer science, hierarchical protection domains, often called protection rings, are a mechanism to protect data and functionality from faults and malicious behaviour ....
). The primary benefit of running a driver in user mode is improved stability, since a poorly written user mode device driver cannot crash the system by overwriting kernel memory. On the other hand, user/kernel-mode transitions usually impose a considerable performance overhead, thereby prohibiting user mode-drivers for low latency and high throughput requirements.

Device driver applications

Because of the diversity of modern hardware
Hardware

Hardware is a general term that refers to the physical cultural artifacts of a technology. It may also mean the physical components of a computer system, in the form of computer hardware....
 and operating systems, many ways exist in which drivers can be used. Drivers are used for interfacing
Interface (computer science)

Interface generally refers to an Abstraction_%28computer_science%29 that an entity provides of itself to the outside. This separates the methods of external communication from internal operation, and allows it to be internally modified without affecting the way outside entities interact with it, as well as provide Polymorphism in object-orien...
 with:
  • Printer
    Computer printer

    File:Lexmark X5100 Series.jpgIn computing, a printer is a peripheral which produces a hard copy of documents stored in computer file form, usually on physical print media such as paper or Transparency ....
    s
  • Video adapters
  • Network card
    Network card

    A network card, network adapter, network interface controller , network interface card, or LAN adapter is a computer hardware component designed to allow computers to communicate over a computer network....
    s
  • Sound card
    Sound card

    A sound card is a computer expansion card that facilitates the input and output of sound to/from a computer under control of computer programs....
    s
  • Local bus
    Computer bus

    In computer architecture, a bus is a subsystem that transfers data between computer components inside a computer or between computers. Each bus defines its set of connectors to physically plug devices, cards or cables together....
    es of various sorts - in particular, for bus mastering
    Bus mastering

    In computing, bus mastering is a feature supported by many computer buss that enables a device connected to the bus to initiate transactions. Also called "First-party DMA", to contrast it with Third-party DMA, the situation where the system DMA controller is actually doing the transfer....
     on modern systems
  • Low-bandwidth
    Bandwidth (computing)

    In computer networking and computer science, digital bandwidth, network bandwidth or just bandwidth is a measure of available or consumed data communication resources expressed in bit/s or multiples of it ....
     I/O
    Input/output

    In computing, input/output, or I/O, refers to the communication between an information processing system , and the outside world ? possibly a human, or another information processing system....
     buses of various sorts (for pointing device
    Pointing device

    A pointing device is an input interface that allows a user to input spatial data to a computer. Computer-aided design systems and graphical user interfaces allow the user to control and provide data to the computer using physical Mouse gesture ? point, click, and drag ? for example, by moving a hand-held Mouse across the surface of the...
    s such as mice, keyboards, USB
    Universal Serial Bus

    In information technology, Universal Serial Bus is a Serial communications computer bus standard to electrical connector devices to a host computer....
    , etc.)
  • computer storage
    Computer storage

    Computer data storage, often called storage or memory, refers to computer components, devices, and recording medium that retain digital data used for computing for some interval of time....
     devices such as hard disk
    Hard disk

    A hard disk drive , commonly referred to as a hard drive, hard disk, or fixed disk drive, is a non-volatile storage device which stores digitally encoded data on rapidly rotating hard disk platters with magnetic surfaces....
    , CD-ROM
    CD-ROM

    CD-ROM is a pre-pressed Compact Disc that contains Computer data storage accessible to, but not writable by, a computer. While the Compact Disc format was originally designed for music storage and playback, the 1985 Yellow Book standard developed by Sony and Philips adapted the format to hold any form of Binary file....
     and floppy disk
    Floppy disk

    A floppy disk is a data storage medium that is composed of a disk of thin, flexible magnetic storage medium encased in a square or rectangle plastic shell....
     buses (ATA, SATA
    Sata

    Sata is a traditional dish from the Malaysian state of Terengganu, consisting of spiced fish meat wrapped in banana leaves and cooked on a grill....
    , SCSI
    SCSI

    Small Computer System Interface, or SCSI , is a set of standards for physically connecting and transferring data between computers and peripheral devices....
    )
  • Implementing support for different file system
    File system

    In computing, a file system is a method for store and organize computer files and the data they contain to make it easy to find and access them....
    s
  • Implementing support for image scanner
    Image scanner

    In computing, a scanner is a device that optically scans images, printed text, handwriting, or an object, and converts it to a digital image. Common examples found in offices are variations of the desktop scanner where the document is placed on a glass window for scanning....
    s and digital camera
    Digital camera

    A digital camera is a camera that takes video or still photographs, or both, digitally by recording digital image via an electronics .Many compact digital still cameras can record sound and moving video as well as still photographs....
    s


Common levels of abstraction for device drivers are
  • For hardware:
    • Interfacing directly
    • Writing to or reading from a Device Control Register
      Device control register

      A device control register is an on-chip register that exists architecturally and physically outside the main compute core, and therefore are not specified by the ISA and processor programming manuals....
    • Using some higher-level interface (e.g. Video BIOS
      Video BIOS

      Video BIOS is the BIOS of a graphics card in a computer.Much the way the system BIOS provides a set of functions that are used by software programs to access the system hardware, the video BIOS provides a set of video-related functions that are used by programs to access the video hardware....
      )
    • Using another lower-level device driver (e.g. file system drivers using disk drivers)
    • Simulating work with hardware, while doing something entirely different
  • For software:
    • Allowing the operating system direct access to hardware resources
    • Implementing only primitives
    • Implementing an interface for non-driver software (e.g. TWAIN
      TWAIN

      TWAIN is a standard software protocol and applications programming interface that regulates communication between software applications and imaging devices such as and digital cameras....
      )
    • Implementing a language, sometimes quite high-level (e.g. PostScript
      PostScript

      PostScript is a dynamically typed concatenative programming language programming language created by John Warnock and Charles Geschke in 1982. PostScript is best known for its use as a page description language in the electronic and desktop publishing areas....
      )


Choosing and installing the correct device drivers for given hardware is often a key component of computer system configuration.

Virtual device drivers

A particular variant of device drivers are virtual device drivers. They are used to emulate a hardware device, particularly in virtualization
Virtualization

In computing, platform virtualization is a virtualization of computers or operating systems. It hides the physical characteristics of computing platform from the users, instead showing another abstract, emulated computing platform....
 environments, for example when a DOS
DOS

DOS, short for "Disk Operating System", is a shorthand term for several closely related operating systems that dominated the IBM PC compatible market between 1981 and 1995, or until about 2000 if one includes the partially DOS-based Microsoft Windows versions Windows 95, Windows 98, and Windows Me....
 program is run on a Microsoft Windows
Microsoft Windows

Microsoft Windows is a series of software operating systems and graphical user interfaces produced by Microsoft. Microsoft first introduced an operating environment named Windows in November 1985 as an add-on to MS-DOS in response to the growing interest in graphical user interfaces ....
 computer or when a guest operating system
Operating system

An operating system is an interface between hardware and applications; it is responsible for the management and coordination of activities and the sharing of the limited resources of the computer....
 is run on, for example, a Xen
Xen

Xen is a Hypervisor for IA-32 , IA-64 and PowerPC 970 architectures. It allows several guest operating systems to be executed on the same computer hardware concurrently....
 host. Instead of enabling the guest operating system to dialog with hardware, virtual device drivers take the opposite role and emulate a piece of hardware, so that the guest operating system and its drivers running inside a virtual machine
Virtual machine

In computer science, a virtual machine is a software implementation of a machine that executes programs like a real machine.Definitions...
 can have the illusion of accessing real hardware. Attempts by the guest operating system to access the hardware are routed to the virtual device driver in the host operating system as e.g. function calls. The virtual device driver can also send simulated processor-level events like interrupt
Interrupt

In computing, an interrupt is an asynchronous communication signal from hardware indicating the need for attention or a synchronous event in software indicating the need for a change in execution....
s into the virtual machine.

Virtual devices are also used in a non-virtualized environment. For example a virtual network adapter is used with a virtual private network
Virtual private network

VPN which stands for Virtual Private Networks are used as secure extranets and Internets . It protects its network by using encryption, firewalls and other security strategies....
, while a virtual disk device is used with iSCSI
ISCSI

In computing, iSCSI is Internet SCSI , an Internet Protocol -based storage networking standard for linking data storage facilities. By carrying SCSI commands over IP networks, iSCSI is used to facilitate data transfers over intranets and to manage storage over long distances....
.

Open drivers

  • Printers: CUPS.
  • Scanners: SANE
    Scanner Access Now Easy

    Scanner Access Now Easy is an application programming interface that provides standardized access to any raster hardware . The SANE API is public domain and its discussion and development is open to everybody....
    .
  • Video: Vidix
    Vidix

    VIDIX is a portable interface which was designed and introduced as an interface to userspace drivers to provide DGA ....
    , Direct Rendering Infrastructure
    Direct Rendering Infrastructure

    In computing, the Direct Rendering Infrastructure is an interface and a free software implementation used in the X Window System to securely allow user applications to access the video hardware without requiring data to be passed through the X server....


Solaris descriptions of commonly used device drivers
  • fas: Fast/wide SCSI controller
  • hme: Fast (10/100 Mbit/s) Ethernet
  • isp: Differential SCSI controllers and the SunSwift card
  • glm: UltraSCSI controllers
  • scsi: Small Computer Serial Interface (SCSI) devices
  • sf: soc+ or socal Fiber Channel Arbitrated Loop (FCAL)
  • soc: SPARC Storage Array (SSA) controllers
  • socal: Serial optical controllers for FCAL (soc+)


Driver APIs

  • Advanced Linux Sound Architecture (ALSA) - The standard modern Linux sound driver interface
  • I/O Kit
    I/O Kit

    The I/O Kit is an open-source framework in the XNU kernel that helps developers code device drivers for Apple Inc.'s Mac OS X operating system....
     - an open-source framework from Apple
    Apple Computer

    Apple Inc., formerly Apple Computer Inc., is an United States multinational corporation which designs and manufactures consumer electronics and software products....
     for developing Mac OS X
    Mac OS X

    Mac OS X is a line of computer operating systems developed, marketed, and sold by Apple Inc., and since 2002 has been included with all new Macintosh computer systems....
     device drivers
  • Installable File System
    Installable File System

    The Installable File System is a filesystem API in IBM OS/2 and Microsoft Windows that enables the operating system to recognize and load software drivers for file systems....
     (IFS) - a filesystem API
    Filesystem API

    A file system API is an application programming interface through which an operating system interfaces with file system code. The operating system usually provides abstractions for accessing different file systems transparently to userland programs, and in this sense it is analogous to device driver APIs that provide abstracted access to hard...
     for IBM OS/2 and Microsoft Windows NT
  • Network Driver Interface Specification
    Network Driver Interface Specification

    The Network Driver Interface Specification is an application programming interface for network interface cards . It was jointly developed by Microsoft and 3Com Corporation, and is mostly used in Microsoft Windows, but the open source NdisWrapper and Project Evil driver wrapper projects allow many NDIS-compliant NICs to be used with...
     (NDIS) - a standard network card
    Network card

    A network card, network adapter, network interface controller , network interface card, or LAN adapter is a computer hardware component designed to allow computers to communicate over a computer network....
     driver API
  • Open Data-Link Interface
    Open Data-Link Interface

    The Open Data-Link Interface , developed by Apple Computer and Novell, serves the same function as Microsoft and 3COM's Network Driver Interface Specification ....
     (ODI) - a network card API similar to NDIS
  • Scanner Access Now Easy
    Scanner Access Now Easy

    Scanner Access Now Easy is an application programming interface that provides standardized access to any raster hardware . The SANE API is public domain and its discussion and development is open to everybody....
     (SANE) - a public domain interface to raster image scanner hardware
  • Uniform Driver Interface
    Uniform Driver Interface

    The Uniform Driver Interface is a defunct project developed by several companies to define a portable interface for device drivers.The Uniform Driver Interface allowed device drivers to be portable across both hardware platforms and operating systems without any changes to the driver source....
     (UDI) - a cross platform driver interface project
  • Windows Display Driver Model
    Windows Display Driver Model

    Windows Display Driver Model is the graphic driver architecture for video card device driver running Microsoft Windows versions beginning with Windows Vista....
     (WDDM) - the graphic display driver architecture for Windows Vista
    Windows Vista

    Windows Vista is one member in a family of operating systems developed by Microsoft for use on personal computers, including home and business Desktop computer, laptops, Tablet PCs, and media center PCs....
  • Windows Driver Foundation
    Windows Driver Foundation

    Windows Driver Foundation is a set of Microsoft tools that aid in the creation of device drivers for Windows 2000 and later versions of Windows....
     (WDF)
  • Windows Driver Model
    Windows Driver Model

    In computing, the Windows Driver Model — also known at one point as the Win32 Driver Model — is a framework for device drivers that was introduced with Windows 98 and Windows 2000 to replace VxD, which was used on older versions of Windows such as Windows 95 and Windows 3.1x, as well as the Windows_NT#Driver_models....
     (WDM)


Identifiers

  • Device id is the device identifier and Vendor id is the vendor identifier.

See also

  • Class driver
    Class driver

    In computing, a class driver is a type of hardware device driver that can operate a large number of different devices of a broadly similar type....
  • Firmware
    Firmware

    Firmware is a term sometimes used to denote the fixed, usually rather small, programs that internally control various electronic devices. Typical examples range from end user products such as remote controls or calculators, via computer parts and devices like harddisks, keyboard s, TFT screens or memory cards, all the way to scientific instr...
  • Interrupt
    Interrupt

    In computing, an interrupt is an asynchronous communication signal from hardware indicating the need for attention or a synchronous event in software indicating the need for a change in execution....
  • Loadable kernel module
    Loadable Kernel Module

    In computing, a loadable kernel module is an object file that contains code to extend the running kernel , or so-called base kernel, of an operating system....
  • Makedev
  • Open source hardware
    Open source hardware

    File:Uze open console 09.jpgFile:BUG Group - Hiro P edition.jpgOpen source hardware refers to computer and electronic hardware that is designed in the same fashion as free and open source software ....
  • Printer driver
    Printer driver

    In computers, a printer driver or a print processor is a piece of software that converts the data to be printed to the form specific to a computer printer....
  • udev
    Udev

    udev is the device manager for the Linux kernel 2.6 Kernel series. Primarily, it manages device nodes in Filesystem Hierarchy Standard....


External links