aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--hal_io_fmc.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/hal_io_fmc.c b/hal_io_fmc.c
index 386e4c8..afbfc6e 100644
--- a/hal_io_fmc.c
+++ b/hal_io_fmc.c
@@ -47,7 +47,8 @@ static int inited = 0;
#endif
/* not available in arm-none-eabi libc */
-static uint32_t htonl(uint32_t w)
+#ifndef __ARMEB__ // Little endian
+static inline uint32_t htonl(uint32_t w)
{
return
((w & 0x000000ff) << 24) +
@@ -55,6 +56,9 @@ static uint32_t htonl(uint32_t w)
((w & 0x00ff0000) >> 8) +
((w & 0xff000000) >> 24);
}
+#else // Big endian
+#define htonl(x) (x)
+#endif
#define ntohl htonl
static hal_error_t init(void)