usba_hcdi_pipe_bulk_xferperform a USB bulk transfer

#include <sys/usb/usba/hcdi.h>

prefix_hcdi_pipe_bulk_xfer(usba_pipe_handle_data_t *ph, usb_bulk_req_t *ubrp, usb_flags_t usb_flags);

illumos USB HCD private function

This is a private function that is not part of the stable DDI. It may be removed or changed at any time.

A pointer to a USB pipe handle as defined in usba_pipe_handle_data(9S).
A pointer to a USB bulk transfer request. The structure's members are documented in usb_bulk_req(9S).
Flags which describe how allocations should be performed. Valid flags are:
Do not block waiting for memory. If memory is not available the allocation will fail.
Perform a blocking allocation. If memory is not available, the function will wait until memory is made available.

Note, the request may still fail even if USB_FLAGS_SLEEP is specified.

The () entry point is used to initiate an USB bulk transfer on the pipe ph. The specific USB bulk transfer is provided in ubrp. For more background on transfer types, see usba_hcdi(9E).

The host controller driver should first check the USB address of the pipe handle. It may correspond to the root hub. If it does, the driver should return .

Bulk transfers may send data to the device or receive data from the device. A given bulk endpoint is uni-directional. The direction can be determined from the endpoint address based on the member of ubrp. See usb_ep_descr(9S) for more information on how to determine the direction of the endpoint.

The device driver should allocate memory, whether memory suitable for a DMA transfer or otherwise, to perform the transfer. For all memory allocated, it should honor the values in usb_flags to determine whether or not it should block for allocations.

The length of the bulk transfer and its data can be found in the and members of ubrp respectively. The mblk(9S) structure that should not be used directly and data should be copied to or from the data buffer that will go the controller.

If the driver successfully schedules the I/O, then it should return USB_SUCCESS. When the I/O completes, it must call usba_hcdi_cb(9F) with ubrp. If the transfer fails, but the driver returned USB_SUCCESS, it still must call usba_hcdi_cb(9F) and should specify an error there.

It is the driver's responsibility to time out bulk transfer requests. If the timeout in the request as indicated in the member of ubrp is set to zero, then the driver should use the USBA default timeout of . All timeout values are in .

When the bulk transfer completes the driver should consider the following items to determine what actions it should take on the callback:

  • If the transfer timed out, it should remove the transfer from the outstanding list, queue the next transfer, and return the transfer back to the OS with the error code with usba_hcdi_cb(9F).
  • If the transfer failed, it should find the appropriate error and call usba_hcdi_cb(9F) with that error.
  • If the transfer succeeded, but less data was transferred than expected, consult the member of the ubrp. If the flag is not present, then the driver should call usba_hcdi_cb(9F) with the error .
  • If the transfer was going to the host, then the driver should copy the data into the transfer's message block and update the member of the mblk(9S).
  • If everything was successful, call usba_hcdi_cb(9F) with the code .

Upon successful completion, the usba_hcdi_pipe_bulk_xfer() function should return USB_SUCCESS. Otherwise, it should return the appropriate USB error. If uncertain, use .

usba_hcdi(9E), usba_hcdi_cb(9F), mblk(9S), usb_bulk_req(9S), usb_ep_descr(9S), usba_pipe_handle_data(9S)

December 22, 2016 OmniOS