diff options
Diffstat (limited to 'firmware/usbstack/usb_class_driver.h')
-rw-r--r-- | firmware/usbstack/usb_class_driver.h | 59 |
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 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id: $ | ||
9 | * | ||
10 | * Copyright (C) 2008 Frank Gevaerts | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | |||
20 | #ifndef _USB_CLASS_DRIVER_H_ | ||
21 | #define _USB_CLASS_DRIVER_H_ | ||
22 | |||
23 | /* Common api, implemented by all class drivers */ | ||
24 | |||
25 | struct usb_class_driver { | ||
26 | bool enabled; | ||
27 | bool needs_exclusive_ata; | ||
28 | int usb_endpoint; | ||
29 | int usb_interface; | ||
30 | |||
31 | /* Asks the driver to put the interface descriptor and all other | ||
32 | needed descriptor for this driver at dest, for the given settings. | ||
33 | Returns the number of bytes taken by these descriptors. */ | ||
34 | int (*get_config_descriptor)(unsigned char *dest, | ||
35 | int max_packet_size, int interface_number, int endpoint); | ||
36 | |||
37 | /* Tells the driver that a usb connection has been set up and is now | ||
38 | ready to use. */ | ||
39 | void (*init_connection)(int interface,int endpoint); | ||
40 | |||
41 | /* Initialises the driver. This can be called multiple times, | ||
42 | and should not perform any action that can disturb other threads | ||
43 | (like getting the audio buffer) */ | ||
44 | void (*init)(void); | ||
45 | |||
46 | /* Tells the driver that the usb connection is no longer active */ | ||
47 | void (*disconnect)(void); | ||
48 | |||
49 | /* Tells the driver that a usb transfer has been completed. Note that "in" | ||
50 | is relative to the host */ | ||
51 | void (*transfer_complete)(bool in, int status, int length); | ||
52 | |||
53 | /* 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 | ||
55 | it should return false. */ | ||
56 | bool (*control_request)(struct usb_ctrlrequest* req); | ||
57 | }; | ||
58 | |||
59 | #endif | ||