Commit d8fdaea5 authored by Ian Abbott's avatar Ian Abbott Committed by Greg Kroah-Hartman

staging: comedi: das08: Remove forward function declarations.

Moved some functions to avoid forward declarations.  Moved a few other
bits at the same time to keep EXPORT_SYMBOL{,_GPL}() close to the symbol
being exported, and PCI table close to the code that refers to it.

Changed whitespace in das08_board[] and das08_cs_board[] initializers.
Signed-off-by: default avatarIan Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 1e576a57
......@@ -157,29 +157,6 @@
/* gainlist same as _pgx_ below */
static int das08_ai_rinsn(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data);
static int das08_di_rbits(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data);
static int das08_do_wbits(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data);
#if IS_ENABLED(CONFIG_COMEDI_DAS08_ISA)
static int das08jr_di_rbits(struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data);
static int das08jr_do_wbits(struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data);
static int das08jr_ao_winsn(struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data);
static int das08ao_ao_winsn(struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data);
#endif
static void i8254_set_mode_low(unsigned int base, int channel,
unsigned int mode);
static const struct comedi_lrange range_das08_pgl = { 9, {
BIP_RANGE(10),
BIP_RANGE(5),
......@@ -258,272 +235,8 @@ static const int *const das08_gainlists[] = {
das08_pgm_gainlist,
};
#ifdef DO_COMEDI_DRIVER_REGISTER
static const struct das08_board_struct das08_boards[] = {
#if IS_ENABLED(CONFIG_COMEDI_DAS08_ISA)
{
.name = "isa-das08", /* cio-das08.pdf */
.bustype = isa,
.ai = das08_ai_rinsn,
.ai_nbits = 12,
.ai_pg = das08_pg_none,
.ai_encoding = das08_encode12,
.ao = NULL,
.ao_nbits = 12,
.di = das08_di_rbits,
.do_ = das08_do_wbits,
.do_nchan = 4,
.i8255_offset = 8,
.i8254_offset = 4,
.iosize = 16, /* unchecked */
},
{
.name = "das08-pgm", /* cio-das08pgx.pdf */
.bustype = isa,
.ai = das08_ai_rinsn,
.ai_nbits = 12,
.ai_pg = das08_pgm,
.ai_encoding = das08_encode12,
.ao = NULL,
.di = das08_di_rbits,
.do_ = das08_do_wbits,
.do_nchan = 4,
.i8255_offset = 0,
.i8254_offset = 0x04,
.iosize = 16, /* unchecked */
},
{
.name = "das08-pgh", /* cio-das08pgx.pdf */
.bustype = isa,
.ai = das08_ai_rinsn,
.ai_nbits = 12,
.ai_pg = das08_pgh,
.ai_encoding = das08_encode12,
.ao = NULL,
.di = das08_di_rbits,
.do_ = das08_do_wbits,
.do_nchan = 4,
.i8255_offset = 0,
.i8254_offset = 0x04,
.iosize = 16, /* unchecked */
},
{
.name = "das08-pgl", /* cio-das08pgx.pdf */
.bustype = isa,
.ai = das08_ai_rinsn,
.ai_nbits = 12,
.ai_pg = das08_pgl,
.ai_encoding = das08_encode12,
.ao = NULL,
.di = das08_di_rbits,
.do_ = das08_do_wbits,
.do_nchan = 4,
.i8255_offset = 0,
.i8254_offset = 0x04,
.iosize = 16, /* unchecked */
},
{
.name = "das08-aoh", /* cio-das08_aox.pdf */
.bustype = isa,
.ai = das08_ai_rinsn,
.ai_nbits = 12,
.ai_pg = das08_pgh,
.ai_encoding = das08_encode12,
.ao = das08ao_ao_winsn, /* 8 */
.ao_nbits = 12,
.di = das08_di_rbits,
.do_ = das08_do_wbits,
.do_nchan = 4,
.i8255_offset = 0x0c,
.i8254_offset = 0x04,
.iosize = 16, /* unchecked */
},
{
.name = "das08-aol", /* cio-das08_aox.pdf */
.bustype = isa,
.ai = das08_ai_rinsn,
.ai_nbits = 12,
.ai_pg = das08_pgl,
.ai_encoding = das08_encode12,
.ao = das08ao_ao_winsn, /* 8 */
.ao_nbits = 12,
.di = das08_di_rbits,
.do_ = das08_do_wbits,
.do_nchan = 4,
.i8255_offset = 0x0c,
.i8254_offset = 0x04,
.iosize = 16, /* unchecked */
},
{
.name = "das08-aom", /* cio-das08_aox.pdf */
.bustype = isa,
.ai = das08_ai_rinsn,
.ai_nbits = 12,
.ai_pg = das08_pgm,
.ai_encoding = das08_encode12,
.ao = das08ao_ao_winsn, /* 8 */
.ao_nbits = 12,
.di = das08_di_rbits,
.do_ = das08_do_wbits,
.do_nchan = 4,
.i8255_offset = 0x0c,
.i8254_offset = 0x04,
.iosize = 16, /* unchecked */
},
{
.name = "das08/jr-ao", /* cio-das08-jr-ao.pdf */
.bustype = isa,
.ai = das08_ai_rinsn,
.ai_nbits = 12,
.ai_pg = das08_pg_none,
.ai_encoding = das08_encode12,
.ao = das08jr_ao_winsn,
.ao_nbits = 12,
.di = das08jr_di_rbits,
.do_ = das08jr_do_wbits,
.do_nchan = 8,
.i8255_offset = 0,
.i8254_offset = 0,
.iosize = 16, /* unchecked */
},
{
.name = "das08jr-16-ao", /* cio-das08jr-16-ao.pdf */
.bustype = isa,
.ai = das08_ai_rinsn,
.ai_nbits = 16,
.ai_pg = das08_pg_none,
.ai_encoding = das08_encode12,
.ao = das08jr_ao_winsn,
.ao_nbits = 16,
.di = das08jr_di_rbits,
.do_ = das08jr_do_wbits,
.do_nchan = 8,
.i8255_offset = 0,
.i8254_offset = 0x04,
.iosize = 16, /* unchecked */
},
{
.name = "pc104-das08",
.bustype = pc104,
.ai = das08_ai_rinsn,
.ai_nbits = 12,
.ai_pg = das08_pg_none,
.ai_encoding = das08_encode12,
.ao = NULL,
.ao_nbits = 0,
.di = das08_di_rbits,
.do_ = das08_do_wbits,
.do_nchan = 4,
.i8255_offset = 0,
.i8254_offset = 4,
.iosize = 16, /* unchecked */
},
#if 0
{
.name = "das08/f",
},
{
.name = "das08jr",
},
#endif
{
.name = "das08jr/16",
.bustype = isa,
.ai = das08_ai_rinsn,
.ai_nbits = 16,
.ai_pg = das08_pg_none,
.ai_encoding = das08_encode16,
.ao = NULL,
.ao_nbits = 0,
.di = das08jr_di_rbits,
.do_ = das08jr_do_wbits,
.do_nchan = 8,
.i8255_offset = 0,
.i8254_offset = 0,
.iosize = 16, /* unchecked */
},
#if 0
{
.name = "das48-pga", /* cio-das48-pga.pdf */
},
{
.name = "das08-pga-g2", /* a KM board */
},
#endif
#endif /* IS_ENABLED(CONFIG_COMEDI_DAS08_ISA) */
#if IS_ENABLED(CONFIG_COMEDI_DAS08_PCI)
{
.name = "das08", /* pci-das08 */
.id = PCI_DEVICE_ID_PCIDAS08,
.bustype = pci,
.ai = das08_ai_rinsn,
.ai_nbits = 12,
.ai_pg = das08_bipolar5,
.ai_encoding = das08_encode12,
.ao = NULL,
.ao_nbits = 0,
.di = das08_di_rbits,
.do_ = das08_do_wbits,
.do_nchan = 4,
.i8255_offset = 0,
.i8254_offset = 4,
.iosize = 8,
},
#endif /* IS_ENABLED(CONFIG_COMEDI_DAS08_PCI) */
};
#endif /* DO_COMEDI_DRIVER_REGISTER */
#if IS_ENABLED(CONFIG_COMEDI_DAS08_CS)
struct das08_board_struct das08_cs_boards[NUM_DAS08_CS_BOARDS] = {
{
.name = "pcm-das08",
.id = 0x0, /* XXX */
.bustype = pcmcia,
.ai = das08_ai_rinsn,
.ai_nbits = 12,
.ai_pg = das08_bipolar5,
.ai_encoding = das08_pcm_encode12,
.ao = NULL,
.ao_nbits = 0,
.di = das08_di_rbits,
.do_ = das08_do_wbits,
.do_nchan = 3,
.i8255_offset = 0,
.i8254_offset = 0,
.iosize = 16,
},
/* duplicate so driver name can be used also */
{
.name = "das08_cs",
.id = 0x0, /* XXX */
.bustype = pcmcia,
.ai = das08_ai_rinsn,
.ai_nbits = 12,
.ai_pg = das08_bipolar5,
.ai_encoding = das08_pcm_encode12,
.ao = NULL,
.ao_nbits = 0,
.di = das08_di_rbits,
.do_ = das08_do_wbits,
.do_nchan = 3,
.i8255_offset = 0,
.i8254_offset = 0,
.iosize = 16,
},
};
#endif
#if IS_ENABLED(CONFIG_COMEDI_DAS08_PCI)
static DEFINE_PCI_DEVICE_TABLE(das08_pci_table) = {
{ PCI_DEVICE(PCI_VENDOR_ID_COMPUTERBOARDS, PCI_DEVICE_ID_PCIDAS08) },
{0}
};
MODULE_DEVICE_TABLE(pci, das08_pci_table);
#endif
#define devpriv ((struct das08_private_struct *)dev->private)
#define thisboard ((const struct das08_board_struct *)dev->board_ptr)
#define devpriv ((struct das08_private_struct *)dev->private)
#define thisboard ((const struct das08_board_struct *)dev->board_ptr)
#define TIMEOUT 100000
......@@ -710,168 +423,409 @@ static int das08ao_ao_winsn(struct comedi_device *dev,
for (n = 0; n < insn->n; n++) {
#if 0
outb(lsb, dev->iobase + devpriv->ao_offset_lsb[chan]);
outb(msb, dev->iobase + devpriv->ao_offset_msb[chan]);
#else
outb(lsb, dev->iobase + DAS08AO_AO_LSB(chan));
outb(msb, dev->iobase + DAS08AO_AO_MSB(chan));
#endif
/* load DACs */
inb(dev->iobase + DAS08AO_AO_UPDATE);
}
return n;
}
outb(lsb, dev->iobase + devpriv->ao_offset_lsb[chan]);
outb(msb, dev->iobase + devpriv->ao_offset_msb[chan]);
#else
outb(lsb, dev->iobase + DAS08AO_AO_LSB(chan));
outb(msb, dev->iobase + DAS08AO_AO_MSB(chan));
#endif
/* load DACs */
inb(dev->iobase + DAS08AO_AO_UPDATE);
}
return n;
}
#endif
static unsigned int i8254_read_channel_low(unsigned int base, int chan)
{
unsigned int msb, lsb;
/* The following instructions must be in order.
We must avoid other process reading the counter's value in the
middle.
The spin_lock isn't needed since ioctl calls grab the big kernel
lock automatically */
/*spin_lock(sp); */
outb(chan << 6, base + I8254_CTRL);
base += chan;
lsb = inb(base);
msb = inb(base);
/*spin_unlock(sp); */
return lsb | (msb << 8);
}
static void i8254_write_channel_low(unsigned int base, int chan,
unsigned int value)
{
unsigned int msb, lsb;
lsb = value & 0xFF;
msb = value >> 8;
/* write lsb, then msb */
base += chan;
/* See comments in i8254_read_channel_low */
/*spin_lock(sp); */
outb(lsb, base);
outb(msb, base);
/*spin_unlock(sp); */
}
static unsigned int i8254_read_channel(struct i8254_struct *st, int channel)
{
int chan = st->logic2phys[channel];
return i8254_read_channel_low(st->iobase, chan);
}
static void i8254_write_channel(struct i8254_struct *st, int channel,
unsigned int value)
{
int chan = st->logic2phys[channel];
i8254_write_channel_low(st->iobase, chan, value);
}
static void i8254_set_mode_low(unsigned int base, int channel,
unsigned int mode)
{
outb((channel << 6) | 0x30 | (mode & 0x0F), base + I8254_CTRL);
}
static void i8254_set_mode(struct i8254_struct *st, int channel,
unsigned int mode)
{
int chan = st->logic2phys[channel];
st->mode[chan] = mode;
return i8254_set_mode_low(st->iobase, chan, mode);
}
static unsigned int i8254_read_status_low(unsigned int base, int channel)
{
outb(0xE0 | (2 << channel), base + I8254_CTRL);
return inb(base + channel);
}
static unsigned int i8254_read_status(struct i8254_struct *st, int channel)
{
int chan = st->logic2phys[channel];
return i8254_read_status_low(st->iobase, chan);
}
static void i8254_initialize(struct i8254_struct *st)
{
int i;
for (i = 0; i < 3; ++i)
i8254_set_mode_low(st->iobase, i, st->mode[i]);
}
static int das08_counter_read(struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
int chan = insn->chanspec;
/* printk("Reading counter channel %d ",chan); */
data[0] = i8254_read_channel(&devpriv->i8254, chan);
/* printk("=> 0x%08X\n",data[0]); */
return 1;
}
static int das08_counter_write(struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
int chan = insn->chanspec;
/* printk("Writing counter channel %d with 0x%04X\n",chan,data[0]); */
i8254_write_channel(&devpriv->i8254, chan, data[0]);
return 1;
}
static int das08_counter_config(struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
int chan = insn->chanspec;
if (insn->n != 2)
return -EINVAL;
switch (data[0]) {
case INSN_CONFIG_SET_COUNTER_MODE:
i8254_set_mode(&devpriv->i8254, chan, data[1]);
break;
case INSN_CONFIG_8254_READ_STATUS:
data[1] = i8254_read_status(&devpriv->i8254, chan);
break;
default:
return -EINVAL;
break;
}
return 2;
}
#ifdef DO_COMEDI_DRIVER_REGISTER
static const struct das08_board_struct das08_boards[] = {
#if IS_ENABLED(CONFIG_COMEDI_DAS08_ISA)
{
.name = "isa-das08", /* cio-das08.pdf */
.bustype = isa,
.ai = das08_ai_rinsn,
.ai_nbits = 12,
.ai_pg = das08_pg_none,
.ai_encoding = das08_encode12,
.ao = NULL,
.ao_nbits = 12,
.di = das08_di_rbits,
.do_ = das08_do_wbits,
.do_nchan = 4,
.i8255_offset = 8,
.i8254_offset = 4,
.iosize = 16, /* unchecked */
},
{
.name = "das08-pgm", /* cio-das08pgx.pdf */
.bustype = isa,
.ai = das08_ai_rinsn,
.ai_nbits = 12,
.ai_pg = das08_pgm,
.ai_encoding = das08_encode12,
.ao = NULL,
.di = das08_di_rbits,
.do_ = das08_do_wbits,
.do_nchan = 4,
.i8255_offset = 0,
.i8254_offset = 0x04,
.iosize = 16, /* unchecked */
},
{
.name = "das08-pgh", /* cio-das08pgx.pdf */
.bustype = isa,
.ai = das08_ai_rinsn,
.ai_nbits = 12,
.ai_pg = das08_pgh,
.ai_encoding = das08_encode12,
.ao = NULL,
.di = das08_di_rbits,
.do_ = das08_do_wbits,
.do_nchan = 4,
.i8255_offset = 0,
.i8254_offset = 0x04,
.iosize = 16, /* unchecked */
},
{
.name = "das08-pgl", /* cio-das08pgx.pdf */
.bustype = isa,
.ai = das08_ai_rinsn,
.ai_nbits = 12,
.ai_pg = das08_pgl,
.ai_encoding = das08_encode12,
.ao = NULL,
.di = das08_di_rbits,
.do_ = das08_do_wbits,
.do_nchan = 4,
.i8255_offset = 0,
.i8254_offset = 0x04,
.iosize = 16, /* unchecked */
},
{
.name = "das08-aoh", /* cio-das08_aox.pdf */
.bustype = isa,
.ai = das08_ai_rinsn,
.ai_nbits = 12,
.ai_pg = das08_pgh,
.ai_encoding = das08_encode12,
.ao = das08ao_ao_winsn, /* 8 */
.ao_nbits = 12,
.di = das08_di_rbits,
.do_ = das08_do_wbits,
.do_nchan = 4,
.i8255_offset = 0x0c,
.i8254_offset = 0x04,
.iosize = 16, /* unchecked */
},
{
.name = "das08-aol", /* cio-das08_aox.pdf */
.bustype = isa,
.ai = das08_ai_rinsn,
.ai_nbits = 12,
.ai_pg = das08_pgl,
.ai_encoding = das08_encode12,
.ao = das08ao_ao_winsn, /* 8 */
.ao_nbits = 12,
.di = das08_di_rbits,
.do_ = das08_do_wbits,
.do_nchan = 4,
.i8255_offset = 0x0c,
.i8254_offset = 0x04,
.iosize = 16, /* unchecked */
},
{
.name = "das08-aom", /* cio-das08_aox.pdf */
.bustype = isa,
.ai = das08_ai_rinsn,
.ai_nbits = 12,
.ai_pg = das08_pgm,
.ai_encoding = das08_encode12,
.ao = das08ao_ao_winsn, /* 8 */
.ao_nbits = 12,
.di = das08_di_rbits,
.do_ = das08_do_wbits,
.do_nchan = 4,
.i8255_offset = 0x0c,
.i8254_offset = 0x04,
.iosize = 16, /* unchecked */
},
{
.name = "das08/jr-ao", /* cio-das08-jr-ao.pdf */
.bustype = isa,
.ai = das08_ai_rinsn,
.ai_nbits = 12,
.ai_pg = das08_pg_none,
.ai_encoding = das08_encode12,
.ao = das08jr_ao_winsn,
.ao_nbits = 12,
.di = das08jr_di_rbits,
.do_ = das08jr_do_wbits,
.do_nchan = 8,
.i8255_offset = 0,
.i8254_offset = 0,
.iosize = 16, /* unchecked */
},
{
.name = "das08jr-16-ao", /* cio-das08jr-16-ao.pdf */
.bustype = isa,
.ai = das08_ai_rinsn,
.ai_nbits = 16,
.ai_pg = das08_pg_none,
.ai_encoding = das08_encode12,
.ao = das08jr_ao_winsn,
.ao_nbits = 16,
.di = das08jr_di_rbits,
.do_ = das08jr_do_wbits,
.do_nchan = 8,
.i8255_offset = 0,
.i8254_offset = 0x04,
.iosize = 16, /* unchecked */
},
{
.name = "pc104-das08",
.bustype = pc104,
.ai = das08_ai_rinsn,
.ai_nbits = 12,
.ai_pg = das08_pg_none,
.ai_encoding = das08_encode12,
.ao = NULL,
.ao_nbits = 0,
.di = das08_di_rbits,
.do_ = das08_do_wbits,
.do_nchan = 4,
.i8255_offset = 0,
.i8254_offset = 4,
.iosize = 16, /* unchecked */
},
#if 0
{
.name = "das08/f",
},
{
.name = "das08jr",
},
#endif
{
.name = "das08jr/16",
.bustype = isa,
.ai = das08_ai_rinsn,
.ai_nbits = 16,
.ai_pg = das08_pg_none,
.ai_encoding = das08_encode16,
.ao = NULL,
.ao_nbits = 0,
.di = das08jr_di_rbits,
.do_ = das08jr_do_wbits,
.do_nchan = 8,
.i8255_offset = 0,
.i8254_offset = 0,
.iosize = 16, /* unchecked */
},
#if 0
{
.name = "das48-pga", /* cio-das48-pga.pdf */
},
{
.name = "das08-pga-g2", /* a KM board */
},
#endif
#endif /* IS_ENABLED(CONFIG_COMEDI_DAS08_ISA) */
#if IS_ENABLED(CONFIG_COMEDI_DAS08_PCI)
{
.name = "das08", /* pci-das08 */
.id = PCI_DEVICE_ID_PCIDAS08,
.bustype = pci,
.ai = das08_ai_rinsn,
.ai_nbits = 12,
.ai_pg = das08_bipolar5,
.ai_encoding = das08_encode12,
.ao = NULL,
.ao_nbits = 0,
.di = das08_di_rbits,
.do_ = das08_do_wbits,
.do_nchan = 4,
.i8255_offset = 0,
.i8254_offset = 4,
.iosize = 8,
},
#endif /* IS_ENABLED(CONFIG_COMEDI_DAS08_PCI) */
};
#endif /* DO_COMEDI_DRIVER_REGISTER */
static unsigned int i8254_read_channel_low(unsigned int base, int chan)
{
unsigned int msb, lsb;
/* The following instructions must be in order.
We must avoid other process reading the counter's value in the
middle.
The spin_lock isn't needed since ioctl calls grab the big kernel
lock automatically */
/*spin_lock(sp); */
outb(chan << 6, base + I8254_CTRL);
base += chan;
lsb = inb(base);
msb = inb(base);
/*spin_unlock(sp); */
return lsb | (msb << 8);
}
static void i8254_write_channel_low(unsigned int base, int chan,
unsigned int value)
{
unsigned int msb, lsb;
lsb = value & 0xFF;
msb = value >> 8;
/* write lsb, then msb */
base += chan;
/* See comments in i8254_read_channel_low */
/*spin_lock(sp); */
outb(lsb, base);
outb(msb, base);
/*spin_unlock(sp); */
}
static unsigned int i8254_read_channel(struct i8254_struct *st, int channel)
{
int chan = st->logic2phys[channel];
return i8254_read_channel_low(st->iobase, chan);
}
static void i8254_write_channel(struct i8254_struct *st, int channel,
unsigned int value)
{
int chan = st->logic2phys[channel];
i8254_write_channel_low(st->iobase, chan, value);
}
static void i8254_initialize(struct i8254_struct *st)
{
int i;
for (i = 0; i < 3; ++i)
i8254_set_mode_low(st->iobase, i, st->mode[i]);
}
static void i8254_set_mode_low(unsigned int base, int channel,
unsigned int mode)
{
outb((channel << 6) | 0x30 | (mode & 0x0F), base + I8254_CTRL);
}
static void i8254_set_mode(struct i8254_struct *st, int channel,
unsigned int mode)
{
int chan = st->logic2phys[channel];
st->mode[chan] = mode;
return i8254_set_mode_low(st->iobase, chan, mode);
}
static unsigned int i8254_read_status_low(unsigned int base, int channel)
{
outb(0xE0 | (2 << channel), base + I8254_CTRL);
return inb(base + channel);
}
static unsigned int i8254_read_status(struct i8254_struct *st, int channel)
{
int chan = st->logic2phys[channel];
return i8254_read_status_low(st->iobase, chan);
}
static int das08_counter_read(struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
int chan = insn->chanspec;
/* printk("Reading counter channel %d ",chan); */
data[0] = i8254_read_channel(&devpriv->i8254, chan);
/* printk("=> 0x%08X\n",data[0]); */
return 1;
}
static int das08_counter_write(struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
int chan = insn->chanspec;
/* printk("Writing counter channel %d with 0x%04X\n",chan,data[0]); */
i8254_write_channel(&devpriv->i8254, chan, data[0]);
return 1;
}
static int das08_counter_config(struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
int chan = insn->chanspec;
if (insn->n != 2)
return -EINVAL;
switch (data[0]) {
case INSN_CONFIG_SET_COUNTER_MODE:
i8254_set_mode(&devpriv->i8254, chan, data[1]);
break;
case INSN_CONFIG_8254_READ_STATUS:
data[1] = i8254_read_status(&devpriv->i8254, chan);
break;
default:
return -EINVAL;
break;
}
return 2;
}
#ifdef DO_COMEDI_DRIVER_REGISTER
static int das08_attach(struct comedi_device *dev, struct comedi_devconfig *it);
static void das08_detach(struct comedi_device *dev);
static struct comedi_driver das08_driver = {
.driver_name = DRV_NAME,
.module = THIS_MODULE,
.attach = das08_attach,
.detach = das08_detach,
.board_name = &das08_boards[0].name,
.num_names = sizeof(das08_boards) / sizeof(struct das08_board_struct),
.offset = sizeof(struct das08_board_struct),
#if IS_ENABLED(CONFIG_COMEDI_DAS08_CS)
struct das08_board_struct das08_cs_boards[NUM_DAS08_CS_BOARDS] = {
{
.name = "pcm-das08",
.id = 0x0, /* XXX */
.bustype = pcmcia,
.ai = das08_ai_rinsn,
.ai_nbits = 12,
.ai_pg = das08_bipolar5,
.ai_encoding = das08_pcm_encode12,
.ao = NULL,
.ao_nbits = 0,
.di = das08_di_rbits,
.do_ = das08_do_wbits,
.do_nchan = 3,
.i8255_offset = 0,
.i8254_offset = 0,
.iosize = 16,
},
/* duplicate so driver name can be used also */
{
.name = "das08_cs",
.id = 0x0, /* XXX */
.bustype = pcmcia,
.ai = das08_ai_rinsn,
.ai_nbits = 12,
.ai_pg = das08_bipolar5,
.ai_encoding = das08_pcm_encode12,
.ao = NULL,
.ao_nbits = 0,
.di = das08_di_rbits,
.do_ = das08_do_wbits,
.do_nchan = 3,
.i8255_offset = 0,
.i8254_offset = 0,
.iosize = 16,
},
};
EXPORT_SYMBOL_GPL(das08_cs_boards);
#endif
int das08_common_attach(struct comedi_device *dev, unsigned long iobase)
......@@ -1086,7 +1040,26 @@ static void das08_detach(struct comedi_device *dev)
}
#endif /* DO_COMEDI_DRIVER_REGISTER */
#ifdef DO_COMEDI_DRIVER_REGISTER
static struct comedi_driver das08_driver = {
.driver_name = DRV_NAME,
.module = THIS_MODULE,
.attach = das08_attach,
.detach = das08_detach,
.board_name = &das08_boards[0].name,
.num_names = sizeof(das08_boards) / sizeof(struct das08_board_struct),
.offset = sizeof(struct das08_board_struct),
};
#endif
#if IS_ENABLED(CONFIG_COMEDI_DAS08_PCI)
static DEFINE_PCI_DEVICE_TABLE(das08_pci_table) = {
{ PCI_DEVICE(PCI_VENDOR_ID_COMPUTERBOARDS, PCI_DEVICE_ID_PCIDAS08) },
{0}
};
MODULE_DEVICE_TABLE(pci, das08_pci_table);
static int __devinit das08_pci_probe(struct pci_dev *dev,
const struct pci_device_id *ent)
{
......@@ -1126,10 +1099,6 @@ module_init(das08_init);
module_exit(das08_exit);
#endif /* DO_COMEDI_DRIVER_REGISTER */
#if IS_ENABLED(CONFIG_COMEDI_DAS08_CS)
EXPORT_SYMBOL_GPL(das08_cs_boards);
#endif
MODULE_AUTHOR("Comedi http://www.comedi.org");
MODULE_DESCRIPTION("Comedi low-level driver");
MODULE_LICENSE("GPL");
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment