usbhost.h 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896
  1. /*++
  2. Copyright (c) 2013 Minoca Corp.
  3. This file is licensed under the terms of the GNU General Public License
  4. version 3. Alternative licensing terms are available. Contact
  5. info@minocacorp.com for details. See the LICENSE file at the root of this
  6. project for complete licensing information.
  7. Module Name:
  8. usbhost.h
  9. Abstract:
  10. This header contains USB Core library support for host controllers.
  11. Author:
  12. Evan Green 15-Jan-2013
  13. --*/
  14. //
  15. // ------------------------------------------------------------------- Includes
  16. //
  17. #include <minoca/usb/usb.h>
  18. //
  19. // ---------------------------------------------------------------- Definitions
  20. //
  21. //
  22. // Define the current version of the USB host controller interface.
  23. //
  24. #define USB_HOST_CONTROLLER_INTERFACE_VERSION 1
  25. //
  26. // Define the current version of the USB endpoint creation request structure.
  27. //
  28. #define USB_HOST_ENDPOINT_CREATION_REQUEST_VERSION 1
  29. //
  30. // Define the standard USB PID values.
  31. //
  32. #define USB_PID_OUT 0xE1
  33. #define USB_PID_IN 0x69
  34. #define USB_PID_SOF 0xA5
  35. #define USB_PID_SETUP 0x2D
  36. #define USB_PID_DATA0 0xC3
  37. #define USB_PID_DATA1 0x4B
  38. #define USB_PID_DATA2 0x87
  39. #define USB_PID_MDATA 0x0F
  40. #define USB_PID_ACK 0xD2
  41. #define USB_PID_NAK 0x5A
  42. #define USB_PID_STALL 0x1E
  43. #define USB_PID_NYET 0x96
  44. #define USB_PID_PRE 0x3C
  45. #define USB_PID_ERR 0x3C
  46. #define USB_PID_SPLIT 0x78
  47. #define USB_PID_PING 0xB4
  48. //
  49. // Define USB port status bits. These do not correspond directly to any defined
  50. // bits in the USB hub specification.
  51. //
  52. #define USB_PORT_STATUS_CONNECTED 0x0001
  53. #define USB_PORT_STATUS_ENABLED 0x0002
  54. #define USB_PORT_STATUS_SUSPENDED 0x0004
  55. #define USB_PORT_STATUS_OVER_CURRENT 0x0008
  56. #define USB_PORT_STATUS_RESET 0x0010
  57. //
  58. // Define USB port status change bits. These do not correspond directly to any
  59. // defined bits in the USB hub specification. They correspond 1-to-1 with their
  60. // respective status bits.
  61. //
  62. #define USB_PORT_STATUS_CHANGE_CONNECTED USB_PORT_STATUS_CONNECTED
  63. #define USB_PORT_STATUS_CHANGE_ENABLED USB_PORT_STATUS_ENABLED
  64. #define USB_PORT_STATUS_CHANGE_SUSPENDED USB_PORT_STATUS_SUSPENDED
  65. #define USB_PORT_STATUS_CHANGE_OVER_CURRENT USB_PORT_STATUS_OVER_CURRENT
  66. #define USB_PORT_STATUS_CHANGE_RESET USB_PORT_STATUS_RESET
  67. //
  68. // ------------------------------------------------------ Data Type Definitions
  69. //
  70. typedef struct _USB_HUB USB_HUB, *PUSB_HUB;
  71. /*++
  72. Structure Description:
  73. This structure stores port status information.
  74. Members:
  75. Status - Stores a bitmaks of the current port status. See USB_PORT_STATUS_*
  76. definitions.
  77. Change - Stores a bitmaks of the port status bits that have changed and are
  78. yet to be handled. See USB_PORT_STATUS_CHANGE_* definitions.
  79. --*/
  80. typedef struct _USB_PORT_STATUS {
  81. USHORT Status;
  82. USHORT Change;
  83. } USB_PORT_STATUS, *PUSB_PORT_STATUS;
  84. /*++
  85. Structure Description:
  86. This structure stores status information for each of the ports in a USB
  87. hub.
  88. Members:
  89. PortStatus - Stores an array of port status structures. One for each port.
  90. PortDeviceSpeed - Stores an array containing the speed of the device
  91. connected at each port. This value is ignored if no device is connected
  92. to the port.
  93. --*/
  94. typedef struct _USB_HUB_STATUS {
  95. PUSB_PORT_STATUS PortStatus;
  96. PUSB_DEVICE_SPEED PortDeviceSpeed;
  97. } USB_HUB_STATUS, *PUSB_HUB_STATUS;
  98. /*++
  99. Structure Description:
  100. This structure stores information passed to a USB host controller when an
  101. endpoint is being created.
  102. Members:
  103. Version - Stores the version of this structure.
  104. Type - Stores the type of endpoint being created.
  105. Direction - Stores the direction of the endpoint being created.
  106. Speed - Stores the speed of the device the endpoint is being created for.
  107. MaxPacketSize - Stores the maximum number of payload bytes that can be
  108. moved per transfer.
  109. PollRate - Stores the poll rate, in (micro)frames.
  110. EndpointNumber - Stores the endpoint number of the endpoint, as defined by
  111. the USB device.
  112. HubAddress - Stores the address of the device's parent hub, required for
  113. full or low speed devices on a high speed bus. This field will contain
  114. 0 for root hub enumerated devices.
  115. HubPortNumber - Stores the port number this devices is connected to on the
  116. parent hub. This field will be zero for root hub enumerated devices.
  117. --*/
  118. typedef struct _USB_HOST_ENDPOINT_CREATION_REQUEST {
  119. ULONG Version;
  120. USB_TRANSFER_TYPE Type;
  121. USB_TRANSFER_DIRECTION Direction;
  122. USB_DEVICE_SPEED Speed;
  123. ULONG MaxPacketSize;
  124. USHORT PollRate;
  125. UCHAR EndpointNumber;
  126. UCHAR HubAddress;
  127. UCHAR HubPortNumber;
  128. } USB_HOST_ENDPOINT_CREATION_REQUEST, *PUSB_HOST_ENDPOINT_CREATION_REQUEST;
  129. /*++
  130. Structure Description:
  131. This structure stores information about a USB transfer.
  132. Members:
  133. Public - Stores the public portion of the transfer, which is available to
  134. all users of the USB core.
  135. DeviceAddress - Stores the device address where the transfer is pointed.
  136. EndpointNumber - Stores the endpoint number of the endpoint this transfer
  137. is aimed at.
  138. Type - Stores the type of USB request that this transfer is.
  139. --*/
  140. typedef struct _USB_TRANSFER_INTERNAL {
  141. USB_TRANSFER Public;
  142. UCHAR DeviceAddress;
  143. UCHAR EndpointNumber;
  144. USB_TRANSFER_TYPE Type;
  145. } USB_TRANSFER_INTERNAL, *PUSB_TRANSFER_INTERNAL;
  146. //
  147. // Host controller functions.
  148. //
  149. typedef
  150. KSTATUS
  151. (*PUSB_HOST_CREATE_ENDPOINT) (
  152. PVOID HostControllerContext,
  153. PUSB_HOST_ENDPOINT_CREATION_REQUEST Endpoint,
  154. PVOID *EndpointContext
  155. );
  156. /*++
  157. Routine Description:
  158. This routine is called by the USB core when a new endpoint is being opened.
  159. It allows the host controller to create and store any context needed to
  160. support a new endpoint (such as a queue head).
  161. Arguments:
  162. HostControllerContext - Supplies the context pointer passed to the USB core
  163. when the controller was created. This is used to identify the USB host
  164. controller to the host controller driver.
  165. Endpoint - Supplies a pointer containing information about the endpoint
  166. being created. The host controller cannot count on this buffer sticking
  167. around after the function returns. If it needs this information it
  168. should make a copy of it.
  169. EndpointContext - Supplies a pointer where the host controller can store a
  170. context pointer identifying the endpoint created.
  171. Return Value:
  172. STATUS_SUCCESS if the endpoint can be successfully accommodated.
  173. Failing status code if the endpoint cannot be opened.
  174. --*/
  175. typedef
  176. VOID
  177. (*PUSB_HOST_RESET_ENDPOINT) (
  178. PVOID HostControllerContext,
  179. PVOID EndpointContext,
  180. ULONG MaxPacketSize
  181. );
  182. /*++
  183. Routine Description:
  184. This routine is called by the USB core when an endpoint needs to be reset.
  185. Arguments:
  186. HostControllerContext - Supplies the context pointer passed to the USB core
  187. when the controller was created. This is used to identify the USB host
  188. controller to the host controller driver.
  189. EndpointContext - Supplies a pointer to the context returned by the host
  190. controller when the endpoint was created.
  191. MaxPacketSize - Supplies the maximum packet size of the endpoint, which
  192. may have changed in the case of endpoint zero.
  193. Return Value:
  194. None.
  195. --*/
  196. typedef
  197. KSTATUS
  198. (*PUSB_HOST_FLUSH_ENDPOINT) (
  199. PVOID HostControllerContext,
  200. PVOID EndpointContext,
  201. PULONG TransferCount
  202. );
  203. /*++
  204. Routine Description:
  205. This routine flushes all the active transfers from an endpoint. It does so
  206. by polling for completion status and does not return until all transfers
  207. are completed. This must be called at high run level.
  208. Arguments:
  209. HostControllerContext - Supplies the context pointer passed to the USB core
  210. when the controller was created. This is used to identify the USB host
  211. controller to the host controller driver.
  212. EndpointContext - Supplies a pointer to the context returned by the host
  213. controller when the endpoint was created.
  214. TransferCount - Supplies a pointer to a boolean that receives the number
  215. of transfers that were flushed.
  216. Return Value:
  217. Status code.
  218. --*/
  219. typedef
  220. VOID
  221. (*PUSB_HOST_DESTROY_ENDPOINT) (
  222. PVOID HostControllerContext,
  223. PVOID EndpointContext
  224. );
  225. /*++
  226. Routine Description:
  227. This routine tears down and destroys an endpoint created with the endpoint
  228. creation routine.
  229. Arguments:
  230. HostControllerContext - Supplies the context pointer passed to the USB core
  231. when the controller was created. This is used to identify the USB host
  232. controller to the host controller driver.
  233. EndpointContext - Supplies a pointer to the context returned by the host
  234. controller when the endpoint was created.
  235. Return Value:
  236. None.
  237. --*/
  238. typedef
  239. KSTATUS
  240. (*PUSB_HOST_CREATE_TRANSFER) (
  241. PVOID HostControllerContext,
  242. PVOID EndpointContext,
  243. ULONG MaxBufferSize,
  244. ULONG Flags,
  245. PVOID *TransferContext
  246. );
  247. /*++
  248. Routine Description:
  249. This routine allocates structures needed for the USB host controller to
  250. support a transfer.
  251. Arguments:
  252. HostControllerContext - Supplies the context pointer passed to the USB core
  253. when the controller was created. This is used to identify the USB host
  254. controller to the host controller driver.
  255. EndpointContext - Supplies a pointer to the host controller's context of
  256. the endpoint that this transfer will eventually be submitted to.
  257. MaxBufferSize - Supplies the maximum buffer length, in bytes, of the
  258. transfer when it is submitted. It is assumed that the host controller
  259. will set up as many transfer descriptors as are needed to support a
  260. transfer of this size.
  261. Flags - Supplies a bitfield of flags regarding the transaction. See
  262. USB_TRANSFER_FLAG_* definitions.
  263. TransferContext - Supplies a pointer where the host controller can store a
  264. context pointer containing any needed structures for the transfer.
  265. Return Value:
  266. None.
  267. --*/
  268. typedef
  269. VOID
  270. (*PUSB_HOST_DESTROY_TRANSFER) (
  271. PVOID HostControllerContext,
  272. PVOID EndpointContext,
  273. PVOID TransferContext
  274. );
  275. /*++
  276. Routine Description:
  277. This routine destroys host controller structures associated with a USB
  278. transfer.
  279. Arguments:
  280. HostControllerContext - Supplies the context pointer passed to the USB core
  281. when the controller was created. This is used to identify the USB host
  282. controller to the host controller driver.
  283. EndpointContext - Supplies a pointer to the host controller context for the
  284. endpoint this transfer belonged to.
  285. TransferContext - Supplies the pointer provided to the USB core by the host
  286. controller when the transfer was created.
  287. Return Value:
  288. None.
  289. --*/
  290. typedef
  291. KSTATUS
  292. (*PUSB_HOST_SUBMIT_TRANSFER) (
  293. PVOID HostControllerContext,
  294. PVOID EndpointContext,
  295. PUSB_TRANSFER_INTERNAL Transfer,
  296. PVOID TransferContext
  297. );
  298. /*++
  299. Routine Description:
  300. This routine submits a transfer to the USB host controller for execution.
  301. Arguments:
  302. HostControllerContext - Supplies the context pointer passed to the USB core
  303. when the controller was created. This is used to identify the USB host
  304. controller to the host controller driver.
  305. EndpointContext - Supplies the context pointer provided to the USB core by
  306. the host controller when the endpoint was created.
  307. Transfer - Supplies a pointer to the USB transfer to execute.
  308. TransferContext - Supplies the pointer provided to the USB core by the host
  309. controller when the transfer was created.
  310. Return Value:
  311. STATUS_SUCCESS if the transfer was successfully added to the hardware queue.
  312. Failure codes if the transfer could not be added.
  313. --*/
  314. typedef
  315. KSTATUS
  316. (*PUSB_HOST_CANCEL_TRANSFER) (
  317. PVOID HostControllerContext,
  318. PVOID EndpointContext,
  319. PUSB_TRANSFER_INTERNAL Transfer,
  320. PVOID TransferContext
  321. );
  322. /*++
  323. Routine Description:
  324. This routine submits attempts to cancel a transfer that was previously
  325. submitted for execution.
  326. Arguments:
  327. HostControllerContext - Supplies the context pointer passed to the USB core
  328. when the controller was created. This is used to identify the USB host
  329. controller to the host controller driver.
  330. EndpointContext - Supplies the context pointer provided to the USB core by
  331. the host controller when the endpoint was created.
  332. Transfer - Supplies a pointer to the USB transfer to execute.
  333. TransferContext - Supplies the pointer provided to the USB core by the host
  334. controller when the transfer was created.
  335. Return Value:
  336. STATUS_SUCCESS if the transfer was successfully removed from the hardware
  337. queue.
  338. STATUS_TOO_LATE if the transfer had already completed.
  339. Other failure codes if the transfer could not be cancelled but has not yet
  340. completed.
  341. --*/
  342. typedef
  343. KSTATUS
  344. (*PUSB_HOST_GET_ROOT_HUB_STATUS) (
  345. PVOID HostControllerContext,
  346. PUSB_HUB_STATUS HubStatus
  347. );
  348. /*++
  349. Routine Description:
  350. This routine queries the host controller for the status of the root hub.
  351. Arguments:
  352. HostControllerContext - Supplies the context pointer passed to the USB core
  353. when the controller was created. This is used to identify the USB host
  354. controller to the host controller driver.
  355. HubStatus - Supplies a pointer where the host controller should fill out
  356. the root hub status.
  357. Return Value:
  358. STATUS_SUCCESS if the hub status was successfully queried.
  359. Failure codes if the status could not be queried.
  360. --*/
  361. typedef
  362. KSTATUS
  363. (*PUSB_HOST_SET_ROOT_HUB_STATUS) (
  364. PVOID HostControllerContext,
  365. PUSB_HUB_STATUS HubStatus
  366. );
  367. /*++
  368. Routine Description:
  369. This routine sets the state of the root hub in the USB host controller. It
  370. looks at the status change bits for each port in order to determine what
  371. needs to be set.
  372. Arguments:
  373. HostControllerContext - Supplies the context pointer passed to the USB core
  374. when the controller was created. This is used to identify the USB host
  375. controller to the host controller driver.
  376. HubStatus - Supplies a pointer to the status that should be set in the root
  377. hub.
  378. Return Value:
  379. STATUS_SUCCESS if the hub state was successfully programmed into the device.
  380. Failure codes if the status could not be set.
  381. --*/
  382. /*++
  383. Structure Description:
  384. This structure stores an interface of functions that the USB core will use
  385. to call into a specific host controller driver instance.
  386. Members:
  387. Version - Stores the USB controller interface version number.
  388. DriverObject - Stores a pointer to the host controller's driver object,
  389. which is used to create child devices on its behalf.
  390. DeviceObject - Stores a pointer to the host controller's device object,
  391. which is used to create child devices on its behalf.
  392. HostControllerContext - Stores a pointer's worth of context for the USB
  393. host controller. The USB core library will pass this context pointer
  394. to the host controller when calling its interface functions.
  395. Identifier - Stores a unique identifier used to match against the KD debug
  396. handoff data. Often this is the base physical address of the controller.
  397. DebugPortSubType - Stores the host controller type as defined by the Debug
  398. Port Table 2. Set to -1 if the controller isn't defined in the Debug
  399. Port Table 2.
  400. Speed - Stores the maximum supporte speed of the controller.
  401. RootHubPortCount - Stores the number of ports on the root hub of this
  402. controller.
  403. CreateEndpoint - Stores a pointer to a function that the USB core library
  404. calls when an endpoint is being prepared for use.
  405. ResetEndpoint - Stores a pointer to a function that the USB core library
  406. calls to reset an endpoint.
  407. FlushEndpoint - Stores a pointer to a function that the USB core library
  408. calls to flush transfers from an endpoint. This routine is required if
  409. polled I/O is supported.
  410. DestroyEndpoint - Stores a pointer to a function that the USB core library
  411. calls to destroy an endpoint.
  412. CreateTransfer - Stores a pointer to a function that the USB core library
  413. calls to create a new transfer.
  414. DestroyTransfer - Stores a pointer to a function that the USB core library
  415. calls to destroy a USB transfer.
  416. SubmitTransfer - Stores a pointer to a function that the USB core library
  417. calls to submit a USB transfer for execution.
  418. SubmitPolledTransfer - Stores a pointer to a function that the USB core
  419. library calls to submit a USB transfer for polled I/O execution.
  420. CancelTransfer - Stores a pointer to a function that the USB core library
  421. calls to cancel a submitted transfer.
  422. GetRootHubStatus - Stores a pointer to a function that the USB core library
  423. calls to get the current state of the root hub.
  424. SetRootHubStatus - Stores a pointer to a function that the USB core library
  425. calls to set the current state of the root hub.
  426. --*/
  427. typedef struct _USB_HOST_CONTROLLER_INTERFACE {
  428. ULONG Version;
  429. PDRIVER DriverObject;
  430. PDEVICE DeviceObject;
  431. PVOID HostControllerContext;
  432. ULONGLONG Identifier;
  433. USHORT DebugPortSubType;
  434. USB_DEVICE_SPEED Speed;
  435. ULONG RootHubPortCount;
  436. PUSB_HOST_CREATE_ENDPOINT CreateEndpoint;
  437. PUSB_HOST_RESET_ENDPOINT ResetEndpoint;
  438. PUSB_HOST_FLUSH_ENDPOINT FlushEndpoint;
  439. PUSB_HOST_DESTROY_ENDPOINT DestroyEndpoint;
  440. PUSB_HOST_CREATE_TRANSFER CreateTransfer;
  441. PUSB_HOST_DESTROY_TRANSFER DestroyTransfer;
  442. PUSB_HOST_SUBMIT_TRANSFER SubmitTransfer;
  443. PUSB_HOST_SUBMIT_TRANSFER SubmitPolledTransfer;
  444. PUSB_HOST_CANCEL_TRANSFER CancelTransfer;
  445. PUSB_HOST_GET_ROOT_HUB_STATUS GetRootHubStatus;
  446. PUSB_HOST_SET_ROOT_HUB_STATUS SetRootHubStatus;
  447. } USB_HOST_CONTROLLER_INTERFACE, *PUSB_HOST_CONTROLLER_INTERFACE;
  448. //
  449. // -------------------------------------------------------------------- Globals
  450. //
  451. //
  452. // -------------------------------------------------------- Function Prototypes
  453. //
  454. USB_API
  455. KSTATUS
  456. UsbHostRegisterController (
  457. PUSB_HOST_CONTROLLER_INTERFACE ControllerInterface,
  458. PHANDLE ControllerHandle
  459. );
  460. /*++
  461. Routine Description:
  462. This routine registers a new host controller instance with the USB core.
  463. This routine must be called at low level.
  464. Arguments:
  465. ControllerInterface - Supplies a pointer to the interface that the USB
  466. core will use to call back into the host controller. This contents of
  467. this memory will be copied during this call, so the caller can pass
  468. a pointer to a stack-allocated buffer here.
  469. ControllerHandle - Supplies a pointer where a handle will be returned
  470. representing this controller instance. When calls are made to the USB
  471. core regarding a specific controller, pass this handle.
  472. Return Value:
  473. STATUS_SUCCESS on success. A handle will also be returned on success.
  474. STATUS_NOT_SUPPORTED if an unsupported version was supplied with the
  475. controller interface.
  476. Other error codes on other failures.
  477. --*/
  478. USB_API
  479. VOID
  480. UsbHostDestroyControllerState (
  481. HANDLE ControllerHandle
  482. );
  483. /*++
  484. Routine Description:
  485. This routine destroys the state of a USB host controller that was created
  486. during registration.
  487. Arguments:
  488. ControllerHandle - Supplies a handle to a controller instance.
  489. Return Value:
  490. None.
  491. --*/
  492. USB_API
  493. VOID
  494. UsbHostProcessCompletedTransfer (
  495. PUSB_TRANSFER_INTERNAL Transfer
  496. );
  497. /*++
  498. Routine Description:
  499. This routine is called by the USB host controller when the host controller
  500. is done with a transfer. This routine must be called if the transfer is
  501. completed successfully, failed, or was cancelled.
  502. This routine must be called at dispatch level or less.
  503. Arguments:
  504. Transfer - Supplies a pointer to the transfer that has completed.
  505. Return Value:
  506. None.
  507. --*/
  508. USB_API
  509. VOID
  510. UsbHostNotifyPortChange (
  511. HANDLE ControllerHandle
  512. );
  513. /*++
  514. Routine Description:
  515. This routine notifies the USB core that the USB host controller detected a
  516. port change.
  517. Arguments:
  518. ControllerHandle - Supplies a handle to the USB core instance that needs to
  519. be notified that a host port changed status.
  520. Return Value:
  521. None.
  522. --*/
  523. USB_API
  524. KSTATUS
  525. UsbHostQueryChildren (
  526. PIRP Irp,
  527. HANDLE UsbDeviceHandle
  528. );
  529. /*++
  530. Routine Description:
  531. This routine responds to the Query Children IRP for a USB Host controller.
  532. Arguments:
  533. Irp - Supplies a pointer to the Query Children IRP.
  534. UsbDeviceHandle - Supplies a pointer to the USB Host controller handle.
  535. Return Value:
  536. Status code.
  537. --*/
  538. USB_API
  539. KSTATUS
  540. UsbCreateHub (
  541. HANDLE DeviceHandle,
  542. PUSB_HUB *Hub
  543. );
  544. /*++
  545. Routine Description:
  546. This routine creates a new USB hub device. This routine must be called at
  547. low level.
  548. Arguments:
  549. DeviceHandle - Supplies the open device handle to the hub.
  550. Hub - Supplies a pointer where a pointer to the hub context will be
  551. returned.
  552. Return Value:
  553. Status code.
  554. --*/
  555. USB_API
  556. VOID
  557. UsbDestroyHub (
  558. PUSB_HUB Hub
  559. );
  560. /*++
  561. Routine Description:
  562. This routine destroys a USB hub context. This should only be called once
  563. all of the hub's transfers have completed.
  564. Arguments:
  565. Hub - Supplies a pointer to the hub to tear down.
  566. Return Value:
  567. None.
  568. --*/
  569. USB_API
  570. KSTATUS
  571. UsbStartHub (
  572. PUSB_HUB Hub
  573. );
  574. /*++
  575. Routine Description:
  576. This routine starts a USB hub.
  577. Arguments:
  578. Hub - Supplies a pointer to the hub to start.
  579. Return Value:
  580. None.
  581. --*/
  582. USB_API
  583. KSTATUS
  584. UsbHubQueryChildren (
  585. PIRP Irp,
  586. PUSB_HUB Hub
  587. );
  588. /*++
  589. Routine Description:
  590. This routine responds to the Query Children IRP for a USB Hub. This routine
  591. must be called at low level.
  592. Arguments:
  593. Irp - Supplies a pointer to the Query Children IRP.
  594. Hub - Supplies a pointer to the hub to query.
  595. Return Value:
  596. Status code.
  597. --*/