view usr/src/man/man9f/usb_pipe_reset.9f @ 23918:f3c8f3a2a25c

13404 man page spelling errors Reviewed by: Ryan Zezeski <ryan@oxide.computer> Reviewed by: Robert Mustacchi <rm@fingolfin.org> Approved by: Richard Lowe <richlowe@richlowe.net>
author Peter Tribble <peter.tribble@gmail.com>
date Thu, 31 Dec 2020 10:47:42 +0000
parents bd4d8900145e
children
line wrap: on
line source

'\" te
.\" Copyright (c) 2004, Sun Microsystems, Inc., All Rights Reserved
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
.TH USB_PIPE_RESET 9F "December 28, 2020"
.SH NAME
usb_pipe_reset \- Abort queued requests from a USB pipe and reset the pipe
.SH SYNOPSIS
.nf
#include <sys/usb/usba.h>

\fBvoid\fR \fB\fR\fBusb_pipe_reset\fR(\fBdev_info_t *\fR\fIdip\fR,
     \fBusb_pipe_handle_t\fR \fIpipe_handle\fR, \fBusb_flags_t\fR \fIusb_flags\fR,
     \fBvoid (*\fR\fIcallback\fR)(usb_pipe_handle_t \fIcb_pipe_handle\fR,
     \fBusb_opaque_t\fR \fIarg\fR, \fBint\fR \fIrval\fR, \fBusb_cb_flags_t\fR \fIflags)\fR,
     \fBusb_opaque_t\fR \fIcallback_arg\fR);
.fi

.SH INTERFACE LEVEL
Solaris DDI specific (Solaris DDI)
.SH PARAMETERS
.ne 2
.na
\fB\fIdip\fR\fR
.ad
.RS 16n
Pointer to the device's \fBdev_info\fR structure.
.RE

.sp
.ne 2
.na
\fB\fIpipe_handle\fR\fR
.ad
.RS 16n
Handle of the pipe to reset. Cannot be the handle to the default control pipe.
.RE

.sp
.ne 2
.na
\fB\fIusb_flags\fR\fR
.ad
.RS 16n
USB_FLAGS_SLEEP is the only flag recognized. Wait for completion.
.RE

.sp
.ne 2
.na
\fB\fIcallback\fR\fR
.ad
.RS 16n
Function called on completion if the USB_FLAGS_SLEEP flag is not specified. If
NULL, no notification of completion is provided.
.RE

.sp
.ne 2
.na
\fB\fIcallback_arg\fR\fR
.ad
.RS 16n
Second argument to callback function.
.RE

.SH DESCRIPTION
Call \fBusb_pipe_reset()\fR to reset a pipe which is in an error state, or to
abort a current request and clear the pipe. The \fBusb_pipe_reset()\fR function
can be called on any pipe other than the default control pipe.
.sp
.LP
A pipe can be reset automatically when requests sent to the pipe have the
USB_ATTRS_AUTOCLEARING attribute specified. Client drivers see an exception
callback with the USB_CB_STALL_CLEARED callback flag set in such cases.
.sp
.LP
Stalls on pipes executing requests without the USB_ATTRS_AUTOCLEARING attribute
set must be cleared by the client driver. The client driver is notified of the
stall via an exception callback. The client driver must then call
\fBusb_pipe_reset()\fR to clear the stall.
.sp
.LP
The \fBusb_pipe_reset()\fR function resets a pipe as follows:
.br
.in +2
1. Any polling activity is stopped if the pipe being reset is an interrupt or
isochronous pipe.
.in -2
.br
.in +2
2. All pending requests are removed from the pipe. An exception callback, if
specified beforehand, is executed for each aborted request.
.in -2
.br
.in +2
3. The pipe is reset to the idle state.
.in -2
.sp
.LP
Requests to reset the default control pipe are not allowed. No action is taken
on a pipe which is closing.
.sp
.LP
If USB_FLAGS_SLEEP is specified in \fIflags\fR, this function waits for the
action to complete before calling the callback handler and returning. If not
specified, this function queues the request and returns immediately, and the
specified callback is called upon completion.
.sp
.LP
\fIcallback\fR is the callback handler. It takes the following arguments:
.sp
.ne 2
.na
\fBusb_pipe_handle_t cb_pipe_handle\fR
.ad
.sp .6
.RS 4n
Handle of the pipe to reset.
.RE

.sp
.ne 2
.na
\fBusb_opaque_t callback_arg\fR
.ad
.sp .6
.RS 4n
Callback_arg specified to \fBusb_pipe_reset()\fR.
.RE

.sp
.ne 2
.na
\fBint rval\fR
.ad
.sp .6
.RS 4n
Return value of the reset call.
.RE

.sp
.ne 2
.na
\fBusb_cb_flags_t callback_flags\fR
.ad
.sp .6
.RS 4n
Status of the queueing operation. Can be:
.sp
USB_CB_NO_INFO \(em Callback was uneventful.
.sp
USB_CB_ASYNC_REQ_FAILED \(em Error starting asynchronous request.
.RE

.SH RETURN VALUES
Status is returned to the caller via the callback handler's rval argument.
Possible callback handler rval argument values are:
.sp
.ne 2
.na
\fBUSB_SUCCESS\fR
.ad
.RS 23n
Pipe successfully reset.
.RE

.sp
.ne 2
.na
\fBUSB_INVALID_PIPE\fR
.ad
.RS 23n
\fIpipe_handle\fR specifies a pipe which is closed or closing.
.RE

.sp
.ne 2
.na
\fBUSB_INVALID_ARGS\fR
.ad
.RS 23n
\fIdip\fR or \fIpipe_handle\fR arguments are \fBNULL\fR. USB_FLAGS_SLEEP is
clear and callback is NULL.
.RE

.sp
.ne 2
.na
\fBUSB_INVALID_CONTEXT\fR
.ad
.RS 23n
Called from interrupt context with the USB_FLAGS_SLEEP flag set.
.RE

.sp
.ne 2
.na
\fBUSB_INVALID_PERM\fR
.ad
.RS 23n
\fIpipe_handle\fR specifies the default control pipe.
.RE

.sp
.ne 2
.na
\fBUSB_FAILURE\fR
.ad
.RS 23n
Asynchronous resources are unavailable. In this case, USB_CB_ASYNC_REQ_FAILED
is passed in as the \fIcallback_flags\fR arg to the callback handler.
.RE

.sp
.LP
Exception callback handlers of interrupt-IN and isochronous-IN requests which
are terminated by these commands are called with a completion reason of
USB_CR_STOPPED_POLLING.
.sp
.LP
Exception handlers of incomplete bulk requests are called with a completion
reason of USB_CR_FLUSHED.
.sp
.LP
Exception handlers of unstarted requests are called with USB_CR_PIPE_RESET.
.sp
.LP
Note that messages mirroring the above errors are logged to the console logfile
on error. This provides status for calls which could not otherwise provide
status.
.SH CONTEXT
May be called from user or kernel context regardless of arguments. May be
called from any callback with the USB_FLAGS_SLEEP clear. May not be called from
a callback executing in interrupt context if the USB_FLAGS_SLEEP flag is set.
.sp
.LP
If the USB_CB_ASYNC_REQ_FAILED bit is clear in usb_cb_flags_t, the callback, if
supplied, can block because it is executing in kernel context. Otherwise the
callback cannot block. Please see \fBusb_callback_flags\fR(9S) for more
information on callbacks.
.SH EXAMPLES
.in +2
.nf
void post_reset_handler(
    usb_pipe_handle_t, usb_opaque_t, int, usb_cb_flags_t);

/*
 * Do an asynchronous reset on bulk_pipe.
 * Execute post_reset_handler when done.
 */
usb_pipe_reset(dip, bulk_pipe, 0, post_reset_handler, arg);

/* Do a synchronous reset on bulk_pipe. */
usb_pipe_reset(dip, bulk_pipe, USB_FLAGS_SLEEP, NULL, NULL);

.fi
.in -2

.SH ATTRIBUTES
See \fBattributes\fR(5) for descriptions of the following attributes:
.sp

.sp
.TS
box;
c | c
l | l .
ATTRIBUTE TYPE	ATTRIBUTE VALUE
_
Architecture	PCI-based systems
_
Interface stability	Committed
.TE

.SH SEE ALSO
\fBattributes\fR(5), \fBusb_get_cfg\fR(9F), \fBusb_pipe_bulk_xfer\fR(9F),
\fBusb_pipe_close\fR(9F), \fBusb_get_status\fR(9F),
\fBusb_pipe_ctrl_xfer\fR(9F), \fBusb_pipe_drain_reqs\fR(9F),
\fBusb_pipe_get_state\fR(9F), \fBusb_pipe_intr_xfer\fR(9F),
\fBusb_pipe_isoc_xfer\fR(9F), \fBusb_pipe_xopen\fR(9F),
\fBusb_pipe_stop_intr_polling\fR(9F), \fBusb_pipe_stop_isoc_polling\fR(9F),
\fBusb_callback_flags\fR(9S)