The ADC half full flag flag and interrupt occurs at 2049 samples, not 2048
authorIan Abbott <abbotti@mev.co.uk>
Mon, 12 Nov 2007 15:04:46 +0000 (15:04 +0000)
committerIan Abbott <abbotti@mev.co.uk>
Mon, 12 Nov 2007 15:04:46 +0000 (15:04 +0000)
(i.e. it's an "over half full" flag since the FIFO size is 4096).

comedi/drivers/amplc_pci230.c

index 9958833f5daa56bbec78b20391cb5d46251f830b..909f23c552fbc1b093dd6c3390ae7898b1a0cc8f 100644 (file)
@@ -136,6 +136,10 @@ extra triggered scan functionality, interrupt bug-fix added by Steve Sharples
 #define PCI230_ADC_FIFO_FULL           (1<<13)
 #define PCI230_ADC_FIFO_HALF           (1<<14)
 
+/* PCI230 ADC FIFO levels. */
+#define PCI230_ADC_FIFOLEVEL_HALFFULL  2049
+#define PCI230_ADC_FIFOLEVEL_FULL      4096
+
 /* PCI230+ EXTFUNC values. */
 #define PCI230P_EXTFUNC_GAT_EXTTRIG    (1<<0)
                        /* Route EXTTRIG pin to external gate inputs. */
@@ -1451,7 +1455,7 @@ static int pci230_ai_cmd(comedi_device * dev, comedi_subdevice * s)
 
        /* Set FIFO interrupt trigger level. */
        if (cmd->stop_src == TRIG_COUNT) {
-               if (devpriv->ai_count < 2048) {
+               if (devpriv->ai_count < PCI230_ADC_FIFOLEVEL_HALFFULL) {
                        adccon = adccon | PCI230_ADC_INT_FIFO_NEMPTY;
                } else {
                        adccon = adccon | PCI230_ADC_INT_FIFO_HALF;
@@ -1733,7 +1737,7 @@ static void pci230_handle_fifo_half_full(comedi_device * dev,
 {
        int i;
 
-       for (i = 0; i < 2048; i++) {
+       for (i = 0; i < PCI230_ADC_FIFOLEVEL_HALFFULL; i++) {
                /* Read sample and store in Comedi's circular buffer. */
                comedi_buf_put(s->async, pci230_ai_read(dev));