First, locate the slot to which your card is connected, using
Then get the card’s information by calling
This information includes the memory range chosen for the card by the Plug and Play system.
WD_CardRegister() to install the memory range and map it into both kernel and user mode virtual address spaces.
You can then either access the memory directly from your user mode application (more efficient), by using the user mode mapping of the physical address — returned by
cardReg.Card.Item[i].I.Mem.pUserDirectAddr (where ‘i’ is the index number of the memory range in the
Item array) — or pass the kernel mode mapping of the memory — returned by
cardReg.Card.Item[i].I.Mem.pTransAddr — to
WD_MultiTransfer()), in order to access the memory in the kernel.
This is demonstrated, for example, in the sample code found in the
WinDriver/samples/pci_diag directory, and in the diagnostics DriverWizard code that you can generate for your PCI card.
Please also refer to the description of the WinDriver PCI API in the WinDriver PCI Low-Level API Reference (available under theWinDriver/doc/ directory) or in the Function Reference chapter of the WinDriver User’s Manual (in earlier versions) for a better understanding of these functions and the related structures.
NOTE: To access memory directly in the kernel, from within aKernel PlugIn project, you must use the kernel mode mapping of the physical memory address — returned by
cardReg.Card.Item[i].I.Mem.pTransAddr — and not the user mode mapping that is used to access the memory directly from your user-mode application.
The API references in this document may not match the API in earlier versions of WinDriver. In version 11.8.0 the following
WD_ITEMS I.Memfield name and type changes were made: