#undef INTERRUPT_DEBUG
-static void pci9111_interrupt (int irq,
+static irqreturn_t pci9111_interrupt (int irq,
void *p_device,
struct pt_regs *regs)
{
unsigned long irq_flags;
int i, data;
int resolution = ((pci9111_board_struct *) dev->board_ptr)->ai_resolution;
+ int retval = IRQ_HANDLED;
async = subdevice->async;
comedi_spin_lock_irqsave (&dev->spinlock, irq_flags);
-
+
if ((inb(dev_private->lcr_io_base+PLX9050_REGISTER_INTERRUPT_CONTROL) &
PLX9050_LINTI1_STATUS) != 0)
- {
+ {
// Interrupt comes from fifo_half-full signal
-
+
if (pci9111_is_fifo_full())
{
comedi_spin_unlock_irqrestore (&dev->spinlock, irq_flags);
async->events |= COMEDI_CB_ERROR | COMEDI_CB_EOA;
comedi_event (dev, subdevice, async->events);
- return;
+ return IRQ_RETVAL(retval);
}
-
+
if (pci9111_is_fifo_half_full())
{
#ifdef INTERRUPT_DEBUG
printk (PCI9111_DRIVER_NAME ": fifo is half full\n");
#endif
async->events |= COMEDI_CB_BLOCK;
-
+
for (i=0;i<PCI9111_FIFO_HALF_SIZE;i++)
{
// FIXME: The resolution test should be done outside of the read loop
-
+
if (resolution == PCI9111_HR_AI_RESOLUTION) {
data = pci9111_hr_ai_get_data ();
}
async->events |= COMEDI_CB_EOA;
pci9111_ai_cancel (dev, subdevice);
}
-
+
// Very important, otherwise another interrupt request will be inserted
// and will cause driver hangs on processing interrupt event (and cause a
- // computer crash, and corrupt the source file of the driver you are
- // working on, since you forgot to do a sync before test, and you cry,
+ // computer crash, and corrupt the source file of the driver you are
+ // working on, since you forgot to do a sync before test, and you cry,
// and ...)
-
+
pci9111_interrupt_clear();
comedi_spin_unlock_irqrestore (&dev->spinlock, irq_flags);
comedi_event (dev, subdevice, async->events);
+
+ return IRQ_RETVAL(retval);
}
-
+
// ------------------------------------------------------------------
//
// INSTANT ANALOG INPUT OUTPUT SECTION
/*
==============================================================================
*/
-static void interrupt_pci9118_ai_mode4_switch(comedi_device *dev)
+static void interrupt_pci9118_ai_mode4_switch(comedi_device *dev)
{
devpriv->AdFunctionReg=AdFunction_PDTrg|AdFunction_PETrg|AdFunction_AM;
outl(devpriv->AdFunctionReg,dev->iobase+PCI9118_ADFUNC);
outl((devpriv->dmabuf_hw[1-devpriv->dma_actbuf]>>9)&0xff, dev->iobase + PCI9118_CNT0);
devpriv->AdFunctionReg|=AdFunction_Start;
outl(devpriv->AdFunctionReg,dev->iobase+PCI9118_ADFUNC);
-
}
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);
if (devpriv->ai_do==4)
- interrupt_pci9118_ai_mode4_switch(dev);
+ interrupt_pci9118_ai_mode4_switch(dev);
}
comedi_event(dev,s,s->async->events);
/*
==============================================================================
*/
-static void interrupt_pci9118(int irq, void *d, struct pt_regs *regs)
+static irqreturn_t interrupt_pci9118(int irq, void *d, struct pt_regs *regs)
{
comedi_device *dev = d;
unsigned int int_daq=0,int_amcc,int_adstat;
-
+
int_daq=inl(dev->iobase+PCI9118_INTSRC) & 0xf; // get IRQ reasons from card
int_amcc=inl(devpriv->iobase_a+AMCC_OP_REG_INTCSR); // get INT register from AMCC chip
// DPRINTK("INT daq=0x%01x amcc=0x%08x MWAR=0x%08x MWTC=0x%08x ADSTAT=0x%02x ai_do=%d\n", int_daq, int_amcc, inl(devpriv->iobase_a+AMCC_OP_REG_MWAR), inl(devpriv->iobase_a+AMCC_OP_REG_MWTC), inw(dev->iobase+PCI9118_ADSTAT)&0x1ff,devpriv->ai_do);
if ((!int_daq)&&(!(int_amcc&ANY_S593X_INT)))
- return; // interrupt from other source
+ return IRQ_NONE; // interrupt from other source
outl(int_amcc|0x00ff0000, devpriv->iobase_a+AMCC_OP_REG_INTCSR); // shutdown IRQ reasons in AMCC
int_adstat=inw(dev->iobase+PCI9118_ADSTAT)&0x1ff; // get STATUS register
if (devpriv->ai_do) {
- if (devpriv->ai12_startstop)
+ if (devpriv->ai12_startstop)
if ((int_adstat&AdStatus_DTH)&&(int_daq&Int_DTrg)) { // start stop of measure
if (devpriv->ai12_startstop&START_AI_EXT) {
devpriv->ai12_startstop&=~START_AI_EXT;
(devpriv->int_ai_func)(dev,dev->subdevices + 0,int_adstat,int_amcc,int_daq);
}
+ return IRQ_HANDLED;
}
/*
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,s->async->events);
}
-/*
+/*
==============================================================================
*/
-static void interrupt_service_pci1710(int irq, void *d, struct pt_regs *regs)
+static irqreturn_t interrupt_service_pci1710(int irq, void *d, struct pt_regs *regs)
{
- comedi_device *dev = d;
-
+ comedi_device *dev = d;
+ int retval = IRQ_HANDLED;
+
DPRINTK("adv_pci1710 EDBG: BGN: interrupt_service_pci1710(%d,...)\n",irq);
if (!(inw(dev->iobase + PCI171x_STATUS) & Status_IRQ)) // is this interrupt from our board?
- return; // no, exit
+ return IRQ_NONE; // no, exit
DPRINTK("adv_pci1710 EDBG: interrupt_service_pci1710() ST: %4x\n",inw(dev->iobase + PCI171x_STATUS));
outw(devpriv->CntrlReg, dev->iobase+PCI171x_CONTROL);
// start pacer
start_pacer(dev, 1, devpriv->ai_et_div1, devpriv->ai_et_div2);
- return;
+ return IRQ_RETVAL(retval);
}
if (devpriv->ai_eos) { // We use FIFO half full INT or not?
interrupt_pci1710_every_sample(d);
interrupt_pci1710_half_fifo(d);
}
DPRINTK("adv_pci1710 EDBG: END: interrupt_service_pci1710(...)\n");
+ return IRQ_RETVAL(retval);
}
-/*
+/*
==============================================================================
*/
-static int pci171x_ai_docmd_and_mode(int mode, comedi_device * dev, comedi_subdevice * s)
+static int pci171x_ai_docmd_and_mode(int mode, comedi_device * dev, comedi_subdevice * s)
{
unsigned int divisor1, divisor2;
unsigned int seglen;
comedi_cmd *cmd);
static int pc236_intr_cmd(comedi_device *dev,comedi_subdevice *s);
static int pc236_intr_cancel(comedi_device *dev,comedi_subdevice *s);
-static void pc236_interrupt(int irq,void *d,struct pt_regs *regs);
+static irqreturn_t pc236_interrupt(int irq,void *d,struct pt_regs *regs);
/*
* Attach is called by the Comedi core to configure the driver
* Interrupt service routine.
* Based on the comedi_parport driver.
*/
-static void pc236_interrupt(int irq,void *d,struct pt_regs *regs)
+static irqreturn_t pc236_interrupt(int irq,void *d,struct pt_regs *regs)
{
comedi_device *dev=d;
comedi_subdevice *s=dev->subdevices+1;
+ int retval = IRQ_HANDLED;
- if(!pc236_intr_check(dev))
- return;
+ if(!pc236_intr_check(dev))
+ return IRQ_RETVAL(retval);
comedi_buf_put(s->async,0);
s->async->events |= COMEDI_CB_EOS;
-
+
comedi_event(dev,s,s->async->events);
+ return IRQ_RETVAL(retval);
}
static void pci230_cancel_ct0(comedi_device *dev);
static void pci230_cancel_ct1(comedi_device *dev);
static void pci230_cancel_ct2(comedi_device *dev);
-static void pci230_interrupt(int irq, void *d, struct pt_regs *regs);
+static irqreturn_t pci230_interrupt(int irq, void *d, struct pt_regs *regs);
static int pci230_ao_cmdtest(comedi_device *dev,comedi_subdevice *s, comedi_cmd *cmd);
static int pci230_ao_cmd(comedi_device *dev, comedi_subdevice *s);
static int pci230_ao_cancel(comedi_device *dev, comedi_subdevice *s);
}
/* Interrupt handler */
-static void pci230_interrupt(int irq, void *d, struct pt_regs *regs)
+static irqreturn_t pci230_interrupt(int irq, void *d, struct pt_regs *regs)
{
int status_int;
comedi_device *dev = (comedi_device*) d;
comedi_subdevice *s;
+ int retval = IRQ_HANDLED;
/* Read interrupt status/enable register. */
status_int = inb(devpriv->pci_iobase + PCI230_INT_SCE);
s->async->events = 0;
}
- return;
+ return IRQ_RETVAL(retval);
}
static void pci230_handle_ao(comedi_device *dev, comedi_subdevice *s) {
}};
-static void das16cs_interrupt(int irq, void *d, struct pt_regs *regs);
+static irqreturn_t das16cs_interrupt(int irq, void *d, struct pt_regs *regs);
static int das16cs_ai_rinsn(comedi_device *dev,comedi_subdevice *s,
comedi_insn *insn,lsampl_t *data);
static int das16cs_ai_cmd(comedi_device *dev,comedi_subdevice *s);
}
-static void das16cs_interrupt(int irq, void *d, struct pt_regs *regs)
+static irqreturn_t das16cs_interrupt(int irq, void *d, struct pt_regs *regs)
{
//comedi_device *dev = d;
-
+ return IRQ_HANDLED;
}
/*
/*====================================================================*/
-static void cs_error(client_handle_t handle, int func, int ret)
+static void my_cs_error(client_handle_t handle, int func, int ret)
{
error_info_t err = { func, ret };
CardServices(ReportError, handle, &err);
client_reg.event_callback_args.client_data = link;
ret = CardServices(RegisterClient, &link->handle, &client_reg);
if (ret != CS_SUCCESS) {
- cs_error(link->handle, RegisterClient, ret);
+ my_cs_error(link->handle, RegisterClient, ret);
das16cs_pcmcia_detach(link);
return NULL;
}
return;
cs_failed:
- cs_error(link->handle, last_fn, last_ret);
+ my_cs_error(link->handle, last_fn, last_ret);
das16cs_pcmcia_release((u_long)link);
} /* das16cs_pcmcia_config */
static int cb_pcidas_ao_inttrig(comedi_device *dev, comedi_subdevice *subdev, unsigned int trig_num);
static int cb_pcidas_ao_cmdtest(comedi_device *dev,comedi_subdevice *s,
comedi_cmd *cmd);
-static void cb_pcidas_interrupt(int irq, void *d, struct pt_regs *regs);
+static irqreturn_t cb_pcidas_interrupt(int irq, void *d, struct pt_regs *regs);
static void handle_ao_interrupt(comedi_device *dev, unsigned int status);
static int cb_pcidas_cancel(comedi_device *dev, comedi_subdevice *s);
static int cb_pcidas_ao_cancel(comedi_device *dev, comedi_subdevice *s);
return 0;
}
-static void cb_pcidas_interrupt(int irq, void *d, struct pt_regs *regs)
+static irqreturn_t cb_pcidas_interrupt(int irq, void *d, struct pt_regs *regs)
{
comedi_device *dev = (comedi_device*) d;
comedi_subdevice *s = dev->read_subdev;
unsigned int num_samples, i;
static const int timeout = 10000;
unsigned long flags;
-
+ int retval = IRQ_HANDLED;
+
if(dev->attached == 0)
{
comedi_error(dev, "premature interrupt");
#endif
if( ( INTCSR_INTR_ASSERTED & s5933_status ) == 0 )
- return;
+ return IRQ_NONE;
// make sure mailbox 4 is empty
inl_p(devpriv->s5933_config + AMCC_OP_REG_IMB4);
comedi_event(dev, s, async->events);
- return;
+ return IRQ_RETVAL(retval);
}
static void handle_ao_interrupt(comedi_device *dev, unsigned int status)
//static int ao_cmd(comedi_device *dev,comedi_subdevice *s);
//static int ao_inttrig(comedi_device *dev, comedi_subdevice *subdev, unsigned int trig_num);
//static int ao_cmdtest(comedi_device *dev,comedi_subdevice *s, comedi_cmd *cmd);
-static void handle_interrupt(int irq, void *d, struct pt_regs *regs);
+static irqreturn_t handle_interrupt(int irq, void *d, struct pt_regs *regs);
static int ai_cancel(comedi_device *dev, comedi_subdevice *s);
//static int ao_cancel(comedi_device *dev, comedi_subdevice *s);
static int dio_callback(int dir, int port, int data, unsigned long arg);
// XXX check for buffer overrun somehow
}
-static void handle_interrupt(int irq, void *d, struct pt_regs *regs)
+static irqreturn_t handle_interrupt(int irq, void *d, struct pt_regs *regs)
{
comedi_device *dev = d;
comedi_subdevice *s = dev->read_subdev;
uint32_t plx_bits;
uint8_t dma0_status, dma1_status;
unsigned long flags;
+ int retval = IRQ_HANDLED;
plx_status = readl(priv(dev)->plx9080_iobase + PLX_INTRCS_REG);
status = readw(priv(dev)->main_iobase + HW_STATUS_REG);
DEBUG_PRINT("exiting handler\n");
- return;
+ return IRQ_RETVAL( retval );
}
void abort_dma(comedi_device *dev, unsigned int channel)
printk("comedi%d: daqboard2000:", dev->minor);
- if(!pci_present()) {
- printk(" PCI bus not present!\n");
- result = -EIO;
- goto out;
- }
-
/* FIXME: we should handle multiple cards, have to make David decide
how, so we will be consistent among all PCI card drivers... */
card = pci_find_device(0x1616, 0x0409, NULL);
static int das16_cancel(comedi_device *dev, comedi_subdevice *s);
static void das16_reset(comedi_device *dev);
-static void das16_dma_interrupt(int irq, void *d, struct pt_regs *regs);
+static irqreturn_t das16_dma_interrupt(int irq, void *d, struct pt_regs *regs);
static void das16_timer_interrupt(unsigned long arg);
static void das16_interrupt(comedi_device *dev);
}
-static void das16_dma_interrupt(int irq, void *d, struct pt_regs *regs)
+static irqreturn_t das16_dma_interrupt(int irq, void *d, struct pt_regs *regs)
{
int status;
comedi_device *dev = d;
if((status & DAS16_INT ) == 0)
{
DEBUG_PRINT( "spurious interrupt\n" );
- return;
+ return IRQ_NONE;
}
/* clear interrupt */
outb(0x00, dev->iobase + DAS16_STATUS);
das16_interrupt(dev);
+ return IRQ_HANDLED;
}
static void das16_timer_interrupt(unsigned long arg)
static int das16m1_cancel(comedi_device *dev, comedi_subdevice *s);
static int das16m1_poll(comedi_device *dev, comedi_subdevice *s);
-static void das16m1_interrupt(int irq, void *d, struct pt_regs *regs);
+static irqreturn_t das16m1_interrupt(int irq, void *d, struct pt_regs *regs);
static void das16m1_handler(comedi_device *dev, unsigned int status);
static unsigned int das16m1_set_pacer(comedi_device *dev, unsigned int ns, int round_flag);
return s->async->buf_write_count - s->async->buf_read_count;
}
-static void das16m1_interrupt(int irq, void *d, struct pt_regs *regs)
+static irqreturn_t das16m1_interrupt(int irq, void *d, struct pt_regs *regs)
{
int status;
comedi_device *dev = d;
if(dev->attached == 0)
{
comedi_error(dev, "premature interrupt");
- return;
+ return IRQ_HANDLED;
}
// prevent race with comedi_poll()
{
comedi_error(dev, "spurious interrupt");
spin_unlock(&dev->spinlock);
- return;
+ return IRQ_NONE;
}
das16m1_handler(dev, status);
outb(0, dev->iobase + DAS16M1_CLEAR_INTR);
spin_unlock(&dev->spinlock);
+ return IRQ_HANDLED;
}
static void munge_sample_array( sampl_t *array, unsigned int num_elements )
static int das1800_detach(comedi_device *dev);
static int das1800_probe(comedi_device *dev);
static int das1800_cancel(comedi_device *dev, comedi_subdevice *s);
-static void das1800_interrupt(int irq, void *d, struct pt_regs *regs);
+static irqreturn_t das1800_interrupt(int irq, void *d, struct pt_regs *regs);
static int das1800_ai_poll(comedi_device *dev,comedi_subdevice *s);
static void das1800_ai_handler(comedi_device *dev);
static void das1800_handle_dma(comedi_device *dev, comedi_subdevice *s, unsigned int status);
return s->async->buf_write_count - s->async->buf_read_count;
}
-static void das1800_interrupt(int irq, void *d, struct pt_regs *regs)
+static irqreturn_t das1800_interrupt(int irq, void *d, struct pt_regs *regs)
{
comedi_device *dev = d;
unsigned int status;
if(dev->attached == 0)
{
comedi_error(dev, "premature interrupt");
- return;
+ return IRQ_HANDLED;
}
/* Prevent race with das1800_ai_poll() on multi processor systems.
if(!(status & INT))
{
spin_unlock(&dev->spinlock);
- return;
+ return IRQ_NONE;
}
/* clear the interrupt status bit INT*/
outb(CLEAR_INTR_MASK & ~INT, dev->iobase + DAS1800_STATUS);
das1800_ai_handler(dev);
spin_unlock(&dev->spinlock);
+ return IRQ_HANDLED;
}
// the guts of the interrupt handler, that is shared with das1800_ai_poll
outb_p(p,dev->iobase+14);
}
-static void intr_handler(int irq,void *d,struct pt_regs *regs)
+static irqreturn_t intr_handler(int irq,void *d,struct pt_regs *regs)
{
comedi_device *dev=d;
comedi_subdevice *s=dev->subdevices;
if (devpriv->das6402_ignoreirq){
printk("das6402: BUG: spurious interrupt\n");
- return;
+ return IRQ_HANDLED;
}
#ifdef DEBUG
outb(0x01,dev->iobase+8); /* clear only the interrupt flip-flop */
comedi_event(dev,s,s->async->events);
+ return IRQ_HANDLED;
}
#if 0
offset: sizeof(das800_board),
};
-static void das800_interrupt(int irq, void *d, struct pt_regs *regs);
+static irqreturn_t das800_interrupt(int irq, void *d, struct pt_regs *regs);
static void enable_das800(comedi_device *dev);
static void disable_das800(comedi_device *dev);
static int das800_ai_do_cmdtest(comedi_device *dev,comedi_subdevice *s,comedi_cmd *cmd);
COMEDI_INITCLEANUP(driver_das800);
/* interrupt service routine */
-static void das800_interrupt(int irq, void *d, struct pt_regs *regs)
+static irqreturn_t das800_interrupt(int irq, void *d, struct pt_regs *regs)
{
short i; /* loop index */
sampl_t dataPoint = 0;
status = inb(dev->iobase + DAS800_STATUS);
/* if interrupt was not generated by board or driver not attached, quit */
- if(!(status & IRQ) || !(dev->attached))
- {
- return;
- }
+ if(!(status & IRQ) )
+ return IRQ_NONE;
+ if(!(dev->attached))
+ return IRQ_HANDLED;
/* wait until here to initialize async, since we will get null dereference
* if interrupt occurs before driver is fully attached!
if(status == 0)
{
comedi_spin_unlock_irqrestore(&dev->spinlock, irq_flags);
- return;
+ return IRQ_HANDLED;
}
/* loop while card's fifo is not empty (and limit to half fifo for cio-das802/16) */
async->events |= COMEDI_CB_ERROR | COMEDI_CB_EOA;
comedi_event(dev, s, async->events);
async->events = 0;
- return;
+ return IRQ_HANDLED;
}
if(devpriv->count > 0 || devpriv->forever == 1)
{
comedi_spin_unlock_irqrestore(&dev->spinlock, irq_flags);
comedi_event(dev, s, async->events);
async->events = 0;
- return;
+ return IRQ_HANDLED;
}
static int das800_attach(comedi_device *dev, comedi_devconfig *it)
};
COMEDI_INITCLEANUP(driver_dt2814);
-static void dt2814_interrupt(int irq,void *dev,struct pt_regs * regs);
+static irqreturn_t dt2814_interrupt(int irq,void *dev,struct pt_regs * regs);
typedef struct{
int ntrig;
}
-static void dt2814_interrupt(int irq,void *d,struct pt_regs * regs)
+static irqreturn_t dt2814_interrupt(int irq,void *d,struct pt_regs * regs)
{
- int lo,hi;
- comedi_device *dev=d;
+ int lo,hi;
+ comedi_device *dev=d;
comedi_subdevice *s = dev->subdevices + 0;
int data;
- hi=inb(dev->iobase+DT2814_DATA);
- lo=inb(dev->iobase+DT2814_DATA);
+ hi=inb(dev->iobase+DT2814_DATA);
+ lo=inb(dev->iobase+DT2814_DATA);
- data=(hi<<4)|(lo>>4);
+ data=(hi<<4)|(lo>>4);
if(!(--devpriv->ntrig)){
- int flags,i;
+ int i;
outb(0,dev->iobase+DT2814_CSR);
/* note: turning off timed mode triggers another
sample. */
- save_flags(flags);
- cli(); /* FIXME */
for(i=0;i<DT2814_TIMEOUT;i++){
if(inb(dev->iobase+DT2814_CSR)&DT2814_FINISH)
break;
}
inb(dev->iobase+DT2814_DATA);
inb(dev->iobase+DT2814_DATA);
- restore_flags(flags);
-
+
s->async->events |= COMEDI_CB_EOA;
}
comedi_event(dev,s,s->async->events);
+ return IRQ_HANDLED;
}
return n;
}
-static void dt282x_interrupt(int irq, void *d, struct pt_regs *regs)
+static irqreturn_t dt282x_interrupt(int irq, void *d, struct pt_regs *regs)
{
comedi_device *dev = d;
comedi_subdevice *s = dev->subdevices+0;
comedi_error(dev, "A/D error");
dt282x_ai_cancel(dev,s);
s->async->events |= COMEDI_CB_ERROR;
- comedi_event(dev,s,s->async->events);
- return;
+ comedi_event(dev,s,s->async->events);
+ return IRQ_HANDLED;
}
supcsr = inw(dev->iobase + DT2821_SUPCSR);
/*printk("supcsr=%02x\n",supcsr);*/
dt282x_ai_dma_interrupt(dev);
else
dt282x_ao_dma_interrupt(dev);
- return;
+ return IRQ_HANDLED;
}
if ((dacsr = inw(dev->iobase + DT2821_DACSR)) & DT2821_DAERR) {
#if 0
comedi_error(dev, "D/A error");
dt282x_ao_cancel(dev,s_ao);
s->async->events |= COMEDI_CB_ERROR;
- comedi_event(dev,s_ao,s->async->events);
- return;
+ comedi_event(dev,s_ao,s->async->events);
+ return IRQ_HANDLED;
}
if (adcsr & DT2821_ADDONE) {
data = (sampl_t) inw(dev->iobase + DT2821_ADDAT);
update_supcsr(DT2821_STRIG);
}
- comedi_event(dev,s,s->async->events);
- return;
+ comedi_event(dev,s,s->async->events);
+ return IRQ_HANDLED;
}
+ return IRQ_HANDLED;
}
*/
static int dt282x_attach(comedi_device * dev, comedi_devconfig * it)
{
- int i, irqs, irq;
- long flags;
+ int i, irq;
int ret;
comedi_subdevice *s;
int iobase;
/* should do board test */
irq = it->options[opt_irq];
+#if 0
if (irq < 0) {
+ unsigned long flags;
+ int irqs;
+
save_flags(flags);
sti();
irqs = probe_irq_on();
printk(" error probing irq (bad)");
}
}
- dev->irq = 0;
+#endif
if (irq > 0) {
printk(" ( irq = %d )", irq);
ret = comedi_request_irq(irq, dt282x_interrupt, 0, "dt282x", dev);
static int debug_n_ints = 0;
-static void dt3k_interrupt(int irq, void *d, struct pt_regs *regs)
+static irqreturn_t dt3k_interrupt(int irq, void *d, struct pt_regs *regs)
{
comedi_device *dev = d;
comedi_subdevice *s = dev->subdevices + 0;
}
comedi_event(dev,s,s->async->events);
+ return IRQ_HANDLED;
}
#ifdef DEBUG
static int hpdi_cmd( comedi_device *dev, comedi_subdevice *s );
static int hpdi_cmd_test( comedi_device *dev, comedi_subdevice *s, comedi_cmd *cmd );
static int hpdi_cancel( comedi_device *dev, comedi_subdevice *s );
-static void handle_interrupt(int irq, void *d, struct pt_regs *regs);
+static irqreturn_t handle_interrupt(int irq, void *d, struct pt_regs *regs);
static int dio_config_block_size( comedi_device *dev, lsampl_t *data );
#undef HPDI_DEBUG // disable debugging messages
// XXX check for buffer overrun somehow
}
-static void handle_interrupt(int irq, void *d, struct pt_regs *regs)
+static irqreturn_t handle_interrupt(int irq, void *d, struct pt_regs *regs)
{
comedi_device *dev = d;
comedi_subdevice *s = dev->read_subdev;
writel( hpdi_intr_status, priv(dev)->hpdi_iobase + INTERRUPT_STATUS_REG );
}else if( ( plx_status & ( ICS_DMA0_A | ICS_DMA1_A | ICS_LIA ) ) == 0 )
{
- return;
+ return IRQ_NONE;
}
// spin lock makes sure noone else changes plx dma control reg
cfc_handle_events( dev, s );
- return;
+ return IRQ_HANDLED;
}
void abort_dma( comedi_device *dev, unsigned int channel )
static int hpdi_cancel( comedi_device *dev, comedi_subdevice *s )
{
hpdi_writel( dev, 0, BOARD_CONTROL_REG );
-
+
writel( 0, priv(dev)->hpdi_iobase + INTERRUPT_CONTROL_REG );
abort_dma(dev, 0);
void *d Pointer to current device
struct pt_regs *regs Pointer to
- Returns:int Nmuber of instructions executed
-
==============================================================================
*/
-static void interrupt_service_icp_multi(int irq, void *d, struct pt_regs *regs)
+static irqreturn_t interrupt_service_icp_multi(int irq, void *d, struct pt_regs *regs)
{
comedi_device *dev = d;
int int_no;
-
+
#ifdef ICP_MULTI_EXTDEBUG
printk("icp multi EDBG: BGN: interrupt_service_icp_multi(%d,...)\n",irq);
#endif
// Is this interrupt from our board?
int_no = readw(dev->iobase + ICP_MULTI_INT_STAT) & Status_IRQ;
- if (!int_no)
+ if (!int_no)
// No, exit
- return;
+ return IRQ_NONE;
#ifdef ICP_MULTI_EXTDEBUG
printk("icp multi EDBG: interrupt_service_icp_multi() ST: %4x\n",readw(dev->iobase + ICP_MULTI_INT_STAT));
#ifdef ICP_MULTI_EXTDEBUG
printk("icp multi EDBG: END: interrupt_service_icp_multi(...)\n");
#endif
+ return IRQ_HANDLED;
}
==============================================================================
Name: check_channel_list
-
+
Description:
This function checks if the channel list, provided by user
is built correctly
return 2;
}
-static void ni6527_interrupt(int irq, void *d, struct pt_regs *regs)
+static irqreturn_t ni6527_interrupt(int irq, void *d, struct pt_regs *regs)
{
comedi_device *dev = d;
comedi_subdevice *s = dev->subdevices + 2;
unsigned int status;
status = readb(dev->iobase + Change_Status);
- if(!status&MasterInterruptStatus)return;
- if(!status&EdgeStatus)return;
+ if(!status&MasterInterruptStatus)return IRQ_NONE;
+ if(!status&EdgeStatus)return IRQ_NONE;
writeb(ClrEdge | ClrOverflow, dev->iobase + Clear_Register);
comedi_buf_put(s->async, 0);
s->async->events |= COMEDI_CB_EOS;
comedi_event(dev,s,s->async->events);
+ return IRQ_HANDLED;
}
static int ni6527_intr_cmdtest(comedi_device *dev,comedi_subdevice *s,
detach: a2150_detach,
};
-static void a2150_interrupt(int irq, void *d, struct pt_regs *regs);
+static irqreturn_t a2150_interrupt(int irq, void *d, struct pt_regs *regs);
static int a2150_ai_cmdtest(comedi_device *dev,comedi_subdevice *s,comedi_cmd *cmd);
static int a2150_ai_cmd(comedi_device *dev, comedi_subdevice *s);
static int a2150_ai_rinsn(comedi_device *dev, comedi_subdevice *s, comedi_insn *insn, lsampl_t *data);
#endif
/* interrupt service routine */
-static void a2150_interrupt(int irq, void *d, struct pt_regs *regs)
+static irqreturn_t a2150_interrupt(int irq, void *d, struct pt_regs *regs)
{
int i;
int status;
if(dev->attached == 0)
{
comedi_error(dev, "premature interrupt");
- return;
+ return IRQ_HANDLED;
}
// initialize async here to make sure s is not NULL
async = s->async;
if((status & INTR_BIT ) == 0)
{
comedi_error(dev, "spurious interrupt");
- return;
+ return IRQ_NONE;
}
if(status & OVFL_BIT)
a2150_cancel(dev, s);
async->events |= COMEDI_CB_ERROR | COMEDI_CB_EOA;
comedi_event(dev, s, async->events);
- return;
+ return IRQ_HANDLED;
}
flags = claim_dma_lock();
/* clear interrupt */
outw(0x00, dev->iobase + DMA_TC_CLEAR_REG);
- return;
+ return IRQ_HANDLED;
}
// probes board type, returns offset
/* function prototypes */
static int atmio16d_attach(comedi_device *dev,comedi_devconfig *it);
static int atmio16d_detach(comedi_device *dev);
-static void atmio16d_interrupt(int irq, void *d, struct pt_regs *regs);
+static irqreturn_t atmio16d_interrupt(int irq, void *d, struct pt_regs *regs);
static int atmio16d_ai_cmdtest(comedi_device *dev, comedi_subdevice *s, comedi_cmd *cmd);
static int atmio16d_ai_cmd(comedi_device *dev, comedi_subdevice *s);
static int atmio16d_ai_cancel(comedi_device *dev, comedi_subdevice *s);
outw(2048, dev->iobase+DAC1_REG);
}
-static void atmio16d_interrupt(int irq, void *d, struct pt_regs *regs)
+static irqreturn_t atmio16d_interrupt(int irq, void *d, struct pt_regs *regs)
{
comedi_device *dev = d;
comedi_subdevice *s = dev->subdevices + 0;
-
+
// printk("atmio16d_interrupt!\n");
comedi_buf_put( s->async, inw(dev->iobase+AD_FIFO_REG) );
comedi_event(dev, s, s->async->events);
+ return IRQ_HANDLED;
}
static int atmio16d_ai_cmdtest(comedi_device *dev, comedi_subdevice *s, comedi_cmd *cmd)
/*====================================================================*/
-static void cs_error(client_handle_t handle, int func, int ret)
+static void my_cs_error(client_handle_t handle, int func, int ret)
{
error_info_t err = { func, ret };
CardServices(ReportError, handle, &err);
client_reg.event_callback_args.client_data = link;
ret = CardServices(RegisterClient, &link->handle, &client_reg);
if (ret != CS_SUCCESS) {
- cs_error(link->handle, RegisterClient, ret);
+ my_cs_error(link->handle, RegisterClient, ret);
dio24_cs_detach(link);
return NULL;
}
return;
cs_failed:
- cs_error(link->handle, last_fn, last_ret);
+ my_cs_error(link->handle, last_fn, last_ret);
printk(KERN_INFO "Fallo");
dio24_release((u_long)link);
static int labpc_attach(comedi_device *dev,comedi_devconfig *it);
static int labpc_cancel(comedi_device *dev, comedi_subdevice *s);
-static void labpc_interrupt(int irq, void *d, struct pt_regs *regs);
+static irqreturn_t labpc_interrupt(int irq, void *d, struct pt_regs *regs);
static int labpc_drain_fifo(comedi_device *dev);
static void labpc_drain_dma(comedi_device *dev);
static void handle_isa_dma(comedi_device *dev);
}
/* interrupt service routine */
-static void labpc_interrupt(int irq, void *d, struct pt_regs *regs)
+static irqreturn_t labpc_interrupt(int irq, void *d, struct pt_regs *regs)
{
comedi_device *dev = d;
comedi_subdevice *s = dev->read_subdev;
if(dev->attached == 0)
{
comedi_error(dev, "premature interrupt");
- return;
+ return IRQ_HANDLED;
}
async = s->async;
(devpriv->status2_bits & A1_TC_BIT) == 0 &&
(devpriv->status2_bits & FNHF_BIT))
{
- return;
+ return IRQ_NONE;
}
if(devpriv->status1_bits & OVERRUN_BIT)
async->events |= COMEDI_CB_ERROR | COMEDI_CB_EOA;
comedi_event(dev, s, async->events);
comedi_error(dev, "overrun");
- return;
+ return IRQ_HANDLED;
}
if(devpriv->current_transfer == isa_dma_transfer)
thisboard->write_byte(0x1, dev->iobase + ADC_CLEAR_REG);
async->events |= COMEDI_CB_ERROR | COMEDI_CB_EOA;
comedi_error(dev, "overflow");
- return;
+ return IRQ_HANDLED;
}
// handle external stop trigger
}
comedi_event(dev, s, async->events);
+ return IRQ_HANDLED;
}
// read all available samples from ai fifo
/*====================================================================*/
-static void cs_error(client_handle_t handle, int func, int ret)
+static void my_cs_error(client_handle_t handle, int func, int ret)
{
error_info_t err = { func, ret };
CardServices(ReportError, handle, &err);
client_reg.event_callback_args.client_data = link;
ret = CardServices(RegisterClient, &link->handle, &client_reg);
if (ret != CS_SUCCESS) {
- cs_error(link->handle, RegisterClient, ret);
+ my_cs_error(link->handle, RegisterClient, ret);
labpc_cs_detach(link);
return NULL;
}
return;
cs_failed:
- cs_error(link->handle, last_fn, last_ret);
+ my_cs_error(link->handle, last_fn, last_ret);
labpc_release((u_long)link);
} /* labpc_config */
}
-static void ni_E_interrupt(int irq,void *d,struct pt_regs * regs)
+static irqreturn_t ni_E_interrupt(int irq,void *d,struct pt_regs * regs)
{
comedi_device *dev=d;
unsigned short a_status;
handle_a_interrupt(dev, a_status, m0_status);
if(b_status&Interrupt_B_St || m1_status & CHSR_INT )
handle_b_interrupt(dev, b_status, m1_status);
+ return IRQ_HANDLED;
}
#ifdef PCIDMA
};
static int mio_cs_event(event_t event, int priority, event_callback_args_t *args);
-static void cs_error(client_handle_t handle, int func, int ret)
+static void my_cs_error(client_handle_t handle, int func, int ret)
{
error_info_t err = { func, ret };
- DPRINTK("cs_error(handle=%p, func=%d, ret=%d)\n",handle,func,ret);
+ DPRINTK("my_cs_error(handle=%p, func=%d, ret=%d)\n",handle,func,ret);
CardServices(ReportError, handle, &err);
}
client_reg.event_callback_args.client_data = link;
ret = CardServices(RegisterClient, &link->handle, &client_reg);
if (ret != CS_SUCCESS) {
- cs_error(link->handle, RegisterClient, ret);
+ my_cs_error(link->handle, RegisterClient, ret);
printk("detaching...\n");
cs_detach(link);
return NULL;
}
}
-static void nidio_interrupt(int irq, void *d, struct pt_regs *regs)
+static irqreturn_t nidio_interrupt(int irq, void *d, struct pt_regs *regs)
{
comedi_device *dev=d;
comedi_subdevice *s = dev->subdevices;
int status;
int work = 0;
unsigned int m_status;
+ int retval = IRQ_HANDLED;
status = readb(dev->iobase+Interrupt_And_Window_Status);
flags = readb(dev->iobase+Group_1_Flags);
out:
comedi_event(dev,s,async->events);
-
+
#if unused
if(!tag){
writeb(0x03,dev->iobase+Master_DMA_And_Interrupt_Control);
}
#endif
-
+ return IRQ_RETVAL(retval);
}
#ifdef DEBUG_FLAGS
#define devpriv ((pcl711_private *)dev->private)
-static void pcl711_interrupt(int irq, void *d, struct pt_regs *regs)
+static irqreturn_t pcl711_interrupt(int irq, void *d, struct pt_regs *regs)
{
int lo, hi;
int data;
s->async->events |= COMEDI_CB_EOA;
}
comedi_event(dev, s, s->async->events);
+ return IRQ_HANDLED;
}
static void pcl711_set_changain(comedi_device * dev, int chan)
/*
==============================================================================
*/
-static void interrupt_pcl812_ai_int(int irq, void *d, struct pt_regs *regs)
+static irqreturn_t interrupt_pcl812_ai_int(int irq, void *d, struct pt_regs *regs)
{
char err=1;
unsigned int mask, timeout;
comedi_udelay(1);
}
}
-
+
if (err) {
rt_printk("comedi%d: pcl812: (%s at 0x%x) 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);
- return;
+ return IRQ_HANDLED;
}
comedi_buf_put( s->async,
}
comedi_event(dev,s,s->async->events);
+ return IRQ_HANDLED;
}
-/*
+/*
==============================================================================
*/
static void transfer_from_dma_buf(comedi_device *dev,comedi_subdevice *s,
/*
==============================================================================
*/
-static void interrupt_pcl812_ai_dma(int irq, void *d, struct pt_regs *regs)
+static irqreturn_t interrupt_pcl812_ai_dma(int irq, void *d, struct pt_regs *regs)
{
comedi_device *dev = d;
comedi_subdevice *s = dev->subdevices + 0;
unsigned long dma_flags;
int len,bufptr;
- sampl_t *ptr;
+ sampl_t *ptr;
#ifdef PCL812_EXTDEBUG
rt_printk("pcl812 EDBG: BGN: interrupt_pcl812_ai_dma(...)\n");
#endif
- ptr=(sampl_t *)devpriv->dmabuf[devpriv->next_dma_buf];
- len=(devpriv->dmabytestomove[devpriv->next_dma_buf] >> 1) - devpriv->ai_poll_ptr;
+ ptr=(sampl_t *)devpriv->dmabuf[devpriv->next_dma_buf];
+ len=(devpriv->dmabytestomove[devpriv->next_dma_buf] >> 1) - devpriv->ai_poll_ptr;
- devpriv->next_dma_buf=1-devpriv->next_dma_buf;
- disable_dma(devpriv->dma);
+ devpriv->next_dma_buf=1-devpriv->next_dma_buf;
+ disable_dma(devpriv->dma);
set_dma_mode(devpriv->dma, DMA_MODE_READ);
dma_flags=claim_dma_lock();
set_dma_addr(devpriv->dma, devpriv->hwdmaptr[devpriv->next_dma_buf]);
if (devpriv->ai_eos) {
- set_dma_count(devpriv->dma, devpriv->dmabytestomove[devpriv->next_dma_buf]);
+ set_dma_count(devpriv->dma, devpriv->dmabytestomove[devpriv->next_dma_buf]);
} else {
if (devpriv->dma_runs_to_end) { set_dma_count(devpriv->dma, devpriv->dmabytestomove[devpriv->next_dma_buf]); }
- else { set_dma_count(devpriv->dma, devpriv->last_dma_run); }
- devpriv->dma_runs_to_end--;
+ else { set_dma_count(devpriv->dma, devpriv->last_dma_run); }
+ devpriv->dma_runs_to_end--;
}
release_dma_lock(dma_flags);
enable_dma(devpriv->dma);
- outb(0,dev->iobase+PCL812_CLRINT); /* clear INT request */
+ outb(0,dev->iobase+PCL812_CLRINT); /* clear INT request */
- bufptr=devpriv->ai_poll_ptr;
+ bufptr=devpriv->ai_poll_ptr;
devpriv->ai_poll_ptr=0;
transfer_from_dma_buf(dev, s, ptr, bufptr, len);
#ifdef PCL812_EXTDEBUG
rt_printk("pcl812 EDBG: END: interrupt_pcl812_ai_dma(...)\n");
#endif
+ return IRQ_HANDLED;
}
-/*
+/*
==============================================================================
*/
-static void interrupt_pcl812(int irq, void *d, struct pt_regs *regs)
+static irqreturn_t interrupt_pcl812(int irq, void *d, struct pt_regs *regs)
{
comedi_device *dev = d;
- if (devpriv->ai_dma) { interrupt_pcl812_ai_dma(irq, d, regs); }
- else { interrupt_pcl812_ai_int(irq, d, regs); };
-
+ if (devpriv->ai_dma) { return interrupt_pcl812_ai_dma(irq, d, regs); }
+ else { return interrupt_pcl812_ai_int(irq, d, regs); };
}
/*
analog input interrupt mode 1 & 3, 818 cards
one sample per interrupt version
*/
-static void
+static irqreturn_t
interrupt_pcl816_ai_mode13_int (int irq, void *d, struct pt_regs *regs)
{
- comedi_device *dev = d;
- comedi_subdevice *s = dev->subdevices + 0;
- int low, hi;
- int timeout = 50; /* wait max 50us */
+ comedi_device *dev = d;
+ comedi_subdevice *s = dev->subdevices + 0;
+ int low, hi;
+ int timeout = 50; /* wait max 50us */
- while (timeout--) {
- if (!(inb (dev->iobase + PCL816_STATUS) & PCL816_STATUS_DRDY_MASK))
+ while (timeout--) {
+ if (!(inb (dev->iobase + PCL816_STATUS) & PCL816_STATUS_DRDY_MASK))
break;
comedi_udelay (1);
}
if(!timeout) { // timeout, bail error
- outb (0, dev->iobase + PCL816_CLRINT); /* clear INT request */
- 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);
- return;
+ outb (0, dev->iobase + PCL816_CLRINT); /* clear INT request */
+ 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);
+ return IRQ_HANDLED;
}
- // get the sample
- low = inb (dev->iobase + PCL816_AD_LO);
- hi = inb (dev->iobase + PCL816_AD_HI);
+ // get the sample
+ low = inb (dev->iobase + PCL816_AD_LO);
+ hi = inb (dev->iobase + PCL816_AD_HI);
- comedi_buf_put( s->async, (hi << 8)|low );
+ comedi_buf_put( s->async, (hi << 8)|low );
- outb (0, dev->iobase + PCL816_CLRINT); /* clear INT request */
+ outb (0, dev->iobase + PCL816_CLRINT); /* clear INT request */
- if (++devpriv->ai_act_chanlist_pos >= devpriv->ai_act_chanlist_len)
- devpriv->ai_act_chanlist_pos = 0;
+ if (++devpriv->ai_act_chanlist_pos >= devpriv->ai_act_chanlist_len)
+ devpriv->ai_act_chanlist_pos = 0;
- if (s->async->cur_chan == 0){
+ if (s->async->cur_chan == 0){
devpriv->ai_act_scan++;
- }
+ }
- if (!devpriv->ai_neverending)
+ if (!devpriv->ai_neverending)
if (devpriv->ai_act_scan >= devpriv->ai_scans) { /* all data sampled */
/* all data sampled */
pcl816_ai_cancel (dev, s);
s->async->events |= COMEDI_CB_EOA;
- return;
}
comedi_event(dev, s, s->async->events);
+ return IRQ_HANDLED;
}
/*
}
-static void interrupt_pcl816_ai_mode13_dma(int irq, void *d, struct pt_regs *regs)
+static irqreturn_t interrupt_pcl816_ai_mode13_dma(int irq, void *d, struct pt_regs *regs)
{
comedi_device *dev = d;
comedi_subdevice *s = dev->subdevices + 0;
devpriv->ai_poll_ptr = 0;
transfer_from_dma_buf(dev, s, ptr, bufptr, len);
+ return IRQ_HANDLED;
}
==============================================================================
INT procedure
*/
-static void
+static irqreturn_t
interrupt_pcl816 (int irq, void *d, struct pt_regs *regs)
{
comedi_device *dev = d;
if(!dev->attached) {
comedi_error(dev, "premature interrupt");
- return;
+ return IRQ_HANDLED;
}
switch (devpriv->int816_mode) {
case INT_TYPE_AI1_DMA:
case INT_TYPE_AI3_DMA:
- interrupt_pcl816_ai_mode13_dma (irq, d, regs);
- return;
+ return interrupt_pcl816_ai_mode13_dma (irq, d, regs);
case INT_TYPE_AI1_INT:
case INT_TYPE_AI3_INT:
- interrupt_pcl816_ai_mode13_int (irq, d, regs);
- return;
+ return interrupt_pcl816_ai_mode13_int (irq, d, regs);
}
if (devpriv->irq_was_now_closed) {
devpriv->irq_was_now_closed = 0;
// comedi_error(dev,"last IRQ..");
- return;
+ return IRQ_HANDLED;
}
comedi_error (dev, "bad IRQ!");
- return;
+ return IRQ_NONE;
}
comedi_error (dev, "IRQ from unknow source!");
+ return IRQ_NONE;
}
/*
==============================================================================
analog input interrupt mode 1 & 3, 818 cards
- one sample per interrupt version
+ one sample per interrupt version
*/
-static void interrupt_pcl818_ai_mode13_int(int irq, void *d, struct pt_regs *regs)
+static irqreturn_t interrupt_pcl818_ai_mode13_int(int irq, void *d, struct pt_regs *regs)
{
- comedi_device *dev = d;
+ comedi_device *dev = d;
comedi_subdevice *s = dev->subdevices + 0;
- int low;
- int timeout=50; /* wait max 50us */
+ int low;
+ int timeout=50; /* wait max 50us */
while (timeout--) {
if (inb(dev->iobase + PCL818_STATUS) & 0x10) goto conv_finish;
comedi_udelay(1);
- }
- outb(0,dev->iobase+PCL818_STATUS); /* clear INT request */
- comedi_error(dev,"A/D mode1/3 IRQ without DRDY!");
+ }
+ outb(0,dev->iobase+PCL818_STATUS); /* clear INT request */
+ 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);
- return;
+ return IRQ_HANDLED;
conv_finish:
low=inb(dev->iobase + PCL818_AD_LO);
((inb(dev->iobase + PCL818_AD_HI) << 4) | (low >> 4)) ); // get one sample
outb(0,dev->iobase+PCL818_CLRINT); /* clear INT request */
- if ((low & 0xf)!=devpriv->act_chanlist[devpriv->act_chanlist_pos]) { // dropout!
+ 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);
s->async->events |= COMEDI_CB_EOA | COMEDI_CB_ERROR;
comedi_event(dev, s, s->async->events);
- return;
- }
- if (s->async->cur_chan == 0) {
+ return IRQ_HANDLED;
+ }
+ if (s->async->cur_chan == 0) {
// rt_printk("E");
devpriv->int13_act_scan--;
- }
+ }
if (!devpriv->neverending_ai){
if ( devpriv->int13_act_scan == 0 ) { /* all data sampled */
pcl818_ai_cancel(dev,s);
s->async->events |= COMEDI_CB_EOA;
- return;
}
}
comedi_event(dev, s, s->async->events);
+ return IRQ_HANDLED;
}
/*
==============================================================================
analog input dma mode 1 & 3, 818 cards
*/
-static void interrupt_pcl818_ai_mode13_dma(int irq, void *d, struct pt_regs *regs)
+static irqreturn_t interrupt_pcl818_ai_mode13_dma(int irq, void *d, struct pt_regs *regs)
{
comedi_device *dev = d;
comedi_subdevice *s = dev->subdevices + 0;
int i,len,bufptr;
unsigned long flags;
- sampl_t *ptr;
+ sampl_t *ptr;
- disable_dma(devpriv->dma);
- devpriv->next_dma_buf=1-devpriv->next_dma_buf;
- if ((devpriv->dma_runs_to_end)>-1) { // switch dma bufs
+ disable_dma(devpriv->dma);
+ devpriv->next_dma_buf=1-devpriv->next_dma_buf;
+ if ((devpriv->dma_runs_to_end)>-1) { // switch dma bufs
set_dma_mode(devpriv->dma, DMA_MODE_READ);
flags=claim_dma_lock();
set_dma_addr(devpriv->dma, devpriv->hwdmaptr[devpriv->next_dma_buf]);
else { set_dma_count(devpriv->dma, devpriv->last_dma_run); }
release_dma_lock(flags);
enable_dma(devpriv->dma);
- }
+ }
- devpriv->dma_runs_to_end--;
- outb(0,dev->iobase+PCL818_CLRINT); /* clear INT request */
- ptr=(sampl_t *)devpriv->dmabuf[1-devpriv->next_dma_buf];
+ devpriv->dma_runs_to_end--;
+ outb(0,dev->iobase+PCL818_CLRINT); /* clear INT request */
+ ptr=(sampl_t *)devpriv->dmabuf[1-devpriv->next_dma_buf];
- len=devpriv->hwdmasize[0] >> 1;
- bufptr=0;
+ len=devpriv->hwdmasize[0] >> 1;
+ bufptr=0;
- for (i=0;i<len;i++) {
+ for (i=0;i<len;i++) {
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);
+ 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);
s->async->events |= COMEDI_CB_EOA | COMEDI_CB_ERROR;
comedi_event(dev, s, s->async->events);
- return;
+ return IRQ_HANDLED;
}
comedi_buf_put( s->async, ptr[bufptr++] >> 4 ); // get one sample
s->async->events |= COMEDI_CB_EOA;
comedi_event(dev, s, s->async->events);
// printk("done int ai13 dma\n");
- return;
+ return IRQ_HANDLED;
}
}
if (len>0) comedi_event(dev, s, s->async->events);
+ return IRQ_HANDLED;
}
/*
==============================================================================
analog input dma mode 1 & 3 over RTC, 818 cards
*/
-static void interrupt_pcl818_ai_mode13_dma_rtc(int irq, void *d, struct pt_regs *regs)
+static irqreturn_t interrupt_pcl818_ai_mode13_dma_rtc(int irq, void *d, struct pt_regs *regs)
{
- comedi_device *dev = d;
+ comedi_device *dev = d;
comedi_subdevice *s = dev->subdevices + 0;
- unsigned long tmp;
- unsigned int top1,top2,i,bufptr;
- long ofs_dats;
- sampl_t *dmabuf=(sampl_t *)devpriv->dmabuf[0];
+ unsigned long tmp;
+ unsigned int top1,top2,i,bufptr;
+ long ofs_dats;
+ sampl_t *dmabuf=(sampl_t *)devpriv->dmabuf[0];
- //outb(2,0x378);
- switch(devpriv->int818_mode) {
+ //outb(2,0x378);
+ switch(devpriv->int818_mode) {
case INT_TYPE_AI1_DMA_RTC:
case INT_TYPE_AI3_DMA_RTC:
tmp = (CMOS_READ(RTC_INTR_FLAGS) & 0xF0);
if (top1==top2) break;
}
- if (top1!=top2) return;
+ if (top1!=top2) return IRQ_HANDLED;
top1=devpriv->hwdmasize[0]-top1; // where is now DMA in buffer
top1>>=1;
ofs_dats=top1-devpriv->last_top_dma; // new samples from last call
if (ofs_dats<0) ofs_dats=(devpriv->dmasamplsize)+ofs_dats;
- if (!ofs_dats) return; // exit=no new samples from last call
+ if (!ofs_dats) return IRQ_HANDLED; // exit=no new samples from last call
// obsluz data
i=devpriv->last_top_dma-1;
i&=(devpriv->dmasamplsize-1);
pcl818_ai_cancel(dev,s);
s->async->events |= COMEDI_CB_EOA | COMEDI_CB_ERROR;
comedi_event(dev, s, s->async->events);
- return;
+ return IRQ_HANDLED;
}
//rt_printk("r %ld ",ofs_dats);
pcl818_ai_cancel(dev,s);
s->async->events |= COMEDI_CB_EOA | COMEDI_CB_ERROR;
comedi_event(dev, s, s->async->events);
- return;
+ return IRQ_HANDLED;
}
comedi_buf_put( s->async, dmabuf[bufptr++] >> 4); // get one sample
s->async->events |= COMEDI_CB_EOA;
comedi_event(dev, s, s->async->events);
//printk("done int ai13 dma\n");
- return;
+ return IRQ_HANDLED;
}
}
dmabuf[bufptr]=MAGIC_DMA_WORD;
comedi_event(dev, s, s->async->events);
//outb(0,0x378);
- return;
+ return IRQ_HANDLED;
}
//outb(0,0x378);
+ return IRQ_HANDLED;
}
/*
==============================================================================
analog input interrupt mode 1 & 3, 818HD/HG cards
*/
-static void interrupt_pcl818_ai_mode13_fifo(int irq, void *d, struct pt_regs *regs)
+static irqreturn_t interrupt_pcl818_ai_mode13_fifo(int irq, void *d, struct pt_regs *regs)
{
- comedi_device *dev = d;
- comedi_subdevice *s = dev->subdevices + 0;
- int i,len,lo;
+ comedi_device *dev = d;
+ comedi_subdevice *s = dev->subdevices + 0;
+ int i,len,lo;
- outb(0, dev->iobase + PCL818_FI_INTCLR); // clear fifo int request
+ outb(0, dev->iobase + PCL818_FI_INTCLR); // clear fifo int request
- lo=inb(dev->iobase + PCL818_FI_STATUS);
+ lo=inb(dev->iobase + PCL818_FI_STATUS);
- if (lo&4) {
+ if (lo&4) {
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);
- return;
- }
+ return IRQ_HANDLED;
+ }
- if (lo&1) {
+ if (lo&1) {
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);
- return;
+ return IRQ_HANDLED;
}
- if (lo&2) { len=512; }
- else { len=0; }
+ if (lo&2) { len=512; }
+ else { len=0; }
- for (i=0;i<len;i++) {
+ for (i=0;i<len;i++) {
lo=inb(dev->iobase + PCL818_FI_DATALO);
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);
s->async->events |= COMEDI_CB_EOA | COMEDI_CB_ERROR;
comedi_event(dev, s, s->async->events);
- return;
+ return IRQ_HANDLED;
}
comedi_buf_put( s->async, (lo >> 4)|(inb(dev->iobase + PCL818_FI_DATAHI) << 4) ); // get one sample
pcl818_ai_cancel(dev,s);
s->async->events |= COMEDI_CB_EOA;
comedi_event(dev, s, s->async->events);
- return;
+ return IRQ_HANDLED;
}
}
if (len>0) comedi_event(dev, s, s->async->events);
+ return IRQ_HANDLED;
}
/*
==============================================================================
INT procedure
*/
-static void interrupt_pcl818(int irq, void *d, struct pt_regs *regs)
+static irqreturn_t interrupt_pcl818(int irq, void *d, struct pt_regs *regs)
{
- comedi_device *dev = d;
+ comedi_device *dev = d;
if(!dev->attached)
{
comedi_error(dev, "premature interrupt");
- return;
+ return IRQ_HANDLED;
}
- //rt_printk("I\n");
+ //rt_printk("I\n");
- switch (devpriv->int818_mode) {
+ switch (devpriv->int818_mode) {
case INT_TYPE_AI1_DMA:
case INT_TYPE_AI3_DMA:
- interrupt_pcl818_ai_mode13_dma(irq, d, regs);
- return;
+ return interrupt_pcl818_ai_mode13_dma(irq, d, regs);
case INT_TYPE_AI1_INT:
case INT_TYPE_AI3_INT:
- interrupt_pcl818_ai_mode13_int(irq, d, regs);
- return;
+ return interrupt_pcl818_ai_mode13_int(irq, d, regs);
case INT_TYPE_AI1_FIFO:
case INT_TYPE_AI3_FIFO:
- interrupt_pcl818_ai_mode13_fifo(irq, d, regs);
- return;
+ return interrupt_pcl818_ai_mode13_fifo(irq, d, regs);
#ifdef PCL818_MODE13_AO
case INT_TYPE_AO1_INT:
case INT_TYPE_AO3_INT:
- interrupt_pcl818_ao_mode13_int(irq, d, regs);
- return;
+ return interrupt_pcl818_ao_mode13_int(irq, d, regs);
#endif
+ default:
+ break;
}
outb(0,dev->iobase+PCL818_CLRINT); /* clear INT request */
- if ((!dev->irq)|(!devpriv->irq_free)|(!devpriv->irq_blocked)|(!devpriv->int818_mode)) {
+ if ((!dev->irq)||(!devpriv->irq_free)||(!devpriv->irq_blocked)||(!devpriv->int818_mode)) {
if (devpriv->irq_was_now_closed) {
devpriv->irq_was_now_closed=0;
// comedi_error(dev,"last IRQ..");
- return;
+ return IRQ_HANDLED;
}
comedi_error(dev,"bad IRQ!");
- return;
+ return IRQ_NONE;
}
- comedi_error(dev,"IRQ from unknow source!");
+ comedi_error(dev,"IRQ from unknow source!");
+ return IRQ_NONE;
}
/*
/*====================================================================*/
-static void cs_error(client_handle_t handle, int func, int ret)
+static void my_cs_error(client_handle_t handle, int func, int ret)
{
error_info_t err = { func, ret };
CardServices(ReportError, handle, &err);
client_reg.event_callback_args.client_data = link;
ret = CardServices(RegisterClient, &link->handle, &client_reg);
if (ret != CS_SUCCESS) {
- cs_error(link->handle, RegisterClient, ret);
+ my_cs_error(link->handle, RegisterClient, ret);
daqp_cs_detach(link);
return NULL;
}
return;
cs_failed:
- cs_error(link->handle, last_fn, last_ret);
+ my_cs_error(link->handle, last_fn, last_ret);
daqp_cs_release((u_long)link);
} /* daqp_cs_config */
static int rtd_ai_cancel ( comedi_device *dev, comedi_subdevice *s);
//static int rtd_ai_poll (comedi_device *dev,comedi_subdevice *s);
static int rtd_ns_to_timer (unsigned int *ns, int roundMode);
-static void rtd_interrupt ( int irq, void *d, struct pt_regs *regs);
+static irqreturn_t rtd_interrupt ( int irq, void *d, struct pt_regs *regs);
/*
#endif /* USE_DMA */
/*
- Handle all rtd520 interrupts.
+ Handle all rtd520 interrupts.
Runs atomically and is never re-entered.
This is a "slow handler"; other interrupts may be active.
The data conversion may someday happen in a "bottom half".
*/
-static void rtd_interrupt (
+static irqreturn_t rtd_interrupt (
int irq, /* interrupt number (ignored) */
void *d, /* our data */
struct pt_regs *regs) /* cpu context (ignored) */
{
- comedi_device *dev = d; /* must be called "dev" for devpriv */
- u16 status;
- u16 fifoStatus;
- comedi_subdevice *s = dev->subdevices + 0; /* analog in subdevice */
+ comedi_device *dev = d; /* must be called "dev" for devpriv */
+ u16 status;
+ u16 fifoStatus;
+ comedi_subdevice *s = dev->subdevices + 0; /* analog in subdevice */
- devpriv->intCount++; /* DEBUG statistics */
+ devpriv->intCount++; /* DEBUG statistics */
- fifoStatus = RtdFifoStatus (dev);
- /* check for FIFO full, this automatically halts the ADC! */
- if (!(fifoStatus & FS_ADC_FULL)) { /* 0 -> full */
- DPRINTK("rtd520: FIFO full! fifo_status=0x%x\n",
- (fifoStatus ^ 0x6666) & 0x7777); /* should be all 0s */
- goto abortTransfer;
- }
+ fifoStatus = RtdFifoStatus (dev);
+ /* check for FIFO full, this automatically halts the ADC! */
+ if (!(fifoStatus & FS_ADC_FULL)) { /* 0 -> full */
+ DPRINTK("rtd520: FIFO full! fifo_status=0x%x\n",
+ (fifoStatus ^ 0x6666) & 0x7777); /* should be all 0s */
+ goto abortTransfer;
+ }
#ifdef USE_DMA
if (devpriv->flags & DMA0_ACTIVE) { /* Check DMA */
| PLX_CLEAR_DMA_INTR_BIT);
goto abortTransfer;
}
-
+
/*DPRINTK ("rtd520: DMA transfer: %ld to go, istatus %x\n",
devpriv->aiCount, istatus);*/
RtdDma0Control (dev, (devpriv->dma0Control & ~PLX_DMA_START_BIT)
status = RtdInterruptStatus (dev);
/* if interrupt was not caused by our board, or handled above */
if (0 == status) {
- return;
+ return IRQ_HANDLED;
}
if (status & IRQM_ADC_ABOUT_CNT) { /* sample count -> read FIFO */
devpriv->aiCount,
0xffff & RtdInterruptOverrunStatus (dev));
goto abortTransfer;
- }
-
+ }
+
/* clear the interrupt */
RtdInterruptClearMask (dev, status);
RtdInterruptClear (dev);
- return;
+ return IRQ_HANDLED;
abortTransfer:
RtdAdcClearFifo (dev); /* clears full flag */
status = RtdInterruptStatus (dev);
RtdInterruptClearMask (dev, status);
RtdInterruptClear (dev);
-
+
fifoStatus = RtdFifoStatus (dev); /* DEBUG */
DPRINTK("rtd520: Acquisition complete. %ld ints, intStat=%x, overStat=%x\n",
devpriv->intCount,
status,
0xffff & RtdInterruptOverrunStatus (dev));
+
+ return IRQ_HANDLED;
}
#if 0
};
COMEDI_INITCLEANUP(driver_rti800);
-static void rti800_interrupt(int irq, void *dev, struct pt_regs *regs);
+static irqreturn_t rti800_interrupt(int irq, void *dev, struct pt_regs *regs);
typedef struct {
enum {
#define RTI800_TIMEOUT 10
-static void rti800_interrupt(int irq, void *dev, struct pt_regs *regs)
+static irqreturn_t rti800_interrupt(int irq, void *dev, struct pt_regs *regs)
{
-
-
+ return IRQ_HANDLED;
}
// settling delay times in usec for different gains