Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-1-5]: src/sys/dev/isa Pull up revisions 1.16, 1.19-1.21 (requested...
details: https://anonhg.NetBSD.org/src/rev/861b6111d7ab
branches: netbsd-1-5
changeset: 493004:861b6111d7ab
user: he <he%NetBSD.org@localhost>
date: Wed Mar 27 10:15:39 2002 +0000
description:
Pull up revisions 1.16,1.19-1.21 (requested by itohy):
Several changes to wss-compatible audio devices:
o Fix ADPCM playback/recording
o Add explicit support for OPL3-SA2 (YMF711), fixes PR#14819
o Add AD1845 support
o other minor bugfixes and cleanups
diffstat:
sys/dev/isa/ad1848_isa.c | 41 +++++++++++++++++++++++++++++++++++------
1 files changed, 35 insertions(+), 6 deletions(-)
diffs (97 lines):
diff -r f0c40bef3e08 -r 861b6111d7ab sys/dev/isa/ad1848_isa.c
--- a/sys/dev/isa/ad1848_isa.c Wed Mar 27 10:14:37 2002 +0000
+++ b/sys/dev/isa/ad1848_isa.c Wed Mar 27 10:15:39 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ad1848_isa.c,v 1.14.4.3 2001/02/26 22:08:11 he Exp $ */
+/* $NetBSD: ad1848_isa.c,v 1.14.4.4 2002/03/27 10:15:39 he Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -101,6 +101,9 @@
* Portions also supplied from the SoundBlaster driver for NetBSD.
*/
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: ad1848_isa.c,v 1.14.4.4 2002/03/27 10:15:39 he Exp $");
+
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/errno.h>
@@ -114,7 +117,6 @@
#include <machine/bus.h>
#include <sys/audioio.h>
-#include <vm/vm.h>
#include <dev/audio_if.h>
#include <dev/auconv.h>
@@ -192,7 +194,7 @@
{
struct ad1848_softc *sc = &isc->sc_ad1848;
u_char tmp, tmp1 = 0xff, tmp2 = 0xff;
- int i;
+ int i, t;
sc->sc_readreg = ad1848_isa_read;
sc->sc_writereg = ad1848_isa_write;
@@ -250,6 +252,14 @@
tmp = ad_read(sc, SP_MISC_INFO);
ad_write(sc, SP_MISC_INFO, (~tmp) & 0x0f);
+ /* Here, AD1845 may sometimes be busy. Wait til it becomes ready. */
+ for (t = 0; t < 100000 && ADREAD(sc, AD1848_IADDR) & SP_IN_INIT; t++)
+ ;
+#ifdef AUDIO_DEBUG
+ if (t)
+ DPRINTF(("ad1848_isa_probe: t %d\n", t));
+#endif
+
if ((tmp & 0x0f) != ((tmp1 = ad_read(sc, SP_MISC_INFO)) & 0x0f)) {
DPRINTF(("ad_detect_D (%x)\n", tmp1));
goto bad;
@@ -345,7 +355,15 @@
break;
case 0x80:
/* XXX I25 no good, AD1845 same as CS4231 */
- sc->chip_name = "CS4231 or AD1845";
+ /*
+ * XXX
+ * This test is correct only after reset
+ */
+ if (ad_read(sc, 17) & 0xf0) {
+ sc->chip_name = "AD1845";
+ sc->is_ad1845 = 1;
+ } else
+ sc->chip_name = "CS4231";
break;
case 0x82:
sc->chip_name = "CS4232";
@@ -565,7 +583,13 @@
isc->sc_parg = arg;
}
- blksize = (blksize * 8) / (param->precision * param->factor * param->channels) - 1;
+
+ /*
+ * Calculate number of transfers.
+ * Note that ADPCM is always transferred 4 bytes at at a time.
+ */
+ blksize = (param->encoding == AUDIO_ENCODING_ADPCM) ? blksize / 4 - 1 :
+ (blksize * 8) / (param->precision * param->factor * param->channels) - 1;
if (sc->mode >= 2) {
ad_write(sc, CS_LOWER_REC_CNT, blksize & 0xff);
@@ -602,7 +626,12 @@
isc->sc_pintr = intr;
isc->sc_parg = arg;
- blksize = (blksize * 8) / (param->precision * param->factor * param->channels) - 1;
+ /*
+ * Calculate number of transfers.
+ * Note that ADPCM is always transferred 4 bytes at at a time.
+ */
+ blksize = (param->encoding == AUDIO_ENCODING_ADPCM) ? blksize / 4 - 1 :
+ (blksize * 8) / (param->precision * param->factor * param->channels) - 1;
ad_write(sc, SP_LOWER_BASE_COUNT, blksize & 0xff);
ad_write(sc, SP_UPPER_BASE_COUNT, blksize >> 8);
Home |
Main Index |
Thread Index |
Old Index