1 /* $OpenBSD: joy_isapnp.c,v 1.7 2007/08/01 13:18:18 martin Exp $ */ 2 /* $NetBSD: joy.c,v 1.3 1996/05/05 19:46:15 christos Exp $ */ 3 4 /*- 5 * Copyright (c) 1995 Jean-Marc Zucconi 6 * All rights reserved. 7 * 8 * Ported to NetBSD by Matthieu Herrb <matthieu@laas.fr> 9 * 10 * Redistribution and use in source and binary forms, with or without 11 * modification, are permitted provided that the following conditions 12 * are met: 13 * 1. Redistributions of source code must retain the above copyright 14 * notice, this list of conditions and the following disclaimer 15 * in this position and unchanged. 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. The name of the author may not be used to endorse or promote products 20 * derived from this software without specific prior written permission 21 * 22 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 23 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 24 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 25 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 26 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 27 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 31 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 * 33 */ 34 35 #include <sys/param.h> 36 #include <sys/systm.h> 37 #include <sys/kernel.h> 38 #include <sys/device.h> 39 #include <sys/errno.h> 40 41 #include <machine/cpu.h> 42 #include <machine/pio.h> 43 #include <machine/cpufunc.h> 44 #include <machine/joystick.h> 45 #include <machine/conf.h> 46 47 #include <dev/isa/isavar.h> 48 #include <dev/isa/isareg.h> 49 #include <dev/ic/i8253reg.h> 50 #include <i386/isa/joyreg.h> 51 52 int joy_isapnp_probe(struct device *, void *, void *); 53 void joy_isapnp_attach(struct device *, struct device *, void *); 54 55 struct cfattach joy_isapnp_ca = { 56 sizeof(struct joy_softc), joy_isapnp_probe, joy_isapnp_attach 57 }; 58 59 int 60 joy_isapnp_probe(struct device *parent, void *match, void *aux) 61 { 62 return (1); 63 } 64 65 void 66 joy_isapnp_attach(struct device *parent, struct device *self, void *aux) 67 { 68 struct joy_softc *sc = (void *) self; 69 struct isa_attach_args *ia = aux; 70 int iobase = ia->ipa_io[0].base; 71 72 sc->port = iobase; 73 sc->timeout[0] = sc->timeout[1] = 0; 74 outb(iobase, 0xff); 75 DELAY(10000); /* 10 ms delay */ 76 #if 0 77 printf(": joystick%sconnected\n", 78 (inb(iobase) & 0x0f) == 0x0f ? " not " : " "); 79 #else 80 printf("\n"); 81 #endif 82 } 83