Thu Mar 5 08:34:47 2015 UTC ()
Kill URQ_AUTO_BUFFER


(skrll)
diff -r1.162.2.10 -r1.162.2.11 src/sys/dev/usb/usbdi.c
diff -r1.109.2.11 -r1.109.2.12 src/sys/dev/usb/usbdivar.h

cvs diff -r1.162.2.10 -r1.162.2.11 src/sys/dev/usb/usbdi.c (expand / switch to unified diff)

--- src/sys/dev/usb/usbdi.c 2015/02/01 13:09:15 1.162.2.10
+++ src/sys/dev/usb/usbdi.c 2015/03/05 08:34:47 1.162.2.11
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: usbdi.c,v 1.162.2.10 2015/02/01 13:09:15 skrll Exp $ */ 1/* $NetBSD: usbdi.c,v 1.162.2.11 2015/03/05 08:34:47 skrll 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.162.2.10 2015/02/01 13:09:15 skrll Exp $"); 34__KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.162.2.11 2015/03/05 08:34:47 skrll Exp $");
35 35
36#ifdef _KERNEL_OPT 36#ifdef _KERNEL_OPT
37#include "opt_usb.h" 37#include "opt_usb.h"
38#include "opt_compat_netbsd.h" 38#include "opt_compat_netbsd.h"
39#endif 39#endif
40 40
41#include "usb_dma.h" 41#include "usb_dma.h"
42 42
43#include <sys/param.h> 43#include <sys/param.h>
44#include <sys/systm.h> 44#include <sys/systm.h>
45#include <sys/kernel.h> 45#include <sys/kernel.h>
46#include <sys/device.h> 46#include <sys/device.h>
47#include <sys/kmem.h> 47#include <sys/kmem.h>
@@ -212,39 +212,46 @@ usbd_open_pipe_intr(usbd_interface_handl @@ -212,39 +212,46 @@ usbd_open_pipe_intr(usbd_interface_handl
212 USBHIST_LOG(usbdebug, "address = 0x%x flags = 0x%x len = %d", 212 USBHIST_LOG(usbdebug, "address = 0x%x flags = 0x%x len = %d",
213 address, flags, len, 0); 213 address, flags, len, 0);
214 214
215 err = usbd_open_pipe_ival(iface, address, 215 err = usbd_open_pipe_ival(iface, address,
216 USBD_EXCLUSIVE_USE | (flags & USBD_MPSAFE), 216 USBD_EXCLUSIVE_USE | (flags & USBD_MPSAFE),
217 &ipipe, ival); 217 &ipipe, ival);
218 if (err) 218 if (err)
219 return err; 219 return err;
220 xfer = usbd_alloc_xfer(iface->ui_dev); 220 xfer = usbd_alloc_xfer(iface->ui_dev);
221 if (xfer == NULL) { 221 if (xfer == NULL) {
222 err = USBD_NOMEM; 222 err = USBD_NOMEM;
223 goto bad1; 223 goto bad1;
224 } 224 }
 225 void *buf = usbd_alloc_buffer(xfer, len);
 226 if (buf == NULL) {
 227 err = ENOMEM;
 228 goto bad2;
 229 }
 230
225 usbd_setup_xfer(xfer, ipipe, priv, buffer, len, flags, 231 usbd_setup_xfer(xfer, ipipe, priv, buffer, len, flags,
226 USBD_NO_TIMEOUT, cb); 232 USBD_NO_TIMEOUT, cb);
227 ipipe->up_intrxfer = xfer; 233 ipipe->up_intrxfer = xfer;
228 ipipe->up_repeat = 1; 234 ipipe->up_repeat = 1;
229 err = usbd_transfer(xfer); 235 err = usbd_transfer(xfer);
230 *pipe = ipipe; 236 *pipe = ipipe;
231 if (err != USBD_IN_PROGRESS) 237 if (err != USBD_IN_PROGRESS)
232 goto bad2; 238 goto bad3;
233 return USBD_NORMAL_COMPLETION; 239 return USBD_NORMAL_COMPLETION;
234 240
235 bad2: 241 bad3:
236 ipipe->up_intrxfer = NULL; 242 ipipe->up_intrxfer = NULL;
237 ipipe->up_repeat = 0; 243 ipipe->up_repeat = 0;
 244 bad2:
238 usbd_free_xfer(xfer); 245 usbd_free_xfer(xfer);
239 bad1: 246 bad1:
240 usbd_close_pipe(ipipe); 247 usbd_close_pipe(ipipe);
241 return err; 248 return err;
242} 249}
243 250
244usbd_status 251usbd_status
245usbd_close_pipe(usbd_pipe_handle pipe) 252usbd_close_pipe(usbd_pipe_handle pipe)
246{ 253{
247 254
248 USBHIST_FUNC(); USBHIST_CALLED(usbdebug); 255 USBHIST_FUNC(); USBHIST_CALLED(usbdebug);
249 256
250#ifdef DIAGNOSTIC 257#ifdef DIAGNOSTIC
@@ -288,77 +295,51 @@ usbd_transfer(usbd_xfer_handle xfer) @@ -288,77 +295,51 @@ usbd_transfer(usbd_xfer_handle xfer)
288 295
289#ifdef USB_DEBUG 296#ifdef USB_DEBUG
290 if (usbdebug > 5) 297 if (usbdebug > 5)
291 usbd_dump_queue(pipe); 298 usbd_dump_queue(pipe);
292#endif 299#endif
293 xfer->ux_done = 0; 300 xfer->ux_done = 0;
294 301
295 if (pipe->up_aborting) { 302 if (pipe->up_aborting) {
296 USBHIST_LOG(usbdebug, "<- done xfer %p, aborting", xfer, 0, 0, 303 USBHIST_LOG(usbdebug, "<- done xfer %p, aborting", xfer, 0, 0,
297 0); 304 0);
298 return USBD_CANCELLED; 305 return USBD_CANCELLED;
299 } 306 }
300 307
301 struct usbd_bus *bus = pipe->up_dev->ud_bus; 308 KASSERT(xfer->ux_length == 0 || xfer->ux_buf != NULL);
302 309
303 size = xfer->ux_length; 310 size = xfer->ux_length;
304 flags = xfer->ux_flags; 311 flags = xfer->ux_flags;
305 312
306 /* 313 struct usbd_bus *bus = pipe->up_dev->ud_bus;
307 * isoc transfers are always size == 0, whereas other transfers can 
308 * require a URQ_AUTO_BUFFER buffer. 
309 * 
310 * URQ_AUTO_BUFFER will be removed at some point, i.e. the transfer 
311 * should provide the buffer. 
312 */ 
313 if (size != 0) { 
314 if (xfer->ux_buf == NULL) { 
315 xfer->ux_buf = usbd_alloc_buffer(xfer, size); 
316 if (xfer->ux_buf == NULL) 
317 return USBD_NOMEM; 
318 314
319#ifdef DIAGNOSTIC 
320 if (xfer->ux_rqflags & URQ_AUTO_BUFFER) 
321 printf("usbd_transfer: has old buffer!\n"); 
322#endif 
323 xfer->ux_rqflags |= URQ_AUTO_BUFFER; 
324 } 
325 } 
326 if (bus->ub_usedma) { 315 if (bus->ub_usedma) {
327 /* 316 /*
328 * Copy data if not using the xfer buffer. isoc transfers 317 * Copy data if not using the xfer buffer. isoc transfers
329 * always use DMA buffer, i.e. buffer == NULL 318 * always use DMA buffer, i.e. buffer == NULL
330 */ 319 */
331 if (xfer->ux_buffer == NULL) { 320 if (xfer->ux_buffer == NULL) {
332 xfer->ux_buffer = xfer->ux_buf; 321 xfer->ux_buffer = xfer->ux_buf;
333 } else if (xfer->ux_buffer != xfer->ux_buf) { 322 } else if (xfer->ux_buffer != xfer->ux_buf) {
334 memcpy(xfer->ux_buf, xfer->ux_buffer, size); 323 memcpy(xfer->ux_buf, xfer->ux_buffer, size);
335 } 324 }
336 } else { 325 } else {
337 xfer->ux_buffer = xfer->ux_buf; 326 xfer->ux_buffer = xfer->ux_buf;
338 } 327 }
339 328
340 /* xfer is not valid after the transfer method unless synchronous */ 329 /* xfer is not valid after the transfer method unless synchronous */
341 err = pipe->up_methods->upm_transfer(xfer); 330 err = pipe->up_methods->upm_transfer(xfer);
342 USBHIST_LOG(usbdebug, "<- done transfer %p, err = %d", xfer, err, 0, 0); 331 USBHIST_LOG(usbdebug, "<- done transfer %p, err = %d", xfer, err, 0, 0);
343 332
344 if (err != USBD_IN_PROGRESS && err) { 
345 /* The transfer has not been queued, so free buffer. */ 
346 if (xfer->ux_rqflags & URQ_AUTO_BUFFER) { 
347 usbd_free_buffer(xfer); 
348 xfer->ux_rqflags &= ~URQ_AUTO_BUFFER; 
349 } 
350 } 
351 
352 if (!(flags & USBD_SYNCHRONOUS)) { 333 if (!(flags & USBD_SYNCHRONOUS)) {
353 USBHIST_LOG(usbdebug, "<- done xfer %p, not sync", xfer, 0, 0, 334 USBHIST_LOG(usbdebug, "<- done xfer %p, not sync", xfer, 0, 0,
354 0); 335 0);
355 return err; 336 return err;
356 } 337 }
357 338
358 /* Sync transfer, wait for completion. */ 339 /* Sync transfer, wait for completion. */
359 if (err != USBD_IN_PROGRESS) { 340 if (err != USBD_IN_PROGRESS) {
360 USBHIST_LOG(usbdebug, "<- done xfer %p, not in progress", xfer, 341 USBHIST_LOG(usbdebug, "<- done xfer %p, not in progress", xfer,
361 0, 0, 0); 342 0, 0, 0);
362 return err; 343 return err;
363 } 344 }
364 usbd_lock_pipe(pipe); 345 usbd_lock_pipe(pipe);
@@ -395,27 +376,26 @@ usbd_sync_transfer(usbd_xfer_handle xfer @@ -395,27 +376,26 @@ usbd_sync_transfer(usbd_xfer_handle xfer
395usbd_status 376usbd_status
396usbd_sync_transfer_sig(usbd_xfer_handle xfer) 377usbd_sync_transfer_sig(usbd_xfer_handle xfer)
397{ 378{
398 xfer->ux_flags |= USBD_SYNCHRONOUS | USBD_SYNCHRONOUS_SIG; 379 xfer->ux_flags |= USBD_SYNCHRONOUS | USBD_SYNCHRONOUS_SIG;
399 return usbd_transfer(xfer); 380 return usbd_transfer(xfer);
400} 381}
401 382
402void * 383void *
403usbd_alloc_buffer(usbd_xfer_handle xfer, uint32_t size) 384usbd_alloc_buffer(usbd_xfer_handle xfer, uint32_t size)
404{ 385{
405 386
406 KASSERT(xfer->ux_buf == NULL); 387 KASSERT(xfer->ux_buf == NULL);
407 KASSERT(size != 0); 388 KASSERT(size != 0);
408 KASSERT(!(xfer->ux_rqflags & URQ_AUTO_BUFFER)); 
409 389
410 xfer->ux_bufsize = 0; 390 xfer->ux_bufsize = 0;
411#if NUSB_DMA > 0 391#if NUSB_DMA > 0
412 struct usbd_bus *bus = xfer->ux_dev->ud_bus; 392 struct usbd_bus *bus = xfer->ux_dev->ud_bus;
413 393
414 if (bus->ub_usedma) { 394 if (bus->ub_usedma) {
415 usb_dma_t *dmap = &xfer->ux_dmabuf; 395 usb_dma_t *dmap = &xfer->ux_dmabuf;
416 396
417 int err = usb_allocmem_flags(bus, size, 0, dmap, bus->ub_dmaflags); 397 int err = usb_allocmem_flags(bus, size, 0, dmap, bus->ub_dmaflags);
418 if (err) { 398 if (err) {
419 return NULL; 399 return NULL;
420 } 400 }
421 xfer->ux_buf = KERNADDR(&xfer->ux_dmabuf, 0); 401 xfer->ux_buf = KERNADDR(&xfer->ux_dmabuf, 0);
@@ -433,27 +413,26 @@ usbd_alloc_buffer(usbd_xfer_handle xfer, @@ -433,27 +413,26 @@ usbd_alloc_buffer(usbd_xfer_handle xfer,
433 413
434 return xfer->ux_buf; 414 return xfer->ux_buf;
435} 415}
436 416
437void 417void
438usbd_free_buffer(usbd_xfer_handle xfer) 418usbd_free_buffer(usbd_xfer_handle xfer)
439{ 419{
440 KASSERT(xfer->ux_buf != NULL); 420 KASSERT(xfer->ux_buf != NULL);
441 KASSERT(xfer->ux_bufsize != 0); 421 KASSERT(xfer->ux_bufsize != 0);
442 422
443 void *buf = xfer->ux_buf; 423 void *buf = xfer->ux_buf;
444 uint32_t size = xfer->ux_bufsize; 424 uint32_t size = xfer->ux_bufsize;
445 425
446 xfer->ux_rqflags &= ~URQ_AUTO_BUFFER; 
447 xfer->ux_buf = NULL; 426 xfer->ux_buf = NULL;
448 xfer->ux_bufsize = 0; 427 xfer->ux_bufsize = 0;
449 428
450#if NUSB_DMA > 0 429#if NUSB_DMA > 0
451 struct usbd_bus *bus = xfer->ux_dev->ud_bus; 430 struct usbd_bus *bus = xfer->ux_dev->ud_bus;
452 431
453 if (bus->ub_usedma) { 432 if (bus->ub_usedma) {
454 usb_dma_t *dmap = &xfer->ux_dmabuf; 433 usb_dma_t *dmap = &xfer->ux_dmabuf;
455 434
456 usb_freemem(bus, dmap); 435 usb_freemem(bus, dmap);
457 return; 436 return;
458 } 437 }
459#endif 438#endif
@@ -897,34 +876,26 @@ usb_transfer_complete(usbd_xfer_handle x @@ -897,34 +876,26 @@ usb_transfer_complete(usbd_xfer_handle x
897 /* XXXX */ 876 /* XXXX */
898 if (polling) 877 if (polling)
899 pipe->up_running = 0; 878 pipe->up_running = 0;
900 879
901 if (xfer->ux_buffer != xfer->ux_buf) { 880 if (xfer->ux_buffer != xfer->ux_buf) {
902 /* can only be different for DMA busses */ 881 /* can only be different for DMA busses */
903 KASSERT(bus->ub_usedma); 882 KASSERT(bus->ub_usedma);
904 KDASSERTMSG(xfer->ux_actlen <= xfer->ux_length, 883 KDASSERTMSG(xfer->ux_actlen <= xfer->ux_length,
905 "actlen %d length %d",xfer->ux_actlen, xfer->ux_length); 884 "actlen %d length %d",xfer->ux_actlen, xfer->ux_length);
906 885
907 memcpy(xfer->ux_buffer, xfer->ux_buf, xfer->ux_actlen); 886 memcpy(xfer->ux_buffer, xfer->ux_buf, xfer->ux_actlen);
908 } 887 }
909 888
910 /* XXX remove at some point */ 
911 /* if we allocated the buffer in usbd_transfer() we free it here. */ 
912 if (xfer->ux_rqflags & URQ_AUTO_BUFFER) { 
913 if (!repeat) { 
914 usbd_free_buffer(xfer); 
915 xfer->ux_rqflags &= ~URQ_AUTO_BUFFER; 
916 } 
917 } 
918 889
919 if (!repeat) { 890 if (!repeat) {
920 /* Remove request from queue. */ 891 /* Remove request from queue. */
921 892
922 KASSERTMSG(!SIMPLEQ_EMPTY(&pipe->up_queue), 893 KASSERTMSG(!SIMPLEQ_EMPTY(&pipe->up_queue),
923 "pipe %p is empty, but xfer %p wants to complete", pipe, 894 "pipe %p is empty, but xfer %p wants to complete", pipe,
924 xfer); 895 xfer);
925#ifdef DIAGNOSTIC 896#ifdef DIAGNOSTIC
926 if (xfer != SIMPLEQ_FIRST(&pipe->up_queue)) 897 if (xfer != SIMPLEQ_FIRST(&pipe->up_queue))
927 printf("%s: bad dequeue %p != %p\n", __func__, 898 printf("%s: bad dequeue %p != %p\n", __func__,
928 xfer, SIMPLEQ_FIRST(&pipe->up_queue)); 899 xfer, SIMPLEQ_FIRST(&pipe->up_queue));
929 xfer->ux_state = XFER_BUSY; 900 xfer->ux_state = XFER_BUSY;
930#endif 901#endif
@@ -1096,26 +1067,36 @@ usbd_do_request_flags_pipe(usbd_device_h @@ -1096,26 +1067,36 @@ usbd_do_request_flags_pipe(usbd_device_h
1096 usb_device_request_t *req, void *data, uint16_t flags, int *actlen, 1067 usb_device_request_t *req, void *data, uint16_t flags, int *actlen,
1097 uint32_t timeout) 1068 uint32_t timeout)
1098{ 1069{
1099 usbd_xfer_handle xfer; 1070 usbd_xfer_handle xfer;
1100 usbd_status err; 1071 usbd_status err;
1101 1072
1102 USBHIST_FUNC(); USBHIST_CALLED(usbdebug); 1073 USBHIST_FUNC(); USBHIST_CALLED(usbdebug);
1103 1074
1104 ASSERT_SLEEPABLE(); 1075 ASSERT_SLEEPABLE();
1105 1076
1106 xfer = usbd_alloc_xfer(dev); 1077 xfer = usbd_alloc_xfer(dev);
1107 if (xfer == NULL) 1078 if (xfer == NULL)
1108 return USBD_NOMEM; 1079 return USBD_NOMEM;
 1080
 1081 if (UGETW(req->wLength) != 0) {
 1082 void *buf = usbd_alloc_buffer(xfer, UGETW(req->wLength));
 1083 if (buf == NULL) {
 1084 err = ENOMEM;
 1085 goto bad;
 1086 }
 1087 }
 1088
 1089
1109 usbd_setup_default_xfer(xfer, dev, 0, timeout, req, 1090 usbd_setup_default_xfer(xfer, dev, 0, timeout, req,
1110 data, UGETW(req->wLength), flags, 0); 1091 data, UGETW(req->wLength), flags, 0);
1111 xfer->ux_pipe = pipe; 1092 xfer->ux_pipe = pipe;
1112 err = usbd_sync_transfer(xfer); 1093 err = usbd_sync_transfer(xfer);
1113#if defined(USB_DEBUG) || defined(DIAGNOSTIC) 1094#if defined(USB_DEBUG) || defined(DIAGNOSTIC)
1114 if (xfer->ux_actlen > xfer->ux_length) { 1095 if (xfer->ux_actlen > xfer->ux_length) {
1115 USBHIST_LOG(usbdebug, "overrun addr = %d type = 0x%02x", 1096 USBHIST_LOG(usbdebug, "overrun addr = %d type = 0x%02x",
1116 dev->ud_addr, xfer->ux_request.bmRequestType, 0, 0); 1097 dev->ud_addr, xfer->ux_request.bmRequestType, 0, 0);
1117 USBHIST_LOG(usbdebug, " req = 0x%02x val = %d index = %d", 1098 USBHIST_LOG(usbdebug, " req = 0x%02x val = %d index = %d",
1118 xfer->ux_request.bRequest, UGETW(xfer->ux_request.wValue), 1099 xfer->ux_request.bRequest, UGETW(xfer->ux_request.wValue),
1119 UGETW(xfer->ux_request.wIndex), 0); 1100 UGETW(xfer->ux_request.wIndex), 0);
1120 USBHIST_LOG(usbdebug, " rlen = %d length = %d actlen = %d", 1101 USBHIST_LOG(usbdebug, " rlen = %d length = %d actlen = %d",
1121 UGETW(xfer->ux_request.wLength), 1102 UGETW(xfer->ux_request.wLength),

cvs diff -r1.109.2.11 -r1.109.2.12 src/sys/dev/usb/usbdivar.h (expand / switch to unified diff)

--- src/sys/dev/usb/usbdivar.h 2015/02/22 14:50:07 1.109.2.11
+++ src/sys/dev/usb/usbdivar.h 2015/03/05 08:34:47 1.109.2.12
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: usbdivar.h,v 1.109.2.11 2015/02/22 14:50:07 skrll Exp $ */ 1/* $NetBSD: usbdivar.h,v 1.109.2.12 2015/03/05 08:34:47 skrll 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
@@ -255,27 +255,26 @@ struct usbd_xfer { @@ -255,27 +255,26 @@ struct usbd_xfer {
255 255
256 /* For isoc */ 256 /* For isoc */
257 uint16_t *ux_frlengths; 257 uint16_t *ux_frlengths;
258 int ux_nframes; 258 int ux_nframes;
259 259
260 /* For memory allocation */ 260 /* For memory allocation */
261 struct usbd_device *ux_dev; 261 struct usbd_device *ux_dev;
262 usb_dma_t ux_dmabuf; 262 usb_dma_t ux_dmabuf;
263 void *ux_buf; 263 void *ux_buf;
264 uint32_t ux_bufsize; 264 uint32_t ux_bufsize;
265 265
266 uint8_t ux_rqflags; 266 uint8_t ux_rqflags;
267#define URQ_REQUEST 0x01 267#define URQ_REQUEST 0x01
268#define URQ_AUTO_BUFFER 0x10 
269 268
270 SIMPLEQ_ENTRY(usbd_xfer) ux_next; 269 SIMPLEQ_ENTRY(usbd_xfer) ux_next;
271 270
272 void *ux_hcpriv; /* private use by the HC driver */ 271 void *ux_hcpriv; /* private use by the HC driver */
273 uint8_t ux_hcflags; /* private use by the HC driver */ 272 uint8_t ux_hcflags; /* private use by the HC driver */
274#define UXFER_ABORTING 0x01 /* xfer is aborting. */ 273#define UXFER_ABORTING 0x01 /* xfer is aborting. */
275#define UXFER_ABORTWAIT 0x02 /* abort completion is being awaited. */ 274#define UXFER_ABORTWAIT 0x02 /* abort completion is being awaited. */
276 kcondvar_t ux_hccv; /* private use by the HC driver */ 275 kcondvar_t ux_hccv; /* private use by the HC driver */
277 276
278 struct callout ux_callout; 277 struct callout ux_callout;
279}; 278};
280 279
281void usbd_init(void); 280void usbd_init(void);