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 52469Srz201010 * Common Development and Distribution License (the "License"). 62469Srz201010 * 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 /* 223497Srz201010 * Copyright 2007 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_KBIO_H 270Sstevel@tonic-gate #define _SYS_KBIO_H 280Sstevel@tonic-gate 290Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" /* SunOS4.0 1.23 */ 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 * Keyboard related ioctls 370Sstevel@tonic-gate */ 380Sstevel@tonic-gate 390Sstevel@tonic-gate /* 400Sstevel@tonic-gate * See sys/kbd.h for TR_NONE (don't translate) and TR_ASCII 410Sstevel@tonic-gate * (translate to ASCII) TR_EVENT (translate to virtual input 420Sstevel@tonic-gate * device codes) 430Sstevel@tonic-gate */ 440Sstevel@tonic-gate #define KIOC ('k'<<8) 450Sstevel@tonic-gate 460Sstevel@tonic-gate #if defined(__i386) || defined(__i386_COMPAT) 470Sstevel@tonic-gate 480Sstevel@tonic-gate /* 490Sstevel@tonic-gate * For x86, these numbers conflict with KD "Xenix" ioctl numbers, so each 500Sstevel@tonic-gate * conflicting command has been offset by 30. 510Sstevel@tonic-gate */ 520Sstevel@tonic-gate #define KIOCTRANS (KIOC|30) /* set keyboard translation */ 530Sstevel@tonic-gate #define KIOCGTRANS (KIOC|35) /* get keyboard translation */ 540Sstevel@tonic-gate #define KIOCTRANSABLE (KIOC|36) /* set keyboard translatability */ 550Sstevel@tonic-gate #define KIOCGTRANSABLE (KIOC|37) /* get keyboard translatability */ 560Sstevel@tonic-gate 570Sstevel@tonic-gate #else /* __i386 || __i386_COMPAT */ 580Sstevel@tonic-gate 590Sstevel@tonic-gate #define KIOCTRANS (KIOC|0) /* set keyboard translation */ 600Sstevel@tonic-gate #define KIOCGTRANS (KIOC|5) /* get keyboard translation */ 610Sstevel@tonic-gate #define KIOCTRANSABLE (KIOC|6) /* set keyboard translatability */ 620Sstevel@tonic-gate #define KIOCGTRANSABLE (KIOC|7) /* get keyboard translatability */ 630Sstevel@tonic-gate 640Sstevel@tonic-gate #endif /* __i386 || __i386_COMPAT */ 650Sstevel@tonic-gate 660Sstevel@tonic-gate 670Sstevel@tonic-gate #define TR_CANNOT 0 /* Cannot translate keyboard using tables */ 680Sstevel@tonic-gate #define TR_CAN 1 /* Can translate keyboard using tables */ 690Sstevel@tonic-gate 700Sstevel@tonic-gate /* 710Sstevel@tonic-gate * Old-style keymap entry, for backwards compatibility only. 720Sstevel@tonic-gate */ 730Sstevel@tonic-gate struct kiockey { 740Sstevel@tonic-gate int kio_tablemask; /* Translation table (one of: 0, CAPSMASK, */ 750Sstevel@tonic-gate /* SHIFTMASK, CTRLMASK, UPMASK, */ 760Sstevel@tonic-gate /* ALTGRAPHMASK, NUMLOCKMASK) */ 770Sstevel@tonic-gate #define KIOCABORT1 -1 /* Special "mask": abort1 keystation */ 780Sstevel@tonic-gate #define KIOCABORT2 -2 /* Special "mask": abort2 keystation */ 790Sstevel@tonic-gate #define KIOCABORT1A -3 /* Special "mask": alt abort1 keystation */ 800Sstevel@tonic-gate uchar_t kio_station; /* Physical keyboard key station (0-127) */ 810Sstevel@tonic-gate uchar_t kio_entry; /* Translation table station's entry */ 820Sstevel@tonic-gate char kio_string[10]; /* Value for STRING entries (null terminated) */ 830Sstevel@tonic-gate }; 840Sstevel@tonic-gate 850Sstevel@tonic-gate /* 860Sstevel@tonic-gate * Set kio_tablemask table's kio_station to kio_entry. 870Sstevel@tonic-gate * Copy kio_string to string table if kio_entry is between STRING and 880Sstevel@tonic-gate * STRING+15. EINVAL is possible if there are invalid arguments. 890Sstevel@tonic-gate */ 900Sstevel@tonic-gate #if defined(__i386) || defined(__i386_COMPAT) 910Sstevel@tonic-gate #define KIOCSETKEY (KIOC|31) /* avoid conflict with "SETFKEY" */ 920Sstevel@tonic-gate #else 930Sstevel@tonic-gate #define KIOCSETKEY (KIOC|1) 940Sstevel@tonic-gate #endif 950Sstevel@tonic-gate 960Sstevel@tonic-gate /* 970Sstevel@tonic-gate * Get kio_tablemask table's kio_station to kio_entry. 980Sstevel@tonic-gate * Get kio_string from string table if kio_entry is between STRING and 990Sstevel@tonic-gate * STRING+15. EINVAL is possible if there are invalid arguments. 1000Sstevel@tonic-gate */ 1010Sstevel@tonic-gate #if defined(__i386) || defined(__i386_COMPAT) 1020Sstevel@tonic-gate #define KIOCGETKEY (KIOC|32) /* avoid conflict with "GIO_SCRNMAP" */ 1030Sstevel@tonic-gate #else 1040Sstevel@tonic-gate #define KIOCGETKEY (KIOC|2) 1050Sstevel@tonic-gate #endif 1060Sstevel@tonic-gate 1070Sstevel@tonic-gate /* 1080Sstevel@tonic-gate * Send the keyboard device a control command. sys/kbd.h contains 1090Sstevel@tonic-gate * the constants that define the commands. Normal values are: 1100Sstevel@tonic-gate * KBD_CMD_BELL, KBD_CMD_NOBELL, KBD_CMD_CLICK, KBD_CMD_NOCLICK. 1110Sstevel@tonic-gate * Inappropriate commands for particular keyboard types are ignored. 1120Sstevel@tonic-gate * 1130Sstevel@tonic-gate * Since there is no reliable way to get the state of the bell or click 1140Sstevel@tonic-gate * or LED (because we can't query the kdb, and also one could do writes 1150Sstevel@tonic-gate * to the appropriate serial driver--thus going around this ioctl) 1160Sstevel@tonic-gate * we don't provide an equivalent state querying ioctl. 1170Sstevel@tonic-gate */ 1180Sstevel@tonic-gate #define KIOCCMD (KIOC|8) 1190Sstevel@tonic-gate 1200Sstevel@tonic-gate /* 1210Sstevel@tonic-gate * Get keyboard type. Return values are one of KB_* from sys/kbd.h, 1220Sstevel@tonic-gate * e.g., KB_KLUNK, KB_VT100, KB_SUN2, KB_SUN3, KB_SUN4, KB_ASCII. 1230Sstevel@tonic-gate * -1 means that the type is not known. 1240Sstevel@tonic-gate */ 1250Sstevel@tonic-gate #define KIOCTYPE (KIOC|9) /* get keyboard type */ 1260Sstevel@tonic-gate 1270Sstevel@tonic-gate /* 1280Sstevel@tonic-gate * Set flag indicating whether keystrokes get routed to /dev/console. 1290Sstevel@tonic-gate */ 1300Sstevel@tonic-gate #define KIOCSDIRECT (KIOC|10) 1310Sstevel@tonic-gate 1320Sstevel@tonic-gate /* 1330Sstevel@tonic-gate * Get flag indicating whether keystrokes get routed to /dev/console. 1340Sstevel@tonic-gate */ 1350Sstevel@tonic-gate #if defined(__i386) || defined(__i386_COMPAT) 1360Sstevel@tonic-gate #define KIOCGDIRECT (KIOC|41) /* avoid conflict with "GIO_STRMAP" */ 1370Sstevel@tonic-gate #else 1380Sstevel@tonic-gate #define KIOCGDIRECT (KIOC|11) 1390Sstevel@tonic-gate #endif 1400Sstevel@tonic-gate 1410Sstevel@tonic-gate /* 1420Sstevel@tonic-gate * New-style key map entry. 1430Sstevel@tonic-gate */ 1440Sstevel@tonic-gate struct kiockeymap { 1450Sstevel@tonic-gate int kio_tablemask; /* Translation table (one of: 0, CAPSMASK, */ 1460Sstevel@tonic-gate /* SHIFTMASK, CTRLMASK, UPMASK, */ 1470Sstevel@tonic-gate /* ALTGRAPHMASK) */ 1480Sstevel@tonic-gate uchar_t kio_station; /* Physical keyboard key station (0-127) */ 1490Sstevel@tonic-gate ushort_t kio_entry; /* Translation table station's entry */ 1500Sstevel@tonic-gate char kio_string[10]; /* Value for STRING entries (null terminated) */ 1510Sstevel@tonic-gate }; 1520Sstevel@tonic-gate 1530Sstevel@tonic-gate /* 1540Sstevel@tonic-gate * Set kio_tablemask table's kio_station to kio_entry. 1550Sstevel@tonic-gate * Copy kio_string to string table if kio_entry is between STRING and 1560Sstevel@tonic-gate * STRING+15. EINVAL is possible if there are invalid arguments. 1570Sstevel@tonic-gate */ 1580Sstevel@tonic-gate #if defined(__i386) || defined(__i386_COMPAT) 1590Sstevel@tonic-gate #define KIOCSKEY (KIOC|42) /* avoid conflict with "PIO_STRMAP" */ 1600Sstevel@tonic-gate #else 1610Sstevel@tonic-gate #define KIOCSKEY (KIOC|12) 1620Sstevel@tonic-gate #endif 1630Sstevel@tonic-gate 1640Sstevel@tonic-gate /* 1650Sstevel@tonic-gate * Get kio_tablemask table's kio_station to kio_entry. 1660Sstevel@tonic-gate * Get kio_string from string table if kio_entry is between STRING and 1670Sstevel@tonic-gate * STRING+15. EINVAL is possible if there are invalid arguments. 1680Sstevel@tonic-gate */ 1690Sstevel@tonic-gate #define KIOCGKEY (KIOC|13) 1700Sstevel@tonic-gate 1710Sstevel@tonic-gate /* 1720Sstevel@tonic-gate * Set and get LED state. 1730Sstevel@tonic-gate */ 1740Sstevel@tonic-gate #define KIOCSLED (KIOC|14) 1750Sstevel@tonic-gate #define KIOCGLED (KIOC|15) 1760Sstevel@tonic-gate 1770Sstevel@tonic-gate /* 1780Sstevel@tonic-gate * Set and get compatibility mode. 1790Sstevel@tonic-gate */ 1800Sstevel@tonic-gate #define KIOCSCOMPAT (KIOC|16) 1810Sstevel@tonic-gate #define KIOCGCOMPAT (KIOC|17) 1820Sstevel@tonic-gate 1830Sstevel@tonic-gate /* 1840Sstevel@tonic-gate * Set and get keyboard layout. 1850Sstevel@tonic-gate */ 1860Sstevel@tonic-gate #define KIOCSLAYOUT (KIOC|19) 1870Sstevel@tonic-gate #define KIOCLAYOUT (KIOC|20) 1880Sstevel@tonic-gate 1890Sstevel@tonic-gate /* 1900Sstevel@tonic-gate * KIOCSKABORTEN: 1910Sstevel@tonic-gate * 1920Sstevel@tonic-gate * Enable/Disable/Alternate Keyboard abort effect (Stop/A, Break or other seq). 1930Sstevel@tonic-gate * The argument is a pointer to an integer. If the integer is zero, 1940Sstevel@tonic-gate * keyboard abort is disabled, one will enable keyboard abort (hardware BREAK 1950Sstevel@tonic-gate * signal), two will revert to the Alternative Break Sequence. NB: This ioctl 1960Sstevel@tonic-gate * requires root credentials and applies to serial input devices and keyboards. 1970Sstevel@tonic-gate * When the Alternative Break Sequence is enabled it applies to serial input 1980Sstevel@tonic-gate * devices ONLY. 1990Sstevel@tonic-gate */ 2000Sstevel@tonic-gate #define KIOCSKABORTEN (KIOC|21) 2010Sstevel@tonic-gate 2020Sstevel@tonic-gate #define KIOCABORTDISABLE 0 /* Disable Aborts */ 2030Sstevel@tonic-gate #define KIOCABORTENABLE 1 /* Enable BREAK Signal Aborts */ 2040Sstevel@tonic-gate #define KIOCABORTALTERNATE 2 /* Enable Alternative Aborts */ 2050Sstevel@tonic-gate 2060Sstevel@tonic-gate /* 2070Sstevel@tonic-gate * Get/Set Keyboard autorepeat delay/rate. 2080Sstevel@tonic-gate * Use millisecond as unit used by the user-level application 2090Sstevel@tonic-gate */ 2100Sstevel@tonic-gate #define KIOCGRPTDELAY (KIOC|22) 2110Sstevel@tonic-gate #define KIOCSRPTDELAY (KIOC|23) 2120Sstevel@tonic-gate #define KIOCGRPTRATE (KIOC|24) 2130Sstevel@tonic-gate #define KIOCSRPTRATE (KIOC|25) 2140Sstevel@tonic-gate 2153497Srz201010 /* Set keyboard and console beeper frequencies */ 2163497Srz201010 #define KIOCSETFREQ (KIOC|26) 2173497Srz201010 2183497Srz201010 /* Beeper type for struct freq_request */ 2193497Srz201010 enum fr_beep_type {CONSOLE_BEEP = 1, KBD_BEEP = 2}; 2203497Srz201010 2213497Srz201010 /* Frequency request structure */ 2223497Srz201010 struct freq_request { 2233497Srz201010 enum fr_beep_type type; /* Beeper type */ 2243497Srz201010 int16_t freq; /* Frequency */ 2253497Srz201010 }; 2263497Srz201010 227*5129Smarx #define KIOCMKTONE (KIOC|27) 228*5129Smarx 229*5129Smarx /* 230*5129Smarx * For historical reasons, the frequency argument to KIOCMKTONE is 231*5129Smarx * in i8254 clock cycles. 232*5129Smarx */ 233*5129Smarx 234*5129Smarx #define PIT_HZ 1193182 /* 8254's cycles per second */ 235*5129Smarx 236*5129Smarx #define KDMKTONE KIOCMKTONE 237*5129Smarx 2380Sstevel@tonic-gate /* Used to control the AutoRepeat Min-delay and Min-Rate */ 2392469Srz201010 #define KIOCRPTDELAY_MIN (100) 2404385Syx209491 #define KIOCRPTRATE_MIN (1) 2410Sstevel@tonic-gate 2420Sstevel@tonic-gate #ifdef __cplusplus 2430Sstevel@tonic-gate } 2440Sstevel@tonic-gate #endif 2450Sstevel@tonic-gate 2460Sstevel@tonic-gate #endif /* _SYS_KBIO_H */ 247