Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pci Merge in changes sent by Michael Shalayeff, from...



details:   https://anonhg.NetBSD.org/src/rev/5a35246396f1
branches:  trunk
changeset: 519668:5a35246396f1
user:      jdolecek <jdolecek%NetBSD.org@localhost>
date:      Sun Dec 23 23:14:59 2001 +0000

description:
Merge in changes sent by Michael Shalayeff, from OpenBSD port of this driver:
- use better default for DAC level (previous produced distorted output)
- preserve DAC setting in between openings

diffstat:

 sys/dev/pci/emuxki.c    |  63 +++++++++++++++++++++++++++++-------------------
 sys/dev/pci/emuxkivar.h |   4 +-
 2 files changed, 40 insertions(+), 27 deletions(-)

diffs (136 lines):

diff -r 880fd3af5501 -r 5a35246396f1 sys/dev/pci/emuxki.c
--- a/sys/dev/pci/emuxki.c      Sun Dec 23 23:08:41 2001 +0000
+++ b/sys/dev/pci/emuxki.c      Sun Dec 23 23:14:59 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: emuxki.c,v 1.6 2001/12/23 22:54:08 jdolecek Exp $      */
+/*     $NetBSD: emuxki.c,v 1.7 2001/12/23 23:14:59 jdolecek Exp $      */
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -57,7 +57,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: emuxki.c,v 1.6 2001/12/23 22:54:08 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: emuxki.c,v 1.7 2001/12/23 23:14:59 jdolecek Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -879,7 +879,7 @@
 emuxki_chanparms_set_defaults(struct emuxki_channel *chan)
 {
        chan->fxsend.a.level = chan->fxsend.b.level =
-       chan->fxsend.c.level = chan->fxsend.d.level = 0xff;     /* max */
+       chan->fxsend.c.level = chan->fxsend.d.level = 0xc0;     /* not max */
        chan->fxsend.a.dest = 0x0;
        chan->fxsend.b.dest = 0x1;
        chan->fxsend.c.dest = 0x2;
@@ -1241,24 +1241,31 @@
        struct emuxki_voice *voice;
        int             s;
 
-       if ((voice = malloc(sizeof(*voice), M_DEVBUF, M_WAITOK)) == NULL)
-               return (NULL);
-       voice->sc = sc;
+       s = splaudio();
+       voice = sc->lvoice;
+       sc->lvoice = NULL;
+       splx(s);
+
+       if (!voice) {
+               if (!(voice = malloc(sizeof(*voice), M_DEVBUF, M_WAITOK)))
+                       return (NULL);
+               voice->sc = sc;
+               voice->state = !EMU_VOICE_STATE_STARTED;
+               voice->stereo = EMU_VOICE_STEREO_NOTSET;
+               voice->b16 = 0;
+               voice->sample_rate = 0;
+               if (use & EMU_VOICE_USE_PLAY)
+                       voice->dataloc.chan[0] = voice->dataloc.chan[0] = NULL;
+               else
+                       voice->dataloc.source = EMU_RECSRC_NOTSET;
+               voice->buffer = NULL;
+               voice->blksize = 0;
+               voice->trigblk = 0;
+               voice->blkmod = 0;
+               voice->inth = NULL;
+               voice->inthparam = NULL;
+       }
        voice->use = use;
-       voice->state = !EMU_VOICE_STATE_STARTED;
-       voice->stereo = EMU_VOICE_STEREO_NOTSET;
-       voice->b16 = 0;
-       voice->sample_rate = 0;
-       if (use & EMU_VOICE_USE_PLAY)
-               voice->dataloc.chan[0] = voice->dataloc.chan[0] = NULL;
-       else
-               voice->dataloc.source = EMU_RECSRC_NOTSET;
-       voice->buffer = NULL;
-       voice->blksize = 0;
-       voice->trigblk = 0;
-       voice->blkmod = 0;
-       voice->inth = NULL;
-       voice->inthparam = NULL;
 
        s = splaudio();
        LIST_INSERT_HEAD((&sc->voices), voice, next);
@@ -1270,17 +1277,23 @@
 static void
 emuxki_voice_delete(struct emuxki_voice *voice)
 {
-       int             s;
+       struct emuxki_softc *sc = voice->sc;
+       struct emuxki_voice *lvoice;
+       int s;
 
        if (voice->state & EMU_VOICE_STATE_STARTED)
                emuxki_voice_halt(voice);
 
        s = splaudio();
        LIST_REMOVE(voice, next);
+       lvoice = sc->lvoice;
+       sc->lvoice = voice;
        splx(s);
 
-       emuxki_voice_dataloc_destroy(voice);
-       free(voice, M_DEVBUF);
+       if (lvoice) {
+               emuxki_voice_dataloc_destroy(lvoice);
+               free(lvoice, M_DEVBUF);
+       }
 }
 
 static int
@@ -1299,12 +1312,12 @@
                fxsend.c.dest = 0x2;
                fxsend.d.dest = 0x3;
                if (voice->stereo) {
-                       fxsend.a.level = fxsend.c.level = 0xff;
+                       fxsend.a.level = fxsend.c.level = 0xc0;
                        fxsend.b.level = fxsend.d.level = 0x00;
                        emuxki_channel_set_fxsend(voice->dataloc.chan[0],
                                                   &fxsend);
                        fxsend.a.level = fxsend.c.level = 0x00;
-                       fxsend.b.level = fxsend.d.level = 0xff;
+                       fxsend.b.level = fxsend.d.level = 0xc0;
                        emuxki_channel_set_fxsend(voice->dataloc.chan[1],
                                                   &fxsend);
                } /* No else : default is good for mono */      
diff -r 880fd3af5501 -r 5a35246396f1 sys/dev/pci/emuxkivar.h
--- a/sys/dev/pci/emuxkivar.h   Sun Dec 23 23:08:41 2001 +0000
+++ b/sys/dev/pci/emuxkivar.h   Sun Dec 23 23:14:59 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: emuxkivar.h,v 1.2 2001/12/23 22:52:49 jdolecek Exp $   */
+/*     $NetBSD: emuxkivar.h,v 1.3 2001/12/23 23:14:59 jdolecek Exp $   */
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -253,7 +253,7 @@
        struct ac97_codec_if    *codecif;
        struct device           *sc_audev;
 
-       struct emuxki_voice     *pvoice, *rvoice;
+       struct emuxki_voice     *pvoice, *rvoice, *lvoice;
 };
 
 #endif                         /* !_DEV_PCI_EMU10K1VAR_H_ */



Home | Main Index | Thread Index | Old Index