xref: /onnv-gate/usr/src/uts/common/sys/consms.h (revision 1662:f2943a2040e9)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*1662Sqz150045  * Common Development and Distribution License (the "License").
6*1662Sqz150045  * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate  *
80Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate  * See the License for the specific language governing permissions
110Sstevel@tonic-gate  * and limitations under the License.
120Sstevel@tonic-gate  *
130Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate  *
190Sstevel@tonic-gate  * CDDL HEADER END
200Sstevel@tonic-gate  */
210Sstevel@tonic-gate /*
22*1662Sqz150045  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
230Sstevel@tonic-gate  * Use is subject to license terms.
240Sstevel@tonic-gate  */
250Sstevel@tonic-gate 
260Sstevel@tonic-gate #ifndef	_SYS_CONSMS_H
270Sstevel@tonic-gate #define	_SYS_CONSMS_H
280Sstevel@tonic-gate 
290Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
300Sstevel@tonic-gate 
310Sstevel@tonic-gate #ifdef	__cplusplus
320Sstevel@tonic-gate extern "C" {
330Sstevel@tonic-gate #endif
340Sstevel@tonic-gate 
350Sstevel@tonic-gate /*
360Sstevel@tonic-gate  * Those default values are taken from lower mice drivers.
370Sstevel@tonic-gate  */
380Sstevel@tonic-gate #define	CONSMS_SR_DEFAULT_HEIGHT	768
390Sstevel@tonic-gate #define	CONSMS_SR_DEFAULT_WIDTH		1024
400Sstevel@tonic-gate 
410Sstevel@tonic-gate #define	CONSMS_PARMS_DEFAULT_JITTER	0
420Sstevel@tonic-gate #define	CONSMS_PARMS_DEFAULT_SPEED_LAW	0
430Sstevel@tonic-gate #define	CONSMS_PARMS_DEFAULT_SPEED_LIMIT	48
440Sstevel@tonic-gate 
450Sstevel@tonic-gate #define	CONSMS_MAX(x, y)	((x) > (y) ? (x) : (y))
460Sstevel@tonic-gate 
470Sstevel@tonic-gate /*
480Sstevel@tonic-gate  * These states are only used when an underlying mouse
490Sstevel@tonic-gate  * is being linked under the virtual mouse (/dev/mouse),
500Sstevel@tonic-gate  * in order to set some cached state variables. And these
510Sstevel@tonic-gate  * states go in a sequential way.
520Sstevel@tonic-gate  */
530Sstevel@tonic-gate typedef enum {
540Sstevel@tonic-gate 	LQS_START = 0,				/* begin of initializing */
550Sstevel@tonic-gate 	LQS_BUTTON_COUNT_PENDING = 1,		/* wait for button count ACK */
560Sstevel@tonic-gate 	LQS_WHEEL_COUNT_PENDING = 2,		/* wait for wheel count ACK */
570Sstevel@tonic-gate 	LQS_SET_VUID_FORMAT_PENDING = 3,	/* wait for set format ACK */
580Sstevel@tonic-gate 	LQS_SET_WHEEL_STATE_PENDING = 4,	/* wait for wheel state ACK */
59*1662Sqz150045 	LQS_SET_PARMS_PENDING = 5,		/* wait for parameters ACK */
60*1662Sqz150045 	LQS_SET_RESOLUTION_PENDING = 6,		/* wait for resolution ACK */
610Sstevel@tonic-gate 	LQS_DONE = 7				/* mark end of initialization */
620Sstevel@tonic-gate } consms_lq_state_t;
630Sstevel@tonic-gate 
640Sstevel@tonic-gate struct consms_lq;
650Sstevel@tonic-gate typedef void (*ioc_reply_func_t)(struct consms_lq *, mblk_t *);
660Sstevel@tonic-gate 
670Sstevel@tonic-gate /*
680Sstevel@tonic-gate  * This structure contains information
690Sstevel@tonic-gate  * for each underlying physical mouse
700Sstevel@tonic-gate  * (lower queue).
710Sstevel@tonic-gate  */
720Sstevel@tonic-gate typedef struct consms_lq {
730Sstevel@tonic-gate 	struct consms_lq	*lq_next;	/* next lower queue */
740Sstevel@tonic-gate 
750Sstevel@tonic-gate 	consms_lq_state_t	lq_state;	/* used during initializing */
760Sstevel@tonic-gate 	queue_t			*lq_queue;	/* lower write q */
770Sstevel@tonic-gate 
780Sstevel@tonic-gate 	ioc_reply_func_t	lq_ioc_reply_func; /* reply function */
790Sstevel@tonic-gate 	mblk_t			*lq_pending_plink; /* pending msg */
800Sstevel@tonic-gate 	queue_t			*lq_pending_queue; /* upper write q */
810Sstevel@tonic-gate 
820Sstevel@tonic-gate 	int			lq_num_buttons; /* number of buttons */
830Sstevel@tonic-gate 	int			lq_num_wheels;	/* number of wheels */
840Sstevel@tonic-gate 	ushort_t		lq_wheel_state_bf; /* enabled/disabled */
850Sstevel@tonic-gate } consms_lq_t;
860Sstevel@tonic-gate 
870Sstevel@tonic-gate /*
880Sstevel@tonic-gate  * This structure is used to remember the
890Sstevel@tonic-gate  * COPYIN and COPYOUT request mp from lower
900Sstevel@tonic-gate  * queue during transparent ioctl.
910Sstevel@tonic-gate  */
920Sstevel@tonic-gate typedef struct consms_response {
930Sstevel@tonic-gate 	struct consms_response	*rsp_next;
940Sstevel@tonic-gate 	mblk_t  *rsp_mp;	/* response mp (M_COPYIN or M_COPYOUT) */
950Sstevel@tonic-gate 	queue_t	*rsp_queue;	/* lower read q giving this response */
960Sstevel@tonic-gate } consms_response_t;
970Sstevel@tonic-gate 
980Sstevel@tonic-gate /*
990Sstevel@tonic-gate  * This structure contains information for
1000Sstevel@tonic-gate  * each ioctl message from upper layer
1010Sstevel@tonic-gate  * (usually, X server).
1020Sstevel@tonic-gate  */
1030Sstevel@tonic-gate typedef struct consms_msg {
1040Sstevel@tonic-gate 	struct consms_msg *msg_next;
1050Sstevel@tonic-gate 
1060Sstevel@tonic-gate 	uint_t	msg_id;			/* taken from request message */
1070Sstevel@tonic-gate 	int	msg_num_requests;	/* # of lower queues dispatched */
1080Sstevel@tonic-gate 	int	msg_num_responses;	/* # of responses from lower queues */
1090Sstevel@tonic-gate 	mblk_t	*msg_request;		/* pending request message from upper */
1100Sstevel@tonic-gate 	queue_t *msg_queue;		/* upper write q used for qrely() */
1110Sstevel@tonic-gate 
1120Sstevel@tonic-gate 	/*
1130Sstevel@tonic-gate 	 * ack_mp is just used for IOCACK
1140Sstevel@tonic-gate 	 * and rsp_list is only used for COPYIN
1150Sstevel@tonic-gate 	 * or COPYOUT responses from lowers
1160Sstevel@tonic-gate 	 */
1170Sstevel@tonic-gate 	mblk_t			*msg_ack_mp;	/* IOCACK from lower */
1180Sstevel@tonic-gate 	consms_response_t	*msg_rsp_list;	/* responses from lower */
1190Sstevel@tonic-gate } consms_msg_t;
1200Sstevel@tonic-gate 
1210Sstevel@tonic-gate /*
1220Sstevel@tonic-gate  * This structure contains information
1230Sstevel@tonic-gate  * about virtual mouse (lower queue list,
1240Sstevel@tonic-gate  * and virtual mouse state variables).
1250Sstevel@tonic-gate  */
1260Sstevel@tonic-gate typedef struct consms_state {
1270Sstevel@tonic-gate 	consms_lq_t	*consms_lqs;		/* lower queues */
1280Sstevel@tonic-gate 	int		consms_num_lqs;		/* # of lower queues */
1290Sstevel@tonic-gate 
1300Sstevel@tonic-gate 	/* virtual mouse state variables */
1310Sstevel@tonic-gate 	int		consms_vuid_format;	/* NATIVE or VUID_FIRM */
1320Sstevel@tonic-gate 	int		consms_num_buttons;	/* max number of buttons */
1330Sstevel@tonic-gate 	int		consms_num_wheels;	/* max number of wheels */
1340Sstevel@tonic-gate 	ushort_t	consms_wheel_state_bf;	/* wheel enabled or disabled */
1350Sstevel@tonic-gate 	Ms_parms	consms_ms_parms;	/* parameters for usb mouse */
1360Sstevel@tonic-gate 	Ms_screen_resolution	consms_ms_sr; 	/* for absolute mouse */
1370Sstevel@tonic-gate } consms_state_t;
1380Sstevel@tonic-gate 
1390Sstevel@tonic-gate #ifdef	__cplusplus
1400Sstevel@tonic-gate }
1410Sstevel@tonic-gate #endif
1420Sstevel@tonic-gate 
1430Sstevel@tonic-gate #endif	/* _SYS_CONSMS_H */
144