6811333 Remove prom_printf() message in emlxs driver
[opensolaris.git] / usr / src / uts / common / sys / mse.h
blob404bc36a6f32159085d2b5408cdc70361cc6fcb8
1 /*
2 * CDDL HEADER START
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
7 * with the License.
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]
20 * CDDL HEADER END
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 */
31 #ifndef _SYS_MSE_H
32 #define _SYS_MSE_H
34 #pragma ident "%Z%%M% %I% %E% SMI"
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
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
55 #define HC 0x80
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 */
68 #define MOUSE1 0x23c
69 #define MOUSE2 0x238
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 */
96 #define SW3 1
97 #define SW2 2
98 #define SW1 4
99 #define XA 0x10
100 #define XB 0x20
101 #define YA 0x40
102 #define YB 0x80
104 /* Mode register definitions */
105 #define RATEMASK 7
106 #define HZ0NOINTR 0
107 #define HZ30 1
108 #define HZ50 2
109 #define HZ100 3
110 #define HZ200 4
111 #define HZ0INTR 6
112 #define HZEXT 7
113 #define DATAINT 8
114 #define TIMERINT 0x10
115 #define HOLD 0x20
116 /* #define MODEMASK 0xc0 */
117 #define QUADMODE 0
118 #define SYNCHMODE 0x40
119 #define ASYNMODE 0x80
120 #define DIRMODE 0xc0
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)
130 #define SNDERR 0xfe
131 #define FAILED (-1)
133 struct msecopy {
134 int state;
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 */
144 #ifdef _KERNEL
146 /* STREAMS mouse info structure */
147 struct strmseinfo {
148 int msetimeid;
149 queue_t *rqp;
150 queue_t *wqp;
151 struct msecopy copystate;
152 char state;
153 uchar_t type;
154 struct mouseinfo mseinfo;
155 ddi_iblock_cookie_t iblock;
156 uchar_t button;
157 char x;
158 char y;
159 char old_buttons;
160 dev_t dev;
161 kmutex_t lock;
164 #endif
166 #define BUS_MAJOR 0
167 #define MCA_MAJOR 1
169 #define MBUS 1
170 #define M320 2
171 #define MSERIAL 3
173 /* Mouse configuration */
175 struct mse_cfg {
176 struct mousemap *mapping; /* Pointer to mapping table */
177 unsigned count; /* # of entries in mapping table */
181 /* Mouse monitor daemon */
183 struct mse_mon {
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)
200 struct mcastat {
201 int mode; /* stream or prompt mode */
202 int present;
203 int map_unit;
206 /* Per-unit bus mouse configuration info (in mse/space.c) */
208 struct mouseconfig {
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) */
218 struct mousemap {
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 */
237 typedef struct {
238 struct proc *u_procp;
239 int mse_pid;
240 int rupted;
241 int isopen;
242 char old_buttons;
243 } MOUSE_STRUCT;
245 /* Mouse driver internal status structure kept for each physical mouse */
246 typedef struct {
247 MOUSEMAP map; /* Device assignment info */
248 int n_vts;
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 */
256 } MOUSE_UNIT;
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 */
262 #ifdef __cplusplus
264 #endif
266 #endif /* _SYS_MSE_H */