1 /* $OpenBSD: joy_isapnp.c,v 1.9 2023/01/30 10:49:05 jsg 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/device.h> 38 39 #include <machine/cpu.h> 40 #include <machine/pio.h> 41 42 #include <dev/isa/isavar.h> 43 #include <i386/isa/joyreg.h> 44 45 int joy_isapnp_probe(struct device *, void *, void *); 46 void joy_isapnp_attach(struct device *, struct device *, void *); 47 48 const struct cfattach joy_isapnp_ca = { 49 sizeof(struct joy_softc), joy_isapnp_probe, joy_isapnp_attach 50 }; 51 52 int 53 joy_isapnp_probe(struct device *parent, void *match, void *aux) 54 { 55 return (1); 56 } 57 58 void 59 joy_isapnp_attach(struct device *parent, struct device *self, void *aux) 60 { 61 struct joy_softc *sc = (void *) self; 62 struct isa_attach_args *ia = aux; 63 int iobase = ia->ipa_io[0].base; 64 65 sc->port = iobase; 66 sc->timeout[0] = sc->timeout[1] = 0; 67 outb(iobase, 0xff); 68 DELAY(10000); /* 10 ms delay */ 69 #if 0 70 printf(": joystick%sconnected\n", 71 (inb(iobase) & 0x0f) == 0x0f ? " not " : " "); 72 #else 73 printf("\n"); 74 #endif 75 } 76