152131Smckusick /* 2*63217Sbostic * Copyright (c) 1992, 1993 3*63217Sbostic * The Regents of the University of California. All rights reserved. 452131Smckusick * 552131Smckusick * This code is derived from software contributed to Berkeley by 652131Smckusick * Ralph Campbell. 752131Smckusick * 852131Smckusick * %sccs.include.redist.c% 952131Smckusick * 10*63217Sbostic * @(#)pmioctl.h 8.1 (Berkeley) 06/10/93 1152131Smckusick * 1252131Smckusick * graphics.h -- 1352131Smckusick * 1452131Smckusick * Defines for the graphics device. 1552131Smckusick * 1652131Smckusick * Copyright (C) 1989 by Digital Equipment Corporation, Maynard MA 1752131Smckusick * 1852131Smckusick * All Rights Reserved 1952131Smckusick * 2052131Smckusick * Permission to use, copy, modify, and distribute this software and its 2152131Smckusick * documentation for any purpose and without fee is hereby granted, 2252131Smckusick * provided that the above copyright notice appear in all copies and that 2352131Smckusick * both that copyright notice and this permission notice appear in 2452131Smckusick * supporting documentation, and that the name of Digital not be 2552131Smckusick * used in advertising or publicity pertaining to distribution of the 2652131Smckusick * software without specific, written prior permission. 2752131Smckusick * 2852131Smckusick * Digitial disclaims all warranties with regard to this software, including 2952131Smckusick * all implied warranties of merchantability and fitness. In no event shall 3052131Smckusick * Digital be liable for any special, indirect or consequential damages or 3152131Smckusick * any damages whatsoever resulting from loss of use, data or profits, 3252131Smckusick * whether in an action of contract, negligence or other tortious action, 3352131Smckusick * arising out of or in connection with the use or performance of this 3452131Smckusick * software. 3552131Smckusick * 3652131Smckusick * from: $Header: devSerialPmax.c, 3752131Smckusick * v 1.4 89/05/22 13:31:07 mnelson Exp $ SPRITE (DECWRL) 3852131Smckusick */ 3952131Smckusick 4052131Smckusick #include <sys/ioctl.h> 4152131Smckusick 4252131Smckusick /* 4352131Smckusick * Events. 4452131Smckusick */ 4552131Smckusick typedef struct { 4652131Smckusick short x; /* x position */ 4752131Smckusick short y; /* y position */ 4852131Smckusick unsigned int time; /* 1 millisecond units */ 4952131Smckusick unsigned char type; /* button up/down/raw or motion */ 5052131Smckusick unsigned char key; /* the key (button only) */ 5152131Smckusick unsigned char index; /* which instance of device */ 5252131Smckusick unsigned char device; /* which device */ 5352131Smckusick } pmEvent; 5452131Smckusick 5552131Smckusick /* 5652131Smckusick * type field 5752131Smckusick */ 5852131Smckusick #define BUTTON_UP_TYPE 0 5952131Smckusick #define BUTTON_DOWN_TYPE 1 6052131Smckusick #define BUTTON_RAW_TYPE 2 6152131Smckusick #define MOTION_TYPE 3 6252131Smckusick 6352131Smckusick /* 6452131Smckusick * device field 6552131Smckusick */ 6652131Smckusick #define NULL_DEVICE 0 /* NULL event (for QD_GETEVENT ret) */ 6752131Smckusick #define MOUSE_DEVICE 1 /* mouse */ 6852131Smckusick #define KEYBOARD_DEVICE 2 /* main keyboard */ 6952131Smckusick #define TABLET_DEVICE 3 /* graphics tablet */ 7052131Smckusick #define AUX_DEVICE 4 /* auxiliary */ 7152131Smckusick #define CONSOLE_DEVICE 5 /* console */ 7252131Smckusick #define KNOB_DEVICE 8 7352131Smckusick #define JOYSTICK_DEVICE 9 7452131Smckusick 7552131Smckusick #define PM_MAXEVQ 64 /* must be power of 2 */ 7652131Smckusick #define PM_EVROUND(x) ((x) & (PM_MAXEVQ - 1)) 7752131Smckusick #define MOTION_BUFFER_SIZE 100 7852131Smckusick 7952131Smckusick typedef struct { 8052131Smckusick unsigned int time; 8152131Smckusick short x, y; 8252131Smckusick } pmTimeCoord; 8352131Smckusick 8452131Smckusick /* 8552131Smckusick * The event queue. This structure is normally included in the info 8652131Smckusick * returned by the device driver. 8752131Smckusick */ 8852131Smckusick typedef struct { 8952131Smckusick pmEvent *events; 9052131Smckusick unsigned int eSize; 9152131Smckusick unsigned int eHead; 9252131Smckusick unsigned int eTail; 9352131Smckusick unsigned long timestamp_ms; 9452131Smckusick pmTimeCoord *tcs; /* history of pointer motions */ 9552131Smckusick unsigned int tcSize; 9652131Smckusick unsigned int tcNext; /* simple ring buffer, old events are tossed */ 9752131Smckusick } pmEventQueue; 9852131Smckusick 9952131Smckusick /* 10052131Smckusick * mouse cursor position 10152131Smckusick */ 10252131Smckusick typedef struct { 10352131Smckusick short x; 10452131Smckusick short y; 10552131Smckusick } pmCursor; 10652131Smckusick 10752131Smckusick /* 10852131Smckusick * mouse motion rectangle 10952131Smckusick */ 11052131Smckusick typedef struct { 11152131Smckusick short bottom; 11252131Smckusick short right; 11352131Smckusick short left; 11452131Smckusick short top; 11552131Smckusick } pmBox; 11652131Smckusick 11752131Smckusick /* 11852131Smckusick * Structures used by ioctl's. 11952131Smckusick */ 12052131Smckusick typedef struct pm_kpcmd { 12152131Smckusick char nbytes; /* number of bytes in parameter */ 12252131Smckusick unsigned char cmd; /* command to be sent, peripheral bit will */ 12352131Smckusick /* be forced by driver */ 12452131Smckusick unsigned char par[2]; /* bytes of parameters to be sent */ 12552131Smckusick } pmKpCmd; 12652131Smckusick 12752131Smckusick typedef struct pm_info { 12852131Smckusick pmEventQueue qe; /* event & motion queues */ 12952131Smckusick short mswitches; /* current value of mouse buttons */ 13052131Smckusick pmCursor tablet; /* current tablet position */ 13152131Smckusick short tswitches; /* current tablet buttons NI! */ 13252131Smckusick pmCursor cursor; /* current cursor position */ 13352131Smckusick short row; /* screen row */ 13452131Smckusick short col; /* screen col */ 13552131Smckusick short max_row; /* max character row */ 13652131Smckusick short max_col; /* max character col */ 13752131Smckusick short max_x; /* max x position */ 13852131Smckusick short max_y; /* max y position */ 13952131Smckusick short max_cur_x; /* max cursor x position */ 14052131Smckusick short max_cur_y; /* max cursor y position */ 14152131Smckusick int version; /* version of driver */ 14252131Smckusick char *bitmap; /* bit map position */ 14352131Smckusick short *scanmap; /* scanline map position */ 14452131Smckusick short *cursorbits; /* cursor bit position */ 14552131Smckusick short *pmaddr; /* virtual address */ 14652131Smckusick char *planemask; /* plane mask virtual location */ 14752131Smckusick pmCursor mouse; /* atomic read/write */ 14852131Smckusick pmBox mbox; /* atomic read/write */ 14952131Smckusick short mthreshold; /* mouse motion parameter */ 15052131Smckusick short mscale; /* mouse scale factor (if 15152131Smckusick negative, then do square). */ 15252131Smckusick short min_cur_x; /* min cursor x position */ 15352131Smckusick short min_cur_y; /* min cursor y position */ 15452131Smckusick } PM_Info; 15552131Smckusick 15652131Smckusick typedef struct { 15752131Smckusick short Map; 15852131Smckusick unsigned short index; 15952131Smckusick struct { 16052131Smckusick unsigned short red; 16152131Smckusick unsigned short green; 16252131Smckusick unsigned short blue; 16352131Smckusick } Entry; 16452131Smckusick } ColorMap; 16552131Smckusick 16652131Smckusick /* 16752131Smckusick * CAUTION: 16852131Smckusick * The numbers of these ioctls must match 16952131Smckusick * the ioctls in qvioctl.h 17052131Smckusick */ 17152131Smckusick #define QIOCGINFO _IOR('q', 1, struct pm_info *) /* get the info */ 17252131Smckusick #define QIOCPMSTATE _IOW('q', 2, pmCursor) /* set mouse pos */ 17352131Smckusick #define QIOWCURSORCOLOR _IOW('q', 3, unsigned int [6]) /* bg/fg r/g/b */ 17452131Smckusick #define QIOCINIT _IO('q', 4) /* init screen */ 17552131Smckusick #define QIOCKPCMD _IOW('q', 5, struct pm_kpcmd) /* keybd. per. cmd */ 17652131Smckusick #define QIOCADDR _IOR('q', 6, struct pm_info *) /* get address */ 17752131Smckusick #define QIOWCURSOR _IOW('q', 7, short [32]) /* write cursor bit map */ 17852131Smckusick #define QIOKERNLOOP _IO('q', 8) /* re-route kernel console output */ 17952131Smckusick #define QIOKERNUNLOOP _IO('q', 9) /* don't re-route kernel console output */ 18052131Smckusick #define QIOVIDEOON _IO('q', 10) /* turn on the video */ 18152131Smckusick #define QIOVIDEOOFF _IO('q', 11) /* turn off the video */ 18252131Smckusick #define QIOSETCMAP _IOW('q', 12, ColorMap) 183