diff options
Diffstat (limited to 'firmware/usbstack/controller.h')
-rw-r--r-- | firmware/usbstack/controller.h | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/firmware/usbstack/controller.h b/firmware/usbstack/controller.h new file mode 100644 index 0000000000..8e99cf6641 --- /dev/null +++ b/firmware/usbstack/controller.h | |||
@@ -0,0 +1,68 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id: arcotg_udc.c 12340 2007-02-16 22:13:21Z barrywardell $ | ||
9 | * | ||
10 | * Copyright (C) 2007 by Christian Gmeiner | ||
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 _USBSTACK_CONTROLLER_H_ | ||
21 | #define _USBSTACK_CONTROLLER_H_ | ||
22 | |||
23 | struct usb_controller { | ||
24 | const char* name; | ||
25 | enum usb_controller_type type; | ||
26 | enum usb_device_speed speed; | ||
27 | void (*init)(void); | ||
28 | void (*shutdown)(void); | ||
29 | void (*irq)(void); | ||
30 | void (*start)(void); | ||
31 | void (*stop)(void); | ||
32 | void* controller_ops; | ||
33 | struct usb_device_driver* device_driver; | ||
34 | struct usb_host_driver* host_driver; | ||
35 | struct usb_ep* ep0; | ||
36 | struct usb_ep endpoints; | ||
37 | }; | ||
38 | |||
39 | struct usb_dcd_controller_ops { | ||
40 | /* endpoint management */ | ||
41 | int (*enable)(struct usb_ep* ep); | ||
42 | int (*disable)(struct usb_ep* ep); | ||
43 | int (*set_halt)(struct usb_ep* ep, bool hald); | ||
44 | |||
45 | /* transmitting */ | ||
46 | int (*send)(struct usb_ep* ep, struct usb_response* req); | ||
47 | int (*receive)(struct usb_ep* ep, struct usb_response* res); | ||
48 | |||
49 | /* ep0 */ | ||
50 | struct usb_ep* ep0; | ||
51 | }; | ||
52 | |||
53 | int usb_controller_register(struct usb_controller* ctrl); | ||
54 | int usb_controller_unregister(struct usb_controller* ctrl); | ||
55 | |||
56 | /* | ||
57 | * dcd - device controller driver | ||
58 | */ | ||
59 | void usb_dcd_init(void); | ||
60 | void usb_dcd_shutdown(void); | ||
61 | |||
62 | /* | ||
63 | * hcd - host controller driver | ||
64 | */ | ||
65 | void usb_hcd_init(void); | ||
66 | void usb_hcd_shutdown(void); | ||
67 | |||
68 | #endif /*_USBSTACK_CONTROLLER_H_*/ | ||