## 1394 Diagnostic Tools

### Summary

This document and the associated source code describe how to interact with the WDM 1394 stack. The 1394 Diagnostic Tools consist of two sample WDM Drivers (1394vdev.sys and 1394diag.sys), a API which interfaces to those drivers (1394api.dll) and a user mode application which allows access to the interfaces of the sample driver.

The 1394vdev.sys and 1394diag.sys source codes provide examples of sample drivers interfacing with the upper edge of the WDM 1394 stack. In addition to handling asynchronous and isochronous data transfers, the sample source code demonstrates the correct way to handle Plug and Play and power management I/O Request Packets (IRPs), which are the basic I/O Manager structures used to communicate with the 1394 stack. See the Microsoft® Windows® 2000 DDK for background information on the IRPs discussed in this sample.

The difference between the 1394vdev.sys and 1394diag.sys drivers is how they are enumerated. The 1394vdev.sys driver is meant to be a virtual diagnostic driver that is loaded by using the IOCTL_IEEE1394_API_REQUEST defined in the 1394 DDI section. The 1394diag.sys driver is meant to be a physical diagnostic device driver that is loaded of some actual 1394 device plugged into the PC. In Windows XP 1394vdev.inf is used to load both 1394vdev.sys and 1394diag.sys drivers.

The 1394api.dll source code provides an easy to use mechanism by which the various 1394 DDIs can be accessed. This dll can be used by user mode applications to access various 1394 routines. Also this dll provides mechanisms for implementing loopback routines on both Asynchronous and Isochronous data.

The win1394.exe source code provides examples of a user mode application leveraging the 1394 stack to provide access to all of the various interfaces. Win1394.exe can be used as a sample application which takes advantage of 1394 or as a testing tool to verify the various 1394 interfaces.

### Building the Sample

To build the sample, run the build -c command. Samples must be build individually for each component. The sample will produce four binaries: two WDM drivers (1394vdev.sys and 1394diag.sys), one DLL (1394api.dll), and one EXE (Win1394.exe).

The driver supports Plug and Play and Power Management, and builds properly with Microsoft® Visual C® 6.0. It has undergone extensive testing, and there are no known bugs or issues to report.

### Installing the Sample

### The 1394 DDK samples can be installed by installing the 1394vdev.inf file. This file is located in the \src\wdm\1394\driver\1394vdev directory. This can be done by right-clicking the file and selecting “Install” from the menu selection. This will copy the 1394api.dll file to the windows\system32 directory and the 1394vdev.sys and 1394diag.sys files to the windows\system32\drivers directory. Also this will create the appropriate entries in the registry so when a 1394 diagnostic device (either virtual or physical) is created on the system it will be enumerated and installed silently without user intervention.

### The win1394.exe application requires the 1394api.dll to function properly. If the 1394vdev.inf has been installed this file will already by present in the system directory and no further user intervention will be required.

### To install and use the sample 1394 tool set provided a test device must be used. Previously, any other Windows PC connected via 1394 will enumerated as a 1394 Test Device, but this is no longer true in Windows XP. Now a test device can be loaded virtually via the menu options in win1394.exe or can be loaded physically by putting the 1394 stack into Diagnostic Mode. Once in Diagnostic Mode all devices plugged in will be enumerated as 1394 Test Devices. Diagnostic mode can be enabled/disabled through the win1394.exe menu options.

### CODE TOUR

#### File Manifest

    File           Description

    1394vdev:

1394vdev.c Entry points for 1394vdev driver

1394vdev.h Prototype file for 1394vdev driver

1394vdev.rc Resource file for 1394vdev driver

debug.h Prototype file for debug functions

depend.mk Dependencies files for 1394vdev

ioctl.c Source file for all IOCTLs

makefile Standard DDK build environment makefile

pch.h Prototype file for all external dependencies

pnp.c Source file for all Plug and Play handling

power.c Source file for all Power handling

1394api.c Common source file with 1394diag for general 1394 class DDIs

asyncapi.c Common source file with 1394diag for async related 1394 class DDIs

common.h Common header file with 1394diag for external definitions

isochapi.c Common source file with 1394diag for all isoch 1394 DDIs

util.c Common source file with 1394diag for utility functions

makefile Standard DDK build environment makefile

sources The generic file for building the code sample

    1394diag:

1394diag.c Entry points for 1394diag driver

1394diag.h Prototype file for 1394diag driver

1394diag.rc Resource file for 1394diag driver

debug.h Prototype file for debug functions

depend.mk Dependencies files for 1394diag

ioctl.c Source file for all IOCTLs

makefile Standard DDK build environment makefile

pch.h Prototype file for all external dependencies

pnp.c Source file for all Plug and Play handling

power.c Source file for all Power handling

1394api.c Common source file with 1394vdev for general 1394 class DDIs

asyncapi.c Common source file with 1394vdev for async related 1394 class DDIs

common.h Common header file with 1394vdev for external definitions

isochapi.c Common source file with 1394vdev for all isoch 1394 DDIs

util.c Common source file with 1394vdev for utility functions

makefile Standard DDK build environment makefile

sources The generic file for building the code sample

1394api:

1394api.c Source file for general 1394 API calls

1394main.c Main source file for 1394api DLL

Asyncapi.c Source file for async 1394 API calls

Debug.c Source file for debug

Isochapi.c Source file for isoch 1394 API calls

Utils.c Source file for misc. util functions

Debug.h Prototype file for debug

Local.h Prototype file for local dependencies

Pch.h Prototype file for external dependencies

Util.h Prototype file for util functions

1394api.rc Resource file for 1394api DLL.

1394api.def Definition file for 1394api DLL

makefile Standard DDK build environment makefile

sources The generic file for building the code sample

Win1394:

1394.c Source file for general 1394 calls

Async.c Source file for async 1394 calls

Debug.c Source file for debug calls

Isoch.c Source file for isoch 1394 calls

Util.c Source file for util functions

Win1394.c Main source file for win1394 executable

Win1394.rc Resource file for win1394 executable

1394.h Prototype file for 1394.c

Async.h Prototype file for Async.c

Debug.h Prototype file for Debug.c

Isoch.h Prototype file for Isoch.c

Local.h Prototype file for local dependencies

Pch.h Prototype file for external dependencies

Resource.h Prototype file for win1394 executable resources

Util.h Prototype file for Util.c

Win1394.ico Icon file for 1394

makefile Standard DDK build environment makefile

sources The generic file for building the code sample

Top of page

© 1999 Microsoft Corporation