summaryrefslogtreecommitdiff
path: root/sys/arch/sparc/dev
diff options
context:
space:
mode:
authorJason Wright <jason@cvs.openbsd.org>2003-06-28 18:12:32 +0000
committerJason Wright <jason@cvs.openbsd.org>2003-06-28 18:12:32 +0000
commitf32071adcfa8a824d60cdeceea34693d4e5af919 (patch)
tree801136b9d0a917359014aef0a08328cc1bd1af12 /sys/arch/sparc/dev
parentc561b3ac449ce8baa4cd514495757d6ed54abb94 (diff)
add emulations for slinear:8 and ulinear:8; ok miod
Diffstat (limited to 'sys/arch/sparc/dev')
-rw-r--r--sys/arch/sparc/dev/amd7930.c36
1 files changed, 31 insertions, 5 deletions
diff --git a/sys/arch/sparc/dev/amd7930.c b/sys/arch/sparc/dev/amd7930.c
index 9a72a1a1b3d..35fc74685db 100644
--- a/sys/arch/sparc/dev/amd7930.c
+++ b/sys/arch/sparc/dev/amd7930.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: amd7930.c,v 1.23 2003/05/11 19:41:12 deraadt Exp $ */
+/* $OpenBSD: amd7930.c,v 1.24 2003/06/28 18:12:31 jason Exp $ */
/* $NetBSD: amd7930.c,v 1.37 1998/03/30 14:23:40 pk Exp $ */
/*
@@ -46,6 +46,7 @@
#include <sys/audioio.h>
#include <dev/audio_if.h>
+#include <dev/mulaw.h>
#include <dev/ic/am7930reg.h>
#include <sparc/dev/amd7930var.h>
@@ -387,12 +388,25 @@ amd7930_set_params(addr, setmode, usemode, p, r)
struct audio_params *p, *r;
{
if (p->sample_rate < 7500 || p->sample_rate > 8500 ||
- p->encoding != AUDIO_ENCODING_ULAW ||
- p->precision != 8 ||
- p->channels != 1)
+ p->precision != 8 || p->channels != 1)
return (EINVAL);
- p->sample_rate = 8000; /* no other rates supported by amd chip */
+ switch (p->encoding) {
+ case AUDIO_ENCODING_ULAW:
+ break;
+ case AUDIO_ENCODING_SLINEAR:
+ p->sw_code = slinear8_to_mulaw;
+ r->sw_code = mulaw_to_slinear8;
+ break;
+ case AUDIO_ENCODING_ULINEAR:
+ p->sw_code = ulinear8_to_mulaw;
+ r->sw_code = mulaw_to_ulinear8;
+ break;
+ default:
+ return (EINVAL);
+ }
+
+ p->sample_rate = 8000; /* no other rates supported by amd chip */
return (0);
}
@@ -408,6 +422,18 @@ amd7930_query_encoding(addr, fp)
fp->precision = 8;
fp->flags = 0;
break;
+ case 1:
+ strlcpy(fp->name, AudioEslinear, sizeof fp->name);
+ fp->encoding = AUDIO_ENCODING_SLINEAR;
+ fp->precision = 8;
+ fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
+ break;
+ case 2:
+ strlcpy(fp->name, AudioEulinear, sizeof fp->name);
+ fp->encoding = AUDIO_ENCODING_ULINEAR;
+ fp->precision = 8;
+ fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
+ break;
default:
return (EINVAL);
/*NOTREACHED*/