dma is no longer disabled in das1800 driver when rt suppport is configured
authorFrank Mori Hess <fmhess@speakeasy.net>
Fri, 22 Jun 2001 15:50:42 +0000 (15:50 +0000)
committerFrank Mori Hess <fmhess@speakeasy.net>
Fri, 22 Jun 2001 15:50:42 +0000 (15:50 +0000)
for comedi.  dma is instead disabled on a cmd by cmd basis when the TRIG_RT
flag is received.

Documentation/comedi/drivers.txt
comedi/drivers/das1800.c

index ec6dd1a8111d71b0690e269daab58cb8d9c75586..8f22f213fce5b665a4ab863629ae98c24a2ce398 100644 (file)
@@ -333,8 +333,7 @@ Device Names: das-1701st, das-1701st-da, das-1701ao, das-1702st,
   das-1802hr, das-1802hr-da, das-1802hc, das-1802ao
 Status: works
 
-Presently, DMA is disabled if you enable hard real-time support for
-Comedi.  The waveform analog output on the 'ao' cards is not supported.
+The waveform analog output on the 'ao' cards is not supported.
 If you need it, send me (Frank Hess) an email.
 
 Configuration options:
index a920c2b88f88ce3a1e03d9d3f18d9f8c4bf9135a..bbf456c7714bcf95cb05ca1ab11585e97f20abc7 100644 (file)
@@ -69,8 +69,6 @@ at least 1 and no more than 0x10000 == 65536
 NOTES:
 Only the DAS-1801ST has been tested by me.
 Unipolar and bipolar ranges cannot be mixed in the channel/gain list.
-For safety reasons, the driver disables dma transfers if you enable
-       real-time support in comedi.
 
 TODO:
        Add support for analog out on 'ao' cards.
@@ -498,21 +496,11 @@ static int das1800_attach(comedi_device *dev, comedi_devconfig *it)
        unsigned long flags;
        int iobase = it->options[0];
        int irq = it->options[1];
-       int dma0, dma1;
+       int dma0 = it->options[2];
+       int dma1 = it->options[3];
        int iobase2;
        int board;
 
-// disable unsafe isa dma if comedi real time kernel support is on
-#ifdef CONFIG_COMEDI_RT
-       dma0 = 0;
-       dma1 = 0;
-       if(it->options[2] || it->options[3])
-               printk("%s: dma disabled to avoid conflicts with RT support\n", driver_das1800.driver_name);
-#else
-       dma0 = it->options[2];
-       dma1 = it->options[3];
-#endif
-
        /* allocate and initialize dev->private */
        if(alloc_private(dev, sizeof(das1800_private)) < 0)
                return -ENOMEM;
@@ -1472,20 +1460,25 @@ static int das1800_ai_do_cmd(comedi_device *dev, comedi_subdevice *s)
                return -1;
        }
 
+       /* disable dma on TRIG_WAKE_EOS (to reduce latency) or TRIG_RT
+        * (because dma in handler is unsafe at hard real-time priority) */
+       if(cmd.flags & (TRIG_WAKE_EOS | TRIG_RT))
+       {
+               devpriv->irq_dma_bits &= ~DMA_ENABLED;
+       }else
+       {
+               devpriv->irq_dma_bits |= devpriv->dma_bits;
+       }
+       // interrupt on end of conversion for TRIG_WAKE_EOS
        if(cmd.flags & TRIG_WAKE_EOS)
        {
                // interrupt fifo not empty
                devpriv->irq_dma_bits &= ~FIMD;
-               // turn off dma
-               devpriv->irq_dma_bits &= ~DMA_ENABLED;
        }else
        {
                // interrupt fifo half full
                devpriv->irq_dma_bits |= FIMD;
-               // turn on dma if configured
-               devpriv->irq_dma_bits |= devpriv->dma_bits;
        }
-
        // determine how many conversions we need
        if(cmd.stop_src == TRIG_COUNT)
        {