add macro for u32 little endian access from ppc
authortheStack <sebastian.falbesoner@gmail.com>
Wed, 16 Sep 2009 19:26:40 +0000 (21:26 +0200)
committertheStack <sebastian.falbesoner@gmail.com>
Wed, 16 Sep 2009 19:26:40 +0000 (21:26 +0200)
usb/host/ohci.c

index 5e50dba4af1f6fcab081da764ef7c7a6176310c9..ed71c40250dedda7a83fbc7ff34a92e41c81df24 100644 (file)
@@ -18,6 +18,14 @@ Copyright (C) 2009     Sebastian Falbesoner <sebastian.falbesoner@gmail.com>
 #include "host.h"
 #include "../usbspec/usb11spec.h"
 
+// macro for accessing u32 variables that need to be in little endian byte order;
+// whenever you read or write from an u32 field that the ohci host controller
+// will read or write from too, use this macro for access!
+#define ACCESS_LE(dword) ( ((dword & 0xFF000000) >> 24) | \
+                          ((dword & 0x00FF0000) >> 8) | \
+                          ((dword & 0x0000FF00) << 8) |  \
+                          ((dword & 0x000000FF) << 24) )
+
 static struct ohci_hcca hcca_oh0;
 
 static struct endpoint_descriptor *allocate_endpoint()