Subject: kern/10029: missing software coding functionality in MI audio driver
To: None <gnats-bugs@gnats.netbsd.org>
From: None <g.mcgarry@ieee.org>
List: netbsd-bugs
Date: 05/01/2000 15:12:11
>Number:         10029
>Category:       kern
>Synopsis:       missing software coding functionality in MI audio driver
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon May 01 15:13:00 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator:     Gregory McGarry
>Release:        1.4X
>Organization:
>Environment:
NetBSD/pmax
>Description:
The functionality in the MI audio driver for software coding is
incomplete.  It is required to by turbochannel audio driver.
>How-To-Repeat:


>Fix:
*** audio.c.orig        Thu Jan 20 12:21:17 2000
--- audio.c     Thu Jan 20 12:28:10 2000
***************
*** 1,4 ****
! /*    $NetBSD: audio.c,v 1.121 1999/12/15 12:09:34 kleink Exp $       */
  
  /*
   * Copyright (c) 1991-1993 Regents of the University of California.
--- 1,4 ----
! /*    $NetBSD$        */
  
  /*
   * Copyright (c) 1991-1993 Regents of the University of California.
***************
*** 1259,1278 ****
                splx(s);
                cc = used - cb->usedlow; /* maximum to read */
                n = cb->end - outp;
                if (n < cc)
                        cc = n; /* don't read beyond end of buffer */
!               
                if (uio->uio_resid < cc)
                        cc = uio->uio_resid; /* and no more than we want */
  
                if (sc->sc_rparams.sw_code)
                        sc->sc_rparams.sw_code(sc->hw_hdl, outp, cc);
                DPRINTFN(1,("audio_read: outp=%p, cc=%d\n", outp, cc));
                error = uiomove(outp, cc, uio);
                used -= cc;
                outp += cc;
                if (outp >= cb->end)
                        outp = cb->start;
                s = splaudio();
                cb->outp = outp;
                cb->used = used;
--- 1259,1294 ----
                splx(s);
                cc = used - cb->usedlow; /* maximum to read */
                n = cb->end - outp;
+ 
                if (n < cc)
                        cc = n; /* don't read beyond end of buffer */
! /* XXX */
!                 if (sc->sc_rparams.factor != 1) {
!                         /* Compensate for software coding expansion factor. */
!                         n /= sc->sc_rparams.factor;
!                         cc /= sc->sc_rparams.factor;
!                 }
! /* XXX */
                if (uio->uio_resid < cc)
                        cc = uio->uio_resid; /* and no more than we want */
  
                if (sc->sc_rparams.sw_code)
                        sc->sc_rparams.sw_code(sc->hw_hdl, outp, cc);
                DPRINTFN(1,("audio_read: outp=%p, cc=%d\n", outp, cc));
+               n = uio->uio_resid;
                error = uiomove(outp, cc, uio);
+                 cc = n - uio->uio_resid; /* number of bytes actually moved */
+ /* XXX */
+                 if (sc->sc_rparams.factor != 1) {
+                         /* Adjust count with expansion. */
+                         cc *= sc->sc_rparams.factor;
+                 }
+ /* XXX */
                used -= cc;
                outp += cc;
                if (outp >= cb->end)
                        outp = cb->start;
+               DPRINTF(("used=%d output=%p\n", used, outp));
                s = splaudio();
                cb->outp = outp;
                cb->used = used;

>Release-Note:
>Audit-Trail:
>Unformatted: