1*fd9cb95cSsethg /* 2*fd9cb95cSsethg * CDDL HEADER START 3*fd9cb95cSsethg * 4*fd9cb95cSsethg * The contents of this file are subject to the terms of the 5*fd9cb95cSsethg * Common Development and Distribution License, Version 1.0 only 6*fd9cb95cSsethg * (the "License"). You may not use this file except in compliance 7*fd9cb95cSsethg * with the License. 8*fd9cb95cSsethg * 9*fd9cb95cSsethg * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*fd9cb95cSsethg * or http://www.opensolaris.org/os/licensing. 11*fd9cb95cSsethg * See the License for the specific language governing permissions 12*fd9cb95cSsethg * and limitations under the License. 13*fd9cb95cSsethg * 14*fd9cb95cSsethg * When distributing Covered Code, include this CDDL HEADER in each 15*fd9cb95cSsethg * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*fd9cb95cSsethg * If applicable, add the following below this CDDL HEADER, with the 17*fd9cb95cSsethg * fields enclosed by brackets "[]" replaced with your own identifying 18*fd9cb95cSsethg * information: Portions Copyright [yyyy] [name of copyright owner] 19*fd9cb95cSsethg * 20*fd9cb95cSsethg * CDDL HEADER END 21*fd9cb95cSsethg */ 22*fd9cb95cSsethg /* 23*fd9cb95cSsethg * Copyright (c) 1999 by Sun Microsystems, Inc. 24*fd9cb95cSsethg * All rights reserved. 25*fd9cb95cSsethg */ 26*fd9cb95cSsethg 27*fd9cb95cSsethg /* Copyright (c) 1990, 1991 UNIX System Laboratories, Inc. */ 28*fd9cb95cSsethg /* Copyright (c) 1984, 1986, 1987, 1988, 1989, 1990 AT&T */ 29*fd9cb95cSsethg /* All Rights Reserved */ 30*fd9cb95cSsethg 31*fd9cb95cSsethg #ifndef _SYS_MOUSE_H 32*fd9cb95cSsethg #define _SYS_MOUSE_H 33*fd9cb95cSsethg 34*fd9cb95cSsethg #pragma ident "%Z%%M% %I% %E% SMI" 35*fd9cb95cSsethg 36*fd9cb95cSsethg #ifdef __cplusplus 37*fd9cb95cSsethg extern "C" { 38*fd9cb95cSsethg #endif 39*fd9cb95cSsethg 40*fd9cb95cSsethg #define BUTCHNGMASK 0x38 41*fd9cb95cSsethg #define MOVEMENT 0x40 42*fd9cb95cSsethg 43*fd9cb95cSsethg #define BUTSTATMASK 7 44*fd9cb95cSsethg #define BUT3STAT 1 45*fd9cb95cSsethg #define BUT2STAT 2 46*fd9cb95cSsethg #define BUT1STAT 4 47*fd9cb95cSsethg #define BUT3CHNG 8 48*fd9cb95cSsethg #define BUT2CHNG 0x10 49*fd9cb95cSsethg #define BUT1CHNG 0x20 50*fd9cb95cSsethg 51*fd9cb95cSsethg struct mse_event { 52*fd9cb95cSsethg uchar_t type; /* event type (see below) */ 53*fd9cb95cSsethg uchar_t code; /* when type is XQ_MOTION or XQ_BUTTON, => */ 54*fd9cb95cSsethg /* bit 0 clear if right button pushed; */ 55*fd9cb95cSsethg /* bit 1 clear if middle button pushed; */ 56*fd9cb95cSsethg /* bit 2 clear if left button pushed; */ 57*fd9cb95cSsethg char x; /* delta x movement (mouse motion only) */ 58*fd9cb95cSsethg char y; /* delta y movement (mouse motion only) */ 59*fd9cb95cSsethg }; 60*fd9cb95cSsethg 61*fd9cb95cSsethg #define MSE_BUTTON 0 62*fd9cb95cSsethg #define MSE_MOTION 1 63*fd9cb95cSsethg 64*fd9cb95cSsethg struct mouseinfo { 65*fd9cb95cSsethg unsigned char status; 66*fd9cb95cSsethg char xmotion, ymotion; 67*fd9cb95cSsethg }; 68*fd9cb95cSsethg 69*fd9cb95cSsethg /* Ioctl Command definitions */ 70*fd9cb95cSsethg 71*fd9cb95cSsethg #define MOUSEIOC ('M'<<8) 72*fd9cb95cSsethg #define MOUSEIOCREAD (MOUSEIOC|60) 73*fd9cb95cSsethg #define MOUSEISOPEN (MOUSEIOC|66) 74*fd9cb95cSsethg #define MOUSE320 (MOUSEIOC|67) 75*fd9cb95cSsethg #define MSEBUTTONS (MOUSEIOC|68) 76*fd9cb95cSsethg #define TS_CALIB (MOUSEIOC|70) /* Touch screen: set the calibration */ 77*fd9cb95cSsethg #define TS_RECALIB (MOUSEIOC|71) /* Touch screen: disable calibration */ 78*fd9cb95cSsethg #define TS_CURPOS (MOUSEIOC|72) /* Touch screen: set cursor position */ 79*fd9cb95cSsethg #define MOUSEIOCDELAY (MOUSEIOC|80) 80*fd9cb95cSsethg #define MOUSEIOCNDELAY (MOUSEIOC|81) 81*fd9cb95cSsethg #define MOUSEIOCCONFIG (MOUSEIOC|100) 82*fd9cb95cSsethg #define MOUSEIOCMON (MOUSEIOC|101) 83*fd9cb95cSsethg 84*fd9cb95cSsethg #define VPC_MOUSE_READ MOUSEIOCREAD 85*fd9cb95cSsethg 86*fd9cb95cSsethg #define UPPERLIM 127 87*fd9cb95cSsethg #define LOWERLIM -128 88*fd9cb95cSsethg #define ONEBYTE(x) ((x) > UPPERLIM ? UPPERLIM : \ 89*fd9cb95cSsethg (x) < LOWERLIM ? LOWERLIM : (x)) 90*fd9cb95cSsethg 91*fd9cb95cSsethg /* 320 mouse command/query structure */ 92*fd9cb95cSsethg 93*fd9cb95cSsethg struct cmd_320 { 94*fd9cb95cSsethg int cmd; 95*fd9cb95cSsethg int arg1; 96*fd9cb95cSsethg int arg2; 97*fd9cb95cSsethg int arg3; 98*fd9cb95cSsethg }; 99*fd9cb95cSsethg 100*fd9cb95cSsethg /* 101*fd9cb95cSsethg * AT&T 320 (PS/2 style) Mouse Commands 102*fd9cb95cSsethg */ 103*fd9cb95cSsethg #define MSERESET 0xff /* reset mouse */ 104*fd9cb95cSsethg #define MSERESEND 0xfe /* resend last data stream */ 105*fd9cb95cSsethg #define MSESETDEF 0xf6 /* set default status */ 106*fd9cb95cSsethg #define MSEOFF 0xf5 /* disable mouse */ 107*fd9cb95cSsethg #define MSEON 0xf4 /* enable mouse */ 108*fd9cb95cSsethg #define MSECHGMOD 0xf3 /* set sampling rate and/or button mode */ 109*fd9cb95cSsethg #define MSEGETDEV 0xf2 /* read device type */ 110*fd9cb95cSsethg #define MSESPROMPT 0xf0 /* set prompt mode (resets stream mode) */ 111*fd9cb95cSsethg #define MSEECHON 0xee /* set echo mode */ 112*fd9cb95cSsethg #define MSEECHOFF 0xec /* reset echo mode */ 113*fd9cb95cSsethg #define MSEREPORT 0xeb /* read mouse report */ 114*fd9cb95cSsethg #define MSESTREAM 0xea /* set Incremental Stream Mode */ 115*fd9cb95cSsethg #define MSESTATREQ 0xe9 /* status request */ 116*fd9cb95cSsethg #define MSESETRES 0xe8 /* set counts per mm. resolution */ 117*fd9cb95cSsethg #define MSESCALE2 0xe7 /* set 2:1 scaling */ 118*fd9cb95cSsethg #define MSESCALE1 0xe6 /* set 1:1 scaling */ 119*fd9cb95cSsethg 120*fd9cb95cSsethg /* 121*fd9cb95cSsethg * 320 mouse 8042 controller commands and flags 122*fd9cb95cSsethg */ 123*fd9cb95cSsethg #define MSE_ROP 0xD0 /* read output port command */ 124*fd9cb95cSsethg #define MSE_RIP 0xC0 /* read input port command */ 125*fd9cb95cSsethg #define MSE_WOP 0xD3 /* write to loopback command */ 126*fd9cb95cSsethg #define MSE_WAD 0xD4 /* write to device command */ 127*fd9cb95cSsethg #define MSE_RCB 0x20 /* read command byte command */ 128*fd9cb95cSsethg #define MSE_WCB 0x60 /* write command byte command */ 129*fd9cb95cSsethg #define MSE_INBF 0x03 /* input/output buffer full flag */ 130*fd9cb95cSsethg #define MSE_OUTBF 0x21 /* output buffer full flag */ 131*fd9cb95cSsethg #define MSE_ENAB 0xA8 /* enable 8042 interface */ 132*fd9cb95cSsethg #define MSE_DISAB 0xA7 /* disable 8042 interface */ 133*fd9cb95cSsethg #define MSE_ACK 0xFA /* Acknowledgement byte from 8042 */ 134*fd9cb95cSsethg 135*fd9cb95cSsethg typedef struct mouseinfo MOUSEINFO; 136*fd9cb95cSsethg 137*fd9cb95cSsethg /* 138*fd9cb95cSsethg * Begin Carrol touch screen-specific definitions. 139*fd9cb95cSsethg */ 140*fd9cb95cSsethg 141*fd9cb95cSsethg /* 142*fd9cb95cSsethg * Calibration data structure. Used with TS_CALIB ioctl to register the upper 143*fd9cb95cSsethg * left opto-coordinate that corresponds to the upper left corner of the active 144*fd9cb95cSsethg * video area, and the lower right opto-coordinate that corresponds to the 145*fd9cb95cSsethg * lower right corner of the active video area. 146*fd9cb95cSsethg */ 147*fd9cb95cSsethg 148*fd9cb95cSsethg struct ts_calib { 149*fd9cb95cSsethg int c_ulx, /* upper left X opto-coordinate of active video area */ 150*fd9cb95cSsethg c_uly, /* upper left Y opto-coordinate of active video area */ 151*fd9cb95cSsethg c_lrx, /* lower right X opto-coordinate of active video area */ 152*fd9cb95cSsethg c_lry; /* lower right Y opto-coordinate of active video area */ 153*fd9cb95cSsethg }; 154*fd9cb95cSsethg 155*fd9cb95cSsethg /* 156*fd9cb95cSsethg * Position cursor at the given "pixel" coordinate. 157*fd9cb95cSsethg */ 158*fd9cb95cSsethg 159*fd9cb95cSsethg struct ts_curpos { 160*fd9cb95cSsethg int p_xpos, /* X cursor coordinate */ 161*fd9cb95cSsethg p_ypos; /* Y cursor coordinate */ 162*fd9cb95cSsethg }; 163*fd9cb95cSsethg 164*fd9cb95cSsethg /* 165*fd9cb95cSsethg * End Carrol touch screen-specific definitions. 166*fd9cb95cSsethg */ 167*fd9cb95cSsethg 168*fd9cb95cSsethg #ifdef __cplusplus 169*fd9cb95cSsethg } 170*fd9cb95cSsethg #endif 171*fd9cb95cSsethg 172*fd9cb95cSsethg #endif /* _SYS_MOUSE_H */ 173