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
,
24 struct comedi_devconfig
*it
);
25 static int pcl725_detach(struct comedi_device
*dev
);
26 static struct comedi_driver driver_pcl725
= {
27 .driver_name
= "pcl725",
28 .module
= THIS_MODULE
,
29 .attach
= pcl725_attach
,
30 .detach
= pcl725_detach
,
33 COMEDI_INITCLEANUP(driver_pcl725
);
35 static int pcl725_do_insn(struct comedi_device
*dev
, struct comedi_subdevice
*s
,
36 struct comedi_insn
*insn
, unsigned int *data
)
43 s
->state
|= (data
[0] & data
[1]);
44 outb(s
->state
, dev
->iobase
+ PCL725_DO
);
52 static int pcl725_di_insn(struct comedi_device
*dev
, struct comedi_subdevice
*s
,
53 struct comedi_insn
*insn
, unsigned int *data
)
58 data
[1] = inb(dev
->iobase
+ PCL725_DI
);
63 static int pcl725_attach(struct comedi_device
*dev
, struct comedi_devconfig
*it
)
65 struct comedi_subdevice
*s
;
68 iobase
= it
->options
[0];
69 printk(KERN_INFO
"comedi%d: pcl725: 0x%04lx ", dev
->minor
, iobase
);
70 if (!request_region(iobase
, PCL725_SIZE
, "pcl725")) {
71 printk("I/O port conflict\n");
74 dev
->board_name
= "pcl725";
78 if (alloc_subdevices(dev
, 2) < 0)
81 s
= dev
->subdevices
+ 0;
83 s
->type
= COMEDI_SUBD_DO
;
84 s
->subdev_flags
= SDF_WRITABLE
;
87 s
->insn_bits
= pcl725_do_insn
;
88 s
->range_table
= &range_digital
;
90 s
= dev
->subdevices
+ 1;
92 s
->type
= COMEDI_SUBD_DI
;
93 s
->subdev_flags
= SDF_READABLE
;
96 s
->insn_bits
= pcl725_di_insn
;
97 s
->range_table
= &range_digital
;
99 printk(KERN_INFO
"\n");
104 static int pcl725_detach(struct comedi_device
*dev
)
106 printk(KERN_INFO
"comedi%d: pcl725: remove\n", dev
->minor
);
109 release_region(dev
->iobase
, PCL725_SIZE
);