17c478bd9Sstevel@tonic-gate /* 27c478bd9Sstevel@tonic-gate * CDDL HEADER START 37c478bd9Sstevel@tonic-gate * 47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*d5007c14Sqz150045 * Common Development and Distribution License (the "License"). 6*d5007c14Sqz150045 * You may not use this file except in compliance with the License. 77c478bd9Sstevel@tonic-gate * 87c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 97c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 107c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 117c478bd9Sstevel@tonic-gate * and limitations under the License. 127c478bd9Sstevel@tonic-gate * 137c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 147c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 157c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 167c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 177c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 187c478bd9Sstevel@tonic-gate * 197c478bd9Sstevel@tonic-gate * CDDL HEADER END 207c478bd9Sstevel@tonic-gate */ 217c478bd9Sstevel@tonic-gate /* 22*d5007c14Sqz150045 * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 237c478bd9Sstevel@tonic-gate * Use is subject to license terms. 247c478bd9Sstevel@tonic-gate */ 257c478bd9Sstevel@tonic-gate 267c478bd9Sstevel@tonic-gate #ifndef _SYS_CONSMS_H 277c478bd9Sstevel@tonic-gate #define _SYS_CONSMS_H 287c478bd9Sstevel@tonic-gate 297c478bd9Sstevel@tonic-gate #ifdef __cplusplus 307c478bd9Sstevel@tonic-gate extern "C" { 317c478bd9Sstevel@tonic-gate #endif 327c478bd9Sstevel@tonic-gate 337c478bd9Sstevel@tonic-gate /* 347c478bd9Sstevel@tonic-gate * Those default values are taken from lower mice drivers. 357c478bd9Sstevel@tonic-gate */ 367c478bd9Sstevel@tonic-gate #define CONSMS_SR_DEFAULT_HEIGHT 768 377c478bd9Sstevel@tonic-gate #define CONSMS_SR_DEFAULT_WIDTH 1024 387c478bd9Sstevel@tonic-gate 397c478bd9Sstevel@tonic-gate #define CONSMS_PARMS_DEFAULT_JITTER 0 407c478bd9Sstevel@tonic-gate #define CONSMS_PARMS_DEFAULT_SPEED_LAW 0 417c478bd9Sstevel@tonic-gate #define CONSMS_PARMS_DEFAULT_SPEED_LIMIT 48 427c478bd9Sstevel@tonic-gate 437c478bd9Sstevel@tonic-gate #define CONSMS_MAX(x, y) ((x) > (y) ? (x) : (y)) 447c478bd9Sstevel@tonic-gate 457c478bd9Sstevel@tonic-gate /* 467c478bd9Sstevel@tonic-gate * These states are only used when an underlying mouse 477c478bd9Sstevel@tonic-gate * is being linked under the virtual mouse (/dev/mouse), 487c478bd9Sstevel@tonic-gate * in order to set some cached state variables. And these 497c478bd9Sstevel@tonic-gate * states go in a sequential way. 507c478bd9Sstevel@tonic-gate */ 517c478bd9Sstevel@tonic-gate typedef enum { 527c478bd9Sstevel@tonic-gate LQS_START = 0, /* begin of initializing */ 537c478bd9Sstevel@tonic-gate LQS_BUTTON_COUNT_PENDING = 1, /* wait for button count ACK */ 547c478bd9Sstevel@tonic-gate LQS_WHEEL_COUNT_PENDING = 2, /* wait for wheel count ACK */ 557c478bd9Sstevel@tonic-gate LQS_SET_VUID_FORMAT_PENDING = 3, /* wait for set format ACK */ 567c478bd9Sstevel@tonic-gate LQS_SET_WHEEL_STATE_PENDING = 4, /* wait for wheel state ACK */ 57*d5007c14Sqz150045 LQS_SET_PARMS_PENDING = 5, /* wait for parameters ACK */ 58*d5007c14Sqz150045 LQS_SET_RESOLUTION_PENDING = 6, /* wait for resolution ACK */ 597c478bd9Sstevel@tonic-gate LQS_DONE = 7 /* mark end of initialization */ 607c478bd9Sstevel@tonic-gate } consms_lq_state_t; 617c478bd9Sstevel@tonic-gate 627c478bd9Sstevel@tonic-gate struct consms_lq; 637c478bd9Sstevel@tonic-gate typedef void (*ioc_reply_func_t)(struct consms_lq *, mblk_t *); 647c478bd9Sstevel@tonic-gate 657c478bd9Sstevel@tonic-gate /* 667c478bd9Sstevel@tonic-gate * This structure contains information 677c478bd9Sstevel@tonic-gate * for each underlying physical mouse 687c478bd9Sstevel@tonic-gate * (lower queue). 697c478bd9Sstevel@tonic-gate */ 707c478bd9Sstevel@tonic-gate typedef struct consms_lq { 717c478bd9Sstevel@tonic-gate struct consms_lq *lq_next; /* next lower queue */ 727c478bd9Sstevel@tonic-gate 737c478bd9Sstevel@tonic-gate consms_lq_state_t lq_state; /* used during initializing */ 747c478bd9Sstevel@tonic-gate queue_t *lq_queue; /* lower write q */ 757c478bd9Sstevel@tonic-gate 767c478bd9Sstevel@tonic-gate ioc_reply_func_t lq_ioc_reply_func; /* reply function */ 777c478bd9Sstevel@tonic-gate mblk_t *lq_pending_plink; /* pending msg */ 787c478bd9Sstevel@tonic-gate queue_t *lq_pending_queue; /* upper write q */ 797c478bd9Sstevel@tonic-gate 807c478bd9Sstevel@tonic-gate int lq_num_buttons; /* number of buttons */ 817c478bd9Sstevel@tonic-gate int lq_num_wheels; /* number of wheels */ 827c478bd9Sstevel@tonic-gate ushort_t lq_wheel_state_bf; /* enabled/disabled */ 837c478bd9Sstevel@tonic-gate } consms_lq_t; 847c478bd9Sstevel@tonic-gate 857c478bd9Sstevel@tonic-gate /* 867c478bd9Sstevel@tonic-gate * This structure is used to remember the 877c478bd9Sstevel@tonic-gate * COPYIN and COPYOUT request mp from lower 887c478bd9Sstevel@tonic-gate * queue during transparent ioctl. 897c478bd9Sstevel@tonic-gate */ 907c478bd9Sstevel@tonic-gate typedef struct consms_response { 917c478bd9Sstevel@tonic-gate struct consms_response *rsp_next; 927c478bd9Sstevel@tonic-gate mblk_t *rsp_mp; /* response mp (M_COPYIN or M_COPYOUT) */ 937c478bd9Sstevel@tonic-gate queue_t *rsp_queue; /* lower read q giving this response */ 947c478bd9Sstevel@tonic-gate } consms_response_t; 957c478bd9Sstevel@tonic-gate 967c478bd9Sstevel@tonic-gate /* 977c478bd9Sstevel@tonic-gate * This structure contains information for 987c478bd9Sstevel@tonic-gate * each ioctl message from upper layer 997c478bd9Sstevel@tonic-gate * (usually, X server). 1007c478bd9Sstevel@tonic-gate */ 1017c478bd9Sstevel@tonic-gate typedef struct consms_msg { 1027c478bd9Sstevel@tonic-gate struct consms_msg *msg_next; 1037c478bd9Sstevel@tonic-gate 1047c478bd9Sstevel@tonic-gate uint_t msg_id; /* taken from request message */ 1057c478bd9Sstevel@tonic-gate int msg_num_requests; /* # of lower queues dispatched */ 1067c478bd9Sstevel@tonic-gate int msg_num_responses; /* # of responses from lower queues */ 1077c478bd9Sstevel@tonic-gate mblk_t *msg_request; /* pending request message from upper */ 1087c478bd9Sstevel@tonic-gate queue_t *msg_queue; /* upper write q used for qrely() */ 1097c478bd9Sstevel@tonic-gate 1107c478bd9Sstevel@tonic-gate /* 1117c478bd9Sstevel@tonic-gate * ack_mp is just used for IOCACK 1127c478bd9Sstevel@tonic-gate * and rsp_list is only used for COPYIN 1137c478bd9Sstevel@tonic-gate * or COPYOUT responses from lowers 1147c478bd9Sstevel@tonic-gate */ 1157c478bd9Sstevel@tonic-gate mblk_t *msg_ack_mp; /* IOCACK from lower */ 1167c478bd9Sstevel@tonic-gate consms_response_t *msg_rsp_list; /* responses from lower */ 1177c478bd9Sstevel@tonic-gate } consms_msg_t; 1187c478bd9Sstevel@tonic-gate 1197c478bd9Sstevel@tonic-gate /* 1207c478bd9Sstevel@tonic-gate * This structure contains information 1217c478bd9Sstevel@tonic-gate * about virtual mouse (lower queue list, 1227c478bd9Sstevel@tonic-gate * and virtual mouse state variables). 1237c478bd9Sstevel@tonic-gate */ 1247c478bd9Sstevel@tonic-gate typedef struct consms_state { 1257c478bd9Sstevel@tonic-gate consms_lq_t *consms_lqs; /* lower queues */ 1267c478bd9Sstevel@tonic-gate int consms_num_lqs; /* # of lower queues */ 1277c478bd9Sstevel@tonic-gate 1287c478bd9Sstevel@tonic-gate /* virtual mouse state variables */ 1297c478bd9Sstevel@tonic-gate int consms_vuid_format; /* NATIVE or VUID_FIRM */ 1307c478bd9Sstevel@tonic-gate int consms_num_buttons; /* max number of buttons */ 1317c478bd9Sstevel@tonic-gate int consms_num_wheels; /* max number of wheels */ 1327c478bd9Sstevel@tonic-gate ushort_t consms_wheel_state_bf; /* wheel enabled or disabled */ 1337c478bd9Sstevel@tonic-gate Ms_parms consms_ms_parms; /* parameters for usb mouse */ 1347c478bd9Sstevel@tonic-gate Ms_screen_resolution consms_ms_sr; /* for absolute mouse */ 1357c478bd9Sstevel@tonic-gate } consms_state_t; 1367c478bd9Sstevel@tonic-gate 1377c478bd9Sstevel@tonic-gate #ifdef __cplusplus 1387c478bd9Sstevel@tonic-gate } 1397c478bd9Sstevel@tonic-gate #endif 1407c478bd9Sstevel@tonic-gate 1417c478bd9Sstevel@tonic-gate #endif /* _SYS_CONSMS_H */ 142