From: Frank Mori Hess Date: Fri, 27 Jul 2007 21:00:12 +0000 (+0000) Subject: Got rid of useless 3rd parameter of comedi_event(). X-Git-Tag: r0_7_74~25 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=00493f7f61845eaaaea64e3cd1a656551ba15882;p=comedi.git Got rid of useless 3rd parameter of comedi_event(). --- diff --git a/comedi/comedi_fops.c b/comedi/comedi_fops.c index d82ef211..82b01d4c 100644 --- a/comedi/comedi_fops.c +++ b/comedi/comedi_fops.c @@ -1811,7 +1811,7 @@ void comedi_error(const comedi_device *dev,const char *s) rt_printk("comedi%d: %s: %s\n", dev->minor, dev->driver->driver_name, s); } -void comedi_event(comedi_device *dev, comedi_subdevice *s, unsigned useless) +void comedi_event(comedi_device *dev, comedi_subdevice *s) { comedi_async *async = s->async; diff --git a/comedi/drivers/8255.c b/comedi/drivers/8255.c index 89d46103..4c118970 100644 --- a/comedi/drivers/8255.c +++ b/comedi/drivers/8255.c @@ -129,7 +129,7 @@ void subdev_8255_interrupt(comedi_device *dev, comedi_subdevice *s) comedi_buf_put(s->async, d); s->async->events |= COMEDI_CB_EOS; - comedi_event(dev,s,s->async->events); + comedi_event(dev, s); } static int subdev_8255_cb(int dir,int port,int data,unsigned long arg) diff --git a/comedi/drivers/adl_pci9111.c b/comedi/drivers/adl_pci9111.c index a3de23d6..484747fa 100644 --- a/comedi/drivers/adl_pci9111.c +++ b/comedi/drivers/adl_pci9111.c @@ -967,7 +967,7 @@ pci9111_interrupt (int irq, void *p_device PT_REGS_ARG) pci9111_interrupt_clear(); pci9111_ai_cancel (dev, subdevice); async->events |= COMEDI_CB_ERROR | COMEDI_CB_EOA; - comedi_event (dev, subdevice, async->events); + comedi_event (dev, subdevice); return IRQ_HANDLED; } @@ -1040,7 +1040,7 @@ pci9111_interrupt (int irq, void *p_device PT_REGS_ARG) comedi_spin_unlock_irqrestore (&dev->spinlock, irq_flags); - comedi_event (dev, subdevice, async->events); + comedi_event (dev, subdevice); return IRQ_HANDLED; } diff --git a/comedi/drivers/adl_pci9118.c b/comedi/drivers/adl_pci9118.c index 61e8e42d..4efafb5e 100644 --- a/comedi/drivers/adl_pci9118.c +++ b/comedi/drivers/adl_pci9118.c @@ -501,7 +501,7 @@ static char pci9118_decode_error_status(comedi_device *dev,comedi_subdevice *s,u if (m & devpriv->ai_maskharderr) { s->async->events|=COMEDI_CB_ERROR|COMEDI_CB_EOA; pci9118_ai_cancel(dev,s); - comedi_event(dev,s,s->async->events); + comedi_event(dev, s); return 1; } @@ -547,7 +547,7 @@ static void interrupt_pci9118_ai_onesample(comedi_device *dev,comedi_subdevice * rt_printk("comedi: A/D SAMPL - data dropout: received channel %d, expected %d!\n",sampl & 0x000f, devpriv->chanlist[s->async->cur_chan]); s->async->events|=COMEDI_CB_ERROR|COMEDI_CB_EOA; pci9118_ai_cancel(dev,s); - comedi_event(dev,s,s->async->events); + comedi_event(dev, s); return; } } @@ -565,7 +565,7 @@ static void interrupt_pci9118_ai_onesample(comedi_device *dev,comedi_subdevice * } if (s->async->events) - comedi_event(dev,s,s->async->events); + comedi_event(dev, s); } /* @@ -580,7 +580,7 @@ static void interrupt_pci9118_ai_dma(comedi_device *dev,comedi_subdevice *s, comedi_error(dev,"AMCC IRQ - MASTER DMA ABORT!"); s->async->events|=COMEDI_CB_ERROR|COMEDI_CB_EOA; pci9118_ai_cancel(dev,s); - comedi_event(dev,s,s->async->events); + comedi_event(dev, s); return; } @@ -588,7 +588,7 @@ static void interrupt_pci9118_ai_dma(comedi_device *dev,comedi_subdevice *s, comedi_error(dev,"AMCC IRQ - TARGET DMA ABORT!"); s->async->events|=COMEDI_CB_ERROR|COMEDI_CB_EOA; pci9118_ai_cancel(dev,s); - comedi_event(dev,s,s->async->events); + comedi_event(dev, s); return; } @@ -634,7 +634,7 @@ static void interrupt_pci9118_ai_dma(comedi_device *dev,comedi_subdevice *s, interrupt_pci9118_ai_mode4_switch(dev); } - comedi_event(dev,s,s->async->events); + comedi_event(dev, s); } /* diff --git a/comedi/drivers/adv_pci1710.c b/comedi/drivers/adv_pci1710.c index 29b2e600..0f7d23a9 100644 --- a/comedi/drivers/adv_pci1710.c +++ b/comedi/drivers/adv_pci1710.c @@ -567,14 +567,14 @@ static void interrupt_pci1710_every_sample(void *d) rt_printk("comedi%d: A/D FIFO empty (%4x)\n", dev->minor, m); pci171x_ai_cancel(dev,s); s->async->events |= COMEDI_CB_EOA | COMEDI_CB_ERROR; - comedi_event(dev,s,s->async->events); + comedi_event(dev, s); 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); s->async->events |= COMEDI_CB_EOA | COMEDI_CB_ERROR; - comedi_event(dev,s,s->async->events); + comedi_event(dev, s); return; } @@ -590,7 +590,7 @@ static void interrupt_pci1710_every_sample(void *d) 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); s->async->events |= COMEDI_CB_EOA | COMEDI_CB_ERROR; - comedi_event(dev,s,s->async->events); + comedi_event(dev, s); return; } DPRINTK("%8d %2d %8d~",s->async->buf_int_ptr,s->async->cur_chan,s->async->buf_int_count); @@ -611,7 +611,7 @@ static void interrupt_pci1710_every_sample(void *d) if ((!devpriv->neverending_ai)&&(devpriv->ai_act_scan>=devpriv->ai_scans)) { // all data sampled pci171x_ai_cancel(dev,s); s->async->events |= COMEDI_CB_EOA; - comedi_event(dev,s,s->async->events); + comedi_event(dev, s); return; } } @@ -620,7 +620,7 @@ 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); + comedi_event(dev, s); } /* @@ -643,7 +643,7 @@ static int move_block_from_fifo(comedi_device *dev,comedi_subdevice *s, int n, i dev->minor, (sampl & 0xf000)>>12,(devpriv->act_chanlist[j] & 0xf000)>>12, i, j, devpriv->ai_act_scan, n, turn, sampl); pci171x_ai_cancel(dev,s); s->async->events |= COMEDI_CB_EOA | COMEDI_CB_ERROR; - comedi_event(dev,s,s->async->events); + comedi_event(dev, s); return 1; } comedi_buf_put( s->async, sampl & 0x0fff ); @@ -675,14 +675,14 @@ static void interrupt_pci1710_half_fifo(void *d) rt_printk("comedi%d: A/D FIFO not half full! (%4x)\n", dev->minor, m); pci171x_ai_cancel(dev,s); s->async->events |= COMEDI_CB_EOA | COMEDI_CB_ERROR; - comedi_event(dev,s,s->async->events); + comedi_event(dev, s); 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); s->async->events |= COMEDI_CB_EOA | COMEDI_CB_ERROR; - comedi_event(dev,s,s->async->events); + comedi_event(dev, s); return; } @@ -703,13 +703,13 @@ static void interrupt_pci1710_half_fifo(void *d) if ( devpriv->ai_act_scan>=devpriv->ai_scans ) { /* all data sampled */ pci171x_ai_cancel(dev,s); s->async->events |= COMEDI_CB_EOA; - comedi_event(dev,s,s->async->events); + comedi_event(dev, s); 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); + comedi_event(dev, s); } /* diff --git a/comedi/drivers/amplc_dio200.c b/comedi/drivers/amplc_dio200.c index bd1f046d..2560bcfa 100644 --- a/comedi/drivers/amplc_dio200.c +++ b/comedi/drivers/amplc_dio200.c @@ -631,7 +631,7 @@ dio200_inttrig_start_intr(comedi_device *dev, comedi_subdevice *s, comedi_spin_unlock_irqrestore(&subpriv->spinlock, flags); if (event) { - comedi_event(dev, s, s->async->events); + comedi_event(dev, s); } return 1; @@ -741,7 +741,7 @@ dio200_handle_read_intr(comedi_device *dev, comedi_subdevice *s) comedi_spin_unlock_irqrestore(&subpriv->spinlock, flags); if (oldevents != s->async->events) { - comedi_event(dev, s, s->async->events); + comedi_event(dev, s); } return (triggered != 0); @@ -899,7 +899,7 @@ dio200_subdev_intr_cmd(comedi_device *dev, comedi_subdevice *s) comedi_spin_unlock_irqrestore(&subpriv->spinlock, flags); if (event) { - comedi_event(dev, s, s->async->events); + comedi_event(dev, s); } return 0; diff --git a/comedi/drivers/amplc_pc236.c b/comedi/drivers/amplc_pc236.c index f76edb65..fce474b3 100644 --- a/comedi/drivers/amplc_pc236.c +++ b/comedi/drivers/amplc_pc236.c @@ -561,7 +561,7 @@ static irqreturn_t pc236_interrupt(int irq,void *d PT_REGS_ARG) if (handled) { comedi_buf_put(s->async,0); s->async->events |= COMEDI_CB_BLOCK | COMEDI_CB_EOS; - comedi_event(dev,s,s->async->events); + comedi_event(dev, s); } return IRQ_RETVAL(handled); } diff --git a/comedi/drivers/amplc_pci224.c b/comedi/drivers/amplc_pci224.c index 62d9c652..68b93cd2 100644 --- a/comedi/drivers/amplc_pci224.c +++ b/comedi/drivers/amplc_pci224.c @@ -575,7 +575,7 @@ pci224_ao_start(comedi_device *dev, comedi_subdevice *s) /* An empty acquisition! */ pci224_ao_stop(dev, s); s->async->events |= COMEDI_CB_EOA; - comedi_event(dev, s, s->async->events); + comedi_event(dev, s); } else { /* Enable interrupts. */ comedi_spin_lock_irqsave(&devpriv->ao_spinlock, flags); @@ -714,7 +714,7 @@ pci224_ao_handle_fifo(comedi_device *dev, comedi_subdevice *s) } } if (s->async->events) { - comedi_event(dev, s, s->async->events); + comedi_event(dev, s); } } diff --git a/comedi/drivers/amplc_pci230.c b/comedi/drivers/amplc_pci230.c index c5f395f9..dd79824b 100644 --- a/comedi/drivers/amplc_pci230.c +++ b/comedi/drivers/amplc_pci230.c @@ -1461,7 +1461,7 @@ static irqreturn_t pci230_interrupt(int irq, void *d PT_REGS_ARG) s = dev->write_subdev; s->async->events = 0; pci230_handle_ao(dev, s); - comedi_event(dev, s, s->async->events); + comedi_event(dev, s); s->async->events = 0; } @@ -1469,7 +1469,7 @@ static irqreturn_t pci230_interrupt(int irq, void *d PT_REGS_ARG) s = dev->read_subdev; s->async->events = 0; pci230_handle_ai(dev, s); - comedi_event(dev, s, s->async->events); + comedi_event(dev, s); s->async->events = 0; } diff --git a/comedi/drivers/cb_pcidas.c b/comedi/drivers/cb_pcidas.c index 4db26d62..1e7360a9 100644 --- a/comedi/drivers/cb_pcidas.c +++ b/comedi/drivers/cb_pcidas.c @@ -1604,7 +1604,7 @@ static irqreturn_t cb_pcidas_interrupt(int irq, void *d PT_REGS_ARG) async->events |= COMEDI_CB_EOA | COMEDI_CB_ERROR; } - comedi_event(dev, s, async->events); + comedi_event(dev, s); return IRQ_HANDLED; } @@ -1661,7 +1661,7 @@ static void handle_ao_interrupt(comedi_device *dev, unsigned int status) comedi_spin_unlock_irqrestore( &dev->spinlock, flags ); } - comedi_event(dev, s, async->events); + comedi_event(dev, s); } // cancel analog input command diff --git a/comedi/drivers/comedi_fc.c b/comedi/drivers/comedi_fc.c index d0f7abf2..38ae2333 100644 --- a/comedi/drivers/comedi_fc.c +++ b/comedi/drivers/comedi_fc.c @@ -111,7 +111,7 @@ unsigned int cfc_handle_events( comedi_device *dev, comedi_subdevice *subd ) if( events & ( COMEDI_CB_EOA | COMEDI_CB_ERROR | COMEDI_CB_OVERFLOW ) ) subd->cancel( dev, subd ); - comedi_event( dev, subd, events ); + comedi_event(dev, subd); return events; } diff --git a/comedi/drivers/comedi_parport.c b/comedi/drivers/comedi_parport.c index 6ea3c8c0..cfaba060 100644 --- a/comedi/drivers/comedi_parport.c +++ b/comedi/drivers/comedi_parport.c @@ -277,7 +277,7 @@ static irqreturn_t parport_interrupt(int irq,void *d PT_REGS_ARG) comedi_buf_put( s->async, 0 ); s->async->events |= COMEDI_CB_BLOCK | COMEDI_CB_EOS; - comedi_event(dev,s,s->async->events); + comedi_event(dev, s); return IRQ_HANDLED; } diff --git a/comedi/drivers/comedi_test.c b/comedi/drivers/comedi_test.c index 37f8a6c8..b9a3e9df 100644 --- a/comedi/drivers/comedi_test.c +++ b/comedi/drivers/comedi_test.c @@ -178,7 +178,7 @@ static void waveform_ai_interrupt(unsigned long arg) else del_timer(&devpriv->timer); - comedi_event(dev, dev->read_subdev, async->events); + comedi_event(dev, dev->read_subdev); } static int waveform_attach(comedi_device *dev,comedi_devconfig *it) diff --git a/comedi/drivers/das16m1.c b/comedi/drivers/das16m1.c index de878967..65a9c94e 100644 --- a/comedi/drivers/das16m1.c +++ b/comedi/drivers/das16m1.c @@ -568,7 +568,7 @@ static void das16m1_handler(comedi_device *dev, unsigned int status) comedi_error(dev, "fifo overflow"); } - comedi_event(dev, s, async->events); + comedi_event(dev, s); } diff --git a/comedi/drivers/das1800.c b/comedi/drivers/das1800.c index 721438c1..f33036e0 100644 --- a/comedi/drivers/das1800.c +++ b/comedi/drivers/das1800.c @@ -947,7 +947,7 @@ static void das1800_ai_handler(comedi_device *dev) comedi_error(dev, "DAS1800 FIFO overflow"); das1800_cancel(dev, s); async->events |= COMEDI_CB_ERROR | COMEDI_CB_EOA; - comedi_event(dev, s, async->events); + comedi_event(dev, s); return; } @@ -970,7 +970,7 @@ static void das1800_ai_handler(comedi_device *dev) async->events |= COMEDI_CB_EOA; } - comedi_event(dev, s, async->events); + comedi_event(dev, s); return; } diff --git a/comedi/drivers/das6402.c b/comedi/drivers/das6402.c index 9e7730eb..63274c7d 100644 --- a/comedi/drivers/das6402.c +++ b/comedi/drivers/das6402.c @@ -176,12 +176,12 @@ static irqreturn_t intr_handler(int irq,void *d PT_REGS_ARG) printk("das6402: Got %i samples\n\n",devpriv->das6402_wordsread-diff); #endif s->async->events |= COMEDI_CB_EOA; - comedi_event(dev,s,s->async->events); + comedi_event(dev, s); } outb(0x01,dev->iobase+8); /* clear only the interrupt flip-flop */ - comedi_event(dev,s,s->async->events); + comedi_event(dev, s); return IRQ_HANDLED; } diff --git a/comedi/drivers/das800.c b/comedi/drivers/das800.c index e34411f8..aca1e28e 100644 --- a/comedi/drivers/das800.c +++ b/comedi/drivers/das800.c @@ -428,7 +428,7 @@ static irqreturn_t das800_interrupt(int irq, void *d PT_REGS_ARG) comedi_error(dev, "DAS800 FIFO overflow"); das800_cancel(dev, dev->subdevices + 0); async->events |= COMEDI_CB_ERROR | COMEDI_CB_EOA; - comedi_event(dev, s, async->events); + comedi_event(dev, s); async->events = 0; return IRQ_HANDLED; } @@ -446,7 +446,7 @@ static irqreturn_t das800_interrupt(int irq, void *d PT_REGS_ARG) disable_das800(dev); /* diable hardware triggered conversions */ async->events |= COMEDI_CB_EOA; } - comedi_event(dev, s, async->events); + comedi_event(dev, s); async->events = 0; return IRQ_HANDLED; } diff --git a/comedi/drivers/dmm32at.c b/comedi/drivers/dmm32at.c index 1a2c4659..c2b59fe0 100644 --- a/comedi/drivers/dmm32at.c +++ b/comedi/drivers/dmm32at.c @@ -825,7 +825,7 @@ static int dmm32at_ai_cmd(comedi_device *dev, comedi_subdevice *s) /* comedi_buf_put(s->async,i*100); */ /* s->async->events |= COMEDI_CB_EOA; */ -/* comedi_event(dev,s,s->async->events); */ +/* comedi_event(dev, s); */ return 0; @@ -870,7 +870,7 @@ static irqreturn_t dmm32at_isr(int irq,void *d PT_REGS_ARG){ } /* flush the buffer */ - comedi_event(dev,s,s->async->events); + comedi_event(dev, s); } /* reset the interrupt */ diff --git a/comedi/drivers/dt2814.c b/comedi/drivers/dt2814.c index 64628975..de084730 100644 --- a/comedi/drivers/dt2814.c +++ b/comedi/drivers/dt2814.c @@ -360,7 +360,7 @@ static irqreturn_t dt2814_interrupt(int irq,void *d PT_REGS_ARG) s->async->events |= COMEDI_CB_EOA; } - comedi_event(dev,s,s->async->events); + comedi_event(dev, s); return IRQ_HANDLED; } diff --git a/comedi/drivers/dt282x.c b/comedi/drivers/dt282x.c index bd58dcc0..ef901324 100644 --- a/comedi/drivers/dt282x.c +++ b/comedi/drivers/dt282x.c @@ -639,7 +639,7 @@ static irqreturn_t dt282x_interrupt(int irq, void *d PT_REGS_ARG) handled = 1; } #endif - comedi_event(dev, s, s->async->events); + comedi_event(dev, s); /* printk("adcsr=0x%02x dacsr-0x%02x supcsr=0x%02x\n", adcsr, dacsr, supcsr); */ return IRQ_RETVAL(handled); } diff --git a/comedi/drivers/dt3000.c b/comedi/drivers/dt3000.c index 0cfd0d71..4001b0af 100644 --- a/comedi/drivers/dt3000.c +++ b/comedi/drivers/dt3000.c @@ -357,7 +357,7 @@ static irqreturn_t dt3k_interrupt(int irq, void *d PT_REGS_ARG) s->async->events |= COMEDI_CB_EOA; } - comedi_event(dev,s,s->async->events); + comedi_event(dev, s); return IRQ_HANDLED; } diff --git a/comedi/drivers/me4000.c b/comedi/drivers/me4000.c index 3fedb93c..7373a24f 100644 --- a/comedi/drivers/me4000.c +++ b/comedi/drivers/me4000.c @@ -1802,7 +1802,7 @@ static irqreturn_t me4000_ai_isr(int irq, void *dev_id PT_REGS_ARG){ ISR_PDEBUG("me4000_ai_isr(): Events = 0x%X\n", s->async->events); if(s->async->events) - comedi_event(dev, s, s->async->events); + comedi_event(dev, s); return IRQ_HANDLED; } diff --git a/comedi/drivers/ni_6527.c b/comedi/drivers/ni_6527.c index a6902b41..a52f8e69 100644 --- a/comedi/drivers/ni_6527.c +++ b/comedi/drivers/ni_6527.c @@ -211,7 +211,7 @@ static irqreturn_t ni6527_interrupt(int irq, void *d PT_REGS_ARG) comedi_buf_put(s->async, 0); s->async->events |= COMEDI_CB_EOS; - comedi_event(dev,s,s->async->events); + comedi_event(dev, s); return IRQ_HANDLED; } diff --git a/comedi/drivers/ni_65xx.c b/comedi/drivers/ni_65xx.c index 3a6171cc..59bc6e49 100644 --- a/comedi/drivers/ni_65xx.c +++ b/comedi/drivers/ni_65xx.c @@ -464,7 +464,7 @@ static irqreturn_t ni_65xx_interrupt(int irq, void *d PT_REGS_ARG) comedi_buf_put(s->async, 0); s->async->events |= COMEDI_CB_EOS; - comedi_event(dev,s,s->async->events); + comedi_event(dev, s); return IRQ_HANDLED; } diff --git a/comedi/drivers/ni_at_a2150.c b/comedi/drivers/ni_at_a2150.c index 2235d049..475dcc0c 100644 --- a/comedi/drivers/ni_at_a2150.c +++ b/comedi/drivers/ni_at_a2150.c @@ -245,7 +245,7 @@ static irqreturn_t a2150_interrupt(int irq, void *d PT_REGS_ARG) comedi_error(dev, "caught non-dma interrupt? Aborting."); a2150_cancel(dev, s); async->events |= COMEDI_CB_ERROR | COMEDI_CB_EOA; - comedi_event(dev, s, async->events); + comedi_event(dev, s); return IRQ_HANDLED; } @@ -313,7 +313,7 @@ static irqreturn_t a2150_interrupt(int irq, void *d PT_REGS_ARG) async->events |= COMEDI_CB_BLOCK; - comedi_event(dev, s, async->events); + comedi_event(dev, s); /* clear interrupt */ outw(0x00, dev->iobase + DMA_TC_CLEAR_REG); diff --git a/comedi/drivers/ni_atmio16d.c b/comedi/drivers/ni_atmio16d.c index 642d9287..3ec1bc04 100644 --- a/comedi/drivers/ni_atmio16d.c +++ b/comedi/drivers/ni_atmio16d.c @@ -263,7 +263,7 @@ static irqreturn_t atmio16d_interrupt(int irq, void *d PT_REGS_ARG) comedi_buf_put( s->async, inw(dev->iobase+AD_FIFO_REG) ); - comedi_event(dev, s, s->async->events); + comedi_event(dev, s); return IRQ_HANDLED; } diff --git a/comedi/drivers/ni_labpc.c b/comedi/drivers/ni_labpc.c index 2cef71b9..625c7ad8 100644 --- a/comedi/drivers/ni_labpc.c +++ b/comedi/drivers/ni_labpc.c @@ -1351,7 +1351,7 @@ static irqreturn_t labpc_interrupt(int irq, void *d PT_REGS_ARG) // clear error interrupt devpriv->write_byte(0x1, dev->iobase + ADC_CLEAR_REG); async->events |= COMEDI_CB_ERROR | COMEDI_CB_EOA; - comedi_event(dev, s, async->events); + comedi_event(dev, s); comedi_error(dev, "overrun"); return IRQ_HANDLED; } @@ -1378,7 +1378,7 @@ static irqreturn_t labpc_interrupt(int irq, void *d PT_REGS_ARG) // clear error interrupt devpriv->write_byte(0x1, dev->iobase + ADC_CLEAR_REG); async->events |= COMEDI_CB_ERROR | COMEDI_CB_EOA; - comedi_event(dev, s, async->events); + comedi_event(dev, s); comedi_error(dev, "overflow"); return IRQ_HANDLED; } @@ -1404,7 +1404,7 @@ static irqreturn_t labpc_interrupt(int irq, void *d PT_REGS_ARG) } } - comedi_event(dev, s, async->events); + comedi_event(dev, s); return IRQ_HANDLED; } diff --git a/comedi/drivers/ni_mio_common.c b/comedi/drivers/ni_mio_common.c index 0e002c0a..f93fbe4f 100644 --- a/comedi/drivers/ni_mio_common.c +++ b/comedi/drivers/ni_mio_common.c @@ -787,9 +787,9 @@ static void shutdown_ai_command( comedi_device *dev ) s->async->events |= COMEDI_CB_EOA; } -static void ni_event(comedi_device *dev, comedi_subdevice *s, unsigned events) +static void ni_event(comedi_device *dev, comedi_subdevice *s) { - if(events & (COMEDI_CB_ERROR | COMEDI_CB_OVERFLOW | COMEDI_CB_EOA)) + if(s->async->events & (COMEDI_CB_ERROR | COMEDI_CB_OVERFLOW | COMEDI_CB_EOA)) { switch(dev->subdevices - s) { @@ -807,7 +807,7 @@ static void ni_event(comedi_device *dev, comedi_subdevice *s, unsigned events) break; } } - comedi_event(dev, s, events); + comedi_event(dev, s); } static void handle_gpct_interrupt(comedi_device *dev, unsigned short counter_index) @@ -816,7 +816,7 @@ static void handle_gpct_interrupt(comedi_device *dev, unsigned short counter_ind ni_tio_handle_interrupt(&devpriv->counter_dev->counters[counter_index], s); if(s->async->events) - ni_event(dev, s, s->async->events); + ni_event(dev, s); } static void ack_a_interrupt(comedi_device *dev, unsigned short a_status) @@ -877,7 +877,7 @@ static void handle_a_interrupt(comedi_device *dev, unsigned short status, * so it's a good idea to be careful. */ if(comedi_get_subdevice_runflags(s) & SRF_RUNNING){ s->async->events |= COMEDI_CB_ERROR | COMEDI_CB_EOA; - ni_event(dev, s, s->async->events); + ni_event(dev, s); } return; } @@ -892,7 +892,7 @@ static void handle_a_interrupt(comedi_device *dev, unsigned short status, if(status & (AI_Overrun_St | AI_Overflow_St)) s->async->events |= COMEDI_CB_OVERFLOW; - ni_event(dev, s, s->async->events); + ni_event(dev, s); return; } @@ -924,7 +924,7 @@ static void handle_a_interrupt(comedi_device *dev, unsigned short status, ni_handle_eos(dev, s); } - ni_event(dev,s,s->async->events); + ni_event(dev, s); #ifdef DEBUG_INTERRUPT status=devpriv->stc_readw(dev, AI_Status_1_Register); @@ -1017,7 +1017,7 @@ static void handle_b_interrupt(comedi_device *dev, unsigned short b_status, } #endif - ni_event(dev,s,s->async->events); + ni_event(dev, s); } #ifdef DEBUG_STATUS_A diff --git a/comedi/drivers/ni_pcidio.c b/comedi/drivers/ni_pcidio.c index 6721b000..ba79dc35 100644 --- a/comedi/drivers/ni_pcidio.c +++ b/comedi/drivers/ni_pcidio.c @@ -468,13 +468,13 @@ static int nidio96_8255_cb(int dir,int port,int data,unsigned long iobase) } } -void ni_pcidio_event(comedi_device *dev, comedi_subdevice *s, unsigned events) +void ni_pcidio_event(comedi_device *dev, comedi_subdevice *s) { - if(events & (COMEDI_CB_EOA | COMEDI_CB_ERROR | COMEDI_CB_OVERFLOW)) + if(s->async->events & (COMEDI_CB_EOA | COMEDI_CB_ERROR | COMEDI_CB_OVERFLOW)) { ni_pcidio_cancel(dev, s); } - comedi_event(dev, s, events); + comedi_event(dev, s); } static irqreturn_t nidio_interrupt(int irq, void *d PT_REGS_ARG) @@ -604,7 +604,7 @@ static irqreturn_t nidio_interrupt(int irq, void *d PT_REGS_ARG) } out: - ni_pcidio_event(dev, s, async->events); + ni_pcidio_event(dev, s); #if 0 if(!tag){ writeb(0x03,devpriv->mite->daq_io_addr+Master_DMA_And_Interrupt_Control); diff --git a/comedi/drivers/pcl711.c b/comedi/drivers/pcl711.c index 70c0961a..9aa776e7 100644 --- a/comedi/drivers/pcl711.c +++ b/comedi/drivers/pcl711.c @@ -201,7 +201,7 @@ static irqreturn_t pcl711_interrupt(int irq, void *d PT_REGS_ARG) s->async->events |= COMEDI_CB_EOA; } - comedi_event(dev, s, s->async->events); + comedi_event(dev, s); return IRQ_HANDLED; } diff --git a/comedi/drivers/pcl812.c b/comedi/drivers/pcl812.c index d0e847bc..77562555 100644 --- a/comedi/drivers/pcl812.c +++ b/comedi/drivers/pcl812.c @@ -880,7 +880,7 @@ static irqreturn_t interrupt_pcl812_ai_int(int irq, void *d) rt_printk("comedi%d: pcl812: (%s at 0x%lx) A/D cmd IRQ without DRDY!\n", dev->minor, dev->board_name, dev->iobase); pcl812_ai_cancel(dev,s); s->async->events |= COMEDI_CB_EOA|COMEDI_CB_ERROR; - comedi_event(dev,s,s->async->events); + comedi_event(dev, s); return IRQ_HANDLED; } @@ -898,7 +898,7 @@ static irqreturn_t interrupt_pcl812_ai_int(int irq, void *d) } } - comedi_event(dev,s,s->async->events); + comedi_event(dev, s); return IRQ_HANDLED; } @@ -925,7 +925,7 @@ static void transfer_from_dma_buf(comedi_device *dev,comedi_subdevice *s, } } - comedi_event(dev,s,s->async->events); + comedi_event(dev, s); } /* diff --git a/comedi/drivers/pcl816.c b/comedi/drivers/pcl816.c index ad23dab5..0324b05e 100644 --- a/comedi/drivers/pcl816.c +++ b/comedi/drivers/pcl816.c @@ -302,7 +302,7 @@ interrupt_pcl816_ai_mode13_int (int irq, void *d) comedi_error (dev, "A/D mode1/3 IRQ without DRDY!"); pcl816_ai_cancel (dev, s); s->async->events |= COMEDI_CB_EOA | COMEDI_CB_ERROR; - comedi_event(dev, s, s->async->events); + comedi_event(dev, s); return IRQ_HANDLED; } @@ -332,7 +332,7 @@ interrupt_pcl816_ai_mode13_int (int irq, void *d) pcl816_ai_cancel (dev, s); s->async->events |= COMEDI_CB_EOA; } - comedi_event(dev, s, s->async->events); + comedi_event(dev, s); return IRQ_HANDLED; } @@ -366,7 +366,7 @@ static void transfer_from_dma_buf(comedi_device *dev,comedi_subdevice *s, } } - comedi_event(dev,s,s->async->events); + comedi_event(dev, s); } diff --git a/comedi/drivers/pcl818.c b/comedi/drivers/pcl818.c index c137bfd6..8bc2475a 100644 --- a/comedi/drivers/pcl818.c +++ b/comedi/drivers/pcl818.c @@ -514,7 +514,7 @@ static irqreturn_t interrupt_pcl818_ai_mode13_int(int irq, void *d) comedi_error(dev,"A/D mode1/3 IRQ without DRDY!"); pcl818_ai_cancel(dev,s); s->async->events |= COMEDI_CB_EOA | COMEDI_CB_ERROR; - comedi_event(dev, s, s->async->events); + comedi_event(dev, s); return IRQ_HANDLED; conv_finish: @@ -527,7 +527,7 @@ conv_finish: 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); s->async->events |= COMEDI_CB_EOA | COMEDI_CB_ERROR; - comedi_event(dev, s, s->async->events); + comedi_event(dev, s); return IRQ_HANDLED; } if (s->async->cur_chan == 0) { @@ -541,7 +541,7 @@ conv_finish: s->async->events |= COMEDI_CB_EOA; } } - comedi_event(dev, s, s->async->events); + comedi_event(dev, s); return IRQ_HANDLED; } @@ -582,7 +582,7 @@ static irqreturn_t interrupt_pcl818_ai_mode13_dma(int irq, void *d) rt_printk("comedi: A/D mode1/3 DMA - channel dropout %d(card)!=%d(chanlist) at %d !\n",(ptr[bufptr] & 0xf),devpriv->act_chanlist[devpriv->act_chanlist_pos], devpriv->act_chanlist_pos); pcl818_ai_cancel(dev,s); s->async->events |= COMEDI_CB_EOA | COMEDI_CB_ERROR; - comedi_event(dev, s, s->async->events); + comedi_event(dev, s); return IRQ_HANDLED; } @@ -598,13 +598,13 @@ static irqreturn_t interrupt_pcl818_ai_mode13_dma(int irq, void *d) if ( devpriv->ai_act_scan == 0 ) { /* all data sampled */ pcl818_ai_cancel(dev,s); s->async->events |= COMEDI_CB_EOA; - comedi_event(dev, s, s->async->events); + comedi_event(dev, s); // printk("done int ai13 dma\n"); return IRQ_HANDLED; } } - if (len>0) comedi_event(dev, s, s->async->events); + if (len>0) comedi_event(dev, s); return IRQ_HANDLED; } @@ -650,7 +650,7 @@ static irqreturn_t interrupt_pcl818_ai_mode13_dma_rtc(int irq, void *d) //rt_printk("I %d dmabuf[i] %d %d\n",i,dmabuf[i],devpriv->dmasamplsize); pcl818_ai_cancel(dev,s); s->async->events |= COMEDI_CB_EOA | COMEDI_CB_ERROR; - comedi_event(dev, s, s->async->events); + comedi_event(dev, s); return IRQ_HANDLED; } //rt_printk("r %ld ",ofs_dats); @@ -662,7 +662,7 @@ static irqreturn_t interrupt_pcl818_ai_mode13_dma_rtc(int irq, void *d) 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); s->async->events |= COMEDI_CB_EOA | COMEDI_CB_ERROR; - comedi_event(dev, s, s->async->events); + comedi_event(dev, s); return IRQ_HANDLED; } @@ -677,7 +677,7 @@ static irqreturn_t interrupt_pcl818_ai_mode13_dma_rtc(int irq, void *d) if ( devpriv->ai_act_scan == 0 ) { /* all data sampled */ pcl818_ai_cancel(dev,s); s->async->events |= COMEDI_CB_EOA; - comedi_event(dev, s, s->async->events); + comedi_event(dev, s); //printk("done int ai13 dma\n"); return IRQ_HANDLED; } @@ -687,7 +687,7 @@ static irqreturn_t interrupt_pcl818_ai_mode13_dma_rtc(int irq, void *d) bufptr--; bufptr&=(devpriv->dmasamplsize-1); dmabuf[bufptr]=MAGIC_DMA_WORD; - comedi_event(dev, s, s->async->events); + comedi_event(dev, s); //outb(0,0x378); return IRQ_HANDLED; } @@ -715,7 +715,7 @@ static irqreturn_t interrupt_pcl818_ai_mode13_fifo(int irq, void *d) comedi_error(dev,"A/D mode1/3 FIFO overflow!"); pcl818_ai_cancel(dev,s); s->async->events |= COMEDI_CB_EOA | COMEDI_CB_ERROR; - comedi_event(dev, s, s->async->events); + comedi_event(dev, s); return IRQ_HANDLED; } @@ -723,7 +723,7 @@ static irqreturn_t interrupt_pcl818_ai_mode13_fifo(int irq, void *d) comedi_error(dev,"A/D mode1/3 FIFO interrupt without data!"); pcl818_ai_cancel(dev,s); s->async->events |= COMEDI_CB_EOA | COMEDI_CB_ERROR; - comedi_event(dev, s, s->async->events); + comedi_event(dev, s); return IRQ_HANDLED; } @@ -736,7 +736,7 @@ static irqreturn_t interrupt_pcl818_ai_mode13_fifo(int irq, void *d) 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); s->async->events |= COMEDI_CB_EOA | COMEDI_CB_ERROR; - comedi_event(dev, s, s->async->events); + comedi_event(dev, s); return IRQ_HANDLED; } @@ -750,12 +750,12 @@ static irqreturn_t interrupt_pcl818_ai_mode13_fifo(int irq, void *d) if ( devpriv->ai_act_scan == 0 ) { /* all data sampled */ pcl818_ai_cancel(dev,s); s->async->events |= COMEDI_CB_EOA; - comedi_event(dev, s, s->async->events); + comedi_event(dev, s); return IRQ_HANDLED; } } - if (len>0) comedi_event(dev, s, s->async->events); + if (len>0) comedi_event(dev, s); return IRQ_HANDLED; } diff --git a/comedi/drivers/pcmmio.c b/comedi/drivers/pcmmio.c index 58d42cd7..1c867d60 100644 --- a/comedi/drivers/pcmmio.c +++ b/comedi/drivers/pcmmio.c @@ -29,7 +29,7 @@ Status: works A driver for the relatively new PCM-MIO multifunction board from Winsystems. This board is a PC-104 based I/O board. It contains -four subdevices: +four subdevices: subdevice 0 - 16 channels of 16-bit AI subdevice 1 - 8 channels of 16-bit AO subdevice 2 - first 24 channels of the 48 channel of DIO (with edge-triggered interrupt support) @@ -37,12 +37,12 @@ four subdevices: Some notes: - Synchronous reads and writes are the only things implemented for AI and AO, + Synchronous reads and writes are the only things implemented for AI and AO, even though the hardware itself can do streaming acquisition, etc. Anyone want to add asynchronous I/O for AI/AO as a feature? Be my guest... - Asynchronous I/O for the DIO subdevices *is* implemented, however! They are - basically edge-triggered interrupts for any configuration of the first + Asynchronous I/O for the DIO subdevices *is* implemented, however! They are + basically edge-triggered interrupts for any configuration of the first 24 DIO-lines. Also note that this interrupt support is untested. @@ -50,24 +50,24 @@ four subdevices: A few words about edge-detection IRQ support (commands on DIO): * To use edge-detection IRQ support for the DIO subdevice, pass the IRQ - of the board to the comedi_config command. The board IRQ is not jumpered + of the board to the comedi_config command. The board IRQ is not jumpered but rather configured through software, so any IRQ from 1-15 is OK. - - * Due to the genericity of the comedi API, you need to create a special + + * Due to the genericity of the comedi API, you need to create a special comedi_command in order to use edge-triggered interrupts for DIO. - - * Use comedi_commands with TRIG_NOW. Your callback will be called each + + * Use comedi_commands with TRIG_NOW. Your callback will be called each time an edge is detected on the specified DIO line(s), and the data values will be two sample_t's, which should be concatenated to form one 32-bit unsigned int. This value is the mask of channels that had edges detected from your channel list. Note that the bits positions in the mask correspond to positions in your chanlist when you specified the command and *not* channel id's! - - * To set the polarity of the edge-detection interrupts pass a nonzero value - for either CR_RANGE or CR_AREF for edge-up polarity, or a zero + + * To set the polarity of the edge-detection interrupts pass a nonzero value + for either CR_RANGE or CR_AREF for edge-up polarity, or a zero value for both CR_RANGE and CR_AREF if you want edge-down polarity. - + Configuration Options: [0] - I/O port base address @@ -104,7 +104,7 @@ Configuration Options: -------------------------------------------------------------- REG_PORTx All R/W Read/Write/Configure IO REG_INT_PENDING All ReadOnly Quickly see which INT_IDx has int. - REG_PAGELOCK All WriteOnly Select a page + REG_PAGELOCK All WriteOnly Select a page REG_POLx Pg. 1 only WriteOnly Select edge-detection polarity REG_ENABx Pg. 2 only WriteOnly Enable/Disable edge-detect. int. REG_INT_IDx Pg. 3 only R/W See which ports/bits have ints. @@ -119,10 +119,10 @@ Configuration Options: #define REG_PAGELOCK 0x7 /* page selector register, upper 2 bits select a page and bits 0-5 are used to 'lock down' a particular port above to make it readonly. */ -#define REG_POL0 0x8 +#define REG_POL0 0x8 #define REG_POL1 0x9 #define REG_POL2 0xA -#define REG_ENAB0 0x8 +#define REG_ENAB0 0x8 #define REG_ENAB1 0x9 #define REG_ENAB2 0xA #define REG_INT_ID0 0x8 @@ -171,13 +171,13 @@ static const comedi_lrange ranges_ai = static const comedi_lrange ranges_ao = { 6, { RANGE(0.,5.), RANGE(0.,10.) , RANGE(-5.,5.), RANGE(-10.,10.), RANGE(-2.5, 2.5), RANGE(-2.5, 7.5) } }; -static const pcmmio_board pcmmio_boards[] = +static const pcmmio_board pcmmio_boards[] = { { name: "pcmmio", dio_num_asics: 1, dio_num_ports: 6, - total_iosize: 32, + total_iosize: 32, ai_bits: 16, ao_bits: 16, n_ai_chans: 16, @@ -196,23 +196,23 @@ static const pcmmio_board pcmmio_boards[] = #define thisboard ((const pcmmio_board *)dev->board_ptr) /* this structure is for data unique to this subdevice. */ -typedef struct +typedef struct { - + union { /* for DIO: mapping of halfwords (bytes) in port/chanarray to iobase */ unsigned long iobases[PORTS_PER_SUBDEV]; - + /* for AI/AO */ unsigned long iobase; }; union { struct { - + /* The below is only used for intr subdevices */ struct { int asic; /* if non-negative, this subdev has an interrupt asic */ - int first_chan; /* if nonnegative, the first channel id for + int first_chan; /* if nonnegative, the first channel id for interrupts. */ int num_asic_chans; /* the number of asic channels in this subdev that have interrutps */ @@ -236,9 +236,9 @@ typedef struct several hardware drivers keep similar information in this structure, feel free to suggest moving the variable to the comedi_device struct. */ typedef struct -{ +{ /* stuff for DIO */ - struct + struct { unsigned char pagelock; /* current page and lock*/ unsigned char pol [NUM_PAGED_REGS]; /* shadow of POLx registers */ @@ -247,7 +247,7 @@ typedef struct unsigned long iobase; unsigned int irq; spinlock_t spinlock; - } asics[MAX_ASICS]; + } asics[MAX_ASICS]; pcmmio_subdev_private *sprivs; } pcmmio_private; @@ -266,7 +266,7 @@ typedef struct static int pcmmio_attach(comedi_device *dev, comedi_devconfig *it); static int pcmmio_detach(comedi_device *dev); -static comedi_driver driver = +static comedi_driver driver = { driver_name: "pcmmio", module: THIS_MODULE, @@ -329,16 +329,16 @@ static int pcmmio_attach(comedi_device *dev, comedi_devconfig *it) irq[0] = it->options[1]; printk("comedi%d: %s: io: %lx ", dev->minor, driver.driver_name, iobase); - + dev->iobase = iobase; - - if ( !iobase || !request_region(iobase, - thisboard->total_iosize, + + if ( !iobase || !request_region(iobase, + thisboard->total_iosize, driver.driver_name) ) { printk("I/O port conflict\n"); return -EIO; } - + /* * Initialize dev->board_name. Note that we can use the "thisboard" * macro now, since we just initialized it in the last line. @@ -357,13 +357,13 @@ static int pcmmio_attach(comedi_device *dev, comedi_devconfig *it) for (asic = 0; asic < MAX_ASICS; ++asic) { devpriv->asics[asic].num = asic; devpriv->asics[asic].iobase = dev->iobase + 16 + asic*ASIC_IOSIZE; - devpriv->asics[asic].irq = 0; /* this gets actually set at the end of - this function when we + devpriv->asics[asic].irq = 0; /* this gets actually set at the end of + this function when we comedi_request_irqs */ spin_lock_init(&devpriv->asics[asic].spinlock); } - - chans_left = CHANS_PER_ASIC * thisboard->dio_num_asics; + + chans_left = CHANS_PER_ASIC * thisboard->dio_num_asics; n_dio_subdevs = CALC_N_DIO_SUBDEVS(chans_left); n_subdevs = n_dio_subdevs + 2; devpriv->sprivs = (pcmmio_subdev_private *)kmalloc(sizeof(pcmmio_subdev_private) * n_subdevs, GFP_KERNEL); @@ -384,7 +384,7 @@ static int pcmmio_attach(comedi_device *dev, comedi_devconfig *it) } memset(dev->subdevices, 0, sizeof(*dev->subdevices) * n_subdevs); - + /* First, AI */ sdev_no = 0; s = dev->subdevices + sdev_no; @@ -418,17 +418,17 @@ static int pcmmio_attach(comedi_device *dev, comedi_devconfig *it) outb(0, subpriv->iobase + 3); outb(0, subpriv->iobase+4 + 3); - ++sdev_no; + ++sdev_no; port = 0; - asic = 0; + asic = 0; for (; sdev_no < (int)dev->n_subdevices; ++sdev_no) - { + { int byte_no; s = dev->subdevices + sdev_no; s->private = devpriv->sprivs + sdev_no; s->maxdata = 1; - s->range_table = &range_digital; + s->range_table = &range_digital; s->subdev_flags = SDF_READABLE|SDF_WRITABLE; s->type = COMEDI_SUBD_DIO; s->insn_bits = pcmmio_dio_insn_bits; @@ -439,10 +439,10 @@ static int pcmmio_attach(comedi_device *dev, comedi_devconfig *it) subpriv->dio.intr.asic_chan = -1; subpriv->dio.intr.num_asic_chans = -1; subpriv->dio.intr.active = 0; - s->len_chanlist = 1; + s->len_chanlist = 1; - /* save the ioport address for each 'port' of 8 channels in the - subdevice */ + /* save the ioport address for each 'port' of 8 channels in the + subdevice */ for (byte_no = 0; byte_no < PORTS_PER_SUBDEV; ++byte_no, ++port) { if (port >= PORTS_PER_ASIC) { port = 0; @@ -463,7 +463,7 @@ static int pcmmio_attach(comedi_device *dev, comedi_devconfig *it) s->cancel = pcmmio_cancel; s->do_cmd = pcmmio_cmd; s->do_cmdtest = pcmmio_cmdtest; - s->len_chanlist = subpriv->dio.intr.num_asic_chans; + s->len_chanlist = subpriv->dio.intr.num_asic_chans; } thisasic_chanct += CHANS_PER_PORT; } @@ -475,7 +475,7 @@ static int pcmmio_attach(comedi_device *dev, comedi_devconfig *it) asic = 0; /* reset the asic to our first asic, to do intr subdevs */ port = 0; } - + } init_asics(dev); /* clear out all the registers, basically */ @@ -485,34 +485,34 @@ static int pcmmio_attach(comedi_device *dev, comedi_devconfig *it) int i; /* unroll the allocated irqs.. */ for (i = asic-1; i >= 0; --i) { - comedi_free_irq(irq[i], dev); + comedi_free_irq(irq[i], dev); devpriv->asics[i].irq = irq[i] = 0; } irq[asic] = 0; } devpriv->asics[asic].irq = irq[asic]; } - - dev->irq = irq[0]; /* grr.. wish comedi dev struct supported multiple + + dev->irq = irq[0]; /* grr.. wish comedi dev struct supported multiple irqs.. */ if (irq[0]) { printk("irq: %u ", irq[0]); - if (irq[1] && thisboard->dio_num_asics == 2) + if (irq[1] && thisboard->dio_num_asics == 2) printk("second ASIC irq: %u ", irq[1]); } else { printk("(IRQ mode disabled) "); } printk("attached\n"); - + return 1; } /* * _detach is called to deconfigure a device. It should deallocate - * resources. + * resources. * This function is also called when _attach() fails, so it should be * careful not to release resources that were not necessarily * allocated by _attach(). dev->private and dev->subdevices are @@ -527,10 +527,10 @@ static int pcmmio_detach(comedi_device *dev) release_region(dev->iobase, thisboard->total_iosize); for (i = 0; i < MAX_ASICS; ++i) { - if (devpriv && devpriv->asics[i].irq) + if (devpriv && devpriv->asics[i].irq) comedi_free_irq(devpriv->asics[i].irq, dev); } - + if (devpriv && devpriv->sprivs) kfree(devpriv->sprivs); @@ -550,9 +550,9 @@ static int pcmmio_dio_insn_bits(comedi_device *dev, comedi_subdevice *s, if (insn->n != 2) return -EINVAL; /* NOTE: - reading a 0 means this channel was high + reading a 0 means this channel was high writine a 0 sets the channel high - reading a 1 means this channel was low + reading a 1 means this channel was low writing a 1 means set this channel low Therefore everything is always inverted. */ @@ -569,13 +569,13 @@ static int pcmmio_dio_insn_bits(comedi_device *dev, comedi_subdevice *s, for (byte_no = 0; byte_no < s->n_chan/CHANS_PER_PORT; ++byte_no) { /* address of 8-bit port */ - unsigned long ioaddr = subpriv->iobases[byte_no], + unsigned long ioaddr = subpriv->iobases[byte_no], /* bit offset of port in 32-bit doubleword */ - offset = byte_no * 8; + offset = byte_no * 8; /* this 8-bit port's data */ - unsigned char byte = 0, + unsigned char byte = 0, /* The write mask for this port (if any) */ - write_mask_byte = (data[0] >> offset) & 0xff, + write_mask_byte = (data[0] >> offset) & 0xff, /* The data byte for this port */ data_byte = (data[1] >> offset) & 0xff; @@ -586,7 +586,7 @@ static int pcmmio_dio_insn_bits(comedi_device *dev, comedi_subdevice *s, printk("byte %d wmb %02x db %02x offset %02d io %04x, data_in %02x ", byte_no, (unsigned)write_mask_byte, (unsigned)data_byte, offset, ioaddr, (unsigned)byte); #endif - if ( write_mask_byte ) { + if ( write_mask_byte ) { /* this byte has some write_bits -- so set the output lines */ byte &= ~write_mask_byte; /* clear bits for write mask */ byte |= ~data_byte & write_mask_byte; /* set to inverted data_byte */ @@ -599,17 +599,17 @@ static int pcmmio_dio_insn_bits(comedi_device *dev, comedi_subdevice *s, printk("data_out_byte %02x\n", (unsigned)byte); #endif /* save the digital input lines for this byte.. */ - s->state |= ((unsigned int)byte) << offset; + s->state |= ((unsigned int)byte) << offset; } /* now return the DIO lines to data[1] - note they came inverted! */ - data[1] = ~s->state; + data[1] = ~s->state; #ifdef DAMMIT_ITS_BROKEN /* DEBUG */ printk("s->state %08x data_out %08x\n", s->state, data[1]); #endif - + return 2; } @@ -626,23 +626,23 @@ static int pcmmio_dio_insn_config(comedi_device *dev, comedi_subdevice *s, /* Compute ioaddr for this channel */ ioaddr = subpriv->iobases[byte_no]; - + /* NOTE: - writing a 0 an IO channel's bit sets the channel to INPUT + writing a 0 an IO channel's bit sets the channel to INPUT and pulls the line high as well - + writing a 1 to an IO channel's bit pulls the line low - All channels are implicitly always in OUTPUT mode -- but when + All channels are implicitly always in OUTPUT mode -- but when they are high they can be considered to be in INPUT mode.. - Thus, we only force channels low if the config request was INPUT, + Thus, we only force channels low if the config request was INPUT, otherwise we do nothing to the hardware. */ switch(data[0]) { case INSN_CONFIG_DIO_OUTPUT: - /* save to io_bits -- don't actually do anything since + /* save to io_bits -- don't actually do anything since all input channels are also output channels... */ s->io_bits |= 1<io_bits &= ~(1<n; + return insn->n; } -static void init_asics(comedi_device *dev) /* sets up an +static void init_asics(comedi_device *dev) /* sets up an ASIC chip to defaults */ { int asic; - + for (asic = 0; asic < thisboard->dio_num_asics; ++asic) { int port, page; @@ -688,7 +688,7 @@ static void init_asics(comedi_device *dev) /* sets up an switch_page(dev, asic, 0); /* switch back to page 0 */ /* first, clear all the DIO port bits */ - for (port = 0; port < PORTS_PER_ASIC; ++port) + for (port = 0; port < PORTS_PER_ASIC; ++port) outb(0, baseaddr + REG_PORT0 + port); /* Next, clear all the paged registers for each page */ @@ -709,7 +709,7 @@ static void init_asics(comedi_device *dev) /* sets up an /* END DEBUG */ switch_page(dev, asic, 0); /* switch back to default page 0 */ - + } } @@ -723,7 +723,7 @@ static void switch_page(comedi_device *dev, int asic, int page) devpriv->asics[asic].pagelock |= page<asics[asic].pagelock, + outb(devpriv->asics[asic].pagelock, devpriv->asics[asic].iobase + REG_PAGELOCK); } @@ -732,7 +732,7 @@ static void lock_port(comedi_device *dev, int asic, int port) if (asic < 0 || asic >= thisboard->dio_num_asics) return; /* paranoia */ if (port < 0 || port >= PORTS_PER_ASIC) return; /* more paranoia */ - devpriv->asics[asic].pagelock |= 0x1<asics[asic].pagelock |= 0x1<asics[asic].pagelock, devpriv->asics[asic].iobase + REG_PAGELOCK); return; @@ -743,7 +743,7 @@ static void unlock_port(comedi_device *dev, int asic, int port) { if (asic < 0 || asic >= thisboard->dio_num_asics) return; /* paranoia */ if (port < 0 || port >= PORTS_PER_ASIC) return; /* more paranoia */ - devpriv->asics[asic].pagelock &= ~(0x1<asics[asic].pagelock &= ~(0x1<asics[asic].pagelock, devpriv->asics[asic].iobase + REG_PAGELOCK); (void)unlock_port(dev, asic, port); /* not reached, suppress compiler warnings*/ @@ -753,10 +753,10 @@ static irqreturn_t interrupt_pcmmio(int irq, void *d PT_REGS_ARG) { int asic, got1 = 0; comedi_device *dev = (comedi_device *)d; - + for (asic = 0; asic < MAX_ASICS; ++asic) { if (irq == devpriv->asics[asic].irq) { - unsigned long flags; + unsigned long flags; unsigned triggered = 0; unsigned long iobase = devpriv->asics[asic].iobase; /* it is an interrupt for ASIC #asic */ @@ -773,8 +773,8 @@ static irqreturn_t interrupt_pcmmio(int irq, void *d PT_REGS_ARG) unsigned char io_lines_with_edges = 0; switch_page(dev, asic, PAGE_INT_ID); io_lines_with_edges = inb(iobase + REG_INT_ID0 + port); - - if (io_lines_with_edges) + + if (io_lines_with_edges) /* clear pending interrupt */ outb(0, iobase + REG_INT_ID0 + port); @@ -787,7 +787,7 @@ static irqreturn_t interrupt_pcmmio(int irq, void *d PT_REGS_ARG) comedi_spin_unlock_irqrestore(&devpriv->asics[asic].spinlock, flags); - if (triggered) { + if (triggered) { comedi_subdevice *s; /* TODO here: dispatch io lines to subdevs with commands.. */ printk("PCMMIO DEBUG: got edge detect interrupt %d asic %d which_chans: %06x\n", irq, asic, triggered); @@ -795,9 +795,9 @@ static irqreturn_t interrupt_pcmmio(int irq, void *d PT_REGS_ARG) if (subpriv->dio.intr.asic == asic) { /* this is an interrupt subdev, and it matches this asic! */ unsigned long flags; unsigned oldevents; - + comedi_spin_lock_irqsave(&subpriv->dio.intr.spinlock, flags); - + oldevents = s->async->events; if (subpriv->dio.intr.active) { @@ -805,7 +805,7 @@ static irqreturn_t interrupt_pcmmio(int irq, void *d PT_REGS_ARG) if (mytrig & subpriv->dio.intr.enabled_mask) { lsampl_t val = 0; unsigned int n, ch, len; - + len = s->async->cmd.chanlist_len; for (n = 0; n < len; n++) { ch = CR_CHAN(s->async->cmd.chanlist[n]); @@ -820,9 +820,9 @@ static irqreturn_t interrupt_pcmmio(int irq, void *d PT_REGS_ARG) } else { /* Overflow! Stop acquisition!! */ /* TODO: STOP_ACQUISITION_CALL_HERE!! */ - pcmmio_stop_intr(dev, s); + pcmmio_stop_intr(dev, s); } - + /* Check for end of acquisition. */ if (!subpriv->dio.intr.continuous) { /* stop_src == TRIG_COUNT */ @@ -831,7 +831,7 @@ static irqreturn_t interrupt_pcmmio(int irq, void *d PT_REGS_ARG) if (subpriv->dio.intr.stop_count == 0) { s->async->events |= COMEDI_CB_EOA; /* TODO: STOP_ACQUISITION_CALL_HERE!! */ - pcmmio_stop_intr(dev, s); + pcmmio_stop_intr(dev, s); } } } @@ -839,13 +839,13 @@ static irqreturn_t interrupt_pcmmio(int irq, void *d PT_REGS_ARG) } comedi_spin_unlock_irqrestore(&subpriv->dio.intr.spinlock, flags); - + if (oldevents != s->async->events) { - comedi_event(dev, s, s->async->events); + comedi_event(dev, s); } } - + } } @@ -859,9 +859,9 @@ static irqreturn_t interrupt_pcmmio(int irq, void *d PT_REGS_ARG) static void pcmmio_stop_intr(comedi_device *dev, comedi_subdevice *s) { int nports, firstport, asic, port; - + if ( (asic = subpriv->dio.intr.asic) < 0 ) return; /* not an interrupt subdev */ - + subpriv->dio.intr.enabled_mask = 0; subpriv->dio.intr.active = 0; s->async->inttrig = 0; @@ -884,9 +884,9 @@ static int pcmmio_start_intr(comedi_device *dev, comedi_subdevice *s) } else { unsigned bits = 0, pol_bits = 0, n; int nports, firstport, asic, port; - comedi_cmd *cmd = &s->async->cmd; - - if ( (asic = subpriv->dio.intr.asic) < 0 ) return 1; /* not an interrupt + comedi_cmd *cmd = &s->async->cmd; + + if ( (asic = subpriv->dio.intr.asic) < 0 ) return 1; /* not an interrupt subdev */ subpriv->dio.intr.enabled_mask = 0; subpriv->dio.intr.active = 1; @@ -895,7 +895,7 @@ static int pcmmio_start_intr(comedi_device *dev, comedi_subdevice *s) if (cmd->chanlist) { for (n = 0; n < cmd->chanlist_len; n++) { bits |= (1U << CR_CHAN(cmd->chanlist[n])); - pol_bits |= + pol_bits |= (CR_AREF(cmd->chanlist[n]) || CR_RANGE(cmd->chanlist[n]) ? 1U : 0U) << CR_CHAN(cmd->chanlist[n]); } @@ -908,14 +908,14 @@ static int pcmmio_start_intr(comedi_device *dev, comedi_subdevice *s) /* set resource enable register to enable IRQ operation */ outb(1<<4, dev->iobase+3); /* set bits 0-3 of b to the irq number from 0-15 */ - b = dev->irq & ((1<<4)-1); + b = dev->irq & ((1<<4)-1); outb(b, dev->iobase+2); /* done, we told the board what irq to use */ } switch_page(dev, asic, PAGE_ENAB); for (port = firstport; port < firstport+nports; ++port) { - unsigned enab = bits >> (subpriv->dio.intr.first_chan + (port-firstport)*8) & 0xff, + unsigned enab = bits >> (subpriv->dio.intr.first_chan + (port-firstport)*8) & 0xff, pol = pol_bits >> (subpriv->dio.intr.first_chan + (port-firstport)*8) & 0xff ; /* set enab intrs for this subdev.. */ outb(enab, devpriv->asics[asic].iobase + REG_ENAB0 + port); @@ -934,7 +934,7 @@ static int pcmmio_cancel(comedi_device *dev, comedi_subdevice *s) if (subpriv->dio.intr.active) pcmmio_stop_intr(dev, s); comedi_spin_unlock_irqrestore(&subpriv->dio.intr.spinlock, flags); - return 0; + return 0; } /* @@ -956,7 +956,7 @@ pcmmio_inttrig_start_intr(comedi_device *dev, comedi_subdevice *s, unsigned int comedi_spin_unlock_irqrestore(&subpriv->dio.intr.spinlock, flags); if (event) { - comedi_event(dev, s, s->async->events); + comedi_event(dev, s); } return 1; @@ -1002,7 +1002,7 @@ pcmmio_cmd(comedi_device *dev, comedi_subdevice *s) comedi_spin_unlock_irqrestore(&subpriv->dio.intr.spinlock, flags); if (event) { - comedi_event(dev, s, s->async->events); + comedi_event(dev, s); } return 0; @@ -1033,7 +1033,7 @@ pcmmio_cmdtest(comedi_device *dev, comedi_subdevice *s, if (!cmd->convert_src || tmp != cmd->convert_src) err++; tmp = cmd->scan_end_src; - cmd->scan_end_src &= TRIG_COUNT; + cmd->scan_end_src &= TRIG_COUNT; if (!cmd->scan_end_src || tmp != cmd->scan_end_src) err++; tmp = cmd->stop_src; @@ -1115,8 +1115,8 @@ static int ai_rinsn(comedi_device *dev, comedi_subdevice *s, comedi_insn *insn, { int n; unsigned long iobase = subpriv->iobase; - - /* + + /* 1. write the CMD byte (to BASE+2) 2. read junk lo byte (BASE+0) 3. read junk hi byte (BASE+1) @@ -1124,41 +1124,41 @@ static int ai_rinsn(comedi_device *dev, comedi_subdevice *s, comedi_insn *insn, 5. read valid lo byte(BASE+0) 6. read valid hi byte(BASE+1) - Additionally note that the BASE += 4 if the channel >= 8 + Additionally note that the BASE += 4 if the channel >= 8 */ - + /* convert n samples */ for(n = 0; n < insn->n; n++) { unsigned chan = CR_CHAN(insn->chanspec), range = CR_RANGE(insn->chanspec), aref = CR_AREF(insn->chanspec); unsigned char command_byte = 0; unsigned iooffset = 0; - sampl_t sample, adc_adjust = 0; - + sampl_t sample, adc_adjust = 0; + if (chan > 7) chan -= 8, iooffset = 4; /* use the second dword for channels > 7 */ - + if (aref != AREF_DIFF) { aref = AREF_GROUND; - command_byte |= 1<<7; /* set bit 7 to indicate single-ended */ + command_byte |= 1<<7; /* set bit 7 to indicate single-ended */ } if (range < 2) adc_adjust = 0x8000; /* bipolar ranges (-5,5 .. -10,10 need to be adjusted -- that is.. they need to wrap around by adding 0x8000 */ if (chan % 2) { command_byte |= 1<<6; /* odd-numbered channels have bit 6 set */ } - + /* select the channel, bits 4-5 == chan/2 */ command_byte |= ((chan/2) & 0x3)<<4; - + /* set the range, bits 2-3 */ command_byte |= (range & 0x3) << 2; /* need to do this twice to make sure mux settled */ outb(command_byte, iobase + iooffset + 2); /* chan/range/aref select */ - + adc_wait_ready(iobase + iooffset); /* wait for the adc to say it finised the conversion */ - + outb(command_byte, iobase + iooffset + 2); /* select the chan/range/aref AGAIN */ adc_wait_ready(iobase + iooffset); @@ -1188,16 +1188,16 @@ static int wait_dac_ready(unsigned long iobase) unsigned long retry = 100000L; /* This may seem like an absurd way to handle waiting and violates the - "no busy waiting" policy. The fact is that the hardware is - normally so fast that we usually only need one time through the loop - anyway. The longer timeout is for rare occasions and for detecting + "no busy waiting" policy. The fact is that the hardware is + normally so fast that we usually only need one time through the loop + anyway. The longer timeout is for rare occasions and for detecting non-existant hardware. */ - + while(retry--) { if (inb(iobase+3) & 0x80) return 0; - + } return 1; } @@ -1206,30 +1206,30 @@ static int ao_winsn(comedi_device *dev, comedi_subdevice *s, comedi_insn *insn, { int n; unsigned iobase = subpriv->iobase, iooffset = 0; - + for(n = 0; n < insn->n; n++) { unsigned chan = CR_CHAN(insn->chanspec), range = CR_RANGE(insn->chanspec); if (chan < s->n_chan) { unsigned char command_byte = 0, range_byte = range&((1<<4)-1); if (chan >= 4) chan -=4, iooffset += 4; /* set the range.. */ - outb(range_byte, iobase+iooffset+0); + outb(range_byte, iobase+iooffset+0); outb(0, iobase+iooffset+1); /* tell it to begin */ command_byte = (chan << 1) | 0x60; outb(command_byte, iobase+iooffset+2); - + wait_dac_ready(iobase+iooffset); outb(data[n] & 0xff, iobase+iooffset+0); /* low order byte */ outb((data[n]>>8) & 0xff, iobase+iooffset+1); /* high order byte */ command_byte = 0x70 | (chan<<1); /* set bit 4 of command byte to indicate data is loaded and trigger conversion */ /* trigger converion */ - outb(command_byte, iobase+iooffset+2); + outb(command_byte, iobase+iooffset+2); wait_dac_ready(iobase+iooffset); - + subpriv->ao.shadow_samples[chan] = data[n]; /* save to shadow register for ao_rinsn */ } } diff --git a/comedi/drivers/pcmuio.c b/comedi/drivers/pcmuio.c index d36e6b8b..f2472688 100644 --- a/comedi/drivers/pcmuio.c +++ b/comedi/drivers/pcmuio.c @@ -775,7 +775,7 @@ static irqreturn_t interrupt_pcmuio(int irq, void *d PT_REGS_ARG) comedi_spin_unlock_irqrestore(&subpriv->intr.spinlock, flags); if (oldevents != s->async->events) { - comedi_event(dev, s, s->async->events); + comedi_event(dev, s); } } @@ -880,7 +880,7 @@ pcmuio_inttrig_start_intr(comedi_device *dev, comedi_subdevice *s, unsigned int comedi_spin_unlock_irqrestore(&subpriv->intr.spinlock, flags); if (event) { - comedi_event(dev, s, s->async->events); + comedi_event(dev, s); } return 1; @@ -926,7 +926,7 @@ pcmuio_cmd(comedi_device *dev, comedi_subdevice *s) comedi_spin_unlock_irqrestore(&subpriv->intr.spinlock, flags); if (event) { - comedi_event(dev, s, s->async->events); + comedi_event(dev, s); } return 0; diff --git a/comedi/drivers/rtd520.c b/comedi/drivers/rtd520.c index 8e3eb037..393e506b 100644 --- a/comedi/drivers/rtd520.c +++ b/comedi/drivers/rtd520.c @@ -1541,7 +1541,7 @@ static irqreturn_t rtd_interrupt ( DPRINTK("rtd520: Samples Done (DMA).\n"); goto transferDone; } - comedi_event (dev, s, s->async->events); + comedi_event (dev, s); } else { /*DPRINTK ("rtd520: No DMA ready: istatus %x\n", istatus);*/ } @@ -1572,7 +1572,7 @@ static irqreturn_t rtd_interrupt ( (fifoStatus ^ 0x6666) & 0x7777); /* should be all 0s */ goto transferDone; } - comedi_event (dev, s, s->async->events); + comedi_event (dev, s); } else if (devpriv->transCount > 0) { /* read often */ /*DPRINTK("rtd520: Sample int, reading %d fifo_status 0x%x\n", devpriv->transCount, (fifoStatus ^ 0x6666) & 0x7777);*/ @@ -1587,7 +1587,7 @@ static irqreturn_t rtd_interrupt ( (fifoStatus ^ 0x6666) & 0x7777); goto transferDone; } - comedi_event (dev, s, s->async->events); + comedi_event (dev, s); } } else { /* wait for 1/2 FIFO (old)*/ DPRINTK("rtd520: Sample int. Wait for 1/2. fifo_status 0x%x\n", @@ -1644,7 +1644,7 @@ transferDone: } s->async->events |= COMEDI_CB_EOA;/* signal end to comedi */ - comedi_event (dev, s, s->async->events); + comedi_event (dev, s); /* clear the interrupt */ status = RtdInterruptStatus (dev); diff --git a/comedi/drivers/s626.c b/comedi/drivers/s626.c index 69e4ed9f..b52f8543 100644 --- a/comedi/drivers/s626.c +++ b/comedi/drivers/s626.c @@ -1026,7 +1026,7 @@ static irqreturn_t s626_irq_handler(int irq,void *d PT_REGS_ARG) // tell comedi that data is there DEBUG("s626_irq_handler: events %d\n",s->async->events); - comedi_event(dev, s, s->async->events); + comedi_event(dev, s); break; case IRQ_GPIO3: //check dio and conter interrupt diff --git a/comedi/drivers/usbdux.c b/comedi/drivers/usbdux.c index 19c7cfe7..c4888c59 100644 --- a/comedi/drivers/usbdux.c +++ b/comedi/drivers/usbdux.c @@ -452,8 +452,7 @@ static void usbduxsub_ai_IsocIrq(struct urb *urb PT_REGS_ARG) s->async->events |= COMEDI_CB_EOA; s->async->events |= COMEDI_CB_ERROR; comedi_event(this_usbduxsub->comedidev, - s, - s->async->events); + s); // stop the transfer w/o unlink usbdux_ai_stop(this_usbduxsub,0); } @@ -468,8 +467,7 @@ static void usbduxsub_ai_IsocIrq(struct urb *urb PT_REGS_ARG) s->async->events |= COMEDI_CB_EOA; s->async->events |= COMEDI_CB_ERROR; comedi_event(this_usbduxsub->comedidev, - s, - s->async->events); + s); // don't do an unlink here usbdux_ai_stop(this_usbduxsub,0); } @@ -500,8 +498,7 @@ static void usbduxsub_ai_IsocIrq(struct urb *urb PT_REGS_ARG) s->async->events |= COMEDI_CB_EOA; s->async->events |= COMEDI_CB_ERROR; comedi_event(this_usbduxsub->comedidev, - s, - s->async->events); + s); // don't do an unlink here usbdux_ai_stop(this_usbduxsub,0); return; @@ -527,8 +524,7 @@ static void usbduxsub_ai_IsocIrq(struct urb *urb PT_REGS_ARG) // say comedi that the acquistion is over s->async->events |= COMEDI_CB_EOA; comedi_event(this_usbduxsub->comedidev, - s, - s->async->events); + s); return; } } @@ -550,8 +546,7 @@ static void usbduxsub_ai_IsocIrq(struct urb *urb PT_REGS_ARG) } // tell comedi that data is there comedi_event(this_usbduxsub->comedidev, - s, - s->async->events); + s); } @@ -697,8 +692,7 @@ static void usbduxsub_ao_IsocIrq(struct urb *urb PT_REGS_ARG) { if (this_usbduxsub->ao_cmd_running) { s->async->events |= COMEDI_CB_EOA; comedi_event(this_usbduxsub->comedidev, - s, - s->async->events); + s); usbdux_ao_stop(this_usbduxsub,0); } return; @@ -711,8 +705,7 @@ static void usbduxsub_ao_IsocIrq(struct urb *urb PT_REGS_ARG) { s->async->events |= COMEDI_CB_ERROR; s->async->events |= COMEDI_CB_EOA; comedi_event(this_usbduxsub->comedidev, - s, - s->async->events); + s); // we do an unlink if we are in the high speed mode usbdux_ao_stop(this_usbduxsub,0); } @@ -740,8 +733,7 @@ static void usbduxsub_ao_IsocIrq(struct urb *urb PT_REGS_ARG) { 0); s->async->events |= COMEDI_CB_EOA; comedi_event(this_usbduxsub->comedidev, - s, - s->async->events); + s); // no resubmit of the urb return; } @@ -773,8 +765,7 @@ static void usbduxsub_ao_IsocIrq(struct urb *urb PT_REGS_ARG) { // transmit data to comedi s->async->events |= COMEDI_CB_BLOCK; comedi_event(this_usbduxsub->comedidev, - s, - s->async->events); + s); } } urb->transfer_buffer_length = SIZEOUTBUF; @@ -803,8 +794,7 @@ static void usbduxsub_ao_IsocIrq(struct urb *urb PT_REGS_ARG) { s->async->events |= COMEDI_CB_EOA; s->async->events |= COMEDI_CB_ERROR; comedi_event(this_usbduxsub->comedidev, - s, - s->async->events); + s); // don't do an unlink here usbdux_ao_stop(this_usbduxsub,0); } diff --git a/comedi/drivers/usbduxfast.c b/comedi/drivers/usbduxfast.c index cef25c8e..9e32b4c9 100644 --- a/comedi/drivers/usbduxfast.c +++ b/comedi/drivers/usbduxfast.c @@ -216,7 +216,7 @@ static int send_dux_commands(usbduxfastsub_t* this_usbduxfastsub,int cmd_type) { CHANNELLISTEP), this_usbduxfastsub->dux_commands, SIZEOFDUXBUFFER, - &nsent, + &nsent, 10000); if (result<0) { printk("comedi%d: could not transmit dux_commands to the usb-device, err=%d\n", @@ -275,7 +275,7 @@ static int usbduxfast_ai_stop(usbduxfastsub_t* this_usbduxfastsub, #endif - this_usbduxfastsub->ai_cmd_running=0; + this_usbduxfastsub->ai_cmd_running=0; if (do_unlink) { // stop aquistion @@ -313,7 +313,7 @@ static int usbduxfast_ai_cancel(comedi_device *dev, // unlink res=usbduxfast_ai_stop(this_usbduxfastsub,1); up(&this_usbduxfastsub->sem); - + return res; } @@ -384,9 +384,8 @@ static void usbduxfastsub_ai_Irq(struct urb *urb PT_REGS_ARG) // tell this comedi s->async->events |= COMEDI_CB_EOA; s->async->events |= COMEDI_CB_ERROR; - comedi_event(this_usbduxfastsub->comedidev, - s, - s->async->events); + comedi_event(this_usbduxfastsub->comedidev, + s); // stop the transfer w/o unlink usbduxfast_ai_stop(this_usbduxfastsub,0); return; @@ -397,9 +396,8 @@ static void usbduxfastsub_ai_Irq(struct urb *urb PT_REGS_ARG) urb->status); s->async->events |= COMEDI_CB_EOA; s->async->events |= COMEDI_CB_ERROR; - comedi_event(this_usbduxfastsub->comedidev, - s, - s->async->events); + comedi_event(this_usbduxfastsub->comedidev, + s); usbduxfast_ai_stop(this_usbduxfastsub,0); return; } @@ -418,23 +416,21 @@ static void usbduxfastsub_ai_Irq(struct urb *urb PT_REGS_ARG) 0); // say comedi that the acquistion is over s->async->events |= COMEDI_CB_EOA; - comedi_event(this_usbduxfastsub->comedidev, - s, - s->async->events); + comedi_event(this_usbduxfastsub->comedidev, + s); return; } this_usbduxfastsub->ai_sample_count-=n; } - + // write the full buffer to comedi cfc_write_array_to_buffer(s, urb->transfer_buffer, urb->actual_length); - + // tell comedi that data is there - comedi_event(this_usbduxfastsub->comedidev, - s, - s->async->events); + comedi_event(this_usbduxfastsub->comedidev, + s); } else { // ignore this packet @@ -451,9 +447,8 @@ static void usbduxfastsub_ai_Irq(struct urb *urb PT_REGS_ARG) err); s->async->events |= COMEDI_CB_EOA; s->async->events |= COMEDI_CB_ERROR; - comedi_event(this_usbduxfastsub->comedidev, - s, - s->async->events); + comedi_event(this_usbduxfastsub->comedidev, + s); usbduxfast_ai_stop(this_usbduxfastsub,0); } } @@ -468,17 +463,17 @@ static int usbduxfastsub_start(usbduxfastsub_t* usbduxfastsub) { if (usbduxfastsub->probed) { // 7f92 to zero - local_transfer_buffer[0]=0; + local_transfer_buffer[0]=0; errcode=USB_CONTROL_MSG (usbduxfastsub->usbdev, // create a pipe for a control transfer usb_sndctrlpipe(usbduxfastsub->usbdev,0), // bRequest, "Firmware" - USBDUXFASTSUB_FIRMWARE, + USBDUXFASTSUB_FIRMWARE, // bmRequestType - VENDOR_DIR_OUT, + VENDOR_DIR_OUT, // Value - USBDUXFASTSUB_CPUCS, + USBDUXFASTSUB_CPUCS, // Index 0x0000, // address of the transfer buffer @@ -486,7 +481,7 @@ static int usbduxfastsub_start(usbduxfastsub_t* usbduxfastsub) { // Length 1, // Timeout - EZTIMEOUT + EZTIMEOUT ); if (errcode<0) { printk("comedi_: usbduxfast_: control msg failed (start)\n"); @@ -505,23 +500,23 @@ static int usbduxfastsub_stop(usbduxfastsub_t* usbduxfastsub) { unsigned char local_transfer_buffer[16]; if (usbduxfastsub->probed) { // 7f92 to one - local_transfer_buffer[0]=1; + local_transfer_buffer[0]=1; errcode=USB_CONTROL_MSG (usbduxfastsub->usbdev, usb_sndctrlpipe(usbduxfastsub->usbdev,0), // bRequest, "Firmware" - USBDUXFASTSUB_FIRMWARE, + USBDUXFASTSUB_FIRMWARE, // bmRequestType VENDOR_DIR_OUT, // Value USBDUXFASTSUB_CPUCS, // Index - 0x0000, + 0x0000, local_transfer_buffer, // Length 1, // Timeout - EZTIMEOUT + EZTIMEOUT ); if (errcode<0) { printk("comedi_: usbduxfast: control msg failed (stop)\n"); @@ -530,7 +525,7 @@ static int usbduxfastsub_stop(usbduxfastsub_t* usbduxfastsub) { } return 0; } - + @@ -585,7 +580,7 @@ return 0; -int firmwareUpload(usbduxfastsub_t* usbduxfastsub, +int firmwareUpload(usbduxfastsub_t* usbduxfastsub, unsigned char* firmwareBinary, int sizeFirmware) { int ret; @@ -616,7 +611,7 @@ int firmwareUpload(usbduxfastsub_t* usbduxfastsub, } return 0; } - + int usbduxfastsub_submit_InURBs(usbduxfastsub_t* usbduxfastsub) { @@ -653,8 +648,8 @@ int usbduxfastsub_submit_InURBs(usbduxfastsub_t* usbduxfastsub) { -static int usbduxfast_ai_cmdtest(comedi_device *dev, - comedi_subdevice *s, +static int usbduxfast_ai_cmdtest(comedi_device *dev, + comedi_subdevice *s, comedi_cmd *cmd) { int err=0, stop_mask=0; @@ -909,7 +904,7 @@ static int usbduxfast_ai_cmd(comedi_device *dev, comedi_subdevice *s) } steps=0; if(cmd->scan_begin_src == TRIG_TIMER) { - printk("comedi%d: usbduxfast: scan_begin_src==TRIG_TIMER not valid.\n", + printk("comedi%d: usbduxfast: scan_begin_src==TRIG_TIMER not valid.\n", dev->minor); up(&this_usbduxfastsub->sem); return -EINVAL; @@ -918,8 +913,8 @@ static int usbduxfast_ai_cmd(comedi_device *dev, comedi_subdevice *s) steps=(cmd->convert_arg*30)/1000; } if ((stepschanlist_len!=1)) { - printk("comedi%d: usbduxfast: ai_cmd: steps=%ld, scan_begin_arg=%d. Not properly tested by cmdtest?\n", - dev->minor, + printk("comedi%d: usbduxfast: ai_cmd: steps=%ld, scan_begin_arg=%d. Not properly tested by cmdtest?\n", + dev->minor, steps, cmd->scan_begin_arg); up(&this_usbduxfastsub->sem); @@ -963,7 +958,7 @@ static int usbduxfast_ai_cmd(comedi_device *dev, comedi_subdevice *s) this_usbduxfastsub->dux_commands[OPBASE+0]=0; this_usbduxfastsub->dux_commands[OUTBASE+0]=0xFF & rngmask; this_usbduxfastsub->dux_commands[LOGBASE+0]=0; - } + } if (stepsdux_commands[LENBASE+1]=steps/2; this_usbduxfastsub->dux_commands[OPBASE+1]=0; this_usbduxfastsub->dux_commands[OUTBASE+1]=0xFF & rngmask; this_usbduxfastsub->dux_commands[LOGBASE+1]=0; - + // and the second part this_usbduxfastsub->dux_commands[LENBASE+2]=steps-steps/2; this_usbduxfastsub->dux_commands[OPBASE+2]=0; this_usbduxfastsub->dux_commands[OUTBASE+2]=0xFF & rngmask; this_usbduxfastsub->dux_commands[LOGBASE+2]=0; - + // get the data and branch back this_usbduxfastsub->dux_commands[LENBASE+3]=0x09; // branch back to state 1 this_usbduxfastsub->dux_commands[OPBASE+3]=0x03; // deceision state w data @@ -1037,7 +1032,7 @@ static int usbduxfast_ai_cmd(comedi_device *dev, comedi_subdevice *s) this_usbduxfastsub->dux_commands[OPBASE+2]=0; this_usbduxfastsub->dux_commands[OUTBASE+2]=0xFF & rngmask; this_usbduxfastsub->dux_commands[LOGBASE+2]=0; - + this_usbduxfastsub->dux_commands[LENBASE+3]=1; this_usbduxfastsub->dux_commands[OPBASE+3]=0x02; // data this_usbduxfastsub->dux_commands[OUTBASE+3]=0xFF & rngmask; @@ -1058,7 +1053,7 @@ static int usbduxfast_ai_cmd(comedi_device *dev, comedi_subdevice *s) this_usbduxfastsub->dux_commands[OPBASE+5]=0; this_usbduxfastsub->dux_commands[OUTBASE+5]=0xFF & rngmask; this_usbduxfastsub->dux_commands[LOGBASE+5]=0; - + this_usbduxfastsub->dux_commands[LENBASE+6]=1; this_usbduxfastsub->dux_commands[OPBASE+6]=0; this_usbduxfastsub->dux_commands[OUTBASE+6]=0xFF & rngmask; @@ -1082,7 +1077,7 @@ static int usbduxfast_ai_cmd(comedi_device *dev, comedi_subdevice *s) this_usbduxfastsub->dux_commands[OUTBASE+j*2+1]=0xFE & rngmask; //count this_usbduxfastsub->dux_commands[LOGBASE+j*2+1]=0; } - + // 2 steps with duration 1: the idele step and step 6: steps_tmp=steps-2; // commit data to the FIFO and do the first part of the delay @@ -1090,7 +1085,7 @@ static int usbduxfast_ai_cmd(comedi_device *dev, comedi_subdevice *s) this_usbduxfastsub->dux_commands[OPBASE+4]=0x02; // data this_usbduxfastsub->dux_commands[OUTBASE+4]=0xFF & rngmask; // no change this_usbduxfastsub->dux_commands[LOGBASE+4]=0; - + if (CR_RANGE(cmd->chanlist[0])>0) rngmask=0xff-0x04; else rngmask=0xff; // do the second part of the delay this_usbduxfastsub->dux_commands[LENBASE+5]=steps_tmp-steps_tmp/2; @@ -1102,7 +1097,7 @@ static int usbduxfast_ai_cmd(comedi_device *dev, comedi_subdevice *s) this_usbduxfastsub->dux_commands[OPBASE+6]=0; this_usbduxfastsub->dux_commands[OUTBASE+6]=0xFF & rngmask; this_usbduxfastsub->dux_commands[LOGBASE+6]=0; - + case 16: if (CR_RANGE(cmd->chanlist[0])>0) rngmask=0xff-0x04; else rngmask=0xff; if(cmd->start_src == TRIG_EXT) { // we loop here until ready has been set @@ -1115,7 +1110,7 @@ static int usbduxfast_ai_cmd(comedi_device *dev, comedi_subdevice *s) this_usbduxfastsub->dux_commands[OPBASE+0]=0; this_usbduxfastsub->dux_commands[OUTBASE+0]=(0xFF-0x02) & rngmask; // reset this_usbduxfastsub->dux_commands[LOGBASE+0]=0; - } + } // commit data to the FIFO this_usbduxfastsub->dux_commands[LENBASE+1]=1; @@ -1151,7 +1146,7 @@ static int usbduxfast_ai_cmd(comedi_device *dev, comedi_subdevice *s) up(&this_usbduxfastsub->sem); return -EFAULT; } - + #ifdef CONFIG_COMEDI_DEBUG printk("comedi %d: sending commands to the usb device\n", @@ -1173,7 +1168,7 @@ static int usbduxfast_ai_cmd(comedi_device *dev, comedi_subdevice *s) up(&this_usbduxfastsub->sem); return -EFAULT; } - this_usbduxfastsub->ai_continous=0; + this_usbduxfastsub->ai_continous=0; } else { // continous aquisition this_usbduxfastsub->ai_continous=1; @@ -1250,28 +1245,28 @@ static int usbduxfast_ai_insn_read(comedi_device * dev, usbduxfastsub->dux_commands[OPBASE+0]=0x02; // data usbduxfastsub->dux_commands[OUTBASE+0]=0xFF & rngmask; usbduxfastsub->dux_commands[LOGBASE+0]=0; - + // do the first part of the delay usbduxfastsub->dux_commands[LENBASE+1]=12; usbduxfastsub->dux_commands[OPBASE+1]=0; usbduxfastsub->dux_commands[OUTBASE+1]=0xFE & rngmask; usbduxfastsub->dux_commands[LOGBASE+1]=0; - + usbduxfastsub->dux_commands[LENBASE+2]=1; usbduxfastsub->dux_commands[OPBASE+2]=0; usbduxfastsub->dux_commands[OUTBASE+2]=0xFE & rngmask; usbduxfastsub->dux_commands[LOGBASE+2]=0; - + usbduxfastsub->dux_commands[LENBASE+3]=1; usbduxfastsub->dux_commands[OPBASE+3]=0; usbduxfastsub->dux_commands[OUTBASE+3]=0xFE & rngmask; usbduxfastsub->dux_commands[LOGBASE+3]=0; - + usbduxfastsub->dux_commands[LENBASE+4]=1; usbduxfastsub->dux_commands[OPBASE+4]=0; usbduxfastsub->dux_commands[OUTBASE+4]=0xFE & rngmask; usbduxfastsub->dux_commands[LOGBASE+4]=0; - + // second part usbduxfastsub->dux_commands[LENBASE+5]=12; usbduxfastsub->dux_commands[OPBASE+5]=0; @@ -1303,7 +1298,7 @@ static int usbduxfast_ai_insn_read(comedi_device * dev, (int)(usbduxfastsub->urbIn->dev)); #endif for(i=0;iusbdev, + err=USB_BULK_MSG(usbduxfastsub->usbdev, usb_rcvbulkpipe(usbduxfastsub->usbdev,BULKINEP), usbduxfastsub->transfer_buffer, SIZEINBUF, @@ -1318,7 +1313,7 @@ static int usbduxfast_ai_insn_read(comedi_device * dev, } // data points for(i=0;in;) { - err=USB_BULK_MSG(usbduxfastsub->usbdev, + err=USB_BULK_MSG(usbduxfastsub->usbdev, usb_rcvbulkpipe(usbduxfastsub->usbdev,BULKINEP), usbduxfastsub->transfer_buffer, SIZEINBUF, @@ -1336,7 +1331,7 @@ static int usbduxfast_ai_insn_read(comedi_device * dev, dev->minor); up(&usbduxfastsub->sem); return -EINVAL; - } + } for(j=chan;(jn);j=j+16) { data[i]=((uint16_t*)(usbduxfastsub->transfer_buffer))[j]; i++; @@ -1382,7 +1377,7 @@ static int read_firmware(usbduxfastsub_t* usbduxfastsub, void *firmwarePtr,long ); return -ENOMEM; } - + for (;;) { char buf[256],*cp; char type; @@ -1431,7 +1426,7 @@ static int read_firmware(usbduxfastsub_t* usbduxfastsub, void *firmwarePtr,long printk("comedi_: usbduxfast: firmware upload goes beyond FX2 RAM boundaries."); return -EFAULT; } - + //printk("comedi_: usbduxfast: off=%x, len=%x:",off,len); /* Read the record type */ @@ -1522,11 +1517,11 @@ static void tidy_up(usbduxfastsub_t* usbduxfastsub_tmp) { // allocate memory for the urbs and initialise them #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) -static void* usbduxfastsub_probe(struct usb_device *udev, +static void* usbduxfastsub_probe(struct usb_device *udev, unsigned int interfnum, const struct usb_device_id *id) { #else -static int usbduxfastsub_probe(struct usb_interface *uinterf, +static int usbduxfastsub_probe(struct usb_interface *uinterf, const struct usb_device_id *id) { struct usb_device *udev = interface_to_usbdev(uinterf); #endif @@ -1618,7 +1613,7 @@ static int usbduxfastsub_probe(struct usb_interface *uinterf, tidy_up(&(usbduxfastsub[index])); up(&start_stop_sem); return PROBE_ERR_RETURN( -ENOMEM); - } + } usbduxfastsub[index].transfer_buffer= kmalloc(SIZEINBUF,GFP_KERNEL); if (!(usbduxfastsub[index].transfer_buffer)) { @@ -1629,7 +1624,7 @@ static int usbduxfastsub_probe(struct usb_interface *uinterf, } // we've reached the bottom of the function usbduxfastsub[index].probed=1; - up(&start_stop_sem); + up(&start_stop_sem); printk("comedi_: usbduxfast%d has been successfully initialized.\n",index); #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) return (void*)(&usbduxfastsub[index]); @@ -1655,7 +1650,7 @@ static void usbduxfastsub_disconnect(struct usb_interface *intf) { if (!usbduxfastsub_tmp) { printk("comedi_: usbduxfast: disconnect called with null pointer.\n"); return; - } + } if (usbduxfastsub_tmp->usbdev!=udev) { printk("comedi_: usbduxfast: BUG! called with wrong ptr!!!\n"); return; @@ -1706,15 +1701,15 @@ static int usbduxfast_attach(comedi_device * dev, comedi_devconfig * it) usbduxfastsub[index].comedidev=dev; // trying to upload the firmware into the chip - if(comedi_aux_data(it->options, 0) && + if(comedi_aux_data(it->options, 0) && it->options[COMEDI_DEVCONF_AUX_DATA_LENGTH]){ read_firmware(usbduxfastsub, comedi_aux_data(it->options, 0), it->options[COMEDI_DEVCONF_AUX_DATA_LENGTH]); - } + } dev->board_name = BOARDNAME; - + /* set number of subdevices */ dev->n_subdevices=N_SUBDEVICES; @@ -1901,7 +1896,7 @@ static void exit_usbduxfast(void) { module_init(init_usbduxfast); -module_exit(exit_usbduxfast); +module_exit(exit_usbduxfast); MODULE_AUTHOR( DRIVER_AUTHOR ); MODULE_DESCRIPTION( DRIVER_DESC ); diff --git a/include/linux/comedidev.h b/include/linux/comedidev.h index 718debe6..a85266bb 100644 --- a/include/linux/comedidev.h +++ b/include/linux/comedidev.h @@ -268,7 +268,7 @@ static const int comedi_debug = 0; * function prototypes */ -void comedi_event(comedi_device *dev,comedi_subdevice *s,unsigned int mask); +void comedi_event(comedi_device *dev, comedi_subdevice *s); void comedi_error(const comedi_device *dev,const char *s); /* we can expand the number of bits used to encode devices/subdevices into