예제 #1
0
static int submit_urb(struct usb_hcd *hcd, struct urb *urb)
{
	struct musb *host = hcd->hcd_priv;
	int ret;
	unsigned long timeout;

	ret = musb_urb_enqueue(hcd, urb, 0);
	if (ret < 0) {
		printf("Failed to enqueue URB to controller\n");
		return ret;
	}

	timeout = get_timer(0) + USB_TIMEOUT_MS(urb->pipe);
	do {
		if (ctrlc())
			return -EIO;
		host->isr(0, host);
	} while (urb->status == -EINPROGRESS &&
		 get_timer(0) < timeout);

	if (urb->status == -EINPROGRESS)
		musb_urb_dequeue(hcd, urb, -ETIME);

	return urb->status;
}
예제 #2
0
파일: musb_uboot.c 프로젝트: ehamine/u-boot
int destroy_int_queue(struct usb_device *dev, struct int_queue *queue)
{
	int index = usb_pipein(queue->urb.pipe) * 16 + 
		    usb_pipeendpoint(queue->urb.pipe);

	if (queue->urb.status == -EINPROGRESS)
		musb_urb_dequeue(&hcd, &queue->urb, -ETIME);

	dev->int_pending &= ~(1 << index);
	free(queue);
	return 0;
}