From: Alan Cox Date: Tue, 30 Aug 2016 19:39:37 +0000 (+0100) Subject: cpu-68000: add missing endian code X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=c7c03c1e6ee0af81f8eac7fc54080f3a9600c783;p=FUZIX.git cpu-68000: add missing endian code --- diff --git a/Kernel/cpu-68000/cpu.h b/Kernel/cpu-68000/cpu.h index 6453530f..fd074549 100644 --- a/Kernel/cpu-68000/cpu.h +++ b/Kernel/cpu-68000/cpu.h @@ -50,6 +50,17 @@ typedef union { /* this structure is endian dependent */ } h; } ticks_t; +extern uint16_t swab(uint16_t); + +#define ntohs(x) (x) +#define ntohl(x) (x) + +#define cpu_to_le16(x) swab(x) +#define le16_to_cpu(x) swab(x) +#define cpu_to_le32(x) ((((uint32_t)cpu_to_le16((x) & 0xFFFF)) << 16) | \ + (uint32_t)cpu_to_le16((x) >> 16)) +#define le32_to_cpu(x) cpu_to_le32(x) + /* We don't need any banking bits really */ #define CODE1 #define CODE2