Convert all uses of comedi_bufcheck, comedi_done, comedi_error_done,
authorDavid Schleef <ds@schleef.org>
Tue, 15 Jan 2002 11:54:56 +0000 (11:54 +0000)
committerDavid Schleef <ds@schleef.org>
Tue, 15 Jan 2002 11:54:56 +0000 (11:54 +0000)
comedi_eobuf, and comedi_eos to setting s->async flags and calling
comedi_event.

12 files changed:
comedi/drivers/adl_pci9118.c
comedi/drivers/adv_pci1710.c
comedi/drivers/comedi_parport.c
comedi/drivers/das6402.c
comedi/drivers/dt2811.c
comedi/drivers/dt2814.c
comedi/drivers/dt282x.c
comedi/drivers/ni_atmio16d.c
comedi/drivers/ni_mio_common.c
comedi/drivers/pcl711.c
comedi/drivers/pcl818.c
comedi/drivers/rtd520.c

index 8489d67efa24ed3383bd799da053dd5a931e5d16..64cb1550a6fdadb7733b59a6b2610b8dbce1eb38 100644 (file)
@@ -324,7 +324,8 @@ static void move_block_from_dma_12bit(comedi_device *dev,comedi_subdevice *s,sam
                if ((*dma & 0x0f00)!=devpriv->chanlist[j]) { // data dropout!
                        rt_printk("comedi: A/D  DMA - data dropout: received channel %d, expected %d!\n",(*dma & 0x0f00)>>8,devpriv->chanlist[j]>>8);
                        pci9118_ai_cancel(dev,s);
-                       comedi_error_done(dev,s);
+                       s->async->events |= COMEDI_CB_ERROR | COMEDI_CB_EOA;
+                       comedi_event(dev,s,s->async->events);
                        return;
                }
 #endif
@@ -338,7 +339,7 @@ static void move_block_from_dma_12bit(comedi_device *dev,comedi_subdevice *s,sam
                                m=0;
                                devpriv->ai1234_act_scan++;
                                if (devpriv->ai1234_flags & TRIG_WAKE_EOS) 
-                                       comedi_eos(dev,s);  
+                                       s->async->events |= COMEDI_CB_EOS;
                        }
                }
        }
@@ -365,8 +366,7 @@ static void move_block_from_dma_16bit(comedi_device *dev,comedi_subdevice *s,sam
                        if(m>=devpriv->ai1234_n_scanlen) {
                                m=0;
                                devpriv->ai1234_act_scan++;
-                               if (devpriv->ai1234_flags & TRIG_WAKE_EOS) 
-                                       comedi_eos(dev,s);  
+                               s->async->events |= COMEDI_CB_EOS;
                        }
                }
        }
@@ -396,7 +396,8 @@ static void interrupt_pci9118_ai_dma(int irq, void *d, struct pt_regs *regs)
        if (samplesinbuf & 1) {
                comedi_error(dev,"Odd count of bytes in DMA ring!");
                pci9118_ai_cancel(dev,s);
-               comedi_error_done(dev,s);
+               s->async->events |= COMEDI_CB_EOA | COMEDI_CB_ERROR;
+               comedi_event(dev,s,s->async->events);
                return;
        }
 
@@ -412,7 +413,8 @@ static void interrupt_pci9118_ai_dma(int irq, void *d, struct pt_regs *regs)
                        comedi_error(dev,"A/D Overrun Status (Fatal Error!)");
                if (m & 0x10a) {
                        pci9118_ai_cancel(dev,s);
-                       comedi_error_done(dev,s);
+                       s->async->events |= COMEDI_CB_EOA | COMEDI_CB_ERROR;
+                       comedi_event(dev,s,s->async->events);
                        return;
                }
        }
@@ -436,7 +438,7 @@ static void interrupt_pci9118_ai_dma(int irq, void *d, struct pt_regs *regs)
                samplesinbuf-=m;
                s->async->buf_int_ptr=0;
 
-               comedi_eobuf(dev,s);
+               s->async->events |= COMEDI_CB_EOBUF;
        }
        
        if (samplesinbuf) {
@@ -445,14 +447,15 @@ static void interrupt_pci9118_ai_dma(int irq, void *d, struct pt_regs *regs)
                s->async->buf_int_count+=samplesinbuf*sizeof(sampl_t);
                s->async->buf_int_ptr+=samplesinbuf*sizeof(sampl_t);
                if (!(devpriv->ai1234_flags & TRIG_WAKE_EOS)) {
-                       comedi_bufcheck(dev,s);
+                       s->async->events |= COMEDI_CB_EOS;
                }
        }
 
        if (!devpriv->neverending_ai)
                if ( devpriv->ai1234_act_scan>=devpriv->ai1234_scans ) { /* all data sampled */
                        pci9118_ai_cancel(dev,s);
-                       comedi_done(dev,s); 
+                       s->async->events |= COMEDI_CB_EOA;
+                       comedi_event(dev,s,s->async->events);
                        return;
                }
        
@@ -463,6 +466,8 @@ static void interrupt_pci9118_ai_dma(int irq, void *d, struct pt_regs *regs)
                outl(devpriv->dmabuf_hw[0], devpriv->iobase_a+AMCC_OP_REG_MWAR);
                outl(devpriv->dmabuf_use_size[0], devpriv->iobase_a+AMCC_OP_REG_MWTC);
        }
+
+       comedi_event(dev,s,s->async->events);
 }
 
 /* 
index efbd717b6d81e9c7b4a9ad762fd952a19982cb71..454a5c35a6f93336af1321bc478285853056128d 100644 (file)
@@ -481,13 +481,15 @@ static void interrupt_pci1710_every_sample(void *d)
        if (m & Status_FE) {
                rt_printk("comedi%d: A/D FIFO empty (%4x)\n", dev->minor, m);
                pci171x_ai_cancel(dev,s);
-               comedi_error_done(dev,s);
+               s->async->events |= COMEDI_CB_EOA | COMEDI_CB_ERROR;
+               comedi_event(dev,s,s->async->events);
                return;
        }
        if (m & Status_FF) {
                rt_printk("comedi%d: A/D FIFO Full status (Fatal Error!) (%4x)\n", dev->minor, m);
                pci171x_ai_cancel(dev,s);
-               comedi_error_done(dev,s);
+               s->async->events |= COMEDI_CB_EOA | COMEDI_CB_ERROR;
+               comedi_event(dev,s,s->async->events);
                return;
        }
 
@@ -502,7 +504,8 @@ static void interrupt_pci1710_every_sample(void *d)
                        if ((sampl & 0xf000)!=devpriv->act_chanlist[s->async->cur_chan]) {
                                rt_printk("comedi: A/D data dropout: received data from channel %d, expected %d!\n",(sampl & 0xf000)>>12,(devpriv->act_chanlist[s->async->cur_chan] & 0xf000)>>12);
                                pci171x_ai_cancel(dev,s);
-                               comedi_error_done(dev,s);
+                               s->async->events |= COMEDI_CB_EOA | COMEDI_CB_ERROR;
+                               comedi_event(dev,s,s->async->events);
                                return;
                        }
                *(sampl_t *)((void *)(devpriv->ai_data)+s->async->buf_int_ptr)=sampl & 0x0fff;
@@ -517,7 +520,7 @@ static void interrupt_pci1710_every_sample(void *d)
                if (s->async->buf_int_ptr>=devpriv->ai_data_len) {      // buffer rollover
                        s->async->buf_int_ptr = 0;
                        DPRINTK("adv_pci1710 EDBG: EOBUF1 bic %d bip %d buc %d bup %d\n",s->async->buf_int_count,s->async->buf_int_ptr, s->async->buf_user_count, s->async->buf_user_ptr);
-                       comedi_eobuf(dev, s);
+                       s->async->events |= COMEDI_CB_BLOCK;
                        DPRINTK("adv_pci1710 EDBG: EOBUF2\n");
                }
 
@@ -525,11 +528,12 @@ static void interrupt_pci1710_every_sample(void *d)
                        s->async->cur_chan=0;
                        devpriv->ai_act_scan++;
                        DPRINTK("adv_pci1710 EDBG: EOS1 bic %d bip %d buc %d bup %d\n",s->async->buf_int_count,s->async->buf_int_ptr, s->async->buf_user_count, s->async->buf_user_ptr);
-                       comedi_eos(dev, s);
+                       s->async->events |= COMEDI_CB_EOS;
                        DPRINTK("adv_pci1710 EDBG: EOS2\n");
                        if ((!devpriv->neverending_ai)&&(devpriv->ai_act_scan>=devpriv->ai_scans)) { // all data sampled 
                                pci171x_ai_cancel(dev,s);
-                               comedi_done(dev,s); 
+                               s->async->events |= COMEDI_CB_EOA;
+                               comedi_event(dev,s,s->async->events);
                                return;
                        }
                }
@@ -537,6 +541,8 @@ static void interrupt_pci1710_every_sample(void *d)
 
        outb(0, dev->iobase + PCI171x_CLRINT);                  // clear our INT request
        DPRINTK("adv_pci1710 EDBG: END: interrupt_pci1710_every_sample(...)\n");
+
+       comedi_event(dev,s,s->async->events);
 }
 
 /* 
@@ -561,7 +567,8 @@ static int move_block_from_fifo(comedi_device *dev,comedi_subdevice *s,sampl_t *
                                s->async->buf_int_ptr+=i*sizeof(sampl_t);
                                s->async->cur_chan=j;
                                pci171x_ai_cancel(dev,s);
-                               comedi_error_done(dev,s);
+                               s->async->events |= COMEDI_CB_EOA | COMEDI_CB_ERROR;
+                               comedi_event(dev,s,s->async->events);
                                return 1;
                        }
                *data=sampl & 0x0fff;
@@ -594,13 +601,15 @@ static void interrupt_pci1710_half_fifo(void *d)
        if (!(m & Status_FH)) {
                rt_printk("comedi%d: A/D FIFO not half full! (%4x)\n", dev->minor, m);
                pci171x_ai_cancel(dev,s);
-               comedi_error_done(dev,s);
+               s->async->events |= COMEDI_CB_EOA | COMEDI_CB_ERROR;
+               comedi_event(dev,s,s->async->events); 
                return;
        }
        if (m & Status_FF) {
                rt_printk("comedi%d: A/D FIFO Full status (Fatal Error!) (%4x)\n", dev->minor, m);
                pci171x_ai_cancel(dev,s);
-               comedi_error_done(dev,s);
+               s->async->events |= COMEDI_CB_EOA | COMEDI_CB_ERROR;
+               comedi_event(dev,s,s->async->events); 
                return;
        }
 
@@ -613,7 +622,7 @@ static void interrupt_pci1710_half_fifo(void *d)
                samplesinbuf-=m;
                s->async->buf_int_ptr=0;
                DPRINTK("adv_pci1710 EDBG: EOBUF1 bic %d bip %d buc %d bup %d\n",s->async->buf_int_count,s->async->buf_int_ptr, s->async->buf_user_count, s->async->buf_user_ptr);
-               comedi_eobuf(dev,s);
+               s->async->events |= COMEDI_CB_EOBUF;
                DPRINTK("adv_pci1710 EDBG: EOBUF2\n");
        }
 
@@ -625,18 +634,21 @@ static void interrupt_pci1710_half_fifo(void *d)
                s->async->buf_int_ptr+=samplesinbuf*sizeof(sampl_t);
 
                DPRINTK("adv_pci1710 EDBG: BUFCHECK1 bic %d bip %d buc %d bup %d\n",s->async->buf_int_count,s->async->buf_int_ptr, s->async->buf_user_count, s->async->buf_user_ptr);
-               comedi_bufcheck(dev,s);
+               s->async->events |= COMEDI_CB_BLOCK;
                DPRINTK("adv_pci1710 EDBG: BUFCHECK2\n");
        }
 
        if (!devpriv->neverending_ai)
                if ( devpriv->ai_act_scan>=devpriv->ai_scans ) { /* all data sampled */
                        pci171x_ai_cancel(dev,s);
-                       comedi_done(dev,s); 
+                       s->async->events |= COMEDI_CB_EOA;
+                       comedi_event(dev,s,s->async->events); 
                        return;
                }
        outb(0, dev->iobase + PCI171x_CLRINT);                  // clear our INT request
        DPRINTK("adv_pci1710 EDBG: END: interrupt_pci1710_half_fifo(...)\n");
+
+       comedi_event(dev,s,s->async->events); 
 }
 
 /* 
index 4c2802b0e1c67b4afd2a60cfeb4dd1a753f1bf12..60082e5170492be9a7afc2f00da856c546e2b454 100644 (file)
@@ -276,10 +276,10 @@ static void parport_interrupt(int irq,void *d,struct pt_regs *regs)
        s->async->buf_int_count+=sizeof(sampl_t);
        if(s->async->buf_int_ptr>=s->async->data_len){
                s->async->buf_int_ptr=0;
-               comedi_eobuf(dev,s);
+               s->async->events |= COMEDI_CB_EOBUF;
        }
        
-       comedi_bufcheck(dev,s);
+       comedi_event(dev,s,s->async->events);
 }
 
 static int parport_attach(comedi_device *dev,comedi_devconfig *it)
index d709fd9097cf52d5c0b072f76ccbb089123d6820..90f3008c47e84bf7c04b405a2525b2ec7d653dff 100644 (file)
@@ -177,12 +177,13 @@ static void intr_handler(int irq,void *d,struct pt_regs *regs)
 #ifdef DEBUG
                printk("das6402: Got %i samples\n\n",devpriv->das6402_wordsread-diff);
 #endif
-               comedi_done(dev,dev->subdevices+0);
+               s->async->events |= COMEDI_CB_EOA;
+               comedi_event(dev,s,s->async->events);
        }
 
        outb(0x01,dev->iobase+8);   /* clear only the interrupt flip-flop */
 
-       return;
+       comedi_event(dev,s,s->async->events);
 }
 
 #if 0
@@ -216,7 +217,7 @@ static void das6402_ai_fifo_dregs(comedi_device *dev,comedi_subdevice *s)
                        s->async->buf_int_count+=sizeof(sampl_t);
                }
                s->async->buf_int_ptr=0;
-               comedi_eobuf(dev,s);
+               s->async->events |= COMEDI_CB_EOBUF;
        }
 #if 0
        if (n>1024) {
index 2341e2747106f004bc157f77baea3824d0796c6c..7448044bb1fcc386968b0980ba6a8ba7956faffd 100644 (file)
@@ -278,8 +278,9 @@ static void dt2811_interrupt(int irq, void *d, struct pt_regs *regs)
 
        if (!(--devpriv->ntrig)) {
                /* how to turn off acquisition */
-               comedi_done(dev, dev->subdevices + 0);
+               s->async->events |= COMEDI_SB_EOA;
        }
+       comedi_event(dev, s, s->async->events);
 }
 #endif
 
index c29de31be31c6ec5297bd2ac107feeea949beb35..4051fcfa219dc3e5687d65bc8f06037d7ad8adc3 100644 (file)
@@ -342,6 +342,7 @@ static void dt2814_interrupt(int irq,void *d,struct pt_regs * regs)
 {
         int lo,hi;
         comedi_device *dev=d;
+       comedi_subdevice *s = dev->subdevices + 0;
        int data;
 
         hi=inb(dev->iobase+DT2814_DATA);
@@ -366,7 +367,8 @@ static void dt2814_interrupt(int irq,void *d,struct pt_regs * regs)
                inb(dev->iobase+DT2814_DATA);
                restore_flags(flags);
        
-               comedi_done(dev,dev->subdevices);
+               s->async->events |= COMEDI_CB_EOA;
        }
+       comedi_event(dev,s,s->async->events);
 }
 
index 5a72f31e40a96542f9836eddd9ce1f3cf1b6b726..f3e9d80e45d80f5ef10717e2fcb27ca71ff95f09 100644 (file)
@@ -481,14 +481,16 @@ static void dt282x_ao_dma_interrupt(comedi_device * dev)
        if(!size){
                printk("dt282x: AO underrun\n");
                dt282x_ao_cancel(dev,s);
-               comedi_done(dev,s);
+               s->async->events |= COMEDI_CB_EOA | COMEDI_CB_ERROR;
+               comedi_event(dev,s,s->async->events);
                return;
        }
        prep_ao_dma(dev,i,size/2);
 
        enable_dma(devpriv->dma[i].chan);
 
-       comedi_bufcheck(dev,s);
+       s->async->events |= COMEDI_CB_BLOCK;
+       comedi_event(dev,s,s->async->events);
        return;
 }
 
@@ -529,11 +531,12 @@ static void dt282x_ai_dma_interrupt(comedi_device * dev)
                devpriv->supcsr = 0;
                update_supcsr(DT2821_ADCINIT);
 
-               comedi_done(dev,s);
+               s->async->events |= COMEDI_CB_EOA;
+               comedi_event(dev,s,s->async->events);
 
                return;
        }else{
-               comedi_bufcheck(dev,s);
+               s->async->events |= COMEDI_CB_BLOCK;
        }
 
 #if 1
@@ -549,7 +552,7 @@ static void dt282x_ai_dma_interrupt(comedi_device * dev)
 
        enable_dma(devpriv->dma[i].chan);
 
-       return;
+       comedi_event(dev,s,s->async->events);
 }
 
 static int prep_ai_dma(comedi_device * dev,int chan,int n)
@@ -610,7 +613,8 @@ static void dt282x_interrupt(int irq, void *d, struct pt_regs *regs)
        if (adcsr & DT2821_ADERR) {
                comedi_error(dev, "A/D error");
                dt282x_ai_cancel(dev,s);
-               comedi_done(dev,s);
+               s->async->events |= COMEDI_CB_EOA | COMEDI_CB_ERROR;
+               comedi_event(dev,s,s->async->events);   
                return;
        }
        supcsr = inw(dev->iobase + DT2821_SUPCSR);
@@ -632,7 +636,8 @@ static void dt282x_interrupt(int irq, void *d, struct pt_regs *regs)
 #endif
                comedi_error(dev, "D/A error");
                dt282x_ao_cancel(dev,s);
-               comedi_done(dev,s);
+               s->async->events |= COMEDI_CB_EOA | COMEDI_CB_ERROR;
+               comedi_event(dev,s,s->async->events);   
                return;
        }
        if (adcsr & DT2821_ADDONE) {
@@ -646,17 +651,18 @@ static void dt282x_interrupt(int irq, void *d, struct pt_regs *regs)
                s->async->buf_int_count+=sizeof(sampl_t);
                if(s->async->buf_int_ptr>=s->async->data_len){
                        s->async->buf_int_ptr = 0;
-                       //s->events |= COMEDI_EOBUF;
+                       s->async->events |= COMEDI_CB_EOBUF;
                }
 
                devpriv->nread--;
                if(!devpriv->nread){
-                       comedi_done(dev,s);
+                       s->async->events |= COMEDI_CB_EOA;
                }else{
                        if(supcsr&DT2821_SCDN)
                                update_supcsr(DT2821_STRIG);
                }
 
+               comedi_event(dev,s,s->async->events);   
                return;
        }
 }
index f4d8a1e671ddc75a7a2354792aeac288097ea4bc..b2a95ba337596e4efc4d9367cd0193cd232a16da 100644 (file)
@@ -277,13 +277,14 @@ static void atmio16d_interrupt(int irq, void *d, struct pt_regs *regs)
 
        if((++s->async->cur_chan) >= s->async->cmd.chanlist_len) {      /* one scan done */
                s->async->cur_chan = 0;
-               comedi_eos(dev, s);
+               s->async->events |= COMEDI_CB_EOS;
        }
 
        if (s->async->buf_int_ptr >= s->async->data_len) {      /* buffer rollover */
                s->async->buf_int_ptr = 0;
-               comedi_eobuf(dev, s);
+               s->async->events |= COMEDI_CB_EOBUF;
        }
+       comedi_event(dev, s, s->async->events);
 }
 
 static int atmio16d_ai_cmdtest(comedi_device *dev, comedi_subdevice *s, comedi_cmd *cmd)
index 267028622e9a0deba9f71f2ebf4a6c0558b53566..dfd864f7ec91aa82ced73c592e1207f049fc116c 100644 (file)
@@ -350,7 +350,7 @@ static void mite_handle_interrupt(comedi_device *dev,unsigned int m_status)
        
        comedi_subdevice *s=dev->subdevices+0;
        
-       comedi_event(dev,s,COMEDI_CB_BLOCK);
+       s->async->events |= COMEDI_CB_BLOCK;
 
        MDPRINTK("mite_handle_interrupt\n");
        writel(CHOR_CLRLC, devpriv->mite->mite_io_addr+MITE_CHOR+CHAN_OFFSET(0));
@@ -421,7 +421,10 @@ static void handle_a_interrupt(comedi_device *dev,unsigned short status)
                        rt_printk("ni_mio_common: a_status=0xffff.  Card removed?\n");
                        /* we probably aren't even running a command now,
                         * so it's a good idea to be careful. */
-                       if(s->subdev_flags&SDF_RUNNING)comedi_done(dev,s);
+                       if(s->subdev_flags&SDF_RUNNING){
+                               s->async->events |= COMEDI_CB_EOA;
+                               comedi_event(dev,s,s->async->events);
+                       }
                        return;
                }
                if(status&(AI_Overrun_St|AI_Overflow_St|AI_SC_TC_Error_St)){
@@ -443,7 +446,8 @@ static void handle_a_interrupt(comedi_device *dev,unsigned short status)
                                AI_FIFO_Interrupt_Enable,0);
                                
                        ni_ai_reset(dev,dev->subdevices);//added by tim
-                       comedi_done(dev,s);
+                       s->async->events |= COMEDI_CB_EOA;
+                       comedi_event(dev,s,s->async->events);
                        return;
                }
                if(status&AI_SC_TC_St){
@@ -461,7 +465,7 @@ static void handle_a_interrupt(comedi_device *dev,unsigned short status)
                                        AI_STOP_Interrupt_Enable| AI_Error_Interrupt_Enable|
                                        AI_FIFO_Interrupt_Enable,0);
 
-                               comedi_done(dev,s);
+                               s->async->events |= COMEDI_CB_EOA;
                        }
 #endif // !PCIDMA
                        ack|=AI_SC_TC_Interrupt_Ack;
@@ -520,6 +524,8 @@ static void handle_b_interrupt(comedi_device *dev,unsigned short b_status)
                rt_printk("Ack! didn't clear AO interrupt. b_status=0x%04x\n",b_status);
                win_out(0,Interrupt_B_Enable_Register);
        }
+
+       comedi_event(dev,s,s->async->events);
 }
 
 #ifdef DEBUG_STATUS_A
@@ -688,6 +694,8 @@ static void ni_munge(comedi_device *dev,comedi_subdevice *s,sampl_t *start,
 
 static void ni_handle_block_dma(comedi_device *dev)
 {
+       comedi_subdevice *s = dev->subdevices + 0;
+
        MDPRINTK("ni_handle_block_dma\n");
        //mite_dump_regs(devpriv->mite);  
        mite_dma_disarm(devpriv->mite);
@@ -699,7 +707,7 @@ static void ni_handle_block_dma(comedi_device *dev)
                AI_FIFO_Interrupt_Enable,0);
 
        ni_ai_reset(dev,dev->subdevices);
-       comedi_done(dev,dev->subdevices);
+       s->async->events |= COMEDI_CB_EOA;
        MDPRINTK("exit ni_handle_block_dma\n");
 }
 
@@ -1597,7 +1605,7 @@ static int ni_ao_fifo_half_empty(comedi_device *dev,comedi_subdevice *s)
        }
        ni_ao_fifo_load(dev,s,s->async->data+s->async->buf_int_ptr,n);
 
-       comedi_bufcheck(dev,s);
+       s->async->events |= COMEDI_CB_BLOCK;
 
        return 1;
 }
index f0dee5708b05b4dffb4f0b3797e01ed629f58360..eb79fd251931e7b42d02e7b55bf6900d6f166f01 100644 (file)
@@ -209,8 +209,9 @@ static void pcl711_interrupt(int irq, void *d, struct pt_regs *regs)
                        outb(0, dev->iobase + PCL711_MODE);
                }
 
-               comedi_done(dev,s);
+               s->async->events |= COMEDI_CB_EOA;
        }
+       comedi_event(dev, s, s->async->events);
 }
 
 static void pcl711_set_changain(comedi_device * dev, int chan)
index e6e8017cbd6ec66594f83a2706e18151a5a1d314..c4fa120941d39b5440283fcd00d7f530edff5ea4 100644 (file)
@@ -500,7 +500,8 @@ static void interrupt_pcl818_ai_mode13_int(int irq, void *d, struct pt_regs *reg
         outb(0,dev->iobase+PCL818_STATUS); /* clear INT request */
         comedi_error(dev,"A/D mode1/3 IRQ without DRDY!");
        pcl818_ai_cancel(dev,s);
-        comedi_error_done(dev,s);
+       s->async->events |= COMEDI_CB_EOA | COMEDI_CB_ERROR;
+       comedi_event(dev, s, s->async->events);
        return;
 
 conv_finish:
@@ -512,7 +513,8 @@ conv_finish:
         if ((low & 0xf)!=devpriv->act_chanlist[devpriv->act_chanlist_pos]) { // dropout!
                rt_printk("comedi: A/D mode1/3 IRQ - channel dropout %x!=%x !\n",(low & 0xf),devpriv->act_chanlist[devpriv->act_chanlist_pos]);
                pcl818_ai_cancel(dev,s);
-               comedi_error_done(dev,s);
+               s->async->events |= COMEDI_CB_EOA | COMEDI_CB_ERROR;
+               comedi_event(dev, s, s->async->events);
                return;
         }
         s->async->buf_int_ptr+=sizeof(sampl_t);
@@ -521,15 +523,7 @@ conv_finish:
        s->async->cur_chan++;
         if (s->async->cur_chan>=s->async->cmd.chanlist_len){
                s->async->cur_chan=0;
-#if 0
-               if (devpriv->cur_flags & TRIG_WAKE_EOS){
-                       comedi_eos(dev,s);
-               } else {
-                       comedi_bufcheck(dev,s);
-               }
-#else
-               comedi_bufcheck(dev,s);
-#endif
+               s->async->events |= COMEDI_CB_BLOCK;
                // rt_printk("E");
                devpriv->int13_act_scan--;
         }
@@ -538,15 +532,17 @@ conv_finish:
                s->async->buf_int_ptr=0;
                devpriv->buf_ptr=0;
                //printk("B ");
-               comedi_eobuf(dev,s);
+               s->async->events |= COMEDI_CB_EOBUF;
         }
 
-       if (!devpriv->neverending_ai)
+       if (!devpriv->neverending_ai){
                if ( devpriv->int13_act_scan == 0 ) { /* all data sampled */
                        pcl818_ai_cancel(dev,s);
-                       comedi_done(dev,s);
+                       s->async->events |= COMEDI_CB_EOA;
                        return;
                }
+       }
+       comedi_event(dev, s, s->async->events);
 }
 
 /*
@@ -584,7 +580,8 @@ static void interrupt_pcl818_ai_mode13_dma(int irq, void *d, struct pt_regs *reg
                if ((ptr[bufptr] & 0xf)!=devpriv->act_chanlist[devpriv->act_chanlist_pos]) { // dropout!
                        rt_printk("comedi: A/D mode1/3 DMA - channel dropout %d!=%d !\n",(ptr[bufptr] & 0xf),devpriv->act_chanlist[devpriv->act_chanlist_pos]);
                        pcl818_ai_cancel(dev,s);
-                       comedi_error_done(dev,s);
+                       s->async->events |= COMEDI_CB_EOA | COMEDI_CB_ERROR;
+                       comedi_event(dev, s, s->async->events);
                        return;
                }
 
@@ -604,19 +601,20 @@ static void interrupt_pcl818_ai_mode13_dma(int irq, void *d, struct pt_regs *reg
                if (s->async->buf_int_ptr>=s->async->data_len) { /* buffer rollover */
                        s->async->buf_int_ptr=0;
                        devpriv->buf_ptr=0;
-                       comedi_eobuf(dev,s);
+                       s->async->events |= COMEDI_CB_EOBUF;
                }
 
                if (!devpriv->neverending_ai)
                        if ( devpriv->int13_act_scan == 0 ) { /* all data sampled */
                                pcl818_ai_cancel(dev,s);
-                               comedi_done(dev,s);
+                               s->async->events |= COMEDI_CB_EOA;
+                               comedi_event(dev, s, s->async->events);
                                // printk("done int ai13 dma\n");
                                return;
                        }
        }
 
-       if (len>0)  comedi_bufcheck(dev,s);
+       if (len>0) comedi_event(dev, s, s->async->events);
 }
 
 /*
@@ -659,7 +657,8 @@ static void interrupt_pcl818_ai_mode13_dma_rtc(int irq, void *d, struct pt_regs
                        comedi_error(dev,"A/D mode1/3 DMA buffer overflow!");
                        //rt_printk("I %d dmabuf[i] %d %d\n",i,dmabuf[i],devpriv->dmasamplsize);
                        pcl818_ai_cancel(dev,s);
-                       comedi_error_done(dev,s);
+                       s->async->events |= COMEDI_CB_EOA | COMEDI_CB_ERROR;
+                       comedi_event(dev, s, s->async->events);
                        return;
                }
                //rt_printk("r %ld ",ofs_dats);
@@ -670,7 +669,8 @@ static void interrupt_pcl818_ai_mode13_dma_rtc(int irq, void *d, struct pt_regs
                        if ((dmabuf[bufptr] & 0xf)!=devpriv->act_chanlist[devpriv->act_chanlist_pos]) { // dropout!
                                rt_printk("comedi: A/D mode1/3 DMA - channel dropout %d!=%d !\n",(dmabuf[bufptr] & 0xf),devpriv->act_chanlist[devpriv->act_chanlist_pos]);
                                pcl818_ai_cancel(dev,s);
-                               comedi_error_done(dev,s);
+                               s->async->events |= COMEDI_CB_EOA | COMEDI_CB_ERROR;
+                               comedi_event(dev, s, s->async->events);
                                return;
                        }
 
@@ -691,13 +691,14 @@ static void interrupt_pcl818_ai_mode13_dma_rtc(int irq, void *d, struct pt_regs
                        if (s->async->buf_int_ptr>=s->async->data_len) { /* buffer rollover */
                                s->async->buf_int_ptr=0;
                                devpriv->buf_ptr=0;
-                               comedi_eobuf(dev,s);
+                               s->async->events |= COMEDI_CB_EOBUF;
                        }
 
                        if (!devpriv->neverending_ai)
                                if ( devpriv->int13_act_scan == 0 ) { /* all data sampled */
                                        pcl818_ai_cancel(dev,s);
-                                       comedi_done(dev,s);
+                                       s->async->events |= COMEDI_CB_EOA;
+                                       comedi_event(dev, s, s->async->events);
                                        //printk("done int ai13 dma\n");
                                        return;
                                }
@@ -707,13 +708,12 @@ static void interrupt_pcl818_ai_mode13_dma_rtc(int irq, void *d, struct pt_regs
                bufptr--;
                bufptr&=(devpriv->dmasamplsize-1);
                dmabuf[bufptr]=MAGIC_DMA_WORD;
-               comedi_bufcheck(dev,s);
+               comedi_event(dev, s, s->async->events);
                //outb(0,0x378);
                return;
        }
 
        //outb(0,0x378);
-
 }
 
 /*
@@ -733,14 +733,16 @@ static void interrupt_pcl818_ai_mode13_fifo(int irq, void *d, struct pt_regs *re
         if (lo&4) {
                comedi_error(dev,"A/D mode1/3 FIFO overflow!");
                pcl818_ai_cancel(dev,s);
-               comedi_error_done(dev,s);
+               s->async->events |= COMEDI_CB_EOA | COMEDI_CB_ERROR;
+               comedi_event(dev, s, s->async->events);
                return;
         }
 
         if (lo&1) {
                comedi_error(dev,"A/D mode1/3 FIFO interrupt without data!");
                pcl818_ai_cancel(dev,s);
-               comedi_error_done(dev,s);
+               s->async->events |= COMEDI_CB_EOA | COMEDI_CB_ERROR;
+               comedi_event(dev, s, s->async->events);
                return;
        }
 
@@ -752,7 +754,8 @@ static void interrupt_pcl818_ai_mode13_fifo(int irq, void *d, struct pt_regs *re
                if ((lo & 0xf)!=devpriv->act_chanlist[devpriv->act_chanlist_pos]) { // dropout!
                        rt_printk("comedi: A/D mode1/3 FIFO - channel dropout %d!=%d !\n",(lo & 0xf),devpriv->act_chanlist[devpriv->act_chanlist_pos]);
                        pcl818_ai_cancel(dev,s);
-                       comedi_error_done(dev,s);
+                       s->async->events |= COMEDI_CB_EOA | COMEDI_CB_ERROR;
+                       comedi_event(dev, s, s->async->events);
                        return;
                }
 
@@ -771,19 +774,19 @@ static void interrupt_pcl818_ai_mode13_fifo(int irq, void *d, struct pt_regs *re
                if (s->async->buf_int_ptr>=s->async->data_len) { /* buffer rollover */
                        s->async->buf_int_ptr=0;
                        devpriv->buf_ptr=0;
-                       comedi_eobuf(dev,s);
+                       s->async->events |= COMEDI_CB_EOBUF;
                }
 
                if (!devpriv->neverending_ai)
                        if ( devpriv->int13_act_scan == 0 ) { /* all data sampled */
-                               comedi_bufcheck(dev,s);
                                pcl818_ai_cancel(dev,s);
-                               comedi_done(dev,s);
+                               s->async->events |= COMEDI_CB_EOA;
+                               comedi_event(dev, s, s->async->events);
                                return;
                        }
        }
 
-       if (len>0)  comedi_bufcheck(dev,s);
+       if (len>0) comedi_event(dev, s, s->async->events);
 }
 
 /*
index f1b005556cdb3cb7b94808b99ed3adbf6a85de84..09e146f55a514f8927d1caf3b80047f5ae802429 100644 (file)
@@ -1025,7 +1025,6 @@ static void rtd_interrupt (
        /* Check for any ready data */
        if (RtdFifoStatus (dev) & FS_ADC_HEMPTY) { /* read 1/2 fifo worth */
            ai_read_half_fifo (dev, s);
-           /*comedi_bufcheck (dev, s); */
            s->async->events |= COMEDI_CB_BLOCK; /* signal something there */
        } else {
            /* for slow transfers, we should read whatever is there */
@@ -1035,7 +1034,6 @@ static void rtd_interrupt (
        if (0 == devpriv->aiCount) { /* done! stop! */
            RtdInterruptMask (dev, 0);          /* mask out ABOUT and SAMPLE */
            RtdPacerStop (dev);                 /* Stop PACER */
-           /*comedi_done (dev, s);*/
            s->async->events |= COMEDI_CB_EOA;/* signal end to comedi */
        } else if (status & IRQM_ADC_ABOUT_CNT) { /* about cnt terminated */
            if (devpriv->aboutWrap) { /* multi-count wraps */
@@ -1049,17 +1047,13 @@ static void rtd_interrupt (
                RtdPacerStop (dev);     /* Stop PACER */
                ai_read_dregs (dev, s); /* ready anything in FIFO */
 
-               /*comedi_done (dev, s);*/
                s->async->events |= COMEDI_CB_EOA;/* signal end to comedi */
            }
        }
 
        /* check for fifo over-run */
        
-       if (s->async->events != 0) {    /* signal any events */
-           comedi_event (dev, s, s->async->events);
-           s->async->events = 0;
-       }
+       comedi_event (dev, s, s->async->events);
     }
 
                                        /* clear the interrupt */
@@ -1436,7 +1430,6 @@ static int rtd_ai_cmd (
            = d + 2048;                 /* convert to comedi unsigned data */
        s->async->buf_int_count += sizeof(sampl_t);
        s->async->buf_int_ptr += sizeof(sampl_t);
-       comedi_done (dev, s);
     } else {
        /* interrupt setup */
        if (! dev->irq) {