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)
50 * Main datastructure of the usbstack, which have to be instanced
51 * in the main application.
54 typedef struct usb_device_t usb_device;
65 u8 bNumConfigurations;
74 typedef struct usb_endpoint_t usb_endpoint;
75 struct usb_endpoint_t {
85 typedef struct usb_transfer_descriptor_ep_t usb_transfer_descriptor_ep;
86 struct usb_transfer_descriptor_ep_t {
87 usb_transfer_descriptor_ep *next;
90 struct usb_transfer_descriptor_t *start;
94 * USB Driver data structure
96 typedef struct usb_driver_t usb_driver;
110 typedef struct usb_irp_t usb_irp;
113 u8 endpoint; /* ep -> bit 7 is for direction 1=from dev to host */
115 u8 type; /* control, interrupt, bulk or isochron */
126 * usb transfer descriptor
128 typedef struct usb_transfer_descriptor_t usb_transfer_descriptor;
129 struct usb_transfer_descriptor_t {
133 // TODO: zusammenfassen!
142 usb_transfer_descriptor *next;
146 //typedef struct usb_core_t usb_core;
149 void (*stdout)(char * arg);
157 u8 usb_next_address();
160 usb_device * usb_add_device();
161 u8 usb_remove_device(usb_device *dev);
162 u8 usb_register_driver(usb_driver *driver);
163 void usb_probe_driver();
167 usb_irp * usb_get_irp();
168 u8 usb_remove_irp(usb_irp *irp);
169 u16 usb_submit_irp(usb_irp *irp);
172 usb_transfer_descriptor * usb_create_transfer_descriptor(usb_irp *irp);
175 #define USB_IRP_WAITING 1
178 #define USB_TRANSFER_DESCR_NONE 1
179 #define USB_TRANSFER_DESCR_SEND 2