Exemplo n.º 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;
}
Exemplo n.º 2
0
static struct int_queue *_musb_create_int_queue(struct musb_host_data *host,
	struct usb_device *dev, unsigned long pipe, int queuesize,
	int elementsize, void *buffer, int interval)
{
	struct int_queue *queue;
	int ret, index = usb_pipein(pipe) * 16 + usb_pipeendpoint(pipe);

	if (queuesize != 1) {
		printf("ERROR musb int-queues only support queuesize 1\n");
		return NULL;
	}

	if (dev->int_pending & (1 << index)) {
		printf("ERROR int-urb is already pending on pipe %lx\n", pipe);
		return NULL;
	}

	queue = malloc(sizeof(*queue));
	if (!queue)
		return NULL;

	construct_urb(&queue->urb, &queue->hep, dev, USB_ENDPOINT_XFER_INT,
		      pipe, buffer, elementsize, NULL, interval);

	ret = musb_urb_enqueue(&host->hcd, &queue->urb, 0);
	if (ret < 0) {
		printf("Failed to enqueue URB to controller\n");
		free(queue);
		return NULL;
	}

	dev->int_pending |= 1 << index;
	return queue;
}
Exemplo n.º 3
0
static int submit_urb(struct usb_hcd *hcd, struct urb *urb)
{
	struct musb *host = hcd->hcd_priv;
	int ret;
	int timeout;

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

	timeout = MUSB_HOST_TIMEOUT;
	do {
		if (ctrlc())
			return -EIO;
		host->isr(0, host);
	} while ((urb->dev->status & USB_ST_NOT_PROC) && --timeout);

	return urb->status;
}