Interface Level

Parameters

For usb_alloc_ctrl_req(), usb_alloc_bulk_req() and usb_alloc_intr_req():

dip

Pointer to the device's dev_info structure.

len

Length of data for this request.

flags

Only USB_FLAGS_SLEEP is recognized. Wait for resources if not immediately available.

For usb_alloc_isoc_req():

dip

Pointer to the device's dev_info structure.

isoc_pkts_count

Number of isochronous packet descriptors to associate with this request. Must be greater than zero.

len

Length of data for this isochronous request.

flags

Only USB_FLAGS_SLEEP is recognized. Wait for resources if not immediately available.

For usb_free_ctrl_req(), usb_free_bulk_req(), usb_free_intr_req() and usb_free_isoc_req():

request

Pointer to the request structure to be freed. Can be NULL.

Description

The usb_alloc_ctrl_req(), usb_alloc_bulk_req(), usb_alloc_intr_req(), and usb_alloc_isoc_req() functions allocate control, bulk, interrupt, or
isochronous requests. Optionally, these functions can also allocate an
mblk of the specified length to pass data associated with the
request. (For guidelines on mblk data allocation, see the manpage for the
relevant transfer function).

The usb_alloc_isoc_req() function also allocates a number of isochronous packet descriptors (usb_isoc_pkt_descr_t)
specified by isoc_pkts_count to the end of the request proper (usb_isoc_req_t).
See usb_isoc_request(9S) for more information on isochronous packet descriptors.

These functions always succeed when the USB_FLAGS_SLEEP flag is set, provided that
they are given valid args and are not called from interrupt context.

The usb_free_ctrl_req(), usb_free_bulk_req(), usb_free_intr_req(), and usb_free_isoc_req() functions free their corresponding request. If
the request's data block pointer is non-zero, the data block is also
freed. For isoc requests, the array of packet descriptors is freed.

Return Values

For usb_alloc_ctrl_req(), usb_alloc_bulk_req(), usb_alloc_intr_req() and usb_alloc_isoc_req():

On success: returns a pointer to the appropriate usb_xxx_request_t.

On failure: returns NULL. Fails because the dip argument is invalid, USB_FLAGS_SLEEP
is not set and memory is not available or because USB_FLAGS_SLEEP is
set but the call was made in interrupt context.