From 683f29f87c6dba65337844d843d6ca36d15487d1 Mon Sep 17 00:00:00 2001 From: Frank Mori Hess Date: Wed, 20 Aug 2003 22:35:34 +0000 Subject: [PATCH] fix delays --- comedi/drivers/rti800.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/comedi/drivers/rti800.c b/comedi/drivers/rti800.c index b5ffc064..af806518 100644 --- a/comedi/drivers/rti800.c +++ b/comedi/drivers/rti800.c @@ -163,7 +163,7 @@ typedef struct { #define devpriv ((rti800_private *)dev->private) -#define RTI800_TIMEOUT 10 +#define RTI800_TIMEOUT 100 static irqreturn_t rti800_interrupt(int irq, void *dev, struct pt_regs *regs) { @@ -186,9 +186,16 @@ static int rti800_ai_insn_read(comedi_device *dev,comedi_subdevice *s, outb(chan | (gain << 5), dev->iobase + RTI800_MUXGAIN); + /* without a delay here, you the RTI_OVERRUN bit + * gets set, and you will have an error. Not + * sure if this is a long enough delay though. + * comedi_udelay( gaindelay[ gain ] ) definitely + * works */ + comedi_udelay(1); + for(i=0;in;i++){ outb(0, dev->iobase + RTI800_CONVERT); - for (t = RTI800_TIMEOUT; t; t--) { + for (t = RTI800_TIMEOUT; t; t--) { status=inb(dev->iobase+RTI800_CSR); if(status & RTI800_OVERRUN){ rt_printk("rti800: a/d overrun\n"); @@ -196,7 +203,7 @@ static int rti800_ai_insn_read(comedi_device *dev,comedi_subdevice *s, return -EIO; } if (status & RTI800_DONE)break; - //comedi_udelay(8); + comedi_udelay(1); } if(t == 0){ rt_printk("rti800: timeout\n"); -- 2.26.2