next up previous contents
Next: 2.3 WD_PciGetCardInfo() Up: 2. WD_xxx PCI/PCMCIA/ISA Functions Previous: 2.1 API Calling Sequence   Contents


2.2 WD_PciScanCards()


PURPOSE

$\bullet$Detects PCI devices installed on the PCI bus, which conform to the input criteria (vendor ID and/or card ID), and returns the number and location (bus, slot and function) of the detected devices.


PROTOTYPE

DWORD WD_PciScanCards(
    HANDLE hWD,
    WD_PCI_SCAN_CARDS *pPciScan);


PARAMETERS

Name Type Input/Output
$\bullet$hWD HANDLE Input
$\bullet$pPciScan WD_PCI_SCAN_CARDS*  
$\gg$searchId WD_PCI_ID  
$\diamond$dwVendorId DWORD Input
$\diamond$dwDeviceId DWORD Input
$\gg$dwCards DWORD Output
$\gg$cardId WD_PCI_ID[WD_PCI_CARDS]  
$\diamond$dwVendorId DWORD Output
$\diamond$dwDeviceId DWORD Output
$\gg$cardSlot WD_PCI_SLOT[WD_PCI_CARDS]  
$\diamond$dwBus DWORD Output
$\diamond$dwSlot DWORD Output
$\diamond$dwFunction DWORD Output
$\gg$dwOptions DWORD Input


DESCRIPTION

Name Description
hWD The handle to WinDriver's kernel-mode driver received from WD_Open() [5.2]
pPciScan Pointer to a PCI bus scan information structure:
searchId PCI card ID information structure:
searchId.dwVendorId The vendor ID of the PCI cards to detect. If 0, the function will search for all PCI card vendor IDs.
searchId.dwDeviceId The card ID of the PCI cards to detect. If 0, the function will search for all PCI card IDs.
If both dwVendorId and dwDeviceId are set to 0 the function will return information regarding all connected PCI cards.
dwCards Number of cards detected for the specified search criteria set in the searchId field
cardId Array of PCI card ID information structures for the detected PCI cards that match the search criteria set in the searchId field:
cardId.dwVendorId Vendor ID
cardId.dwDeviceId Card ID
cardSlot Array of PCI slot information structures for the detected PCI cards that match the search criteria set in the searchId field:
cardSlot.dwBus Bus number (0 based)
cardSlot.dwSlot Slot number (0 based)
cardSlot.dwFunction Function number (0 based)
dwOptions PCI bus scan options. Can be either of the following:
$\bullet$WD_PCI_SCAN_DEFAULT: Scan all PCI buses and slots.
This is the default scan option.
$\bullet$WD_PCI_SCAN_BY_TOPOLOGY: Scan the PCI bus by topology.


RETURN VALUE

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


EXAMPLE

WD_PCI_SCAN_CARDS pciScan;
DWORD cards_found;
WD_PCI_SLOT pciSlot;

BZERO(pciScan);
pciScan.searchId.dwVendorId = 0x12bc;
pciScan.searchId.dwDeviceId = 0x1;
WD_PciScanCards(hWD, &pciScan);
if (pciScan.dwCards>0) /* Found at least one device */
    pciSlot = pciScan.cardSlot[0]; /* Use the first card found */
else
    printf("No matching PCI devices found\n");


next up previous contents
Next: 2.3 WD_PciGetCardInfo() Up: 2. WD_xxx PCI/PCMCIA/ISA Functions Previous: 2.1 API Calling Sequence   Contents