## The PKTDMA Sample

The PKTDMA Sample accompanies Chapter 7 and illustrates how to perform a DMA transfer with a bus-mastering PCI device.

The sample includes two components:

- PKTDMA.SYS (SYS subdirectory) is a WDM driver for a simulated device based on the AMCC S5933 chip.
- TEST.EXE (TEST subdirectory) is a Win32 console application that tests the PKTDMA driver.

### Building PKTDMA

To build PKTDMA.SYS, follow the general instructions for building a WDM sample. The Microsoft Visual C++ project file is named PKTDMA.DSP.

To build TEST.EXE, follow the general instructions for building user-mode programs. The Microsoft Visual C++ project file is named TEST.DSP in the TEST subdirectory.

### Testing PKTDMA

I recommend installing and testing the PCI42 sample first. The instructions for PCI42 explain how to install the PCI and ISA cards that are part of the AMCC S5933DK1 development kit and how to install the S5933DK1.SYS driver for the ISA card.

If you follow the suggestion of trying out PCI42 first, you can use the Device Manager to update the driver for the S5933 development board. Point the installer to the PKTDMA\SYS subdirectory for the PKTDMA.INF installation file.

With both the S5933DK1 and PKTDMA drivers installed, open a command prompt and run TEST.EXE from the TEST\DEBUG subdirectory. TEST will write data to the PCI card and read the same data from the associated ISA card. The PKTDMA driver uses DMA to accomplish the transfer.

### What to look for

ReadWrite.cpp in the sys directory contains the code for doing DMA transfers to the development board. Read the routines named StartIo, AdapterControl, OnInterrupt, and DpcForIsr.