A device driver is software that operates and controls a device attached to a computer. The purpose of device drivers is to provide hardware abstraction, i.e., to provide a standardized interface over which other software can take advantage of hardware without possessing intricate, specialized knowledge of each piece of hardware. A driver communicates with the device through the computer bus or communications subsystem to which the hardware connects. A calling app can invoke a routine within the driver, which issues commands to the device and returns the resulting data to the calling app. Drivers are hardware-dependent and operating-system–specific. They usually provide the interrupt handling required for any necessary asynchronous time-dependent hardware interface.
Purpose The main purpose of device drivers is to provide hardware abstraction by acting as a translator between a hardware device and the app or operating systems using it. Software developers can write higher-level code independently of whatever specific hardware the end-user is using. For example, an app for interacting with a serial port may have two routines to send data and receive data. At a lower level, a device driver implementing these functions would communicate with the computer's serial port controller. This driver knows the appropriate commands. For instance, the commands needed to control a 16550 UART are different from those of a USB-to-serial adapter, but the device driver abstracts these details into the same (or similar) software interface. Therefore, the same app on different computers uses the same routines to communicate with device drivers and gets the same results, without getting concerned with how drivers get said results. Because of the diversity of modern hardware and operating systems, drivers operate in many different environments. Drivers may interface with printers, video adapters, network interface controllers (NICs), sound cards, PC chipsets, power- and battery management features, local buses (in particular, for bus mastering on modern systems), computer storage devices (such as hard disk, CD-ROM, and floppy disk drives), image scanners, digital cameras, digital terrestrial television tuners, IrDA adapters, wireless personal area networks (such as Bluetooth Low Energy, Thread, Zigbee, and Z-Wave), and even file systems. Choosing and installing the correct device drivers for the given hardware is often a key component of computer system configuration.
Development Writing a device driver requires an in-depth understanding of how the hardware and the software work for a given platform function. Because drivers require low-level access to hardware functions in order to operate, drivers typically operate in a highly privileged environment and can cause system operational issues if something goes wrong. (In contrast, misbehavior in most user-level software on modern operating systems 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. The task of writing drivers thus usually falls to software developers or computer engineers who work for hardware vendors because they possess the necessary information at hand. It is in the manufacturer's interest to guarantee that their clients can use their hardware optimally. However, with the growth of the Linux operating systems, non-vendors have written numerous free and open-source device drivers for proprietary devices, including free and open-source graphics device drivers. In such cases, the necessary information on how device works must be obtained either from the hardware vendor (as is the case with open-source hardware) or via reverse engineering. Operating systems support device drivers implemented as loadable kernel modules, which can be loaded into memory only when necessary and then unloaded, thus saving kernel memory. Each OS, however, has a different term for these modules, including "kernel loadable module" in FreeBSD, "kernel extension module" in AIX, "dynamically loadable kernel module" in HP-UX, and "downloadable kernel module" in VxWorks. They don't have a particular name in Microsoft Windows because all device drivers are loadable modules.
In Microsoft Windows Device drivers in Microsoft Windows bear use the .sys filename extension. Kernel-mode device drivers interface with the OS through the Hardware Abstraction Layer (HAL), in implemented in hal.dll. Windows uses a combination of full drivers and "minidrivers" (more specifically "miniclass" and "miniport" drivers), where the full driver is provided with the operating system while vendors develop minidrivers to implement or optimize a subset of the full driver stack.
APIs and frameworks The operating system categorizes devices into classes and provides a number of class-specific driver APIs, including:
Windows Driver Model (WDM) for all device classes Network Driver Interface Specification (NDIS) for network devices Windows Display Driver Model (WDDM) for display drivers WaveRT for real-time audio drivers StorPort for storage devices Windows Image Acquisition (WIA) for image scanners and apps that read and write digital pictures Human Interface Device (HID) for keyboards, mice, touchpads, graphics tablets, touchscreens, and other input devices All of the above can have full drivers and minidrivers. Microsoft develops and maintains Windows Driver Frameworks (WDF), a set of libraries and tools that intend to ease the process of creating high-quality drivers. WDF includes User-Mode Driver Framework (UMDF) that encourages development of user-mode drivers for devices that can communicate with the OS via message-based protocols. If such drivers malfunction, they do not cause system instability. The Kernel-Mode Driver Framework (KMDF) caters to the development of traditional kernel-mode device drivers but attempts to provide standard implementations of functions that are known to cause problems, including cancellation of I/O operations, power management, and plug-and-play device support.
… excerpt ends here. Continue reading the full article.

