Source-Changes-HG archive

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

[src/jmcneill-audiomp3]: src/sys adapt to audiomp api changes



details:   https://anonhg.NetBSD.org/src/rev/b921a1d5c9c6
branches:  jmcneill-audiomp3
changeset: 771368:b921a1d5c9c6
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Sun Nov 20 15:48:52 2011 +0000

description:
adapt to audiomp api changes

diffstat:

 sys/arch/amiga/dev/melody.c          |   8 +++++-
 sys/arch/amigappc/amigappc/machdep.c |   6 ++--
 sys/dev/ic/tms320av110.c             |  40 +++++++++++++++++++++++++++++------
 sys/dev/ic/tms320av110var.h          |   5 +++-
 4 files changed, 46 insertions(+), 13 deletions(-)

diffs (188 lines):

diff -r b9e9aa346a40 -r b921a1d5c9c6 sys/arch/amiga/dev/melody.c
--- a/sys/arch/amiga/dev/melody.c       Sun Nov 20 15:24:01 2011 +0000
+++ b/sys/arch/amiga/dev/melody.c       Sun Nov 20 15:48:52 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: melody.c,v 1.16 2011/07/19 15:55:27 dyoung Exp $ */
+/*     $NetBSD: melody.c,v 1.16.4.1 2011/11/20 15:48:52 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: melody.c,v 1.16 2011/07/19 15:55:27 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: melody.c,v 1.16.4.1 2011/11/20 15:48:52 jmcneill Exp $");
 
 /*
  * Melody audio driver.
@@ -111,6 +111,10 @@
        sc->sc_tav.sc_dif = 0;
        sc->sc_tav.sc_pcm_div = 12;
 
+       mutex_init(&sc->sc_tav.sc_lock, MUTEX_DEFAULT, IPL_NONE);
+       mutex_init(&sc->sc_tav.sc_intr_lock, MUTEX_DEFAULT, IPL_SCHED);
+       cv_init(&sc->sc_tav.sc_cv, device_xname(self));
+
        /*
         * Attach option boards now. They might provide additional
         * functionality to our audio part.
diff -r b9e9aa346a40 -r b921a1d5c9c6 sys/arch/amigappc/amigappc/machdep.c
--- a/sys/arch/amigappc/amigappc/machdep.c      Sun Nov 20 15:24:01 2011 +0000
+++ b/sys/arch/amigappc/amigappc/machdep.c      Sun Nov 20 15:48:52 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.48 2011/07/17 20:54:36 joerg Exp $ */
+/* $NetBSD: machdep.c,v 1.48.4.1 2011/11/20 15:48:53 jmcneill Exp $ */
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.48 2011/07/17 20:54:36 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.48.4.1 2011/11/20 15:48:53 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/mount.h>
@@ -241,7 +241,7 @@
        intr_establish(1, IST_LEVEL, IPL_BIO, lev1_intr, NULL);
        intr_establish(2, IST_LEVEL, IPL_BIO, ports_intr, &isr_ports);
        intr_establish(3, IST_LEVEL, IPL_TTY, lev3_intr, NULL);
-       intr_establish(4, IST_LEVEL, IPL_AUDIO, lev4_intr, NULL);
+       intr_establish(4, IST_LEVEL, IPL_SCHED, lev4_intr, NULL);
        intr_establish(5, IST_LEVEL, IPL_SERIAL, lev5_intr, NULL);
        intr_establish(6, IST_LEVEL, IPL_SERIAL, exter_intr, &isr_exter);
 }
diff -r b9e9aa346a40 -r b921a1d5c9c6 sys/dev/ic/tms320av110.c
--- a/sys/dev/ic/tms320av110.c  Sun Nov 20 15:24:01 2011 +0000
+++ b/sys/dev/ic/tms320av110.c  Sun Nov 20 15:48:52 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tms320av110.c,v 1.21 2008/04/28 20:23:51 martin Exp $  */
+/*     $NetBSD: tms320av110.c,v 1.21.36.1 2011/11/20 15:48:52 jmcneill Exp $   */
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tms320av110.c,v 1.21 2008/04/28 20:23:51 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tms320av110.c,v 1.21.36.1 2011/11/20 15:48:52 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -72,6 +72,7 @@
 int tav_get_port(void *, mixer_ctrl_t *);
 int tav_query_devinfo(void *, mixer_devinfo_t *);
 int tav_get_props(void *);
+void tav_get_locks(void *, kmutex_t **, kmutex_t **);
 
 const struct audio_hw_if tav_audio_if = {
        tav_open,
@@ -98,7 +99,11 @@
        0 /* round_buffersize */,       /* optional */
        0 /* mappage */,                /* optional */
        tav_get_props,
-       0 /* dev_ioctl */               /* optional */
+       0, /* trigger_output */
+       0, /* trigger_input */
+       0, /* dev_ioctl */              /* optional */
+       0, /* powerhook */              /* optional */
+       tav_get_locks,
 };
 
 void
@@ -146,6 +151,9 @@
        uint16_t intlist;
 
        sc = p;
+
+       mutex_spin_enter(&sc->sc_intr_lock);
+
        intlist = tav_read_short(sc->sc_iot, sc->sc_ioh, TAV_INTR)
            /* & tav_read_short(sc->sc_iot, sc->sc_ioh, TAV_INTR_EN)*/;
 
@@ -161,9 +169,11 @@
        }
 
        if (intlist & TAV_INTR_PCM_OUTPUT_UNDERFLOW) {
-                wakeup(sc);
+                cv_broadcast(&sc->sc_cv);
        }
 
+       mutex_spin_exit(&sc->sc_intr_lock);
+
        return 1;
 }
 
@@ -211,8 +221,10 @@
        iot = sc->sc_iot;
        ioh = sc->sc_ioh;
 
+       mutex_spin_enter(&sc->sc_intr_lock);
+
        /*
-        * tsleep waiting for underflow interrupt.
+        * wait for underflow interrupt.
         */
        if (tav_read_short(iot, ioh, TAV_BUFF)) {
                mask = tav_read_short(iot, ioh, TAV_INTR_EN);
@@ -220,8 +232,10 @@
                    mask|TAV_INTR_PCM_OUTPUT_UNDERFLOW);
 
                /* still more than zero? */
-               if (tav_read_short(iot, ioh, TAV_BUFF))
-                       (void)tsleep(sc, PCATCH, "tavdrain", 32*hz);
+               if (tav_read_short(iot, ioh, TAV_BUFF)) {
+                       (void)cv_timedwait_sig(&sc->sc_cv,
+                           &sc->sc_intr_lock, 32*hz);
+               }
 
                /* can be really that long for mpeg */
 
@@ -230,6 +244,8 @@
                    mask & ~TAV_INTR_PCM_OUTPUT_UNDERFLOW);
        }
 
+       mutex_spin_exit(&sc->sc_intr_lock);
+
        return 0;
 }
 
@@ -371,6 +387,16 @@
        return 0;
 }
 
+void
+tav_get_locks(void *hdl, kmutex_t **intr, kmutex_t **thread)
+{
+       struct tav_softc *sc;
+
+       sc = hdl;
+       *intr = &sc->sc_intr_lock;
+       *thread = &sc->sc_lock;
+}
+
 int
 tav_set_params(void *hdl, int setmode, int usemode, audio_params_t *p,
     audio_params_t *r, stream_filter_list_t *pfil, stream_filter_list_t *rfil)
diff -r b9e9aa346a40 -r b921a1d5c9c6 sys/dev/ic/tms320av110var.h
--- a/sys/dev/ic/tms320av110var.h       Sun Nov 20 15:24:01 2011 +0000
+++ b/sys/dev/ic/tms320av110var.h       Sun Nov 20 15:48:52 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tms320av110var.h,v 1.10 2008/04/28 20:23:51 martin Exp $       */
+/*     $NetBSD: tms320av110var.h,v 1.10.36.1 2011/11/20 15:48:52 jmcneill Exp $        */
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -46,6 +46,9 @@
 
 struct tav_softc {
        struct device   sc_dev;
+       kmutex_t        sc_lock;
+       kmutex_t        sc_intr_lock;
+       kcondvar_t      sc_cv;
 
        bus_space_tag_t sc_iot;
        bus_space_handle_t sc_ioh;



Home | Main Index | Thread Index | Old Index