PURPOSE
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 |
|---|---|---|
| HANDLE | Input | |
| WD_PCI_CONFIG_DUMP* | ||
| WD_PCI_SLOT | ||
| DWORD | Input | |
| DWORD | Input | |
| DWORD | Input | |
| PVOID | Input/Output | |
| DWORD | Input | |
| DWORD | Input | |
| DWORD | Input | |
| 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: |
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]);
}