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 #pragma ident "%Z%%M% %I% %E% SMI" 307c478bd9Sstevel@tonic-gate 317c478bd9Sstevel@tonic-gate #ifdef __cplusplus 327c478bd9Sstevel@tonic-gate extern "C" { 337c478bd9Sstevel@tonic-gate #endif 347c478bd9Sstevel@tonic-gate 357c478bd9Sstevel@tonic-gate /* 367c478bd9Sstevel@tonic-gate * Those default values are taken from lower mice drivers. 377c478bd9Sstevel@tonic-gate */ 387c478bd9Sstevel@tonic-gate #define CONSMS_SR_DEFAULT_HEIGHT 768 397c478bd9Sstevel@tonic-gate #define CONSMS_SR_DEFAULT_WIDTH 1024 407c478bd9Sstevel@tonic-gate 417c478bd9Sstevel@tonic-gate #define CONSMS_PARMS_DEFAULT_JITTER 0 427c478bd9Sstevel@tonic-gate #define CONSMS_PARMS_DEFAULT_SPEED_LAW 0 437c478bd9Sstevel@tonic-gate #define CONSMS_PARMS_DEFAULT_SPEED_LIMIT 48 447c478bd9Sstevel@tonic-gate 457c478bd9Sstevel@tonic-gate #define CONSMS_MAX(x, y) ((x) > (y) ? (x) : (y)) 467c478bd9Sstevel@tonic-gate 477c478bd9Sstevel@tonic-gate /* 487c478bd9Sstevel@tonic-gate * These states are only used when an underlying mouse 497c478bd9Sstevel@tonic-gate * is being linked under the virtual mouse (/dev/mouse), 507c478bd9Sstevel@tonic-gate * in order to set some cached state variables. And these 517c478bd9Sstevel@tonic-gate * states go in a sequential way. 527c478bd9Sstevel@tonic-gate */ 537c478bd9Sstevel@tonic-gate typedef enum { 547c478bd9Sstevel@tonic-gate LQS_START = 0, /* begin of initializing */ 557c478bd9Sstevel@tonic-gate LQS_BUTTON_COUNT_PENDING = 1, /* wait for button count ACK */ 567c478bd9Sstevel@tonic-gate LQS_WHEEL_COUNT_PENDING = 2, /* wait for wheel count ACK */ 577c478bd9Sstevel@tonic-gate LQS_SET_VUID_FORMAT_PENDING = 3, /* wait for set format ACK */ 587c478bd9Sstevel@tonic-gate LQS_SET_WHEEL_STATE_PENDING = 4, /* wait for wheel state ACK */ 59*d5007c14Sqz150045 LQS_SET_PARMS_PENDING = 5, /* wait for parameters ACK */ 60*d5007c14Sqz150045 LQS_SET_RESOLUTION_PENDING = 6, /* wait for resolution ACK */ 617c478bd9Sstevel@tonic-gate LQS_DONE = 7 /* mark end of initialization */ 627c478bd9Sstevel@tonic-gate } consms_lq_state_t; 637c478bd9Sstevel@tonic-gate 647c478bd9Sstevel@tonic-gate struct consms_lq; 657c478bd9Sstevel@tonic-gate typedef void (*ioc_reply_func_t)(struct consms_lq *, mblk_t *); 667c478bd9Sstevel@tonic-gate 677c478bd9Sstevel@tonic-gate /* 687c478bd9Sstevel@tonic-gate * This structure contains information 697c478bd9Sstevel@tonic-gate * for each underlying physical mouse 707c478bd9Sstevel@tonic-gate * (lower queue). 717c478bd9Sstevel@tonic-gate */ 727c478bd9Sstevel@tonic-gate typedef struct consms_lq { 737c478bd9Sstevel@tonic-gate struct consms_lq *lq_next; /* next lower queue */ 747c478bd9Sstevel@tonic-gate 757c478bd9Sstevel@tonic-gate consms_lq_state_t lq_state; /* used during initializing */ 767c478bd9Sstevel@tonic-gate queue_t *lq_queue; /* lower write q */ 777c478bd9Sstevel@tonic-gate 787c478bd9Sstevel@tonic-gate ioc_reply_func_t lq_ioc_reply_func; /* reply function */ 797c478bd9Sstevel@tonic-gate mblk_t *lq_pending_plink; /* pending msg */ 807c478bd9Sstevel@tonic-gate queue_t *lq_pending_queue; /* upper write q */ 817c478bd9Sstevel@tonic-gate 827c478bd9Sstevel@tonic-gate int lq_num_buttons; /* number of buttons */ 837c478bd9Sstevel@tonic-gate int lq_num_wheels; /* number of wheels */ 847c478bd9Sstevel@tonic-gate ushort_t lq_wheel_state_bf; /* enabled/disabled */ 857c478bd9Sstevel@tonic-gate } consms_lq_t; 867c478bd9Sstevel@tonic-gate 877c478bd9Sstevel@tonic-gate /* 887c478bd9Sstevel@tonic-gate * This structure is used to remember the 897c478bd9Sstevel@tonic-gate * COPYIN and COPYOUT request mp from lower 907c478bd9Sstevel@tonic-gate * queue during transparent ioctl. 917c478bd9Sstevel@tonic-gate */ 927c478bd9Sstevel@tonic-gate typedef struct consms_response { 937c478bd9Sstevel@tonic-gate struct consms_response *rsp_next; 947c478bd9Sstevel@tonic-gate mblk_t *rsp_mp; /* response mp (M_COPYIN or M_COPYOUT) */ 957c478bd9Sstevel@tonic-gate queue_t *rsp_queue; /* lower read q giving this response */ 967c478bd9Sstevel@tonic-gate } consms_response_t; 977c478bd9Sstevel@tonic-gate 987c478bd9Sstevel@tonic-gate /* 997c478bd9Sstevel@tonic-gate * This structure contains information for 1007c478bd9Sstevel@tonic-gate * each ioctl message from upper layer 1017c478bd9Sstevel@tonic-gate * (usually, X server). 1027c478bd9Sstevel@tonic-gate */ 1037c478bd9Sstevel@tonic-gate typedef struct consms_msg { 1047c478bd9Sstevel@tonic-gate struct consms_msg *msg_next; 1057c478bd9Sstevel@tonic-gate 1067c478bd9Sstevel@tonic-gate uint_t msg_id; /* taken from request message */ 1077c478bd9Sstevel@tonic-gate int msg_num_requests; /* # of lower queues dispatched */ 1087c478bd9Sstevel@tonic-gate int msg_num_responses; /* # of responses from lower queues */ 1097c478bd9Sstevel@tonic-gate mblk_t *msg_request; /* pending request message from upper */ 1107c478bd9Sstevel@tonic-gate queue_t *msg_queue; /* upper write q used for qrely() */ 1117c478bd9Sstevel@tonic-gate 1127c478bd9Sstevel@tonic-gate /* 1137c478bd9Sstevel@tonic-gate * ack_mp is just used for IOCACK 1147c478bd9Sstevel@tonic-gate * and rsp_list is only used for COPYIN 1157c478bd9Sstevel@tonic-gate * or COPYOUT responses from lowers 1167c478bd9Sstevel@tonic-gate */ 1177c478bd9Sstevel@tonic-gate mblk_t *msg_ack_mp; /* IOCACK from lower */ 1187c478bd9Sstevel@tonic-gate consms_response_t *msg_rsp_list; /* responses from lower */ 1197c478bd9Sstevel@tonic-gate } consms_msg_t; 1207c478bd9Sstevel@tonic-gate 1217c478bd9Sstevel@tonic-gate /* 1227c478bd9Sstevel@tonic-gate * This structure contains information 1237c478bd9Sstevel@tonic-gate * about virtual mouse (lower queue list, 1247c478bd9Sstevel@tonic-gate * and virtual mouse state variables). 1257c478bd9Sstevel@tonic-gate */ 1267c478bd9Sstevel@tonic-gate typedef struct consms_state { 1277c478bd9Sstevel@tonic-gate consms_lq_t *consms_lqs; /* lower queues */ 1287c478bd9Sstevel@tonic-gate int consms_num_lqs; /* # of lower queues */ 1297c478bd9Sstevel@tonic-gate 1307c478bd9Sstevel@tonic-gate /* virtual mouse state variables */ 1317c478bd9Sstevel@tonic-gate int consms_vuid_format; /* NATIVE or VUID_FIRM */ 1327c478bd9Sstevel@tonic-gate int consms_num_buttons; /* max number of buttons */ 1337c478bd9Sstevel@tonic-gate int consms_num_wheels; /* max number of wheels */ 1347c478bd9Sstevel@tonic-gate ushort_t consms_wheel_state_bf; /* wheel enabled or disabled */ 1357c478bd9Sstevel@tonic-gate Ms_parms consms_ms_parms; /* parameters for usb mouse */ 1367c478bd9Sstevel@tonic-gate Ms_screen_resolution consms_ms_sr; /* for absolute mouse */ 1377c478bd9Sstevel@tonic-gate } consms_state_t; 1387c478bd9Sstevel@tonic-gate 1397c478bd9Sstevel@tonic-gate #ifdef __cplusplus 1407c478bd9Sstevel@tonic-gate } 1417c478bd9Sstevel@tonic-gate #endif 1427c478bd9Sstevel@tonic-gate 1437c478bd9Sstevel@tonic-gate #endif /* _SYS_CONSMS_H */ 144