Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/pci Scale the drain timeout for allowing auto-initia...



details:   https://anonhg.NetBSD.org/src/rev/16fef8544ab7
branches:  trunk
changeset: 483987:16fef8544ab7
user:      kleink <kleink%NetBSD.org@localhost>
date:      Wed Mar 22 14:37:43 2000 +0000

description:
Scale the drain timeout for allowing auto-initialize DMA to complete.

diffstat:

 sys/dev/pci/eso.c    |  18 ++++++++++++++----
 sys/dev/pci/esovar.h |   8 ++++++--
 2 files changed, 20 insertions(+), 6 deletions(-)

diffs (79 lines):

diff -r 4a203398aaa1 -r 16fef8544ab7 sys/dev/pci/eso.c
--- a/sys/dev/pci/eso.c Wed Mar 22 14:36:35 2000 +0000
+++ b/sys/dev/pci/eso.c Wed Mar 22 14:37:43 2000 +0000
@@ -1,7 +1,7 @@
-/*     $NetBSD: eso.c,v 1.17 2000/01/18 04:48:47 cjs Exp $     */
+/*     $NetBSD: eso.c,v 1.18 2000/03/22 14:37:43 kleink Exp $  */
 
 /*
- * Copyright (c) 1999 Klaus J. Klein
+ * Copyright (c) 1999, 2000 Klaus J. Klein
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -823,7 +823,7 @@
            ESO_IO_A2DMAM_DMAENB);
 
        sc->sc_pintr = NULL;
-       error = tsleep(&sc->sc_pintr, PCATCH | PWAIT, "esoho", hz);
+       error = tsleep(&sc->sc_pintr, PCATCH | PWAIT, "esoho", sc->sc_pdrain);
        splx(s);
        
        /* Shut down DMA completely. */
@@ -851,7 +851,7 @@
            DMA37MD_WRITE | DMA37MD_DEMAND);
 
        sc->sc_rintr = NULL;
-       error = tsleep(&sc->sc_rintr, PCATCH | PWAIT, "esohi", hz);
+       error = tsleep(&sc->sc_rintr, PCATCH | PWAIT, "esohi", sc->sc_rdrain);
        splx(s);
 
        /* Shut down DMA completely. */
@@ -1662,6 +1662,11 @@
        sc->sc_pintr = intr;
        sc->sc_parg = arg;
 
+       /* Compute drain timeout. */
+       sc->sc_pdrain = (blksize * NBBY * hz) / 
+           (param->sample_rate * param->channels *
+            param->precision * param->factor) + 2;     /* slop */
+
        /* DMA transfer count (in `words'!) reload using 2's complement. */
        blksize = -(blksize >> 1);
        eso_write_mixreg(sc, ESO_MIXREG_A2TCRLO, blksize & 0xff);
@@ -1744,6 +1749,11 @@
        sc->sc_rintr = intr;
        sc->sc_rarg = arg;
 
+       /* Compute drain timeout. */
+       sc->sc_rdrain = (blksize * NBBY * hz) / 
+           (param->sample_rate * param->channels *
+            param->precision * param->factor) + 2;     /* slop */
+
        /* Set up ADC DMA converter parameters. */
        actl = eso_read_ctlreg(sc, ESO_CTLREG_ACTL);
        if (param->channels == 2) {
diff -r 4a203398aaa1 -r 16fef8544ab7 sys/dev/pci/esovar.h
--- a/sys/dev/pci/esovar.h      Wed Mar 22 14:36:35 2000 +0000
+++ b/sys/dev/pci/esovar.h      Wed Mar 22 14:37:43 2000 +0000
@@ -1,7 +1,7 @@
-/*     $NetBSD: esovar.h,v 1.3 1999/11/02 12:11:43 kleink Exp $        */
+/*     $NetBSD: esovar.h,v 1.4 2000/03/22 14:37:43 kleink Exp $        */
 
 /*
- * Copyright (c) 1999 Klaus J. Klein
+ * Copyright (c) 1999, 2000 Klaus J. Klein
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -123,6 +123,10 @@
        void                    (*sc_rintr) __P((void *));
        void *                  sc_rarg;
 
+       /* Auto-initialize DMA transfer block drain timeouts, in ticks */
+       int                     sc_pdrain;
+       int                     sc_rdrain;
+
        /* Audio 2 state */
        uint8_t                 sc_a2c2;        /* Audio 2 Control 2 */
        



Home | Main Index | Thread Index | Old Index