83 #include "../comedidev.h"
85 #define PCI20000_ID 0x1d
86 #define PCI20341_ID 0x77
87 #define PCI20006_ID 0xe3
88 #define PCI20xxx_EMPTY_ID 0xff
90 #define PCI20000_OFFSET 0x100
91 #define PCI20000_MODULES 3
93 #define PCI20000_DIO_0 0x80
94 #define PCI20000_DIO_1 0x81
95 #define PCI20000_DIO_2 0xc0
96 #define PCI20000_DIO_3 0xc1
97 #define PCI20000_DIO_CONTROL_01 0x83
98 #define PCI20000_DIO_CONTROL_23 0xc3
99 #define PCI20000_DIO_BUFFER 0x82
100 #define PCI20000_DIO_EOC 0xef
101 #define PCI20000_DIO_OOC 0xfd
102 #define PCI20000_DIO_EIC 0x90
103 #define PCI20000_DIO_OIC 0x82
104 #define DIO_CAND 0x12
108 #define DIO_PS_0 0x00
109 #define DIO_PS_1 0x01
110 #define DIO_PS_2 0x04
111 #define DIO_PS_3 0x05
113 #define PCI20006_LCHAN0 0x0d
114 #define PCI20006_STROBE0 0x0b
115 #define PCI20006_LCHAN1 0x15
116 #define PCI20006_STROBE1 0x13
118 #define PCI20341_INIT 0x04
119 #define PCI20341_REPMODE 0x00
120 #define PCI20341_PACER 0x00
121 #define PCI20341_CHAN_NR 0x04
122 #define PCI20341_CONFIG_REG 0x10
123 #define PCI20341_MOD_STATUS 0x01
124 #define PCI20341_OPT_REG 0x11
125 #define PCI20341_SET_TIME_REG 0x15
126 #define PCI20341_LCHAN_ADDR_REG 0x13
127 #define PCI20341_CHAN_LIST 0x80
128 #define PCI20341_CC_RESET 0x1b
129 #define PCI20341_CHAN_RESET 0x19
130 #define PCI20341_SOFT_PACER 0x04
131 #define PCI20341_STATUS_REG 0x12
132 #define PCI20341_LDATA 0x02
133 #define PCI20341_DAISY_CHAIN 0x20
134 #define PCI20341_MUX 0x04
135 #define PCI20341_SCANLIST 0x80
159 #define devpriv ((struct pci20xxx_private *)dev->private)
160 #define CHAN (CR_CHAN(it->chanlist[0]))
219 " C-2A Carrier Board at base=0x%p not found !\n",
223 printk(
KERN_INFO "comedi%d: ii_pci20kc: PCI-20001 C-2A at base=0x%p\n",
235 pci20006_init(dev, s, it->
options[2 * i + 2],
238 "ii_pci20kc PCI-20006 module in slot %d\n",
244 pci20341_init(dev, s, it->
options[2 * i + 2],
247 "ii_pci20kc PCI-20341 module in slot %d\n",
252 "code 0x%02x in slot %d: module disabled\n",
262 pci20xxx_dio_init(dev, &dev->
subdevices[PCI20000_MODULES]);
292 if (opt0 < 0 || opt0 > 2)
294 if (opt1 < 0 || opt1 > 2)
297 sdp->
pci20006.ao_range_list[0] = pci20006_range_list[opt0];
298 sdp->
pci20006.ao_range_list[1] = pci20006_range_list[opt1];
329 unsigned int boarddata;
332 boarddata = (((
unsigned int)data[0] + 0x8000) & 0xffff);
334 lo = (boarddata & 0xff);
335 hi = ((boarddata >> 8) & 0xff);
350 " comedi%d: pci20xxx: ao channel Error!\n", dev->
minor);
363 static const int pci20341_timebase[] = { 0x00, 0x00, 0x00, 0x04 };
364 static const int pci20341_settling_time[] = { 0x58, 0x58, 0x93, 0x99 };
381 static const struct comedi_lrange *
const pci20341_ranges[] = {
395 if (opt0 < 0 || opt0 > 3)
397 sdp->
pci20341.timebase = pci20341_timebase[opt0];
398 sdp->
pci20341.settling_time = pci20341_settling_time[opt0];
430 unsigned int i = 0,
j = 0;
434 unsigned int boarddata;
449 for (i = 0; i < insn->
n; i++) {
460 while ((eoc < 0x80) &&
j < 100) {
466 "comedi%d: pci20xxx: "
467 "AI interrupt channel %i polling exit !\n",
473 boarddata = lo + 0x100 * hi;
476 data[
i] = (
short)((boarddata + 0x8000) & 0xffff);
489 static int pci20xxx_dio_insn_config(
struct comedi_device *dev,
510 pci20xxx_dio_config(dev, s);
515 static int pci20xxx_dio_insn_config(
struct comedi_device *dev,
523 if (mask & 0x000000ff)
525 else if (mask & 0x0000ff00)
527 else if (mask & 0x00ff0000)
535 pci20xxx_dio_config(dev, s);
544 unsigned int mask = data[0];
547 s->
state |= (mask & data[1]);
550 if (mask & 0x000000ff)
553 if (mask & 0x0000ff00)
556 if (mask & 0x00ff0000)
559 if (mask & 0xff000000)
574 unsigned char control_01;
575 unsigned char control_23;
657 .driver_name =
"ii_pci20kc",
659 .attach = pci20xxx_attach,
660 .detach = pci20xxx_detach,