fixes for 1760: base address index was wrong (from
authorFrank Mori Hess <fmhess@speakeasy.net>
Sat, 14 May 2005 00:06:37 +0000 (00:06 +0000)
committerFrank Mori Hess <fmhess@speakeasy.net>
Sat, 14 May 2005 00:06:37 +0000 (00:06 +0000)
Bill Jennings <comedi@bigriverwireless.net>), and I cleaned up some
dead code and removed broken (and unneeded) pci1760_insn_read_di()

comedi/drivers/adv_pci_dio.c

index fe246aebfcda65ff2e8452ff141c7f54d53375e3..a86b47c78e8662fa78067f869997bc1b3ed8239e 100644 (file)
@@ -295,7 +295,7 @@ static boardtype boardtypes[] =
          { 4, PCI175x_BOARDID, 1, SDF_INTERNAL},
         IO_16b
        },
-       {"pci1760", PCI_VENDOR_ID_ADVANTECH, 0x1760, PCIDIO_MAINREG,
+       {"pci1760", PCI_VENDOR_ID_ADVANTECH, 0x1760, 0,
         TYPE_PCI1760,
         {{ 0, 0, 0, 0}, { 0, 0, 0, 0}},        // This card have own setup work
         {{ 0, 0, 0, 0}, { 0, 0, 0, 0}},
@@ -428,7 +428,7 @@ static int pci_dio_insn_bits_do_w(comedi_device *dev, comedi_subdevice *s,
 /*
 ==============================================================================
 */
-static int pci1760_mbxrequest(comedi_device *dev, comedi_subdevice *s,
+static int pci1760_mbxrequest(comedi_device *dev,
        unsigned char *omb, unsigned char *imb, 
        int repeats)
 {
@@ -470,7 +470,7 @@ static int pci1760_insn_bits_di(comedi_device *dev, comedi_subdevice *s,
                0x00};
        unsigned char imb[4];
        
-       if (!(ret=pci1760_mbxrequest(dev, s, omb, imb, OMBCMD_RETRY)))
+       if (!(ret=pci1760_mbxrequest(dev, omb, imb, OMBCMD_RETRY)))
                return ret;
 
        data[1]=imb[3];
@@ -478,29 +478,6 @@ static int pci1760_insn_bits_di(comedi_device *dev, comedi_subdevice *s,
        return 2;
 }
 
-/*
-==============================================================================
-*/
-static int pci1760_insn_read_di(comedi_device *dev, comedi_subdevice *s, 
-       comedi_insn *insn, lsampl_t *data)
-{
-       int ret, n;
-       unsigned char omb[4]={
-               0x00, 
-               0x00, 
-               CMD_ClearIMB2, 
-               0x00};
-       unsigned char imb[4];
-       
-       for (n=0; n<insn->n; n++) {
-               if (!(ret=pci1760_mbxrequest(dev, s, omb, imb, OMBCMD_RETRY)))
-                       return ret;
-               data[n] = imb[3];
-       }
-
-       return n;
-}
-
 /*
 ==============================================================================
 */
@@ -519,7 +496,7 @@ static int pci1760_insn_bits_do(comedi_device *dev, comedi_subdevice *s,
                s->state &= ~data[0];
                s->state |= (data[0]&data[1]);
                omb[0] = s->state;
-               if (!(ret=pci1760_mbxrequest(dev, s, omb, imb, OMBCMD_RETRY)))
+               if (!(ret=pci1760_mbxrequest(dev, omb, imb, OMBCMD_RETRY)))
                        return ret;
        }
        data[1] = s->state;
@@ -542,7 +519,7 @@ static int pci1760_insn_cnt_read(comedi_device *dev, comedi_subdevice *s,
        unsigned char imb[4];
 
        for (n=0; n<insn->n; n++) {
-               if (!(ret=pci1760_mbxrequest(dev, s, omb, imb, OMBCMD_RETRY)))
+               if (!(ret=pci1760_mbxrequest(dev, omb, imb, OMBCMD_RETRY)))
                        return ret;
                data[n] = (imb[1]<<8) + imb[0];
        }
@@ -567,20 +544,20 @@ static int pci1760_insn_cnt_write(comedi_device *dev, comedi_subdevice *s,
        unsigned char imb[4];
 
        if (devpriv->CntResValue[chan] != (data[0]&0xffff)) { // Set reset value if different
-               if (!(ret=pci1760_mbxrequest(dev, s, omb, imb, OMBCMD_RETRY)))
+               if (!(ret=pci1760_mbxrequest(dev, omb, imb, OMBCMD_RETRY)))
                        return ret;
                devpriv->CntResValue[chan] = data[0]&0xffff;
        }
 
        omb[0] = bitmask;       // reset counter to it reset value
        omb[2] = CMD_ResetIDICounters;
-       if (!(ret=pci1760_mbxrequest(dev, s, omb, imb, OMBCMD_RETRY)))
+       if (!(ret=pci1760_mbxrequest(dev, omb, imb, OMBCMD_RETRY)))
                return ret;
 
        if (!(bitmask & devpriv->IDICntEnable)) {       // start counter if it don't run
                omb[0] = bitmask;
                omb[2] = CMD_EnableIDICounters;
-               if (!(ret=pci1760_mbxrequest(dev, s, omb, imb, OMBCMD_RETRY)))
+               if (!(ret=pci1760_mbxrequest(dev, omb, imb, OMBCMD_RETRY)))
                        return ret;
                devpriv->IDICntEnable |= bitmask;
        }
@@ -604,28 +581,28 @@ static int pci1760_reset(comedi_device *dev)
 
        omb[0] = 0x00;
        omb[2] = CMD_SetRelaysOutput;   // reset relay outputs
-       pci1760_mbxrequest(dev, NULL, omb, imb, OMBCMD_RETRY);
+       pci1760_mbxrequest(dev, omb, imb, OMBCMD_RETRY);
        
        omb[0] = 0x00;
        omb[2] = CMD_EnableIDICounters; // disable IDI up counters
-       pci1760_mbxrequest(dev, NULL, omb, imb, OMBCMD_RETRY);
+       pci1760_mbxrequest(dev, omb, imb, OMBCMD_RETRY);
        devpriv->IDICntEnable = 0;
 
        omb[0] = 0x00;
        omb[2] = CMD_OverflowIDICounters;       // disable counters overflow interrupts
-       pci1760_mbxrequest(dev, NULL, omb, imb, OMBCMD_RETRY);
+       pci1760_mbxrequest(dev, omb, imb, OMBCMD_RETRY);
        devpriv->IDICntOverEnable = 0;
 
        omb[0] = 0x00;
        omb[2] = CMD_MatchIntIDICounters;       // disable counters match value interrupts
-       pci1760_mbxrequest(dev, NULL, omb, imb, OMBCMD_RETRY);
+       pci1760_mbxrequest(dev, omb, imb, OMBCMD_RETRY);
        devpriv->IDICntMatchEnable = 0;
 
        omb[0] = 0x00;
        omb[1] = 0x80;
        for (i=0; i<8; i++) {   // set IDI up counters match value
                omb[2] = CMD_SetIDI0CntMatchValue+i;
-               pci1760_mbxrequest(dev, NULL, omb, imb, OMBCMD_RETRY);
+               pci1760_mbxrequest(dev, omb, imb, OMBCMD_RETRY);
                devpriv->CntMatchValue[i] = 0x8000;
        }
 
@@ -633,32 +610,32 @@ static int pci1760_reset(comedi_device *dev)
        omb[1] = 0x00;
        for (i=0; i<8; i++) {   // set IDI up counters reset value
                omb[2] = CMD_SetIDI0CntResetValue+i;
-               pci1760_mbxrequest(dev, NULL, omb, imb, OMBCMD_RETRY);
+               pci1760_mbxrequest(dev, omb, imb, OMBCMD_RETRY);
                devpriv->CntResValue[i] = 0x0000;
        }
        
        omb[0] = 0xff;
        omb[2] = CMD_ResetIDICounters;  // reset IDI up counters to reset values
-       pci1760_mbxrequest(dev, NULL, omb, imb, OMBCMD_RETRY);
+       pci1760_mbxrequest(dev, omb, imb, OMBCMD_RETRY);
 
        omb[0] = 0x00;
        omb[2] = CMD_EdgeIDICounters;   // set IDI up counters count edge
-       pci1760_mbxrequest(dev, NULL, omb, imb, OMBCMD_RETRY);
+       pci1760_mbxrequest(dev, omb, imb, OMBCMD_RETRY);
        devpriv->IDICntEdge = 0x00;
 
        omb[0] = 0x00;
        omb[2] = CMD_EnableIDIFilters;  // disable all digital in filters
-       pci1760_mbxrequest(dev, NULL, omb, imb, OMBCMD_RETRY);
+       pci1760_mbxrequest(dev, omb, imb, OMBCMD_RETRY);
        devpriv->IDIFiltersEn = 0x00;
 
        omb[0] = 0x00;
        omb[2] = CMD_EnableIDIPatternMatch;     // disable pattern matching
-       pci1760_mbxrequest(dev, NULL, omb, imb, OMBCMD_RETRY);
+       pci1760_mbxrequest(dev, omb, imb, OMBCMD_RETRY);
        devpriv->IDIPatMatchEn = 0x00;
 
        omb[0] = 0x00;
        omb[2] = CMD_SetIDIPatternMatch;        // set pattern match value
-       pci1760_mbxrequest(dev, NULL, omb, imb, OMBCMD_RETRY);
+       pci1760_mbxrequest(dev, omb, imb, OMBCMD_RETRY);
        devpriv->IDIPatMatchValue = 0x00;
 
        return 0;
@@ -753,8 +730,6 @@ static int pci1760_attach(comedi_device *dev, comedi_devconfig *it)
        s->maxdata = 1;
        s->len_chanlist = 8;
        s->range_table = &range_digital;
-       s->io_bits=0;           /* all bits input */
-       s->insn_read=pci1760_insn_read_di;
        s->insn_bits=pci1760_insn_bits_di;
        subdev++;       
 
@@ -765,7 +740,6 @@ static int pci1760_attach(comedi_device *dev, comedi_devconfig *it)
        s->maxdata = 1;
        s->len_chanlist = 8;
        s->range_table = &range_digital;
-       s->io_bits=255; /* all bits output */
        s->state=0;
        s->insn_bits=pci1760_insn_bits_do;
        subdev++;       
@@ -806,7 +780,6 @@ static int pci_dio_add_di(comedi_device *dev, comedi_subdevice *s,
        s->maxdata = 1;
        s->len_chanlist = d->chans;
        s->range_table = &range_digital;
-       s->io_bits=0;           /* all bits input */
        switch (this_board->io_access) {
        case IO_8b:
                s->insn_bits=pci_dio_insn_bits_di_b;
@@ -833,7 +806,6 @@ static int pci_dio_add_do(comedi_device *dev, comedi_subdevice *s,
        s->maxdata = 1;
        s->len_chanlist = d->chans;
        s->range_table = &range_digital;
-       s->io_bits=(1 << d->chans)-1;   /* all bits output */
        s->state=0;
        switch (this_board->io_access) {
        case IO_8b: