Resource List Objects
The PortCls system driver implements the IResourceList interface for the benefit of miniport drivers. An IResourceList object represents a configuration resource list, which is a list of the system hardware resources that the Plug and Play manager assigns to a device at device-startup time. For more information about resource assignment at startup time, see Starting a Device in a Function Driver.
A resource list contains the following types of resources:
I/O port addresses
Blocks of bus-relative memory addresses
For information about resource types, see Hardware Resources.
An IResourceList object encapsulates both the translated and untranslated (or "raw") versions of a resource list. For more information about translated and untranslated resources, see Mapping Bus-Relative Addresses to Virtual Addresses.
The IResourceList interface supports the following methods:
Header file Portcls.h defines set of macros to simplify the handling of resource-list objects. These macros generate calls to the IResourceList methods. For more information, see IResourceList.
In addition, Portcls.h defines a pair of functions for creating resource lists:
To start up the devices on an audio adapter card, the operating system calls the adapter driver's start-device routine (see Startup Sequence) and passes in a resource list object as an input parameter. This list contains all the system resources that the operating system has assigned to the adapter driver.
In the start-device routine, the adapter driver starts up all of the adapter driver's devices (wave device, MIDI device, and so on). To manage each device, the adapter driver creates a miniport driver object and its associated port driver object. The adapter driver divides up the resources in the resource list among the various devices in the adapter card. For this purpose, the driver typically calls PcNewResourceSublist to create a resource list object for each device. The driver then calls IResourceList::AddEntryFromParent as many times as necessary to copy selected resources from the parent list into the various child lists. In addition, the adapter driver might assign some resources to itself.
Next, the start-device routine calls each port driver's IPort::Init method and passes in the device's resource list object (containing the child list) as an input parameter. Each port driver's IPort::Init method calls the corresponding miniport driver's IMiniportXxx::Init method, which is one of the following:
The IPort::Init method passes its resource list object to the IMiniportXxx::Init method as an input parameter. The miniport driver can then make use of the DMA channels, interrupts, and other system resources in the resource list.
For a code example, see the Sb16 sample audio driver in the Microsoft Windows Driver Kit (WDK).