Lines Matching refs:xfer
130 struct libusb_transfer *xfer; member
140 struct libusb_transfer *xfer; member
386 r->xfer = libusb_alloc_transfer(0); in usb_host_req_alloc()
404 libusb_free_transfer(r->xfer); in usb_host_req_free()
421 static void LIBUSB_CALL usb_host_req_complete_ctrl(struct libusb_transfer *xfer) in usb_host_req_complete_ctrl() argument
423 USBHostRequest *r = xfer->user_data; in usb_host_req_complete_ctrl()
425 bool disconnect = (xfer->status == LIBUSB_TRANSFER_NO_DEVICE); in usb_host_req_complete_ctrl()
431 r->p->status = status_map[xfer->status]; in usb_host_req_complete_ctrl()
432 r->p->actual_length = xfer->actual_length; in usb_host_req_complete_ctrl()
433 if (r->in && xfer->actual_length) { in usb_host_req_complete_ctrl()
436 memcpy(r->cbuf, r->buffer + 8, xfer->actual_length); in usb_host_req_complete_ctrl()
440 if (r->usb3ep0quirk && xfer->actual_length >= 18 && in usb_host_req_complete_ctrl()
453 xfer->actual_length > in usb_host_req_complete_ctrl()
471 static void LIBUSB_CALL usb_host_req_complete_data(struct libusb_transfer *xfer) in usb_host_req_complete_data() argument
473 USBHostRequest *r = xfer->user_data; in usb_host_req_complete_data()
475 bool disconnect = (xfer->status == LIBUSB_TRANSFER_NO_DEVICE); in usb_host_req_complete_data()
481 r->p->status = status_map[xfer->status]; in usb_host_req_complete_data()
482 if (r->in && xfer->actual_length) { in usb_host_req_complete_data()
483 usb_packet_copy(r->p, r->buffer, xfer->actual_length); in usb_host_req_complete_data()
516 libusb_cancel_transfer(r->xfer); in usb_host_req_abort()
525 USBHostIsoXfer *xfer = transfer->user_data; in usb_host_req_complete_iso() local
527 if (!xfer) { in usb_host_req_complete_iso()
534 QTAILQ_REMOVE(&xfer->ring->inflight, xfer, next); in usb_host_req_complete_iso()
535 if (QTAILQ_EMPTY(&xfer->ring->inflight)) { in usb_host_req_complete_iso()
536 USBHostDevice *s = xfer->ring->host; in usb_host_req_complete_iso()
537 trace_usb_host_iso_stop(s->bus_num, s->addr, xfer->ring->ep->nr); in usb_host_req_complete_iso()
539 if (xfer->ring->ep->pid == USB_TOKEN_IN) { in usb_host_req_complete_iso()
540 QTAILQ_INSERT_TAIL(&xfer->ring->copy, xfer, next); in usb_host_req_complete_iso()
541 usb_wakeup(xfer->ring->ep, 0); in usb_host_req_complete_iso()
543 QTAILQ_INSERT_TAIL(&xfer->ring->unused, xfer, next); in usb_host_req_complete_iso()
550 USBHostIsoXfer *xfer; in usb_host_iso_alloc() local
563 xfer = g_new0(USBHostIsoXfer, 1); in usb_host_iso_alloc()
564 xfer->ring = ring; in usb_host_iso_alloc()
565 xfer->xfer = libusb_alloc_transfer(packets); in usb_host_iso_alloc()
566 xfer->xfer->dev_handle = s->dh; in usb_host_iso_alloc()
567 xfer->xfer->type = LIBUSB_TRANSFER_TYPE_ISOCHRONOUS; in usb_host_iso_alloc()
569 xfer->xfer->endpoint = ring->ep->nr; in usb_host_iso_alloc()
571 xfer->xfer->endpoint |= USB_DIR_IN; in usb_host_iso_alloc()
573 xfer->xfer->callback = usb_host_req_complete_iso; in usb_host_iso_alloc()
574 xfer->xfer->user_data = xfer; in usb_host_iso_alloc()
576 xfer->xfer->num_iso_packets = packets; in usb_host_iso_alloc()
577 xfer->xfer->length = ring->ep->max_packet_size * packets; in usb_host_iso_alloc()
578 xfer->xfer->buffer = g_malloc0(xfer->xfer->length); in usb_host_iso_alloc()
580 QTAILQ_INSERT_TAIL(&ring->unused, xfer, next); in usb_host_iso_alloc()
598 static void usb_host_iso_reset_xfer(USBHostIsoXfer *xfer) in usb_host_iso_reset_xfer() argument
600 libusb_set_iso_packet_lengths(xfer->xfer, in usb_host_iso_reset_xfer()
601 xfer->ring->ep->max_packet_size); in usb_host_iso_reset_xfer()
602 xfer->packet = 0; in usb_host_iso_reset_xfer()
603 xfer->copy_complete = false; in usb_host_iso_reset_xfer()
606 static void usb_host_iso_free_xfer(USBHostIsoXfer *xfer, bool inflight) in usb_host_iso_free_xfer() argument
609 xfer->xfer->user_data = NULL; in usb_host_iso_free_xfer()
611 g_free(xfer->xfer->buffer); in usb_host_iso_free_xfer()
612 libusb_free_transfer(xfer->xfer); in usb_host_iso_free_xfer()
614 g_free(xfer); in usb_host_iso_free_xfer()
619 USBHostIsoXfer *xfer; in usb_host_iso_free() local
621 while ((xfer = QTAILQ_FIRST(&ring->inflight)) != NULL) { in usb_host_iso_free()
622 QTAILQ_REMOVE(&ring->inflight, xfer, next); in usb_host_iso_free()
623 usb_host_iso_free_xfer(xfer, true); in usb_host_iso_free()
625 while ((xfer = QTAILQ_FIRST(&ring->unused)) != NULL) { in usb_host_iso_free()
626 QTAILQ_REMOVE(&ring->unused, xfer, next); in usb_host_iso_free()
627 usb_host_iso_free_xfer(xfer, false); in usb_host_iso_free()
629 while ((xfer = QTAILQ_FIRST(&ring->copy)) != NULL) { in usb_host_iso_free()
630 QTAILQ_REMOVE(&ring->copy, xfer, next); in usb_host_iso_free()
631 usb_host_iso_free_xfer(xfer, false); in usb_host_iso_free()
647 static bool usb_host_iso_data_copy(USBHostIsoXfer *xfer, USBPacket *p) in usb_host_iso_data_copy() argument
652 buf = libusb_get_iso_packet_buffer_simple(xfer->xfer, xfer->packet); in usb_host_iso_data_copy()
655 if (psize > xfer->ring->ep->max_packet_size) { in usb_host_iso_data_copy()
657 psize = xfer->ring->ep->max_packet_size; in usb_host_iso_data_copy()
659 xfer->xfer->iso_packet_desc[xfer->packet].length = psize; in usb_host_iso_data_copy()
661 psize = xfer->xfer->iso_packet_desc[xfer->packet].actual_length; in usb_host_iso_data_copy()
668 xfer->packet++; in usb_host_iso_data_copy()
669 xfer->copy_complete = (xfer->packet == xfer->xfer->num_iso_packets); in usb_host_iso_data_copy()
670 return xfer->copy_complete; in usb_host_iso_data_copy()
676 USBHostIsoXfer *xfer; in usb_host_iso_data_in() local
686 xfer = QTAILQ_FIRST(&ring->copy); in usb_host_iso_data_in()
687 if (xfer != NULL) { in usb_host_iso_data_in()
688 if (usb_host_iso_data_copy(xfer, p)) { in usb_host_iso_data_in()
689 QTAILQ_REMOVE(&ring->copy, xfer, next); in usb_host_iso_data_in()
690 QTAILQ_INSERT_TAIL(&ring->unused, xfer, next); in usb_host_iso_data_in()
695 while ((xfer = QTAILQ_FIRST(&ring->unused)) != NULL) { in usb_host_iso_data_in()
696 QTAILQ_REMOVE(&ring->unused, xfer, next); in usb_host_iso_data_in()
697 usb_host_iso_reset_xfer(xfer); in usb_host_iso_data_in()
698 rc = libusb_submit_transfer(xfer->xfer); in usb_host_iso_data_in()
701 QTAILQ_INSERT_TAIL(&ring->unused, xfer, next); in usb_host_iso_data_in()
710 QTAILQ_INSERT_TAIL(&ring->inflight, xfer, next); in usb_host_iso_data_in()
721 USBHostIsoXfer *xfer; in usb_host_iso_data_out() local
731 xfer = QTAILQ_FIRST(&ring->copy); in usb_host_iso_data_out()
732 while (xfer != NULL && xfer->copy_complete) { in usb_host_iso_data_out()
734 xfer = QTAILQ_NEXT(xfer, next); in usb_host_iso_data_out()
736 if (xfer == NULL) { in usb_host_iso_data_out()
737 xfer = QTAILQ_FIRST(&ring->unused); in usb_host_iso_data_out()
738 if (xfer == NULL) { in usb_host_iso_data_out()
742 QTAILQ_REMOVE(&ring->unused, xfer, next); in usb_host_iso_data_out()
743 usb_host_iso_reset_xfer(xfer); in usb_host_iso_data_out()
744 QTAILQ_INSERT_TAIL(&ring->copy, xfer, next); in usb_host_iso_data_out()
746 usb_host_iso_data_copy(xfer, p); in usb_host_iso_data_out()
757 while ((xfer = QTAILQ_FIRST(&ring->copy)) != NULL && in usb_host_iso_data_out()
758 xfer->copy_complete) { in usb_host_iso_data_out()
759 QTAILQ_REMOVE(&ring->copy, xfer, next); in usb_host_iso_data_out()
760 rc = libusb_submit_transfer(xfer->xfer); in usb_host_iso_data_out()
763 QTAILQ_INSERT_TAIL(&ring->unused, xfer, next); in usb_host_iso_data_out()
772 QTAILQ_INSERT_TAIL(&ring->inflight, xfer, next); in usb_host_iso_data_out()
1291 libusb_cancel_transfer(r->xfer); in usb_host_cancel_packet()
1521 libusb_fill_control_transfer(r->xfer, s->dh, r->buffer, in usb_host_handle_control()
1524 rc = libusb_submit_transfer(r->xfer); in usb_host_handle_control()
1575 libusb_fill_bulk_stream_transfer(r->xfer, s->dh, ep, p->stream, in usb_host_handle_data()
1585 libusb_fill_bulk_transfer(r->xfer, s->dh, ep, in usb_host_handle_data()
1597 libusb_fill_interrupt_transfer(r->xfer, s->dh, ep, in usb_host_handle_data()
1618 rc = libusb_submit_transfer(r->xfer); in usb_host_handle_data()