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.
Access to the PCI Express extended configuaration space is supported on
target platforms that support such access (e.g.
Windows, Linux, Solaris 10+).
On such platforms, 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 | Handle to WinDriver's kernel-mode driver as received from WD_Open() [5.2] |
| pConfig | Pointer to a PCI configuration space information structure: |
| PCI slot information structure: | |
| PCI bus number (0 based) | |
| PCI slot number (0 based) | |
| PCI function number (0 based) | |
| 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) | |
| The offset of the specific register(s) in the PCI configuration space to read/write from/to | |
| Number of bytes to read/write | |
| If TRUE - read from the PCI configuration
space; If FALSE - write to the PCI configuration space |
|
| 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]);
}