diff options
Diffstat (limited to 'firmware/usbstack/core.h')
-rw-r--r-- | firmware/usbstack/core.h | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/firmware/usbstack/core.h b/firmware/usbstack/core.h new file mode 100644 index 0000000000..7bda2934e7 --- /dev/null +++ b/firmware/usbstack/core.h | |||
@@ -0,0 +1,84 @@ | |||
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_CORE_H_ | ||
21 | #define _USBSTACK_CORE_H_ | ||
22 | |||
23 | #include "linkedlist.h" | ||
24 | #include "usb_ch9.h" | ||
25 | #include "logf.h" | ||
26 | #include "system.h" | ||
27 | |||
28 | #include "usbstack.h" | ||
29 | |||
30 | /* | ||
31 | * stack datatypes | ||
32 | */ | ||
33 | struct usb_response { | ||
34 | void* buf; | ||
35 | uint32_t length; | ||
36 | }; | ||
37 | |||
38 | struct usb_ep { | ||
39 | const char name[15]; | ||
40 | uint8_t type; | ||
41 | uint32_t ep_num; /* which endpoint? */ | ||
42 | uint32_t pipe_num; /* which pipe? */ | ||
43 | uint32_t maxpacket; | ||
44 | bool claimed; | ||
45 | |||
46 | struct usb_endpoint_descriptor *desc; | ||
47 | struct list_head list; | ||
48 | }; | ||
49 | |||
50 | #include "usbstack/controller.h" | ||
51 | #include "usbstack/device.h" | ||
52 | #include "usbstack/host.h" | ||
53 | |||
54 | #define NUM_DRIVERS 3 | ||
55 | |||
56 | /* | ||
57 | * usb core | ||
58 | */ | ||
59 | struct usb_core { | ||
60 | /* we can have maximum two controllers (one device, one host) */ | ||
61 | struct usb_controller* controller[2]; | ||
62 | struct usb_controller* active_controller; | ||
63 | /* device driver used by stack */ | ||
64 | struct usb_device_driver* device_driver; | ||
65 | /* for each type of driver use own array */ | ||
66 | struct usb_host_driver* host_drivers[NUM_DRIVERS]; | ||
67 | struct usb_device_driver* device_drivers[NUM_DRIVERS]; | ||
68 | enum usb_controller_type mode; | ||
69 | bool running; | ||
70 | }; | ||
71 | |||
72 | void usb_stack_irq(void); | ||
73 | void usb_stack_work(void); | ||
74 | |||
75 | /* endpoint configuration */ | ||
76 | void usb_ep_autoconfig_reset(void); | ||
77 | struct usb_ep* usb_ep_autoconfig(struct usb_endpoint_descriptor* desc); | ||
78 | |||
79 | /* only used for debug */ | ||
80 | void into_usb_ctrlrequest(struct usb_ctrlrequest* request); | ||
81 | |||
82 | extern struct usb_core usbcore; | ||
83 | |||
84 | #endif /*_USBSTACK_CORE_H_*/ | ||