| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: usbdi.c,v 1.148 2013/01/22 12:40:43 jmcneill Exp $ */ | | 1 | /* $NetBSD: usbdi.c,v 1.149 2013/01/22 13:18:47 jmcneill Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 1998, 2012 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 1998, 2012 The NetBSD Foundation, Inc. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * This code is derived from software contributed to The NetBSD Foundation | | 7 | * This code is derived from software contributed to The NetBSD Foundation |
8 | * by Lennart Augustsson (lennart@augustsson.net) at | | 8 | * by Lennart Augustsson (lennart@augustsson.net) at |
9 | * Carlstedt Research & Technology and Matthew R. Green (mrg@eterna.com.au). | | 9 | * Carlstedt Research & Technology and Matthew R. Green (mrg@eterna.com.au). |
10 | * | | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | | 11 | * Redistribution and use in source and binary forms, with or without |
12 | * modification, are permitted provided that the following conditions | | 12 | * modification, are permitted provided that the following conditions |
13 | * are met: | | 13 | * are met: |
14 | * 1. Redistributions of source code must retain the above copyright | | 14 | * 1. Redistributions of source code must retain the above copyright |
| @@ -21,27 +21,27 @@ | | | @@ -21,27 +21,27 @@ |
21 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | | 21 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
22 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | | 22 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
23 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | | 23 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS |
24 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | | 24 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
25 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | | 25 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
26 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | | 26 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
27 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | | 27 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | | 28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
29 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | | 29 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
30 | * POSSIBILITY OF SUCH DAMAGE. | | 30 | * POSSIBILITY OF SUCH DAMAGE. |
31 | */ | | 31 | */ |
32 | | | 32 | |
33 | #include <sys/cdefs.h> | | 33 | #include <sys/cdefs.h> |
34 | __KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.148 2013/01/22 12:40:43 jmcneill Exp $"); | | 34 | __KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.149 2013/01/22 13:18:47 jmcneill Exp $"); |
35 | | | 35 | |
36 | #ifdef _KERNEL_OPT | | 36 | #ifdef _KERNEL_OPT |
37 | #include "opt_compat_netbsd.h" | | 37 | #include "opt_compat_netbsd.h" |
38 | #endif | | 38 | #endif |
39 | | | 39 | |
40 | #include <sys/param.h> | | 40 | #include <sys/param.h> |
41 | #include <sys/systm.h> | | 41 | #include <sys/systm.h> |
42 | #include <sys/kernel.h> | | 42 | #include <sys/kernel.h> |
43 | #include <sys/device.h> | | 43 | #include <sys/device.h> |
44 | #include <sys/malloc.h> | | 44 | #include <sys/malloc.h> |
45 | #include <sys/proc.h> | | 45 | #include <sys/proc.h> |
46 | #include <sys/bus.h> | | 46 | #include <sys/bus.h> |
47 | #include <sys/cpu.h> | | 47 | #include <sys/cpu.h> |
| @@ -167,48 +167,48 @@ usbd_open_pipe_ival(usbd_interface_handl | | | @@ -167,48 +167,48 @@ usbd_open_pipe_ival(usbd_interface_handl |
167 | iface, address, flags)); | | 167 | iface, address, flags)); |
168 | | | 168 | |
169 | for (i = 0; i < iface->idesc->bNumEndpoints; i++) { | | 169 | for (i = 0; i < iface->idesc->bNumEndpoints; i++) { |
170 | ep = &iface->endpoints[i]; | | 170 | ep = &iface->endpoints[i]; |
171 | if (ep->edesc == NULL) | | 171 | if (ep->edesc == NULL) |
172 | return (USBD_IOERROR); | | 172 | return (USBD_IOERROR); |
173 | if (ep->edesc->bEndpointAddress == address) | | 173 | if (ep->edesc->bEndpointAddress == address) |
174 | goto found; | | 174 | goto found; |
175 | } | | 175 | } |
176 | return (USBD_BAD_ADDRESS); | | 176 | return (USBD_BAD_ADDRESS); |
177 | found: | | 177 | found: |
178 | if ((flags & USBD_EXCLUSIVE_USE) && ep->refcnt != 0) | | 178 | if ((flags & USBD_EXCLUSIVE_USE) && ep->refcnt != 0) |
179 | return (USBD_IN_USE); | | 179 | return (USBD_IN_USE); |
180 | err = usbd_setup_pipe(iface->device, iface, ep, ival, &p); | | 180 | err = usbd_setup_pipe_flags(iface->device, iface, ep, ival, &p, flags); |
181 | if (err) | | 181 | if (err) |
182 | return (err); | | 182 | return (err); |
183 | LIST_INSERT_HEAD(&iface->pipes, p, next); | | 183 | LIST_INSERT_HEAD(&iface->pipes, p, next); |
184 | *pipe = p; | | 184 | *pipe = p; |
185 | return (USBD_NORMAL_COMPLETION); | | 185 | return (USBD_NORMAL_COMPLETION); |
186 | } | | 186 | } |
187 | | | 187 | |
188 | usbd_status | | 188 | usbd_status |
189 | usbd_open_pipe_intr(usbd_interface_handle iface, u_int8_t address, | | 189 | usbd_open_pipe_intr(usbd_interface_handle iface, u_int8_t address, |
190 | u_int8_t flags, usbd_pipe_handle *pipe, | | 190 | u_int8_t flags, usbd_pipe_handle *pipe, |
191 | usbd_private_handle priv, void *buffer, u_int32_t len, | | 191 | usbd_private_handle priv, void *buffer, u_int32_t len, |
192 | usbd_callback cb, int ival) | | 192 | usbd_callback cb, int ival) |
193 | { | | 193 | { |
194 | usbd_status err; | | 194 | usbd_status err; |
195 | usbd_xfer_handle xfer; | | 195 | usbd_xfer_handle xfer; |
196 | usbd_pipe_handle ipipe; | | 196 | usbd_pipe_handle ipipe; |
197 | | | 197 | |
198 | DPRINTFN(3,("usbd_open_pipe_intr: address=0x%x flags=0x%x len=%d\n", | | 198 | DPRINTFN(3,("usbd_open_pipe_intr: address=0x%x flags=0x%x len=%d\n", |
199 | address, flags, len)); | | 199 | address, flags, len)); |
200 | | | 200 | |
201 | err = usbd_open_pipe_ival(iface, address, USBD_EXCLUSIVE_USE, | | 201 | err = usbd_open_pipe_ival(iface, address, USBD_EXCLUSIVE_USE | flags, |
202 | &ipipe, ival); | | 202 | &ipipe, ival); |
203 | if (err) | | 203 | if (err) |
204 | return (err); | | 204 | return (err); |
205 | xfer = usbd_alloc_xfer(iface->device); | | 205 | xfer = usbd_alloc_xfer(iface->device); |
206 | if (xfer == NULL) { | | 206 | if (xfer == NULL) { |
207 | err = USBD_NOMEM; | | 207 | err = USBD_NOMEM; |
208 | goto bad1; | | 208 | goto bad1; |
209 | } | | 209 | } |
210 | usbd_setup_xfer(xfer, ipipe, priv, buffer, len, flags, | | 210 | usbd_setup_xfer(xfer, ipipe, priv, buffer, len, flags, |
211 | USBD_NO_TIMEOUT, cb); | | 211 | USBD_NO_TIMEOUT, cb); |
212 | ipipe->intrxfer = xfer; | | 212 | ipipe->intrxfer = xfer; |
213 | ipipe->repeat = 1; | | 213 | ipipe->repeat = 1; |
214 | err = usbd_transfer(xfer); | | 214 | err = usbd_transfer(xfer); |