44 #include "../comedidev.h"
46 #include <asm/byteorder.h>
50 #define S526_START_AI_CONV 0
51 #define S526_AI_READ 0
54 #define S526_IOSIZE 0x40
55 #define S526_NUM_PORTS 27
87 #if defined(__LITTLE_ENDIAN_BITFIELD)
88 unsigned short coutSource:1;
89 unsigned short coutPolarity:1;
90 unsigned short autoLoadResetRcap:3;
91 unsigned short hwCtEnableSource:2;
92 unsigned short ctEnableCtrl:2;
93 unsigned short clockSource:2;
94 unsigned short countDir:1;
95 unsigned short countDirCtrl:1;
96 unsigned short outputRegLatchCtrl:1;
97 unsigned short preloadRegSel:1;
99 #elif defined(__BIG_ENDIAN_BITFIELD)
101 unsigned short preloadRegSel:1;
102 unsigned short outputRegLatchCtrl:1;
103 unsigned short countDirCtrl:1;
104 unsigned short countDir:1;
105 unsigned short clockSource:2;
106 unsigned short ctEnableCtrl:2;
107 unsigned short hwCtEnableSource:2;
108 unsigned short autoLoadResetRcap:3;
109 unsigned short coutPolarity:1;
110 unsigned short coutSource:1;
112 #error Unknown bit field order
133 unsigned long chan_iobase = dev->
iobase + chan * 8;
138 for (i = 0; i < insn->
n; i++) {
143 data[
i] = (hi << 16) | lo;
156 unsigned long chan_iobase = dev->
iobase + chan * 8;
208 if (
cmReg.
reg.autoLoadResetRcap == 0) {
220 if (data[1] == GPCT_X2)
222 else if (data[1] == GPCT_X4)
234 if (data[3] == GPCT_RESET_COUNTER_ON_INDEX)
243 val = (data[2] >> 16) & 0xffff;
247 val = data[2] & 0xffff;
252 val = data[3] & 0xffff;
256 if (
cmReg.
reg.autoLoadResetRcap == 0) {
281 val = (data[2] >> 16) & 0xffff;
285 val = data[2] & 0xffff;
294 val = (data[3] >> 16) & 0xffff;
298 val = data[3] & 0xffff;
303 val = data[4] & 0xffff;
324 val = (data[2] >> 16) & 0xffff;
328 val = data[2] & 0xffff;
337 val = (data[3] >> 16) & 0xffff;
341 val = data[3] & 0xffff;
346 val = data[4] & 0xffff;
366 unsigned long chan_iobase = dev->
iobase + chan * 8;
379 if ((data[1] <= data[0]) || !data[0])
386 outw((data[0] >> 16) & 0xffff, chan_iobase +
REG_C0H);
397 #define ISR_ADC_DONE 0x4
419 devpriv->
ai_config = (data[0] & 0x3ff) << 5;
434 unsigned short value;
441 ((1 << 5) << chan) | (chan << 1) | 0x0001;
444 for (n = 0; n < insn->
n; n++) {
450 for (i = 0; i <
TIMEOUT; i++) {
464 data[
n] = d ^ 0x8000;
482 for (i = 0; i < insn->
n; i++) {
499 for (i = 0; i < insn->
n; i++)
510 s->
state &= ~data[0];
511 s->
state |= data[0] & data[1];
529 mask = 0xF << (group << 2);
533 s->
state |= 1 << (group + 10);
537 s->
state &= ~(1 << (group + 10));
567 ret = alloc_private(dev,
sizeof(*devpriv));
631 .driver_name =
"s526",
633 .attach = s526_attach,
634 .detach = s526_detach,