diff options
author | Marc Espie <espie@cvs.openbsd.org> | 1999-12-05 18:35:34 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 1999-12-05 18:35:34 +0000 |
commit | c121700f1d7afdace3b6544077aedd3d395a4380 (patch) | |
tree | a2ceef31c884bbaf60d443728d72c2200df376fd | |
parent | 4acb0b678b76e7baba0522ce923b8dc8c9cd6ef9 (diff) |
Pass device mode to query_encoding in the structure to fill, so
that devices that don't need it are not affected.
eso has those weird 16 bits mode that differ in endianess depending
on READ/WRITE. Use this to avoid setting AUDIO_FLAGS_EMULATED needlessly.
Reorder eso modes slightly so that emulated modes are always last.
-rw-r--r-- | sys/dev/audio.c | 4 | ||||
-rw-r--r-- | sys/dev/pci/eso.c | 73 |
2 files changed, 54 insertions, 23 deletions
diff --git a/sys/dev/audio.c b/sys/dev/audio.c index b4f2fbfb9b8..4a6a06a88b5 100644 --- a/sys/dev/audio.c +++ b/sys/dev/audio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: audio.c,v 1.18 1999/11/20 18:51:58 espie Exp $ */ +/* $OpenBSD: audio.c,v 1.19 1999/12/05 18:35:33 espie Exp $ */ /* $NetBSD: audio.c,v 1.105 1998/09/27 16:43:56 christos Exp $ */ /* @@ -1560,6 +1560,8 @@ audio_ioctl(dev, cmd, addr, flag, p) case AUDIO_GETENC: DPRINTF(("AUDIO_GETENC\n")); + /* Pass read/write info down to query_encoding */ + ((struct audio_encoding *)addr)->flags = sc->sc_open; error = hw->query_encoding(sc->hw_hdl, (struct audio_encoding *)addr); break; diff --git a/sys/dev/pci/eso.c b/sys/dev/pci/eso.c index 85aac8dbe4d..5e691665a20 100644 --- a/sys/dev/pci/eso.c +++ b/sys/dev/pci/eso.c @@ -1,4 +1,4 @@ -/* $OpenBSD: eso.c,v 1.6 1999/12/04 21:39:29 deraadt Exp $ */ +/* $OpenBSD: eso.c,v 1.7 1999/12/05 18:35:33 espie Exp $ */ /* $NetBSD: eso.c,v 1.3 1999/08/02 17:37:43 augustss Exp $ */ /* @@ -62,6 +62,7 @@ #include <dev/ic/i8237reg.h> #include <dev/pci/esoreg.h> #include <dev/pci/esovar.h> +#include <dev/audiovar.h> #include <machine/bus.h> #include <machine/intr.h> @@ -653,45 +654,73 @@ eso_query_encoding(hdl, fp) fp->flags = 0; break; case 1: - strcpy(fp->name, AudioEmulaw); - fp->encoding = AUDIO_ENCODING_ULAW; + strcpy(fp->name, AudioEslinear); + fp->encoding = AUDIO_ENCODING_SLINEAR; fp->precision = 8; - fp->flags = AUDIO_ENCODINGFLAG_EMULATED; + fp->flags = 0; break; case 2: - strcpy(fp->name, AudioEalaw); - fp->encoding = AUDIO_ENCODING_ALAW; - fp->precision = 8; - fp->flags = AUDIO_ENCODINGFLAG_EMULATED; + fp->precision = 16; + if (fp->flags & AUOPEN_READ) { + strcpy(fp->name, AudioEslinear_be); + fp->encoding = AUDIO_ENCODING_SLINEAR_BE; + if (fp->flags & AUOPEN_WRITE) + fp->flags = AUDIO_ENCODINGFLAG_EMULATED; + else + fp->flags = 0; + } else { + strcpy(fp->name, AudioEslinear_le); + fp->encoding = AUDIO_ENCODING_SLINEAR_LE; + fp->flags = 0; + } break; case 3: - strcpy(fp->name, AudioEslinear); - fp->encoding = AUDIO_ENCODING_SLINEAR; - fp->precision = 8; - fp->flags = 0; + fp->precision = 16; + if (fp->flags & AUOPEN_READ) { + strcpy(fp->name, AudioEulinear_be); + fp->encoding = AUDIO_ENCODING_ULINEAR_BE; + if (fp->flags & AUOPEN_WRITE) + fp->flags = AUDIO_ENCODINGFLAG_EMULATED; + else + fp->flags = 0; + } else { + strcpy(fp->name, AudioEulinear_le); + fp->encoding = AUDIO_ENCODING_ULINEAR_LE; + fp->flags = 0; + } break; case 4: - strcpy(fp->name, AudioEslinear_le); - fp->encoding = AUDIO_ENCODING_SLINEAR_LE; fp->precision = 16; + if (fp->flags & AUOPEN_READ) { + strcpy(fp->name, AudioEslinear_le); + fp->encoding = AUDIO_ENCODING_SLINEAR_LE; + } else { + strcpy(fp->name, AudioEslinear_be); + fp->encoding = AUDIO_ENCODING_SLINEAR_BE; + } fp->flags = AUDIO_ENCODINGFLAG_EMULATED; break; case 5: - strcpy(fp->name, AudioEulinear_le); - fp->encoding = AUDIO_ENCODING_ULINEAR_LE; fp->precision = 16; + if (fp->flags & AUOPEN_READ) { + strcpy(fp->name, AudioEulinear_le); + fp->encoding = AUDIO_ENCODING_ULINEAR_LE; + } else { + strcpy(fp->name, AudioEulinear_be); + fp->encoding = AUDIO_ENCODING_ULINEAR_BE; + } fp->flags = AUDIO_ENCODINGFLAG_EMULATED; break; case 6: - strcpy(fp->name, AudioEslinear_be); - fp->encoding = AUDIO_ENCODING_SLINEAR_BE; - fp->precision = 16; + strcpy(fp->name, AudioEmulaw); + fp->encoding = AUDIO_ENCODING_ULAW; + fp->precision = 8; fp->flags = AUDIO_ENCODINGFLAG_EMULATED; break; case 7: - strcpy(fp->name, AudioEulinear_be); - fp->encoding = AUDIO_ENCODING_ULINEAR_BE; - fp->precision = 16; + strcpy(fp->name, AudioEalaw); + fp->encoding = AUDIO_ENCODING_ALAW; + fp->precision = 8; fp->flags = AUDIO_ENCODINGFLAG_EMULATED; break; default: |