Source-Changes-HG archive

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

[src/trunk]: src/sys Make the SPARC audioamd driver at least *compile*. Well...



details:   https://anonhg.NetBSD.org/src/rev/3eed00d0afd8
branches:  trunk
changeset: 485873:3eed00d0afd8
user:      mycroft <mycroft%NetBSD.org@localhost>
date:      Mon May 08 02:44:31 2000 +0000

description:
Make the SPARC audioamd driver at least *compile*.  Well, the C code, that is.
*sigh*

diffstat:

 sys/arch/sparc/dev/audioamd.c |  98 ++++++++++++++++++++++++++++--------------
 sys/dev/ic/am7930reg.h        |   4 +-
 2 files changed, 67 insertions(+), 35 deletions(-)

diffs (239 lines):

diff -r 09ca2116d5fa -r 3eed00d0afd8 sys/arch/sparc/dev/audioamd.c
--- a/sys/arch/sparc/dev/audioamd.c     Mon May 08 00:52:18 2000 +0000
+++ b/sys/arch/sparc/dev/audioamd.c     Mon May 08 02:44:31 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: audioamd.c,v 1.1 2000/05/02 06:35:14 augustss Exp $    */
+/*     $NetBSD: audioamd.c,v 1.2 2000/05/08 02:44:32 mycroft Exp $     */
 /*     NetBSD: am7930_sparc.c,v 1.44 1999/03/14 22:29:00 jonathan Exp  */
 
 /*
@@ -142,8 +142,10 @@
 
 u_int8_t       audioamd_codec_iread __P((struct am7930_softc *, int));
 u_int16_t      audioamd_codec_iread16 __P((struct am7930_softc *, int));
+u_int8_t       audioamd_codec_dread __P((struct audioamd_softc *, int));
 void   audioamd_codec_iwrite __P((struct am7930_softc *, int, u_int8_t));
 void   audioamd_codec_iwrite16 __P((struct am7930_softc *, int, u_int16_t));
+void   audioamd_codec_dwrite __P((struct audioamd_softc *, int, u_int8_t));
 void   audioamd_onopen __P((struct am7930_softc *sc));
 void   audioamd_onclose __P((struct am7930_softc *sc));
 
@@ -166,6 +168,7 @@
                                  void *));
 int    audioamd_start_input __P((void *, void *, int, void (*)(void *),
                                 void *));
+int    audioamd_getdev __P((void *, struct audio_device *));
 
 struct audio_hw_if sa_hw_if = {
        am7930_open,
@@ -240,7 +243,7 @@
                        ma->ma_bustag,
                        ma->ma_iospace,
                        ma->ma_paddr,
-                       sizeof(struct am7930),
+                       AM7930_DREG_SIZE,
                        BUS_SPACE_MAP_LINEAR,
                        0,
                        &bh) != 0) {
@@ -267,7 +270,7 @@
                        sa->sa_bustag,
                        sa->sa_slot,
                        sa->sa_offset,
-                       sizeof(struct am7930),
+                       AM7930_DREG_SIZE,
                        0, 0,
                        &bh) != 0) {
                printf("%s: cannot map registers\n", self->dv_xname);
@@ -288,9 +291,9 @@
        /*
         * Set up glue for MI code early; we use some of it here.
         */
-       sc->sc_glue = &audioamd_glue;
+       sc->sc_am7930.sc_glue = &audioamd_glue;
 
-       am7930_init(sc, AUDIOAMD_POLL_MODE);
+       am7930_init(&sc->sc_am7930, AUDIOAMD_POLL_MODE);
 
 #ifndef AUDIO_C_HANDLER
        auiop = &sc->sc_au;
@@ -305,9 +308,9 @@
                                 BUS_INTR_ESTABLISH_SOFTINTR,
                                 am7930swintr, sc);
 
-       evcnt_attach(&sc->sc_dev, "intr", &sc->sc_intrcnt);
+       evcnt_attach(&sc->sc_am7930.sc_dev, "intr", &sc->sc_intrcnt);
 
-       audio_attach_mi(&sa_hw_if, sc, &sc->sc_dev);
+       audio_attach_mi(&sa_hw_if, sc, &sc->sc_am7930.sc_dev);
 }
 
 
@@ -315,7 +318,7 @@
 audioamd_onopen(sc)
        struct am7930_softc *sc;
 {
-       struct audioamd_softc *mdsc = (struct audioamd *)sc;
+       struct audioamd_softc *mdsc = (struct audioamd_softc *)sc;
 
        /* reset pdma state */
        mdsc->sc_rintr = 0;
@@ -338,7 +341,7 @@
 }
 
 int
-audioamd_output(addr, p, cc, intr, arg)
+audioamd_start_output(addr, p, cc, intr, arg)
        void *addr;
        void *p;
        int cc;
@@ -349,10 +352,10 @@
 
        DPRINTFN(1, ("sa_start_output: cc=%d %p (%p)\n", cc, intr, arg));
 
-       if (!sc->sc_locked) {
-               audioamd_codec_iwrite(sc,
+       if (!sc->sc_am7930.sc_locked) {
+               audioamd_codec_iwrite(&sc->sc_am7930,
                        AM7930_IREG_INIT, AM7930_INIT_PMS_ACTIVE);
-               sc->sc_locked = 1;
+               sc->sc_am7930.sc_locked = 1;
                DPRINTF(("sa_start_output: started intrs.\n"));
        }
        sc->sc_pintr = intr;
@@ -363,7 +366,7 @@
 }
 
 int
-am7930_start_input(addr, p, cc, intr, arg)
+audioamd_start_input(addr, p, cc, intr, arg)
        void *addr;
        void *p;
        int cc;
@@ -374,10 +377,10 @@
 
        DPRINTFN(1, ("sa_start_input: cc=%d %p (%p)\n", cc, intr, arg));
 
-       if (!sc->sc_locked) {
-               audioamd_codec_iwrite(sc,
+       if (!sc->sc_am7930.sc_locked) {
+               audioamd_codec_iwrite(&sc->sc_am7930,
                        AM7930_IREG_INIT, AM7930_INIT_PMS_ACTIVE);
-               sc->sc_locked = 1;
+               sc->sc_am7930.sc_locked = 1;
                DPRINTF(("sa_start_input: started intrs.\n"));
        }
        sc->sc_rintr = intr;
@@ -470,20 +473,23 @@
        int reg;
        u_int8_t val;
 {
-       audioamd_codec_dwrite(sc, AM7930_DREG_CR, reg);
-       audioamd_codec_dwrite(sc, AM7930_DREG_DR, val);
+       struct audioamd_softc *mdsc = (struct audioamd_softc *)sc;
+
+       audioamd_codec_dwrite(mdsc, AM7930_DREG_CR, reg);
+       audioamd_codec_dwrite(mdsc, AM7930_DREG_DR, val);
 }
 
-
 void
 audioamd_codec_iwrite16(sc, reg, val)
        struct am7930_softc *sc;
        int reg;
        u_int16_t val;
 {
-       audioamd_codec_dwrite(sc, AM7930_DREG_CR, reg);
-       audioamd_codec_dwrite(sc, AM7930_DREG_DR, val);
-       audioamd_codec_dwrite(sc, AM7930_DREG_DR, val>>8);
+       struct audioamd_softc *mdsc = (struct audioamd_softc *)sc;
+
+       audioamd_codec_dwrite(mdsc, AM7930_DREG_CR, reg);
+       audioamd_codec_dwrite(mdsc, AM7930_DREG_DR, val);
+       audioamd_codec_dwrite(mdsc, AM7930_DREG_DR, val>>8);
 }
 
 
@@ -493,29 +499,53 @@
        struct am7930_softc *sc;
        int reg;
 {
-       audioamd_codec_dwrite(sc, AM7930_DREG_CR, reg);
-       return audioamd_codec_dread(sc, AM7930_DREG_DR);
+       struct audioamd_softc *mdsc = (struct audioamd_softc *)sc;
+
+       audioamd_codec_dwrite(mdsc, AM7930_DREG_CR, reg);
+       return (audioamd_codec_dread(mdsc, AM7930_DREG_DR));
+}
+
+u_int16_t
+audioamd_codec_iread16(sc, reg)
+       struct am7930_softc *sc;
+       int reg;
+{
+       struct audioamd_softc *mdsc = (struct audioamd_softc *)sc;
+       u_int8_t lo, hi;
+
+       audioamd_codec_dwrite(mdsc, AM7930_DREG_CR, reg);
+       lo = audioamd_codec_dread(mdsc, AM7930_DREG_DR);
+       hi = audioamd_codec_dread(mdsc, AM7930_DREG_DR);
+       return ((hi << 8) | lo);
+}
+
+/* direct read */
+u_int8_t
+audioamd_codec_dread(sc, reg)
+       struct audioamd_softc *sc;
+       int reg;
+{
+       return (bus_space_read_1(sc->sc_bt, sc->sc_bh, reg));
 }
 
 /* direct write */
 void
 audioamd_codec_dwrite(sc, reg, val)
-       struct am7930_softc *sc;
+       struct audioamd_softc *sc;
        int reg;
        u_int8_t val;
 {
-       struct audioamd_softc *mdsc = (struct audioamd_softc *)sc;
-       bus_space_write_1(mdsc->sc_bt, mdsc->sc_bh, reg, val);
+       bus_space_write_1(sc->sc_bt, sc->sc_bh, reg, val);
 }
 
-/* direct read */
-u_int8_t
-bba_codec_dread(sc, reg)
-       struct am7930_softc *sc;
-       int reg;
+int
+audioamd_getdev(addr, retp)
+       void *addr;
+       struct audio_device *retp;
 {
-       struct audioamd_softc *mdsc = (struct audioamd_softc *)sc;
-       return bus_space_read_1(mdsc->sc_bt, mdsc->sc_bh, reg);
+
+       *retp = audioamd_device;
+       return (0);
 }
 
 #endif /* NAUDIO > 0 */
diff -r 09ca2116d5fa -r 3eed00d0afd8 sys/dev/ic/am7930reg.h
--- a/sys/dev/ic/am7930reg.h    Mon May 08 00:52:18 2000 +0000
+++ b/sys/dev/ic/am7930reg.h    Mon May 08 02:44:31 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: am7930reg.h,v 1.4 2000/05/02 06:30:51 augustss Exp $ */
+/* $NetBSD: am7930reg.h,v 1.5 2000/05/08 02:44:31 mycroft Exp $ */
 
 /*
  * Am79C30A direct registers
@@ -25,6 +25,8 @@
 #define AM7930_DREG_BCRB       6       /* Bc-channel receive register (ro) */
 #define AM7930_DREG_DSR2       7       /* D-channel status register 2 (ro) */
 
+#define        AM7930_DREG_SIZE        8
+
 /*
  * Am79C30A indirect registers
  */



Home | Main Index | Thread Index | Old Index