Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/vax Add audio support for VAXstation VLC, 60 and 90...
details: https://anonhg.NetBSD.org/src/rev/35ecaa1faaaf
branches: trunk
changeset: 334975:35ecaa1faaaf
user: jklos <jklos%NetBSD.org@localhost>
date: Fri Dec 19 04:44:13 2014 +0000
description:
Add audio support for VAXstation VLC, 60 and 90 machines. Originally rom
Blaz Antonic and ported from OpenBSD by Bj?rn Johannesso. Tested on VLC
and 4000/60.
diffstat:
sys/arch/vax/conf/GENERIC | 7 +-
sys/arch/vax/conf/files.vax | 7 +-
sys/arch/vax/conf/majors.vax | 3 +-
sys/arch/vax/vsa/vsaudio.c | 587 +++++++++++++++++++++++++++++++++++++++++++
4 files changed, 600 insertions(+), 4 deletions(-)
diffs (truncated from 657 to 300 lines):
diff -r 2ac7a4945885 -r 35ecaa1faaaf sys/arch/vax/conf/GENERIC
--- a/sys/arch/vax/conf/GENERIC Fri Dec 19 04:31:41 2014 +0000
+++ b/sys/arch/vax/conf/GENERIC Fri Dec 19 04:44:13 2014 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.193 2014/11/16 16:01:43 manu Exp $
+# $NetBSD: GENERIC,v 1.194 2014/12/19 04:44:13 jklos Exp $
#
# GENERIC machine description file
#
@@ -22,7 +22,7 @@
options INCLUDE_CONFIG_FILE # embed config file in kernel binary
-#ident "GENERIC-$Revision: 1.193 $"
+#ident "GENERIC-$Revision: 1.194 $"
# Here are all different supported CPU types listed.
#options VAX8800 # VAX 8500, 8530, 8550, 8700, 8800
@@ -206,6 +206,9 @@
#clr0 at vsbus0 csr 0x30000000 # 4- or 8-bitplans color graphics
spx0 at vsbus0 csr 0x38000000 # Low Cost SPX on VS4000/90.
#lcg0 at vsbus0 csr 0x21801000 # VS4000/60 (or VLC) graphics
+vsaudio0 at vsbus0 csr 0x200d0000 # VS4000/60 (or VLC) audio
+vsaudio0 at vsbus0 csr 0x26800000 # VS4000/90 audio
+audio* at audiobus?
tc0 at vsbus0 csr 0x36000000 # VS4000/60 or 90 TC adapter
tcds* at tc0 slot ? offset ? # TC dual SCSI controller
asc* at tcds? chip ? # PMAZB/C
diff -r 2ac7a4945885 -r 35ecaa1faaaf sys/arch/vax/conf/files.vax
--- a/sys/arch/vax/conf/files.vax Fri Dec 19 04:31:41 2014 +0000
+++ b/sys/arch/vax/conf/files.vax Fri Dec 19 04:44:13 2014 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: files.vax,v 1.118 2011/06/12 03:35:49 rmind Exp $
+# $NetBSD: files.vax,v 1.119 2014/12/19 04:44:13 jklos Exp $
#
# new style config file for vax architecture
#
@@ -315,6 +315,11 @@
attach dh at uba
file arch/vax/uba/dh.c dh needs-flag
+# Vaxstation 4000 audio
+device vsaudio: audiobus, am7930
+attach vsaudio at vsbus
+file arch/vax/vsa/vsaudio.c vsaudio needs-flag
+
# These are general files needed for compilation.
file dev/cons.c
file dev/cninit.c
diff -r 2ac7a4945885 -r 35ecaa1faaaf sys/arch/vax/conf/majors.vax
--- a/sys/arch/vax/conf/majors.vax Fri Dec 19 04:31:41 2014 +0000
+++ b/sys/arch/vax/conf/majors.vax Fri Dec 19 04:44:13 2014 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: majors.vax,v 1.24 2012/06/22 20:42:23 abs Exp $
+# $NetBSD: majors.vax,v 1.25 2014/12/19 04:44:13 jklos Exp $
#
# Device majors for vax
#
@@ -84,6 +84,7 @@
device-major ses char 81 ses
device-major nsmb char 98 nsmb
+device-major audio char 99 audio
#
# block-device-only devices
diff -r 2ac7a4945885 -r 35ecaa1faaaf sys/arch/vax/vsa/vsaudio.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/vax/vsa/vsaudio.c Fri Dec 19 04:44:13 2014 +0000
@@ -0,0 +1,587 @@
+/* $OpenBSD: vsaudio.c,v 1.4 2013/05/15 21:21:11 ratchov Exp $ */
+
+/*
+ * Copyright (c) 2011 Miodrag Vallat.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+/*
+ * Copyright (c) 1995 Rolf Grossmann
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by Rolf Grossmann.
+ * 4. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * Audio backend for the VAXstation 4000 AMD79C30 audio chip.
+ * Currently working in pseudo-DMA mode; DMA operation may be possible and
+ * needs to be investigated.
+ */
+/*
+ * Although he did not claim copyright for his work, this code owes a lot
+ * to Blaz Antonic <blaz.antonic%siol.net@localhost> who figured out a working
+ * interrupt triggering routine in vsaudio_match().
+ */
+/*
+ * Ported to NetBSD, from OpenBSD, by Björn Johannesson (rherdware%yahoo.com@localhost)
+ * in December 2014
+ */
+
+#include "audio.h"
+#if NAUDIO > 0
+
+#include <sys/errno.h>
+#include <sys/evcnt.h>
+#include <sys/intr.h>
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/device.h>
+
+#include <machine/cpu.h>
+#include <machine/sid.h>
+#include <machine/scb.h>
+#include <machine/vsbus.h>
+
+#include <sys/audioio.h>
+#include <dev/audio_if.h>
+#include <dev/auconv.h>
+
+#include <dev/ic/am7930reg.h>
+#include <dev/ic/am7930var.h>
+
+#ifdef AUDIO_DEBUG
+#define DPRINTF(x) if (am7930debug) printf x
+#define DPRINTFN(n,x) if (am7930debug>(n)) printf x
+#else
+#define DPRINTF(x)
+#define DPRINTFN(n,x)
+#endif /* AUDIO_DEBUG */
+
+/* physical addresses of the AM79C30 chip */
+#define VSAUDIO_CSR 0x200d0000
+#define VSAUDIO_CSR_KA49 0x26800000
+
+/* pdma state */
+struct auio {
+ bus_space_tag_t au_bt; /* bus tag */
+ bus_space_handle_t au_bh; /* handle to chip registers */
+
+ uint8_t *au_rdata; /* record data */
+ uint8_t *au_rend; /* end of record data */
+ uint8_t *au_pdata; /* play data */
+ uint8_t *au_pend; /* end of play data */
+ struct evcnt au_intrcnt; /* statistics */
+};
+
+struct am7930_intrhand {
+ int (*ih_fun)(void *);
+ void *ih_arg;
+};
+
+
+struct vsaudio_softc {
+ struct am7930_softc sc_am7930; /* glue to MI code */
+ bus_space_tag_t sc_bt; /* bus cookie */
+ bus_space_handle_t sc_bh; /* device registers */
+
+ struct am7930_intrhand sc_ih; /* interrupt vector (hw or sw) */
+ void (*sc_rintr)(void*); /* input completion intr handler */
+ void *sc_rarg; /* arg for sc_rintr() */
+ void (*sc_pintr)(void*); /* output completion intr handler */
+ void *sc_parg; /* arg for sc_pintr() */
+
+ uint8_t *sc_rdata; /* record data */
+ uint8_t *sc_rend; /* end of record data */
+ uint8_t *sc_pdata; /* play data */
+ uint8_t *sc_pend; /* end of play data */
+
+ struct auio sc_au; /* recv and xmit buffers, etc */
+#define sc_intrcnt sc_au.au_intrcnt /* statistics */
+ void *sc_sicookie; /* softintr(9) cookie */
+ int sc_cvec;
+ kmutex_t sc_lock;
+};
+
+static int vsaudio_match(struct device *parent, struct cfdata *match, void *);
+static void vsaudio_attach(device_t parent, device_t self, void *);
+
+CFATTACH_DECL_NEW(vsaudio, sizeof(struct vsaudio_softc), vsaudio_match,
+ vsaudio_attach, NULL, NULL);
+
+/*
+ * Hardware access routines for the MI code
+ */
+uint8_t vsaudio_codec_iread(struct am7930_softc *, int);
+uint16_t vsaudio_codec_iread16(struct am7930_softc *, int);
+uint8_t vsaudio_codec_dread(struct vsaudio_softc *, int);
+void vsaudio_codec_iwrite(struct am7930_softc *, int, uint8_t);
+void vsaudio_codec_iwrite16(struct am7930_softc *, int, uint16_t);
+void vsaudio_codec_dwrite(struct vsaudio_softc *, int, uint8_t);
+void vsaudio_onopen(struct am7930_softc *);
+void vsaudio_onclose(struct am7930_softc *);
+
+/*
+static stream_filter_factory_t vsaudio_output_conv;
+static stream_filter_factory_t vsaudio_input_conv;
+static int vsaudio_output_conv_fetch_to(struct audio_softc *,
+ stream_fetcher_t *, audio_stream_t *, int);
+static int vsaudio_input_conv_fetch_to(struct audio_softc *,
+ stream_fetcher_t *, audio_stream_t *, int);
+ */
+
+struct am7930_glue vsaudio_glue = {
+ vsaudio_codec_iread,
+ vsaudio_codec_iwrite,
+ vsaudio_codec_iread16,
+ vsaudio_codec_iwrite16,
+ vsaudio_onopen,
+ vsaudio_onclose,
+ 0,
+ /*vsaudio_input_conv*/0,
+ /*vsaudio_output_conv*/0,
+};
+
+/*
+ * Interface to the MI audio layer.
+ */
+int vsaudio_start_output(void *, void *, int, void (*)(void *), void *);
+int vsaudio_start_input(void *, void *, int, void (*)(void *), void *);
+int vsaudio_getdev(void *, struct audio_device *);
+void vsaudio_get_locks(void *opaque, kmutex_t **intr, kmutex_t **thread);
+
+struct audio_hw_if vsaudio_hw_if = {
+ am7930_open,
+ am7930_close,
+ NULL,
+ am7930_query_encoding,
+ am7930_set_params,
+ am7930_round_blocksize,
+ am7930_commit_settings,
+ NULL,
+ NULL,
+ vsaudio_start_output,
+ vsaudio_start_input,
+ am7930_halt_output,
+ am7930_halt_input,
+ NULL,
+ vsaudio_getdev,
+ NULL,
+ am7930_set_port,
+ am7930_get_port,
+ am7930_query_devinfo,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ am7930_get_props,
+ NULL,
+ NULL,
+ NULL,
+ vsaudio_get_locks,
+};
+
+
+struct audio_device vsaudio_device = {
+ "am7930",
+ "x",
+ "vsaudio"
+};
+
+void vsaudio_hwintr(void *);
+void vsaudio_swintr(void *);
+struct auio *auiop;
+
+
+static int
+vsaudio_match(struct device *parent, struct cfdata *match, void *aux)
+{
Home |
Main Index |
Thread Index |
Old Index