Source-Changes-HG archive

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

[src/trunk]: src/sys/dev move IS_FIXED_RATE(), SUPPORTS_4CH(), and SUPPORTS_6...



details:   https://anonhg.NetBSD.org/src/rev/1d26a1fa2b8e
branches:  trunk
changeset: 571046:1d26a1fa2b8e
user:      kent <kent%NetBSD.org@localhost>
date:      Wed Nov 10 04:20:26 2004 +0000

description:
move IS_FIXED_RATE(), SUPPORTS_4CH(), and SUPPORTS_6CH to ac97var.h

diffstat:

 sys/dev/ic/ac97var.h   |  11 ++++++++++-
 sys/dev/pci/auacer.c   |  21 ++++++---------------
 sys/dev/pci/auich.c    |  25 ++++++++-----------------
 sys/dev/pci/auvia.c    |  19 ++++++++-----------
 sys/dev/pci/auviavar.h |   5 +----
 5 files changed, 33 insertions(+), 48 deletions(-)

diffs (259 lines):

diff -r 72a2a3ecc267 -r 1d26a1fa2b8e sys/dev/ic/ac97var.h
--- a/sys/dev/ic/ac97var.h      Wed Nov 10 04:11:34 2004 +0000
+++ b/sys/dev/ic/ac97var.h      Wed Nov 10 04:20:26 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ac97var.h,v 1.11 2004/11/08 14:24:17 kent Exp $        */
+/*     $NetBSD: ac97var.h,v 1.12 2004/11/10 04:20:26 kent Exp $        */
 /*     $OpenBSD: ac97.h,v 1.4 2000/07/19 09:01:35 csapuntz Exp $       */
 
 /*
@@ -80,4 +80,13 @@
 
 int ac97_attach(struct ac97_host_if *);
 
+#define AC97_IS_FIXED_RATE(codec)      \
+       !((codec)->vtbl->get_extcaps(codec) & AC97_EXT_AUDIO_VRA)
+#define AC97_IS_4CH(codec)             \
+       ((codec)->vtbl->get_extcaps(codec) & AC97_EXT_AUDIO_SDAC)
+#define AC97_IS_6CH(codec)             \
+       (((codec)->vtbl->get_extcaps(codec) \
+       & (AC97_EXT_AUDIO_SDAC | AC97_EXT_AUDIO_CDAC | AC97_EXT_AUDIO_LDAC)) \
+       == (AC97_EXT_AUDIO_SDAC | AC97_EXT_AUDIO_CDAC | AC97_EXT_AUDIO_LDAC))
+
 #endif /* _DEV_IC_AC97VAR_H_ */
diff -r 72a2a3ecc267 -r 1d26a1fa2b8e sys/dev/pci/auacer.c
--- a/sys/dev/pci/auacer.c      Wed Nov 10 04:11:34 2004 +0000
+++ b/sys/dev/pci/auacer.c      Wed Nov 10 04:20:26 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: auacer.c,v 1.2 2004/11/09 15:57:11 kent Exp $  */
+/*     $NetBSD: auacer.c,v 1.3 2004/11/10 04:20:26 kent Exp $  */
 
 /*-
  * Copyright (c) 2004 The NetBSD Foundation, Inc.
@@ -51,7 +51,7 @@
 
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: auacer.c,v 1.2 2004/11/09 15:57:11 kent Exp $");
+__KERNEL_RCSID(0, "$NetBSD: auacer.c,v 1.3 2004/11/10 04:20:26 kent Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -145,15 +145,6 @@
 #define WRITE2(sc, a, v) bus_space_write_2(sc->iot, sc->aud_ioh, a, v)
 #define WRITE4(sc, a, v) bus_space_write_4(sc->iot, sc->aud_ioh, a, v)
 
-#define IS_FIXED_RATE(codec)   !((codec)->vtbl->get_extcaps(codec) \
-                               & AC97_EXT_AUDIO_VRA)
-#define SUPPORTS_4CH(codec)    ((codec)->vtbl->get_extcaps(codec) \
-                               & AC97_EXT_AUDIO_SDAC)
-#define AC97_6CH_DACS          (AC97_EXT_AUDIO_SDAC | AC97_EXT_AUDIO_CDAC \
-                               | AC97_EXT_AUDIO_LDAC)
-#define SUPPORTS_6CH(codec)    (((codec)->vtbl->get_extcaps(codec) \
-                               & AC97_6CH_DACS) == AC97_6CH_DACS)
-
 /* Debug */
 #ifdef AUACER_DEBUG
 #define        DPRINTF(l,x)    do { if (auacer_debug & (l)) printf x; } while(0)
@@ -610,11 +601,11 @@
                        case 2:
                                break;
                        case 4:
-                               if (!SUPPORTS_4CH(sc->codec_if))
+                               if (!AC97_IS_4CH(sc->codec_if))
                                        return EINVAL;
                                break;
                        case 6:
-                               if (!SUPPORTS_6CH(sc->codec_if))
+                               if (!AC97_IS_6CH(sc->codec_if))
                                        return EINVAL;
                                break;
                        default:
@@ -698,7 +689,7 @@
                        return (EINVAL);
                }
 
-               if (IS_FIXED_RATE(sc->codec_if)) {
+               if (AC97_IS_FIXED_RATE(sc->codec_if)) {
                        p->hw_sample_rate = AC97_SINGLE_RATE;
                        /* If hw_sample_rate is changed, aurateconv works. */
                } else {
@@ -899,7 +890,7 @@
         * rate because of aurateconv.  Applications can't know what rate the
         * device can process in the case of mmap().
         */
-       if (!IS_FIXED_RATE(sc->codec_if))
+       if (!AC97_IS_FIXED_RATE(sc->codec_if))
                props |= AUDIO_PROP_MMAP;
        return props;
 }
diff -r 72a2a3ecc267 -r 1d26a1fa2b8e sys/dev/pci/auich.c
--- a/sys/dev/pci/auich.c       Wed Nov 10 04:11:34 2004 +0000
+++ b/sys/dev/pci/auich.c       Wed Nov 10 04:20:26 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: auich.c,v 1.74 2004/11/06 08:41:14 xtraeme Exp $       */
+/*     $NetBSD: auich.c,v 1.75 2004/11/10 04:20:26 kent Exp $  */
 
 /*-
  * Copyright (c) 2000, 2004 The NetBSD Foundation, Inc.
@@ -118,7 +118,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: auich.c,v 1.74 2004/11/06 08:41:14 xtraeme Exp $");
+__KERNEL_RCSID(0, "$NetBSD: auich.c,v 1.75 2004/11/10 04:20:26 kent Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -223,15 +223,6 @@
        int sc_ac97_clock_mib;
 };
 
-#define IS_FIXED_RATE(codec)   !((codec)->vtbl->get_extcaps(codec) \
-                               & AC97_EXT_AUDIO_VRA)
-#define SUPPORTS_4CH(codec)    ((codec)->vtbl->get_extcaps(codec) \
-                               & AC97_EXT_AUDIO_SDAC)
-#define AC97_6CH_DACS          (AC97_EXT_AUDIO_SDAC | AC97_EXT_AUDIO_CDAC \
-                               | AC97_EXT_AUDIO_LDAC)
-#define SUPPORTS_6CH(codec)    (((codec)->vtbl->get_extcaps(codec) \
-                               & AC97_6CH_DACS) == AC97_6CH_DACS)
-
 /* Debug */
 #ifdef AUICH_DEBUG
 #define        DPRINTF(l,x)    do { if (auich_debug & (l)) printf x; } while(0)
@@ -527,7 +518,7 @@
        config_interrupts(self, auich_finish_attach);
 
        /* sysctl setup */
-       if (IS_FIXED_RATE(sc->codec_if))
+       if (AC97_IS_FIXED_RATE(sc->codec_if))
                return;
        err = sysctl_createv(&sc->sc_log, 0, NULL, NULL, 0,
                             CTLTYPE_NODE, "hw", NULL, NULL, 0, NULL, 0,
@@ -605,7 +596,7 @@
 {
        struct auich_softc *sc = (void *)self;
 
-       if (!IS_FIXED_RATE(sc->codec_if))
+       if (!AC97_IS_FIXED_RATE(sc->codec_if))
                auich_calibrate(sc);
 
        sc->sc_audiodev = audio_attach_mi(&auich_hw_if, sc, &sc->sc_dev);
@@ -821,11 +812,11 @@
                        case 2:
                                break;
                        case 4:
-                               if (!SUPPORTS_4CH(sc->codec_if))
+                               if (!AC97_IS_4CH(sc->codec_if))
                                        return EINVAL;
                                break;
                        case 6:
-                               if (!SUPPORTS_6CH(sc->codec_if))
+                               if (!AC97_IS_6CH(sc->codec_if))
                                        return EINVAL;
                                break;
                        default:
@@ -909,7 +900,7 @@
                        return (EINVAL);
                }
 
-               if (IS_FIXED_RATE(sc->codec_if)) {
+               if (AC97_IS_FIXED_RATE(sc->codec_if)) {
                        p->hw_sample_rate = AC97_SINGLE_RATE;
                        /* If hw_sample_rate is changed, aurateconv works. */
                } else {
@@ -1083,7 +1074,7 @@
         * rate because of aurateconv.  Applications can't know what rate the
         * device can process in the case of mmap().
         */
-       if (!IS_FIXED_RATE(sc->codec_if))
+       if (!AC97_IS_FIXED_RATE(sc->codec_if))
                props |= AUDIO_PROP_MMAP;
        return props;
 }
diff -r 72a2a3ecc267 -r 1d26a1fa2b8e sys/dev/pci/auvia.c
--- a/sys/dev/pci/auvia.c       Wed Nov 10 04:11:34 2004 +0000
+++ b/sys/dev/pci/auvia.c       Wed Nov 10 04:20:26 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: auvia.c,v 1.45 2004/11/08 06:20:58 kent Exp $  */
+/*     $NetBSD: auvia.c,v 1.46 2004/11/10 04:20:26 kent Exp $  */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -47,7 +47,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: auvia.c,v 1.45 2004/11/08 06:20:58 kent Exp $");
+__KERNEL_RCSID(0, "$NetBSD: auvia.c,v 1.46 2004/11/10 04:20:26 kent Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -638,12 +638,9 @@
                                /* ok */
                        } else if (p->channels == 2) {
                                /* ok */
-                       } else if (p->channels == 4
-                               && ext_id & AC97_EXT_AUDIO_SDAC) {
+                       } else if (p->channels == 4 && AC97_IS_4CH(codec)) {
                                /* ok */
-#define BITS_6CH       (AC97_EXT_AUDIO_SDAC | AC97_EXT_AUDIO_CDAC | AC97_EXT_AUDIO_LDAC)
-                       } else if (p->channels == 6
-                               && (ext_id & BITS_6CH) == BITS_6CH) {
+                       } else if (p->channels == 6 && AC97_IS_6CH(codec)) {
                                /* ok */
                        } else {
                                return (EINVAL);
@@ -656,7 +653,7 @@
                    (p->precision != 8 && p->precision != 16))
                        return (EINVAL);
 
-               if (IS_FIXED_RATE(codec)) {
+               if (AC97_IS_FIXED_RATE(codec)) {
                        /* Enable aurateconv */
                        p->hw_sample_rate = AC97_SINGLE_RATE;
                } else {
@@ -715,7 +712,7 @@
                                p->sw_code = mulaw_to_slinear16_le;
                                p->hw_encoding = AUDIO_ENCODING_SLINEAR_LE;
                                p->hw_precision = 16;
-                       } else if (!IS_FIXED_RATE(codec)) {
+                       } else if (!AC97_IS_FIXED_RATE(codec)) {
                                p->sw_code = ulinear8_to_mulaw;
                                p->hw_encoding = AUDIO_ENCODING_ULINEAR;
                        } else {
@@ -734,7 +731,7 @@
                                p->sw_code = alaw_to_slinear16_le;
                                p->hw_encoding = AUDIO_ENCODING_SLINEAR_LE;
                                p->hw_precision = 16;
-                       } else if (!IS_FIXED_RATE(codec)) {
+                       } else if (!AC97_IS_FIXED_RATE(codec)) {
                                p->sw_code = ulinear8_to_alaw;
                                p->hw_encoding = AUDIO_ENCODING_ULINEAR;
                        } else {
@@ -961,7 +958,7 @@
         * rate because of aurateconv.  Applications can't know what rate the
         * device can process in the case of mmap().
         */
-       if (!IS_FIXED_RATE(sc->codec_if))
+       if (!AC97_IS_FIXED_RATE(sc->codec_if))
                props |= AUDIO_PROP_MMAP;
        return props;
 }
diff -r 72a2a3ecc267 -r 1d26a1fa2b8e sys/dev/pci/auviavar.h
--- a/sys/dev/pci/auviavar.h    Wed Nov 10 04:11:34 2004 +0000
+++ b/sys/dev/pci/auviavar.h    Wed Nov 10 04:20:26 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: auviavar.h,v 1.6 2004/10/17 08:46:39 kent Exp $        */
+/*     $NetBSD: auviavar.h,v 1.7 2004/11/10 04:20:26 kent Exp $        */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -79,7 +79,4 @@
        int sc_suspend;
 };
 
-#define IS_FIXED_RATE(codec)   !((codec)->vtbl->get_extcaps(codec) \
-                                 & AC97_EXT_AUDIO_VRA)
-
 #endif /* !_DEV_PCI_AUVIAVAR_H_ */



Home | Main Index | Thread Index | Old Index