diff options
author | Frank Gevaerts <frank@gevaerts.be> | 2008-04-26 19:02:16 +0000 |
---|---|---|
committer | Frank Gevaerts <frank@gevaerts.be> | 2008-04-26 19:02:16 +0000 |
commit | bec6aa3176fc6d5ce80bcd4d6022358aa6c01629 (patch) | |
tree | dfbaa924ba3e13d6f73dc446b1a2149610ed3e67 /firmware/usbstack/usb_class_driver.h | |
parent | 33c44461e1b5fb9aff2f8ba7470ad2449b3c410e (diff) |
- 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.h | 52 |
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 @@ /* Common api, implemented by all class drivers */ struct usb_class_driver { + /* First some runtime data */ bool enabled; + int first_interface; + int last_interface; + + /* Driver api starts here */ + + /* Set this to true if the driver needs exclusive disk access (e.g. usb storage) */ bool needs_exclusive_ata; - int usb_endpoint; - int usb_interface; + + /* Tells the driver what its first interface number will be. The driver + returns the number of the first available interface for the next driver + (i.e. a driver with one interface will return interface+1) + A driver must have at least one interface + Mandatory function */ + int (*set_first_interface)(int interface); + + /* Tells the driver what its first endpoint pair number will be. The driver + returns the number of the first available endpoint pair for the next + driver (i.e. a driver with one endpoint pair will return endpoint +1) + Mandatory function */ + int (*set_first_endpoint)(int endpoint); /* 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); + needed descriptor for this driver at dest. + Returns the number of bytes taken by these descriptors. + Mandatory function */ + int (*get_config_descriptor)(unsigned char *dest, int max_packet_size); /* Tells the driver that a usb connection has been set up and is now - ready to use. */ - void (*init_connection)(int interface,int endpoint); + ready to use. + Optional function */ + void (*init_connection)(void); /* 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) */ + (like getting the audio buffer) + Optional function */ void (*init)(void); - /* Tells the driver that the usb connection is no longer active */ + /* Tells the driver that the usb connection is no longer active + Optional function */ 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); + is relative to the host + Optional function */ + void (*transfer_complete)(int ep,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. */ + it should return false. + Optional function */ bool (*control_request)(struct usb_ctrlrequest* req); #ifdef HAVE_HOTSWAP /* Tells the driver that a hotswappable disk/card was inserted or - extracted */ + extracted + Optional function */ void (*notify_hotswap)(int volume, bool inserted); #endif }; |