2.3.WD_PciScanCaps()

Purpose

Scans the specified PCI capabilities group of the given PCI slot for the specified capability (or for all capabilities).

Prototype
DWORD WD_PciScanCaps(
    HANDLE hWD,
    WD_PCI_SCAN_CAPS *pPciScanCaps);
Parameters
NameTypeInput/Output
hWDHANDLEInput
pPciScanCapsWD_PCI_SCAN_CAPS*
pciSlotWD_PCI_SLOT
*dwBusDWORDInput
*dwSlotDWORDInput
*dwFunctionDWORDInput
dwCapIdDWORDInput
dwOptionsDWORDInput
dwNumCapsDWORDOutput
pciCapsWD_PCI_CAP[WD_PCI_MAX_CAPS]
*dwCapIdDWORDOutput
*dwCapOffsetDWORDOutput
Description
NameDescription
hWDHandle to WinDriver's kernel-mode driver as received from WD_Open()[5.2]
pPciScanCapsPointer to a PCI capabilities scan structure:
pciSlotPCI slot information structure
*dwBusBus number (0 based)
*dwSlotSlot number (0 based)
*dwFunctionFunction number (0 based)
dwCapId ID of the PCI capability for which to search, or WD_PCI_CAP_ID_ALL to search for all PCI capabilities
dwOptions PCI capabilities scan options. Can be set to any of the WD_PCI_SCAN_CAPS_OPTIONS flags:
  • WD_PCI_SCAN_CAPS_BASIC — Scan the basic PCI capabilities. This is the default scan option.
  • WD_PCI_SCAN_CAPS_EXTENDED — Scan the extended (PCIExpress) PCI capabilities.
dwNumCaps Number of PCI capabilities that match the search criteria set in the dwCapId and dwOptions fields
pciCaps Array of PCI capability structures for PCI capabilities that match the search criteria set in the dwCapId and dwOptions fields
*dwCapIdPCI capability ID
*dwCapOffsetPCI capability register offset
Return Value

Returns WD_STATUS_SUCCESS (0) on success, or an appropriate error code otherwise[A].

Example
WD_PCI_SCAN_CAPS pciScanCaps;
WD_PCI_CAP pciCap;

BZERO(pciScanCaps);
pciScanCaps.pciSlot = pciSlot; /* pciSlot = a WD_PCI_SLOT struct returned by
                                  WD_PciScanCards() in pPciScan->cardSlot */
pciScanCaps.dwCapId = 0x05; /* Search for the MSI capability */
pciScanCaps.dwOptions = WD_PCI_SCAN_CAPS_BASIC; /* Scan the basic PCI
                                                   capabilities */
WD_PciScanCaps(hWD, &pciScanCaps);
if (pciScanCaps.dwNumCaps > 0) /* Found a matching capability */
{
    pciCap = pciScanCaps.pciCaps[0]; /* Use the first capability found */
}
else
{
    printf("PCI capability 0x%lx not found in the basic PCI capabilities\n",
      pciScanCaps.dwCapId);
}