Home | History | Annotate | Line # | Download | only in pci
opl_yds.c revision 1.1
      1  1.1  minoura /*	$NetBSD: opl_yds.c,v 1.1 2001/03/30 14:32:08 minoura Exp $	*/
      2  1.1  minoura 
      3  1.1  minoura /*
      4  1.1  minoura  * Copyright (c) 1998 The NetBSD Foundation, Inc.
      5  1.1  minoura  * All rights reserved.
      6  1.1  minoura  *
      7  1.1  minoura  * This code is derived from software contributed to The NetBSD Foundation
      8  1.1  minoura  * by Lennart Augustsson (augustss (at) netbsd.org).
      9  1.1  minoura  *
     10  1.1  minoura  * Redistribution and use in source and binary forms, with or without
     11  1.1  minoura  * modification, are permitted provided that the following conditions
     12  1.1  minoura  * are met:
     13  1.1  minoura  * 1. Redistributions of source code must retain the above copyright
     14  1.1  minoura  *    notice, this list of conditions and the following disclaimer.
     15  1.1  minoura  * 2. Redistributions in binary form must reproduce the above copyright
     16  1.1  minoura  *    notice, this list of conditions and the following disclaimer in the
     17  1.1  minoura  *    documentation and/or other materials provided with the distribution.
     18  1.1  minoura  * 3. All advertising materials mentioning features or use of this software
     19  1.1  minoura  *    must display the following acknowledgement:
     20  1.1  minoura  *        This product includes software developed by the NetBSD
     21  1.1  minoura  *        Foundation, Inc. and its contributors.
     22  1.1  minoura  * 4. Neither the name of The NetBSD Foundation nor the names of its
     23  1.1  minoura  *    contributors may be used to endorse or promote products derived
     24  1.1  minoura  *    from this software without specific prior written permission.
     25  1.1  minoura  *
     26  1.1  minoura  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     27  1.1  minoura  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     28  1.1  minoura  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     29  1.1  minoura  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     30  1.1  minoura  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     31  1.1  minoura  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     32  1.1  minoura  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     33  1.1  minoura  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     34  1.1  minoura  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     35  1.1  minoura  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     36  1.1  minoura  * POSSIBILITY OF SUCH DAMAGE.
     37  1.1  minoura  */
     38  1.1  minoura 
     39  1.1  minoura #include <sys/param.h>
     40  1.1  minoura #include <sys/systm.h>
     41  1.1  minoura #include <sys/kernel.h>
     42  1.1  minoura #include <sys/errno.h>
     43  1.1  minoura #include <sys/device.h>
     44  1.1  minoura #include <sys/malloc.h>
     45  1.1  minoura #include <sys/proc.h>
     46  1.1  minoura #include <sys/conf.h>
     47  1.1  minoura #include <sys/select.h>
     48  1.1  minoura #include <sys/audioio.h>
     49  1.1  minoura #include <sys/midiio.h>
     50  1.1  minoura 
     51  1.1  minoura #include <machine/bus.h>
     52  1.1  minoura 
     53  1.1  minoura #include <dev/audio_if.h>
     54  1.1  minoura #include <dev/midi_if.h>
     55  1.1  minoura #include <dev/ic/oplreg.h>
     56  1.1  minoura #include <dev/ic/oplvar.h>
     57  1.1  minoura #include <dev/ic/ac97var.h>
     58  1.1  minoura 
     59  1.1  minoura #include <dev/pci/pcireg.h>
     60  1.1  minoura #include <dev/pci/pcivar.h>
     61  1.1  minoura 
     62  1.1  minoura #include <dev/pci/ydsreg.h>
     63  1.1  minoura #include <dev/pci/ydsvar.h>
     64  1.1  minoura 
     65  1.1  minoura int	opl_yds_match __P((struct device *, struct cfdata *, void *));
     66  1.1  minoura void	opl_yds_attach __P((struct device *, struct device *, void *));
     67  1.1  minoura 
     68  1.1  minoura struct cfattach opl_yds_ca = {
     69  1.1  minoura 	sizeof (struct opl_softc), opl_yds_match, opl_yds_attach
     70  1.1  minoura };
     71  1.1  minoura 
     72  1.1  minoura int
     73  1.1  minoura opl_yds_match(parent, match, aux)
     74  1.1  minoura 	struct device *parent;
     75  1.1  minoura 	struct cfdata *match;
     76  1.1  minoura 	void *aux;
     77  1.1  minoura {
     78  1.1  minoura 	struct audio_attach_args *aa = (struct audio_attach_args *)aux;
     79  1.1  minoura 	struct yds_softc *ssc = (struct yds_softc *)parent;
     80  1.1  minoura 	struct opl_softc sc;
     81  1.1  minoura 
     82  1.1  minoura 	if (aa->type != AUDIODEV_TYPE_OPL)
     83  1.1  minoura 		return (0);
     84  1.1  minoura 	memset(&sc, 0, sizeof sc);
     85  1.1  minoura 	sc.iot = ssc->sc_opl_iot;
     86  1.1  minoura 	sc.ioh = ssc->sc_opl_ioh;
     87  1.1  minoura 	return (opl_find(&sc));
     88  1.1  minoura }
     89  1.1  minoura 
     90  1.1  minoura void
     91  1.1  minoura opl_yds_attach(parent, self, aux)
     92  1.1  minoura 	struct device *parent;
     93  1.1  minoura 	struct device *self;
     94  1.1  minoura 	void *aux;
     95  1.1  minoura {
     96  1.1  minoura 	struct yds_softc *ssc = (struct yds_softc *)parent;
     97  1.1  minoura 	struct opl_softc *sc = (struct opl_softc *)self;
     98  1.1  minoura 
     99  1.1  minoura 	sc->ioh = ssc->sc_opl_ioh;
    100  1.1  minoura 	sc->iot = ssc->sc_opl_iot;
    101  1.1  minoura 	sc->offs = 0;
    102  1.1  minoura 	strcpy(sc->syn.name, "DS-1 integrated ");
    103  1.1  minoura 
    104  1.1  minoura 	opl_attach(sc);
    105  1.1  minoura }
    106