Developing Drivers with the Windows Driver Foundation (Pro Developer)

KMDF supports both static and dynamic enumeration of child devices. It also includes additional PDO-specific features. This section briefly describes these features.

Static and Dynamic Enumeration in Bus Drivers

The framework invokes a bus driver's EvtDriverDeviceAdd callback after another driver has created a PDO for the bus. The bus driver creates an FDO for the device itself and then enumerates the child devices that are attached to the device and creates a PDO for each one. The driver can enumerate the child devices either statically or dynamically.

A KMDF driver supplies information about its children in a WDFCHILDLIST object, and the framework reports information from this object to the PnP manager in response to its requests for information.

If the driver calls WdfFdoInitSetDefaultChildListConfig, the framework creates an empty default WDFCHILDLIST object and sets the FDO as the parent of the WDFCHILDLIST. The child-list object maintains information about the child devices that a parent device enumerates.

Dynamic Enumeration

If the driver performs dynamic enumeration, it must at a minimum:

A driver that performs dynamic enumeration uses WdfChildListXxx methods to change its child list.

Static Enumeration

If the driver performs static enumeration, it is not required to implement any EvtChildListXxx callback functions. Instead, its EvtDriverDeviceAdd callback must:

In general, drivers that perform static enumeration do not change their child lists. However, if changes are required, a driver uses WdfFdoXxx methods to change a static child list.

PDO-Specific Initialization

Certain callback functions apply only to device objects that represent PDOs. PDOs can support callbacks that respond to queries about device resources and resource requirements, requests to lock or eject the device, and requests to enable and disable the device wake signal. KMDF drivers register the callbacks during device object initialization by calling WdfPdoInitSetEventCallbacks. Table 6-5 lists the PDO-specific callbacks.

Table 6-5: PDO-Specific Callbacks

Open table as spreadsheet

KMDF callback

Description

EvtDeviceDisableWakeAtBus

Sets the bus so that one of its devices can no longer trigger a wake signal.

EvtDeviceEject

Handles device ejection.

EvtDeviceEnableWakeAtBus

Sets the bus so that one of its devices can trigger a wake signal.

EvtDeviceResourceRequirementsQuery

Reports the range of resources that satisfy device requirements.

EvtDeviceResourcesQuery

Reports resources assigned to the device at boot time.

EvtDeviceSetLock

Locks the device-for example, to prevent ejection.

Additional WdfPdoInitXxx methods enable the driver to specify device-specific data, such as device IDs.

Категории