Take account of arch's bitfield order.
authorIan Abbott <abbotti@mev.co.uk>
Fri, 7 Aug 2009 14:57:47 +0000 (14:57 +0000)
committerIan Abbott <abbotti@mev.co.uk>
Fri, 7 Aug 2009 14:57:47 +0000 (14:57 +0000)
comedi/drivers/s526.c

index f67925e5db3c5004764d801806365a8f8ec3d6a7..818b1c943c2e790dd8a6383d5d5edf1ce8d68391 100644 (file)
@@ -43,6 +43,7 @@ comedi_config /dev/comedi0 s526 0x2C0,0x3
 
 #include <linux/comedidev.h>
 #include <linux/ioport.h>
+#include <asm/byteorder.h>
 
 #define S526_SIZE 64
 
@@ -113,6 +114,7 @@ static const int s526_ports[] = {
 };
 
 typedef struct {
+#if defined (__LITTLE_ENDIAN_BITFIELD)
        unsigned short coutSource:1;
        unsigned short coutPolarity:1;
        unsigned short autoLoadResetRcap:3;
@@ -124,6 +126,21 @@ typedef struct {
        unsigned short outputRegLatchCtrl:1;
        unsigned short preloadRegSel:1;
        unsigned short reserved:1;
+#elif defined(__BIG_ENDIAN_BITFIELD)
+       unsigned short reserved:1;
+       unsigned short preloadRegSel:1;
+       unsigned short outputRegLatchCtrl:1;
+       unsigned short countDirCtrl:1;
+       unsigned short countDir:1;
+       unsigned short clockSource:2;
+       unsigned short ctEnableCtrl:2;
+       unsigned short hwCtEnableSource:2;
+       unsigned short autoLoadResetRcap:3;
+       unsigned short coutPolarity:1;
+       unsigned short coutSource:1;
+#else
+#error Unknown bit field order
+#endif
 } counter_mode_register_t;
 
 union cmReg {