Kernel Functions for Drivers usb_pipe_bulk_xfer(9F)
NAME
usb_pipe_bulk_xfer - USB bulk transfer function
SYNOPSIS
#include
int usb_pipe_bulk_xfer(usb_pipe_handle_t pipe_handle,
usb_bulk_req_t *request, usb_flags_t flags);
INTERFACE LEVEL
Solaris DDI specific (Solaris DDI)PARAMETERS
pipe_handle Bulk pipe handle on which request is made.
request Pointer to bulk transfer request.flags USB_FLAGS_SLEEP is the only flag recognized.
Wait for request to complete.DESCRIPTION
The usb_pipe_bulk_xfer() function requests the USBA frame-
work to perform a transfer through a USB bulk pipe. The request is passed to the host controller driver (HCD), which performs the necessary transactions to complete the request.Requests are synchronous when USB_FLAGS_SLEEP has been
specified in flags. Calls for synchronous requests will not return until their transaction has completed. Asynchronousrequests (made without specifying the USB_FLAGS_SLEEP flag)
notify the caller of their completion via a callback func-
tion. Requests for bulk transfers must have mblks attached to store data. Allocate an mblk for data when a request isallocated via usb_alloc_bulk_req(9F) by passing a non-
negative value for the len argument.RETURN VALUES
USB_SUCCESS Transfer was successful.
USB_INVALID_ARGS Request is NULL.
USB_INVALID_CONTEXT Called from interrupt context with
the USB_FLAGS_SLEEP flag set.
SunOS 5.11 Last change: 3 Aug 2006 1
Kernel Functions for Drivers usb_pipe_bulk_xfer(9F)
USB_INVALID_REQUEST The request has been freed or oth-
erwise invalidated. A set of conflicting attributes were specified. Seeusb_bulk_request(9S).
The normal and/or exception call-
back was NULL and USB_FLAGS_SLEEP
was not set. Data space is not provided to anon-zero length bulk request:
(bulk_data == NULL and bulk_len != 0)
USB_INVALID_PIPE Pipe handle is NULL or invalid.
Pipe is closing or closed.USB_PIPE_ERROR Pipe handle refers to a pipe which
is in the USB_PIPE_STATE_ERROR
state.USB_NO_RESOURCES Memory, descriptors or other
resources are unavailable.USB_HC_HARDWARE_ERROR Host controller is in error state.
USB_FAILURE An asynchronous transfer failed or
an internal error occurred. A bulk request requested too much data:(length > usb_get_max_bulk_xfer size())
The pipe is in a unsuitable state (error, busy, not ready). Additional status information may be available in thebulk_completion_reason and bulk_cb_flags fields of the
request. Please see usb_completion_reason(9S) and
usb_callback_flags(9S) for more information.
SunOS 5.11 Last change: 3 Aug 2006 2
Kernel Functions for Drivers usb_pipe_bulk_xfer(9F)
CONTEXT
May be called from kernel or user context without regard to arguments. May be called from interrupt context only whenthe USB_FLAGS_SLEEP flag is clear.
EXAMPLES
/* Allocate, initialize and issue a synchronous bulk request. */usb_bulk_req_t bulk_req;
mblk_t *mblk;
bulk_req = usb_alloc_bulk_req(dip, bp->b_bcount, USB_FLAGS_SLEEP);
bulk_req->bulk_attributes = USB_ATTRS_AUTOCLEARING;
mblk = bulk_req->bulk_data;
bcopy(buffer, mblk->b_wptr, bp->b_bcount);
mblk->b_wptr += bp->b_bcount;
if ((rval = usb_pipe_bulk_xfer(pipe, bulk_req, USB_FLAGS_SLEEP))
!= USB_SUCCESS) {
cmn_err (CE_WARN, "%s%d: Error writing bulk data.",
ddi_driver_name(dip), ddi_get_instance(dip));
}ATTRIBUTES
See attributes(5) for descriptions of the following attri-
butes:____________________________________________________________
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
|_____________________________|_____________________________|
| Architecture | PCI-based systems |
|_____________________________|_____________________________|
| Interface Stability | Committed ||_____________________________|_____________________________|
| Availability | driver/usb ||_____________________________|_____________________________|
SEE ALSO
attributes(5), usb_alloc_request(9F), usb_get_cfg(9F),
usb_get_status(9F), usb_pipe_ctrl_xfer(9F),
usb_pipe_get_state(9F), usb_pipe_intr_xfer(9F),
usb_pipe_isoc_xfer(9F), usb_pipe_open(9F),
usb_pipe_reset(9F), usb_bulk_request(9S),
usb_callback_flags(9S), usb_completion_reason(9S),
usb_ctrl_request(9S), usb_intr_request(9S),
usb_isoc_request(9S)
SunOS 5.11 Last change: 3 Aug 2006 3