Reads/writes from/to the PCI configuration space of a selected PCI card or the extended configuration space of a selected PCI Express card.
![]() | |
| Access to the PCI Express extended configuration space is supported on target platforms that support such access (e.g., Windows and Linux). For such platforms, all PCI references in the following documentation include PCI Express as well. |
DWORD WD_PciConfigDump(
HANDLE hWD,
WD_PCI_CONFIG_DUMP *pConfig);
| Name | Type | Input/Output |
|---|---|---|
| hWD | HANDLE | Input |
| pConfig | WD_PCI_CONFIG_DUMP* | |
| • pciSlot | WD_PCI_SLOT | |
| * dwBus | DWORD | Input |
| * dwSlot | DWORD | Input |
| * dwFunction | DWORD | Input |
| • pBuffer | PVOID | Input/Output |
| • dwOffset | DWORD | Input |
| • dwBytes | DWORD | Input |
| • fIsRead | DWORD | Input |
| • dwResult | DWORD | Output |
| Name | Description |
|---|---|
| hWD | Handle to WinDriver's kernel-mode driver as
received from WD_Open() |
| pConfig | Pointer to a PCI configuration space information structure: |
| • pciSlot | PCI slot information structure: |
| * dwBus | PCI bus number (0 based) |
| * dwSlot | PCI slot number (0 based) |
| * 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:• PCI_ACCESS_OK — read/write succeeded• PCI_ACCESS_ERROR — read/write failed• PCI_BAD_BUS — the specified bus does not exist
• PCI_BAD_SLOT — the specified slot or function
does not exist
|
Returns WD_STATUS_SUCCESS (0) on success, or an appropriate
error code otherwise
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]);
}