From db27747293decfe0b03bc7ec515855b44d33a05d Mon Sep 17 00:00:00 2001 From: Ron Sluiter Date: Mon, 2 Jun 2014 14:52:23 +0000 Subject: [PATCH] Jens Eden's mod to add EPICS_BYTE_ORDER to the logic of setting {MSB/LSB}_First. --- motorApp/MotorSrc/motor.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/motorApp/MotorSrc/motor.h b/motorApp/MotorSrc/motor.h index 30ae512d..4d30d929 100644 --- a/motorApp/MotorSrc/motor.h +++ b/motorApp/MotorSrc/motor.h @@ -51,6 +51,8 @@ Last Modified: $Date: 2009-04-27 14:28:42 $ * tested by jph with simMotorDriver. * .10 08-25-11 rls - Replaced deprecated #cpu preprocessor assertions with * the defined() operator. + * .11 06-02-14 rls - Jens Eden's modification to add EPICS_BYTE_ORDER to the + * logic of setting {MSB/LSB}_First. */ #ifndef INCmotorh @@ -61,6 +63,7 @@ Last Modified: $Date: 2009-04-27 14:28:42 $ #include #include #include +#include /* Less than EPICS base version test.*/ #define LT_EPICSBASE(v,r,l) ((EPICS_VERSION<=(v)) && (EPICS_REVISION<=(r)) && (EPICS_MODIFICATION<(l))) @@ -137,8 +140,14 @@ typedef enum { #define LSB_First (TRUE) /* LSB is packed first. */ #elif defined(sparc) || defined(m68k) || defined(powerpc) #define MSB_First (TRUE) /* MSB is packed first. */ -#elif (CPU == PPC604) || (CPU == PPC603) || (CPU == PPC85XX) || (CPU == MC68040) || (CPU == PPC32) +#elif defined(CPU) && ((CPU == PPC604) || (CPU == PPC603) || (CPU == PPC85XX) || (CPU == MC68040) || (CPU == PPC32)) #define MSB_First (TRUE) /* MSB is packed first. */ +#elif defined(__GNUC__) + #if (EPICS_BYTE_ORDER == EPICS_ENDIAN_LITTLE) + #define LSB_First (TRUE) + #else + #define MSB_First (TRUE) + #endif #else #error: unknown bit order! #endif