2 * comedi/drivers/pcl725.c
3 * Driver for PCL725 and clones
8 Description: Advantech PCL-725 (& compatibles)
11 Devices: [Advantech] PCL-725 (pcl725)
14 #include "../comedidev.h"
16 #include <linux/ioport.h>
23 static int pcl725_attach(struct comedi_device * dev, struct comedi_devconfig * it);
24 static int pcl725_detach(struct comedi_device * dev);
25 static struct comedi_driver driver_pcl725 = {
32 COMEDI_INITCLEANUP(driver_pcl725);
34 static int pcl725_do_insn(struct comedi_device * dev, struct comedi_subdevice * s,
35 struct comedi_insn * insn, unsigned int * data)
42 s->state |= (data[0] & data[1]);
43 outb(s->state, dev->iobase + PCL725_DO);
51 static int pcl725_di_insn(struct comedi_device * dev, struct comedi_subdevice * s,
52 struct comedi_insn * insn, unsigned int * data)
57 data[1] = inb(dev->iobase + PCL725_DI);
62 static int pcl725_attach(struct comedi_device * dev, struct comedi_devconfig * it)
64 struct comedi_subdevice *s;
67 iobase = it->options[0];
68 printk("comedi%d: pcl725: 0x%04lx ", dev->minor, iobase);
69 if (!request_region(iobase, PCL725_SIZE, "pcl725")) {
70 printk("I/O port conflict\n");
73 dev->board_name = "pcl725";
77 if (alloc_subdevices(dev, 2) < 0)
80 s = dev->subdevices + 0;
82 s->type = COMEDI_SUBD_DO;
83 s->subdev_flags = SDF_WRITABLE;
86 s->insn_bits = pcl725_do_insn;
87 s->range_table = &range_digital;
89 s = dev->subdevices + 1;
91 s->type = COMEDI_SUBD_DI;
92 s->subdev_flags = SDF_READABLE;
95 s->insn_bits = pcl725_di_insn;
96 s->range_table = &range_digital;
103 static int pcl725_detach(struct comedi_device * dev)
105 printk("comedi%d: pcl725: remove\n", dev->minor);
108 release_region(dev->iobase, PCL725_SIZE);