SAMPLE: PCIDMA.exe PCI Busmaster DMA Driver (185075)



The information in this article applies to:

  • Microsoft Win32 Device Driver Kit (DDK) for Windows NT 4.0
  • Microsoft Win32 Device Driver Kit (DDK) for Windows NT 3.51

This article was previously published under Q185075

SUMMARY

Pcidma.exe is a sample that contains a PCI busmaster DMA driver sample (packet-based) and a Win32 console-mode test application.

MORE INFORMATION

The following file is available for download from the Microsoft Download Center:
Release Date: Apr-30-1998

For additional information about how to download Microsoft Support files, click the following article number to view the article in the Microsoft Knowledge Base:

119591 How to Obtain Microsoft Support Files from Online Services

Microsoft scanned this file for viruses. Microsoft used the most current virus-detection software that was available on the date that the file was posted. The file is stored on security-enhanced servers that help to prevent any unauthorized changes to the file.

This sample driver is a template for a PCI busmaster DMA device that generates interrupts. Included is a small Win32 console mode application that sends I/O requests to the driver.

The code assumes a single I/O per interrupt. If more than one I/O per interrupt is to be supported, the driver must be modified. Also, when the interrupt fires, the driver checks for a current I/O. If there is not a current I/O, the ISR only clears the interrupt. If you want a DPC to run even if there is no current I/O, you will have to change the driver design.

Important Note

This sample driver implements specific PCI SCSI registers, for a specific PCI vendor. Before using this driver, insure that the vendor-specific portions of the code have been removed or modified. Failure to take these precautions could cause a working system to fail unexpectedly.

All the vendor unique code should have been identified with a VENDOR_UNIQUE comment. If you are using this code, you are responsible for insuring that the code does not cause undesired side-effects.

The PciDma.sys driver is not a replacement SCSI driver.

The sample driver cannot run at the same time as the Symbios Logic SCSI driver -- only one or the other driver will run. If the SCSI driver is used to control the boot device, the PciDma.sys driver should not be used or the system may become unbootable. Do not disable the SCSI driver unless you are sure it is not needed to boot.

Build Instructions

To run the sample:
  1. Build the driver and Win32 test application. See the DDK documentation for details on creating drivers and Win32 applications from the DDK Build Environment.
  2. Copy the driver to the test computer. PciDma.sys goes into %systemroot%\system32\drivers directory on the test computer.
  3. Add the driver to the test computer's registry. Using Windows Explorer, right-click the PciDma.reg file and select Merge. Restart your computer to update the cached registry information.
  4. Restart your computer.
  5. Start the driver. After restarting your computer, you can start the driver from the Command Prompt window by typing "net start pcidma". The driver can also be started by going to the Control Panel, opening Devices, highlighting the PciDma driver in the Devices dialog box, and clicking Start.
  6. Run the test program. The test program requires parameters to run. From the Command Prompt window, run the test program without parameters to see the required switches.

Symbios Logic 53c815 Implementation Details

This section provides information about how this driver controls the Symbios Logic PCI SCSI device.

For simplicity, the driver sets up a hardware timer on the Symbios 53c815. When the hardware timer fires, the PCI device interrupts the CPU. The driver ISR runs, queues the DPC, and the DPC completes a single pending I/O. This driver was created to support only one I/O per interrupt.

This sample driver doesn't actually DMA data to the user buffer. However, the code to prepare the buffers for DMA transfer has been extracted from several working drivers.

The specific registers that are used to control functionality are documented in the hardware specifications available from Symbios Logic.

Modification Type:MinorLast Reviewed:3/21/2005
Keywords:kbfile kbSample KB185075 kbAudDeveloper