From 7a330bee62f226f13108a789e998757b297fec92 Mon Sep 17 00:00:00 2001 From: Frank Mori Hess Date: Thu, 23 Aug 2001 04:54:36 +0000 Subject: [PATCH] forgot to load up fifo in analog out inttrig, fixed typo in dt282x.c, accidentally commited unknown changes to ni_at_a2150.c I'll have to look at that :) --- comedi/drivers/cb_pcidas.c | 30 ++++++++++++++++++++++++++---- comedi/drivers/dt282x.c | 2 +- comedi/drivers/ni_at_a2150.c | 2 +- 3 files changed, 28 insertions(+), 6 deletions(-) diff --git a/comedi/drivers/cb_pcidas.c b/comedi/drivers/cb_pcidas.c index 5b2955ff..2107a165 100644 --- a/comedi/drivers/cb_pcidas.c +++ b/comedi/drivers/cb_pcidas.c @@ -69,6 +69,7 @@ analog triggering on 1602 series // PCI vendor number of ComputerBoards/MeasurementComputing #define PCI_VENDOR_CB 0x1307 #define TIMER_BASE 100 // 10MHz master clock +static const int max_fifo_size = 1024; // maximum fifo size of any supported board /* PCI-DAS base addresses */ @@ -1182,8 +1183,6 @@ static int cb_pcidas_ao_cmd(comedi_device *dev,comedi_subdevice *s) break; } - // next time we send these bits, we want aquisiton to actually start - ao_control_bits |= DAC_START | DACEN | DAC_EMPTY; devpriv->ao_control_bits = ao_control_bits; async->inttrig = cb_pcidas_ao_inttrig; @@ -1192,9 +1191,30 @@ static int cb_pcidas_ao_cmd(comedi_device *dev,comedi_subdevice *s) static int cb_pcidas_ao_inttrig(comedi_device *dev, comedi_subdevice *s, unsigned int trig_num) { + unsigned int i, num_points = thisboard->fifo_size; + sampl_t data[max_fifo_size]; + comedi_async *async = s->async; + comedi_cmd *cmd = &s->async->cmd; + if(trig_num != 0) return -EINVAL; + // load up fifo + if(cmd->stop_src == TRIG_COUNT && + devpriv->ao_count < num_points) + num_points = devpriv->ao_count; + for(i = 0; i < num_points; i++) + { + if(comedi_buf_get(async, &data[i])) + break; + } + if(cmd->stop_src == TRIG_COUNT) + { + devpriv->ao_count -= i; + } + // write data to board's fifo + outsw(devpriv->ao_registers + DACDATA, data, i); + // enable dac half-full and empty interrupts devpriv->adc_fifo_bits |= DAEMIE | DAHFIE; #ifdef CB_PCIDAS_DEBUG @@ -1206,12 +1226,13 @@ static int cb_pcidas_ao_inttrig(comedi_device *dev, comedi_subdevice *s, unsigne outl(devpriv->s5933_intcsr_bits, devpriv->s5933_config + INTCSR); // start dac + devpriv->ao_control_bits |= DAC_START | DACEN | DAC_EMPTY; outw(devpriv->ao_control_bits, devpriv->control_status + DAC_CSR); #ifdef CB_PCIDAS_DEBUG rt_printk("comedi: sent 0x%x to dac control\n", devpriv->ao_control_bits); #endif - s->async->inttrig = NULL; + async->inttrig = NULL; return 0; } @@ -1322,13 +1343,14 @@ static void cb_pcidas_interrupt(int irq, void *d, struct pt_regs *regs) return; } + static void handle_ao_interrupt(comedi_device *dev, unsigned int status) { comedi_subdevice *s = dev->write_subdev; comedi_async *async = s->async; comedi_cmd *cmd = &async->cmd; unsigned int half_fifo = thisboard->fifo_size / 2; - static const int max_half_fifo = 512; // maximum possible half-fifo size + static const int max_half_fifo = max_fifo_size / 2; // maximum possible half-fifo size sampl_t data[max_half_fifo]; unsigned int num_points, i; diff --git a/comedi/drivers/dt282x.c b/comedi/drivers/dt282x.c index 850f570c..7cac9dd8 100644 --- a/comedi/drivers/dt282x.c +++ b/comedi/drivers/dt282x.c @@ -1011,7 +1011,7 @@ static int dt282x_ao_inttrig(comedi_device *dev,comedi_subdevice *s, { int size; - if(x!=0)return -EVINAL; + if(x!=0)return -EINVAL; size=copy_from_buf(dev,s,devpriv->dma[0].buf,devpriv->dma_maxsize*2); prep_ao_dma(dev,0,size/2); diff --git a/comedi/drivers/ni_at_a2150.c b/comedi/drivers/ni_at_a2150.c index 4009fd01..44be8cb3 100644 --- a/comedi/drivers/ni_at_a2150.c +++ b/comedi/drivers/ni_at_a2150.c @@ -1,6 +1,6 @@ /* ni_at_a2150.c driver for National Instruments AT-A2150 boards - Copyright (C) 2000 Frank Mori Hess + Copyright (C) 2001 Frank Mori Hess COMEDI - Linux Control and Measurement Device Interface Copyright (C) 2000 David A. Schleef -- 2.26.2