[tmp] speicherprobleme behoben; in current bleibt der erste endpoint
authorBernhard Urban <lewurm@gmx.net>
Wed, 16 Sep 2009 16:19:51 +0000 (18:19 +0200)
committerBernhard Urban <lewurm@gmx.net>
Wed, 16 Sep 2009 18:00:03 +0000 (20:00 +0200)
"haengen"
weiters steht merkuwerdiger weise die adresse (0x80008000) nach
"warmstart" in current -- WTF?
im "done head" leider noch immer nix :( vielleicht ist die endianess
schuld?! (le<>be)

usb/core/core.c
usb/core/core.h
usb/core/usb.c
usb/host/ohci.c

index 94abe688b5dceb4fa172c8b3846f85c1b8d6b5e1..1f7baf40dab1632a3907cdd6117caae3070c6e93 100644 (file)
@@ -428,6 +428,7 @@ usb_transfer_descriptor *usb_create_transfer_descriptor(usb_irp * irp)
        td->endpoint = irp->endpoint;
        td->iso = 0;
        td->state = USB_TRANSFER_DESCR_NONE;
+       td->maxp = irp->epsize;
 
        return td;
 }
index 0e127224209a33c5061e2b0ee043f6cdd1ed763c..50d8d2a0194838afe448b4860ca6f2c5114e770a 100644 (file)
@@ -110,7 +110,6 @@ struct usb_driver_t {
 
 typedef struct usb_irp_t usb_irp;
 struct usb_irp_t {
-       //u8 devaddress;
        usb_device * dev;
        u8 endpoint;                            /* ep -> bit 7 is for direction 1=from  dev to host */
        u8 epsize;
@@ -142,6 +141,7 @@ struct usb_transfer_descriptor_t {
        
        u8 state;
        usb_transfer_descriptor *next;
+       u8 maxp;
 };
 
 //typedef struct usb_core_t usb_core;
index d30f83d341607655f0a268204d4eff9792eccf1c..9e973c3de2ca27cd7a5e4ae2374e07dc6a9aeb69 100644 (file)
@@ -137,7 +137,6 @@ u8 usb_control_msg(usb_device *dev, u8 requesttype, u8 request, u16 value, u16 i
 {
        usb_irp *irp = (usb_irp*)malloc(sizeof(usb_irp));
        irp->dev = dev;
-       //irp->devaddress = dev->address;
        irp->endpoint = 0;
        
        irp->epsize = dev->bMaxPacketSize0;
index 5f964295e71cbc67ab9c4aef2952da713fcfec5f..5e50dba4af1f6fcab081da764ef7c7a6176310c9 100644 (file)
@@ -151,8 +151,8 @@ u8 hcdi_enqueue(usb_transfer_descriptor *td) {
        sync_before_read(&hcca_oh0, 256);
        printf("done head (nach sync): 0x%08X\n", hcca_oh0.done_head);
 
-       struct general_td *tmptd = allocate_general_td(sizeof(td->actlen));
-       (void) memcpy((void*) phys_to_virt(tmptd->cbp), td->buffer, sizeof(td->actlen)); /* throws dsi exception after some time :X */
+       struct general_td *tmptd = allocate_general_td(td->actlen);
+       (void) memcpy((void*) phys_to_virt(tmptd->cbp), td->buffer, td->actlen); /* throws dsi exception after some time :X */
 
        tmptd->flags &= ~OHCI_TD_DIRECTION_PID_MASK;
        switch(td->pid) {
@@ -169,21 +169,31 @@ u8 hcdi_enqueue(usb_transfer_descriptor *td) {
                        tmptd->flags |= OHCI_TD_DIRECTION_PID_IN;
                        break;
        }
+       tmptd->flags |= (td->togl) ? OHCI_TD_TOGGLE_1 : OHCI_TD_TOGGLE_0;
 
        printf("tmptd hexump (before):\n");
        hexdump(tmptd, sizeof(struct general_td));
        printf("tmptd-cbp hexump (before):\n");
-       hexdump((void*) phys_to_virt(tmptd->cbp), sizeof(td->actlen));
+       hexdump((void*) phys_to_virt(tmptd->cbp), td->actlen);
 
-       sync_after_write((void*) (tmptd->cbp), sizeof(td->actlen));
+       sync_after_write((void*) (tmptd->cbp), td->actlen);
        sync_after_write(tmptd, sizeof(struct general_td));
 
        struct endpoint_descriptor *dummyconfig = allocate_endpoint();
 
+       u32 current2 = read32(OHCI0_HC_CTRL_CURRENT_ED);
+       printf("current2: 0x%08X\n", current2);
+
+#define ED_MASK2 ~0 /*((u32)~0x0f) */
+#define ED_MASK ((u32)~0x0f) 
        printf("tmpdt & ED_MASK: 0x%08X\n", virt_to_phys((void*) ((u32)tmptd & ED_MASK)));
-#define ED_MASK ((u32)~0x0f)
-       dummyconfig->tailp = /* dummyconfig->headp = */ virt_to_phys((void*) ((u32)tmptd & ED_MASK));
-//     dummyconfig->flags |= OHCI_ENDPOINT_DIRECTION_OUT;
+       dummyconfig->tailp = dummyconfig->headp = virt_to_phys((void*) ((u32)tmptd & ED_MASK));
+
+       dummyconfig->flags |= OHCI_ENDPOINT_LOW_SPEED | 
+               OHCI_ENDPOINT_SET_DEVICE_ADDRESS(td->devaddress) | 
+               OHCI_ENDPOINT_SET_ENDPOINT_NUMBER(td->endpoint) |
+               OHCI_ENDPOINT_SET_MAX_PACKET_SIZE(td->maxp);
+
        sync_after_write(dummyconfig, 64);
        write32(OHCI0_HC_CTRL_HEAD_ED, virt_to_phys(dummyconfig));
 
@@ -220,9 +230,9 @@ u8 hcdi_enqueue(usb_transfer_descriptor *td) {
        printf("tmptd hexump (after):\n");
        hexdump(tmptd, sizeof(struct general_td));
 
-       sync_before_read((void*) (tmptd->cbp), sizeof(td->actlen));
+       sync_before_read((void*) (tmptd->cbp), td->actlen);
        printf("tmptd-cbp hexump (after):\n");
-       hexdump((void*) (tmptd->cbp), sizeof(td->actlen));
+       hexdump((void*) phys_to_virt(tmptd->cbp), td->actlen);
 
        printf("done head (vor sync): 0x%08X\n", hcca_oh0.done_head);
        sync_before_read(&hcca_oh0, 256);