Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

160 lines
8.7 KiB

  1. <HTML>
  2. <HEAD>
  3. <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-
  4. 1252">
  5. <META NAME="Generator" CONTENT="Microsoft FrontPage 5.0">
  6. <TITLE>Iso Usb</TITLE>
  7. </HEAD>
  8. <BODY LINK="#0000ff">
  9. <p><b><font face="Times New Roman">The Isousb driver</font></b></p>
  10. <ul>
  11. <li><font face="Times New Roman">The isousb driver is function driver, based on the
  12. Windows Driver Model (WDM).</font></li>
  13. <li><font face="Times New Roman">Supports Plug and Play(PnP), Power
  14. Management(PM), Windows Management Instrumentation (WMI) and the Selective
  15. Suspend (SS) features.</font></li>
  16. <li><font face="Times New Roman">This sample is based off the selSusp sample
  17. in the DDK. Please refer the selSusp sample and the DDK docs to understand the
  18. handling of PnP, PM, WMI and SS features and implementations.</font></li>
  19. <li><font face="Times New Roman">The USB device used for this sample is a
  20. generic Intel I82930 USB evaluation board programmed with a simple loopback
  21. test using a 64KB circular buffer. None of the code in the sample is specific
  22. to this controller chip</font></li>
  23. </ul>
  24. <p><font face="Times New Roman">This section describes the driver routines that
  25. allow a user-mode application to perform isoch reads and writes or stream
  26. transfers. The isoch read/write is performed by opening a handle to the device
  27. and using the standard Win32 Read/Write command. The stream transfer is a
  28. continuous streaming of isoch IN data which can be explicitly initiated/stopped
  29. using the driver-supported IOCTLs from the user application.</font></p>
  30. <p><b>Isousb Reads/Writes and Stream Transfers<br>
  31. </b></p>
  32. <table border="1" width="68%">
  33. <tr>
  34. <td width="50%"><font face="Courier New">Requests</font></td>
  35. <td width="50%"><font face="Courier New">Dispatch Routines</font></td>
  36. </tr>
  37. <tr>
  38. <td width="50%"><font face="Courier New">IRP_MJ_CREATE</font></td>
  39. <td width="50%"><font face="Courier New">IsoUsb_DispatchCreate()</font></td>
  40. </tr>
  41. <tr>
  42. <td width="50%"><font face="Courier New">IRP_MJ_CLOSE</font></td>
  43. <td width="50%"><font face="Courier New">IsoUsb_DispatchClose()</font></td>
  44. </tr>
  45. <tr>
  46. <td width="50%"><font face="Courier New">IRP_MJ_READ</font></td>
  47. <td width="50%"><font face="Courier New">IsoUsb_DispatchReadWrite()</font></td>
  48. </tr>
  49. <tr>
  50. <td width="50%"><font face="Courier New">IRP_MJ_WRITE</font></td>
  51. <td width="50%"><font face="Courier New">IsoUsb_DispatchReadWrite()</font></td>
  52. </tr>
  53. <tr>
  54. <td width="50%"><font face="Courier New">IOCTL_ISOUSB_START_ISO_STREAM</font></td>
  55. <td width="50%"><font face="Courier New">IsoUsb_StartIsoStream()</font></td>
  56. </tr>
  57. <tr>
  58. <td width="50%"><font face="Courier New">IOCTL_ISOUSB_STOP_ISO_STREAM</font></td>
  59. <td width="50%"><font face="Courier New">IsoUsb_StopIsoStream()</font></td>
  60. </tr>
  61. </table>
  62. <p>Notes</p>
  63. <ul>
  64. <li>The <font face="Courier New">IsoUsb_DispatchCreate()</font> allows a user-mode app. to open handles to the
  65. device or to the pipe.</li>
  66. <li>Pipe # 5 and Pipe # 6 correspond to the Isoch IN and Isoch OUT
  67. respectively. The driver does not hard-code the pipe # for reads and writes.</li>
  68. <li>The <font face="Courier New">IsoUsb_DispatchClose()</font> closes the
  69. handles to the pipe or the device</li>
  70. </ul>
  71. <p><b>Stream Transfers</b></p>
  72. <ul>
  73. <li>The driver routines which implement this functionality are:<br>
  74. <font face="Courier New">IsoUsb_StartIsoStream()<br>
  75. IsoUsb_StopIsoStream()<br>
  76. IsoUsb_InitializeStreamUrb()<br>
  77. IsoUsb_IsoIrp_Complete()<br>
  78. IsoUsb_ProcessTransfer()<br>
  79. IsoUsb_StreamObjectCleanup()<br>
  80. </font></li>
  81. <li>The stream transfer can be initiated from a device control request.</li>
  82. <li>The stream transfer comprises of continuous streaming IN of data.</li>
  83. <li>The stream transfer circulates <font face="Courier New">ISOUSB_MAX_IRP</font>
  84. number of requests at any time.</li>
  85. <li>The stream transfer stops on receiving an explicit device control
  86. request or when the user-mode app. terminates or stops.</li>
  87. <li>The stream transfer context information is maintained in the <font face="Courier New">ISOUSB_STREAM_OBJECT</font>
  88. structure. This structure is saved in the FileObject pointer.</li>
  89. <li>There are ISOUSB_MAX_IRP number of Irp/Urb pairs which are re-circulated
  90. and used for transfers. The ISOUSB_TRANSFER_OBJECT structure maintains
  91. context information for each of the Irp/Urb pair.</li>
  92. <li><font face="Times New Roman">In order to stop or abort the transfer, the
  93. routine </font><font face="Courier New">IsoUsb_StreamObjectCleanup</font><font face="Times New Roman">
  94. cancels the re-circulating Irps and waits on an event triggered by the
  95. completion routine for the last cancelled Irp. Thereafter, it proceeds to
  96. release memory allocation for the stream object and the transfer objects.</font></li>
  97. <li><font face="Times New Roman">Since the driver saves the stream object
  98. structure in the FileObject, it is multi-threaded safe accross applications,
  99. but with a major caveat. The user applications should not use the same handle
  100. to initiate multiple stream transfers. This functionality can be easily
  101. supported by forming a list of stream-object structures in the FileObject
  102. (rather than storing a single stream object structure). </font></li>
  103. </ul>
  104. <p><b>Isoch Reads/Writes</b></p>
  105. <ul>
  106. <li><font face="Times New Roman">The Isoch read/write transfer requires an Irp/Urb
  107. pair with the function code of URB_FUNCTION_ISOCH_TRANSFER.</font></li>
  108. <li>There is an upper bound on the number of packets that can be transferred
  109. with each of the Irp/Urb pair and is given as 255. This calls for creating
  110. multiple subsidiary Irp/Urb pairs to transfer the requested length of data.</li>
  111. <li><font face="Times New Roman">The </font><font face="Courier New">IsoUsb_DispatchReadWrite</font><font face="Times New Roman">
  112. creates the required number of subsidiary Irp/Urb pairs,
  113. initializes them and sets a completion routine (</font><font face="Courier New">IsoUsb_SinglePairComplete</font><font face="Times New Roman">)
  114. for each of the Irp in the pair&nbsp;</font></li>
  115. <li>The dispatch routine sets <font face="Times New Roman">a cancellation
  116. routine (</font><font face="Courier New">IsoUsb_CancelReadWrite</font><font face="Times New Roman">)
  117. for the original read/write Irp and pends the Irp.</font></li>
  118. <li><font face="Times New Roman">The dispatch routine now passes the
  119. subsidiary Irp/Urb pair down the stack.</font></li>
  120. <li>It is possible to abort the read/write transfers at any point. It is the
  121. responsibility of the driver to cancel/free the Irp/Urb pairs, release all
  122. resources and terminate gracefully.</li>
  123. <li><font face="Times New Roman">The </font><font face="Courier New">IsoUsb_DispatchReadWrite,
  124. IsoUsb_SinglePairComplete
  125. </font><font face="Times New Roman">and
  126. </font><font face="Courier New">IsoUsb_CancelReadWrite</font><font face="Times New Roman">
  127. routines are well annotated with comments to aid understanding.</font></li>
  128. <li><font face="Times New Roman">Since the driver does not save the read-write
  129. context information in the driver, but passes it to the completion routine, it
  130. is multithreaded safe.</font></li>
  131. </ul>
  132. <p><b><font face="Times New Roman">High Speed Isoch Reads/Writes</font></b></p>
  133. <ul>
  134. <li><font face="Times New Roman">The DDK sample has been updated for high
  135. speed isoch transfers.</font></li>
  136. <li><font face="Times New Roman">There are two significant differences between
  137. high speed and full speed transfers:<br>
  138. a. The upper bound on the number of packets that can be transferred with each
  139. Irp/Urb pair is 1024.<br>
  140. b. The number of packets sent down with each Irp/Urb pair should be a multiple
  141. of 8.</font></li>
  142. <li><font face="Times New Roman">The </font><font face="Courier New">
  143. PerformHighSpeedIsochTransfer</font><font face="Times New Roman"> gives one
  144. implementation of creating multiple of 8 packets.</font></li>
  145. </ul>
  146. <p><b><font face="Times New Roman">Known Bugs</font></b></p>
  147. <ul>
  148. <li><font face="Times New Roman">When the Intel I82930 evaluation board is
  149. used to perform loopback transfers with OUT transfers not in multiple of 8,
  150. the IN pipe is stalled. This can be attributed to the firmware error.
  151. Resetting the pipe does not solve this problem. This requires reconfiguring
  152. the device or driver unload/load. </font></li>
  153. </ul>
  154. <p><b>RwIso.exe</b></p>
  155. <p>RwIso.exe is a console application used to initiate isochronous transfer and
  156. obtain a dump of information on the device's I/O endpoints. The application also
  157. demonstrates how to use GUID-based device names and pipe names generated by the
  158. operating system using the SetupDiXXX user-mode APIs.</p>
  159. </BODY>
  160. </HTML>