/* overriding the 8255 insn config */ static int subdev_3724_insn_config(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { unsigned int chan = CR_CHAN(insn->chanspec); unsigned int mask; int ret; if (chan < 8) mask = 0x0000ff; else if (chan < 16) mask = 0x00ff00; else if (chan < 20) mask = 0x0f0000; else mask = 0xf00000; ret = comedi_dio_insn_config(dev, s, insn, data, mask); if (ret) return ret; do_3724_config(dev, s, insn->chanspec); enable_chan(dev, s, insn->chanspec); return insn->n; }
static int daq700_dio_insn_config(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { int ret; ret = comedi_dio_insn_config(dev, s, insn, data, 0); if (ret) return ret; /* The DIO channels are not configurable, fix the io_bits */ s->io_bits = 0x00ff; return insn->n; }
static int usbduxsigma_dio_insn_config(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { int ret; ret = comedi_dio_insn_config(dev, s, insn, data, 0); if (ret) return ret; /* * We don't tell the firmware here as it would take 8 frames * to submit the information. We do it in the (*insn_bits). */ return insn->n; }
static int dnp_dio_insn_config(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { unsigned int chan = CR_CHAN(insn->chanspec); unsigned int mask; unsigned int val; int ret; ret = comedi_dio_insn_config(dev, s, insn, data, 0); if (ret) return ret; if (chan < 8) { /* Port A */ mask = 1 << chan; outb(PAMR, CSCIR); } else if (chan < 16) { /* Port B */ mask = 1 << (chan - 8); outb(PBMR, CSCIR); } else { /* Port C */ /* * We have to pay attention with port C. * This is the meaning of PCMR: * Bit in PCMR: 7 6 5 4 3 2 1 0 * Corresponding port C pin: d 3 d 2 d 1 d 0 d= don't touch * * Multiplication by 2 brings bits into correct position * for PCMR! */ mask = 1 << ((chan - 16) * 2); outb(PCMR, CSCIR); } val = inb(CSCDR); if (data[0] == COMEDI_OUTPUT) val |= mask; else val &= ~mask; outb(val, CSCDR); return insn->n; }
static int parport_data_reg_insn_config(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { unsigned int ctrl; int ret; ret = comedi_dio_insn_config(dev, s, insn, data, 0xff); if (ret) return ret; ctrl = inb(dev->iobase + PARPORT_CTRL_REG); if (s->io_bits) ctrl &= ~PARPORT_CTRL_BIDIR_ENA; else ctrl |= PARPORT_CTRL_BIDIR_ENA; outb(ctrl, dev->iobase + PARPORT_CTRL_REG); return insn->n; }