Layered Drivers (Compact 2013)

3/26/2014

In the layered driver model, the MDD layer implements a set of functions and I/O control (IOCTL) codes that is common for a certain class of device drivers. This upper interface of the device driver MDD defines the DDI for that class of driver. The MDD layer also implements an interrupt service thread (IST) and defines the interface for interacting with the lower PDD layer of the driver. This lower interface between the MDD and PDD is called the device driver service interface (DDSI). The PDD layer implements the functionality that is specific to a particular hardware device. In effect, the PDD maps the functionality provided by a particular hardware device to the service interface presented by a particular MDD.

Distinctions between these two layers are described in the following table.

Layer

Characteristics

MDD (upper layer)

  • Accesses its devices indirectly, through the PDD layer.
  • Common to all platforms and functions both as source code and as a library.
  • Links to the PDD layer and uses the DDSI functions implemented in the PDD layer.
  • Implements a Device Driver Interface (DDI), a set of functions called by the applications or other operating system components such as GWES.

PDD (lower layer)

  • Hardware dependent; typically must be customized and ported to specific hardware.
  • Interfaces with an MDD and hardware.
  • Implements a Device Driver Service Interface (DDSI), a set of functions called by the MDD layer.

The MDD can present a stream interface or a native interface. You can use a given MDD in multiple device drivers, each with a different PDD, so that different hardware devices of the same class are available through the same interface. For example, multiple device drivers that share a single MDD implementation can manage multiple sound devices, each with a corresponding PDD. This makes it possible for an audio mixer application to change the volume in the same way on each device, regardless of any differences in the underlying hardware.

Microsoft provides sample PDD and MDD implementations for a range of devices and device types. Keep in mind that if you modify an MDD layer, you are responsible for maintaining those changes when Microsoft releases newer versions of that MDD.

When to Create a Layered Driver

The layered driver model is a good choice for a new device driver implementation if any one of the following is true:

  • You want to accelerate your development time by reusing an existing MDD for your device driver, concentrating your efforts on the hardware-specific PDD.
  • You want to reuse source code from an existing layered device driver.
  • You want to save work during the development of driver updates, such as providing hotfixes to customers. Restricting modifications to the PDD layer increases development efficiency.

Most Windows Embedded Compact device drivers are layered device drivers so that you can reuse this provided device driver functionality. When you are porting a device driver to new hardware, you generally do not have to modify the code in the MDD layer, because it contains code that is common to all drivers of that class. For example, audio drivers consist of a PDD component and an MDD component, and the PDD is the only component that you must change in order to support a new sound device.

For More Information About Layered Drivers

Typically, a layered device driver implementation re-uses an existing MDD that corresponds to the device class for that device. To learn more about layered driver device classes, see the Windows Embedded Compact 2013 topics described in the following table.

Topic

Description

Accelerometer Driver

Describes the MDD and PDD functions of device drivers managing hardware that measures acceleration caused by gravity or other external forces.

Audio Drivers

Describes the MDD waveform audio and mixer functions and the PDD functions of device drivers that manage sound playback devices.

Battery Drivers

Describes the PDD functions and IOCTLs of battery drivers that report battery status to the OS.

Camera Drivers

Describes the MDD and PDD functions of device drivers that manage video and still image capture devices.

Flash Drivers

Describes the MDD and PDD functions of device drivers that manage flash memory devices.

Keyboard and Mouse Drivers

Describes the DDI data types and structures and the MDD and PDD functions of keyboard and mouse device drivers.

Remote NDIS Drivers

Describes the MDD and PDD functions of device drivers that provide functionality for a device to act as a host computer’s miniport driver across an I/O bus such as USB.

Serial Port Drivers

Describes the MDD functions, PDD functions, and IOCTLs for device drivers that manage serial port devices.

USB Function Controller Drivers

Describes the MDD and PDD functions for USB function controller device drivers.

USB Host Controller Drivers

Describes the MDD and PDD functions for UHCI, OHCI, and EHCI USB host controller device drivers.

Each device driver topic listed in this table contains detailed information about the MDD and PDD functions implemented by that class of device driver.

See Also

Concepts

Layered and Monolithic Drivers