next up previous contents
Next: 2.5 WD_PcmciaScanCards() Up: 2. WD_xxx PCI/PCMCIA/ISA Functions Previous: 2.3 WD_PciGetCardInfo()   Contents


2.4 WD_PciConfigDump()


PURPOSE

$\bullet$Reads/writes from/to the PCI configuration space of a selected PCI card or the extended configuration space of a selected PCI Express card (on Windows/Linux).

For Windows and Linux, all references to ''PCI'' in the description below also include PCI Express.


PROTOTYPE

DWORD WD_PciConfigDump(
    HANDLE hWD,
    WD_PCI_CONFIG_DUMP *pConfig);


PARAMETERS

Name Type Input/Output
$\bullet$hWD HANDLE Input
$\bullet$pConfig WD_PCI_CONFIG_DUMP*  
$\gg$pciSlot WD_PCI_SLOT  
$\diamond$dwBus DWORD Input
$\diamond$dwSlot DWORD Input
$\diamond$dwFunction DWORD Input
$\gg$pBuffer PVOID Input/Output
$\gg$dwOffset DWORD Input
$\gg$dwBytes DWORD Input
$\gg$fIsRead DWORD Input
$\gg$dwResult DWORD Output


DESCRIPTION

Name Description
hWD The handle to WinDriver's kernel-mode driver received from WD_Open() [5.2]
pConfig Pointer to a PCI configuration space information structure:
pciSlot PCI slot information structure:
pciSlot.dwBus PCI bus number (0 based)
pciSlot.dwSlot PCI slot number (0 based)
pciSlot.dwFunction PCI function number (0 based)
pBuffer A pointer to the data that is read from the PCI configuration space (if fIsRead is TRUE) or a pointer to the data to write to the PCI configuration space (if fIsRead is FALSE)
dwOffset The offset of the specific register(s) in the PCI configuration space to read/write from/to
dwBytes Number of bytes to read/write
fIsRead If TRUE - read from the PCI configuration space;
If FALSE - write to the PCI configuration space
dwResult Result of the PCI configuration space read/write. Can be any of the following PCI_ACCESS_RESULT enumeration values:
$\bullet$PCI_ACCESS_OK - read/write succeeded
$\bullet$PCI_ACCESS_ERROR - read/write failed
$\bullet$PCI_BAD_BUS - the specified bus does not exist
$\bullet$PCI_BAD_SLOT - the specified slot or function does not exist


RETURN VALUE

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


EXAMPLE

WD_PCI_CONFIG_DUMP pciConfig;
DWORD dwStatus;
WORD aBuffer[2];

BZERO(pciConfig);
pciConfig.pciSlot.dwBus = 0;
pciConfig.pciSlot.dwSlot = 3;
pciConfig.pciSlot.dwFunction = 0;
pciConfig.pBuffer = aBuffer;
pciConfig.dwOffset = 0;
pciConfig.dwBytes = sizeof(aBuffer);
pciConfig.fIsRead = TRUE;

dwStatus = WD_PciConfigDump(hWD, &pciConfig);
if (dwStatus)
{
    printf("WD_PciConfigDump failed: %s\n", Stat2Str(dwStatus));
}
else
{
    printf("Card in Bus 0, Slot 3, Funcion 0 has Vendor ID %x "
        "Device ID %x\n", aBuffer[0], aBuffer[1]);
}


next up previous contents
Next: 2.5 WD_PcmciaScanCards() Up: 2. WD_xxx PCI/PCMCIA/ISA Functions Previous: 2.3 WD_PciGetCardInfo()   Contents