From 30233475a1c80b315e35122ff4baa1dba2030559 Mon Sep 17 00:00:00 2001 From: Frank Mori Hess Date: Sat, 28 Jan 2006 15:31:54 +0000 Subject: [PATCH] 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. --- comedi/drivers/amplc_pci230.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) 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; -- 2.26.2