2 .\" This file and its contents are supplied under the terms of the
3 .\" Common Development and Distribution License ("CDDL"), version 1.0.
4 .\" You may only use this file in accordance with the terms of version
7 .\" A full copy of the text of the CDDL should have accompanied this
8 .\" source. A copy of the CDDL is also available via the Internet at
9 .\" http://www.illumos.org/license/CDDL.
12 .\" Copyright 2016 Joyent, Inc.
15 .Dt USBA_HCDI_PIPE_BULK_XFER 9E
18 .Nm usba_hcdi_pipe_bulk_xfer
19 .Nd perform a USB bulk transfer
21 .In sys/usb/usba/hcdi.h
23 .Fo prefix_hcdi_pipe_bulk_xfer
24 .Fa "usba_pipe_handle_data_t *ph"
25 .Fa "usb_bulk_req_t *ubrp"
26 .Fa "usb_flags_t usb_flags"
30 illumos USB HCD private function
32 This is a private function that is not part of the stable DDI. It may be
33 removed or changed at any time.
37 A pointer to a USB pipe handle as defined in
38 .Xr usba_pipe_handle_data 9S .
40 A pointer to a USB bulk transfer request. The structure's members are
44 Flags which describe how allocations should be performed. Valid flags
47 .It Sy USB_FLAGS_NOSLEEP
48 Do not block waiting for memory. If memory is not available the allocation
50 .It Sy USB_FLAGS_SLEEP
51 Perform a blocking allocation. If memory is not available, the function
52 will wait until memory is made available.
54 Note, the request may still fail even if
61 .Fn usba_hcdi_pipe_bulk_xfer
62 entry point is used to initiate an
64 USB bulk transfer on the pipe
66 The specific USB bulk transfer is provided in
68 For more background on transfer types, see
71 The host controller driver should first check the USB address of the
72 pipe handle. It may correspond to the root hub. If it does, the driver
74 .Sy USB_NOT_SUPPORTED .
76 Bulk transfers may send data to the device or receive data from the
77 device. A given bulk endpoint is uni-directional. The direction can be
78 determined from the endpoint address based on the
84 for more information on how to determine the direction of the endpoint.
86 The device driver should allocate memory, whether memory suitable for a
87 DMA transfer or otherwise, to perform the transfer. For all memory
88 allocated, it should honor the values in
90 to determine whether or not it should block for allocations.
92 The length of the bulk transfer and its data can be found in the
100 structure that should not be used directly and data should be copied to
101 or from the data buffer that will go the controller.
103 If the driver successfully schedules the I/O, then it should return
105 When the I/O completes, it must call
109 If the transfer fails, but the driver returned
113 and should specify an error there.
115 It is the driver's responsibility to time out bulk transfer
116 requests. If the timeout in the request as indicated in the
120 is set to zero, then the driver should use the USBA default timeout of
121 .Sy HCDI_DEFAULT_TIMEOUT .
122 All timeout values are in
124 .Ss Callback Handling
125 When the bulk transfer completes the driver should consider the
126 following items to determine what actions it should take on the
130 If the transfer timed out, it should remove the transfer from the
131 outstanding list, queue the next transfer, and return the transfer back
132 to the OS with the error code
135 .Xr usba_hcdi_cb 9F .
137 If the transfer failed, it should find the appropriate error and call
141 If the transfer succeeded, but less data was transferred than expected,
147 .Sy USB_ATTRS_SHORT_XFER_OK
148 flag is not present, then the driver should call
151 .Sy USB_CR_DATA_UNDERRUN .
153 If the transfer was going to the host, then the driver should copy the
154 data into the transfer's message block and update the
159 If everything was successful, call
165 Upon successful completion, the
166 .Fn usba_hcdi_pipe_bulk_xfer
167 function should return
169 Otherwise, it should return the appropriate USB error. If uncertain, use
173 .Xr usba_hcdi_cb 9F ,
175 .Xr usb_bulk_req 9S ,
176 .Xr usb_ep_descr 9S ,
177 .Xr usba_pipe_handle_data 9S