Author: imp
Date: Fri Oct 26 04:10:32 2018
New Revision: 339763
URL: https://svnweb.freebsd.org/changeset/base/339763

Log:
  Revert r339563.
  
  I held the mistaken belief this was completely unused. While the
  driver is unused and likely not relevant for a long time,
  sys/joystick.h lives on in maybe half a dozen ports, even though
  hardware to use it hasn't been widely used in maybe 15 years.

Added:
  head/share/man/man4/joy.4
     - copied unchanged from r339562, head/share/man/man4/joy.4
  head/sys/dev/joy/joy.c
     - copied unchanged from r339562, head/sys/dev/joy/joy.c
  head/sys/dev/joy/joy_isa.c
     - copied unchanged from r339562, head/sys/dev/joy/joy_isa.c
  head/sys/dev/joy/joyvar.h
     - copied unchanged from r339562, head/sys/dev/joy/joyvar.h
  head/sys/modules/joy/Makefile
     - copied unchanged from r339562, head/sys/modules/joy/Makefile
  head/sys/sys/joystick.h
     - copied unchanged from r339562, head/sys/sys/joystick.h
  head/tools/kerneldoc/subsys/Doxyfile-dev_joy
     - copied unchanged from r339562, 
head/tools/kerneldoc/subsys/Doxyfile-dev_joy
Modified:
  head/ObsoleteFiles.inc
  head/share/man/man4/Makefile
  head/sys/conf/NOTES
  head/sys/conf/files
  head/sys/modules/Makefile

Modified: head/ObsoleteFiles.inc
==============================================================================
--- head/ObsoleteFiles.inc      Fri Oct 26 04:05:48 2018        (r339762)
+++ head/ObsoleteFiles.inc      Fri Oct 26 04:10:32 2018        (r339763)
@@ -45,9 +45,6 @@ OLD_LIBS+=usr/lib32/libcrypto.so.9
 OLD_LIBS+=usr/lib32/libssl.so.9
 # 20181021: mse(4) removal
 OLD_FILES+=usr/share/man/man4/mse.4.gz
-# 20181021: joy(4) removal
-OLD_FILES+=usr/share/man/man4/joy.4.gz
-OLD_FILES+=usr/include/sys/joystick.h
 # 20181015: Stale libcasper(3) files following r329452
 OLD_LIBS+=lib/casper/libcap_sysctl.so.0
 OLD_LIBS+=lib/casper/libcap_grp.so.0

Modified: head/share/man/man4/Makefile
==============================================================================
--- head/share/man/man4/Makefile        Fri Oct 26 04:05:48 2018        
(r339762)
+++ head/share/man/man4/Makefile        Fri Oct 26 04:10:32 2018        
(r339763)
@@ -239,6 +239,7 @@ MAN=        aac.4 \
        ixl.4 \
        jedec_dimm.4 \
        jme.4 \
+       joy.4 \
        kbdmux.4 \
        keyboard.4 \
        kld.4 \

Copied: head/share/man/man4/joy.4 (from r339562, head/share/man/man4/joy.4)
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/share/man/man4/joy.4   Fri Oct 26 04:10:32 2018        (r339763, copy 
of r339562, head/share/man/man4/joy.4)
@@ -0,0 +1,119 @@
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 23, 1995
+.Dt JOY 4
+.Os
+.Sh NAME
+.Nm joy
+.Nd joystick device driver
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device joy"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+joy_load="YES"
+.Ed
+.Pp
+In
+.Pa /boot/device.hints :
+.Cd hint.joy.0.at="isa"
+.Cd hint.joy.0.port="0x201"
+.Cd hint.joy.1.at="isa"
+.Cd hint.joy.1.port="0x201"
+.Pp
+.In sys/joystick.h
+.Sh DESCRIPTION
+The joystick device driver allows applications to read the status of
+the PC joystick.
+.Pp
+This device may be opened by only one process at a time.
+.Pp
+The joystick status is read from a structure via a read()
+call.
+The structure is defined in the header file as follows:
+.Bd -literal -offset indent
+       struct joystick {
+               int x;         /* x position */
+               int y;         /* y position */
+               int b1;        /* button 1 status */
+               int b2;        /* button 2 status */
+       };
+.Ed
+.Pp
+Positions are typically in the range 0-2000.
+.Ss One line perl example:
+.Bd -literal -compact
+perl -e 'open(JOY,"/dev/joy0")||die;while(1)
+{sysread(JOY,$x,16);@j=unpack("iiii",$x);print "@j\\n";sleep(1);}'
+.Ed
+.Ss ioctl calls
+Several ioctl() calls are also available.
+They take an argument of
+type int *
+.Bl -tag -width JOY_SET_X_OFFSET
+.It Dv JOY_SETTIMEOUT Fa int *limit
+Set the time limit (in microseconds) for reading the joystick
+status.
+Setting a value
+too small may prevent to get correct values for the positions (which
+are then set to -2147483648), however this can be useful if one is
+only interested by the buttons status.
+.It Dv JOY_GETTIMEOUT Fa int *limit
+Get the time limit (in microseconds) used for reading the joystick
+status.
+.It Dv JOY_SET_X_OFFSET Fa int *offset
+Set the value to be added to the X position when reading the joystick
+status.
+.It Dv JOY_SET_Y_OFFSET Fa int *offset
+Set the value to be added to the Y position when reading the joystick
+status.
+.It Dv JOY_GET_X_OFFSET Fa int *offset
+Get the value which is added to the X position when reading the joystick
+status.
+.It Dv JOY_GET_Y_OFFSET Fa int *offset
+Get the value which is added to the Y position when reading the joystick
+status.
+.El
+.Sh TECHNICAL SPECIFICATIONS
+The pinout of the DB-15 connector is as follow:
+.Bd -literal
+  1  XY1 (+5v)
+  2  Switch 1
+  3  X1 (potentiometer #1)
+  4  Switch 1 (GND)
+  5  Switch 2 (GND)
+  6  Y1 (potentiometer #2)
+  7  Switch 2
+  8  N.C.
+  9  XY2 (+5v)
+ 10  Switch 4
+ 11  X2 (potentiometer #3)
+ 12  Switch 3&4 (GND)
+ 13  Y2 (potentiometer #4)
+ 14  Switch 3
+ 15  N.C.
+.Ed
+.Pp
+Pots are normally 0-150k variable resistors (0-100k sometimes), and
+according to the IBM technical reference, the time is given by
+Time = 24.2e-6s + 0.011e-6s * R/Ohms
+.Sh FILES
+.Bl -tag -width /dev/joy?
+.It Pa /dev/joy?
+joystick device files
+.El
+.Sh HISTORY
+The
+.Nm
+driver appeared in
+.Fx 2.0.5 .
+.Sh AUTHORS
+.An Jean-Marc Zucconi Aq Mt j...@cabri.obs-besancon.fr

Modified: head/sys/conf/NOTES
==============================================================================
--- head/sys/conf/NOTES Fri Oct 26 04:05:48 2018        (r339762)
+++ head/sys/conf/NOTES Fri Oct 26 04:10:32 2018        (r339763)
@@ -2313,8 +2313,12 @@ options          SND_OLDSTEREO
 # Miscellaneous hardware:
 #
 # bktr: Brooktree bt848/848a/849a/878/879 video capture and TV Tuner board
+# joy: joystick (including IO DATA PCJOY PC Card joystick)
 # cmx: OmniKey CardMan 4040 pccard smartcard reader
 
+device         joy                     # PnP aware, hints for non-PnP only
+hint.joy.0.at="isa"
+hint.joy.0.port="0x201"
 device         cmx
 
 #

Modified: head/sys/conf/files
==============================================================================
--- head/sys/conf/files Fri Oct 26 04:05:48 2018        (r339762)
+++ head/sys/conf/files Fri Oct 26 04:10:32 2018        (r339763)
@@ -2294,6 +2294,8 @@ dev/ixgbe/ixgbe_dcb_82599.c       optional ix inet | ixv 
ine
        compile-with "${NORMAL_C} -I$S/dev/ixgbe"
 dev/jedec_dimm/jedec_dimm.c    optional jedec_dimm smbus
 dev/jme/if_jme.c               optional jme pci
+dev/joy/joy.c                  optional joy
+dev/joy/joy_isa.c              optional joy isa
 dev/kbd/kbd.c                  optional atkbd | pckbd | sc | ukbd | vt
 dev/kbdmux/kbdmux.c            optional kbdmux
 dev/ksyms/ksyms.c              optional ksyms

Copied: head/sys/dev/joy/joy.c (from r339562, head/sys/dev/joy/joy.c)
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/dev/joy/joy.c      Fri Oct 26 04:10:32 2018        (r339763, copy 
of r339562, head/sys/dev/joy/joy.c)
@@ -0,0 +1,251 @@
+/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ * Copyright (c) 1995 Jean-Marc Zucconi
+ * All rights reserved.
+ *
+ * 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 without 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.
+ *
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/conf.h>
+#include <sys/uio.h>
+#include <sys/kernel.h>
+#include <sys/module.h>
+#include <sys/bus.h>
+#include <machine/bus.h>
+#include <machine/resource.h>
+#include <sys/rman.h>
+#include <sys/time.h>
+#include <sys/joystick.h>
+#include <dev/joy/joyvar.h>
+
+/* 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.
+ */
+
+#define joypart(d) (dev2unit(d)&1)
+#ifndef JOY_TIMEOUT
+#define JOY_TIMEOUT   2000 /* 2 milliseconds */
+#endif
+
+static d_open_t        joyopen;
+static d_close_t       joyclose;
+static d_read_t        joyread;
+static d_ioctl_t       joyioctl;
+
+static struct cdevsw joy_cdevsw = {
+       .d_version =    D_VERSION,
+       .d_flags =      D_NEEDGIANT,
+       .d_open =       joyopen,
+       .d_close =      joyclose,
+       .d_read =       joyread,
+       .d_ioctl =      joyioctl,
+       .d_name =       "joy",
+};
+
+devclass_t joy_devclass;
+
+int
+joy_probe(device_t dev)
+{
+#ifdef WANT_JOYSTICK_CONNECTED
+#ifdef notyet
+       outb(dev->id_iobase, 0xff);
+       DELAY(10000); /*  10 ms delay */
+       return (inb(dev->id_iobase) & 0x0f) != 0x0f;
+#else
+       return (0);
+#endif
+#else
+       return (0);
+#endif
+}
+
+int
+joy_attach(device_t dev)
+{
+       int     unit = device_get_unit(dev);
+       struct joy_softc *joy = device_get_softc(dev);
+
+       joy->rid = 0;
+       joy->res = bus_alloc_resource_any(dev, SYS_RES_IOPORT, &joy->rid,
+           RF_ACTIVE|RF_SHAREABLE);
+       if (joy->res == NULL)
+               return ENXIO;
+       joy->bt = rman_get_bustag(joy->res);
+       joy->port = rman_get_bushandle(joy->res);
+       joy->timeout[0] = joy->timeout[1] = 0;
+       joy->d = make_dev(&joy_cdevsw, unit, 0, 0, 0600, "joy%d", unit);
+       joy->d->si_drv1 = joy;
+       gone_in_dev(dev, 12, "joy(4) driver");
+
+       return (0);
+}
+
+int
+joy_detach(device_t dev)
+{
+       struct joy_softc *joy = device_get_softc(dev);
+
+       if (joy->res != NULL)
+               bus_release_resource(dev, SYS_RES_IOPORT, joy->rid, joy->res);
+       if (joy->d)
+               destroy_dev(joy->d);
+       return (0);
+}
+
+
+static int
+joyopen(struct cdev *dev, int flags, int fmt, struct thread *td)
+{
+       int i = joypart (dev);
+       struct joy_softc *joy = dev->si_drv1;
+
+       if (joy->timeout[i])
+               return (EBUSY);
+       joy->x_off[i] = joy->y_off[i] = 0;
+       joy->timeout[i] = JOY_TIMEOUT;
+       return (0);
+}
+
+static int
+joyclose(struct cdev *dev, int flags, int fmt, struct thread *td)
+{
+       int i = joypart (dev);
+       struct joy_softc *joy = dev->si_drv1;
+
+       joy->timeout[i] = 0;
+       return (0);
+}
+
+static int
+joyread(struct cdev *dev, struct uio *uio, int flag)
+{
+       struct joy_softc *joy = dev->si_drv1;
+       bus_space_handle_t port = joy->port;
+       bus_space_tag_t bt = joy->bt;
+       struct timespec t, start, end;
+       int state = 0;
+       struct timespec x, y;
+       struct joystick c;
+#ifndef __i386__
+       int s;
+
+       s = splhigh();
+#else
+       disable_intr ();
+#endif
+       nanotime(&t);
+       end.tv_sec = 0;
+       end.tv_nsec = joy->timeout[joypart(dev)] * 1000;
+       timespecadd(&end, &t, &end);
+       for (; timespeccmp(&t, &end, <) && (bus_space_read_1(bt, port, 0) & 
0x0f); nanotime(&t))
+               ;       /* nothing */
+       bus_space_write_1 (bt, port, 0, 0xff);
+       nanotime(&start);
+       end.tv_sec = 0;
+       end.tv_nsec = joy->timeout[joypart(dev)] * 1000;
+       timespecadd(&end, &start, &end);
+       t = start;
+       timespecclear(&x);
+       timespecclear(&y);
+       while (timespeccmp(&t, &end, <)) {
+               state = bus_space_read_1 (bt, port, 0);
+               if (joypart(dev) == 1)
+                       state >>= 2;
+               nanotime(&t);
+               if (!timespecisset(&x) && !(state & 0x01))
+                       x = t;
+               if (!timespecisset(&y) && !(state & 0x02))
+                       y = t;
+               if (timespecisset(&x) && timespecisset(&y))
+                       break;
+       }
+#ifndef __i386__
+       splx(s);
+#else
+       enable_intr ();
+#endif
+       if (timespecisset(&x)) {
+               timespecsub(&x, &start, &x);
+               c.x = joy->x_off[joypart(dev)] + x.tv_nsec / 1000;
+       } else
+               c.x = 0x80000000;
+       if (timespecisset(&y)) {
+               timespecsub(&y, &start, &y);
+               c.y = joy->y_off[joypart(dev)] + y.tv_nsec / 1000;
+       } else
+               c.y = 0x80000000;
+       state >>= 4;
+       c.b1 = ~state & 1;
+       c.b2 = ~(state >> 1) & 1;
+       return (uiomove((caddr_t)&c, sizeof(struct joystick), uio));
+}
+
+static int
+joyioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag, struct thread 
*td)
+{
+       struct joy_softc *joy = dev->si_drv1;
+       int i = joypart (dev);
+       int x;
+
+       switch (cmd) {
+       case JOY_SETTIMEOUT:
+               x = *(int *) data;
+               if (x < 1 || x > 10000) /* 10ms maximum! */
+                       return EINVAL;
+               joy->timeout[i] = x;
+               break;
+       case JOY_GETTIMEOUT:
+               *(int *) data = joy->timeout[i];
+               break;
+       case JOY_SET_X_OFFSET:
+               joy->x_off[i] = *(int *) data;
+               break;
+       case JOY_SET_Y_OFFSET:
+               joy->y_off[i] = *(int *) data;
+               break;
+       case JOY_GET_X_OFFSET:
+               *(int *) data = joy->x_off[i];
+               break;
+       case JOY_GET_Y_OFFSET:
+               *(int *) data = joy->y_off[i];
+               break;
+       default:
+               return (ENOTTY);
+       }
+       return (0);
+}

Copied: head/sys/dev/joy/joy_isa.c (from r339562, head/sys/dev/joy/joy_isa.c)
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/dev/joy/joy_isa.c  Fri Oct 26 04:10:32 2018        (r339763, copy 
of r339562, head/sys/dev/joy/joy_isa.c)
@@ -0,0 +1,88 @@
+/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ * Copyright (c) 1995 Jean-Marc Zucconi
+ * All rights reserved.
+ *
+ * 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 without 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.
+ *
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/conf.h>
+#include <sys/uio.h>
+#include <sys/kernel.h>
+#include <sys/module.h>
+#include <sys/bus.h>
+#include <machine/bus.h>
+#include <machine/resource.h>
+#include <sys/rman.h>
+#include <sys/time.h>
+#include <dev/joy/joyvar.h>
+
+#include <isa/isavar.h>
+#include "isa_if.h"
+
+static int joy_isa_probe (device_t);
+
+static struct isa_pnp_id joy_ids[] = {
+    {0x0100630e, "CSC0001 PnP Joystick"},      /* CSC0001 */
+    {0x0101630e, "CSC0101 PnP Joystick"},      /* CSC0101 */
+    {0x01100002, "ALS0110 PnP Joystick"},      /* @P@1001 */
+    {0x01200002, "ALS0120 PnP Joystick"},      /* @P@2001 */
+    {0x01007316, "ESS0001 PnP Joystick"},      /* ESS0001 */
+    {0x2fb0d041, "Generic PnP Joystick"},      /* PNPb02f */
+    {0x2200a865, "YMH0022 PnP Joystick"},      /* YMH0022 */
+    {0x82719304, NULL},                        /* ADS7182 */
+    {0}
+};
+
+static int
+joy_isa_probe(device_t dev)
+{
+    if (ISA_PNP_PROBE(device_get_parent(dev), dev, joy_ids) == ENXIO)
+        return ENXIO;
+    return (joy_probe(dev));
+}
+
+static device_method_t joy_methods[] = {
+    DEVMETHOD(device_probe,    joy_isa_probe),
+    DEVMETHOD(device_attach,   joy_attach),
+    DEVMETHOD(device_detach,   joy_detach),
+    { 0, 0 }
+};
+
+static driver_t joy_isa_driver = {
+    "joy",
+    joy_methods,
+    sizeof (struct joy_softc)
+};
+
+DRIVER_MODULE(joy, isa, joy_isa_driver, joy_devclass, 0, 0);
+DRIVER_MODULE(joy, acpi, joy_isa_driver, joy_devclass, 0, 0);
+ISA_PNP_INFO(joy_ids);

Copied: head/sys/dev/joy/joyvar.h (from r339562, head/sys/dev/joy/joyvar.h)
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/dev/joy/joyvar.h   Fri Oct 26 04:10:32 2018        (r339763, copy 
of r339562, head/sys/dev/joy/joyvar.h)
@@ -0,0 +1,47 @@
+/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ * Copyright (c) 1995 Jean-Marc Zucconi
+ * All rights reserved.
+ *
+ * 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 without 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.
+ *
+ * $FreeBSD$
+ */
+
+struct joy_softc {
+       bus_space_tag_t  bt;
+       bus_space_handle_t port;
+       int x_off[2], y_off[2];
+       int timeout[2];
+       struct resource *res;
+       int rid;
+       struct cdev *d;
+};
+
+int joy_probe(device_t);
+int joy_attach(device_t);
+int joy_detach(device_t);
+
+extern devclass_t joy_devclass;

Modified: head/sys/modules/Makefile
==============================================================================
--- head/sys/modules/Makefile   Fri Oct 26 04:05:48 2018        (r339762)
+++ head/sys/modules/Makefile   Fri Oct 26 04:10:32 2018        (r339763)
@@ -205,6 +205,7 @@ SUBDIR=     \
        ${_ixv} \
        ${_ixl} \
        jme \
+       joy \
        kbdmux \
        kgssapi \
        kgssapi_krb5 \

Copied: head/sys/modules/joy/Makefile (from r339562, 
head/sys/modules/joy/Makefile)
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/modules/joy/Makefile       Fri Oct 26 04:10:32 2018        
(r339763, copy of r339562, head/sys/modules/joy/Makefile)
@@ -0,0 +1,8 @@
+# $FreeBSD$
+
+.PATH: ${SRCTOP}/sys/dev/joy
+
+KMOD=  joy
+SRCS=  bus_if.h device_if.h isa_if.h joy.c joy_isa.c
+
+.include <bsd.kmod.mk>

Copied: head/sys/sys/joystick.h (from r339562, head/sys/sys/joystick.h)
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/sys/joystick.h     Fri Oct 26 04:10:32 2018        (r339763, copy 
of r339562, head/sys/sys/joystick.h)
@@ -0,0 +1,52 @@
+/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ * Copyright (c) 1995 Jean-Marc Zucconi
+ * All rights reserved.
+ *
+ * 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 without 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.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef        _SYS_JOYSTICK_H_
+#define        _SYS_JOYSTICK_H_
+
+#include <sys/ioccom.h>
+
+struct joystick {
+    int x;
+    int y;
+    int b1;
+    int b2;
+};
+
+#define JOY_SETTIMEOUT    _IOW('J', 1, int)    /* set timeout */
+#define JOY_GETTIMEOUT    _IOR('J', 2, int)    /* get timeout */
+#define JOY_SET_X_OFFSET  _IOW('J', 3, int)    /* set offset on X-axis */
+#define JOY_SET_Y_OFFSET  _IOW('J', 4, int)    /* set offset on Y-axis */
+#define JOY_GET_X_OFFSET  _IOR('J', 5, int)    /* get offset on X-axis */
+#define JOY_GET_Y_OFFSET  _IOR('J', 6, int)    /* get offset on Y-axis */
+
+#endif /* !_SYS_JOYSTICK_H_ */

Copied: head/tools/kerneldoc/subsys/Doxyfile-dev_joy (from r339562, 
head/tools/kerneldoc/subsys/Doxyfile-dev_joy)
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/tools/kerneldoc/subsys/Doxyfile-dev_joy        Fri Oct 26 04:10:32 
2018        (r339763, copy of r339562, 
head/tools/kerneldoc/subsys/Doxyfile-dev_joy)
@@ -0,0 +1,21 @@
+# Doxyfile 1.5.2
+
+# $FreeBSD$
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+PROJECT_NAME           = "FreeBSD kernel JOY device code"
+OUTPUT_DIRECTORY       = $(DOXYGEN_DEST_PATH)/dev_joy/
+EXTRACT_ALL            = YES    # for undocumented src, no warnings enabled
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+INPUT                  = $(DOXYGEN_SRC_PATH)/dev/joy/ \
+                         $(NOTREVIEWED)
+
+GENERATE_TAGFILE       = dev_joy/dev_joy.tag
+
+@INCLUDE_PATH          = $(DOXYGEN_INCLUDE_PATH)
+@INCLUDE               = common-Doxyfile
+
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to