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