The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/dev/isa/gus_isapnp.c

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*      $OpenBSD: gus_isapnp.c,v 1.10 2022/04/06 18:59:28 naddy Exp $   */
    2 /*      $NetBSD: gus.c,v 1.51 1998/01/25 23:48:06 mycroft Exp $ */
    3 
    4 /*-
    5  * Copyright (c) 1996 The NetBSD Foundation, Inc.
    6  * All rights reserved.
    7  *
    8  * This code is derived from software contributed to The NetBSD Foundation
    9  * by Ken Hornstein and John Kohl.
   10  *
   11  * Redistribution and use in source and binary forms, with or without
   12  * modification, are permitted provided that the following conditions
   13  * are met:
   14  * 1. Redistributions of source code must retain the above copyright
   15  *    notice, this list of conditions and the following disclaimer.
   16  * 2. Redistributions in binary form must reproduce the above copyright
   17  *    notice, this list of conditions and the following disclaimer in the
   18  *    documentation and/or other materials provided with the distribution.
   19  *
   20  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
   21  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
   22  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
   23  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
   24  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
   25  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
   26  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
   27  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
   28  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
   29  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
   30  * POSSIBILITY OF SUCH DAMAGE.
   31  */
   32 
   33 /*
   34  *
   35  * TODO:
   36  *      . figure out why mixer activity while sound is playing causes problems
   37  *        (phantom interrupts?)
   38  *      . figure out a better deinterleave strategy that avoids sucking up
   39  *        CPU, memory and cache bandwidth.  (Maybe a special encoding?
   40  *        Maybe use the double-speed sampling/hardware deinterleave trick
   41  *        from the GUS SDK?)  A 486/33 isn't quite fast enough to keep
   42  *        up with 44.1kHz 16-bit stereo output without some drop-outs.
   43  *      . use CS4231 for 16-bit sampling, for a-law and mu-law playback.
   44  *      . actually test full-duplex sampling(recording) and playback.
   45  */
   46 
   47 /*
   48  * Gravis UltraSound driver
   49  *
   50  * For more detailed information, see the GUS developers' kit
   51  * available on the net at:
   52  *
   53  * ftp://freedom.nmsu.edu/pub/ultrasound/gravis/util/
   54  *      gusdkXXX.zip (developers' kit--get rev 2.22 or later)
   55  *              See ultrawrd.doc inside--it's MS Word (ick), but it's the bible
   56  *
   57  */
   58 
   59 /*
   60  * The GUS Max has a slightly strange set of connections between the CS4231
   61  * and the GF1 and the DMA interconnects.  It's set up so that the CS4231 can
   62  * be playing while the GF1 is loading patches from the system.
   63  *
   64  * Here's a recreation of the DMA interconnect diagram:
   65  *
   66  *       GF1
   67  *   +---------+                                 digital
   68  *   |         |  record                         ASIC
   69  *   |         |--------------+
   70  *   |         |              |                +--------+
   71  *   |         | play (dram)  |      +----+    |        |
   72  *   |         |--------------(------|-\  |    |   +-+  |
   73  *   +---------+              |      |  >-|----|---|C|--|------  dma chan 1
   74  *                            |  +---|-/  |    |   +-+  |
   75  *                            |  |   +----+    |    |   |
   76  *                            |  |   +----+    |    |   |
   77  *   +---------+        +-+   +--(---|-\  |    |    |   |
   78  *   |         | play   |8|      |   |  >-|----|----+---|------  dma chan 2
   79  *   | ---C----|--------|/|------(---|-/  |    |        |
   80  *   |    ^    |record  |1|      |   +----+    |        |
   81  *   |    |    |   /----|6|------+             +--------+
   82  *   | ---+----|--/     +-+
   83  *   +---------+
   84  *     CS4231   8-to-16 bit bus conversion, if needed
   85  *
   86  *
   87  * "C" is an optional combiner.
   88  *
   89  */
   90 
   91 #include <sys/param.h>
   92 #include <sys/systm.h>
   93 #include <sys/errno.h>
   94 #include <sys/ioctl.h>
   95 #include <sys/syslog.h>
   96 #include <sys/device.h>
   97 #include <sys/buf.h>
   98 #include <sys/fcntl.h>
   99 #include <sys/malloc.h>
  100 #include <sys/kernel.h>
  101 #include <sys/timeout.h>
  102 
  103 #include <machine/cpu.h>
  104 #include <machine/intr.h>
  105 #include <machine/bus.h>
  106 #include <machine/cpufunc.h>
  107 #include <sys/audioio.h>
  108 #include <dev/audio_if.h>
  109 
  110 #include <dev/isa/isavar.h>
  111 #include <dev/isa/isadmavar.h>
  112 
  113 #include <dev/ic/ics2101reg.h>
  114 #include <dev/ic/cs4231reg.h>
  115 #include <dev/ic/ad1848reg.h>
  116 #include <dev/isa/ics2101var.h>
  117 #include <dev/isa/ad1848var.h>
  118 #include <dev/isa/cs4231var.h>
  119 #include "gusreg.h"
  120 #include "gusvar.h"
  121 
  122 int     gus_isapnp_match(struct device *, void *, void *);
  123 void    gus_isapnp_attach(struct device *, struct device *, void *);
  124 
  125 const struct cfattach gus_isapnp_ca = {
  126         sizeof(struct gus_softc), gus_isapnp_match, gus_isapnp_attach
  127 };
  128 
  129 /*
  130  * Probe for the GUS hardware.
  131  */
  132 int
  133 gus_isapnp_match(struct device *parent, void *match, void *aux)
  134 {
  135         return 1;
  136 }
  137 
  138 void
  139 gus_isapnp_attach(struct device *parent, struct device *self, void *aux)
  140 {
  141         struct gus_softc *sc = (void *) self;
  142         struct isa_attach_args *ipa = aux;
  143 
  144         sc->sc_iot = ipa->ia_iot;
  145         sc->sc_iobase = ipa->ia_iobase;
  146 
  147         sc->sc_ioh1 = ipa->ipa_io[0].h;         /* p2xr */
  148         sc->sc_ioh2 = ipa->ipa_io[1].h;         /* p3xr */
  149         sc->sc_ioh3 = ipa->ipa_io[2].h;         /* codec/mixer */
  150         sc->sc_ioh4 = (bus_space_handle_t)NULL; /* midi */
  151 
  152         sc->sc_irq = ipa->ipa_irq[0].num;
  153         sc->sc_drq = ipa->ipa_drq[1].num;
  154         sc->sc_recdrq = ipa->ipa_drq[0].num;
  155         sc->sc_isa = parent->dv_parent;
  156 
  157         gus_subattach(sc, ipa);
  158 }

Cache object: 95efd9e8a6db8af25c0e415636e3cc13


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.