status = inb(dev->iobase + STA_R2); if ((status & 0x03)) return -EOVERFLOW;
status = inb(dev->iobase + STA_R1); if ((status & 0x02)) return -ENODATA; if ((status & 0x11) == 0x01) return0; return -EBUSY;
}
staticint daq700_ai_rinsn(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsignedint *data)
{ int n; int d; int ret; unsignedint chan = CR_CHAN(insn->chanspec); unsignedint aref = CR_AREF(insn->chanspec); unsignedint range = CR_RANGE(insn->chanspec); unsignedint r3_bits = 0;
/* set channel input modes */ if (aref == AREF_DIFF)
r3_bits |= CMD_R3_DIFF; /* write channel mode/range */ if (range >= 1)
range++; /* convert range to hardware value */
outb(r3_bits | (range & 0x03), dev->iobase + CMD_R3);
/* write channel to multiplexer */ /* set mask scan bit high to disable scanning */
outb(chan | 0x80, dev->iobase + CMD_R1); /* mux needs 2us to really settle [Fred Brooks]. */
udelay(2);
/* convert n samples */ for (n = 0; n < insn->n; n++) { /* trigger conversion with out0 L to H */
outb(0x00, dev->iobase + CMD_R2); /* enable ADC conversions */
outb(0x30, dev->iobase + CMO_R); /* mode 0 out0 L, from H */
outb(0x00, dev->iobase + ADCLEAR_R); /* clear the ADC FIFO */ /* read 16bit junk from FIFO to clear */
inw(dev->iobase + ADFIFO_R); /* mode 1 out0 H, L to H, start conversion */
outb(0x32, dev->iobase + CMO_R);
/* wait for conversion to end */
ret = comedi_timeout(dev, s, insn, daq700_ai_eoc, 0); if (ret) return ret;
/* read data */
d = inw(dev->iobase + ADFIFO_R); /* mangle the data as necessary */ /* Bipolar Offset Binary: 0 to 4095 for -10 to +10 */
d &= 0x0fff;
d ^= 0x0800;
data[n] = d;
} return n;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.