acemidi.c revision 1.1
11.1Sbjh21/* $NetBSD: acemidi.c,v 1.1 2001/04/14 20:39:23 bjh21 Exp $ */ 21.1Sbjh21 31.1Sbjh21/*- 41.1Sbjh21 * Copyright (c) 2001 Ben Harris 51.1Sbjh21 * All rights reserved. 61.1Sbjh21 * 71.1Sbjh21 * Redistribution and use in source and binary forms, with or without 81.1Sbjh21 * modification, are permitted provided that the following conditions 91.1Sbjh21 * are met: 101.1Sbjh21 * 1. Redistributions of source code must retain the above copyright 111.1Sbjh21 * notice, this list of conditions and the following disclaimer. 121.1Sbjh21 * 2. Redistributions in binary form must reproduce the above copyright 131.1Sbjh21 * notice, this list of conditions and the following disclaimer in the 141.1Sbjh21 * documentation and/or other materials provided with the distribution. 151.1Sbjh21 * 3. The name of the author may not be used to endorse or promote products 161.1Sbjh21 * derived from this software without specific prior written permission. 171.1Sbjh21 * 181.1Sbjh21 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 191.1Sbjh21 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 201.1Sbjh21 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 211.1Sbjh21 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 221.1Sbjh21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 231.1Sbjh21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 241.1Sbjh21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 251.1Sbjh21 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 261.1Sbjh21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 271.1Sbjh21 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 281.1Sbjh21 */ 291.1Sbjh21 301.1Sbjh21#include <sys/param.h> 311.1Sbjh21 321.1Sbjh21__KERNEL_RCSID(0, "$NetBSD: acemidi.c,v 1.1 2001/04/14 20:39:23 bjh21 Exp $"); 331.1Sbjh21 341.1Sbjh21#include <sys/device.h> 351.1Sbjh21#include <sys/systm.h> 361.1Sbjh21 371.1Sbjh21#include <machine/bus.h> 381.1Sbjh21 391.1Sbjh21#include <dev/podulebus/podulebus.h> 401.1Sbjh21#include <dev/podulebus/podules.h> 411.1Sbjh21#include <dev/podulebus/acemidireg.h> 421.1Sbjh21 431.1Sbjh21#include <sys/termios.h> 441.1Sbjh21#include <dev/ic/comvar.h> 451.1Sbjh21#include <dev/ic/comreg.h> 461.1Sbjh21 471.1Sbjh21struct acemidi_softc { 481.1Sbjh21 struct device sc_dev; 491.1Sbjh21}; 501.1Sbjh21 511.1Sbjh21struct com_acemidi_softc { 521.1Sbjh21 struct com_softc sc_com; 531.1Sbjh21 struct evcnt sc_intrcnt; 541.1Sbjh21}; 551.1Sbjh21 561.1Sbjh21static int acemidi_match(struct device *, struct cfdata *, void *); 571.1Sbjh21static void acemidi_attach(struct device *, struct device *, void *); 581.1Sbjh21static int com_acemidi_match(struct device *, struct cfdata *, void *); 591.1Sbjh21static void com_acemidi_attach(struct device *, struct device *, void *); 601.1Sbjh21 611.1Sbjh21struct cfattach acemidi_ca = { 621.1Sbjh21 sizeof(struct acemidi_softc), acemidi_match, acemidi_attach 631.1Sbjh21}; 641.1Sbjh21 651.1Sbjh21struct cfattach com_acemidi_ca = { 661.1Sbjh21 sizeof(struct com_acemidi_softc), com_acemidi_match, com_acemidi_attach 671.1Sbjh21}; 681.1Sbjh21 691.1Sbjh21static int 701.1Sbjh21acemidi_match(struct device *parent, struct cfdata *cf, void *aux) 711.1Sbjh21{ 721.1Sbjh21 struct podulebus_attach_args *pa = aux; 731.1Sbjh21 741.1Sbjh21 if (pa->pa_product == PODULE_MCS_MIDICONNECT) 751.1Sbjh21 return 1; 761.1Sbjh21 return 0; 771.1Sbjh21} 781.1Sbjh21 791.1Sbjh21static void 801.1Sbjh21acemidi_attach(struct device *parent, struct device *self, void *aux) 811.1Sbjh21{ 821.1Sbjh21/* struct acemidi_softc *sc = (void *)self; */ 831.1Sbjh21/* struct podulebus_attach_args *pa = aux; */ 841.1Sbjh21 851.1Sbjh21 printf("\n"); 861.1Sbjh21 config_found_sm(self, aux, NULL, NULL); 871.1Sbjh21} 881.1Sbjh21 891.1Sbjh21static int 901.1Sbjh21com_acemidi_match(struct device *parent, struct cfdata *cf, void *aux) 911.1Sbjh21{ 921.1Sbjh21 931.1Sbjh21 return 1; 941.1Sbjh21} 951.1Sbjh21 961.1Sbjh21static void 971.1Sbjh21com_acemidi_attach(struct device *parent, struct device *self, void *aux) 981.1Sbjh21{ 991.1Sbjh21 struct com_acemidi_softc *sc = (void *)self; 1001.1Sbjh21 struct com_softc *csc = &sc->sc_com; 1011.1Sbjh21 struct podulebus_attach_args *pa = aux; 1021.1Sbjh21 1031.1Sbjh21 csc->sc_iobase = pa->pa_fast_base + ACEMIDI_16550_BASE; 1041.1Sbjh21 csc->sc_iot = pa->pa_fast_t; 1051.1Sbjh21 bus_space_map(csc->sc_iot, csc->sc_iobase, COM_NPORTS, 0, 1061.1Sbjh21 &csc->sc_ioh); 1071.1Sbjh21 csc->sc_frequency = ACEMIDI_16550_FREQ; 1081.1Sbjh21 1091.1Sbjh21 com_attach_subr(csc); 1101.1Sbjh21 1111.1Sbjh21 evcnt_attach_dynamic(&sc->sc_intrcnt, EVCNT_TYPE_INTR, NULL, 1121.1Sbjh21 self->dv_xname, "intr"); 1131.1Sbjh21 podulebus_irq_establish(pa->pa_ih, IPL_SERIAL, comintr, sc, 1141.1Sbjh21 &sc->sc_intrcnt); 1151.1Sbjh21} 116