54 #include "../comedidev.h"
62 #define DRV_NAME "das08"
64 #define DO_ISA IS_ENABLED(CONFIG_COMEDI_DAS08_ISA)
65 #define DO_PCI IS_ENABLED(CONFIG_COMEDI_DAS08_PCI)
66 #define DO_COMEDI_DRIVER_REGISTER (DO_ISA || DO_PCI)
68 #define PCI_VENDOR_ID_COMPUTERBOARDS 0x1307
69 #define PCI_DEVICE_ID_PCIDAS08 0x29
70 #define PCIDAS08_SIZE 0x54
74 #define INTR1_ENABLE 0x1
75 #define INTR1_HIGH_POLARITY 0x2
76 #define PCI_INTR_ENABLE 0x40
77 #define INTR1_EDGE_TRIG 0x100
80 #define CNTRL_INTR 0x4
100 #define DAS08_TRIG_12BIT 1
101 #define DAS08_STATUS 2
102 #define DAS08_EOC (1<<7)
103 #define DAS08_IRQ (1<<3)
104 #define DAS08_IP(x) (((x)>>4)&0x7)
105 #define DAS08_CONTROL 2
106 #define DAS08_MUX_MASK 0x7
107 #define DAS08_MUX(x) ((x) & DAS08_MUX_MASK)
108 #define DAS08_INTE (1<<3)
109 #define DAS08_DO_MASK 0xf0
110 #define DAS08_OP(x) (((x) << 4) & DAS08_DO_MASK)
128 #define DAS08JR_DIO 3
129 #define DAS08JR_AO_LSB(x) ((x) ? 6 : 4)
130 #define DAS08JR_AO_MSB(x) ((x) ? 7 : 5)
152 #define DAS08AO_GAIN_CONTROL 3
153 #define DAS08AO_GAIN_STATUS 3
155 #define DAS08AO_AO_LSB(x) ((x) ? 0xa : 8)
156 #define DAS08AO_AO_MSB(x) ((x) ? 0xb : 9)
157 #define DAS08AO_AO_UPDATE 8
217 static const struct comedi_lrange *
const das08_ai_lranges[] = {
225 static const int das08_pgh_gainlist[] = {
226 8, 0, 10, 2, 12, 4, 14, 6, 1, 3, 5, 7
228 static const int das08_pgl_gainlist[] = { 8, 0, 2, 4, 6, 1, 3, 5, 7 };
229 static const int das08_pgm_gainlist[] = { 8, 0, 10, 12, 14, 9, 11, 13, 15 };
231 static const int *
const das08_gainlists[] = {
249 #define TIMEOUT 100000
283 for (n = 0; n < insn->
n; n++) {
292 for (i = 0; i <
TIMEOUT; i++) {
303 data[
n] = (lsb >> 4) | (msb << 4);
305 data[
n] = (msb << 8) + lsb;
309 data[
n] = (1 << 15) | lsb | ((msb & 0x7f) << 8);
311 data[
n] = (1 << 15) - (lsb | (msb & 0x7f) << 8);
341 wbits |= data[0] & data[1];
374 devpriv->
do_bits |= data[0] & data[1];
383 unsigned int chan,
unsigned int data)
391 msb = (data >> 8) & 0xff;
392 if (thisboard->
is_jr) {
413 for (n = 0; n < s->
n_chan; n++)
414 das08_ao_set_data(dev, n, data);
426 for (n = 0; n < insn->
n; n++)
427 das08_ao_set_data(dev, chan, *data);
442 for (n = 0; n < insn->
n; n++)
455 for (i = 0; i < 3; ++
i)
456 i8254_set_mode(i8254_iobase, 0, i, mode);
467 data[0] = i8254_read(i8254_iobase, 0, chan);
479 i8254_write(i8254_iobase, 0, chan, data[0]);
493 i8254_set_mode(i8254_iobase, 0, chan, data[1]);
496 data[1] = i8254_status(i8254_iobase, 0, chan);
505 #if DO_COMEDI_DRIVER_REGISTER
529 .i8254_offset = 0x04,
540 .i8254_offset = 0x04,
551 .i8254_offset = 0x04,
563 .i8255_offset = 0x0c,
564 .i8254_offset = 0x04,
576 .i8255_offset = 0x0c,
577 .i8254_offset = 0x04,
589 .i8255_offset = 0x0c,
590 .i8254_offset = 0x04,
594 .name =
"das08/jr-ao",
606 .name =
"das08jr-16-ao",
615 .i8254_offset = 0x04,
619 .name =
"pc104-das08",
630 .name =
"das08jr/16",
702 das08_ao_initialize(dev, s);
716 thisboard->
is_jr ? das08jr_di_rbits : das08_di_rbits;
730 thisboard->
is_jr ? das08jr_do_wbits : das08_do_wbits;
755 i8254_initialize(dev);
765 das08_find_pci_board(
struct pci_dev *pdev)
767 #if DO_COMEDI_DRIVER_REGISTER
769 for (i = 0; i <
ARRAY_SIZE(das08_boards); i++)
770 if (is_pci_board(&das08_boards[i]) &&
772 return &das08_boards[i];
790 dev->
board_ptr = das08_find_pci_board(pdev);
795 comedi_set_hw_dev(dev, &pdev->
dev);
799 "Error enabling PCI device and requesting regions\n");
821 if (is_pci_board(thisboard)) {
823 "Manual configuration of PCI board '%s' is not supported\n",
826 }
else if (is_isa_board(thisboard)) {
852 if (is_isa_board(thisboard)) {
855 }
else if (is_pci_board(thisboard)) {
856 struct pci_dev *pdev = comedi_to_pci_dev(dev);
864 #if DO_COMEDI_DRIVER_REGISTER
868 .attach = das08_attach,
869 .attach_pci = das08_attach_pci,
870 .detach = das08_detach,
871 .board_name = &das08_boards[0].
name,
899 .probe = &das08_pci_probe,
904 #if DO_COMEDI_DRIVER_REGISTER
911 static int __init das08_init(
void)
916 static void __exit das08_exit(
void)