|
From: Gordon M. <gm...@us...> - 2001-03-12 15:53:05
|
The following files were modified in linux/include/linux/bluetooth:
Name Old version New version Comment
---- ----------- ----------- -------
hci.h 1.46 1.47=20=20=20=20=20=20=20=20=20=20=20=20
local.h 1.3 1.4=20=20=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
--The other part of Matthias Fuchs big-endian patch
The diff of the modified file(s):
--- hci.h 2001/03/02 10:55:03 1.46
+++ hci.h 2001/03/12 15:55:02 1.47
@@ -75,11 +75,10 @@
u8 data[256];
} __attribute__ ((packed)) cmd_pkt;
=20
-#define hci_put_opcode(ocf, ogf)(((ocf) & 0x03ff) | ((ogf) << 10 & 0xfc00))
-#define hci_put_le16(buf, val) { *((char*)buf) =3D (val) & 0xff; *((char*)=
buf + 1) =3D (val) >> 8; }
-#define hci_get_ocf(opcode) ((opcode) & 0x3ff)
-#define hci_get_ogf(opcode) (((opcode) & 0xfc00) >> 10)=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20
-
+#define hci_put_opcode(ocf, ogf)(cpu_to_le16(((ocf) & 0x03ff) | ((ogf) << =
10 & 0xfc00)))
+//#define hci_put_le16(buf, val) { *((char*)buf) =3D (val) & 0xff; *((char=
*)buf + 1) =3D (val) >> 8; }
+#define hci_get_ocf(opcode) (cpu_to_le16((opcode) & 0x3ff))
+#define hci_get_ogf(opcode) (cpu_to_le16(((opcode) & 0xfc00) >> 10))
=20
/****************** EXPORTED FUNCTION DECLARATION SECTION ****************=
***/
=20
--- local.h 2001/02/15 16:28:47 1.3
+++ local.h 2001/03/12 15:55:02 1.4
@@ -46,6 +46,43 @@
=20
/****************** CONSTANT AND MACRO SECTION ***************************=
***/
=20
+#include <asm/byteorder.h>
+/* In kernel mode either __LITTLE_ENDIAN or __BIG_ENDIAN is defined, but i=
n user usermode
+ * both are defined. In usermode __BYTE_ORDER contains the correct endiane=
ss. So let's undefine
+ * one of them.
+ * __LITTLE_ENDIAN_BITTFIELD and __BIG_ENDIAN_BITFIELD do not cause such p=
roblems.
+ */
+#ifndef __KERNEL__
+# if (__BYTE_ORDER =3D=3D __LITTLE_ENDIAN)
+# undef __BIG_ENDIAN
+# endif
+# if (__BYTE_ORDER =3D=3D __BIG_ENDIAN)
+# undef __LITTLE_ENDIAN
+# endif
+#endif
+=20
+#ifdef BTD_USERSTACK
+=20
+# ifdef __LITTLE_ENDIAN
+# define cpu_to_le16(x) (x)
+# define cpu_to_le32(x) (x)
+# define cpu_to_be16(x) htons((x))
+# define cpu_to_be32(x) htonl((x))
+# else
+# define cpu_to_be16(x) (x)
+# define cpu_to_be32(x) (x)
+ extern inline __u16 cpu_to_le16(__u16 x) { return (x<<8) | (x>>8);}
+ extern inline __u32 cpu_to_le32(__u32 x) { return((x>>24) |
+ ((x>>8)&0xff00) | ((x<<8)&0xff0000) | (x<<24));}
+# endif
+=20
+# define le16_to_cpu(x) cpu_to_le16(x)
+# define le32_to_cpu(x) cpu_to_le32(x)
+# define be16_to_cpu(x) cpu_to_be16(x)
+# define be32_to_cpu(x) cpu_to_be32(x)
+=20
+#endif
+
/****************** TYPE DEFINITION SECTION ******************************=
***/
=20
typedef short s16;=20
|