xref: /csrg-svn/sys/vax/uba/qduser.h (revision 34629)
134544Smarc /*
234544Smarc  * Copyright (c) 1982, 1986 Regents of the University of California.
334544Smarc  * All rights reserved.  The Berkeley software License Agreement
434544Smarc  * specifies the terms and conditions for redistribution.
534544Smarc  *
6*34629Smarc  * 		@(#)qduser.h	1.4  Berkeley  06/03/88
734544Smarc  */
8*34629Smarc /* derived from: @(#)qduser.h	6.1	(ULTRIX)	11/24/87       */
931808Smarc /************************************************************************
1031808Smarc  *									*
1131808Smarc  *			Copyright (c) 1986 by				*
1231808Smarc  *		Digital Equipment Corporation, Maynard, MA		*
1331808Smarc  *			All rights reserved.				*
1431808Smarc  *									*
1531808Smarc  *   This software is furnished under a license and may be used and	*
1631808Smarc  *   copied  only  in accordance with the terms of such license and	*
1731808Smarc  *   with the  inclusion  of  the  above  copyright  notice.   This	*
1831808Smarc  *   software  or  any  other copies thereof may not be provided or	*
1931808Smarc  *   otherwise made available to any other person.  No title to and	*
2031808Smarc  *   ownership of the software is hereby transferred.			*
2131808Smarc  *									*
2231808Smarc  *   The information in this software is subject to change  without	*
2331808Smarc  *   notice  and should not be construed as a commitment by Digital	*
2431808Smarc  *   Equipment Corporation.						*
2531808Smarc  *									*
2631808Smarc  *   Digital assumes no responsibility for the use  or  reliability	*
2731808Smarc  *   of its software on equipment which is not supplied by Digital.	*
2831808Smarc  *									*
2931808Smarc  ************************************************************************/
3031808Smarc 
3131808Smarc /***************************************************************************
3231808Smarc *
3331808Smarc *	QDUSER...
3431808Smarc *	This file defines values shared between the driver and a client
3531808Smarc *
3631808Smarc ***************************************************************************/
3731808Smarc 
3831808Smarc /***************************************************************************
39*34629Smarc *	revision history:
4031808Smarc ****************************************************************************
4131808Smarc *
4231808Smarc * 21 jul 86  ram    fixed define of CURSOR_MIN_Y
4331808Smarc * 25 nov 85  longo  added macro and bit defines for DMA error flags
4431808Smarc * 11 nov 85  longo  renamed _vs_eventqueue to "qdinput" struct
4531808Smarc * 23 oct 85  longo  added more defines to the DMA stuff
4631808Smarc * 17 oct 85  longo  changed "struct rgb" chars to be unsigned
4731808Smarc * 16 oct 85  longo  added new TABLET support definitions
4831808Smarc * 15 oct 85  longo  re-wrote DMA queue access macros
4931808Smarc * 08 oct 85  longo  added status flag manipulation macros to DMA stuff
5031808Smarc * 02 oct 85  longo  added support for color map write buffer loading
5131808Smarc * 26 sep 85  longo  removed adder sertup params from DMA request struct
5231808Smarc * 23 sep 85  longo  added DMA queue access macros
5331808Smarc * 30 aug 85  longo  fixed crock in "qdiobuf" struct compile-time sizing. Also
5431808Smarc *		    removed DMAcontrol struct from DMA buffer for field test
5531808Smarc * 26 aug 85  longo  put in conditional include of "qevent.h" for user prg's
5631808Smarc * 18 jul 85  longo  changed semantics so that head is tail and tail is head
5731808Smarc * 12 jul 85  longo  moved "mouse_report" struct and defs over to qd_data.c
5831808Smarc * 11 jul 85  longo  added device coordinate to gate array cursor coordinate
5931808Smarc *		    transformation macros
6031808Smarc * 03 jul 85  longo  changed kernel typdef's for data types to long-hand
6131808Smarc * 10 may 85  longo  created
6231808Smarc *
6331808Smarc ***************************************************************************/
6431808Smarc 
6531808Smarc #ifdef KERNEL
6632013Smarc #include "qevent.h"		/* include event struct defs */
6731808Smarc #else
6831808Smarc #include <vaxuba/qevent.h>
6931808Smarc #endif
7031808Smarc 
7131808Smarc /*---------------------
7231808Smarc * QDSS device map */
7331808Smarc 
7431808Smarc 	struct qdmap {			/* map of register blocks in QDSS */
7531808Smarc 
7631808Smarc 	    char *template;
7731808Smarc 	    char *adder;
7831808Smarc 	    char *dga;
7931808Smarc 	    char *duart;
8031808Smarc 	    char *memcsr;
8131808Smarc 	    char *red;
8231808Smarc 	    char *blue;
8331808Smarc 	    char *green;
8431808Smarc 	};
8531808Smarc 
8631808Smarc /*--------------------------------------------
8731808Smarc * DGA CSR bit definitions and register map */
8831808Smarc 
8931808Smarc #define DMADONE		0x8000		/* DMA done status */
9031808Smarc #define SET_DONE_FIFO	0x4000		/* set DMADONE when FIFO empty.. */
9131808Smarc 					/* ..AND count = 0 */
9231808Smarc 
9331808Smarc #define PTOB_ENB	0x0600		/* host-to-bitmap DMA xfer */
9431808Smarc #define BTOP_ENB	0x0400		/* bitmap-to-host DMA xfer */
9531808Smarc #define DL_ENB		0x0200		/* display list DMA xfer */
9631808Smarc #define HALT		0x0000		/* halt DGA */
9731808Smarc 
9831808Smarc #define BYTE_DMA	0x0100		/* byte/word DMA xfer */
9931808Smarc 
10031808Smarc #define DMA_ERR		0x0080		/* DMA error bits */
10131808Smarc #define PARITY_ERR	0x0040		/* memory parity error in DMA */
10231808Smarc #define BUS_ERR		0x0020		/* bus timeout error in DMA */
10331808Smarc 
10431808Smarc #define GLOBAL_IE	0x0004		/* global interrupt enable */
10531808Smarc #define DMA_IE		0x0002		/* DMA interrupt enable */
10631808Smarc #define CURS_ENB	0x0001		/* cursor enable */
10731808Smarc 
10831808Smarc /* QDSS memcsr bit definitions */
10931808Smarc 
11031808Smarc #define	UNBLANK			0x0020
11131808Smarc #define SYNC_ON			0x0008
11231808Smarc 
11331808Smarc 	struct dga {
11431808Smarc 
11531808Smarc 	    unsigned short csr;
11631808Smarc 	    unsigned short adrs_lo;	/* destination address of bitmap to */
11731808Smarc 	    unsigned short adrs_hi;	/*   host DMA */
11831808Smarc 	    unsigned short bytcnt_lo;	/* byte length of requested DMA */
11931808Smarc 	    unsigned short bytcnt_hi;	/* (WO = bytcnt) (RO = fifo count) */
12031808Smarc 	    unsigned short fifo;	/* FIFO register */
12131808Smarc 	    unsigned short x_cursor;	/* cursor position registers */
12231808Smarc 	    unsigned short y_cursor;
12331808Smarc 	    unsigned short ivr;		/* interrupt vector register */
12431808Smarc 	    unsigned short memadr;	/* memory base address register */
12531808Smarc 	};
12631808Smarc 
12731808Smarc /*-------------------------------------------------------------------------
12831808Smarc * macros to transform device coordinates to hardware cursor coordinates */
12931808Smarc 
13031808Smarc #define CURS_MIN_X 	232	/* device coordinate x = 0 */
13131808Smarc #define CURS_MIN_Y 	16	/* device coordinate y = 0 */
13231808Smarc 
13331808Smarc #define TRANX(x) ( -(((int)(x)+CURS_MIN_X) & ~0x0003) | \
13431808Smarc 		   (((int)(x)+CURS_MIN_X) & 0x0003) )
13531808Smarc 
13631808Smarc #define TRANY(y) ( -((y)+CURS_MIN_Y) )
13731808Smarc 
13831808Smarc /*********************************************************************
13931808Smarc *
14031808Smarc *	EVENT QUEUE DEFINITIONS
14131808Smarc *
14231808Smarc **********************************************************************
14331808Smarc * most of the event queue definitions are found in "qevent.h".  But a
14431808Smarc * few things not found there are here.  */
14531808Smarc 
14631808Smarc /* The event queue header */
14731808Smarc 
14831808Smarc typedef struct qdinput {
14931808Smarc 
15031808Smarc 	    struct _vs_eventqueue header;  /* event queue ring handling */
15131808Smarc 
15231808Smarc 	    /* for VS100 and QVSS compatability reasons, additions to this
15331808Smarc 	    *  structure must be made below this point.  */
15431808Smarc 
15531808Smarc 	    struct _vs_cursor curs_pos;	/* current mouse position */
15631808Smarc 	    struct _vs_box curs_box;	/* cursor reporting box */
15731808Smarc 
15831808Smarc 	};
15931808Smarc 
16031808Smarc /* vse_key field.  definitions for mouse buttons */
16131808Smarc 
16231808Smarc #define VSE_LEFT_BUTTON		0
16331808Smarc #define VSE_MIDDLE_BUTTON	1
16431808Smarc #define VSE_RIGHT_BUTTON	2
16531808Smarc 
16631808Smarc /* vse_key field.  definitions for mouse buttons */
16731808Smarc 
16831808Smarc #define VSE_T_LEFT_BUTTON	0
16931808Smarc #define VSE_T_FRONT_BUTTON	1
17031808Smarc #define VSE_T_RIGHT_BUTTON	2
17131808Smarc #define VSE_T_BACK_BUTTON	4
17231808Smarc 
17331808Smarc #define VSE_T_BARREL_BUTTON	VSE_T_LEFT_BUTTON
17431808Smarc #define VSE_T_TIP_BUTTON	VSE_T_FRONT_BUTTON
17531808Smarc 
17631808Smarc /*--------------------------------------------------------------------------
17731808Smarc *   These are the macros to be used for loading and extracting from the event
17831808Smarc * queue.  It is presumed that the macro user will only use the access macros
17931808Smarc * if the event queue is non-empty ( ISEMPTY(eq) == FALSE ), and that the
18031808Smarc * driver will only load the event queue after checking that it is not full
18131808Smarc * ( ISFULL(eq) == FALSE ).  ("eq" is a pointer to the event queue header.)
18231808Smarc *
18331808Smarc *   Before an event access session for a particular event, the macro users
18431808Smarc * must use the xxxBEGIN macro, and the xxxEND macro after an event is through
18531808Smarc * with.  As seen below, the xxxBEGIN and xxxEND macros maintain the event
18631808Smarc * queue access mechanism.
18731808Smarc *
18831808Smarc * First, the macros to be used by the event queue reader
18931808Smarc */
19031808Smarc 
19131808Smarc #define ISEMPTY(eq)	  ((eq)->header.head == (eq)->header.tail)
19231808Smarc #define GETBEGIN(eq)	  (&(eq)->header.events[(eq)->header.head])
19331808Smarc 
19431808Smarc #define GET_X(event)	  ((event)->vse_x)  	     /* get x position */
19531808Smarc #define GET_Y(event)	  ((event)->vse_y)  	     /* get y position */
19631808Smarc #define GET_TIME(event)	  ((event)->vse_time) 	     /* get time */
19731808Smarc #define GET_TYPE(event)	  ((event)->vse_type)	     /* get entry type */
19831808Smarc #define GET_KEY(event)	  ((event)->vse_key)  	     /* get keycode */
19931808Smarc #define GET_DIR(event)	  ((event)->vse_direction)     /* get direction */
20031808Smarc #define GET_DEVICE(event) ((event)->vse_device)        /* get device */
20131808Smarc 
20231808Smarc #define GETEND(eq)        (++(eq)->header.head >= (eq)->header.size ? \
20331808Smarc 			   (eq)->header.head = 0 : 0 )
20431808Smarc 
20531808Smarc /*------------------------------------------------
20631808Smarc * macros to be used by the event queue loader  */
20731808Smarc 
20831808Smarc 	/* ISFULL yields TRUE if queue is full */
20931808Smarc 
21031808Smarc #define ISFULL(eq)	((eq)->header.tail+1 == (eq)->header.head ||   \
21131808Smarc 			 ((eq)->header.tail+1 == (eq)->header.size &&  \
21231808Smarc 			  (eq)->header.head == 0))
21331808Smarc 
21431808Smarc 	/* get address of the billet for NEXT event */
21531808Smarc 
21631808Smarc #define PUTBEGIN(eq)	(&(eq)->header.events[(eq)->header.tail])
21731808Smarc 
21831808Smarc #define PUT_X(event, value)  	((event)->vse_x = value)    /* put X pos */
21931808Smarc #define PUT_Y(event, value)   	((event)->vse_y = value)    /* put Y pos */
22031808Smarc #define PUT_TIME(event, value)	((event)->vse_time = value)   /* put time */
22131808Smarc #define PUT_TYPE(event, value)	((event)->vse_type = value) /* put type */
22231808Smarc #define PUT_KEY(event, value)	((event)->vse_key = value) /* put input key */
22331808Smarc #define PUT_DIR(event, value)	((event)->vse_direction = value) /* put dir */
22431808Smarc #define PUT_DEVICE(event, value) ((event)->vse_device = value)   /* put dev */
22531808Smarc 
22631808Smarc #define PUTEND(eq)     (++(eq)->header.tail >= (eq)->header.size ?  \
22731808Smarc 			(eq)->header.tail = 0 : 0)
22831808Smarc 
22931808Smarc /******************************************************************
23031808Smarc *
23131808Smarc *	DMA I/O DEFINITIONS
23231808Smarc *
23331808Smarc ******************************************************************/
23431808Smarc 
23531808Smarc /*---------------------------------------------------------------------
23631808Smarc * The DMA request queue is implemented as a ring buffer of "DMAreq"
23731808Smarc   structures.  The queue is accessed using ring indices located in the
23831808Smarc   "DMAreq_header" structure.  Access is implemented using access macros
23931808Smarc   similar to the event queue access macros above.  */
24031808Smarc 
24131808Smarc 	struct DMAreq {
24231808Smarc 
24331808Smarc 	    short DMAtype;		/* DMA type code (for QDSS) */
24431808Smarc 	    short DMAdone;		/* DMA done parameter */
24531808Smarc 	    char  *bufp;		/* virtual adrs of buffer */
24631808Smarc 	    int   length;	        /* transfer buffer length */
24731808Smarc 	};
24831808Smarc 
24931808Smarc /* DMA type command codes */
25031808Smarc 
25131808Smarc #define DISPLIST	1	/* display list DMA */
25231808Smarc #define PTOB		2	/* 1 plane Qbus to bitmap DMA */
25331808Smarc #define BTOP		3	/* 1 plane bitmap to Qbus DMA */
25431808Smarc 
25531808Smarc /* DMA done notification code */
25631808Smarc 
25731808Smarc #define FIFO_EMPTY	0x01	/* DONE when FIFO becomes empty */
25831808Smarc #define COUNT_ZERO	0x02	/* DONE when count becomes zero */
25931808Smarc #define WORD_PACK	0x04    /* program the gate array for word packing */
26031808Smarc #define BYTE_PACK	0x08	/* program gate array for byte packing */
26131808Smarc #define REQUEST_DONE	0x100	/* clear when driver has processed request */
26231808Smarc #define HARD_ERROR	0x200   /* DMA hardware error occurred */
26331808Smarc 
26431808Smarc /* DMA request queue is a ring buffer of request structures */
26531808Smarc 
26631808Smarc 	struct DMAreq_header {
26731808Smarc 
26831808Smarc 	    int QBAreg;		    /* cookie Qbus map reg for this buffer */
26931808Smarc 	    short status;	    /* master DMA status word */
27031808Smarc 	    int shared_size;	    /* size of shared memory in bytes */
27131808Smarc 	    struct DMAreq *DMAreq;  /* start address of request queue */
27231808Smarc 	    int used;		    /* # of queue entries currently used */
27331808Smarc 	    int size;		    /* # of "DMAreq"'s in the request queue */
27431808Smarc 	    int oldest;		    /* index to oldest queue'd request */
27531808Smarc 	    int newest;		    /* index to newest queue'd request */
27631808Smarc 	};
27731808Smarc 
27831808Smarc /* bit definitions for DMAstatus word in DMAreq_header */
27931808Smarc 
28031808Smarc #define	DMA_ACTIVE	0x0004		/* DMA in progress */
28131808Smarc #define DMA_ERROR	0x0080		/* DMA hardware error */
28231808Smarc #define DMA_IGNORE	0x0002		/* flag to ignore this interrupt */
28331808Smarc 
28431808Smarc /*------------------------------------------
28531808Smarc * macros for DMA request queue fiddling  */
28631808Smarc 
28731808Smarc 	/* DMA status set/check macros */
28831808Smarc 
28931808Smarc #define DMA_SETACTIVE(header)   ((header)->status |= DMA_ACTIVE)
29031808Smarc #define DMA_CLRACTIVE(header)	((header)->status &= ~DMA_ACTIVE)
29131808Smarc #define DMA_ISACTIVE(header)    ((header)->status & DMA_ACTIVE)
29231808Smarc 
29331808Smarc #define DMA_SETERROR(header)    ((header)->status |= DMA_ERROR)
29431808Smarc #define DMA_CLRERROR(header)    ((header)->status &= ~DMA_ERROR)
29531808Smarc #define DMA_ISERROR(header)     ((header)->status & DMA_ERROR)
29631808Smarc 
29731808Smarc #define DMA_SETIGNORE(header)	((header)->status |= DMA_IGNORE)
29831808Smarc #define DMA_CLRIGNORE(header)   ((header)->status &= ~DMA_IGNORE)
29931808Smarc #define DMA_ISIGNORE(header)    ((header)->status & DMA_IGNORE)
30031808Smarc 
30131808Smarc 	/* yields TRUE if queue is empty (ISEMPTY) or full (ISFULL) */
30231808Smarc 
30331808Smarc #define DMA_ISEMPTY(header)	((header)->used == 0)
30431808Smarc #define DMA_ISFULL(header)	((header)->used >= (header)->size)
30531808Smarc 
30631808Smarc 	/* returns address of the billet for next (PUT)
30731808Smarc 	 * or oldest (GET) request */
30831808Smarc 
30931808Smarc #define DMA_PUTBEGIN(header)	(&(header)->DMAreq[(header)->newest])
31031808Smarc #define DMA_GETBEGIN(header)  	(&(header)->DMAreq[(header)->oldest])
31131808Smarc 
31231808Smarc 	/* does queue access pointer maintenance */
31331808Smarc 
31431808Smarc #define DMA_GETEND(header)      (++(header)->oldest >= (header)->size    \
31531808Smarc 				  ? (header)->oldest = 0 : 0);		 \
31631808Smarc 				--(header)->used;
31731808Smarc 
31831808Smarc #define DMA_PUTEND(header)     	(++(header)->newest >= (header)->size    \
31931808Smarc 				  ? (header)->newest = 0 : 0);		 \
32031808Smarc 				++(header)->used;
32131808Smarc 
32231808Smarc /******************************************************************
32331808Smarc *
32431808Smarc *	COLOR MAP WRITE BUFFER DEFINITIONS
32531808Smarc *
32631808Smarc ******************************************************************/
32731808Smarc 
32831808Smarc 	struct rgb {
32931808Smarc 
33031808Smarc 	    unsigned char offset;	/* color map address for load */
33131808Smarc 	    unsigned char red;		/* data for red map */
33231808Smarc 	    unsigned char green;	/* data for green map */
33331808Smarc 	    unsigned char blue;		/* data for blue map */
33431808Smarc 	};
33531808Smarc 
33631808Smarc 	struct color_buf {
33731808Smarc 
33831808Smarc 	    char status;		/* load request/service status */
33931808Smarc 	    short count;		/* number of entries to br loaded */
34031808Smarc 	    struct rgb rgb[256];
34131808Smarc 	};
34231808Smarc 
34331808Smarc #define LOAD_COLOR_MAP	0x0001
34431808Smarc 
34531808Smarc /******************************************************************
34631808Smarc *
34731808Smarc *	SCROLL ASSIST DEFINITIONS
34831808Smarc *
34931808Smarc ******************************************************************/
35031808Smarc 
35131808Smarc 	struct scroll {
35231808Smarc 
35331808Smarc 	    short status;
35431808Smarc 	    short viper_constant;
35531808Smarc 	    short y_scroll_constant;
35631808Smarc 	    short y_offset;
35731808Smarc 	    short x_index_pending;
35831808Smarc 	    short y_index_pending;
35931808Smarc 	};
36031808Smarc 
36131808Smarc #define LOAD_REGS	0x0001
36231808Smarc #define LOAD_INDEX	0x0002
36331808Smarc 
36431808Smarc /******************************************************************
36531808Smarc *
36631808Smarc *	MOUSE/TABLET/KBD PROGRAMMING DEFINITIONS
36731808Smarc *
36831808Smarc ******************************************************************/
36931808Smarc 
37031808Smarc /*-----------------------------------
37131808Smarc * LK201 programmming definitions  */
37231808Smarc 
37331808Smarc #define LK_UPDOWN 	0x86		/* bits for setting lk201 modes */
37431808Smarc #define LK_AUTODOWN 	0x82
37531808Smarc #define LK_DOWN 	0x80
37631808Smarc #define LK_DEFAULTS 	0xD3		/* reset (some) default settings */
37731808Smarc #define LK_AR_ENABLE 	0xE3		/* global auto repeat enable */
37831808Smarc #define LK_CL_ENABLE 	0x1B		/* keyclick enable */
37931808Smarc #define LK_KBD_ENABLE 	0x8B		/* keyboard enable */
38031808Smarc #define LK_BELL_ENABLE 	0x23		/* the bell */
38131808Smarc #define LK_RING_BELL 	0xA7		/* ring keyboard bell */
38231808Smarc 
38331808Smarc #define LK_LED_ENABLE 	0x13		/* light led */
38431808Smarc #define LK_LED_DISABLE 	0x11		/* turn off led */
38531808Smarc #define LED_1 		0x81		/* led bits */
38631808Smarc #define LED_2 		0x82
38731808Smarc #define LED_3 		0x84
38831808Smarc #define LED_4 		0x88
38931808Smarc #define LED_ALL 	0x8F
39031808Smarc #define LK_LED_HOLD	LED_4
39131808Smarc #define LK_LED_LOCK	LED_3
39231808Smarc #define LK_LED_COMPOSE	LED_2
39331808Smarc #define LK_LED_WAIT 	LED_1
39431808Smarc 
39531808Smarc #define LK_KDOWN_ERROR	0x3D		/* key down on powerup error */
39631808Smarc #define LK_POWER_ERROR 	0x3E		/* keyboard failure on powerup test */
39731808Smarc #define LK_OUTPUT_ERROR	0xB5		/* keystrokes lost during inhibit */
39831808Smarc #define LK_INPUT_ERROR 	0xB6		/* garbage command to keyboard */
39931808Smarc #define LK_LOWEST	0x56		/* lowest significant keycode */
40031808Smarc #define LK_DIV6_START	0xAD		/* start of div 6 */
40131808Smarc #define LK_DIV5_END	0xB2		/* end of div 5 */
40231808Smarc 
40331808Smarc #define LAST_PARAM	0x80		/* "no more params" bit */
40431808Smarc 
40531808Smarc 	struct prgkbd {
40631808Smarc 
40731808Smarc 	    short cmd;			/* LK201 command opcode */
40831808Smarc 	    short param1;		/* 1st cmd parameter (can be null) */
40931808Smarc 	    short param2;		/* 2nd cmd parameter (can be null) */
41031808Smarc 	};
41131808Smarc 
41231808Smarc /*-------------------------
41331808Smarc * "special" LK-201 keys */
41431808Smarc 
41531808Smarc #define SHIFT		174
41631808Smarc #define LOCK		176
41731808Smarc #define REPEAT		180
41831808Smarc #define CNTRL		175
41931808Smarc #define ALLUP		179
42031808Smarc 
42131808Smarc /*--------------------------------
42231808Smarc * cursor programming structure */
42331808Smarc 
42431808Smarc 	struct prg_cursor {
42531808Smarc 
42631808Smarc 	    unsigned short acc_factor;	/* cursor aceleration factor */
42731808Smarc 	    unsigned short threshold;	/* threshold to trigger acc at */
42831808Smarc 	};
42931808Smarc 
43031808Smarc /*---------------------
43131808Smarc * mouse definitions */
43231808Smarc 
43331808Smarc #define INC_STREAM_MODE	'R'		/* stream mode reports (55 hz) */
43431808Smarc #define PROMPT_MODE	'D'		/* report when prompted */
43531808Smarc #define REQUEST_POS	'P'		/* request position report */
43631808Smarc #define SELF_TEST	'T'		/* request self test */
43731808Smarc 
43831808Smarc #define MOUSE_ID	0x2		/* mouse ID in lo 4 bits */
43931808Smarc 
44031808Smarc #define START_FRAME	0x80		/* start of report frame bit */
44131808Smarc #define X_SIGN		0x10		/* position sign bits */
44231808Smarc #define Y_SIGN		0x08
44331808Smarc 
44431808Smarc #define RIGHT_BUTTON	0x01		/* mouse buttons */
44531808Smarc #define MIDDLE_BUTTON	0x02
44631808Smarc #define LEFT_BUTTON	0x04
44731808Smarc 
44831808Smarc 	/* mouse report structure definition */
44931808Smarc 
45031808Smarc 	struct mouse_report {
45131808Smarc 
45231808Smarc 	    char state;		/* buttons and sign bits */
45331808Smarc 	    short dx;		/* delta X since last change */
45431808Smarc 	    short dy;		/* delta Y since last change */
45531808Smarc 	    char bytcnt;	/* mouse report byte count */
45631808Smarc 	};
45731808Smarc 
45831808Smarc /*-----------------------------------------
45931808Smarc * tablet command/interface definitions  */
46031808Smarc 
46131808Smarc #define T_STREAM	'R'		/* continuous stream report mode */
46231808Smarc #define T_POINT	 	'D'		/* enter report-on-request mode */
46331808Smarc #define T_REQUEST	'P'		/* request position report */
46431808Smarc 
46531808Smarc #define T_BAUD		'B'		/* increase baud to 9600 from 4800 */
46631808Smarc #define T_RATE_55	'K'		/* report rate: 55/sec */
46731808Smarc #define T_RATE_72	'L'		/* report rate: 72/sec */
46831808Smarc #define T_RATE_120	'M'		/* report rate: 120/sec (9600 only) */
46931808Smarc 
47031808Smarc #define T_TEST		SELF_TEST	/* do self test */
47131808Smarc 
47231808Smarc #define TABLET_ID	0x4		/* tablet ID in lo 4 bits */
47331808Smarc 
47431808Smarc #define T_START_FRAME	0x80		/* start of report frame bit */
47531808Smarc #define T_PROXIMITY	0x01		/* state pointer in proximity */
47631808Smarc 
47731808Smarc #define T_LEFT_BUTTON	0x02		/* puck buttons */
47831808Smarc #define T_FRONT_BUTTON	0x04
47931808Smarc #define T_RIGHT_BUTTON	0x08
48031808Smarc #define T_BACK_BUTTON	0x10
48131808Smarc 
48231808Smarc #define T_BARREL_BUTTON T_LEFT_BUTTON		/* stylus buttons */
48331808Smarc #define T_TIP_BUTTON	T_FRONT_BUTTON
48431808Smarc 
485