summaryrefslogtreecommitdiff
path: root/firmware/usbstack/usb_class_driver.h
diff options
context:
space:
mode:
authorFrank Gevaerts <frank@gevaerts.be>2008-04-26 19:02:16 +0000
committerFrank Gevaerts <frank@gevaerts.be>2008-04-26 19:02:16 +0000
commitbec6aa3176fc6d5ce80bcd4d6022358aa6c01629 (patch)
treedfbaa924ba3e13d6f73dc446b1a2149610ed3e67 /firmware/usbstack/usb_class_driver.h
parent33c44461e1b5fb9aff2f8ba7470ad2449b3c410e (diff)
downloadrockbox-bec6aa3176fc6d5ce80bcd4d6022358aa6c01629.tar.gz
rockbox-bec6aa3176fc6d5ce80bcd4d6022358aa6c01629.zip
- change the usb class driver framework to allow for device classes with more than one interface or more than one endpoint pair
- move the charging-only dummy driver out of usb_core git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17252 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/usbstack/usb_class_driver.h')
-rw-r--r--firmware/usbstack/usb_class_driver.h52
1 files changed, 38 insertions, 14 deletions
diff --git a/firmware/usbstack/usb_class_driver.h b/firmware/usbstack/usb_class_driver.h
index 8bd9de0119..df21228480 100644
--- a/firmware/usbstack/usb_class_driver.h
+++ b/firmware/usbstack/usb_class_driver.h
@@ -23,41 +23,65 @@
23/* Common api, implemented by all class drivers */ 23/* Common api, implemented by all class drivers */
24 24
25struct usb_class_driver { 25struct usb_class_driver {
26 /* First some runtime data */
26 bool enabled; 27 bool enabled;
28 int first_interface;
29 int last_interface;
30
31 /* Driver api starts here */
32
33 /* Set this to true if the driver needs exclusive disk access (e.g. usb storage) */
27 bool needs_exclusive_ata; 34 bool needs_exclusive_ata;
28 int usb_endpoint; 35
29 int usb_interface; 36 /* Tells the driver what its first interface number will be. The driver
37 returns the number of the first available interface for the next driver
38 (i.e. a driver with one interface will return interface+1)
39 A driver must have at least one interface
40 Mandatory function */
41 int (*set_first_interface)(int interface);
42
43 /* Tells the driver what its first endpoint pair number will be. The driver
44 returns the number of the first available endpoint pair for the next
45 driver (i.e. a driver with one endpoint pair will return endpoint +1)
46 Mandatory function */
47 int (*set_first_endpoint)(int endpoint);
30 48
31 /* Asks the driver to put the interface descriptor and all other 49 /* Asks the driver to put the interface descriptor and all other
32 needed descriptor for this driver at dest, for the given settings. 50 needed descriptor for this driver at dest.
33 Returns the number of bytes taken by these descriptors. */ 51 Returns the number of bytes taken by these descriptors.
34 int (*get_config_descriptor)(unsigned char *dest, 52 Mandatory function */
35 int max_packet_size, int interface_number, int endpoint); 53 int (*get_config_descriptor)(unsigned char *dest, int max_packet_size);
36 54
37 /* Tells the driver that a usb connection has been set up and is now 55 /* Tells the driver that a usb connection has been set up and is now
38 ready to use. */ 56 ready to use.
39 void (*init_connection)(int interface,int endpoint); 57 Optional function */
58 void (*init_connection)(void);
40 59
41 /* Initialises the driver. This can be called multiple times, 60 /* Initialises the driver. This can be called multiple times,
42 and should not perform any action that can disturb other threads 61 and should not perform any action that can disturb other threads
43 (like getting the audio buffer) */ 62 (like getting the audio buffer)
63 Optional function */
44 void (*init)(void); 64 void (*init)(void);
45 65
46 /* Tells the driver that the usb connection is no longer active */ 66 /* Tells the driver that the usb connection is no longer active
67 Optional function */
47 void (*disconnect)(void); 68 void (*disconnect)(void);
48 69
49 /* Tells the driver that a usb transfer has been completed. Note that "in" 70 /* Tells the driver that a usb transfer has been completed. Note that "in"
50 is relative to the host */ 71 is relative to the host
51 void (*transfer_complete)(bool in, int status, int length); 72 Optional function */
73 void (*transfer_complete)(int ep,bool in, int status, int length);
52 74
53 /* Tells the driver that a control request has come in. If the driver is 75 /* Tells the driver that a control request has come in. If the driver is
54 able to handle it, it should ack the request, and return true. Otherwise 76 able to handle it, it should ack the request, and return true. Otherwise
55 it should return false. */ 77 it should return false.
78 Optional function */
56 bool (*control_request)(struct usb_ctrlrequest* req); 79 bool (*control_request)(struct usb_ctrlrequest* req);
57 80
58#ifdef HAVE_HOTSWAP 81#ifdef HAVE_HOTSWAP
59 /* Tells the driver that a hotswappable disk/card was inserted or 82 /* Tells the driver that a hotswappable disk/card was inserted or
60 extracted */ 83 extracted
84 Optional function */
61 void (*notify_hotswap)(int volume, bool inserted); 85 void (*notify_hotswap)(int volume, bool inserted);
62#endif 86#endif
63}; 87};