cbp will be count up, but only with low speed devices (except my usb
[ppcskel.git] / usb / core / core.c
index b1d04743e5c77078dfb3b6b6a68e5d303ae3ccc9..27cfd93b2d9a40afc511a4ede62ad91f49876d70 100644 (file)
@@ -40,6 +40,7 @@
 #include "../lib/list.h"
 #include "../../malloc.h"
 #include "../../bootmii_ppc.h" //printf
+#include "../../string.h" //memset
 
 /**
  * Initialize USB stack.
@@ -89,7 +90,7 @@ usb_device *usb_add_device()
 {
        usb_device *dev = (usb_device *) malloc(sizeof(usb_device));
        dev->address = 0;
-       dev->bMaxPacketSize0 = 8;                       /* send at first time only 8 bytes */
+       dev->bMaxPacketSize0 = 8;       /* send at first time only 8 bytes */
 
        dev->epSize[0] = 64;
        dev->epSize[1] = 64;
@@ -115,7 +116,7 @@ usb_device *usb_add_device()
         * wIndex = 0
         * wLength = 8 (in Bytes!?)
         */
-       usb_control_msg(dev, 0x80, GET_DESCRIPTOR, DEVICE, 0, 8, buf, 8, 0);
+       usb_control_msg(dev, 0x80, GET_DESCRIPTOR, DEVICE, 0, 64, buf, 8, 0);
 
        /* 
         * length (here =64) should be "number of byte to transfer", not 
@@ -262,6 +263,7 @@ u16 usb_submit_irp(usb_irp *irp)
        u8 runloop = 1;
        u16 restlength = irp->len;
        char *td_buf_ptr = irp->buffer;
+       char mybuf[64];
 
        //u8 togl=irp->dev->epTogl[(irp->endpoint & 0x7F)];
        u8 togl = irp->dev->epTogl[(irp->endpoint & 0x7F)];
@@ -281,16 +283,24 @@ u16 usb_submit_irp(usb_irp *irp)
                td = usb_create_transfer_descriptor(irp);
                td->pid = USB_PID_SETUP;
                td->buffer = irp->buffer;
-               td->actlen = 8;                                                 /* control message are always 8 bytes */
+               td->actlen = 64;                                                        /* control message are always 8 bytes */
+               memcpy(mybuf, td->buffer, td->actlen);
 
                togl = 0;
                td->togl = togl;                                                /* start with data0 */
+#if 0
                if (togl == 0)
                        togl = 1;
                else
                        togl = 0;
+#endif
                        /**** send token ****/
+               printf("togl: %d\n", togl);
                hcdi_enqueue(td);
+               break;
+#if 0
+               memcpy(td->buffer, mybuf, td->actlen);
+#endif
 
                        /***************** Data Stage ***********************/
                        /**
@@ -348,6 +358,7 @@ u16 usb_submit_irp(usb_irp *irp)
                                }
 
                                        /**** send token ****/
+                               printf("togl: %d\n", togl);
                                hcdi_enqueue(td);
 
                                /* pruefe ob noch weitere Pakete vom Device abgeholt werden muessen */
@@ -373,6 +384,7 @@ u16 usb_submit_irp(usb_irp *irp)
                        td->pid = USB_PID_IN;
                }
                        /**** send token ****/
+               printf("togl: %d\n", togl);
                hcdi_enqueue(td);
                free(td);
 
@@ -417,6 +429,7 @@ u16 usb_submit_irp(usb_irp *irp)
                        else
                                togl = 0;
                                /**** send token ****/
+                       printf("togl: %d\n", togl);
                        hcdi_enqueue(td);
                        free(td);
                }