summaryrefslogtreecommitdiffstats
path: root/sys/dev/usb
diff options
context:
space:
mode:
authortmm <tmm@FreeBSD.org>2002-02-27 17:16:18 +0000
committertmm <tmm@FreeBSD.org>2002-02-27 17:16:18 +0000
commit3ed05b7b8966710c5cffbf0ba479dd2e07c91c0a (patch)
tree46353f300fd15b6b132ccde617d8726a2e38d224 /sys/dev/usb
parente9d577adb2ffdd3b7300415775c1212a087ce0dc (diff)
downloadFreeBSD-src-3ed05b7b8966710c5cffbf0ba479dd2e07c91c0a.zip
FreeBSD-src-3ed05b7b8966710c5cffbf0ba479dd2e07c91c0a.tar.gz
Add the following functions/macros to support byte order conversions and
device drivers for bus system with other endinesses than the CPU (using interfaces compatible to NetBSD): - bwap16() and bswap32(). These have optimized implementations on some architectures; for those that don't, there exist generic implementations. - macros to convert from a certain byte order to host byte order and vice versa, using a naming scheme like le16toh(), htole16(). These are implemented using the bswap functions. - stream bus space access functions, which do not perform a byte order conversion (while the normal access functions would if the bus endianess differs from the CPU endianess). htons(), htonl(), ntohs() and ntohl() are implemented using the new functions above for kernel usage. None of the above interfaces is currently exported to user land. Make use of the new functions in a few places where local implementations of the same functionality existed. Reviewed by: mike, bde Tested on alpha by: mike
Diffstat (limited to 'sys/dev/usb')
-rw-r--r--sys/dev/usb/ohci.c14
-rw-r--r--sys/dev/usb/uhci.c2
-rw-r--r--sys/dev/usb/usb_port.h1
3 files changed, 1 insertions, 16 deletions
diff --git a/sys/dev/usb/ohci.c b/sys/dev/usb/ohci.c
index 369f246..70675c0 100644
--- a/sys/dev/usb/ohci.c
+++ b/sys/dev/usb/ohci.c
@@ -96,20 +96,6 @@ int ohcidebug = 1;
#define DPRINTFN(n,x)
#endif
-/*
- * The OHCI controller is little endian, so on big endian machines
- * the data strored in memory needs to be swapped.
- */
-#if defined(__FreeBSD__)
-#if BYTE_ORDER == BIG_ENDIAN
-#define htole32(x) (bswap32(x))
-#define le32toh(x) (bswap32(x))
-#else
-#define htole32(x) (x)
-#define le32toh(x) (x)
-#endif
-#endif
-
struct ohci_pipe;
Static ohci_soft_ed_t *ohci_alloc_sed(ohci_softc_t *);
diff --git a/sys/dev/usb/uhci.c b/sys/dev/usb/uhci.c
index de4e64f..d01c131 100644
--- a/sys/dev/usb/uhci.c
+++ b/sys/dev/usb/uhci.c
@@ -112,7 +112,7 @@ int uhcinoloop = 0;
* The UHCI controller is little endian, so on big endian machines
* the data strored in memory needs to be swapped.
*/
-#if defined(__FreeBSD__) || defined(__OpenBSD__)
+#if defined(__OpenBSD__)
#if BYTE_ORDER == BIG_ENDIAN
#define htole32(x) (bswap32(x))
#define le32toh(x) (bswap32(x))
diff --git a/sys/dev/usb/usb_port.h b/sys/dev/usb/usb_port.h
index 642b439..1f4b191 100644
--- a/sys/dev/usb/usb_port.h
+++ b/sys/dev/usb/usb_port.h
@@ -314,7 +314,6 @@ typedef struct thread *usb_proc_ptr;
/* XXX Change this when FreeBSD has memset */
#define memcpy(d, s, l) bcopy((s),(d),(l))
#define memset(d, v, l) bzero((d),(l))
-#define bswap32(x) swap32(x)
#define kthread_create1(f, s, p, a0, a1) \
kthread_create((f), (s), (p), RFHIGHPID, (a0), (a1))
OpenPOWER on IntegriCloud