fixed settings of master clock speed through options
authorFrank Mori Hess <fmhess@speakeasy.net>
Sat, 23 Jun 2001 21:56:27 +0000 (21:56 +0000)
committerFrank Mori Hess <fmhess@speakeasy.net>
Sat, 23 Jun 2001 21:56:27 +0000 (21:56 +0000)
comedi/drivers/das16.c

index 38f95603a8cd93641bf4ef1029b54e55060707ae..1b79cc9c1d2d06a8c5b371960395813db302ed44 100644 (file)
@@ -931,15 +931,15 @@ static int das16_probe(comedi_device *dev, comedi_devconfig *it)
        case 0x80:
                printk(" das16 or das16/f");
                /* only difference is speed, so not an issue yet */
-               if(it->options[4])
-                       devpriv->clockbase = it->options[4];
+               if(it->options[3])
+                       devpriv->clockbase = 1000 / it->options[3];
                else
                        devpriv->clockbase = 1000;      // 1 MHz default
                return das16_board_das16;
        case 0x00:
                printk(" das16jr or das16/330");
-               if(it->options[4])
-                       devpriv->clockbase = it->options[4];
+               if(it->options[3])
+                       devpriv->clockbase = 1000 / it->options[3];
                else
                        devpriv->clockbase = 1000;      // 1 MHz default
                /* the 330 has ao, 16jr does not */
@@ -1014,7 +1014,7 @@ static int das1600_mode_detect(comedi_device *dev)
  *   0  I/O base
  *   1  IRQ
  *   2  DMA
- *   3  Clock speed
+ *   3  Clock speed (in MHz)
  */
 
 static int das16_attach(comedi_device *dev, comedi_devconfig *it)
@@ -1029,6 +1029,18 @@ static int das16_attach(comedi_device *dev, comedi_devconfig *it)
 
        printk("comedi%d: das16:",dev->minor);
 
+       // check that clock setting is valid
+       if(it->options[3])
+       {
+               if(it->options[3] != 0 &&
+                       it->options[3] != 1 &&
+                       it->options[3] != 10)
+               {
+                       printk("\n Invalid option.  Master clock must be set to 1 or 10 (MHz)\n");
+                       return -EINVAL;
+               }
+       }
+
        if((ret=alloc_private(dev,sizeof(struct das16_private_struct)))<0)
                return ret;