]> git.sur5r.net Git - u-boot/blobdiff - include/usb.h
* Patch by Matthew S. McClintock, 14 Apr 2004:
[u-boot] / include / usb.h
index edb61201a752de99ed45786b016fa80171da2681..074e0f169cee9ca34487b8f96b4fdcdd4e84f6bd 100644 (file)
@@ -169,7 +169,7 @@ struct usb_device {
  * this is how the lowlevel part communicate with the outer world
  */
 
-#ifdef CONFIG_USB_UHCI
+#if defined(CONFIG_USB_UHCI) || defined(CONFIG_USB_OHCI)
 int usb_lowlevel_init(void);
 int usb_lowlevel_stop(void);
 int submit_bulk_msg(struct usb_device *dev, unsigned long pipe, void *buffer,int transfer_len);
@@ -228,16 +228,25 @@ int usb_string(struct usb_device *dev, int index, char *buf, size_t size);
 int usb_set_interface(struct usb_device *dev, int interface, int alternate);
 
 /* big endian -> little endian conversion */
+/* some CPUs are already little endian e.g. the ARM920T */
+#ifdef LITTLEENDIAN
+#define swap_16(x) ((unsigned short)(x))
+#define swap_32(x) ((unsigned long)(x))
+#else
 #define swap_16(x) \
-       ((unsigned short)( \
-               (((unsigned short)(x) & (unsigned short)0x00ffU) << 8) | \
-               (((unsigned short)(x) & (unsigned short)0xff00U) >> 8) ))
+       ({ unsigned short x_ = (unsigned short)x; \
+        (unsigned short)( \
+               ((x_ & 0x00FFU) << 8) | ((x_ & 0xFF00U) >> 8) ); \
+       })
 #define swap_32(x) \
-       ((unsigned long)( \
-               (((unsigned long)(x) & (unsigned long)0x000000ffUL) << 24) | \
-               (((unsigned long)(x) & (unsigned long)0x0000ff00UL) <<  8) | \
-               (((unsigned long)(x) & (unsigned long)0x00ff0000UL) >>  8) | \
-               (((unsigned long)(x) & (unsigned long)0xff000000UL) >> 24) ))
+       ({ unsigned long x_ = (unsigned long)x; \
+        (unsigned long)( \
+               ((x_ & 0x000000FFUL) << 24) | \
+               ((x_ & 0x0000FF00UL) <<  8) | \
+               ((x_ & 0x00FF0000UL) >>  8) | \
+               ((x_ & 0xFF000000UL) >> 24) ); \
+       })
+#endif /* LITTLEENDIAN */
 
 /*
  * Calling this entity a "pipe" is glorifying it. A USB pipe