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.
33 It may be 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.
41 The structure's members are documented in
44 Flags which describe how allocations should be performed.
47 .It Sy USB_FLAGS_NOSLEEP
48 Do not block waiting for memory.
49 If memory is not available the allocation will fail.
50 .It Sy USB_FLAGS_SLEEP
51 Perform a blocking allocation.
52 If memory is not available, the function will wait until memory is made
55 Note, the request may still fail even if
62 .Fn usba_hcdi_pipe_bulk_xfer
63 entry point is used to initiate an
65 USB bulk transfer on the pipe
67 The specific USB bulk transfer is provided in
69 For more background on transfer types, see
72 The host controller driver should first check the USB address of the
74 It may correspond to the root hub.
75 If it does, the driver should return
76 .Sy USB_NOT_SUPPORTED .
78 Bulk transfers may send data to the device or receive data from the device.
79 A given bulk endpoint is uni-directional.
80 The direction can be determined from the endpoint address based on the
86 for more information on how to determine the direction of the endpoint.
88 The device driver should allocate memory, whether memory suitable for a
89 DMA transfer or otherwise, to perform the transfer.
90 For all memory allocated, it should honor the values in
92 to determine whether or not it should block for allocations.
94 The length of the bulk transfer and its data can be found in the
103 structure that should not be used directly and data should be copied to
104 or from the data buffer that will go the controller.
106 If the driver successfully schedules the I/O, then it should return
108 When the I/O completes, it must call
112 If the transfer fails, but the driver returned
116 and should specify an error there.
118 It is the driver's responsibility to time out bulk transfer requests.
119 If the timeout in the request as indicated in the
123 is set to zero, then the driver should use the USBA default timeout of
124 .Sy HCDI_DEFAULT_TIMEOUT .
125 All timeout values are in
127 .Ss Callback Handling
128 When the bulk transfer completes the driver should consider the
129 following items to determine what actions it should take on the
133 If the transfer timed out, it should remove the transfer from the
134 outstanding list, queue the next transfer, and return the transfer back
135 to the OS with the error code
138 .Xr usba_hcdi_cb 9F .
140 If the transfer failed, it should find the appropriate error and call
144 If the transfer succeeded, but less data was transferred than expected,
150 .Sy USB_ATTRS_SHORT_XFER_OK
151 flag is not present, then the driver should call
154 .Sy USB_CR_DATA_UNDERRUN .
156 If the transfer was going to the host, then the driver should copy the
157 data into the transfer's message block and update the
162 If everything was successful, call
168 Upon successful completion, the
169 .Fn usba_hcdi_pipe_bulk_xfer
170 function should return
172 Otherwise, it should return the appropriate USB error.
177 .Xr usba_hcdi_cb 9F ,
179 .Xr usb_bulk_req 9S ,
180 .Xr usb_ep_descr 9S ,
181 .Xr usba_pipe_handle_data 9S