From 51fcc65a006bbea046a9ebb2cf1bfd622533b112 Mon Sep 17 00:00:00 2001 From: Frank Mori Hess Date: Wed, 27 Jun 2001 17:27:22 +0000 Subject: [PATCH] minor updates --- comedi/drivers/das16.c | 20 +++++++++++++++++--- comedi/drivers/das16m1.c | 5 ++++- comedi/drivers/das800.c | 4 ++-- comedi/drivers/poc.c | 15 +++------------ 4 files changed, 26 insertions(+), 18 deletions(-) diff --git a/comedi/drivers/das16.c b/comedi/drivers/das16.c index 904826c4..aa529beb 100644 --- a/comedi/drivers/das16.c +++ b/comedi/drivers/das16.c @@ -720,6 +720,7 @@ static int das16_cmd_exec(comedi_device *dev,comedi_subdevice *s) comedi_cmd *cmd = &async->cmd; unsigned int byte; unsigned long flags; + int range; if(dev->irq == 0 || devpriv->dma_chan == 0) { @@ -734,11 +735,24 @@ static int das16_cmd_exec(comedi_device *dev,comedi_subdevice *s) devpriv->adc_count = cmd->stop_arg * cmd->chanlist_len; + // disable conversions for das1600 mode + if(thisboard->size > 0x400) + { + outb(DAS1600_CONV_DISABLE, dev->iobase + DAS1600_CONV); + } + // set scan limits byte = CR_CHAN(cmd->chanlist[0]); byte |= CR_CHAN(cmd->chanlist[cmd->chanlist_len - 1]) << 4; outb(byte, dev->iobase + DAS16_MUX); + /* set gain (this is also burst rate register but according to + * computer boards manual, burst rate does nothing, even on keithley cards) */ + if(thisboard->ai_pg != das16_pg_none){ + range = CR_RANGE(cmd->chanlist[0]); + outb((das16_gainlists[thisboard->ai_pg])[range], + dev->iobase+DAS16_GAIN); + } /* set counter mode and counts */ cmd->convert_arg = das16_set_pacer(dev, cmd->convert_arg, cmd->flags & TRIG_ROUND_MASK); @@ -806,10 +820,10 @@ static int das16_cancel(comedi_device *dev, comedi_subdevice *s) if(devpriv->dma_chan) disable_dma(devpriv->dma_chan); - // disable conversions for das1600 mode + /* disable burst mode */ if(thisboard->size > 0x400) { - outb(DAS1600_CONV_DISABLE, dev->iobase + DAS1600_CONV); + outb(0, dev->iobase + DAS1600_BURST); } return 0; @@ -1361,7 +1375,7 @@ static int das16_attach(comedi_device *dev, comedi_devconfig *it) if(thisboard->size > 0x400) { outb(DAS1600_ENABLE_VAL, dev->iobase + DAS1600_ENABLE); - outb(DAS1600_CONV_DISABLE, dev->iobase + DAS1600_CONV); + outb(0, dev->iobase + DAS1600_CONV); outb(0, dev->iobase + DAS1600_BURST); } diff --git a/comedi/drivers/das16m1.c b/comedi/drivers/das16m1.c index 4d3fa4e0..36871fe8 100644 --- a/comedi/drivers/das16m1.c +++ b/comedi/drivers/das16m1.c @@ -286,7 +286,8 @@ static int das16m1_cmd_test(comedi_device *dev,comedi_subdevice *s, comedi_cmd * static int das16m1_cmd_exec(comedi_device *dev,comedi_subdevice *s) { - comedi_cmd *cmd = &s->async->cmd; + comedi_async *async = s->async; + comedi_cmd *cmd = &async->cmd; unsigned int byte, i; if(dev->irq == 0) @@ -308,6 +309,8 @@ static int das16m1_cmd_exec(comedi_device *dev,comedi_subdevice *s) /* 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 diff --git a/comedi/drivers/das800.c b/comedi/drivers/das800.c index 9a84e11b..80d009eb 100644 --- a/comedi/drivers/das800.c +++ b/comedi/drivers/das800.c @@ -704,7 +704,7 @@ static int das800_ai_do_cmdtest(comedi_device *dev,comedi_subdevice *s,comedi_cm startChan = CR_CHAN(cmd->chanlist[0]); for(i = 1; i < cmd->chanlist_len; i++) { - if(CR_CHAN(cmd->chanlist[i]) != (startChan + i) % N_CHAN_AI) + if(CR_CHAN(cmd->chanlist[i]) != (startChan + i) % N_CHAN_AI) { comedi_error(dev, "entries in chanlist must be consecutive channels, counting upwards\n"); err++; @@ -808,7 +808,7 @@ static int das800_ai_do_cmd(comedi_device *dev, comedi_subdevice *s) outb(CONV_CONTROL, dev->iobase + DAS800_GAIN); /* select dev->iobase + 2 to be conversion control register */ outb(conv_bits, dev->iobase + DAS800_CONV_CONTROL); comedi_spin_unlock_irqrestore(&dev->spinlock, irq_flags); - + async->events = 0; enable_das800(dev); return 0; } diff --git a/comedi/drivers/poc.c b/comedi/drivers/poc.c index 657d4890..0a9d9c85 100644 --- a/comedi/drivers/poc.c +++ b/comedi/drivers/poc.c @@ -64,6 +64,7 @@ struct boarddef_struct{ int n_bits; int (*winsn)(comedi_device *,comedi_subdevice *,comedi_insn *,lsampl_t *); int (*rinsn)(comedi_device *,comedi_subdevice *,comedi_insn *,lsampl_t *); + comedi_lrange* range; }; static struct boarddef_struct boards[]={ { @@ -75,6 +76,7 @@ static struct boarddef_struct boards[]={ n_bits: 12, winsn: dac02_ao_winsn, rinsn: readback_insn, + range: &range_unknown, } }; #define n_boards (sizeof(boards)/sizeof(boards[0])) @@ -91,17 +93,6 @@ comedi_driver driver_poc= offset: sizeof(boards[0]), }; -// analog output ranges -static comedi_lrange range_dac02 = { - 4, - { - RANGE( -5, 5 ), - RANGE( -10, 10 ), - RANGE( 0, 5 ), - RANGE( 0, 10 ), - } -}; - static int poc_attach(comedi_device *dev, comedi_devconfig *it) { comedi_subdevice *s; @@ -141,7 +132,7 @@ static int poc_attach(comedi_device *dev, comedi_devconfig *it) s->type = this_board->type; s->n_chan = this_board->n_chan; s->maxdata = (1<n_bits)-1; - s->range_table = &range_dac02; // XXX + s->range_table = this_board->range; s->insn_write = this_board->winsn; s->insn_read = this_board->rinsn; if(s->type==COMEDI_SUBD_AO || s->type==COMEDI_SUBD_DO){ -- 2.26.2