some routines for removing a device on demand. thist do not work properly
[ppcskel.git] / usb / core / core.h
index cb521fc394cd8c3861b85595644910f4b81d1252..98ab7ea3641581a53f191cd7088123f4ee6d4e6e 100644 (file)
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
+/*
+       ppcskel - a Free Software replacement for the Nintendo/BroadOn bootloader.
+       plugmii core
+
+Copyright (C) 2009     Bernhard Urban <lewurm@gmx.net>
+Copyright (C) 2009     Sebastian Falbesoner <sebastian.falbesoner@gmail.com>
+
+# This code is licensed to you under the terms of the GNU GPL, version 2;
+# see file COPYING or http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
+*/
 
 #ifndef _CORE_H_
 #define _CORE_H_
@@ -49,6 +59,7 @@ inline static void wait_ms(int ms)
 struct usb_device {
        u8 address;
        u8 fullspeed;
+       u32 ohci;
 
        /* device descriptor */
        u8 bLength;
@@ -82,6 +93,35 @@ struct usb_conf {
        u8 iConfiguration;
        u8 bmAttributes;
        u8 bMaxPower;
+
+       struct usb_conf *next;
+       struct usb_intf *intf;
+};
+
+struct usb_intf {
+       u8 bLength;
+       u8 bDescriptorType;
+       u8 bInterfaceNumber;
+       u8 bAlternateSetting;
+       u8 bNumEndpoints;
+       u8 bInterfaceClass;
+       u8 bInterfaceSubClass;
+       u8 bInterfaceProtocol;
+       u8 iInterface;
+
+       struct usb_intf *next;
+       struct usb_endp *endp;
+};
+
+struct usb_endp {
+       u8 bLength;
+       u8 bDescriptorType;
+       u8 bEndpointAddress;
+       u8 bmAttributes;
+       u16 wMaxPacketSize;
+       u8 bInterval;
+
+       struct usb_endp *next;
 };
 
 struct usb_endpoint {
@@ -105,7 +145,8 @@ struct usb_driver {
        char* name;
        void (*probe)(void);
        void (*check)(void);
-       void * data;
+       void (*remove)(void);
+       void *data;
        struct usb_driver *next;
 };
 
@@ -136,6 +177,8 @@ struct usb_irp {
 struct usb_transfer_descriptor {
        u8 devaddress;
        u8 endpoint;
+       u8 fullspeed;
+       u8 type;
        
        // TODO: zusammenfassen!
        u8 pid;
@@ -158,17 +201,17 @@ struct usb_core {
        struct list *devices;
 } core;
 
-void usb_init();
+void usb_init(u32 reg);
 void usb_periodic();
 u8 usb_next_address();
 
 
-struct usb_device *usb_add_device();
+struct usb_device *usb_add_device(u8 lowspeed, u32 reg);
 u8 usb_remove_device(struct usb_device *dev);
 u8 usb_register_driver(struct usb_driver *driver);
 void usb_probe_driver();
 
-
+void lsusb(struct usb_device *dev);
 
 struct usb_irp *usb_get_irp();
 u8 usb_remove_irp(struct usb_irp *irp);