/*
Driver: poc.o
Description: Generic driver for very simple devices
-Device names: dac02
Author: ds
Devices: [Keithley Metrabyte] DAC-02 (dac02), [Advantech] PCL-733 (pcl733),
PCL-734 (pcl734)
comedi_insn *insn,lsampl_t *data);
struct boarddef_struct{
- char *name;
- int iosize;
+ const char *name;
+ unsigned int iosize;
int (*setup)(comedi_device *);
int type;
int n_chan;
int (*winsn)(comedi_device *,comedi_subdevice *,comedi_insn *,lsampl_t *);
int (*rinsn)(comedi_device *,comedi_subdevice *,comedi_insn *,lsampl_t *);
int (*insnbits)(comedi_device *,comedi_subdevice *,comedi_insn *,lsampl_t *);
- comedi_lrange* range;
+ const comedi_lrange *range;
};
-static struct boarddef_struct boards[]={
+static const struct boarddef_struct boards[]={
{
name: "dac02",
iosize: 8,
},
};
#define n_boards (sizeof(boards)/sizeof(boards[0]))
-#define this_board ((struct boarddef_struct *)dev->board_ptr)
+#define this_board ((const struct boarddef_struct *)dev->board_ptr)
static comedi_driver driver_poc=
{
module: THIS_MODULE,
attach: poc_attach,
detach: poc_detach,
- board_name: boards,
+ board_name: &boards[0].name,
num_names: n_boards,
offset: sizeof(boards[0]),
};
static int poc_attach(comedi_device *dev, comedi_devconfig *it)
{
comedi_subdevice *s;
- int iosize, iobase;
+ unsigned long iobase;
+ unsigned int iosize;
iobase = it->options[0];
- printk("comedi%d: poc: using %s iobase 0x%x\n", dev->minor,
+ printk("comedi%d: poc: using %s iobase 0x%lx\n", dev->minor,
this_board->name, iobase);
dev->board_name = this_board->name;
iosize = this_board->iosize;
/* check if io addresses are available */
- if(check_region(iobase, iosize) < 0)
+ if(!request_region(iobase, iosize, "dac02"))
{
- printk("I/O port conflict: failed to allocate ports 0x%x to 0x%x\n",
+ printk("I/O port conflict: failed to allocate ports 0x%lx to 0x%lx\n",
iobase, iobase + iosize - 1);
return -EIO;
}
- request_region(iobase, iosize, "dac02");
dev->iobase = iobase;
- dev->n_subdevices = 1;
- if(alloc_subdevices(dev) < 0)
+ if(alloc_subdevices(dev, 1) < 0)
return -ENOMEM;
if(alloc_private(dev,sizeof(lsampl_t)*this_board->n_chan) < 0)
return -ENOMEM;
chan = CR_CHAN(insn->chanspec);
((lsampl_t *)dev->private)[chan] = data[0];
output = data[0];
-#if wrong
+#ifdef wrong
// convert to complementary binary if range is bipolar
if((CR_RANGE(insn->chanspec) & 0x2) == 0)
output = ~output;
comedi_insn *insn,lsampl_t *data)
{
if(insn->n!=2)return -EINVAL;
-
+
data[1] = inb(dev->iobase + 0);
data[1] |= (inb(dev->iobase + 1) << 8);
data[1] |= (inb(dev->iobase + 2) << 16);