4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright 2003 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 /* Copyright (c) 1990, 1991 UNIX System Laboratories, Inc. */
28 /* Copyright (c) 1984, 1986, 1987, 1988, 1989, 1990 AT&T */
29 /* All Rights Reserved */
34 #pragma ident "%Z%%M% %I% %E% SMI"
40 #define MAX_MSE_UNIT 15
42 /* Hardware interface ports */
43 #define DATA_PORT BASE_IOA /* Read only */
44 #define SIGNATURE_PORT BASE_IOA + 1 /* Read/write */
45 #define INTERRUPT_PORT BASE_IOA + 2 /* Read only */
46 #define CONTROL_PORT BASE_IOA + 2 /* Write only */
47 #define CONFIGURATOR_PORT BASE_IOA + 3 /* Read/write */
49 /* Control port bits */
50 #define INTR_DISABLE 0x10
51 #define HIGH_NIBBLE 0x20
52 #define LOW_NIBBLE 0x00
53 #define X_COUNTER 0x00
54 #define Y_COUNTER 0x40
57 /* Macros to make accessing the BUS mouse ports easier */
58 #define data_port (inb(DATA_PORT) & 0xef)
59 #define control_port(x) (outb(CONTROL_PORT, (x)))
62 * This section describes the original mouse.h definitions
63 * It is included here for the sake of compatibility.
67 /* Base I/O addresses for primary and secondary BUS mouse InPort */
71 /* Offsets of I/O registers from base */
72 #define ADDRREG 0 /* Address register */
73 #define DATAREG 1 /* Data register */
74 #define IDENTREG 2 /* Identification register */
75 #define TESTREG 3 /* Test register */
77 /* Address register definitions */
78 #define REGSEL 7 /* Mask for register select bits */
79 #define MSTATUS 0 /* Select mouse status register */
80 #define DATA1 1 /* Select data register 1 */
81 #define DATA2 2 /* Select data register 2 */
82 #define DATA3 3 /* Select data register 3 */
83 #define DATA4 4 /* Select data register 4 */
84 #define ISTATUS 5 /* Select interface status register */
85 #define ICNTRL 6 /* Select interface control register */
86 #define MODE 7 /* Select mode register */
87 #define TESTEN 0x40 /* Enable test register */
88 #define RESET 0x80 /* Reset InPort chip */
90 /* Identification register definitions */
91 #define SIGN 0xde /* InPort chip signature */
92 #define VERS(x) (((x) >> 4) & 15) /* InPort chip version number */
93 #define REV(x) ((x) & 15) /* InPort chip revision number */
95 /* Interface status/control register definitions */
104 /* Mode register definitions */
114 #define TIMERINT 0x10
116 /* #define MODEMASK 0xc0 */
118 #define SYNCHMODE 0x40
119 #define ASYNMODE 0x80
122 #define MSE_UNIT(dev) (getminor(dev) % 15)
123 #define MSE_MINOR(unit, vt) ((((vt) & 7) << 5) | (((vt) & 8) << 1) | (unit))
124 #define DISP_UNIT(dev) (getminor(dev) / 15)
126 #define MSE_CLONE MSE_MINOR(0, VTMAX)
127 #define MSE_MON MSE_MINOR(1, VTMAX)
128 #define MSE_CFG MSE_MINOR(2, VTMAX)
138 * Mouse button number definitions.
141 #define MSE_3_BUTTON 3 /* mouse talks logitech MM data format */
142 #define MSE_DEFAULT 4 /* no button definition needed */
146 /* STREAMS mouse info structure */
151 struct msecopy copystate
;
154 struct mouseinfo mseinfo
;
155 ddi_iblock_cookie_t iblock
;
173 /* Mouse configuration */
176 struct mousemap
*mapping
; /* Pointer to mapping table */
177 unsigned count
; /* # of entries in mapping table */
181 /* Mouse monitor daemon */
184 int cmd
; /* Command from driver to monitor */
185 dev_t dev
; /* Display station for mouse */
186 dev_t mdev
; /* Mouse Device */
187 uchar_t Errno
; /* Error status from action */
190 #define MSE_MGR_OPEN 1 /* Command to open device */
191 #define MSE_MGR_CLOSE 2 /* Command to close device */
192 #define MSE_MGR_LCLOSE 4 /* Command to last close device */
193 #define MGR_WAITING 8
195 /* Structure for mouse information pseudo-ioctl (from mse to display driver) */
197 #define MOUSE_INFO (('M'<<16)|('I'<<8)|99)
201 int mode
; /* stream or prompt mode */
206 /* Per-unit bus mouse configuration info (in mse/space.c) */
209 unsigned io_addr
; /* Base I/O address */
210 unsigned ivect
; /* Interrupt vector */
211 int present
; /* Set by detection routine */
212 int map_unit
; /* Index into mse_mapping[] */
214 typedef struct mouseconfig MOUSECNF
;
216 /* Display-to-mouse mapping table (sent by mouseadmin) */
219 dev_t disp_dev
, /* Display device id */
220 mse_dev
; /* Serial mouse device id; */
221 /* or makedev(0,unit #) for bus mouse */
222 int type
; /* type of mouse (MBUS, M320, etc) */
225 typedef struct mousemap MOUSEMAP
;
229 * AT&T 320 mouse (8042 controller) I/O port addresses
231 #define MSE_OUT 0x60 /* output buffer R/O */
232 #define MSE_IDAT 0x60 /* input buffer data write W/O */
233 #define MSE_STAT 0x64 /* 8042 controller status R/O */
234 #define MSE_ICMD 0x64 /* input buffer command write W/O */
236 /* Mouse driver internal status structure kept for each virtual mouse */
238 struct proc
*u_procp
;
245 /* Mouse driver internal status structure kept for each physical mouse */
247 MOUSEMAP map
; /* Device assignment info */
249 MOUSE_STRUCT
*ms
; /* Mouse structs for this mouse */
250 struct tty
*ttyp
; /* TTY struct of serial mouse */
251 int old
; /* Save old line discipline here */
252 int state
; /* Serial mse input parsing state */
253 int x_ovr
; /* 320 overflow state */
254 int y_ovr
; /* 320 overflow state */
255 int status
; /* Status of manager command */
257 /* bits in data port indicating button state */
258 #define LEFT 0200 /* left button */
259 #define MIDDLE 0100 /* middle button */
260 #define RIGHT 0040 /* right button */
266 #endif /* _SYS_MSE_H */