summaryrefslogtreecommitdiff
path: root/lib/igt_core.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/igt_core.h')
-rw-r--r--lib/igt_core.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/igt_core.h b/lib/igt_core.h
index 526282fa..aa98e8ed 100644
--- a/lib/igt_core.h
+++ b/lib/igt_core.h
@@ -31,6 +31,7 @@
#define IGT_CORE_H
#include <assert.h>
+#include <byteswap.h>
#include <setjmp.h>
#include <stdbool.h>
#include <stdint.h>
@@ -1447,6 +1448,14 @@ void igt_kmsg(const char *format, ...);
#define READ_ONCE(x) (*(volatile typeof(x) *)(&(x)))
#define WRITE_ONCE(x, v) do *(volatile typeof(x) *)(&(x)) = (v); while (0)
+#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
+#define cpu_to_le32(x) bswap_32(x)
+#define le32_to_cpu(x) bswap_32(x)
+#else
+#define cpu_to_le32(x) (x)
+#define le32_to_cpu(x) (x)
+#endif
+
#define MSEC_PER_SEC (1000)
#define USEC_PER_SEC (1000*MSEC_PER_SEC)
#define NSEC_PER_SEC (1000*USEC_PER_SEC)