- From: Bob Apodaca <comedi_at_phxlab.honeywell.com>
- Date: Mon, 12 Jul 2004 14:59:56 -0700
I have written a driver for an analog input card and I'm trying to add
another PCI card (a digital input card) to the driver. Everything is
going fine, except when there's an interrupt. My interrupt handler does:
async = s->async;
async->events = 0;
but the problem is async points to NULL as if no memory were allocated
to it. As you can imagine, the kernel doesn't like this. Here is a
code snippet where I set-up the subdevices:
/* Set-up subdevices */
if(alloc_subdevices(dev, 1) < 0)
return -ENOMEM;
switch(thisboard->id) {
case DIO:
/* Digital input subdevice */
s = dev->subdevices + 0;
dev->read_subdev = s;
s->type = COMEDI_SUBD_DI;
s->subdev_flags = SDF_READABLE | SDF_GROUND;
s->n_chan = 16;
s->maxdata = 1;
s->range_table = &range_digital;
s->insn_bits = di_rbits;
break;
case AD16:
/* Analog input subdevce */
s = dev->subdevices + 0;
dev->read_subdev = s;
s->type = COMEDI_SUBD_AI;
s->subdev_flags = SDF_READABLE | SDF_GROUND | SDF_DIFF;
s->n_chan = thisboard->n_aichan;
s->maxdata = (1 << thisboard->ai_bits) - 1;
s->range_table = thisboard->ranges;
s->insn_read = ai_rinsn;
if(dev->irq) {
s->do_cmd = ai_cmd;
s->do_cmdtest = ai_cmdtest;
}
s->cancel = cancel;
break;
default:
s = dev->subdevices + 0;
s->type = COMEDI_SUBD_UNUSED;
break;
}
printk("attached\n");
return 1;
I'd appreciate any suggestions.
Bob
Received on 2004-07-12Z20:59:56