usb_request.c (186730) | usb_request.c (187173) |
---|---|
1/* $FreeBSD: head/sys/dev/usb2/core/usb2_request.c 186730 2009-01-04 00:12:01Z alfred $ */ | 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: | 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->udev->default_cv); | 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; | 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; |
|
97 struct usb2_pipe *pipe; 98 struct usb2_pipe *pipe_end; 99 struct usb2_pipe *pipe_first; 100 uint8_t to = USB_EP_MAX; 101 | 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 |
102 USB_BUS_LOCK(xfer->udev->bus); | 103 udev = xfer->xroot->udev; |
103 | 104 |
105 USB_BUS_LOCK(udev->bus); 106 |
|
104 /* round robin pipe clear stall */ 105 | 107 /* round robin pipe clear stall */ 108 |
106 pipe = xfer->udev->pipe_curr; 107 pipe_end = xfer->udev->pipes + USB_EP_MAX; 108 pipe_first = xfer->udev->pipes; | 109 pipe = udev->pipe_curr; 110 pipe_end = udev->pipes + USB_EP_MAX; 111 pipe_first = udev->pipes; |
109 if (pipe == NULL) { 110 pipe = pipe_first; 111 } 112 switch (USB_GET_STATE(xfer)) { 113 case USB_ST_TRANSFERRED: 114 if (pipe->edesc && 115 pipe->is_stalled) { 116 pipe->toggle_next = 0; --- 23 unchanged lines hidden (view full) --- 140 141 /* copy in the transfer */ 142 143 usb2_copy_in(xfer->frbuffers, 0, &req, sizeof(req)); 144 145 /* set length */ 146 xfer->frlengths[0] = sizeof(req); 147 xfer->nframes = 1; | 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; |
148 USB_BUS_UNLOCK(xfer->udev->bus); | 151 USB_BUS_UNLOCK(udev->bus); |
149 150 usb2_start_hardware(xfer); 151 | 152 153 usb2_start_hardware(xfer); 154 |
152 USB_BUS_LOCK(xfer->udev->bus); | 155 USB_BUS_LOCK(udev->bus); |
153 break; 154 } 155 pipe++; 156 if (--to) 157 goto tr_setup; 158 break; 159 160 default: 161 if (xfer->error == USB_ERR_CANCELLED) { 162 break; 163 } 164 goto tr_setup; 165 } 166 167 /* store current pipe */ | 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 */ |
168 xfer->udev->pipe_curr = pipe; 169 USB_BUS_UNLOCK(xfer->udev->bus); | 171 udev->pipe_curr = pipe; 172 USB_BUS_UNLOCK(udev->bus); |
170} 171 172/*------------------------------------------------------------------------* 173 * usb2_do_request_flags and usb2_do_request 174 * 175 * Description of arguments passed to these functions: 176 * 177 * "udev" - this is the "usb2_device" structure pointer on which the --- 184 unchanged lines hidden (view full) --- 362 int temp; 363 364 temp = usb2_ss_delay; 365 if (temp > 5000) { 366 temp = 5000; 367 } 368 if (temp > 0) { 369 usb2_pause_mtx( | 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( |
370 xfer->xfer_mtx, temp); | 373 xfer->xroot->xfer_mtx, 374 temp); |
371 } 372#endif 373 xfer->flags.manual_status = 0; 374 } else { 375 break; 376 } 377 } 378 xfer->nframes = 1; 379 } 380 381 usb2_transfer_start(xfer); 382 383 while (usb2_transfer_pending(xfer)) { 384 if ((flags & USB_USE_POLLING) || cold) { 385 usb2_do_poll(udev->default_xfer, USB_DEFAULT_XFER_MAX); 386 } else { | 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 { |
387 usb2_cv_wait(xfer->udev->default_cv, 388 xfer->xfer_mtx); | 391 usb2_cv_wait(udev->default_cv, 392 xfer->xroot->xfer_mtx); |
389 } 390 } 391 392 err = xfer->error; 393 394 if (err) { 395 break; 396 } --- 1043 unchanged lines hidden --- | 393 } 394 } 395 396 err = xfer->error; 397 398 if (err) { 399 break; 400 } --- 1043 unchanged lines hidden --- |