次の方法で共有


Step 3: Enumerating a PCI Serial Driver (Windows Embedded CE 6.0)

1/6/2010

In this step of the driver loading process example, the PCI bus driver comes across a PCI serial device as it enumerates the PCI bus. The following table shows the PCI serial device registry keys and values.

Subkey Value

Class

0x7

SubClass

0x0

ProgIF

0x2

The PCI bus driver examines the registry subkeys of Drivers\PCI and finds a match for these values under the Drivers\PCI\Template\Serial key. The VendorID, DeviceID, and so on, of the device find a more exact match first. In other words, if the key Drivers\PCI\Template\SerialSpecial lists values Class, SubClass, ProgIF, VendorID, and DeviceID that exactly matched those of the device, then that driver description is used instead of the Drivers\PCI\Template\Serial description because it more closely matches the device's identifiers.

The PCI bus driver knows about subkeys of the form Drivers\PCI\Template\DriverName and Drivers\PCI\Instance\DriverNameX:

  • The Template key describes driver information to enable the PCI bus driver to load the appropriate driver for a device. Template describes general information like Dll and Order. Template does not describe specific information, such as MemBase and MemLen, which is where the device exists on the bus.
  • The Instance key provides specific information about a particular instance of a device. When the PCI bus driver discovers a device, it finds a matching Template key and copies this information to a corresponding Instance key, and keeps track of the particular instance. For example, the first instance of a device is DriverName1 and the second instance is DriverName2. If instance-specific information is desired to be set ahead of time, you fill out the values to set under the Instance key.

Serial Subkey Initial State

The following registry key entry shows the initial state for the Drivers\PCI\Template\Serial key.

[HKEY_LOCAL_MACHINE\Drivers\PCI\Template\Serial]
    "Dll"="Com16550.Dll"
    "Class"=dword:07
    "SubClass"=dword:00
    "ProgIF"=dword:02
    "VendorID"=multi_sz:"0AF0","B320","B320"
    "DeviceID"=multi_sz:"0020","0300","0302"
    "Prefix"="COM"

[HKEY_LOCAL_MACHINE\Drivers\PCI\Template\Serial\Unimodem]
    "Tsp"="Unimodem.dll"
    "DeviceType"=dword:0
    "FriendlyName"="Serial Cable on PCI"
    "DevConfig"=hex: 10,00, 00,00, 05,00,00,00, 10,01,00,00, 00,4B,00,00

[HKEY_LOCAL_MACHINE\Drivers\PCI\Instance\Serial1\Unimodem]
    "FriendlyName"="Serial Cable on COM1:"

Serial Subkey Final State

The template information is provided for the Serial and Unimodem device drivers. Instance-specific information is provided to indicate the Unimodem's FriendlyName. When the PCI bus driver discovers the device that matches the serial Template information, it copies all of the Template information to the PCI\Instance\Serial1 key. Any subkeys, such as Unimodem, are copied as well. Any existing values under the PCI\Instance\Serial1 key are not changed. This allows registry values to be set in advance for a particular instance of a device. The PCI bus driver also completes standard location and resource information for the Instance key. The PCI bus driver always sets the Instance values obtained from the device, and they overwrite values that are already set for a particular Instance key. These values include the matching values such as Class, SubClass, ProgIF, VendorID, DeviceID, and so on. These values also include Irq, SysIntr, MemBase, MemLen, IoBase, IoLen, BusNumber, DeviceNumber, and FunctionNumber.

The Instance values are copied from the Template, along with the generated IoBase, IoLen, Irq, and SysIntr values. The Template for Unimodem is also copied, but the existing FriendlyName retains its value.

A device can be fixed to a location in terms of MemBase, IoBase, BusNumber, DeviceNumber, and so on by completing these values in an Instance key in the initial registry. The PCI bus driver examines both Template and Instance information when searching for a registry key that matches the discovered device. If the location information is already set in the Instance key, the PCI bus driver uses those values to configure the device. This process retains device information when a warm boot occurs so the system remains configured as it was before the warm boot. An example is when the RAM-based registry persists or when a system has a persistent registry. All the matching values must be filled out in the Instance key for this to work. The required matching values include Class, SubClass, ProgIF, VendorID, DeviceID, SubsystemVendorID, SubsystemID, RevisionID, BusNumber, DeviceNumber and FunctionNumber. MemBase, MemLen, IoBase, the IoLen values, Irq, and SysIntr also must have valid values, although they are not used for matching an Instance key to a device.

The following registry entry example shows the resulting state for the Drivers\PCI\Instance\Serial1 key.

[HKEY_LOCAL_MACHINE\Drivers\PCI\Instance\Serial1]
    "InstanceIndex"=dword:1
    "Dll"="Com16550.Dll"
    "Prefix"="COM"
    "Priority"=dword:0
    "Class"=dword:7
    "SubClass"=dword:0
    "ProgIF"=dword:2
    "VendorID"=dword:B320
    "DeviceID"=dword:300
    "RevisionID"=dword:0
    "SubVendorID"=dword:B330
    "SubSystemID"=dword:300
    "InterfaceType"=dword:5
    "BusNumber"=dword:0
    "DeviceNumber"=dword:2
    "FunctionNumber"=dword:0
    "IoBase"=dword:D2F8
    "IoLen"=dword:8
    "Irq"=dword:9
    "SysIntr"=dword:19 

[HKEY_LOCAL_MACHINE\Drivers\PCI\Instance\Serial1\Unimodem]
    "Tsp"="Unimodem.dll"
    "DeviceType"=dword:0
    "FriendlyName"="Serial Cable on COM1:"
    "DevConfig"=hex: 10,00, 00,00, 05,00,00,00, 10,01,00,00, 00,4B,00,00

See Also

Concepts

Example: Loading Drivers on the PCI Bus
Step 4: Enumerating a PCI Ethernet Controller Driver