root/dev/isa/ym_isapnp.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. ym_isapnp_match
  2. ym_isapnp_attach

    1 /*      $OpenBSD: ym_isapnp.c,v 1.8 2002/03/14 01:26:57 millert Exp $ */
    2 
    3 
    4 /*
    5  * Copyright (c) 1998 Constantine Sapuntzakis. All rights reserved.
    6  * 
    7  * Redistribution and use in source and binary forms, with or without
    8  * modification, are permitted provided that the following conditions
    9  * are met:
   10  * 1. Redistributions of source code must retain the above copyright
   11  *    notice, this list of conditions and the following disclaimer.
   12  * 2. Redistributions in binary form must reproduce the above copyright
   13  *    notice, this list of conditions and the following disclaimer in the
   14  *    documentation and/or other materials provided with the distribution.
   15  * 3. The name of the author may not be used to endorse or promote products
   16  *    derived from this software without specific prior written permission.
   17  *
   18  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
   19  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   20  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   21  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
   22  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
   23  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
   24  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
   25  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   26  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
   27  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   28  */
   29 
   30 /*
   31  *  Driver for the Yamaha OPL3-SA3 chipset. This is found on many laptops
   32  *  and Pentium (II) motherboards.
   33  */
   34 
   35 #include "midi.h"
   36 
   37 #include <sys/param.h>
   38 #include <sys/systm.h>
   39 #include <sys/errno.h>
   40 #include <sys/ioctl.h>
   41 #include <sys/syslog.h>
   42 #include <sys/device.h>
   43 #include <sys/proc.h>
   44 
   45 #include <sys/audioio.h>
   46 #include <dev/audio_if.h>
   47 #include <dev/midi_if.h>
   48 
   49 #include <dev/isa/isavar.h>
   50 #include <dev/isa/isadmavar.h>
   51 
   52 #include <dev/ic/ad1848reg.h>
   53 #include <dev/isa/ad1848var.h>
   54 
   55 #include <dev/ic/cs4231reg.h>
   56 #include <dev/isa/cs4231var.h>
   57 #include <dev/ic/mpuvar.h>
   58 
   59 #include <dev/isa/wssreg.h>
   60 #include <dev/isa/ymvar.h>
   61 
   62 int     ym_isapnp_match(struct device *, void *, void *);
   63 void    ym_isapnp_attach(struct device *, struct device *, void *);
   64 
   65 struct cfattach ym_isapnp_ca = {
   66         sizeof(struct ym_softc), ym_isapnp_match, ym_isapnp_attach
   67 };
   68 
   69 /*
   70  * Probe / attach routines.
   71  */
   72 
   73 /*
   74  * Probe for the soundblaster hardware.
   75  */
   76 int
   77 ym_isapnp_match(parent, match, aux)
   78         struct device *parent;
   79         void *match, *aux;
   80 {
   81         struct isa_attach_args *ia = aux;
   82 
   83         if (ia->ipa_nio < 5)
   84                 return 0;
   85         return 1;
   86 }
   87 
   88 /*
   89  * Attach hardware to driver, attach hardware driver to audio
   90  * pseudo-device driver.
   91  */
   92 void
   93 ym_isapnp_attach(parent, self, aux)
   94         struct device *parent, *self;
   95         void *aux;
   96 {
   97         struct ym_softc *sc = (struct ym_softc *)self;
   98         struct isa_attach_args *ia = aux;
   99 
  100         sc->sc_iot = ia->ia_iot;
  101         sc->sc_ioh = ia->ipa_io[1].h;
  102         sc->sc_ic = ia->ia_ic;
  103 
  104         sc->ym_irq = ia->ipa_irq[0].num;
  105         sc->ym_drq = ia->ipa_drq[0].num;
  106         sc->ym_recdrq = ia->ipa_drq[1].num;
  107 
  108         sc->sc_controlioh = ia->ipa_io[4].h; 
  109 
  110         sc->sc_ad1848.sc_ioh = sc->sc_ioh;
  111         sc->sc_ad1848.sc_isa = parent->dv_parent;
  112         sc->sc_ad1848.sc_iot = sc->sc_iot;
  113         sc->sc_ad1848.sc_iooffs = WSS_CODEC;
  114         sc->sc_ad1848.mode = 2;
  115         sc->sc_ad1848.MCE_bit = MODE_CHANGE_ENABLE;
  116 
  117 #if NMIDI > 0
  118         sc->sc_mpu_sc.iobase = ia->ipa_io[3].base;
  119         sc->sc_mpu_sc.ioh = ia->ipa_io[3].h;
  120 #endif
  121 
  122         ym_attach(sc);
  123 }

/* [<][>][^][v][top][bottom][index][help] */