Previous | Next

Overview of Win32 Driver Model

Win32 Driver Model (WDM) defines a device-driver architecture that provides a common set of I/O services understood by both Windows 98 and future versions of Windows NT. With WDM, developers can write a single bus driver or device driver for both operating systems.

WDM is based on the concept of layers of driver classes. Each layer isolates portions of the services required of a device driver and allows hardware vendors to contain all hardware-specific functionality into a single file. Before WDM, device drivers had to include hooks for a particular operating system, in addition to the elements necessary to interact with a specific piece of hardware.

Understanding WDM

This section describes WDM. The WDM layered architecture, shown in Figure 30.1, is based on the concept of class drivers.

Figure 30.1 WDM layered architecture

There can be any number of driver layers, depending on the configuration of the computer. In this figure, there are six driver layers:

The WDM layer contains the following types of drivers:

A bus minidriver and a bus class driver for a device are not fundamentally different from other device class drivers and device minidrivers.

The layers of the WDM architecture are detailed in Chapter 28, "Windows 98 Architecture."

Under Windows 98, WDM provides a set of kernel services, device drivers, and bus drivers that enables new bus and device classes to have a single driver for each class, while allowing Windows 98 to fully support existing virtual device drivers (VxDs).

For more information about the workings of the WDM kernel, see the WDM Device Driver Kit (DDK).

Microsoft supports the following technologies using WDM drivers: OnNow power management, Plug and Play, USB, the IEEE 1394 bus, and hardware device classes, including digital audio, Human Interface Device (HID), imaging (still image and video capture), and DVD. Besides providing a set of drivers for buses and mainstream hardware devices supported by WDM, Windows 98 allows you to create custom drivers for unsupported hardware devices as well.

For each bus class and hardware device class provided by WDM, Windows 98 provides a class driver. The interface for this driver is documented in the Windows 98 DDK. Because Microsoft provides all platform-specific integration support for WDM, you are required to write only minidrivers for hardware devices whose classes are supported by Microsoft. In addition, Windows 98 provides enhanced power management for these devices.

For more information about minidrivers, see Chapter 28, "Windows 98 Architecture."

Using the WDM Stream Class

Many devices rely on the WDM Stream class driver. It uses a standard interface for interconnecting device drivers to optimize the flow of data within the Windows 98 kernel. The WDM Stream class driver is used by some audio devices and video-capture devices, as well as hardware decoders (such as MPEG-2) used for playing DVD movies. In addition, the class driver helps to deal with common operating system tasks, such as direct memory access (DMA), scatter/gather memory use, and Plug and Play. The WDM Stream class driver functions on both internal and external buses.

The WDM Stream class lets you work with a single driver model for MPEG, video capture, USB audio and video, IEEE 1394 audio and video, and other streaming hardware. Therefore, if you are creating drivers for multifunction hardware devices, you can build on the Stream class and use a single driver model for all data types. Also, no driver needs to be written for USB audio drivers. This is a great improvement over previous architectures, which required the developer to create drivers using a different driver model for each type of hardware device (for example, audio, MIDI, and video capture).

The WDM Stream class driver is designed to cover an entire category of hardware devices, with each device supported by a minidriver supplied by the manufacturer. This significantly reduces the amount of code required to support a device — provided the device follows standard design specifications and principles.

For more information about the WDM Stream class, see the following:

Identifying Bus Classes Supported by WDM

The following WDM drivers are provided by Windows 98.

USB

Windows 98 provides a USB class driver and a PCI enumerator, and supports USB hubs, the Universal Host Controller Interface (UHCI) standard, the Open Host Controller Interface (OpenHCI) standard, and HID-compliant USB devices. The WDM Stream class provides additional infrastructure for most USB-compliant devices (most HID devices and imaging devices).

IEEE 1394

Windows 98 provides an IEEE 1394 bus class driver and a minidriver for Texas Instruments Lynx, Adaptec host controllers, and 1394 OpenHCI-compliant host controllers.

Identifying Hardware Device Classes Supported by WDM

The following hardware device classes are supported by Windows 98.

HID

Windows 98 provides built-in HID support for the following:

Note

Microsoft Windows 98 supports any HID-compliant device; however, the device may require additional device or vendor-specific drivers or applications to be installed before it is functional.

DVD

DVD support is based on the WDM Stream class driver. When an original equipment manufacturer (OEM) creates a decoder card, a WDM decoder-card minidriver has to be written. Non-WDM components include a class driver for the DVD-ROM drive, a collection of DirectMovie filters, and the Universal Disk Format (UDF) file system to ensure support for UDF-formatted DVD disks.

For more information about UDF, see Chapter 10, "Disks and File Systems."

Digital Audio

Windows 98 provides minidrivers for WDM audio and USB audio, and also provides a cross-application Kernel-mode mixer and a sample-rate converter as clients of the Stream class driver.

Still Image

Windows 98 provides WDM drivers for USB and SCSI still image devices, and supports still image devices (scanners, for example) plugged into serial and parallel ports.

Video Capture

WDM support for video capture is based on the Stream class driver. Windows 98 provides minidrivers for USB and IEEE 1394 cameras, as well as PCI and Videoport capture devices. Support includes DirectMovie filters for WDM video-capture interfaces, and for backward compatibility, a Video for Windows (VFW)-to-Stream class mapper.

Supporting Power Management

Windows 98 directs power management through the OnNow system. In the OnNow system, the operating system directs power management and integrates the activities of other components. The goal of OnNow is to turn the system on quickly through the use of power management techniques. The strategy for achieving that goal is to use power management techniques and have the operating system run the power management process.

WDM under Windows 98 supports OnNow power management for all USB devices. For more information about OnNow support under WDM, see "Supporting OnNow Through WDM" later in this chapter.

Understanding Driver Solutions Provided by Windows 98

To help you determine when to create custom drivers, this section describes the features and capabilities of the drive solutions provided in Windows 98, and how these solutions apply to various kinds of devices.

WDM Stream Class

The Microsoft WDM Stream class, through participation in WDM Connection and Streaming Architecture (CSA), abstracts a way to transport high-bandwidth, time-stamped, latency-sensitive data streams between kernel-mode components or between kernel-mode drivers and user-mode components. Support is provided for power management and Plug and Play.

Through CSA, the Stream class works well with Microsoft DirectShow (formerly known as ActiveMovie), in that it shares media types, has similar streaming states (Stop, Pause, Run), and shares the same concept of pins and connections. Although mainstream implementations of streaming include video capture, TV viewing, and DVD movie playback, the Stream class can also support other device types. An example is high-volume capture of instrumentation data, where time-stamping and data manipulation are important features. The ease with which DirectShow can use this data is an important consideration in deciding to use the Stream class to support a specific device.

For more information about writing WDM class drivers, see the WDM DDK.

HID Class

The HID class driver supports control devices, such as keyboards, mouse devices, and gaming devices. Any device with controls can benefit from the HID class driver. For example, remote controls and front panels are likely candidates for HID class-driver support. Support is also provided for power management and Plug and Play. Although a USB HID minidriver is provided with Windows 98, the HID class driver is not bus-specific. You can develop HID class minidrivers that support legacy input devices using HID emulation or that support HID devices using legacy ports or the IEEE 1394 bus.

For more information about the HID class, see the Windows 98 DDK Help file, "Human Interface Devices."

Port Class

The Microsoft Port class supports PCI and ISA/DMA audio devices. Existing Port drivers include Wave I/O using cyclic DMA, Wave I/O using scatter/gather, Topology (MixerLine support), and MIDI. You can use the Port class to support a specific audio device by writing one or more miniport drivers.

Like the Stream class, the Port class participates in CSA and has the same streaming capabilities and the same synergy with DirectShow. The Port class differs from the Stream class as follows:

WDM miniport audio drivers are simpler to write than VxD drivers. For more information about the Port class, see the Windows 98 DDK document, "WDM Streaming Miniport Driver Model Specification."

Still Image Architecture

The Microsoft Still Image (STI) architecture is not a class, but an infrastructure that supports the use of still image devices, such as scanners and still image cameras with Windows 98. STI currently provides support for SCSI, serial, and USB devices. The architecture is extendible, so Infrared Data Association (IrDA) or IEEE 1394 devices, for example, can be easily incorporated. WDM abstracts the interfaces to which the vendor must write; the vendor need only write a miniport driver that exposes the specific functionality of the device.

For more information about STI, see the Windows 98 DDK Help file, "Architecture and Interfaces for Scanners and Digital Still Cameras Design Notes and Reference."

USB and the IEEE 1394 Bus

Each USB and IEEE 1394 bus class driver provided under Windows 98 is independent of its host bus and supports respective bus adapters or bridges on any other type of bus. Plug and Play support is provided. Both interfaces use I/O request packets (IRPs) to communicate with their respective bus drivers.

For more information about the USB driver and the IEEE 1394 bus driver, see the following Help files in the Windows 98 DDK: