From 7df405394724587e5a86ffa1e26555f15a3db0e7 Mon Sep 17 00:00:00 2001 From: Frank Mori Hess Date: Fri, 6 Jul 2001 15:22:54 +0000 Subject: [PATCH] fixed cmdtest --- comedi/drivers/ni_at_a2150.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/comedi/drivers/ni_at_a2150.c b/comedi/drivers/ni_at_a2150.c index 6d4a24d7..df899911 100644 --- a/comedi/drivers/ni_at_a2150.c +++ b/comedi/drivers/ni_at_a2150.c @@ -132,7 +132,6 @@ a2150_board a2150_boards[] = typedef struct{ volatile unsigned int count; /* number of data points left to be taken */ - volatile int forever; /* flag indicating whether we should take data forever */ unsigned int dma; // dma channel s16 *dma_buffer; // dma buffer unsigned int dma_transfer_size; // size in bytes of dma transfers @@ -558,7 +557,7 @@ static int a2150_ai_cmdtest(comedi_device *dev,comedi_subdevice *s,comedi_cmd *c { tmp = cmd->scan_begin_arg; a2150_get_timing(dev, &cmd->scan_begin_arg, cmd->flags); - if(tmp != cmd->convert_arg) err++; + if(tmp != cmd->scan_begin_arg) err++; } if(err)return 4; @@ -591,11 +590,11 @@ static int a2150_ai_cmd(comedi_device *dev, comedi_subdevice *s) return -1; // setup ac/dc coupling - if(CR_AREF(cmd->chanlist[0]) == AREF_DIFF) + if(CR_AREF(cmd->chanlist[0]) == AREF_OTHER) devpriv->config_bits |= AC0_BIT; else devpriv->config_bits &= ~AC0_BIT; - if(CR_AREF(cmd->chanlist[2]) == AREF_DIFF) + if(CR_AREF(cmd->chanlist[2]) == AREF_OTHER) devpriv->config_bits |= AC1_BIT; else devpriv->config_bits &= ~AC1_BIT; @@ -667,6 +666,12 @@ static int a2150_get_timing(comedi_device *dev, unsigned int *period, int flags) glb_index = thisboard->num_clocks - 1; glb = thisboard->clock[glb_index] * (1 << lub_divisor_shift); + // make sure period is in available range + if(*period < glb) + *period = glb; + if(*period > lub) + *period = lub; + // we can multiply period by 1, 2, 4, or 8, using (1 << i) for(i = 0; i < 4; i = i++) { -- 2.26.2