corrected memalign call thestack/usbkb_sauter
authortheStack <sebastian.falbesoner@gmail.com>
Sat, 19 Sep 2009 02:22:39 +0000 (04:22 +0200)
committertheStack <sebastian.falbesoner@gmail.com>
Sat, 19 Sep 2009 02:22:39 +0000 (04:22 +0200)
irq.c
usb/host/ohci.c

diff --git a/irq.c b/irq.c
index 4f15bb8b9f4e63e5f8114954125f3f043bf1c5f7..31daa980e5ac3d7d6547d38d3b97aa56f7ae96dd 100644 (file)
--- a/irq.c
+++ b/irq.c
@@ -16,6 +16,8 @@ Copyright (C) 2009                    Andre Heider "dhewg" <dhewg@wiibrew.org>
 #include "bootmii_ppc.h"
 #include "usb/host/host.h"
 
+void show_frame_no(void);
+
 void irq_initialize(void)
 {
        // clear flipper-pic (processor interface)
@@ -59,6 +61,7 @@ void irq_handler(void)
 
        if (flags & (1<<BW_PI_IRQ_RESET)) { 
                write32(BW_PI_IRQFLAG, 1<<BW_PI_IRQ_RESET);
+               show_frame_no();
                printf("IRQ-BW RESET\n");
        }
        if (flags & (1<<BW_PI_IRQ_HW)) { //HW-PIC IRQ
index 69f27e9189ba01c397e694c7636a1e70c91940c3..4201b425258f3cad661816eb06cbd6e0683441ea 100644 (file)
@@ -40,8 +40,7 @@ static struct ohci_hcca hcca_oh0;
 static struct endpoint_descriptor *allocate_endpoint()
 {
        struct endpoint_descriptor *ep;
-       //memalign instead of calloc doesn't work here?! WTF
-       ep = (struct endpoint_descriptor *)memalign(sizeof(struct endpoint_descriptor), 16);
+       ep = (struct endpoint_descriptor *)memalign(16, sizeof(struct endpoint_descriptor));
        ep->flags = ACCESS_LE(OHCI_ENDPOINT_GENERAL_FORMAT);
        ep->headp = ep->tailp = ep->nexted = ACCESS_LE(0);
        return ep;
@@ -50,7 +49,7 @@ static struct endpoint_descriptor *allocate_endpoint()
 static struct general_td *allocate_general_td(size_t bsize)
 {
        struct general_td *td;
-       td = (struct general_td *)memalign(sizeof(struct general_td), 16);
+       td = (struct general_td *)memalign(16, sizeof(struct general_td));
        td->flags = ACCESS_LE(0);
        // TODO !! nexttd?
        td->nexttd = ACCESS_LE(virt_to_phys(td));
@@ -58,7 +57,7 @@ static struct general_td *allocate_general_td(size_t bsize)
        if(bsize == 0) {
                td->cbp = td->be = ACCESS_LE(0);
        } else {
-               td->cbp = ACCESS_LE(virt_to_phys(memalign(bsize, 16))); //memailgn required here?
+               td->cbp = ACCESS_LE(virt_to_phys(memalign(16, bsize))); //memailgn required here?
                //td->cbp = ACCESS_LE(virt_to_phys(malloc(bsize)));
                td->be = ACCESS_LE(ACCESS_LE(td->cbp) + bsize - 1);
        }
@@ -491,3 +490,8 @@ void hcdi_irq()
        }
 }
 
+void show_frame_no()
+{
+       sync_before_read(&hcca_oh0, 256);
+       printf("***** frame_no: %d *****\n", ACCESS_LE(hcca_oh0.frame_no));
+}