diff options
author | Mike Lockwood <lockwood@android.com> | 2011-01-04 20:04:36 -0500 |
---|---|---|
committer | Mike Lockwood <lockwood@android.com> | 2011-01-06 09:21:13 -0500 |
commit | e533c5f1005e8913f577d2aeac5a26f88f55a249 (patch) | |
tree | 7dd0c38f29257765abcf967c15bccd8895341e10 /include | |
parent | 90d07ae2b1316dbc8ad7e7ffbbb14eca357f1b28 (diff) | |
download | system_core-e533c5f1005e8913f577d2aeac5a26f88f55a249.zip system_core-e533c5f1005e8913f577d2aeac5a26f88f55a249.tar.gz system_core-e533c5f1005e8913f577d2aeac5a26f88f55a249.tar.bz2 |
libusbhost: Support for multiple pending requests on a single endpoint
Add new usb_request struct to replace usb_endpoint, which is no longer needed.
Change-Id: Ia3637b3431a3597caced41bfec677ef0b044a453
Signed-off-by: Mike Lockwood <lockwood@android.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/usbhost/usbhost.h | 50 |
1 files changed, 23 insertions, 27 deletions
diff --git a/include/usbhost/usbhost.h b/include/usbhost/usbhost.h index 4a8a4fc..3deb182 100644 --- a/include/usbhost/usbhost.h +++ b/include/usbhost/usbhost.h @@ -39,6 +39,17 @@ struct usb_descriptor_iter { unsigned char* curr_desc; }; +struct usb_request +{ + struct usb_device *dev; + void* buffer; + int buffer_length; + int actual_length; + int max_packet_size; + void *private_data; /* struct usbdevfs_urb* */ + void *client_data; /* free for use by client */ +}; + /* Callback for notification when new USB devices are attached. * Return true to exit from usb_host_run. */ @@ -170,38 +181,23 @@ int usb_device_claim_interface(struct usb_device *device, unsigned int interface /* Releases the specified interface of a USB device */ int usb_device_release_interface(struct usb_device *device, unsigned int interface); +/* Creates a new usb_request. */ +struct usb_request *usb_request_new(struct usb_device *dev, + const struct usb_endpoint_descriptor *ep_desc); -/* Creates a new usb_endpoint for the specified endpoint of a USB device. - * This can be used to read or write data across the endpoint. - */ -struct usb_endpoint *usb_endpoint_open(struct usb_device *dev, - const struct usb_endpoint_descriptor *desc); - -/* Releases all resources associated with the endpoint */ -void usb_endpoint_close(struct usb_endpoint *ep); +/* Releases all resources associated with the request */ +void usb_request_free(struct usb_request *req); -/* Begins a read or write operation on the specified endpoint */ -int usb_endpoint_queue(struct usb_endpoint *ep, void *data, int len); +/* Submits a read or write request on the specified device */ +int usb_request_queue(struct usb_request *req); - /* Waits for the results of a previous usb_endpoint_queue operation on the - * specified endpoint. Returns number of bytes transferred, or a negative - * value for error. + /* Waits for the results of a previous usb_request_queue operation. + * Returns a usb_request, or NULL for error. */ -int usb_endpoint_wait(struct usb_device *device, int *out_ep_num); +struct usb_request *usb_request_wait(struct usb_device *dev); -/* Cancels a pending usb_endpoint_queue() operation on an endpoint. */ -int usb_endpoint_cancel(struct usb_endpoint *ep); - -/* Returns the usb_device for the given endpoint */ -struct usb_device *usb_endpoint_get_device(struct usb_endpoint *ep); - -/* Returns the endpoint address for the given endpoint */ -int usb_endpoint_number(struct usb_endpoint *ep); - -/* Returns the maximum packet size for the given endpoint. - * For bulk endpoints this should be 512 for highspeed or 64 for fullspeed. - */ -int usb_endpoint_max_packet(struct usb_endpoint *ep); +/* Cancels a pending usb_request_queue() operation. */ +int usb_request_cancel(struct usb_request *req); #ifdef __cplusplus } |