#define Q_CHAN(x) ((x) & 0x7)
#define Q_RANGE(x) (((x) & 0xf) << 4)
#define UNIPOLAR 0x40
-#define DAS16M1_8254_FIRST 8
+#define DAS16M1_8254_FIRST 0x8
+#define DAS16M1_8254_FIRST_CNTRL 0xb
+#define TOTAL_CLEAR 0x30
#define DAS16M1_8254_SECOND 0xc
#define DAS16M1_82C55 0x400
#define DAS16M1_8254_THIRD 0x404
{
unsigned int err=0, tmp, i;
+ // check chanlist against board's peculiarities
+ if(cmd->chanlist && cmd->chanlist_len > 1)
+ {
+ for(i = 0; i < cmd->chanlist_len; i++)
+ {
+ // even/odd channels must go into even/odd queue addresses
+ if((i % 2) != (CR_CHAN(cmd->chanlist[i]) % 2))
+ {
+ comedi_error(dev, "bad chanlist:\n"
+ " even/odd channels must go have even/odd chanlist indices");
+ err++;
+ }
+ }
+ if((cmd->chanlist_len % 2) != 0)
+ {
+ comedi_error(dev, "chanlist must be of even length or length 1");
+ err++;
+ }
+ }
+ if(err) return -EINVAL;
+
/* make sure triggers are valid */
tmp=cmd->start_src;
cmd->start_src &= TRIG_NOW | TRIG_EXT;
err++;
}
}
- // check chanlist against board's peculiarities
- if(cmd->chanlist_len > 1)
- {
- for(i = 0; i < cmd->chanlist_len; i++)
- {
- // even/odd channels must go into even/odd queue addresses
- if((i % 2) != (CR_CHAN(cmd->chanlist[i]) % 2))
- {
- comedi_error(dev, "bad chanlist:\n"
- " even/odd channels must go have even/odd chanlist indices");
- err++;
- }
- }
- if((cmd->chanlist_len % 2) != 0)
- {
- comedi_error(dev, "chanlist must be of even length or length 1");
- err++;
- }
- }
if(err) return 3;
return -1;
}
+ /* disable interrupts and internal pacer */
+ devpriv->control_state &= ~INTE & ~PACER_MASK;
+ outb(devpriv->control_state, dev->iobase + DAS16M1_INTR_CONTROL);
+
devpriv->adc_count = cmd->stop_arg * cmd->chanlist_len;
/* setup channel/gain queue */
/* set counter mode and counts */
cmd->convert_arg = das16m1_set_pacer(dev, cmd->convert_arg, cmd->flags & TRIG_ROUND_MASK);
- async->events = 0;
-
// set control & status register
byte = 0;
/* if we are using external start trigger (also board dislikes having
}
// initialize async here to avoid freak out on premature interrupt
async = s->async;
+ async->events = 0;
insw(dev->iobase, data, HALF_FIFO);
for(i = 0; i < HALF_FIFO; i++)
}
}
+ /* this probably won't catch overruns since the card doesn't generate
+ * overrun interrupts, but we might as well try */
if(status & OVRUN)
{
das16m1_cancel(dev, s);
/* 8255 */
subdev_8255_init(dev, s, NULL, (void*)(dev->iobase + DAS16M1_82C55));
+ // disable upper half of hardware conversion counter so it doesn't mess with us
+ outb(TOTAL_CLEAR, dev->iobase + DAS16M1_8254_FIRST_CNTRL);
+
// initialize digital output lines
outb(devpriv->do_bits, dev->iobase + DAS16M1_DIO);