1 /* $NetBSD: opl_esl.c,v 1.7 2002/10/02 16:52:20 thorpej Exp $ */
2
3 /*
4 * Copyright (c) 2001 Jared D. McNeill <jmcneill@invisible.yi.org>
5 * 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. All advertising materials mentioning features or use of this software
16 * must display the following acknowledgement:
17 * This product includes software developed by Jared D. McNeill.
18 * 4. Neither the name of the author nor the names of any contributors may
19 f
20 * be used to endorse or promote products derived from this software
21 * without specific prior written permission.
22 *
23 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 * SUCH DAMAGE.
34 *
35 */
36
37 #include <sys/cdefs.h>
38 __KERNEL_RCSID(0, "$NetBSD: opl_esl.c,v 1.7 2002/10/02 16:52:20 thorpej Exp $");
39
40 #include <sys/param.h>
41 #include <sys/systm.h>
42 #include <sys/kernel.h>
43 #include <sys/errno.h>
44 #include <sys/device.h>
45 #include <sys/malloc.h>
46 #include <sys/proc.h>
47 #include <sys/conf.h>
48 #include <sys/select.h>
49 #include <sys/audioio.h>
50 #include <sys/midiio.h>
51
52 #include <machine/bus.h>
53
54 #include <dev/audio_if.h>
55 #include <dev/midi_if.h>
56 #include <dev/ic/oplreg.h>
57 #include <dev/ic/oplvar.h>
58
59 #include <dev/pcmcia/pcmciavar.h>
60 #include <dev/pcmcia/eslvar.h>
61
62 int opl_esl_match(struct device *, struct cfdata *, void *);
63 void opl_esl_attach(struct device *, struct device *, void *);
64 int opl_esl_detach(struct device *, int);
65
66 CFATTACH_DECL(opl_esl, sizeof(struct opl_softc),
67 opl_esl_match, opl_esl_attach, opl_esl_detach, NULL);
68
69 int
70 opl_esl_match(struct device *parent, struct cfdata *match, void *aux)
71 {
72 struct audio_attach_args *aa = (struct audio_attach_args *)aux;
73 struct esl_pcmcia_softc *ssc = (struct esl_pcmcia_softc *)parent;
74 struct opl_softc sc;
75
76 if (aa->type != AUDIODEV_TYPE_OPL)
77 return (0);
78 memset(&sc, 0, sizeof(sc));
79 sc.iot = ssc->sc_pcioh.iot;
80 sc.ioh = ssc->sc_pcioh.ioh;
81
82 return (opl_find(&sc));
83 }
84
85 void
86 opl_esl_attach(struct device *parent, struct device *self, void *aux)
87 {
88 struct esl_pcmcia_softc *ssc = (struct esl_pcmcia_softc *)parent;
89 struct opl_softc *sc = (struct opl_softc *)self;
90
91 sc->iot = ssc->sc_pcioh.iot;
92 sc->ioh = ssc->sc_pcioh.ioh;
93 sc->offs = 0;
94 strcpy(sc->syn.name, "ESS AudioDrive ");
95
96 opl_attach(sc);
97 }
98
99 int
100 opl_esl_detach(struct device *self, int flags)
101 {
102 struct opl_softc *sc = (struct opl_softc *)self;
103 int rv;
104
105 rv = opl_detach(sc, flags);
106
107 return (rv);
108 }
Cache object: eea0239de496666d3fd552f7bd398bbd
|