DeviceConfig

This function is the main entry point called by the PCI bus driver to configure a device using a non-standard method.

DWORD DeviceConfig(
  DWORD Command, 
  PPCI_DEV_INFO pInfo,
  PPCI_RSRC pRsrc1,
  PPCI_RSRC pRsrc2,
  DWORD* pMemSize,
  DWORD* pIoSize
);

Parameters

  • Command
    [in] PCI bus configuration function to call. The following table shows the possible values.
    Value Description
    PCIBUS_CONFIG_RSRC Calls the ConfigRsrc function to gather device resources and update the total memory and I/O size requirements.
    PCIBUS_CONFIG_SET Calls the ConfigSet function to set base addresses for device resources.
    PCIBUS_CONFIG_SIZE Calls the ConfigSize function to query device resource sizes.
    PCIBUS_CONFIG_INIT Calls the ConfigInit function to perform any device initialization procedures necessary.
  • pInfo
    [in] Pointer to a PCI_DEV_INFO structure.
  • pRsrc1
    [in] Pointer to a PCI_RSRC structure.
  • pRsrc2
    [in] Pointer to a PCI_RSRC structure.
  • pMemSize
    [in] Pointer to a memory resource size accumulator.
  • pIoSize
    [in] Pointer to an I/O resource size accumulator.

Return Values

The following table shows return values for this function.

Return value Description
ERROR_SUCCESS Occurs if the call to the function specified by the flag in the Command parameter succeeds.
ERROR_GEN_FAILURE Occurs if the call to the function specified by the flag in the Command parameter fails.
ERROR_BAD_COMMAND Occurs if the flag specified by the Command parameter is not recognized.

Remarks

The ConfigEntry value under the device's registry key specifies the actual name of this function. The following registry key example shows this specification.

[HKEY_LOCAL_MACHINE\Drivers\Builtin\PCI\Template\Permedia3]
    "ConfigDll"="perm3_cfg.dll"
    "ConfigEntry"="DeviceConfig"

ConfigDll is required only if DeviceConfig is implemented in a separate DLL from the device driver. If ConfigDll is not specified, the DeviceConfig function is assumed to be implemented in the device driver DLL.

The PCI bus driver calls DeviceConfig four times in the following order:

  1. When the Command parameter is equal to PCIBUS_CONFIG_RSRC during the resource information gathering stage. DeviceConfig is expected to return the size of the resources it requires.
  2. When the Command parameter is equal to PCIBUS_CONFIG_SET to set the base address registers (BARs) with addresses generated by the PCI bus driver.
  3. When the Command parameter is equal to PCIBUS_CONFIG_SIZE when the PCI bus driver is enumerating the bus and requesting size information of the resources it requires.
  4. When the Command parameter is equal to PCIBUS_CONFIG_INIT to allow DeviceConfig to perform any initialization steps required by the device, if necessary.

Gdcfg.c gives an example of how to implement DeviceConfig so that it mimics the usual operation of the PCI bus driver. It is a good starting point for modifying your DeviceConfig routine.

Requirements

OS Versions: Windows CE .NET 4.0 and later.
Header: Gdcfg.c.
Link Library: Gdcfg.lib.

See Also

ConfigInit | ConfigRsrc | ConfigSet | ConfigSize | PCI Bus Configuration and Enumeration

Last updated on Wednesday, April 13, 2005

© 2005 Microsoft Corporation. All rights reserved.