summaryrefslogtreecommitdiffstats
path: root/firmware/usbstack/usb_class_driver.h
diff options
context:
space:
mode:
authorFrank Gevaerts <frank@gevaerts.be>2008-03-06 21:25:09 +0000
committerFrank Gevaerts <frank@gevaerts.be>2008-03-06 21:25:09 +0000
commitf0b4a32d6f983b1bece0b8cb2f2da1fdd23b012e (patch)
tree90f36c9f421c174d0385268ea47f0013b0c8cd8c /firmware/usbstack/usb_class_driver.h
parent5f83f0e4d2aaad77bda682cfd81a7ebb111a6024 (diff)
downloadrockbox-f0b4a32d6f983b1bece0b8cb2f2da1fdd23b012e.tar.gz
rockbox-f0b4a32d6f983b1bece0b8cb2f2da1fdd23b012e.tar.bz2
rockbox-f0b4a32d6f983b1bece0b8cb2f2da1fdd23b012e.zip
reorganise the usb stack to provide a clean separation between core and class drivers
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16541 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/usbstack/usb_class_driver.h')
-rw-r--r--firmware/usbstack/usb_class_driver.h59
1 files changed, 59 insertions, 0 deletions
diff --git a/firmware/usbstack/usb_class_driver.h b/firmware/usbstack/usb_class_driver.h
new file mode 100644
index 0000000000..631d5a3bc1
--- /dev/null
+++ b/firmware/usbstack/usb_class_driver.h
@@ -0,0 +1,59 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id: $
+ *
+ * Copyright (C) 2008 Frank Gevaerts
+ *
+ * All files in this archive are subject to the GNU General Public License.
+ * See the file COPYING in the source tree root for full license agreement.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+
+#ifndef _USB_CLASS_DRIVER_H_
+#define _USB_CLASS_DRIVER_H_
+
+/* Common api, implemented by all class drivers */
+
+struct usb_class_driver {
+ bool enabled;
+ bool needs_exclusive_ata;
+ int usb_endpoint;
+ int usb_interface;
+
+ /* Asks the driver to put the interface descriptor and all other
+ needed descriptor for this driver at dest, for the given settings.
+ Returns the number of bytes taken by these descriptors. */
+ int (*get_config_descriptor)(unsigned char *dest,
+ int max_packet_size, int interface_number, int endpoint);
+
+ /* Tells the driver that a usb connection has been set up and is now
+ ready to use. */
+ void (*init_connection)(int interface,int endpoint);
+
+ /* Initialises the driver. This can be called multiple times,
+ and should not perform any action that can disturb other threads
+ (like getting the audio buffer) */
+ void (*init)(void);
+
+ /* Tells the driver that the usb connection is no longer active */
+ void (*disconnect)(void);
+
+ /* Tells the driver that a usb transfer has been completed. Note that "in"
+ is relative to the host */
+ void (*transfer_complete)(bool in, int status, int length);
+
+ /* Tells the driver that a control request has come in. If the driver is
+ able to handle it, it should ack the request, and return true. Otherwise
+ it should return false. */
+ bool (*control_request)(struct usb_ctrlrequest* req);
+};
+
+#endif