1usb_pipe_reset(9F)       Kernel Functions for Drivers       usb_pipe_reset(9F)
2
3
4

NAME

6       usb_pipe_reset  -  Abort  queued requests from a USB pipe and reset the
7       pipe
8

SYNOPSIS

10       #include <sys/usb/usba.h>
11
12       void usb_pipe_reset(dev_info_t *dip,
13            usb_pipe_handle_t pipe_handle, usb_flags_t usb_flags,
14            void (*callback)(usb_pipe_handle_t cb_pipe_handle,
15            usb_opaque_t arg, int rval, usb_cb_flags_t flags),
16            usb_opaque_t callback_arg);
17
18

INTERFACE LEVEL

20       Solaris DDI specific (Solaris DDI)
21

PARAMETERS

23       dip             Pointer to the device's dev_info structure.
24
25
26       pipe_handle     Handle of the pipe to reset. Cannot be  the  handle  to
27                       the default control pipe.
28
29
30       usb_flags       USB_FLAGS_SLEEP  is  the only flag recognized. Wait for
31                       completion.
32
33
34       callback        Function called on completion  if  the  USB_FLAGS_SLEEP
35                       flag is not specified. If NULL, no notification of com‐
36                       pletion is provided.
37
38
39       callback_arg    Second argument to callback function.
40
41

DESCRIPTION

43       Call usb_pipe_reset() to reset a pipe which is in an error state, or to
44       abort  a current request and clear the pipe. The usb_pipe_reset() func‐
45       tion can be called on any pipe other than the default control pipe.
46
47
48       A pipe can be reset automatically when requests sent to the  pipe  have
49       the  USB_ATTRS_AUTOCLEARING  attribute specified. Client drivers see an
50       exception callback with the USB_CB_STALL_CLEARED callback flag  set  in
51       such cases.
52
53
54       Stalls  on  pipes executing requests without the USB_ATTRS_AUTOCLEARING
55       attribute set must be cleared by the client driver. The  client  driver
56       is  notified  of the stall via an exception callback. The client driver
57       must then call usb_pipe_reset() to clear the stall.
58
59
60       The usb_pipe_reset() function resets a pipe as follows:
61         1. Any polling activity is stopped if the  pipe  being  reset  is  an
62         interrupt or isochronous pipe.
63         2. All pending requests are removed from the pipe. An exception call‐
64         back, if specified beforehand, is executed for each aborted request.
65         3. The pipe is reset to the idle state.
66
67
68       Requests to reset the default control pipe are not allowed.  No  action
69       is taken on a pipe which is closing.
70
71
72       If  USB_FLAGS_SLEEP  is specified in flags, this function waits for the
73       action to complete before calling the callback handler  and  returning.
74       If  not specified, this function queues the request and returns immedi‐
75       ately, and the specified callback is called upon completion.
76
77
78       callback is the callback handler. It takes the following arguments:
79
80       usb_pipe_handle_t cb_pipe_handle
81
82           Handle of the pipe to reset.
83
84
85       usb_opaque_t callback_arg
86
87           Callback_arg specified to usb_pipe_reset().
88
89
90       int rval
91
92           Return value of the reset call.
93
94
95       usb_cb_flags_t callback_flags
96
97           Status of the queueing operation. Can be:
98
99           USB_CB_NO_INFO — Callback was uneventful.
100
101           USB_CB_ASYNC_REQ_FAILED — Error starting asynchronous request.
102
103

RETURN VALUES

105       Status is returned to the caller via the callback handler's rval  argu‐
106       ment. Possible callback hander rval argument values are:
107
108       USB_SUCCESS            Pipe successfully reset.
109
110
111       USB_INVALID_PIPE       pipe_handle  specifies a pipe which is closed or
112                              closing.
113
114
115       USB_INVALID_ARGS       dip   or   pipe_handle   arguments   are   NULL.
116                              USB_FLAGS_SLEEP is clear and callback is NULL.
117
118
119       USB_INVALID_CONTEXT    Called   from   interrupt   context   with   the
120                              USB_FLAGS_SLEEP flag set.
121
122
123       USB_INVALID_PERM       pipe_handle specifies the default control pipe.
124
125
126       USB_FAILURE            Asynchronous resources are unavailable. In  this
127                              case,  USB_CB_ASYNC_REQ_FAILED  is  passed in as
128                              the callback_flags arg to the callback hander.
129
130
131
132       Exception callback handlers of interrupt-IN and isochronous-IN requests
133       which  are  terminated  by  these commands are called with a completion
134       reason of USB_CR_STOPPED_POLLING.
135
136
137       Exception handlers of incomplete bulk requests are called with  a  com‐
138       pletion reason of USB_CR_FLUSHED.
139
140
141       Exception    handlers   of   unstarted   requests   are   called   with
142       USB_CR_PIPE_RESET.
143
144
145       Note that messages mirroring the above errors are logged to the console
146       logfile on error. This provides status for calls which could not other‐
147       wise provide status.
148

CONTEXT

150       May be called from user or kernel context regardless of arguments.  May
151       be  called from any callback with the USB_FLAGS_SLEEP clear. May not be
152       called  from  a  callback  executing  in  interrupt  context   if   the
153       USB_FLAGS_SLEEP flag is set.
154
155
156       If  the  USB_CB_ASYNC_REQ_FAILED  bit  is  clear in usb_cb_flags_t, the
157       callback, if supplied, can block because it is executing in kernel con‐
158       text.  Otherwise  the  callback  cannot  block.  Please  see  usb_call‐
159       back_flags(9S) for more information on callbacks.
160

EXAMPLES

162         void post_reset_handler(
163             usb_pipe_handle_t, usb_opaque_t, int, usb_cb_flags_t);
164
165         /*
166          * Do an asynchronous reset on bulk_pipe.
167          * Execute post_reset_handler when done.
168          */
169         usb_pipe_reset(dip, bulk_pipe, 0, post_reset_handler, arg);
170
171         /* Do a synchronous reset on bulk_pipe. */
172         usb_pipe_reset(dip, bulk_pipe, USB_FLAGS_SLEEP, NULL, NULL);
173
174
175

ATTRIBUTES

177       See attributes(5) for descriptions of the following attributes:
178
179
180
181
182       ┌─────────────────────────────┬─────────────────────────────┐
183       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
184       ├─────────────────────────────┼─────────────────────────────┤
185       │Architecture                 │PCI-based systems            │
186       ├─────────────────────────────┼─────────────────────────────┤
187       │Interface stability          │Committed                    │
188       ├─────────────────────────────┼─────────────────────────────┤
189       │Availability                 │SUNWusb                      │
190       └─────────────────────────────┴─────────────────────────────┘
191

SEE ALSO

193       attributes(5),         usb_get_cfg(9F),         usb_pipe_bulk_xfer(9F),
194       usb_pipe_close(9F),     usb_get_status(9F),     usb_pipe_ctrl_xfer(9F),
195       usb_pipe_drain_reqs(9F),                        usb_pipe_get_state(9F),
196       usb_pipe_intr_xfer(9F),    usb_pipe_isoc_xfer(9F),   usb_pipe_open(9F),
197       usb_pipe_stop_intr_polling(9F),         usb_pipe_stop_isoc_polling(9F),
198       usb_callback_flags(9S)
199
200
201
202SunOS 5.11                        5 Jan 2004                usb_pipe_reset(9F)
Impressum