static inline uint16_t munge_bipolar_sample(const struct comedi_device *dev,
uint16_t sample)
{
- const struct das1800_board *thisboard = dev->board_ptr;
+ const struct das1800_board *board = dev->board_ptr;
- sample += 1 << (thisboard->resolution - 1);
+ sample += 1 << (board->resolution - 1);
return sample;
}
struct comedi_subdevice *s,
struct comedi_cmd *cmd)
{
- const struct das1800_board *thisboard = dev->board_ptr;
+ const struct das1800_board *board = dev->board_ptr;
int err = 0;
unsigned int arg;
if (cmd->convert_src == TRIG_TIMER) {
err |= comedi_check_trigger_arg_min(&cmd->convert_arg,
- thisboard->ai_speed);
+ board->ai_speed);
}
err |= comedi_check_trigger_arg_min(&cmd->chanlist_len, 1);
struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
- const struct das1800_board *thisboard = dev->board_ptr;
+ const struct das1800_board *board = dev->board_ptr;
int i, n;
int chan, range, aref, chan_range;
int timeout = 1000;
dpnt = inw(dev->iobase + DAS1800_FIFO);
/* shift data to offset binary for bipolar ranges */
if ((conv_flags & UB) == 0)
- dpnt += 1 << (thisboard->resolution - 1);
+ dpnt += 1 << (board->resolution - 1);
data[n] = dpnt;
}
exit:
struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
- const struct das1800_board *thisboard = dev->board_ptr;
+ const struct das1800_board *board = dev->board_ptr;
struct das1800_private *devpriv = dev->private;
int chan = CR_CHAN(insn->chanspec);
/* int range = CR_RANGE(insn->chanspec); */
- int update_chan = thisboard->ao_n_chan - 1;
+ int update_chan = board->ao_n_chan - 1;
unsigned short output;
unsigned long irq_flags;
/* card expects two's complement data */
- output = data[0] - (1 << (thisboard->resolution - 1));
+ output = data[0] - (1 << (board->resolution - 1));
/* if the write is to the 'update' channel, we need to remember its value */
if (chan == update_chan)
devpriv->ao_update_bits = output;
static int das1800_attach(struct comedi_device *dev,
struct comedi_devconfig *it)
{
- const struct das1800_board *thisboard;
+ const struct das1800_board *board;
struct das1800_private *devpriv;
struct comedi_subdevice *s;
unsigned int irq = it->options[1];
if (ret)
return ret;
- thisboard = das1800_probe(dev);
- if (!thisboard) {
+ board = das1800_probe(dev);
+ if (!board) {
dev_err(dev->class_dev, "unable to determine board type\n");
return -ENODEV;
}
- dev->board_ptr = thisboard;
- dev->board_name = thisboard->name;
+ dev->board_ptr = board;
+ dev->board_name = board->name;
/* if it is an 'ao' board with fancy analog out then we need extra io ports */
- if (thisboard->ao_ability == 2) {
+ if (board->ao_ability == 2) {
unsigned long iobase2 = dev->iobase + IOBASE2;
ret = __comedi_request_region(dev, iobase2, DAS1800_SIZE);
s = &dev->subdevices[0];
s->type = COMEDI_SUBD_AI;
s->subdev_flags = SDF_READABLE | SDF_DIFF | SDF_GROUND;
- if (thisboard->common)
+ if (board->common)
s->subdev_flags |= SDF_COMMON;
- s->n_chan = thisboard->qram_len;
- s->maxdata = (1 << thisboard->resolution) - 1;
- s->range_table = thisboard->range_ai;
+ s->n_chan = board->qram_len;
+ s->maxdata = (1 << board->resolution) - 1;
+ s->range_table = board->range_ai;
s->insn_read = das1800_ai_rinsn;
if (dev->irq) {
dev->read_subdev = s;
/* analog out */
s = &dev->subdevices[1];
- if (thisboard->ao_ability == 1) {
+ if (board->ao_ability == 1) {
s->type = COMEDI_SUBD_AO;
s->subdev_flags = SDF_WRITABLE;
- s->n_chan = thisboard->ao_n_chan;
- s->maxdata = (1 << thisboard->resolution) - 1;
+ s->n_chan = board->ao_n_chan;
+ s->maxdata = (1 << board->resolution) - 1;
s->range_table = &range_bipolar10;
s->insn_write = das1800_ao_winsn;
} else {
s = &dev->subdevices[3];
s->type = COMEDI_SUBD_DO;
s->subdev_flags = SDF_WRITABLE;
- s->n_chan = thisboard->do_n_chan;
+ s->n_chan = board->do_n_chan;
s->maxdata = 1;
s->range_table = &range_digital;
s->insn_bits = das1800_do_wbits;
outb(0, dev->iobase + DAS1800_DIGITAL);
/* initialize analog out channels */
- if (thisboard->ao_ability == 1) {
+ if (board->ao_ability == 1) {
/* select 'update' dac channel for baseAddress + 0x0 */
- outb(DAC(thisboard->ao_n_chan - 1),
+ outb(DAC(board->ao_n_chan - 1),
dev->iobase + DAS1800_SELECT);
outw(devpriv->ao_update_bits, dev->iobase + DAS1800_DAC);
}