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