compile fixes and warning fixes
authorDavid Schleef <ds@schleef.org>
Thu, 21 Nov 2002 08:00:10 +0000 (08:00 +0000)
committerDavid Schleef <ds@schleef.org>
Thu, 21 Nov 2002 08:00:10 +0000 (08:00 +0000)
comedi/drivers/cb_pcimdas.c

index ede9f2dc7ba90304257c25a530b5fd087a0da202..cc6ef29daeec3edf47ff4e5fef29762a01d61ac1 100644 (file)
@@ -43,11 +43,12 @@ See http://www.measurementcomputing.com/PDFManuals/pcim-das1602_16.pdf for more
 #include <linux/comedidev.h>
 
 #include <linux/pci.h>
+#include <linux/delay.h>
 
 #include "plx9052.h"
 
 //#define CBPCIMDAS_DEBUG
-#undefine CBPCIMDAS_DEBUG
+#undef CBPCIMDAS_DEBUG
 
 /* Registers for the PCIM-DAS1602/16 */
 
@@ -208,9 +209,6 @@ static int cb_pcimdas_dio_insn_bits(comedi_device *dev,comedi_subdevice *s,
        comedi_insn *insn,lsampl_t *data);
 static int cb_pcimdas_dio_insn_config(comedi_device *dev,comedi_subdevice *s,
        comedi_insn *insn,lsampl_t *data);
-static int cb_pcimdas_ai_cmdtest(comedi_device *dev,comedi_subdevice *s,
-       comedi_cmd *cmd);
-static int cb_pcimdas_ns_to_timer(unsigned int *ns,int round);
 
 /*
  * Attach is called by the Comedi core to configure the driver
@@ -223,9 +221,10 @@ static int cb_pcimdas_attach(comedi_device *dev,comedi_devconfig *it)
        comedi_subdevice *s;
        struct pci_dev* pcidev;
        int index;
-       unsigned long BADR0, BADR1, BADR2, BADR3, BADR4;
+       //unsigned long BADR0;
+       unsigned long BADR1, BADR2, BADR3, BADR4;
        int err;
-       int i;
+       //int i;
 
        printk("comedi%d: cb_pcimdas: ",dev->minor);    
 
@@ -503,143 +502,6 @@ static int cb_pcimdas_ai_rinsn(comedi_device *dev,comedi_subdevice *s,comedi_ins
        return n;
 }
 
-static int cb_pcimdas_ai_cmdtest(comedi_device *dev,comedi_subdevice *s,
-       comedi_cmd *cmd)
-{
-       int err=0;
-       int tmp;
-
-       /* cmdtest tests a particular command to see if it is valid.
-        * Using the cmdtest ioctl, a user can create a valid cmd
-        * and then have it executes by the cmd ioctl.
-        *
-        * cmdtest returns 1,2,3,4 or 0, depending on which tests
-        * the command passes. */
-
-       /* step 1: make sure trigger sources are trivially valid */
-
-       tmp=cmd->start_src;
-       cmd->start_src &= TRIG_NOW;
-       if(!cmd->start_src || tmp!=cmd->start_src)err++;
-
-       tmp=cmd->scan_begin_src;
-       cmd->scan_begin_src &= TRIG_TIMER|TRIG_EXT;
-       if(!cmd->scan_begin_src || tmp!=cmd->scan_begin_src)err++;
-
-       tmp=cmd->convert_src;
-       cmd->convert_src &= TRIG_TIMER|TRIG_EXT;
-       if(!cmd->convert_src || tmp!=cmd->convert_src)err++;
-
-       tmp=cmd->scan_end_src;
-       cmd->scan_end_src &= TRIG_COUNT;
-       if(!cmd->scan_end_src || tmp!=cmd->scan_end_src)err++;
-
-       tmp=cmd->stop_src;
-       cmd->stop_src &= TRIG_COUNT|TRIG_NONE;
-       if(!cmd->stop_src || tmp!=cmd->stop_src)err++;
-
-       if(err)return 1;
-
-       /* step 2: make sure trigger sources are unique and mutually compatible */
-
-       /* note that mutual compatiblity is not an issue here */
-       if(cmd->scan_begin_src!=TRIG_TIMER &&
-          cmd->scan_begin_src!=TRIG_EXT)err++;
-       if(cmd->convert_src!=TRIG_TIMER &&
-          cmd->convert_src!=TRIG_EXT)err++;
-       if(cmd->stop_src!=TRIG_COUNT &&
-          cmd->stop_src!=TRIG_NONE)err++;
-
-       if(err)return 2;
-
-       /* step 3: make sure arguments are trivially compatible */
-
-       if(cmd->start_arg!=0){
-               cmd->start_arg=0;
-               err++;
-       }
-
-#define MAX_SPEED      10000           /* in nanoseconds */
-#define MIN_SPEED      1000000000      /* in nanoseconds */
-
-       if(cmd->scan_begin_src==TRIG_TIMER){
-               if(cmd->scan_begin_arg<MAX_SPEED){
-                       cmd->scan_begin_arg=MAX_SPEED;
-                       err++;
-               }
-               if(cmd->scan_begin_arg>MIN_SPEED){
-                       cmd->scan_begin_arg=MIN_SPEED;
-                       err++;
-               }
-       }else{
-               /* external trigger */
-               /* should be level/edge, hi/lo specification here */
-               /* should specify multiple external triggers */
-               if(cmd->scan_begin_arg>9){
-                       cmd->scan_begin_arg=9;
-                       err++;
-               }
-       }
-       if(cmd->convert_src==TRIG_TIMER){
-               if(cmd->convert_arg<MAX_SPEED){
-                       cmd->convert_arg=MAX_SPEED;
-                       err++;
-               }
-               if(cmd->convert_arg>MIN_SPEED){
-                       cmd->convert_arg=MIN_SPEED;
-                       err++;
-               }
-       }else{
-               /* external trigger */
-               /* see above */
-               if(cmd->convert_arg>9){
-                       cmd->convert_arg=9;
-                       err++;
-               }
-       }
-
-       if(cmd->scan_end_arg!=cmd->chanlist_len){
-               cmd->scan_end_arg=cmd->chanlist_len;
-               err++;
-       }
-       if(cmd->stop_src==TRIG_COUNT){
-               if(cmd->stop_arg>0x00ffffff){
-                       cmd->stop_arg=0x00ffffff;
-                       err++;
-               }
-       }else{
-               /* TRIG_NONE */
-               if(cmd->stop_arg!=0){
-                       cmd->stop_arg=0;
-                       err++;
-               }
-       }
-
-       if(err)return 3;
-
-       /* step 4: fix up any arguments */
-
-       if(cmd->scan_begin_src==TRIG_TIMER){
-               tmp=cmd->scan_begin_arg;
-               cb_pcimdas_ns_to_timer(&cmd->scan_begin_arg,cmd->flags&TRIG_ROUND_MASK);
-               if(tmp!=cmd->scan_begin_arg)err++;
-       }
-       if(cmd->convert_src==TRIG_TIMER){
-               tmp=cmd->convert_arg;
-               cb_pcimdas_ns_to_timer(&cmd->convert_arg,cmd->flags&TRIG_ROUND_MASK);
-               if(tmp!=cmd->convert_arg)err++;
-               if(cmd->scan_begin_src==TRIG_TIMER &&
-                 cmd->scan_begin_arg<cmd->convert_arg*cmd->scan_end_arg){
-                       cmd->scan_begin_arg=cmd->convert_arg*cmd->scan_end_arg;
-                       err++;
-               }
-       }
-
-       if(err)return 4;
-
-       return 0;
-}
-
 
 static int cb_pcimdas_ao_winsn(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data)
 {