161 lines
8.7 KiB
HTML
161 lines
8.7 KiB
HTML
|
<HTML>
|
||
|
<HEAD>
|
||
|
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-
|
||
|
1252">
|
||
|
<META NAME="Generator" CONTENT="Microsoft FrontPage 5.0">
|
||
|
<TITLE>Iso Usb</TITLE>
|
||
|
</HEAD>
|
||
|
<BODY LINK="#0000ff">
|
||
|
|
||
|
<p><b><font face="Times New Roman">The Isousb driver</font></b></p>
|
||
|
<ul>
|
||
|
<li><font face="Times New Roman">The isousb driver is function driver, based on the
|
||
|
Windows Driver Model (WDM).</font></li>
|
||
|
<li><font face="Times New Roman">Supports Plug and Play(PnP), Power
|
||
|
Management(PM), Windows Management Instrumentation (WMI) and the Selective
|
||
|
Suspend (SS) features.</font></li>
|
||
|
<li><font face="Times New Roman">This sample is based off the selSusp sample
|
||
|
in the DDK. Please refer the selSusp sample and the DDK docs to understand the
|
||
|
handling of PnP, PM, WMI and SS features and implementations.</font></li>
|
||
|
<li><font face="Times New Roman">The USB device used for this sample is a
|
||
|
generic Intel I82930 USB evaluation board programmed with a simple loopback
|
||
|
test using a 64KB circular buffer. None of the code in the sample is specific
|
||
|
to this controller chip</font></li>
|
||
|
</ul>
|
||
|
<p><font face="Times New Roman">This section describes the driver routines that
|
||
|
allow a user-mode application to perform isoch reads and writes or stream
|
||
|
transfers. The isoch read/write is performed by opening a handle to the device
|
||
|
and using the standard Win32 Read/Write command. The stream transfer is a
|
||
|
continuous streaming of isoch IN data which can be explicitly initiated/stopped
|
||
|
using the driver-supported IOCTLs from the user application.</font></p>
|
||
|
<p><b>Isousb Reads/Writes and Stream Transfers<br>
|
||
|
</b></p>
|
||
|
<table border="1" width="68%">
|
||
|
<tr>
|
||
|
<td width="50%"><font face="Courier New">Requests</font></td>
|
||
|
<td width="50%"><font face="Courier New">Dispatch Routines</font></td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td width="50%"><font face="Courier New">IRP_MJ_CREATE</font></td>
|
||
|
<td width="50%"><font face="Courier New">IsoUsb_DispatchCreate()</font></td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td width="50%"><font face="Courier New">IRP_MJ_CLOSE</font></td>
|
||
|
<td width="50%"><font face="Courier New">IsoUsb_DispatchClose()</font></td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td width="50%"><font face="Courier New">IRP_MJ_READ</font></td>
|
||
|
<td width="50%"><font face="Courier New">IsoUsb_DispatchReadWrite()</font></td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td width="50%"><font face="Courier New">IRP_MJ_WRITE</font></td>
|
||
|
<td width="50%"><font face="Courier New">IsoUsb_DispatchReadWrite()</font></td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td width="50%"><font face="Courier New">IOCTL_ISOUSB_START_ISO_STREAM</font></td>
|
||
|
<td width="50%"><font face="Courier New">IsoUsb_StartIsoStream()</font></td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td width="50%"><font face="Courier New">IOCTL_ISOUSB_STOP_ISO_STREAM</font></td>
|
||
|
<td width="50%"><font face="Courier New">IsoUsb_StopIsoStream()</font></td>
|
||
|
</tr>
|
||
|
</table>
|
||
|
<p>Notes</p>
|
||
|
<ul>
|
||
|
<li>The <font face="Courier New">IsoUsb_DispatchCreate()</font> allows a user-mode app. to open handles to the
|
||
|
device or to the pipe.</li>
|
||
|
<li>Pipe # 5 and Pipe # 6 correspond to the Isoch IN and Isoch OUT
|
||
|
respectively. The driver does not hard-code the pipe # for reads and writes.</li>
|
||
|
<li>The <font face="Courier New">IsoUsb_DispatchClose()</font> closes the
|
||
|
handles to the pipe or the device</li>
|
||
|
</ul>
|
||
|
<p><b>Stream Transfers</b></p>
|
||
|
<ul>
|
||
|
<li>The driver routines which implement this functionality are:<br>
|
||
|
<font face="Courier New">IsoUsb_StartIsoStream()<br>
|
||
|
IsoUsb_StopIsoStream()<br>
|
||
|
IsoUsb_InitializeStreamUrb()<br>
|
||
|
IsoUsb_IsoIrp_Complete()<br>
|
||
|
IsoUsb_ProcessTransfer()<br>
|
||
|
IsoUsb_StreamObjectCleanup()<br>
|
||
|
</font></li>
|
||
|
<li>The stream transfer can be initiated from a device control request.</li>
|
||
|
<li>The stream transfer comprises of continuous streaming IN of data.</li>
|
||
|
<li>The stream transfer circulates <font face="Courier New">ISOUSB_MAX_IRP</font>
|
||
|
number of requests at any time.</li>
|
||
|
<li>The stream transfer stops on receiving an explicit device control
|
||
|
request or when the user-mode app. terminates or stops.</li>
|
||
|
<li>The stream transfer context information is maintained in the <font face="Courier New">ISOUSB_STREAM_OBJECT</font>
|
||
|
structure. This structure is saved in the FileObject pointer.</li>
|
||
|
<li>There are ISOUSB_MAX_IRP number of Irp/Urb pairs which are re-circulated
|
||
|
and used for transfers. The ISOUSB_TRANSFER_OBJECT structure maintains
|
||
|
context information for each of the Irp/Urb pair.</li>
|
||
|
<li><font face="Times New Roman">In order to stop or abort the transfer, the
|
||
|
routine </font><font face="Courier New">IsoUsb_StreamObjectCleanup</font><font face="Times New Roman">
|
||
|
cancels the re-circulating Irps and waits on an event triggered by the
|
||
|
completion routine for the last cancelled Irp. Thereafter, it proceeds to
|
||
|
release memory allocation for the stream object and the transfer objects.</font></li>
|
||
|
<li><font face="Times New Roman">Since the driver saves the stream object
|
||
|
structure in the FileObject, it is multi-threaded safe accross applications,
|
||
|
but with a major caveat. The user applications should not use the same handle
|
||
|
to initiate multiple stream transfers. This functionality can be easily
|
||
|
supported by forming a list of stream-object structures in the FileObject
|
||
|
(rather than storing a single stream object structure). </font></li>
|
||
|
</ul>
|
||
|
<p><b>Isoch Reads/Writes</b></p>
|
||
|
<ul>
|
||
|
<li><font face="Times New Roman">The Isoch read/write transfer requires an Irp/Urb
|
||
|
pair with the function code of URB_FUNCTION_ISOCH_TRANSFER.</font></li>
|
||
|
<li>There is an upper bound on the number of packets that can be transferred
|
||
|
with each of the Irp/Urb pair and is given as 255. This calls for creating
|
||
|
multiple subsidiary Irp/Urb pairs to transfer the requested length of data.</li>
|
||
|
<li><font face="Times New Roman">The </font><font face="Courier New">IsoUsb_DispatchReadWrite</font><font face="Times New Roman">
|
||
|
creates the required number of subsidiary Irp/Urb pairs,
|
||
|
initializes them and sets a completion routine (</font><font face="Courier New">IsoUsb_SinglePairComplete</font><font face="Times New Roman">)
|
||
|
for each of the Irp in the pair </font></li>
|
||
|
<li>The dispatch routine sets <font face="Times New Roman">a cancellation
|
||
|
routine (</font><font face="Courier New">IsoUsb_CancelReadWrite</font><font face="Times New Roman">)
|
||
|
for the original read/write Irp and pends the Irp.</font></li>
|
||
|
<li><font face="Times New Roman">The dispatch routine now passes the
|
||
|
subsidiary Irp/Urb pair down the stack.</font></li>
|
||
|
<li>It is possible to abort the read/write transfers at any point. It is the
|
||
|
responsibility of the driver to cancel/free the Irp/Urb pairs, release all
|
||
|
resources and terminate gracefully.</li>
|
||
|
<li><font face="Times New Roman">The </font><font face="Courier New">IsoUsb_DispatchReadWrite,
|
||
|
IsoUsb_SinglePairComplete
|
||
|
</font><font face="Times New Roman">and
|
||
|
</font><font face="Courier New">IsoUsb_CancelReadWrite</font><font face="Times New Roman">
|
||
|
routines are well annotated with comments to aid understanding.</font></li>
|
||
|
<li><font face="Times New Roman">Since the driver does not save the read-write
|
||
|
context information in the driver, but passes it to the completion routine, it
|
||
|
is multithreaded safe.</font></li>
|
||
|
</ul>
|
||
|
<p><b><font face="Times New Roman">High Speed Isoch Reads/Writes</font></b></p>
|
||
|
<ul>
|
||
|
<li><font face="Times New Roman">The DDK sample has been updated for high
|
||
|
speed isoch transfers.</font></li>
|
||
|
<li><font face="Times New Roman">There are two significant differences between
|
||
|
high speed and full speed transfers:<br>
|
||
|
a. The upper bound on the number of packets that can be transferred with each
|
||
|
Irp/Urb pair is 1024.<br>
|
||
|
b. The number of packets sent down with each Irp/Urb pair should be a multiple
|
||
|
of 8.</font></li>
|
||
|
<li><font face="Times New Roman">The </font><font face="Courier New">
|
||
|
PerformHighSpeedIsochTransfer</font><font face="Times New Roman"> gives one
|
||
|
implementation of creating multiple of 8 packets.</font></li>
|
||
|
</ul>
|
||
|
<p><b><font face="Times New Roman">Known Bugs</font></b></p>
|
||
|
<ul>
|
||
|
<li><font face="Times New Roman">When the Intel I82930 evaluation board is
|
||
|
used to perform loopback transfers with OUT transfers not in multiple of 8,
|
||
|
the IN pipe is stalled. This can be attributed to the firmware error.
|
||
|
Resetting the pipe does not solve this problem. This requires reconfiguring
|
||
|
the device or driver unload/load. </font></li>
|
||
|
</ul>
|
||
|
<p><b>RwIso.exe</b></p>
|
||
|
<p>RwIso.exe is a console application used to initiate isochronous transfer and
|
||
|
obtain a dump of information on the device's I/O endpoints. The application also
|
||
|
demonstrates how to use GUID-based device names and pipe names generated by the
|
||
|
operating system using the SetupDiXXX user-mode APIs.</p>
|
||
|
</BODY>
|
||
|
</HTML>
|