1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License, Version 1.0 only 6 * (the "License"). You may not use this file except in compliance 7 * with the License. 8 * 9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10 * or http://www.opensolaris.org/os/licensing. 11 * See the License for the specific language governing permissions 12 * and limitations under the License. 13 * 14 * When distributing Covered Code, include this CDDL HEADER in each 15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16 * If applicable, add the following below this CDDL HEADER, with the 17 * fields enclosed by brackets "[]" replaced with your own identifying 18 * information: Portions Copyright [yyyy] [name of copyright owner] 19 * 20 * CDDL HEADER END 21 */ 22 /* 23 * Copyright 2005 Sun Microsystems, Inc. All rights reserved. 24 * Use is subject to license terms. 25 */ 26 27 #ifndef _KBTRANS_STREAMS_H 28 #define _KBTRANS_STREAMS_H 29 30 #pragma ident "%Z%%M% %I% %E% SMI" 31 32 #ifdef __cplusplus 33 extern "C" { 34 #endif 35 36 #include <sys/stream.h> 37 38 #define KBTRANS_POLLED_BUF_SIZE 30 39 40 /* definitions for various state machines */ 41 #define KBTRANS_STREAMS_OPEN 0x00000001 /* keyboard is open for business */ 42 43 #define NO_HARD_RESET 0 /* resets only state struct */ 44 #define HARD_RESET 1 /* resets keyboard and state structure */ 45 46 /* 47 * structure to keep track of currently pressed keys when in 48 * TR_UNTRANS_EVENT mode 49 */ 50 typedef struct key_event { 51 uchar_t key_station; /* Physical key station associated with event */ 52 Firm_event event; /* Event that sent out on down */ 53 } Key_event; 54 55 56 /* state structure for kbtrans_streams */ 57 struct kbtrans { 58 struct kbtrans_lower kbtrans_lower; /* actual translation state */ 59 60 /* Read and write queues */ 61 queue_t *kbtrans_streams_readq; 62 queue_t *kbtrans_streams_writeq; 63 64 /* Pending "ioctl" awaiting buffer */ 65 mblk_t *kbtrans_streams_iocpending; 66 67 /* Number of times the keyboard overflowed input */ 68 int kbtrans_overflow_cnt; 69 70 /* random flags */ 71 int kbtrans_streams_flags; 72 73 /* id from qbufcall on allocb failure */ 74 bufcall_id_t kbtrans_streams_bufcallid; 75 76 timeout_id_t kbtrans_streams_rptid; /* timeout id for repeat */ 77 78 int kbtrans_streams_iocerror; /* error return from "ioctl" */ 79 int kbtrans_streams_translate_mode; /* Translate keycodes? */ 80 int kbtrans_streams_translatable; /* Keyboard is translatable? */ 81 82 /* Vuid_id_addrs for various events */ 83 struct { 84 short ascii; 85 short top; 86 short vkey; 87 } kbtrans_streams_vuid_addr; 88 89 /* 90 * Table of key stations currently down that have 91 * have firm events that need to be matched with up transitions 92 * when translation mode is TR_*EVENT 93 */ 94 struct key_event *kbtrans_streams_downs; 95 96 /* Number of down entries */ 97 int kbtrans_streams_num_downs_entries; /* entries in downs */ 98 99 /* Bytes allocated for downs */ 100 uint_t kbtrans_streams_downs_bytes; 101 102 /* Abort state */ 103 enum { 104 ABORT_NORMAL, 105 ABORT_ABORT1_RECEIVED 106 } kbtrans_streams_abort_state; 107 108 /* Indicated whether or not abort may be honored */ 109 boolean_t kbtrans_streams_abortable; 110 111 /* 112 * During an abort sequence, says which key started the sequence. 113 * This is used to support both L1+A and F1+A. 114 */ 115 kbtrans_key_t kbtrans_streams_abort1_key; 116 117 /* Functions to be called based on the translation type */ 118 struct keyboard_callback *kbtrans_streams_callback; 119 120 /* Private structure for the keyboard specific module/driver */ 121 struct kbtrans_hardware *kbtrans_streams_hw; 122 123 /* Callbacks into the keyboard specific module/driver */ 124 struct kbtrans_callbacks *kbtrans_streams_hw_callbacks; 125 126 /* Keyboard type */ 127 int kbtrans_streams_id; 128 129 /* Buffers to hold characters during the polled mode */ 130 char *kbtrans_polled_pending_chars; 131 char kbtrans_polled_buf[KBTRANS_POLLED_BUF_SIZE+1]; 132 }; 133 134 #ifdef __cplusplus 135 } 136 #endif 137 138 #endif /* _KBTRANS_STREAMS_H */ 139