Example #1
0
int submit_bulk_msg(struct usb_device *dev, unsigned long pipe,
					void *buffer, int len)
{
	struct urb *urb = construct_urb(dev, USB_ENDPOINT_XFER_BULK, pipe,
					buffer, len, NULL, 0);
	return submit_urb(&hcd, urb);
}
Example #2
0
int submit_int_msg(struct usb_device *dev, unsigned long pipe,
				void *buffer, int len, int interval)
{
	struct urb *urb = construct_urb(dev, USB_ENDPOINT_XFER_INT, pipe,
					buffer, len, NULL, interval);
	return submit_urb(&hcd, urb);
}
Example #3
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;
}
Example #4
0
static int _musb_submit_bulk_msg(struct musb_host_data *host,
	struct usb_device *dev, unsigned long pipe, void *buffer, int len)
{
	construct_urb(&host->urb, &host->hep, dev, USB_ENDPOINT_XFER_BULK,
		      pipe, buffer, len, NULL, 0);
	return submit_urb(&host->hcd, &host->urb);
}
Example #5
0
int submit_control_msg(struct usb_device *dev, unsigned long pipe,
			void *buffer, int len, struct devrequest *setup)
{
	struct urb *urb = construct_urb(dev, USB_ENDPOINT_XFER_CONTROL, pipe,
					buffer, len, setup, 0);

	/* Fix speed for non hub-attached devices */
	if (!dev->parent)
		dev->speed = host_speed;

	return submit_urb(&hcd, urb);
}
Example #6
0
static int _musb_submit_control_msg(struct musb_host_data *host,
	struct usb_device *dev, unsigned long pipe,
	void *buffer, int len, struct devrequest *setup)
{
	construct_urb(&host->urb, &host->hep, dev, USB_ENDPOINT_XFER_CONTROL,
		      pipe, buffer, len, setup, 0);

	/* Fix speed for non hub-attached devices */
	if (!usb_dev_get_parent(dev))
		dev->speed = host->host_speed;

	return submit_urb(&host->hcd, &host->urb);
}