2 * Copyright (c) 2007, Benedikt Sauter <sauter@ixbat.de>
5 * Short descripton of file:
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
12 * * Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * * Redistributions in binary form must reproduce the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer in the documentation and/or other materials provided
17 * with the distribution.
18 * * Neither the name of the FH Augsburg nor the names of its
19 * contributors may be used to endorse or promote products derived
20 * from this software without specific prior written permission.
22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38 #include "../../types.h"
39 #include "../lib/list.h"
42 #include "../../bootmii_ppc.h"
43 inline static void wait_ms(int ms)
54 /* device descriptor */
68 u8 bNumConfigurations;
73 struct usb_conf *conf;
74 struct usb_device *next;
82 u8 bConfigurationValue;
87 struct usb_conf *next;
88 struct usb_intf *intf;
98 u8 bInterfaceSubClass;
99 u8 bInterfaceProtocol;
102 struct usb_intf *next;
103 struct usb_endp *endp;
114 struct usb_endp *next;
117 struct usb_endpoint {
121 struct usb_endpoint *next;
124 struct usb_transfer_descriptor_ep {
125 struct usb_transfer_descriptor_ep *next;
128 struct usb_transfer_descriptor *start;
132 * USB Driver data structure
139 struct usb_driver *next;
148 struct usb_device *dev;
149 /* ep -> bit 7 is for direction 1=from dev to host */
152 /* control, interrupt, bulk or isochron */
164 * usb transfer descriptor
166 struct usb_transfer_descriptor {
172 // TODO: zusammenfassen!
181 struct usb_transfer_descriptor *next;
187 void (*stdout)(char * arg);
189 struct list *drivers;
190 struct list *devices;
193 void usb_init(u32 reg);
195 u8 usb_next_address();
198 struct usb_device *usb_add_device(u8 lowspeed, u32 reg);
199 u8 usb_remove_device(struct usb_device *dev);
200 u8 usb_register_driver(struct usb_driver *driver);
201 void usb_probe_driver();
203 void lsusb(struct usb_device *dev);
205 struct usb_irp *usb_get_irp();
206 u8 usb_remove_irp(struct usb_irp *irp);
207 u16 usb_submit_irp(struct usb_irp *irp);
210 struct usb_transfer_descriptor *usb_create_transfer_descriptor(struct usb_irp *irp);
213 #define USB_IRP_WAITING 1
216 #define USB_TRANSFER_DESCR_NONE 1
217 #define USB_TRANSFER_DESCR_SEND 2