return control_a;
}
-/* returns appropriate bits for control register c, depending on command */
-static int control_c_bits(struct comedi_subdevice *s,
- const struct comedi_cmd *cmd)
+static unsigned char das1800_ai_chanspec_bits(struct comedi_subdevice *s,
+ unsigned int chanspec)
{
- unsigned int range = CR_RANGE(cmd->chanlist[0]);
- unsigned int aref = CR_AREF(cmd->chanlist[0]);
- int control_c;
+ unsigned int range = CR_RANGE(chanspec);
+ unsigned int aref = CR_AREF(chanspec);
+ unsigned char bits;
- /* set clock source to internal or external, select analog reference,
- * select unipolar / bipolar
- */
- control_c = UQEN; /* enable upper qram addresses */
+ bits = UQEN;
if (aref != AREF_DIFF)
- control_c |= SD;
+ bits |= SD;
if (aref == AREF_COMMON)
- control_c |= CMEN;
+ bits |= CMEN;
if (comedi_range_is_unipolar(s, range))
- control_c |= UB;
+ bits |= UB;
+
+ return bits;
+}
+
+static int control_c_bits(struct comedi_subdevice *s,
+ const struct comedi_cmd *cmd)
+{
+ int control_c;
+ control_c = das1800_ai_chanspec_bits(s, cmd->chanlist[0]);
+
+ /* set clock source to internal or external */
switch (cmd->scan_begin_src) {
case TRIG_FOLLOW: /* not in burst mode */
switch (cmd->convert_src) {
{
unsigned int chan = CR_CHAN(insn->chanspec);
unsigned int range = CR_RANGE(insn->chanspec);
- unsigned int aref = CR_AREF(insn->chanspec);
bool is_unipolar = comedi_range_is_unipolar(s, range);
int i, n;
int chan_range;
int timeout = 1000;
unsigned short dpnt;
- int conv_flags = 0;
unsigned long irq_flags;
- /* set up analog reference and unipolar / bipolar mode */
- conv_flags |= UQEN;
- if (aref != AREF_DIFF)
- conv_flags |= SD;
- if (aref == AREF_COMMON)
- conv_flags |= CMEN;
- if (is_unipolar)
- conv_flags |= UB;
-
- outb(conv_flags, dev->iobase + DAS1800_CONTROL_C); /* software conversion enabled */
+ outb(das1800_ai_chanspec_bits(s, insn->chanspec),
+ dev->iobase + DAS1800_CONTROL_C); /* software pacer */
outb(CVEN, dev->iobase + DAS1800_STATUS); /* enable conversions */
outb(0x0, dev->iobase + DAS1800_CONTROL_A); /* reset fifo */
outb(FFEN, dev->iobase + DAS1800_CONTROL_A);