From 04d9a24afc83abe036935d9595fac55e31077671 Mon Sep 17 00:00:00 2001 From: David Schleef Date: Tue, 15 Jan 2002 11:54:56 +0000 Subject: [PATCH] Convert all uses of comedi_bufcheck, comedi_done, comedi_error_done, comedi_eobuf, and comedi_eos to setting s->async flags and calling comedi_event. --- comedi/drivers/adl_pci9118.c | 23 +++++++----- comedi/drivers/adv_pci1710.c | 36 ++++++++++++------ comedi/drivers/comedi_parport.c | 4 +- comedi/drivers/das6402.c | 7 ++-- comedi/drivers/dt2811.c | 3 +- comedi/drivers/dt2814.c | 4 +- comedi/drivers/dt282x.c | 24 +++++++----- comedi/drivers/ni_atmio16d.c | 5 ++- comedi/drivers/ni_mio_common.c | 20 +++++++--- comedi/drivers/pcl711.c | 3 +- comedi/drivers/pcl818.c | 65 +++++++++++++++++---------------- comedi/drivers/rtd520.c | 9 +---- 12 files changed, 118 insertions(+), 85 deletions(-) diff --git a/comedi/drivers/adl_pci9118.c b/comedi/drivers/adl_pci9118.c index 8489d67e..64cb1550 100644 --- a/comedi/drivers/adl_pci9118.c +++ b/comedi/drivers/adl_pci9118.c @@ -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); } /* diff --git a/comedi/drivers/adv_pci1710.c b/comedi/drivers/adv_pci1710.c index efbd717b..454a5c35 100644 --- a/comedi/drivers/adv_pci1710.c +++ b/comedi/drivers/adv_pci1710.c @@ -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); } /* diff --git a/comedi/drivers/comedi_parport.c b/comedi/drivers/comedi_parport.c index 4c2802b0..60082e51 100644 --- a/comedi/drivers/comedi_parport.c +++ b/comedi/drivers/comedi_parport.c @@ -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) diff --git a/comedi/drivers/das6402.c b/comedi/drivers/das6402.c index d709fd90..90f3008c 100644 --- a/comedi/drivers/das6402.c +++ b/comedi/drivers/das6402.c @@ -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) { diff --git a/comedi/drivers/dt2811.c b/comedi/drivers/dt2811.c index 2341e274..7448044b 100644 --- a/comedi/drivers/dt2811.c +++ b/comedi/drivers/dt2811.c @@ -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 diff --git a/comedi/drivers/dt2814.c b/comedi/drivers/dt2814.c index c29de31b..4051fcfa 100644 --- a/comedi/drivers/dt2814.c +++ b/comedi/drivers/dt2814.c @@ -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); } diff --git a/comedi/drivers/dt282x.c b/comedi/drivers/dt282x.c index 5a72f31e..f3e9d80e 100644 --- a/comedi/drivers/dt282x.c +++ b/comedi/drivers/dt282x.c @@ -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; } } diff --git a/comedi/drivers/ni_atmio16d.c b/comedi/drivers/ni_atmio16d.c index f4d8a1e6..b2a95ba3 100644 --- a/comedi/drivers/ni_atmio16d.c +++ b/comedi/drivers/ni_atmio16d.c @@ -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) diff --git a/comedi/drivers/ni_mio_common.c b/comedi/drivers/ni_mio_common.c index 26702862..dfd864f7 100644 --- a/comedi/drivers/ni_mio_common.c +++ b/comedi/drivers/ni_mio_common.c @@ -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; } diff --git a/comedi/drivers/pcl711.c b/comedi/drivers/pcl711.c index f0dee570..eb79fd25 100644 --- a/comedi/drivers/pcl711.c +++ b/comedi/drivers/pcl711.c @@ -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) diff --git a/comedi/drivers/pcl818.c b/comedi/drivers/pcl818.c index e6e8017c..c4fa1209 100644 --- a/comedi/drivers/pcl818.c +++ b/comedi/drivers/pcl818.c @@ -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); } /* diff --git a/comedi/drivers/rtd520.c b/comedi/drivers/rtd520.c index f1b00555..09e146f5 100644 --- a/comedi/drivers/rtd520.c +++ b/comedi/drivers/rtd520.c @@ -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) { -- 2.26.2