1usb_intr_request(9S)      Data Structures for Drivers     usb_intr_request(9S)
2
3
4

NAME

6       usb_intr_request - USB interrupt request structure
7

SYNOPSIS

9       #include <sys/usb/usba.h>
10
11

INTERFACE LEVEL

13       Solaris DDI specific (Solaris DDI)
14

DESCRIPTION

16       An  interrupt  request  (that  is,  a request sent through an interrupt
17       pipe), is used to transfer  small amounts  of  data  infrequently,  but
18       with bounded  service periods. (Data flows in either direction.) Please
19       refer to Section 5.7 of the USB 2.0 specification  for  information  on
20       interrupt  transfers.  (The  USB  2.0  specification  is  available  at
21       www.usb.org.)
22
23
24       The fields in the  usb_intr_req_t  are  used  to  format  an  interrupt
25       request.  Please  see  below  for  acceptable combinations of flags and
26       attributes.
27
28
29       The usb_intr_req_t fields are:
30
31           ushort_t       intr_len;     /* Size of pkt. Must be set */
32                                         /* Max size is 8K for low/full speed */
33                                         /* Max size is 20K for high speed */
34            mblk_t         *intr_data;   /* Data for the data phase  */
35                                         /* IN: zero-len mblk alloc by client */
36                                         /* OUT: allocated by client */
37            usb_opaque_t   intr_client_private; /* client specific information  */
38            uint_t         intr_timeout; /* only with ONE TIME POLL, in secs */
39                                         /* If set to zero, defaults to 5 sec */
40            usb_req_attrs_t intr_attributes;
41
42            /* Normal callback function, called upon completion. */
43            void           (*intr_cb)(
44                               usb_pipe_handle_t ph, struct usb_intr_req *req);
45
46            /* Exception callback function, for error handling. */
47            void           (*intr_exc_cb)(
48                               usb_pipe_handle_t ph, struct usb_intr_req *req);
49
50            /* set by USBA/HCD on completion */
51            usb_cr_t    intr_completion_reason; /* overall completion status */
52                                               /* See usb_completion_reason(9S) */
53            usb_cb_flags_t intr_cb_flags; /* recovery done by callback hndlr */
54                                              /* See usb_callback_flags(9S) */
55
56
57
58       Request attributes define special handling for transfers. The following
59       attributes are valid for interrupt requests:
60
61       USB_ATTRS_SHORT_XFER_OK    Accept transfers where less data is received
62                                  than expected.
63
64
65       USB_ATTRS_AUTOCLEARING     Have USB  framework  reset  pipe  and  clear
66                                  functional  stalls  automatically  on excep‐
67                                  tion.
68
69
70       USB_ATTRS_PIPE_RESET       Have USB framework reset pipe  automatically
71                                  on exception.
72
73
74       USB_ATTRS_ONE_XFER         Perform  a single IN transfer.  Do not start
75                                  periodic transfers with this request.
76
77
78
79       Please see usb_request_attributes(9S) for more information.
80
81         Interrupt transfers/requests are subject to the following
82         constraints and caveats:
83
84         1) The following table indicates combinations of
85            usb_pipe_intr_xfer() flags argument and fields
86            of the usb_intr_req_t request argument (X = don't care):
87
88              "none" as attributes in the table below indicates
89              neither ONE_XFER nor SHORT_XFER_OK
90
91              flags     Type  attributes      data    timeout semantics
92              ----------------------------------------------------------------
93              X         IN    X               !=NULL  X       illegal
94
95              X         IN    !ONE_XFER       X       !=0     illegal
96
97              X         IN    !ONE_XFER       NULL    0       See table note (A)
98
99              no sleep  IN    ONE_XFER        NULL    0       See table note (B)
100
101              no sleep  IN    ONE_XFER        NULL    !=0     See table note (C)
102
103              sleep     IN    ONE_XFER        NULL    0       See table note (D)
104
105              sleep     IN    ONE_XFER        NULL    !=0     See table note (E)
106
107              X         OUT   X               NULL    X       illegal
108
109              X         OUT   ONE_XFER        X       X       illegal
110
111              X         OUT   SHORT_XFER_OK   X       X       illegal
112
113              no sleep  OUT   none            !=NULL  0       See table note (F)
114
115              no sleep  OUT   none            !=NULL  !=0     See table note (G)
116
117              sleep     OUT   none            !=NULL  0       See table note (H)
118
119              sleep     OUT   none            !=NULL  !=0     See table note (I)
120
121              Table notes:
122
123                A) Continuous polling, new data is returned in cloned request
124                   structures via continous callbacks, original request is
125                   returned on stop polling.
126
127                B) One time poll, no timeout, callback when data is
128                   received.
129
130                C) One time poll, with timeout, callback when data
131                   is received.
132
133                D) One time poll, no timeout, one callback, unblock
134                   when transfer completes.
135
136                E) One time poll, timeout, one callback, unblock when
137                   transfer completes or timeout occurs.
138
139                F) Transfer until data exhausted, no timeout, callback
140                   when done.
141
142                G) Transfer until data exhausted, timeout, callback
143                   when done.
144
145                H) Transfer until data exhausted, no timeout, unblock
146                   when data is received.
147
148                I) Transfer until data exhausted, timeout, unblock
149                   when data is received.
150
151
152            2) USB_FLAGS_SLEEP indicates here just to wait for
153               resources, except when ONE_XFER is set, in which case it
154               also waits for completion before returning.
155
156            3) Reads (IN):
157
158                a) The client driver does *not* provide a data buffer.
159                   By default, a READ request would mean continuous
160                   polling for data IN.  The USBA framework allocates a
161                   new data buffer for each poll.  intr_len specifies
162                  the amount of 'periodic data' for each poll.
163
164                b) The USBA framework issues a callback to the client
165                   at the end of a polling interval when there is data to
166                   return.  Each callback returns its data in a new request
167                   cloned from the original.  Note that the amount of data
168                   read IN is either intr_len or "wMaxPacketSize" in length.
169
170                c) Normally, the HCD keeps polling the interrupt endpoint
171                   forever even if there is no data to be read IN.  A
172                   client driver may stop this polling by calling
173                   usb_pipe_stop_intr_polling(9F).
174
175                d) If a client driver chooses to pass USB_ATTRS_ONE_XFER
176                   as 'xfer_attributes' the HCD polls for data until
177                   some data is received.  The USBA framework reads in
178                   the data, does a callback, and stops polling for any
179                   more data.  In this case, the client
180                   driver need not explicitly call
181                   usb_pipe_stop_intr_polling().
182
183                e) All requests with USB_ATTRS_ONE_XFER require callbacks
184                   to be specified.
185
186                f) When continuous polling is stopped, the original
187                   request is returned with USB_CR_STOPPED_POLLING.
188
189                g) If the USB_ATTRS_SHORT_XFER_OK attribute is not set
190                   and a short transfer is received while polling,
191                   an error is assumed and polling is stopped.  In this
192                   case or the case of other errors, the error must be cleared
193                   and polling restarted by the client driver. Setting the
194                   USB_ATTRS_AUTOCLEARING attribute will clear the error
195                   but not restart polling.  (NOTE: Polling can be
196                   restarted from an exception callback corresponding to
197                   an original request.  Please see usb_pipe_intr_xfer(9F)
198                   for more information.
199
200            4) Writes (OUT):
201
202                a) A client driver provides the data buffer, and
203                   data, needed for intr write.
204
205                b) Unlike read (see previous section), there
206                  is no continuous write mode.
207
208                c) The USB_ATTRS_ONE_XFER attribute is illegal.
209                   By default USBA keeps writing intr data until
210                   the provided data buffer has been
211                   written out. The USBA framework does ONE
212                   callback to the client driver.
213
214                d) Queueing is supported.
215
216             The intr_completion_reason indicates the status
217             of the transfer.  See usb_completion_reason(9S) for
218             usb_cr_t definitions.
219
220             The intr_cb_flags are set prior to calling the
221             exception callback handler, to summarize recovery actions
222             taken and errors encountered during
223             recovery.  See usb_callback_flags(9S) for
224             usb_cb_flags_t definitions.
225
226             --- Callback handling ---
227
228             All usb request types share the same callback
229             handling. Please see usb_callback_flags(9S) for a
230            description of use and operation.
231
232

ATTRIBUTES

234       See attributes(5) for descriptions of the following attributes:
235
236
237
238
239       ┌─────────────────────────────┬─────────────────────────────┐
240       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
241       ├─────────────────────────────┼─────────────────────────────┤
242       │Architecture                 │PCI-based systems            │
243       ├─────────────────────────────┼─────────────────────────────┤
244       │Interface stability          │Committed                    │
245       ├─────────────────────────────┼─────────────────────────────┤
246       │Availability                 │SUNWusbu                     │
247       └─────────────────────────────┴─────────────────────────────┘
248

SEE ALSO

250       usb_alloc_request(9F), usb_pipe_ctrl_xfer(9F),  usb_pipe_bulk_xfer(9F),
251       usb_pipe_intr_xfer(9F),  usb_pipe_isoc_xfer(9F),  usb_bulk_request(9S),
252       usb_callback_flags(9S),                      usb_completion_reason(9S),
253       usb_ctrl_request(9S), usb_isoc_request(9S), usb_request_attributes(9S)
254
255
256
257SunOS 5.11                        5 Jan 2004              usb_intr_request(9S)
Impressum