Home | History | Annotate | Line # | Download | only in pci
opl_yds.c revision 1.5.6.3
      1  1.5.6.3    skrll /*	$NetBSD: opl_yds.c,v 1.5.6.3 2004/09/21 13:31:04 skrll 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.5.6.1    skrll  * 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.2    lukem 
     39      1.2    lukem #include <sys/cdefs.h>
     40  1.5.6.3    skrll __KERNEL_RCSID(0, "$NetBSD: opl_yds.c,v 1.5.6.3 2004/09/21 13:31:04 skrll Exp $");
     41      1.1  minoura 
     42      1.1  minoura #include <sys/param.h>
     43      1.1  minoura #include <sys/systm.h>
     44      1.1  minoura #include <sys/kernel.h>
     45      1.1  minoura #include <sys/errno.h>
     46      1.1  minoura #include <sys/device.h>
     47      1.1  minoura #include <sys/malloc.h>
     48      1.1  minoura #include <sys/proc.h>
     49      1.1  minoura #include <sys/conf.h>
     50      1.1  minoura #include <sys/select.h>
     51      1.1  minoura #include <sys/audioio.h>
     52      1.1  minoura #include <sys/midiio.h>
     53      1.1  minoura 
     54      1.1  minoura #include <machine/bus.h>
     55      1.1  minoura 
     56      1.1  minoura #include <dev/audio_if.h>
     57      1.1  minoura #include <dev/midi_if.h>
     58      1.1  minoura #include <dev/ic/oplreg.h>
     59      1.1  minoura #include <dev/ic/oplvar.h>
     60      1.1  minoura #include <dev/ic/ac97var.h>
     61      1.1  minoura 
     62      1.1  minoura #include <dev/pci/pcireg.h>
     63      1.1  minoura #include <dev/pci/pcivar.h>
     64      1.1  minoura 
     65      1.1  minoura #include <dev/pci/ydsreg.h>
     66      1.1  minoura #include <dev/pci/ydsvar.h>
     67      1.1  minoura 
     68      1.1  minoura int	opl_yds_match __P((struct device *, struct cfdata *, void *));
     69      1.1  minoura void	opl_yds_attach __P((struct device *, struct device *, void *));
     70      1.1  minoura 
     71      1.4  thorpej CFATTACH_DECL(opl_yds, sizeof (struct opl_softc),
     72      1.5  thorpej     opl_yds_match, opl_yds_attach, NULL, NULL);
     73      1.1  minoura 
     74      1.1  minoura int
     75      1.1  minoura opl_yds_match(parent, match, aux)
     76      1.1  minoura 	struct device *parent;
     77      1.1  minoura 	struct cfdata *match;
     78      1.1  minoura 	void *aux;
     79      1.1  minoura {
     80      1.1  minoura 	struct audio_attach_args *aa = (struct audio_attach_args *)aux;
     81      1.1  minoura 	struct yds_softc *ssc = (struct yds_softc *)parent;
     82      1.1  minoura 	struct opl_softc sc;
     83      1.1  minoura 
     84      1.1  minoura 	if (aa->type != AUDIODEV_TYPE_OPL)
     85      1.1  minoura 		return (0);
     86      1.1  minoura 	memset(&sc, 0, sizeof sc);
     87      1.1  minoura 	sc.iot = ssc->sc_opl_iot;
     88      1.1  minoura 	sc.ioh = ssc->sc_opl_ioh;
     89      1.1  minoura 	return (opl_find(&sc));
     90      1.1  minoura }
     91      1.1  minoura 
     92      1.1  minoura void
     93      1.1  minoura opl_yds_attach(parent, self, aux)
     94      1.1  minoura 	struct device *parent;
     95      1.1  minoura 	struct device *self;
     96      1.1  minoura 	void *aux;
     97      1.1  minoura {
     98      1.1  minoura 	struct yds_softc *ssc = (struct yds_softc *)parent;
     99      1.1  minoura 	struct opl_softc *sc = (struct opl_softc *)self;
    100      1.1  minoura 
    101      1.1  minoura 	sc->ioh = ssc->sc_opl_ioh;
    102      1.1  minoura 	sc->iot = ssc->sc_opl_iot;
    103      1.1  minoura 	sc->offs = 0;
    104      1.1  minoura 	strcpy(sc->syn.name, "DS-1 integrated ");
    105      1.1  minoura 
    106      1.1  minoura 	opl_attach(sc);
    107      1.1  minoura }
    108