xref: /original-bsd/sys/news3400/iop/msreg.h (revision ea3a8ee8)
1 /*
2  * Copyright (c) 1992 The Regents of the University of California.
3  * All rights reserved.
4  *
5  * This code is derived from software contributed to Berkeley by
6  * Sony Corp. and Kazumasa Utashiro of Software Research Associates, Inc.
7  *
8  * %sccs.include.redist.c%
9  *
10  * from: $Hdr: msreg.h,v 4.300 91/06/09 06:43:00 root Rel41 $ SONY
11  *
12  *	@(#)msreg.h	7.1 (Berkeley) 06/04/92
13  */
14 
15 /*
16  * mouse register structure definition.
17  */
18 
19 #ifndef __MSREG__
20 #define __MSREG__ 1
21 
22 #ifdef KERNEL
23 
24 struct msreg {
25 /*00*/	u_char		ms_control;	/* CPU/IOP */
26 #define		MS_DONE		0x01	/* IOP has completed command from CPU */
27 #define		MS_EVREADY	0x02	/* IOP has made event report ready */
28 /*01*/	u_char		ms_command;	/* CPU */
29 #define		MS_CPROBE	0
30 #define		MS_CATTACH	1
31 #define		MS_CSAMPLE	2	/* requset current value */
32 #define		MS_CSETEM	3	/* set event mask */
33 #define		MS_CSETXY	4	/* set current coordinate */
34 #define		MS_CSETPARAM	5	/* set mouse parameter (mag, delta) */
35 #define		MS_CQFLUSH	6	/* flush event queue */
36 #define		MS_CSETRANGE	7	/* set coordinate range */
37 /*02*/	u_char		ms_result;	/* IOP */
38 #define		MS_ROK		0	/* done */
39 #define		MS_RERROR	1	/* failed */
40 #define		MS_REVENT	2	/* event has occured */
41 /*03*/	u_char		ms_eventmask;	/* CPU */
42 /*04*/	struct ms_param	ms_param;	/* CPU */
43 /*0c*/	struct ms_coord	ms_coord;	/* CPU */
44 /*14*/	struct ms_data	ms_data;	/* IOP */
45 /*20*/	struct ms_event	ms_event;	/* IOP */
46 /*38*/	int		ms_unit;	/* CPU */
47 /*3c*/	int		ms_sevcount;	/*XXX*/
48 /*40*/	struct ms_range	ms_range;	/* CPU */
49 };
50 
51 #define MS_S_BYTE	0		/* start byte */
52 #define MS_X_BYTE	1		/* second byte */
53 #define MS_Y_BYTE	2		/* third byte */
54 #define MS_DB_SIZE	3
55 
56 #define MS_S_MARK	0x80		/* start mark (first byte)*/
57 #define MS_S_X7		0x08		/* MSB(sign bit) of X */
58 #define MS_S_Y7		0x10		/* MSB(sign bit) of Y */
59 #define MS_S_SW1	0x01		/* left button is pressed */
60 #define MS_S_SW2	0x02		/* right button is pressed */
61 #define MS_S_SW3	0x04		/* middle button is pressed */
62 
63 #define MS_X_X06	0x7f		/* data bits of X (second byte) */
64 #define MS_Y_Y06	0x7f		/* data bits of Y (third byte) */
65 
66 struct ms_stat {
67 	int		mss_stat;
68 #define		MS_ACTIVE       0x01
69 #define		MS_WAIT         0x02    /* waiting for command completion */
70 #define		MS_EVWAIT       0x04    /* waiting for event report */
71 #define		MS_RCOLL        0x08    /* select collsion on read */
72 #define		MS_WCOLL        0x10    /* select collsion on write */
73 #define		MS_NBIO         0x20    /* noblocked read write */
74 #define		MS_ASYNC        0x40    /* if event queued then send SIGIO */
75 	int		mss_pgrp;
76 	int		mss_mode;
77 	int		mss_command;
78 	int		mss_eventmask;
79 	struct ms_data	mss_data;
80 	struct ms_data	mss_data_old;
81 	struct ms_param	mss_param;
82 	struct ms_range	mss_range;
83 	struct proc	*mss_rsel;
84 	struct proc	*mss_wsel;
85 	struct ms_queue	*mss_queue;
86 };
87 
88 #define		MSPRI		(PZERO+1)
89 #define		MSUNIT(dev)	(minor(dev)&017)
90 #define		MSOLDIF(dev)    (minor(dev)&020)
91 
92 #endif /* KERNEL */
93 #endif /* !__MSREG__ */
94