[BACK]Return to wss_isapnp.c CVS log [TXT][DIR] Up to [local] / sys / dev / isa

Annotation of sys/dev/isa/wss_isapnp.c, Revision 1.1.1.1

1.1       nbrk        1: /*     $OpenBSD; wss_isapnp.c,v1.0 1999/1/5 14:08:57 mike Exp $        */
                      2: /*     $NetBSD: wss_isapnp.c,v 1.5 1998/11/25 22:17:07 augustss Exp $  */
                      3:
                      4: /*
                      5:  * Copyright (c) 1997 The NetBSD Foundation, Inc.
                      6:  * All rights reserved.
                      7:  *
                      8:  * This code is derived from software contributed to The NetBSD Foundation
                      9:  * by Lennart Augustsson (augustss@netbsd.org).
                     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:  * 3. All advertising materials mentioning features or use of this software
                     20:  *    must display the following acknowledgement:
                     21:  *        This product includes software developed by the NetBSD
                     22:  *        Foundation, Inc. and its contributors.
                     23:  * 4. Neither the name of The NetBSD Foundation nor the names of its
                     24:  *    contributors may be used to endorse or promote products derived
                     25:  *    from this software without specific prior written permission.
                     26:  *
                     27:  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
                     28:  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
                     29:  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
                     30:  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
                     31:  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
                     32:  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
                     33:  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
                     34:  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
                     35:  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
                     36:  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
                     37:  * POSSIBILITY OF SUCH DAMAGE.
                     38:  */
                     39:
                     40: #include <sys/param.h>
                     41: #include <sys/systm.h>
                     42: #include <sys/errno.h>
                     43: #include <sys/ioctl.h>
                     44: #include <sys/syslog.h>
                     45: #include <sys/device.h>
                     46: #include <sys/proc.h>
                     47:
                     48: #include <machine/bus.h>
                     49:
                     50: #include <sys/audioio.h>
                     51: #include <dev/audio_if.h>
                     52:
                     53: #include <dev/isa/isavar.h>
                     54: #include <dev/isa/isadmavar.h>
                     55:
                     56: #include <dev/isa/isapnpreg.h>
                     57:
                     58: #include <dev/isa/ad1848var.h>
                     59: #include <dev/ic/ad1848reg.h>
                     60: #include <dev/isa/madreg.h>
                     61: #include <dev/isa/wssreg.h>
                     62: #include <dev/isa/wssvar.h>
                     63:
                     64: int    wss_isapnp_match(struct device *, void *, void *);
                     65: void   wss_isapnp_attach(struct device *, struct device *, void *);
                     66:
                     67: struct cfattach wss_isapnp_ca = {
                     68:        sizeof(struct wss_softc), wss_isapnp_match, wss_isapnp_attach
                     69: };
                     70:
                     71:
                     72: /*
                     73:  * Probe / attach routines.
                     74:  */
                     75:
                     76: /*
                     77:  * Probe for the WSS hardware.
                     78:  */
                     79: int
                     80: wss_isapnp_match(parent, match, aux)
                     81:        struct device *parent;
                     82:        void *match, *aux;
                     83: {
                     84:        return 1;
                     85: }
                     86:
                     87: /*
                     88:  * Attach hardware to driver, attach hardware driver to audio
                     89:  * pseudo-device driver.
                     90:  */
                     91: void
                     92: wss_isapnp_attach(parent, self, aux)
                     93:        struct device *parent, *self;
                     94:        void *aux;
                     95: {
                     96:        struct isapnp_softc *pnp = (struct isapnp_softc *)parent;
                     97:        struct wss_softc *sc = (struct wss_softc *)self;
                     98:        struct ad1848_softc *ac = &sc->sc_ad1848;
                     99:        struct isa_attach_args *ipa = aux;
                    100:
                    101:        /* probably broken */
                    102:        isapnp_write_reg(pnp, ISAPNP_CONFIG_CONTROL, 0x02);
                    103:
                    104:        sc->sc_iot = ipa->ia_iot;
                    105:        sc->sc_ioh = ipa->ipa_io[0].h;
                    106:        sc->mad_chip_type = MAD_NONE;
                    107:
                    108: /* Set up AD1848 I/O handle. */
                    109:        ac->sc_iot = sc->sc_iot;
                    110:        ac->sc_isa = parent->dv_parent;
                    111:        ac->sc_ioh = sc->sc_ioh;
                    112:        ac->mode = 2;
                    113:        ac->sc_iooffs = 0;
                    114:
                    115:        sc->sc_ic  = ipa->ia_ic;
                    116:        sc->wss_irq = ipa->ipa_irq[0].num;
                    117:        sc->wss_drq = ipa->ipa_drq[0].num;
                    118:        sc->wss_recdrq = ipa->ipa_ndrq > 1 ? ipa->ipa_drq[1].num :
                    119:            ipa->ipa_drq[0].num;
                    120:
                    121:        if (ad1848_probe(&sc->sc_ad1848)==0) {
                    122:                printf("%s: probe failed\n", ac->sc_dev.dv_xname);
                    123:                return;
                    124:        }
                    125:
                    126:        wssattach(sc);
                    127: }
                    128:

CVSweb