From: Frank Mori Hess Date: Sat, 28 Jan 2006 15:31:54 +0000 (+0000) Subject: Patch from abbotti@mev.co.uk (Ian Abbott): X-Git-Tag: r0_7_71~67 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=30233475a1c80b315e35122ff4baa1dba2030559;p=comedi.git Patch from abbotti@mev.co.uk (Ian Abbott): Micheal Head reported problems with the PCI230 generating interrupts constantly in his system. Looking at the source code, that could happen if the AI interrupt handler (pci230_handle_ai) detects a FIFO overrun error. In that case, it ends up turning the ADC interrupt source back on in the board's INT_SCE by mistake after cancelling the transfer, resulting in continuous unhandled interrupts. I have a patch to fix the above and initialize the INT_SCE register before hooking up the interrupt with request_irq. --- diff --git a/comedi/drivers/amplc_pci230.c b/comedi/drivers/amplc_pci230.c index b9ac90f8..e6dc47f5 100644 --- a/comedi/drivers/amplc_pci230.c +++ b/comedi/drivers/amplc_pci230.c @@ -388,6 +388,9 @@ static int pci230_attach(comedi_device *dev,comedi_devconfig *it) */ dev->board_name = thisboard->name; + /* Disable board's interrupts. */ + outb(0, devpriv->pci_iobase + PCI230_INT_SCE); + /* Register the interrupt handler. */ irq_hdl = comedi_request_irq(devpriv->pci_dev->irq, pci230_interrupt, SA_SHIRQ, "amplc_pci230", dev); if(irq_hdl<0) { @@ -397,7 +400,7 @@ static int pci230_attach(comedi_device *dev,comedi_devconfig *it) dev->irq = devpriv->pci_dev->irq; printk("comedi%d: amplc_pci230: registered irq %d\n", dev->minor, devpriv->pci_dev->irq); } - + /* * Allocate the subdevice structures. alloc_subdevice() is a * convenient macro defined in comedidev.h. @@ -1504,13 +1507,11 @@ static void pci230_handle_ai(comedi_device *dev, comedi_subdevice *s) { /* Cancel sampled conversion. */ s->async->events |= COMEDI_CB_ERROR | COMEDI_CB_EOA; pci230_ai_cancel(dev, s); - } - if(devpriv->ai_count == 0 && devpriv->ai_stop == 0) { + }else if(devpriv->ai_count == 0 && devpriv->ai_stop == 0) { /* Acquisition complete. */ s->async->events |= COMEDI_CB_EOA; pci230_ai_cancel(dev, s); /* disable hardware conversions */ - } - else { + }else { /* More samples required, tell Comedi to block. */ s->async->events |= COMEDI_CB_BLOCK;