Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pad Use le16enc()/be16enc() to encode LE/BE values b...



details:   https://anonhg.NetBSD.org/src/rev/5f3d83127807
branches:  trunk
changeset: 762781:5f3d83127807
user:      riz <riz%NetBSD.org@localhost>
date:      Mon Feb 28 16:56:39 2011 +0000

description:
Use le16enc()/be16enc() to encode LE/BE values back into the audio stream.
This fixes the tests/dev/audio test on my macppc box.

While I'm here, use le16dec()/be16dec() directly instead of rewriting them.

diffstat:

 sys/dev/pad/padvol.c |  13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)

diffs (50 lines):

diff -r 8bc5c31e6f6b -r 5f3d83127807 sys/dev/pad/padvol.c
--- a/sys/dev/pad/padvol.c      Mon Feb 28 14:29:29 2011 +0000
+++ b/sys/dev/pad/padvol.c      Mon Feb 28 16:56:39 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: padvol.c,v 1.4 2009/09/07 18:23:06 jmcneill Exp $ */
+/* $NetBSD: padvol.c,v 1.5 2011/02/28 16:56:39 riz Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: padvol.c,v 1.4 2009/09/07 18:23:06 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: padvol.c,v 1.5 2011/02/28 16:56:39 riz Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -35,6 +35,7 @@
 #include <sys/condvar.h>
 #include <sys/kmem.h>
 #include <sys/device.h>
+#include <sys/endian.h>
 
 #include <dev/audiovar.h>
 #include <dev/auconv.h>
@@ -88,9 +89,9 @@
        m = (dst->end - dst->start) & ~1;
        m = min(m, max_used);
        FILTER_LOOP_PROLOGUE(this->src, 2, dst, 2, m) {
-               j = (s[1] << 8 | s[0]);
+               j = le16dec(s);
                wp = (int16_t *)d;
-               *wp = ((j * sc->sc_swvol) / 255);
+               le16enc(wp, (j * sc->sc_swvol) / 255);
        } FILTER_LOOP_EPILOGUE(this->src, dst);
 
        return 0;
@@ -114,9 +115,9 @@
        m = (dst->end - dst->start) & ~1;
        m = min(m, max_used);
        FILTER_LOOP_PROLOGUE(this->src, 2, dst, 2, m) {
-               j = (s[0] << 8 | s[1]);
+               j = be16dec(s);
                wp = (int16_t *)d;
-               *wp = ((j * sc->sc_swvol) / 255);
+               be16enc(wp, (j * sc->sc_swvol) / 255);
        } FILTER_LOOP_EPILOGUE(this->src, dst);
 
        return 0;



Home | Main Index | Thread Index | Old Index