Deleted Added
sdiff udiff text old ( 186730 ) new ( 187173 )
full compact
1/* $FreeBSD: head/sys/dev/usb2/core/usb2_request.c 187173 2009-01-13 19:03:12Z thompsa $ */
2/*-
3 * Copyright (c) 1998 The NetBSD Foundation, Inc. All rights reserved.
4 * Copyright (c) 1998 Lennart Augustsson. All rights reserved.
5 * Copyright (c) 2008 Hans Petter Selasky. All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:

--- 65 unchanged lines hidden (view full) ---

75
76 DPRINTF("st=%u\n", USB_GET_STATE(xfer));
77
78 switch (USB_GET_STATE(xfer)) {
79 case USB_ST_SETUP:
80 usb2_start_hardware(xfer);
81 break;
82 default:
83 usb2_cv_signal(xfer->xroot->udev->default_cv);
84 break;
85 }
86}
87
88/*------------------------------------------------------------------------*
89 * usb2_do_clear_stall_callback
90 *
91 * This function is the USB callback for generic clear stall requests.
92 *------------------------------------------------------------------------*/
93void
94usb2_do_clear_stall_callback(struct usb2_xfer *xfer)
95{
96 struct usb2_device_request req;
97 struct usb2_device *udev;
98 struct usb2_pipe *pipe;
99 struct usb2_pipe *pipe_end;
100 struct usb2_pipe *pipe_first;
101 uint8_t to = USB_EP_MAX;
102
103 udev = xfer->xroot->udev;
104
105 USB_BUS_LOCK(udev->bus);
106
107 /* round robin pipe clear stall */
108
109 pipe = udev->pipe_curr;
110 pipe_end = udev->pipes + USB_EP_MAX;
111 pipe_first = udev->pipes;
112 if (pipe == NULL) {
113 pipe = pipe_first;
114 }
115 switch (USB_GET_STATE(xfer)) {
116 case USB_ST_TRANSFERRED:
117 if (pipe->edesc &&
118 pipe->is_stalled) {
119 pipe->toggle_next = 0;

--- 23 unchanged lines hidden (view full) ---

143
144 /* copy in the transfer */
145
146 usb2_copy_in(xfer->frbuffers, 0, &req, sizeof(req));
147
148 /* set length */
149 xfer->frlengths[0] = sizeof(req);
150 xfer->nframes = 1;
151 USB_BUS_UNLOCK(udev->bus);
152
153 usb2_start_hardware(xfer);
154
155 USB_BUS_LOCK(udev->bus);
156 break;
157 }
158 pipe++;
159 if (--to)
160 goto tr_setup;
161 break;
162
163 default:
164 if (xfer->error == USB_ERR_CANCELLED) {
165 break;
166 }
167 goto tr_setup;
168 }
169
170 /* store current pipe */
171 udev->pipe_curr = pipe;
172 USB_BUS_UNLOCK(udev->bus);
173}
174
175/*------------------------------------------------------------------------*
176 * usb2_do_request_flags and usb2_do_request
177 *
178 * Description of arguments passed to these functions:
179 *
180 * "udev" - this is the "usb2_device" structure pointer on which the

--- 184 unchanged lines hidden (view full) ---

365 int temp;
366
367 temp = usb2_ss_delay;
368 if (temp > 5000) {
369 temp = 5000;
370 }
371 if (temp > 0) {
372 usb2_pause_mtx(
373 xfer->xroot->xfer_mtx,
374 temp);
375 }
376#endif
377 xfer->flags.manual_status = 0;
378 } else {
379 break;
380 }
381 }
382 xfer->nframes = 1;
383 }
384
385 usb2_transfer_start(xfer);
386
387 while (usb2_transfer_pending(xfer)) {
388 if ((flags & USB_USE_POLLING) || cold) {
389 usb2_do_poll(udev->default_xfer, USB_DEFAULT_XFER_MAX);
390 } else {
391 usb2_cv_wait(udev->default_cv,
392 xfer->xroot->xfer_mtx);
393 }
394 }
395
396 err = xfer->error;
397
398 if (err) {
399 break;
400 }

--- 1043 unchanged lines hidden ---