Technical Document #76

Technical Document #76
How do I perform PCI DMA Writes from system memory to my card, using WinDriver?

Your device needs to be PCI DMA Master Capable.
After locating and registering your PCI card (using WD_PciScanCards(), WD_PciGetCardInfo() and WD_CardRegister()), you need to lock a memory buffer. To do this, call WD_DMALock() to lock a memory buffer in the kernel and receive an array of pages (dma.dwPages) representing the physical address/es of your buffer.
(For contiguous-buffer DMA the array will contain a single page.)

For more information regarding DMA handling and the related APIs, refer to the WinDriver PCI User's Manual.
The newer versions of WinDriver use the high-level WDC APIs, and document the low-level WD_XXX APIs in the WinDriver PCI Low-Level API Reference.
The manuals for your version are available in the docs/ directory of your WinDriver installation.

Now it is up to you to program your bus-master device with the page list and send a command for your card to start the transfer.
Programming a PCI device for DMA transfer is device specific.
Examples of DMA functions, using our API, can be found in the special WinDriver libraries for the enhanced WinDriver supported PCI chip sets for major PCI chip vendors, such as PLX, Altera, and Xilinx; (see the WinDriver PCI User's Manual for more information regarding this enhanced support).

At the end of the transfer you should call WD_DMAUnlock() to release the buffer's locked physical memory.