Go to main content

man pages section 9: DDI and DKI Kernel Functions

Exit Print View

Updated: July 2017
 
 

usb_pipe_bulk_alloc_streams(9F)

Name

usb_pipe_bulk_alloc_streams - Allocate and set up streams on a USB bulk pipe

Synopsis

#include <sys/usb/usba.h>
int usb_pipe_bulk_alloc_streams(usb_pipe_handle_t *
pipe_handle,
uint16_t stream_cnt, usb_flag_t
 usb_flags);

Interface Level

Solaris DDI specific (Solaris DDI)

Parameters

pipe_handle

Pointer to a usb bulk pipe handle on which streams are set up.

stream_cnt

The streams count to allocate.

flags

USB_FLAGS_SLEEP is the only flag that is recognized. Wait for memory resources if not immediately available.

Description

A standard USB Bulk Pipe represents the ability to move single stream of (FIFO) data between the host and a device via a host memory buffer and a device endpoint. SuperSpeed Streams provide protocol-level support for a multi-stream model and utilize stream pipe communications mode.

The usb_pipe_bulk_alloc_streams() function creates and initializes SuperSpeed Streams on a given USB bulk pipe.

The USB 3.0 defines that a bulk pipe can support up to 65535 streams. However, host and device may be not able to support all the range. The attributes(5) returns the maximum streams count.

All explicit streams allocation is exclusive on a bulk pipe. Attempts to allocate streams on a stream pipe will fail.

Return Values

USB_SUCCESS

Streams resource was allocated and streams were set up.

USB_INVALID_CONTEXT

Called from interrupt handler with USB_FLAGS_SLEEP set.

USB_INVALID_ARGS

Pipe_handle is NULL. The stream_cnt is zero or exceeds the maximum streams count.

USB_NOT_SUPPORTED

The host does not support SuperSpeed Streams.

USB_FAILURE

Host was not in operational state. Host failed to allocate resources. Streams are already set up.

Context

The allocation routines can always be called from kernel and user context regardless of arguments. They may be called from interrupt context only if USB_FLAGS_SLEEP is not specified.

Examples


usb_pipe_handle_t *pipe;
           uint16_t stream_cnt;

           /* Open the pipe */
           if (usb_pipe_open(dip, epdescr, &policy, USB_FLAGS_SLEEP,
               pipe) != USB_SUCCESS) {
           }

           /* Decide how many streams can be allocated. */
           if(usb_pipe_bulk_get_max_streams(pipe, &stream_cnt) !=
               USB_SUCCESS) {
           };

           /* Allocate streams resource. */
           if (usb_pipe_bulk_alloc_streams(*pipe, stream_cnt,
               USB_FLAGS_SLEEP) != USB_SUCCESS) {
           }

Attributes

See attributes(5) for descriptions of the following attributes:

ATTRIBUTE TYPE
ATTRIBUTE VALUE
Architecture
PCI-based systems
Interface Stability
Committed
Availability
system/io/usb

See Also

attributes(5), usb_request_attributes(9S), usb_bulk_request(9S), usb_pipe_bulk_free_streams(9F), usb_pipe_bulk_reset_stream(9F), usb_pipe_open(9F), usb_pipe_close(9F), usb_pipe_reset(9F), usb_pipe_bulk_xfer(9F), usb_pipe_get_max_bulk_streams(9F), usb_callback_flags(9S)