diff mbox

Detect endianness when building for RTEMS

Message ID 20170406172106.9325-1-ljonas@google.com
State Accepted
Headers show

Commit Message

Jonas Larsson April 6, 2017, 5:21 p.m. UTC
This adds endianness detection and byte swap
definitions for the RTEMS RTOS.

Signed-off-by: Jonas Larsson <ljonas@google.com>
---
 src/utils/common.h | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

Jouni Malinen May 4, 2017, 10:07 p.m. UTC | #1
On Thu, Apr 06, 2017 at 10:21:06AM -0700, Jonas Larsson wrote:
> This adds endianness detection and byte swap
> definitions for the RTEMS RTOS.

Thanks, applied.
diff mbox

Patch

diff --git a/src/utils/common.h b/src/utils/common.h
index 88428647b..09f1658a2 100644
--- a/src/utils/common.h
+++ b/src/utils/common.h
@@ -53,6 +53,15 @@  static inline unsigned int bswap_32(unsigned int v)
 }
 #endif /* __APPLE__ */
 
+#ifdef __rtems__
+#include <rtems/endian.h>
+#define __BYTE_ORDER BYTE_ORDER
+#define __LITTLE_ENDIAN LITTLE_ENDIAN
+#define __BIG_ENDIAN BIG_ENDIAN
+#define bswap_16 CPU_swap_u16
+#define bswap_32 CPU_swap_u32
+#endif /* __rtems__ */
+
 #ifdef CONFIG_NATIVE_WINDOWS
 #include <winsock.h>