The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/dev/dec/vsxxx.c

Version: -  FREEBSD  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-2  -  FREEBSD-11-1  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-4  -  FREEBSD-10-3  -  FREEBSD-10-2  -  FREEBSD-10-1  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-3  -  FREEBSD-9-2  -  FREEBSD-9-1  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-4  -  FREEBSD-8-3  -  FREEBSD-8-2  -  FREEBSD-8-1  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-4  -  FREEBSD-7-3  -  FREEBSD-7-2  -  FREEBSD-7-1  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-4  -  FREEBSD-6-3  -  FREEBSD-6-2  -  FREEBSD-6-1  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-5  -  FREEBSD-5-4  -  FREEBSD-5-3  -  FREEBSD-5-2  -  FREEBSD-5-1  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  linux-2.6  -  linux-2.4.22  -  MK83  -  MK84  -  PLAN9  -  DFBSD  -  NETBSD  -  NETBSD5  -  NETBSD4  -  NETBSD3  -  NETBSD20  -  OPENBSD  -  xnu-517  -  xnu-792  -  xnu-792.6.70  -  xnu-1228  -  xnu-1456.1.26  -  xnu-1699.24.8  -  xnu-2050.18.24  -  OPENSOLARIS  -  minix-3-1-1 
SearchContext: -  none  -  3  -  10 

    1 /* $NetBSD: vsxxx.c,v 1.7 2006/11/12 19:00:43 plunky Exp $ */
    2 
    3 /*
    4  * Copyright (c) 1999 Tohru Nishimura.  All rights reserved.
    5  *
    6  * Redistribution and use in source and binary forms, with or without
    7  * modification, are permitted provided that the following conditions
    8  * are met:
    9  * 1. Redistributions of source code must retain the above copyright
   10  *    notice, this list of conditions and the following disclaimer.
   11  * 2. Redistributions in binary form must reproduce the above copyright
   12  *    notice, this list of conditions and the following disclaimer in the
   13  *    documentation and/or other materials provided with the distribution.
   14  * 3. All advertising materials mentioning features or use of this software
   15  *    must display the following acknowledgement:
   16  *      This product includes software developed by Tohru Nishimura.
   17  *      for the NetBSD Project.
   18  * 4. The name of the author may not be used to endorse or promote products
   19  *    derived from this software without specific prior written permission
   20  *
   21  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
   22  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   23  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   24  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
   25  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
   26  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
   27  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
   28  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   29  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
   30  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   31  */
   32 
   33 #include <sys/cdefs.h>
   34 __KERNEL_RCSID(0, "$NetBSD: vsxxx.c,v 1.7 2006/11/12 19:00:43 plunky Exp $");
   35 
   36 /*
   37  * Common machinary for VSXXX mice and tablet
   38  */
   39 
   40 #include <sys/param.h>
   41 #include <sys/systm.h>
   42 #include <sys/device.h>
   43 
   44 #include <dev/wscons/wsconsio.h>
   45 #include <dev/wscons/wsmousevar.h>
   46 
   47 #include <dev/dec/vsxxxvar.h>
   48 
   49 /*
   50  * XXX XXX XXX
   51  *
   52  * collect various mice and tablet parameters/protocol design
   53  * and establish vsxxx.h
   54  *
   55  * XXX XXX XXX
   56  */
   57 #define VS_SELFTEST     'T'
   58 #define VS_INCREMENTAL  'R'
   59 #define VS_PROMPTING    'D'
   60 #define VS_REQ_POSITION 'P'
   61 
   62 #define VS_MOUSE_REPSZ  3
   63 #define VS_TABLET_REPSZ 5
   64 
   65 /* first octet */
   66 #define VS_START_FRAME  0x80
   67 #define VS_R_BUTTON     0x01
   68 #define VS_M_BUTTON     0x02
   69 #define VS_L_BUTTON     0x04
   70 #define VS_Y_SIGN       0x08
   71 #define VS_X_SIGN       0x10
   72 
   73 /* low order 4 bit of the second octet in a SELFTEST reply */
   74 #define VS_MOUSE        0x2
   75 #define VS_TABLET       0x4
   76 
   77 extern struct cfdriver vsms_cd;
   78 
   79 static int  vsxxx_enable(void *);
   80 static int  vsxxx_ioctl(void *, u_long, caddr_t, int, struct proc *);
   81 static void vsxxx_disable(void *);
   82 
   83 struct wsmouse_accessops vsxxx_accessops = {    /* EXPORT */
   84         vsxxx_enable,                           /* MD? */
   85         vsxxx_ioctl,
   86         vsxxx_disable,                          /* MD? */
   87 };
   88 
   89 static int
   90 vsxxx_enable(v)
   91         void *v;
   92 {
   93         /* turn on the hardware? */
   94         ((struct vsxxx_softc *)v)->sc_nbyte = 0;
   95         return 0;
   96 }
   97 
   98 static void
   99 vsxxx_disable(v)
  100         void *v;
  101 {
  102         /* turn off the hardware? */
  103 }
  104 
  105 /*ARGUSED*/
  106 static int
  107 vsxxx_ioctl(v, cmd, data, flag, p)
  108         void *v;
  109         u_long cmd;
  110         caddr_t data;
  111         int flag;
  112         struct proc *p;
  113 {
  114         if (cmd == WSMOUSEIO_GTYPE) {
  115                 *(u_int *)data = WSMOUSE_TYPE_VSXXX;
  116                 return 0;
  117         }
  118         return EPASSTHROUGH;
  119 }
  120 
  121 /* EXPORT */ void
  122 vsxxx_input(data)
  123         int data;
  124 {
  125         struct vsxxx_softc *sc = (void *)vsms_cd.cd_devs[0];
  126         int x, y;
  127 
  128         if (data & VS_START_FRAME)
  129                 sc->sc_nbyte = 0;
  130 
  131         sc->sc_report.raw[sc->sc_nbyte++] = data;
  132 
  133         if (sc->sc_nbyte < VS_MOUSE_REPSZ)
  134                 return;
  135         sc->sc_nbyte = 0;
  136 
  137         x = sc->sc_report.ms.xpos;
  138         y = sc->sc_report.ms.ypos;
  139         if ((sc->sc_report.raw[0] & VS_X_SIGN) == 0)
  140                 x = -x;
  141         if ((sc->sc_report.raw[0] & VS_Y_SIGN) != 0)
  142                 y = -y;                                 /* Eeeh? */
  143         wsmouse_input(sc->sc_wsmousedev,
  144                         sc->sc_report.raw[0] & 07,
  145                         x, y, 0, 0,
  146                         WSMOUSE_INPUT_DELTA);
  147 }

Cache object: 5f6ee3ebd94d2a7f0ce48fb594c012c1


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.