From fea1f1fc7b9ed7ec6928521bb4d3b4cfd9f6161a Mon Sep 17 00:00:00 2001 From: Frank Mori Hess Date: Sat, 23 Jun 2001 21:56:27 +0000 Subject: [PATCH] fixed settings of master clock speed through options --- comedi/drivers/das16.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/comedi/drivers/das16.c b/comedi/drivers/das16.c index 38f95603..1b79cc9c 100644 --- a/comedi/drivers/das16.c +++ b/comedi/drivers/das16.c @@ -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; -- 2.26.2