.i_NbrTTLChannel = 24,
.b_AvailableConvertUnit = 6,
.ui_MinAcquisitiontimeNs = 10000,
- .interrupt = v_APCI3XXX_Interrupt,
.ai_config = i_APCI3XXX_InsnConfigAnalogInput,
.ai_read = i_APCI3XXX_InsnReadAnalogInput,
.ttl_config = i_APCI3XXX_InsnConfigInitTTLIO,
.i_NbrTTLChannel = 24,
.b_AvailableConvertUnit = 6,
.ui_MinAcquisitiontimeNs = 10000,
- .interrupt = v_APCI3XXX_Interrupt,
.ai_config = i_APCI3XXX_InsnConfigAnalogInput,
.ai_read = i_APCI3XXX_InsnReadAnalogInput,
.ttl_config = i_APCI3XXX_InsnConfigInitTTLIO,
.i_NbrTTLChannel = 24,
.b_AvailableConvertUnit = 6,
.ui_MinAcquisitiontimeNs = 10000,
- .interrupt = v_APCI3XXX_Interrupt,
.ai_config = i_APCI3XXX_InsnConfigAnalogInput,
.ai_read = i_APCI3XXX_InsnReadAnalogInput,
.ttl_config = i_APCI3XXX_InsnConfigInitTTLIO,
.i_NbrTTLChannel = 24,
.b_AvailableConvertUnit = 6,
.ui_MinAcquisitiontimeNs = 10000,
- .interrupt = v_APCI3XXX_Interrupt,
.ai_config = i_APCI3XXX_InsnConfigAnalogInput,
.ai_read = i_APCI3XXX_InsnReadAnalogInput,
.ttl_config = i_APCI3XXX_InsnConfigInitTTLIO,
.i_NbrTTLChannel = 24,
.b_AvailableConvertUnit = 6,
.ui_MinAcquisitiontimeNs = 10000,
- .interrupt = v_APCI3XXX_Interrupt,
.ai_config = i_APCI3XXX_InsnConfigAnalogInput,
.ai_read = i_APCI3XXX_InsnReadAnalogInput,
.ttl_config = i_APCI3XXX_InsnConfigInitTTLIO,
.i_NbrTTLChannel = 24,
.b_AvailableConvertUnit = 6,
.ui_MinAcquisitiontimeNs = 10000,
- .interrupt = v_APCI3XXX_Interrupt,
.ai_config = i_APCI3XXX_InsnConfigAnalogInput,
.ai_read = i_APCI3XXX_InsnReadAnalogInput,
.ttl_config = i_APCI3XXX_InsnConfigInitTTLIO,
.i_NbrTTLChannel = 24,
.b_AvailableConvertUnit = 6,
.ui_MinAcquisitiontimeNs = 5000,
- .interrupt = v_APCI3XXX_Interrupt,
.ai_config = i_APCI3XXX_InsnConfigAnalogInput,
.ai_read = i_APCI3XXX_InsnReadAnalogInput,
.ttl_config = i_APCI3XXX_InsnConfigInitTTLIO,
.i_NbrTTLChannel = 24,
.b_AvailableConvertUnit = 6,
.ui_MinAcquisitiontimeNs = 5000,
- .interrupt = v_APCI3XXX_Interrupt,
.ai_config = i_APCI3XXX_InsnConfigAnalogInput,
.ai_read = i_APCI3XXX_InsnReadAnalogInput,
.ttl_config = i_APCI3XXX_InsnConfigInitTTLIO,
.i_NbrTTLChannel = 24,
.b_AvailableConvertUnit = 6,
.ui_MinAcquisitiontimeNs = 5000,
- .interrupt = v_APCI3XXX_Interrupt,
.ai_config = i_APCI3XXX_InsnConfigAnalogInput,
.ai_read = i_APCI3XXX_InsnReadAnalogInput,
.ttl_config = i_APCI3XXX_InsnConfigInitTTLIO,
.i_NbrTTLChannel = 24,
.b_AvailableConvertUnit = 6,
.ui_MinAcquisitiontimeNs = 5000,
- .interrupt = v_APCI3XXX_Interrupt,
.ai_config = i_APCI3XXX_InsnConfigAnalogInput,
.ai_read = i_APCI3XXX_InsnReadAnalogInput,
.ttl_config = i_APCI3XXX_InsnConfigInitTTLIO,
.i_NbrTTLChannel = 24,
.b_AvailableConvertUnit = 6,
.ui_MinAcquisitiontimeNs = 5000,
- .interrupt = v_APCI3XXX_Interrupt,
.ai_config = i_APCI3XXX_InsnConfigAnalogInput,
.ai_read = i_APCI3XXX_InsnReadAnalogInput,
.ttl_config = i_APCI3XXX_InsnConfigInitTTLIO,
.i_NbrTTLChannel = 24,
.b_AvailableConvertUnit = 6,
.ui_MinAcquisitiontimeNs = 5000,
- .interrupt = v_APCI3XXX_Interrupt,
.ai_config = i_APCI3XXX_InsnConfigAnalogInput,
.ai_read = i_APCI3XXX_InsnReadAnalogInput,
.ttl_config = i_APCI3XXX_InsnConfigInitTTLIO,
.i_NbrTTLChannel = 24,
.b_AvailableConvertUnit = 6,
.ui_MinAcquisitiontimeNs = 10000,
- .interrupt = v_APCI3XXX_Interrupt,
.ai_config = i_APCI3XXX_InsnConfigAnalogInput,
.ai_read = i_APCI3XXX_InsnReadAnalogInput,
.ao_write = i_APCI3XXX_InsnWriteAnalogOutput,
.i_NbrTTLChannel = 24,
.b_AvailableConvertUnit = 6,
.ui_MinAcquisitiontimeNs = 10000,
- .interrupt = v_APCI3XXX_Interrupt,
.ai_config = i_APCI3XXX_InsnConfigAnalogInput,
.ai_read = i_APCI3XXX_InsnReadAnalogInput,
.ao_write = i_APCI3XXX_InsnWriteAnalogOutput,
.i_NbrTTLChannel = 24,
.b_AvailableConvertUnit = 6,
.ui_MinAcquisitiontimeNs = 10000,
- .interrupt = v_APCI3XXX_Interrupt,
.ai_config = i_APCI3XXX_InsnConfigAnalogInput,
.ai_read = i_APCI3XXX_InsnReadAnalogInput,
.ao_write = i_APCI3XXX_InsnWriteAnalogOutput,
.i_NbrTTLChannel = 24,
.b_AvailableConvertUnit = 6,
.ui_MinAcquisitiontimeNs = 10000,
- .interrupt = v_APCI3XXX_Interrupt,
.ai_config = i_APCI3XXX_InsnConfigAnalogInput,
.ai_read = i_APCI3XXX_InsnReadAnalogInput,
.ao_write = i_APCI3XXX_InsnWriteAnalogOutput,
.i_NbrTTLChannel = 24,
.b_AvailableConvertUnit = 6,
.ui_MinAcquisitiontimeNs = 5000,
- .interrupt = v_APCI3XXX_Interrupt,
.ai_config = i_APCI3XXX_InsnConfigAnalogInput,
.ai_read = i_APCI3XXX_InsnReadAnalogInput,
.ao_write = i_APCI3XXX_InsnWriteAnalogOutput,
.i_NbrTTLChannel = 24,
.b_AvailableConvertUnit = 6,
.ui_MinAcquisitiontimeNs = 5000,
- .interrupt = v_APCI3XXX_Interrupt,
.ai_config = i_APCI3XXX_InsnConfigAnalogInput,
.ai_read = i_APCI3XXX_InsnReadAnalogInput,
.ao_write = i_APCI3XXX_InsnWriteAnalogOutput,
.i_NbrTTLChannel = 24,
.b_AvailableConvertUnit = 6,
.ui_MinAcquisitiontimeNs = 5000,
- .interrupt = v_APCI3XXX_Interrupt,
.ai_config = i_APCI3XXX_InsnConfigAnalogInput,
.ai_read = i_APCI3XXX_InsnReadAnalogInput,
.ao_write = i_APCI3XXX_InsnWriteAnalogOutput,
.i_NbrTTLChannel = 24,
.b_AvailableConvertUnit = 6,
.ui_MinAcquisitiontimeNs = 5000,
- .interrupt = v_APCI3XXX_Interrupt,
.ai_config = i_APCI3XXX_InsnConfigAnalogInput,
.ai_read = i_APCI3XXX_InsnReadAnalogInput,
.ao_write = i_APCI3XXX_InsnWriteAnalogOutput,
.i_DoMaxdata = 1,
.b_AvailableConvertUnit = 7,
.ui_MinAcquisitiontimeNs = 2500,
- .interrupt = v_APCI3XXX_Interrupt,
.ai_config = i_APCI3XXX_InsnConfigAnalogInput,
.ai_read = i_APCI3XXX_InsnReadAnalogInput,
},
.i_DoMaxdata = 1,
.b_AvailableConvertUnit = 6,
.ui_MinAcquisitiontimeNs = 5000,
- .interrupt = v_APCI3XXX_Interrupt,
.ai_config = i_APCI3XXX_InsnConfigAnalogInput,
.ai_read = i_APCI3XXX_InsnReadAnalogInput,
},
.i_DoMaxdata = 1,
.b_AvailableConvertUnit = 6,
.ui_MinAcquisitiontimeNs = 5000,
- .interrupt = v_APCI3XXX_Interrupt,
.ai_config = i_APCI3XXX_InsnConfigAnalogInput,
.ai_read = i_APCI3XXX_InsnReadAnalogInput,
},
.i_DoMaxdata = 1,
.b_AvailableConvertUnit = 6,
.ui_MinAcquisitiontimeNs = 5000,
- .interrupt = v_APCI3XXX_Interrupt,
.ai_config = i_APCI3XXX_InsnConfigAnalogInput,
.ai_read = i_APCI3XXX_InsnReadAnalogInput,
},
.i_AoMaxdata = 4095,
.pr_AoRangelist = &range_apci3XXX_ao,
.i_NbrTTLChannel = 24,
- .interrupt = v_APCI3XXX_Interrupt,
.ao_write = i_APCI3XXX_InsnWriteAnalogOutput,
.ttl_config = i_APCI3XXX_InsnConfigInitTTLIO,
.ttl_bits = i_APCI3XXX_InsnBitsTTLIO,
},
};
+static irqreturn_t apci3xxx_irq_handler(int irq, void *d)
+{
+ struct comedi_device *dev = d;
+ struct addi_private *devpriv = dev->private;
+ unsigned int status;
+ int i;
+
+ /* Test if interrupt occur */
+ status = readl(devpriv->dw_AiBase + 16);
+ if ((status & 0x2) == 0x2) {
+ /* Reset the interrupt */
+ writel(status, devpriv->dw_AiBase + 16);
+
+ /* Test if interrupt enabled */
+ if (devpriv->b_EocEosInterrupt == 1) {
+ /* Read all analog inputs value */
+ for (i = 0; i < devpriv->ui_AiNbrofChannels; i++) {
+ unsigned int val;
+
+ val = readl(devpriv->dw_AiBase + 28);
+ devpriv->ui_AiReadData[i] = val;
+ }
+
+ /* Set the interrupt flag */
+ devpriv->b_EocEosInterrupt = 2;
+
+ /* Send a signal to from kernel to user space */
+ send_sig(SIGIO, devpriv->tsk_Current, 0);
+ }
+ }
+ return IRQ_RETVAL(1);
+}
+
static int apci3xxx_di_insn_bits(struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_insn *insn,
return insn->n;
}
-static irqreturn_t v_ADDI_Interrupt(int irq, void *d)
-{
- struct comedi_device *dev = d;
- const struct addi_board *this_board = comedi_board(dev);
-
- this_board->interrupt(irq, d);
- return IRQ_RETVAL(1);
-}
-
static int apci3xxx_reset(struct comedi_device *dev)
{
struct addi_private *devpriv = dev->private;
/* ## */
if (pcidev->irq > 0) {
- ret = request_irq(pcidev->irq, v_ADDI_Interrupt, IRQF_SHARED,
- dev->board_name, dev);
+ ret = request_irq(pcidev->irq, apci3xxx_irq_handler,
+ IRQF_SHARED, dev->board_name, dev);
if (ret == 0)
dev->irq = pcidev->irq;
}