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 static int __init
driver_pcl725_init_module(void)
35 return comedi_driver_register(&driver_pcl725
);
38 static void __exit
driver_pcl725_cleanup_module(void)
40 comedi_driver_unregister(&driver_pcl725
);
43 module_init(driver_pcl725_init_module
);
44 module_exit(driver_pcl725_cleanup_module
);
46 static int pcl725_do_insn(struct comedi_device
*dev
, struct comedi_subdevice
*s
,
47 struct comedi_insn
*insn
, unsigned int *data
)
54 s
->state
|= (data
[0] & data
[1]);
55 outb(s
->state
, dev
->iobase
+ PCL725_DO
);
63 static int pcl725_di_insn(struct comedi_device
*dev
, struct comedi_subdevice
*s
,
64 struct comedi_insn
*insn
, unsigned int *data
)
69 data
[1] = inb(dev
->iobase
+ PCL725_DI
);
74 static int pcl725_attach(struct comedi_device
*dev
, struct comedi_devconfig
*it
)
76 struct comedi_subdevice
*s
;
79 iobase
= it
->options
[0];
80 printk(KERN_INFO
"comedi%d: pcl725: 0x%04lx ", dev
->minor
, iobase
);
81 if (!request_region(iobase
, PCL725_SIZE
, "pcl725")) {
82 printk("I/O port conflict\n");
85 dev
->board_name
= "pcl725";
89 if (alloc_subdevices(dev
, 2) < 0)
92 s
= dev
->subdevices
+ 0;
94 s
->type
= COMEDI_SUBD_DO
;
95 s
->subdev_flags
= SDF_WRITABLE
;
98 s
->insn_bits
= pcl725_do_insn
;
99 s
->range_table
= &range_digital
;
101 s
= dev
->subdevices
+ 1;
103 s
->type
= COMEDI_SUBD_DI
;
104 s
->subdev_flags
= SDF_READABLE
;
107 s
->insn_bits
= pcl725_di_insn
;
108 s
->range_table
= &range_digital
;
110 printk(KERN_INFO
"\n");
115 static int pcl725_detach(struct comedi_device
*dev
)
117 printk(KERN_INFO
"comedi%d: pcl725: remove\n", dev
->minor
);
120 release_region(dev
->iobase
, PCL725_SIZE
);
125 MODULE_AUTHOR("Comedi http://www.comedi.org");
126 MODULE_DESCRIPTION("Comedi low-level driver");
127 MODULE_LICENSE("GPL");