xref: /titanic_54/usr/src/uts/common/sys/consms.h (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
1*7c478bd9Sstevel@tonic-gate /*
2*7c478bd9Sstevel@tonic-gate  * CDDL HEADER START
3*7c478bd9Sstevel@tonic-gate  *
4*7c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*7c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*7c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*7c478bd9Sstevel@tonic-gate  * with the License.
8*7c478bd9Sstevel@tonic-gate  *
9*7c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*7c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*7c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*7c478bd9Sstevel@tonic-gate  * and limitations under the License.
13*7c478bd9Sstevel@tonic-gate  *
14*7c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*7c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*7c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*7c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*7c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*7c478bd9Sstevel@tonic-gate  *
20*7c478bd9Sstevel@tonic-gate  * CDDL HEADER END
21*7c478bd9Sstevel@tonic-gate  */
22*7c478bd9Sstevel@tonic-gate /*
23*7c478bd9Sstevel@tonic-gate  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
24*7c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
25*7c478bd9Sstevel@tonic-gate  */
26*7c478bd9Sstevel@tonic-gate 
27*7c478bd9Sstevel@tonic-gate #ifndef	_SYS_CONSMS_H
28*7c478bd9Sstevel@tonic-gate #define	_SYS_CONSMS_H
29*7c478bd9Sstevel@tonic-gate 
30*7c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
31*7c478bd9Sstevel@tonic-gate 
32*7c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
33*7c478bd9Sstevel@tonic-gate extern "C" {
34*7c478bd9Sstevel@tonic-gate #endif
35*7c478bd9Sstevel@tonic-gate 
36*7c478bd9Sstevel@tonic-gate /*
37*7c478bd9Sstevel@tonic-gate  * Those default values are taken from lower mice drivers.
38*7c478bd9Sstevel@tonic-gate  */
39*7c478bd9Sstevel@tonic-gate #define	CONSMS_SR_DEFAULT_HEIGHT	768
40*7c478bd9Sstevel@tonic-gate #define	CONSMS_SR_DEFAULT_WIDTH		1024
41*7c478bd9Sstevel@tonic-gate 
42*7c478bd9Sstevel@tonic-gate #define	CONSMS_PARMS_DEFAULT_JITTER	0
43*7c478bd9Sstevel@tonic-gate #define	CONSMS_PARMS_DEFAULT_SPEED_LAW	0
44*7c478bd9Sstevel@tonic-gate #define	CONSMS_PARMS_DEFAULT_SPEED_LIMIT	48
45*7c478bd9Sstevel@tonic-gate 
46*7c478bd9Sstevel@tonic-gate #define	CONSMS_MAX(x, y)	((x) > (y) ? (x) : (y))
47*7c478bd9Sstevel@tonic-gate 
48*7c478bd9Sstevel@tonic-gate /*
49*7c478bd9Sstevel@tonic-gate  * These states are only used when an underlying mouse
50*7c478bd9Sstevel@tonic-gate  * is being linked under the virtual mouse (/dev/mouse),
51*7c478bd9Sstevel@tonic-gate  * in order to set some cached state variables. And these
52*7c478bd9Sstevel@tonic-gate  * states go in a sequential way.
53*7c478bd9Sstevel@tonic-gate  */
54*7c478bd9Sstevel@tonic-gate typedef enum {
55*7c478bd9Sstevel@tonic-gate 	LQS_START = 0,				/* begin of initializing */
56*7c478bd9Sstevel@tonic-gate 	LQS_BUTTON_COUNT_PENDING = 1,		/* wait for button count ACK */
57*7c478bd9Sstevel@tonic-gate 	LQS_WHEEL_COUNT_PENDING = 2,		/* wait for wheel count ACK */
58*7c478bd9Sstevel@tonic-gate 	LQS_SET_VUID_FORMAT_PENDING = 3,	/* wait for set format ACK */
59*7c478bd9Sstevel@tonic-gate 	LQS_SET_WHEEL_STATE_PENDING = 4,	/* wait for wheel state ACK */
60*7c478bd9Sstevel@tonic-gate 	LQS_SET_RESOLUTION_PENDING = 5,		/* wait for resolution ACK */
61*7c478bd9Sstevel@tonic-gate 	LQS_SET_PARMS_PENDING = 6,		/* wait for parameters ACK */
62*7c478bd9Sstevel@tonic-gate 	LQS_DONE = 7				/* mark end of initialization */
63*7c478bd9Sstevel@tonic-gate } consms_lq_state_t;
64*7c478bd9Sstevel@tonic-gate 
65*7c478bd9Sstevel@tonic-gate struct consms_lq;
66*7c478bd9Sstevel@tonic-gate typedef void (*ioc_reply_func_t)(struct consms_lq *, mblk_t *);
67*7c478bd9Sstevel@tonic-gate 
68*7c478bd9Sstevel@tonic-gate /*
69*7c478bd9Sstevel@tonic-gate  * This structure contains information
70*7c478bd9Sstevel@tonic-gate  * for each underlying physical mouse
71*7c478bd9Sstevel@tonic-gate  * (lower queue).
72*7c478bd9Sstevel@tonic-gate  */
73*7c478bd9Sstevel@tonic-gate typedef struct consms_lq {
74*7c478bd9Sstevel@tonic-gate 	struct consms_lq	*lq_next;	/* next lower queue */
75*7c478bd9Sstevel@tonic-gate 
76*7c478bd9Sstevel@tonic-gate 	consms_lq_state_t	lq_state;	/* used during initializing */
77*7c478bd9Sstevel@tonic-gate 	queue_t			*lq_queue;	/* lower write q */
78*7c478bd9Sstevel@tonic-gate 
79*7c478bd9Sstevel@tonic-gate 	ioc_reply_func_t	lq_ioc_reply_func; /* reply function */
80*7c478bd9Sstevel@tonic-gate 	mblk_t			*lq_pending_plink; /* pending msg */
81*7c478bd9Sstevel@tonic-gate 	queue_t			*lq_pending_queue; /* upper write q */
82*7c478bd9Sstevel@tonic-gate 
83*7c478bd9Sstevel@tonic-gate 	int			lq_num_buttons; /* number of buttons */
84*7c478bd9Sstevel@tonic-gate 	int			lq_num_wheels;	/* number of wheels */
85*7c478bd9Sstevel@tonic-gate 	ushort_t		lq_wheel_state_bf; /* enabled/disabled */
86*7c478bd9Sstevel@tonic-gate } consms_lq_t;
87*7c478bd9Sstevel@tonic-gate 
88*7c478bd9Sstevel@tonic-gate /*
89*7c478bd9Sstevel@tonic-gate  * This structure is used to remember the
90*7c478bd9Sstevel@tonic-gate  * COPYIN and COPYOUT request mp from lower
91*7c478bd9Sstevel@tonic-gate  * queue during transparent ioctl.
92*7c478bd9Sstevel@tonic-gate  */
93*7c478bd9Sstevel@tonic-gate typedef struct consms_response {
94*7c478bd9Sstevel@tonic-gate 	struct consms_response	*rsp_next;
95*7c478bd9Sstevel@tonic-gate 	mblk_t  *rsp_mp;	/* response mp (M_COPYIN or M_COPYOUT) */
96*7c478bd9Sstevel@tonic-gate 	queue_t	*rsp_queue;	/* lower read q giving this response */
97*7c478bd9Sstevel@tonic-gate } consms_response_t;
98*7c478bd9Sstevel@tonic-gate 
99*7c478bd9Sstevel@tonic-gate /*
100*7c478bd9Sstevel@tonic-gate  * This structure contains information for
101*7c478bd9Sstevel@tonic-gate  * each ioctl message from upper layer
102*7c478bd9Sstevel@tonic-gate  * (usually, X server).
103*7c478bd9Sstevel@tonic-gate  */
104*7c478bd9Sstevel@tonic-gate typedef struct consms_msg {
105*7c478bd9Sstevel@tonic-gate 	struct consms_msg *msg_next;
106*7c478bd9Sstevel@tonic-gate 
107*7c478bd9Sstevel@tonic-gate 	uint_t	msg_id;			/* taken from request message */
108*7c478bd9Sstevel@tonic-gate 	int	msg_num_requests;	/* # of lower queues dispatched */
109*7c478bd9Sstevel@tonic-gate 	int	msg_num_responses;	/* # of responses from lower queues */
110*7c478bd9Sstevel@tonic-gate 	mblk_t	*msg_request;		/* pending request message from upper */
111*7c478bd9Sstevel@tonic-gate 	queue_t *msg_queue;		/* upper write q used for qrely() */
112*7c478bd9Sstevel@tonic-gate 
113*7c478bd9Sstevel@tonic-gate 	/*
114*7c478bd9Sstevel@tonic-gate 	 * ack_mp is just used for IOCACK
115*7c478bd9Sstevel@tonic-gate 	 * and rsp_list is only used for COPYIN
116*7c478bd9Sstevel@tonic-gate 	 * or COPYOUT responses from lowers
117*7c478bd9Sstevel@tonic-gate 	 */
118*7c478bd9Sstevel@tonic-gate 	mblk_t			*msg_ack_mp;	/* IOCACK from lower */
119*7c478bd9Sstevel@tonic-gate 	consms_response_t	*msg_rsp_list;	/* responses from lower */
120*7c478bd9Sstevel@tonic-gate } consms_msg_t;
121*7c478bd9Sstevel@tonic-gate 
122*7c478bd9Sstevel@tonic-gate /*
123*7c478bd9Sstevel@tonic-gate  * This structure contains information
124*7c478bd9Sstevel@tonic-gate  * about virtual mouse (lower queue list,
125*7c478bd9Sstevel@tonic-gate  * and virtual mouse state variables).
126*7c478bd9Sstevel@tonic-gate  */
127*7c478bd9Sstevel@tonic-gate typedef struct consms_state {
128*7c478bd9Sstevel@tonic-gate 	consms_lq_t	*consms_lqs;		/* lower queues */
129*7c478bd9Sstevel@tonic-gate 	int		consms_num_lqs;		/* # of lower queues */
130*7c478bd9Sstevel@tonic-gate 
131*7c478bd9Sstevel@tonic-gate 	/* virtual mouse state variables */
132*7c478bd9Sstevel@tonic-gate 	int		consms_vuid_format;	/* NATIVE or VUID_FIRM */
133*7c478bd9Sstevel@tonic-gate 	int		consms_num_buttons;	/* max number of buttons */
134*7c478bd9Sstevel@tonic-gate 	int		consms_num_wheels;	/* max number of wheels */
135*7c478bd9Sstevel@tonic-gate 	ushort_t	consms_wheel_state_bf;	/* wheel enabled or disabled */
136*7c478bd9Sstevel@tonic-gate 	Ms_parms	consms_ms_parms;	/* parameters for usb mouse */
137*7c478bd9Sstevel@tonic-gate 	Ms_screen_resolution	consms_ms_sr; 	/* for absolute mouse */
138*7c478bd9Sstevel@tonic-gate } consms_state_t;
139*7c478bd9Sstevel@tonic-gate 
140*7c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
141*7c478bd9Sstevel@tonic-gate }
142*7c478bd9Sstevel@tonic-gate #endif
143*7c478bd9Sstevel@tonic-gate 
144*7c478bd9Sstevel@tonic-gate #endif	/* _SYS_CONSMS_H */
145