+ printf("done head (nach sync): 0x%08X\n", ACCESS_LE(hcca_oh0.done_head));
+
+ struct general_td* donetd = phys_to_virt(ACCESS_LE(hcca_oh0.done_head)&~1);
+ sync_before_read(donetd, 16);
+ printf("done head hexdump: 0x%08X\n", donetd);
+ hexdump((void*) donetd, 16);
+
+ u32 newlen = 0;
+ if(td->actlen) {
+ sync_before_read((void*) tmptdbuffer, td->actlen);
+ newlen = (u32)phys_to_virt(ACCESS_LE(tmptd->cbp)) - tmptdbuffer;
+ printf("WOOOOT newlen: %d\n", newlen);
+ hexdump((void*) tmptdbuffer, newlen);
+ printf("OLD length: %d\n", td->actlen);
+ hexdump((void*) tmptdbuffer, td->actlen);
+ }
+
+ sync_before_read((void*) (phys_to_virt(ACCESS_LE(tmptd->cbp))-newlen), td->actlen);
+ printf("td->buffer: 0x%08X\np2v(A_L(tmptd->cbp: 0x%08X\ntd->actlen: %d\n", (void*) (td->buffer), phys_to_virt(ACCESS_LE(tmptd->cbp)), td->actlen);
+ (void) memcpy((void*) (td->buffer), (void*) tmptdbuffer, td->actlen);
+
+ write32(OHCI0_HC_CONTROL, read32(OHCI0_HC_CONTROL)&~OHCI_CTRL_CLE);
+ dummyconfig.headp = dummyconfig.tailp = dummyconfig.nexted = ACCESS_LE(0);
+
+ write32(OHCI0_HC_CTRL_HEAD_ED, virt_to_phys(0));
+
+
+ /*
+ * TD should be free'd after taking it from the done queue.
+ * but we are very very dirty and do it anyway :p
+ */