unsigned int ai_maxdata;
unsigned int ai_speed; /* max conversion speed in nanosec */
unsigned int ai_pg;
- void *ao;
- unsigned int ao_nbits;
+ unsigned int has_ao:1;
unsigned int i8255_offset;
unsigned int i8254_offset;
return insn->n;
}
-static int das16_ao_winsn(struct comedi_device *dev, struct comedi_subdevice *s,
- struct comedi_insn *insn, unsigned int *data)
+static int das16_ao_insn_write(struct comedi_device *dev,
+ struct comedi_subdevice *s,
+ struct comedi_insn *insn,
+ unsigned int *data)
{
- const struct das16_board *board = comedi_board(dev);
+ unsigned int chan = CR_CHAN(insn->chanspec);
+ unsigned int val;
int i;
- int lsb, msb;
- int chan;
-
- chan = CR_CHAN(insn->chanspec);
for (i = 0; i < insn->n; i++) {
- if (board->ao_nbits == 12) {
- lsb = (data[i] << 4) & 0xff;
- msb = (data[i] >> 4) & 0xff;
- } else {
- lsb = data[i] & 0xff;
- msb = (data[i] >> 8) & 0xff;
- }
- outb(lsb, dev->iobase + DAS16_AO_LSB(chan));
- outb(msb, dev->iobase + DAS16_AO_MSB(chan));
+ val = data[i];
+ val <<= 4;
+
+ outb(val & 0xff, dev->iobase + DAS16_AO_LSB(chan));
+ outb((val >> 8) & 0xff, dev->iobase + DAS16_AO_MSB(chan));
}
- return i;
+ return insn->n;
}
/* the pc104-das16jr (at least) has problems if the dma
s->munge = das16_ai_munge;
}
+ /* Analog Output subdevice */
s = &dev->subdevices[1];
- /* ao */
- if (board->ao) {
- s->type = COMEDI_SUBD_AO;
- s->subdev_flags = SDF_WRITABLE;
- s->n_chan = 2;
- s->maxdata = (1 << board->ao_nbits) - 1;
- /* user defined ao range */
+ if (board->has_ao) {
+ s->type = COMEDI_SUBD_AO;
+ s->subdev_flags = SDF_WRITABLE;
+ s->n_chan = 2;
+ s->maxdata = 0x0fff;
if (devpriv->user_ao_range_table)
- s->range_table = devpriv->user_ao_range_table;
+ s->range_table = devpriv->user_ao_range_table;
else
- s->range_table = &range_unknown;
+ s->range_table = &range_unknown;
- s->insn_write = board->ao;
+ s->insn_write = das16_ao_insn_write;
} else {
- s->type = COMEDI_SUBD_UNUSED;
+ s->type = COMEDI_SUBD_UNUSED;
}
/* Digital Input subdevice */
.ai_maxdata = 0x0fff,
.ai_speed = 15000,
.ai_pg = das16_pg_none,
- .ao = das16_ao_winsn,
- .ao_nbits = 12,
+ .has_ao = 1,
.i8255_offset = 0x10,
.i8254_offset = 0x0c,
.size = 0x14,
.ai_maxdata = 0x0fff,
.ai_speed = 15000,
.ai_pg = das16_pg_none,
- .ao = das16_ao_winsn,
- .ao_nbits = 12,
+ .has_ao = 1,
.i8255_offset = 0x10,
.i8254_offset = 0x0c,
.size = 0x14,
.ai_maxdata = 0x0fff,
.ai_speed = 8500,
.ai_pg = das16_pg_none,
- .ao = das16_ao_winsn,
- .ao_nbits = 12,
+ .has_ao = 1,
.i8255_offset = 0x10,
.i8254_offset = 0x0c,
.size = 0x14,
.ai_maxdata = 0x0fff,
.ai_speed = 20000,
.ai_pg = das16_pg_none,
- .ao = das16_ao_winsn,
- .ao_nbits = 12,
+ .has_ao = 1,
.i8255_offset = 0x10,
.i8254_offset = 0x0c,
.size = 0x14,
.ai_maxdata = 0x0fff,
.ai_speed = 10000,
.ai_pg = das16_pg_none,
- .ao = das16_ao_winsn,
- .ao_nbits = 12,
+ .has_ao = 1,
.i8255_offset = 0x10,
.i8254_offset = 0x0c,
.size = 0x14,
.ai_maxdata = 0x0fff,
.ai_speed = 7692,
.ai_pg = das16_pg_16jr,
- .ao = NULL,
.i8255_offset = 0,
.i8254_offset = 0x0c,
.size = 0x10,
.ai_maxdata = 0x0fff,
.ai_speed = 3300,
.ai_pg = das16_pg_16jr,
- .ao = NULL,
.i8255_offset = 0,
.i8254_offset = 0x0c,
.size = 0x10,
.ai_maxdata = 0xffff,
.ai_speed = 10000,
.ai_pg = das16_pg_16jr_16,
- .ao = NULL,
.i8255_offset = 0,
.i8254_offset = 0x0c,
.size = 0x10,
.ai_maxdata = 0xffff,
.ai_speed = 10000,
.ai_pg = das16_pg_16jr_16,
- .ao = NULL,
.i8255_offset = 0,
.i8254_offset = 0x0c,
.size = 0x10,
.ai_maxdata = 0x0fff,
.ai_speed = 20000,
.ai_pg = das16_pg_none,
- .ao = NULL,
.i8255_offset = 0x400,
.i8254_offset = 0x0c,
.size = 0x408,
.ai_maxdata = 0x0fff,
.ai_speed = 10000,
.ai_pg = das16_pg_none,
- .ao = NULL,
.i8255_offset = 0x400,
.i8254_offset = 0x0c,
.size = 0x408,
.ai_maxdata = 0x0fff,
.ai_speed = 10000,
.ai_pg = das16_pg_1601,
- .ao = NULL,
.i8255_offset = 0x0,
.i8254_offset = 0x0c,
.size = 0x408,
.ai_maxdata = 0x0fff,
.ai_speed = 10000,
.ai_pg = das16_pg_1602,
- .ao = NULL,
.i8255_offset = 0x0,
.i8254_offset = 0x0c,
.size = 0x408,
.ai_maxdata = 0x0fff,
.ai_speed = 10000,
.ai_pg = das16_pg_1601,
- .ao = das16_ao_winsn,
- .ao_nbits = 12,
+ .has_ao = 1,
.i8255_offset = 0x400,
.i8254_offset = 0x0c,
.size = 0x408,
.ai_maxdata = 0x0fff,
.ai_speed = 10000,
.ai_pg = das16_pg_1602,
- .ao = das16_ao_winsn,
- .ao_nbits = 12,
+ .has_ao = 1,
.i8255_offset = 0x400,
.i8254_offset = 0x0c,
.size = 0x408,
.ai_maxdata = 0x0fff,
.ai_speed = 6250,
.ai_pg = das16_pg_1601,
- .ao = NULL,
.i8255_offset = 0,
.i8254_offset = 0x0c,
.size = 0x408,
.ai_maxdata = 0x0fff,
.ai_speed = 6250,
.ai_pg = das16_pg_1602,
- .ao = NULL,
.i8255_offset = 0,
.i8254_offset = 0x0c,
.size = 0x408,
.ai_maxdata = 0xffff,
.ai_speed = 10000,
.ai_pg = das16_pg_1602,
- .ao = NULL,
.i8255_offset = 0,
.i8254_offset = 0x0c,
.size = 0x408,
.ai_maxdata = 0x0fff,
.ai_speed = 6250,
.ai_pg = das16_pg_1601,
- .ao = das16_ao_winsn,
- .ao_nbits = 12,
+ .has_ao = 1,
.i8255_offset = 0x400,
.i8254_offset = 0x0c,
.size = 0x408,
.ai_maxdata = 0x0fff,
.ai_speed = 10000,
.ai_pg = das16_pg_1602,
- .ao = das16_ao_winsn,
- .ao_nbits = 12,
+ .has_ao = 1,
.i8255_offset = 0x400,
.i8254_offset = 0x0c,
.size = 0x408,
.ai_maxdata = 0xffff,
.ai_speed = 10000,
.ai_pg = das16_pg_1602,
- .ao = das16_ao_winsn,
- .ao_nbits = 12,
+ .has_ao = 1,
.i8255_offset = 0x400,
.i8254_offset = 0x0c,
.size = 0x408,
.ai_maxdata = 0x0fff,
.ai_speed = 3030,
.ai_pg = das16_pg_16jr,
- .ao = NULL,
.i8255_offset = 0,
.i8254_offset = 0x0c,
.size = 0x14,