Source-Changes-HG archive

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

[src/trunk]: src Add a driver for the ESS Technology Solo-1 PCI AudioDrive li...



details:   https://anonhg.NetBSD.org/src/rev/e626f709200d
branches:  trunk
changeset: 474600:e626f709200d
user:      kleink <kleink%NetBSD.org@localhost>
date:      Mon Jul 12 15:13:30 1999 +0000

description:
Add a driver for the ESS Technology Solo-1 PCI AudioDrive line of chips.

diffstat:

 share/man/man4/Makefile |     4 +-
 share/man/man4/eso.4    |    68 +
 sys/dev/pci/eso.c       |  1821 +++++++++++++++++++++++++++++++++++++++++++++++
 sys/dev/pci/esoreg.h    |   244 ++++++
 sys/dev/pci/esovar.h    |   137 +++
 sys/dev/pci/files.pci   |    10 +-
 sys/dev/pci/opl_eso.c   |   101 ++
 7 files changed, 2382 insertions(+), 3 deletions(-)

diffs (truncated from 2430 to 300 lines):

diff -r a629f81e132b -r e626f709200d share/man/man4/Makefile
--- a/share/man/man4/Makefile   Mon Jul 12 15:04:41 1999 +0000
+++ b/share/man/man4/Makefile   Mon Jul 12 15:13:30 1999 +0000
@@ -1,9 +1,9 @@
-#      $NetBSD: Makefile,v 1.92 1999/07/01 10:55:53 itojun Exp $
+#      $NetBSD: Makefile,v 1.93 1999/07/12 15:13:30 kleink Exp $
 #      @(#)Makefile    8.1 (Berkeley) 6/18/93
 
 MAN=   ahb.4 ahc.4 aria.4 atalk.4 audio.4 bha.4 bpf.4 ccd.4 cd.4 ch.4 \
        clnp.4 cltp.4 ddb.4 drum.4 eap.4 eisa.4 en.4 ep.4 esh.4 esis.4 \
-       exphy.4 fd.4 fpa.4 fxp.4 gre.4 icmp.4 icsphy.4 idp.4 ifmedia.4 \
+       eso.4 exphy.4 fd.4 fpa.4 fxp.4 gre.4 icmp.4 icsphy.4 idp.4 ifmedia.4 \
        inet.4 inphy.4 ip.4 ipip.4 iso.4 isp.4 lc.4 lkm.4 lo.4 lxtphy.4 md.4 \
        midi.4 mii.4 mtio.4 ncr.4 ne.4 netintro.4 ns.4 nsip.4 nsphy.4 \
        null.4 opl.4 options.4 pcdisplay.4 pciide.4 pckbc.4 pckbd.4 pcppi.4 \
diff -r a629f81e132b -r e626f709200d share/man/man4/eso.4
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/share/man/man4/eso.4      Mon Jul 12 15:13:30 1999 +0000
@@ -0,0 +1,68 @@
+.\"    $NetBSD: eso.4,v 1.1 1999/07/12 15:13:30 kleink Exp $
+.\"
+.\" Copyright (c) 1999 Klaus J. Klein
+.\" 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. 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.
+.\"
+.Dd July 12, 1999
+.Dt ESO 4
+.Os
+.Sh NAME
+.Nm eso
+.Nd ESS Technology Solo-1 PCI AudioDrive device driver
+.Sh SYNOPSIS
+.Cd "eso*   at pci? dev ? function ?"
+.Cd "audio* at eso?"
+.Cd "opl*   at eso?"
+.Sh DESCRIPTION
+The
+.Nm
+device driver supports sound cards based on ESS Technology Solo-1
+PCI AudioDrive chips (ES1938 and ES1946),
+e.g. the TerraTec 128i PCI card.
+.Sh DIAGNOSTICS
+.Bl -diag
+.It "eso0: can't map Audio 1 DMA into I/O space"
+PCI autoconfiguration did not map the first audio channel DMA controller into
+I/O space at a suitable address, and the driver was not able map it by itself.
+In that case only playback functionality will be available.
+.It "eso0: reset timeout"
+The device failed to acknowledge being reset.
+.It "eso0: RDR timeout"
+The driver timed out reading data from a controller register.
+.It "eso0: WDR timeout"
+The driver timed out waiting to send a command or writing to a controller
+register.
+.El
+.Sh BUGS
+The game port and MIDI port are not supported.
+.Sh SEE ALSO
+.Xr audio 4 ,
+.Xr pci 4
+.Sh HISTORY
+The
+.Nm
+device driver appeared in
+.Nx 1.5 .
diff -r a629f81e132b -r e626f709200d sys/dev/pci/eso.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/dev/pci/eso.c Mon Jul 12 15:13:30 1999 +0000
@@ -0,0 +1,1821 @@
+/*     $NetBSD: eso.c,v 1.1 1999/07/12 15:13:31 kleink Exp $   */
+
+/*
+ * Copyright (c) 1999 Klaus J. Klein
+ * 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. 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.
+ */
+
+/*
+ * ESS Technology Inc. Solo-1 PCI AudioDrive (ES1938/1946) device driver.
+ */
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/kernel.h>
+#include <sys/malloc.h>
+#include <sys/device.h>
+#include <sys/proc.h>
+
+#include <dev/pci/pcidevs.h>
+#include <dev/pci/pcivar.h>
+
+#include <sys/audioio.h>
+#include <dev/audio_if.h>
+#include <dev/midi_if.h>
+
+#include <dev/mulaw.h>
+#include <dev/auconv.h>
+
+#include <dev/isa/mpuvar.h>    /* XXX move this out of dev/isa */
+#include <dev/ic/i8237reg.h>
+#include <dev/pci/esoreg.h>
+#include <dev/pci/esovar.h>
+
+#include <machine/bus.h>
+#include <machine/intr.h>
+
+#if BYTE_ORDER == BIG_ENDIAN
+#include <machine/bswap.h>
+#define htopci(x) bswap32(x)
+#define pcitoh(x) bswap32(x)
+#else
+#define htopci(x) (x)
+#define pcitoh(x) (x)
+#endif
+
+
+#if defined(AUDIO_DEBUG) || defined(DEBUG)
+#define DPRINTF(x) printf x
+#else
+#define DPRINTF(x)
+#endif
+
+struct eso_dma {
+       bus_dmamap_t            ed_map;
+       caddr_t                 ed_addr;
+       bus_dma_segment_t       ed_segs[1];
+       int                     ed_nsegs;
+       size_t                  ed_size;
+       struct eso_dma *        ed_next;
+};
+
+#define KVADDR(dma)    ((void *)(dma)->ed_addr)
+#define DMAADDR(dma)   ((dma)->ed_map->dm_segs[0].ds_addr)
+
+/* Autoconfiguration interface */
+static int eso_match __P((struct device *, struct cfdata *, void *));
+static void eso_attach __P((struct device *, struct device *, void *));
+static void eso_defer __P((struct device *));
+
+struct cfattach eso_ca = {
+       sizeof (struct eso_softc), eso_match, eso_attach
+};
+
+/* PCI interface */
+static int eso_intr __P((void *));
+
+/* MI audio layer interface */
+static int     eso_open __P((void *, int));
+static void    eso_close __P((void *));
+static int     eso_query_encoding __P((void *, struct audio_encoding *));
+static int     eso_set_params __P((void *, int, int, struct audio_params *,
+                   struct audio_params *));
+static int     eso_round_blocksize __P((void *, int));
+static int     eso_halt_output __P((void *));
+static int     eso_halt_input __P((void *));
+static int     eso_getdev __P((void *, struct audio_device *));
+static int     eso_set_port __P((void *, mixer_ctrl_t *));
+static int     eso_get_port __P((void *, mixer_ctrl_t *));
+static int     eso_query_devinfo __P((void *, mixer_devinfo_t *));
+static void *  eso_allocm __P((void *, int, size_t, int, int));
+static void    eso_freem __P((void *, void *, int));
+static size_t  eso_round_buffersize __P((void *, int, size_t));
+static int     eso_mappage __P((void *, void *, int, int));
+static int     eso_get_props __P((void *));
+static int     eso_trigger_output __P((void *, void *, void *, int,
+                   void (*)(void *), void *, struct audio_params *));
+static int     eso_trigger_input __P((void *, void *, void *, int,
+                   void (*)(void *), void *, struct audio_params *));
+
+static struct audio_hw_if eso_hw_if = {
+       eso_open,
+       eso_close,
+       NULL,                   /* drain */
+       eso_query_encoding,
+       eso_set_params,
+       eso_round_blocksize,
+       NULL,                   /* commit_settings */
+       NULL,                   /* init_output */
+       NULL,                   /* init_input */
+       NULL,                   /* start_output */
+       NULL,                   /* start_input */
+       eso_halt_output,
+       eso_halt_input,
+       NULL,                   /* speaker_ctl */
+       eso_getdev,
+       NULL,                   /* setfd */
+       eso_set_port,
+       eso_get_port,
+       eso_query_devinfo,
+       eso_allocm,
+       eso_freem,
+       eso_round_buffersize,
+       eso_mappage,
+       eso_get_props,
+       eso_trigger_output,
+       eso_trigger_input
+};
+
+static const char * const eso_rev2model[] = {
+       "ES1938",
+       "ES1946"
+};
+
+
+/*
+ * Utility routines
+ */
+/* Register access etc. */
+static uint8_t eso_read_ctlreg __P((struct eso_softc *, uint8_t));
+static uint8_t eso_read_mixreg __P((struct eso_softc *, uint8_t));
+static uint8_t eso_read_rdr __P((struct eso_softc *));
+static int     eso_reset __P((struct eso_softc *));
+static void    eso_set_gain __P((struct eso_softc *, unsigned int));
+static int     eso_set_recsrc __P((struct eso_softc *, unsigned int));
+static void    eso_write_cmd __P((struct eso_softc *, uint8_t));
+static void    eso_write_ctlreg __P((struct eso_softc *, uint8_t, uint8_t));
+static void    eso_write_mixreg __P((struct eso_softc *, uint8_t, uint8_t));
+/* DMA memory allocation */
+static int     eso_allocmem __P((struct eso_softc *, size_t, size_t, size_t,
+                   int, struct eso_dma *));
+static void    eso_freemem __P((struct eso_softc *, struct eso_dma *));
+
+
+static int
+eso_match(parent, match, aux)
+       struct device *parent;
+       struct cfdata *match;
+       void *aux;
+{
+       struct pci_attach_args *pa = aux;
+
+       if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_ESSTECH &&
+           PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_ESSTECH_SOLO1)
+               return (1);
+
+       return (0);
+}
+
+static void
+eso_attach(parent, self, aux)
+       struct device *parent, *self;
+       void *aux;
+{
+       struct eso_softc *sc = (struct eso_softc *)self;
+       struct pci_attach_args *pa = aux;
+       struct audio_attach_args aa;
+       pci_intr_handle_t ih;
+       bus_addr_t vcbase;
+       const char *intrstring;
+       int idx;
+       uint8_t a2mode;
+
+       sc->sc_revision = PCI_REVISION(pa->pa_class);
+
+       printf(": ESS Solo-1 PCI AudioDrive ");
+       if (sc->sc_revision <=



Home | Main Index | Thread Index | Old Index