PP502x: Get switch_thread back out of IRAM and devise a better core wakeup system...
[Rockbox.git] / firmware / usbstack / controller.h
blobc91eab785a483550e31c640ff5bae487bd743502
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2007 by Christian Gmeiner
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.
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
18 ****************************************************************************/
20 #ifndef _USBSTACK_CONTROLLER_H_
21 #define _USBSTACK_CONTROLLER_H_
24 * stack datatypes
26 struct usb_response {
27 void* buf;
28 uint32_t length;
31 struct usb_ep {
32 const char name[15];
33 uint8_t type;
34 uint32_t ep_num; /* which endpoint? */
35 uint32_t pipe_num; /* which pipe? */
36 uint32_t maxpacket;
37 bool claimed;
39 struct usb_endpoint_descriptor *desc;
40 struct list_head list;
43 struct usb_controller {
44 const char* name;
45 enum usb_controller_type type;
46 enum usb_device_speed speed;
47 void (*init)(void);
48 void (*shutdown)(void);
49 void (*irq)(void);
50 void (*start)(void);
51 void (*stop)(void);
52 void* controller_ops;
53 struct usb_device_driver* device_driver;
54 struct usb_host_driver* host_driver;
55 struct usb_ep* ep0;
56 struct usb_ep endpoints;
59 struct usb_dcd_controller_ops {
60 /* endpoint management */
61 int (*enable)(struct usb_ep* ep, struct usb_endpoint_descriptor* desc);
62 int (*disable)(struct usb_ep* ep);
63 int (*set_halt)(struct usb_ep* ep, bool hald);
65 /* transmitting */
66 int (*send)(struct usb_ep* ep, struct usb_response* req);
67 int (*receive)(struct usb_ep* ep, struct usb_response* res);
69 /* ep0 */
70 struct usb_ep* ep0;
73 int usb_controller_register(struct usb_controller* ctrl);
74 int usb_controller_unregister(struct usb_controller* ctrl);
77 * dcd - device controller driver
79 void usb_dcd_init(void);
80 void usb_dcd_shutdown(void);
83 * hcd - host controller driver
85 void usb_hcd_init(void);
86 void usb_hcd_shutdown(void);
88 #endif /*_USBSTACK_CONTROLLER_H_*/