86 lines
4.2 KiB
HTML
86 lines
4.2 KiB
HTML
|
<HTML>
|
||
|
<HEAD>
|
||
|
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-
|
||
|
1252">
|
||
|
<META NAME="Generator" CONTENT="Microsoft FrontPage 5.0">
|
||
|
<TITLE>Bulk Usb</TITLE>
|
||
|
</HEAD>
|
||
|
<BODY LINK="#0000ff">
|
||
|
|
||
|
<p><b><font face="Times New Roman">The Bulkusb driver</font></b></p>
|
||
|
<ul>
|
||
|
<li><font face="Times New Roman">The bulkusb driver is a generic 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 DDK
|
||
|
sample. 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>
|
||
|
<p><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
|
||
|
64 KB circular buffer. None of the code in the sample is specific to this
|
||
|
controller chip. </font></p>
|
||
|
</li>
|
||
|
</ul>
|
||
|
<p><font face="Times New Roman">The bulkusb.sys is a minidriver that transfers
|
||
|
asynchronous bulk data packets to and from this board. The USB Request Block (URBs)
|
||
|
allow an abstracted chip-independent transfer to and from the core USB stack. The
|
||
|
sample also consists of a console application</font></p>
|
||
|
<p><font face="Times New Roman">The section below describes the driver routines
|
||
|
that allow a user-mode application to perform bulk reads and writes.</font></p>
|
||
|
<p><b>Bulkusb Reads/Writes</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">BulkUsb_DispatchCreate()</font></td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td width="50%"><font face="Courier New">IRP_MJ_CLOSE</font></td>
|
||
|
<td width="50%"><font face="Courier New">BulkUsb_DispatchClose()</font></td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td width="50%"><font face="Courier New">IRP_MJ_READ</font></td>
|
||
|
<td width="50%"><font face="Courier New">BulkUsb_DispatchReadWrite()</font></td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td width="50%"><font face="Courier New">IRP_MJ_WRITE</font></td>
|
||
|
<td width="50%"><font face="Courier New">BulkUsb_DispatchReadWrite()</font></td>
|
||
|
</tr>
|
||
|
</table>
|
||
|
<p>Notes</p>
|
||
|
<ul>
|
||
|
<li>The <font face="Courier New">BulkUsb_DispatchCreate</font> allows
|
||
|
user-mode app to open handles to the device or to a specific pipe.</li>
|
||
|
<li>The pipe # 3 and pipe # 4 correspond to the bulk IN and bulk OUT pipes on
|
||
|
the I82930 board respectively.
|
||
|
The driver does not hard-code the pipe # for reads and writes.</li>
|
||
|
<li>The <font face="Courier New">BulkUsb_DispatchClose</font> closes open handle to a specific pipe and the
|
||
|
device.</li>
|
||
|
</ul>
|
||
|
<p><font face="Times New Roman">The </font><font face="Courier New">BulkUsb_DispatchReadWrite</font><font face="Times New Roman">,
|
||
|
transforms the </font>original read/write request into an internal device
|
||
|
control request, creates and initializes an URB for this request and sets a completion routine for this
|
||
|
request (<font face="Courier New">BulkUsb_ReadWriteCompletion)</font><font face="Times New Roman">.
|
||
|
</font>The amount of data transferred is
|
||
|
limited by the BULKUSB_MAX_TRANSFER_SIZE (64KB circular buffer limitation). For additional data
|
||
|
transfers, the request (Irp/Urb
|
||
|
pair) is re-initialized and re-submitted in the completion routine.</p>
|
||
|
<p>Since the driver does not save the read-write context information anywhere in the
|
||
|
driver, but passes it along to the completion routine, it is multi-threaded safe.</p>
|
||
|
<p>Please refer the detailed inline comments in the bulkusb driver for
|
||
|
implementation details.</p>
|
||
|
<p>The rwbulk.exe console application is used to initiate bulk transfers 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>
|
||
|
<p> </p>
|
||
|
<p> </p>
|
||
|
<p> </p>
|
||
|
</BODY>
|
||
|
</HTML>
|