summaryrefslogtreecommitdiff
path: root/sys/arch/i386/isa/joyreg.h
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1998-06-02 18:46:38 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1998-06-02 18:46:38 +0000
commitaffd68ab87952b3348adfda93dd8d7eff067cd6b (patch)
tree644021bfd29567d39c933a34a0cc0a76e08574ba /sys/arch/i386/isa/joyreg.h
parenteecbed65eb0e5455c06818223d7b571108327990 (diff)
untested isapnp joystick driver
Diffstat (limited to 'sys/arch/i386/isa/joyreg.h')
-rw-r--r--sys/arch/i386/isa/joyreg.h69
1 files changed, 69 insertions, 0 deletions
diff --git a/sys/arch/i386/isa/joyreg.h b/sys/arch/i386/isa/joyreg.h
new file mode 100644
index 00000000000..fbd2bf6b003
--- /dev/null
+++ b/sys/arch/i386/isa/joyreg.h
@@ -0,0 +1,69 @@
+/* $NetBSD: joy.c,v 1.3 1996/05/05 19:46:15 christos Exp $ */
+
+/*-
+ * Copyright (c) 1995 Jean-Marc Zucconi
+ * All rights reserved.
+ *
+ * Ported to NetBSD by Matthieu Herrb <matthieu@laas.fr>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer
+ * in this position and unchanged.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ * derived from this software withough specific prior written permission
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+/*
+ * The game port can manage 4 buttons and 4 variable resistors (usually 2
+ * joysticks, each with 2 buttons and 2 pots.) via the port at address 0x201.
+ * Getting the state of the buttons is done by reading the game port;
+ * buttons 1-4 correspond to bits 4-7 and resistors 1-4 (X1, Y1, X2, Y2)
+ * to bits 0-3. If button 1 (resp 2, 3, 4) is pressed, the bit 4 (resp 5,
+ * 6, 7) is set to 0 to get the value of a resistor, write the value 0xff
+ * at port and wait until the corresponding bit returns to 0.
+ */
+
+/*
+ * The formulae below only work if u is ``not too large''. See also
+ * the discussion in microtime.s
+ */
+#define USEC2TICKS(u) (((u) * 19549) >> 14)
+#define TICKS2USEC(u) (((u) * 3433) >> 12)
+
+
+#define JOYPART(d) (minor(d) & 1)
+#define JOYUNIT(d) minor(d) >> 1 & 3
+
+#ifndef JOY_TIMEOUT
+#define JOY_TIMEOUT 2000 /* 2 milliseconds */
+#endif
+
+#define JOY_NPORTS 1
+
+struct joy_softc {
+ struct device sc_dev;
+ int port;
+ int x_off[2], y_off[2];
+ int timeout[2];
+};
+
+int joyopen __P((dev_t, int, int, struct proc *));
+int joyclose __P((dev_t, int, int, struct proc *));