Initialization and keymapping code for DEC LK-201 and successor keyboards,
abstrated out of the pmax scc and dc7085 drivers.
This commit is contained in:
parent
92ec4c2ebb
commit
dec12b783d
348
sys/arch/pmax/dev/lk201.c
Normal file
348
sys/arch/pmax/dev/lk201.c
Normal file
@ -0,0 +1,348 @@
|
||||
/*
|
||||
* The LK201 keycode mapping routine is here, along with initialization
|
||||
* functions for the keyboard and mouse.
|
||||
*/
|
||||
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/syslog.h>
|
||||
#include <sys/select.h>
|
||||
#include <dev/cons.h>
|
||||
|
||||
#include <machine/pmioctl.h>
|
||||
|
||||
#include <pmax/dev/lk201.h>
|
||||
|
||||
|
||||
/* Exported functions */
|
||||
extern int kbdMapChar __P((int keycode));
|
||||
|
||||
extern void KBDReset __P(( dev_t dev, void (*putc) (dev_t, int) ));
|
||||
|
||||
/*
|
||||
* Keyboard to Ascii, unshifted.
|
||||
*/
|
||||
static unsigned char unshiftedAscii[] = {
|
||||
/* 0 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY,
|
||||
/* 4 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY,
|
||||
/* 8 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY,
|
||||
/* c */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY,
|
||||
/* 10 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY,
|
||||
/* 14 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY,
|
||||
/* 18 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY,
|
||||
/* 1c */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY,
|
||||
/* 20 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY,
|
||||
/* 24 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY,
|
||||
/* 28 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY,
|
||||
/* 2c */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY,
|
||||
/* 30 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY,
|
||||
/* 34 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY,
|
||||
/* 38 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY,
|
||||
/* 3c */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY,
|
||||
/* 40 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY,
|
||||
/* 44 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY,
|
||||
/* 48 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY,
|
||||
/* 4c */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY,
|
||||
/* 50 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY,
|
||||
/* 54 */ KBD_NOKEY, KBD_NOKEY, KBD_F1, KBD_F2,
|
||||
/* 58 */ KBD_F3, KBD_F4, KBD_F5, KBD_NOKEY,
|
||||
/* 5c */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY,
|
||||
/* 60 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY,
|
||||
/* 64 */ KBD_F6, KBD_F7, KBD_F8, KBD_F9,
|
||||
/* 68 */ KBD_F10, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY,
|
||||
/* 6c */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY,
|
||||
/* 70 */ KBD_NOKEY, '\033', KBD_F12, KBD_F13,
|
||||
/* 74 */ KBD_F14, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY,
|
||||
/* 78 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY,
|
||||
/* 7c */ KBD_HELP, KBD_DO, KBD_NOKEY, KBD_NOKEY,
|
||||
/* 80 */ KBD_F17, KBD_F18, KBD_F19, KBD_F20,
|
||||
/* 84 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY,
|
||||
/* 88 */ KBD_NOKEY, KBD_NOKEY, KBD_FIND, KBD_INSERT,
|
||||
/* 8c */ KBD_REMOVE, KBD_SELECT, KBD_PREVIOUS, KBD_NEXT,
|
||||
/* 90 */ KBD_NOKEY, KBD_NOKEY, '0', KBD_NOKEY,
|
||||
/* 94 */ '.', KBD_KP_ENTER, '1', '2',
|
||||
/* 98 */ '3', '4', '5', '6',
|
||||
/* 9c */ ',', '7', '8', '9',
|
||||
/* a0 */ '-', KBD_KP_F1, KBD_KP_F2, KBD_KP_F3,
|
||||
/* a4 */ KBD_KP_F4, KBD_NOKEY, KBD_NOKEY, KBD_LEFT,
|
||||
/* a8 */ KBD_RIGHT, KBD_DOWN, KBD_UP, KBD_NOKEY,
|
||||
/* ac */ KBD_NOKEY, KBD_NOKEY, KBD_SHIFT, KBD_CONTROL,
|
||||
/* b0 */ KBD_CAPSLOCK, KBD_ALTERNATE, KBD_NOKEY, KBD_NOKEY,
|
||||
/* b4 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY,
|
||||
/* b8 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY,
|
||||
/* bc */ KBD_DEL, KBD_RET, KBD_TAB, '`',
|
||||
/* c0 */ '1', 'q', 'a', 'z',
|
||||
/* c4 */ KBD_NOKEY, '2', 'w', 's',
|
||||
/* c8 */ 'x', '<', KBD_NOKEY, '3',
|
||||
/* cc */ 'e', 'd', 'c', KBD_NOKEY,
|
||||
/* d0 */ '4', 'r', 'f', 'v',
|
||||
/* d4 */ ' ', KBD_NOKEY, '5', 't',
|
||||
/* d8 */ 'g', 'b', KBD_NOKEY, '6',
|
||||
/* dc */ 'y', 'h', 'n', KBD_NOKEY,
|
||||
/* e0 */ '7', 'u', 'j', 'm',
|
||||
/* e4 */ KBD_NOKEY, '8', 'i', 'k',
|
||||
/* e8 */ ',', KBD_NOKEY, '9', 'o',
|
||||
/* ec */ 'l', '.', KBD_NOKEY, '0',
|
||||
/* f0 */ 'p', KBD_NOKEY, ';', '/',
|
||||
/* f4 */ KBD_NOKEY, '=', ']', '\\',
|
||||
/* f8 */ KBD_NOKEY, '-', '[', '\'',
|
||||
/* fc */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY,
|
||||
};
|
||||
|
||||
/*
|
||||
* Keyboard to Ascii, shifted.
|
||||
*/
|
||||
static unsigned char shiftedAscii[] = {
|
||||
/* 0 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY,
|
||||
/* 4 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY,
|
||||
/* 8 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY,
|
||||
/* c */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY,
|
||||
/* 10 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY,
|
||||
/* 14 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY,
|
||||
/* 18 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY,
|
||||
/* 1c */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY,
|
||||
/* 20 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY,
|
||||
/* 24 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY,
|
||||
/* 28 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY,
|
||||
/* 2c */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY,
|
||||
/* 30 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY,
|
||||
/* 34 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY,
|
||||
/* 38 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY,
|
||||
/* 3c */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY,
|
||||
/* 40 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY,
|
||||
/* 44 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY,
|
||||
/* 48 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY,
|
||||
/* 4c */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY,
|
||||
/* 50 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY,
|
||||
/* 54 */ KBD_NOKEY, KBD_NOKEY, KBD_F1, KBD_F2,
|
||||
/* 58 */ KBD_F3, KBD_F4, KBD_F5, KBD_NOKEY,
|
||||
/* 5c */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY,
|
||||
/* 60 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY,
|
||||
/* 64 */ KBD_F6, KBD_F7, KBD_F8, KBD_F9,
|
||||
/* 68 */ KBD_F10, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY,
|
||||
/* 6c */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY,
|
||||
/* 70 */ KBD_NOKEY, KBD_F11, KBD_F12, KBD_F13,
|
||||
/* 74 */ KBD_F14, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY,
|
||||
/* 78 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY,
|
||||
/* 7c */ KBD_HELP, KBD_DO, KBD_NOKEY, KBD_NOKEY,
|
||||
/* 80 */ KBD_F17, KBD_F18, KBD_F19, KBD_F20,
|
||||
/* 84 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY,
|
||||
/* 88 */ KBD_NOKEY, KBD_NOKEY, KBD_FIND, KBD_INSERT,
|
||||
/* 8c */ KBD_REMOVE, KBD_SELECT, KBD_PREVIOUS, KBD_NEXT,
|
||||
/* 90 */ KBD_NOKEY, KBD_NOKEY, '0', KBD_NOKEY,
|
||||
/* 94 */ '.', KBD_KP_ENTER, '1', '2',
|
||||
/* 98 */ '3', '4', '5', '6',
|
||||
/* 9c */ ',', '7', '8', '9',
|
||||
/* a0 */ '-', KBD_KP_F1, KBD_KP_F2, KBD_KP_F3,
|
||||
/* a4 */ KBD_KP_F4, KBD_NOKEY, KBD_NOKEY, KBD_LEFT,
|
||||
/* a8 */ KBD_RIGHT, KBD_DOWN, KBD_UP, KBD_NOKEY,
|
||||
/* ac */ KBD_NOKEY, KBD_NOKEY, KBD_SHIFT, KBD_CONTROL,
|
||||
/* b0 */ KBD_CAPSLOCK, KBD_ALTERNATE, KBD_NOKEY, KBD_NOKEY,
|
||||
/* b4 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY,
|
||||
/* b8 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY,
|
||||
/* bc */ KBD_DEL, KBD_RET, KBD_TAB, '~',
|
||||
/* c0 */ '!', 'q', 'a', 'z',
|
||||
/* c4 */ KBD_NOKEY, '@', 'w', 's',
|
||||
/* c8 */ 'x', '>', KBD_NOKEY, '#',
|
||||
/* cc */ 'e', 'd', 'c', KBD_NOKEY,
|
||||
/* d0 */ '$', 'r', 'f', 'v',
|
||||
/* d4 */ ' ', KBD_NOKEY, '%', 't',
|
||||
/* d8 */ 'g', 'b', KBD_NOKEY, '^',
|
||||
/* dc */ 'y', 'h', 'n', KBD_NOKEY,
|
||||
/* e0 */ '&', 'u', 'j', 'm',
|
||||
/* e4 */ KBD_NOKEY, '*', 'i', 'k',
|
||||
/* e8 */ '<', KBD_NOKEY, '(', 'o',
|
||||
/* ec */ 'l', '>', KBD_NOKEY, ')',
|
||||
/* f0 */ 'p', KBD_NOKEY, ':', '?',
|
||||
/* f4 */ KBD_NOKEY, '+', '}', '|',
|
||||
/* f8 */ KBD_NOKEY, '_', '{', '"',
|
||||
/* fc */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY,
|
||||
};
|
||||
|
||||
/*
|
||||
* Keyboard initialization string.
|
||||
*/
|
||||
static u_char kbdInitString[] = {
|
||||
LK_LED_ENABLE, LED_ALL, /* show we are resetting keyboard */
|
||||
LK_DEFAULTS,
|
||||
LK_CMD_MODE(LK_AUTODOWN, 1),
|
||||
LK_CMD_MODE(LK_AUTODOWN, 2),
|
||||
LK_CMD_MODE(LK_AUTODOWN, 3),
|
||||
LK_CMD_MODE(LK_DOWN, 4), /* could also be LK_AUTODOWN */
|
||||
LK_CMD_MODE(LK_UPDOWN, 5),
|
||||
LK_CMD_MODE(LK_UPDOWN, 6),
|
||||
LK_CMD_MODE(LK_AUTODOWN, 7),
|
||||
LK_CMD_MODE(LK_AUTODOWN, 8),
|
||||
LK_CMD_MODE(LK_AUTODOWN, 9),
|
||||
LK_CMD_MODE(LK_AUTODOWN, 10),
|
||||
LK_CMD_MODE(LK_AUTODOWN, 11),
|
||||
LK_CMD_MODE(LK_AUTODOWN, 12),
|
||||
LK_CMD_MODE(LK_DOWN, 13),
|
||||
LK_CMD_MODE(LK_AUTODOWN, 14),
|
||||
LK_AR_ENABLE, /* we want autorepeat by default */
|
||||
LK_CL_ENABLE, 0x83, /* keyclick, volume */
|
||||
LK_KBD_ENABLE, /* the keyboard itself */
|
||||
LK_BELL_ENABLE, 0x83, /* keyboard bell, volume */
|
||||
LK_LED_DISABLE, LED_ALL, /* clear keyboard leds */
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* Initialize the Keyboard.
|
||||
*/
|
||||
void
|
||||
KBDReset(kbddev, putc)
|
||||
dev_t kbddev;
|
||||
void (*putc) __P((dev_t, int));
|
||||
{
|
||||
register int i;
|
||||
static int inKBDReset;
|
||||
|
||||
if (inKBDReset)
|
||||
return;
|
||||
inKBDReset = 1;
|
||||
for (i = 0; i < sizeof(kbdInitString); i++)
|
||||
(*putc)(kbddev, (int)kbdInitString[i]);
|
||||
inKBDReset = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* ----------------------------------------------------------------------------
|
||||
*
|
||||
* kbdMapChar --
|
||||
*
|
||||
* Map characters from the keyboard to ASCII. Return -1 if there is
|
||||
* no valid mapping.
|
||||
*
|
||||
* Results:
|
||||
* None.
|
||||
*
|
||||
* Side effects:
|
||||
* Remember state of shift and control keys.
|
||||
*
|
||||
* ----------------------------------------------------------------------------
|
||||
*/
|
||||
int
|
||||
kbdMapChar(cc)
|
||||
int cc;
|
||||
{
|
||||
static u_char shiftDown;
|
||||
static u_char ctrlDown;
|
||||
static u_char lastChar;
|
||||
|
||||
switch (cc) {
|
||||
case KEY_REPEAT:
|
||||
cc = lastChar;
|
||||
goto done;
|
||||
|
||||
case KEY_UP:
|
||||
shiftDown = 0;
|
||||
ctrlDown = 0;
|
||||
return (-1);
|
||||
|
||||
case KEY_SHIFT:
|
||||
case KEY_R_SHIFT:
|
||||
if (ctrlDown || shiftDown)
|
||||
shiftDown = 0;
|
||||
else
|
||||
shiftDown = 1;
|
||||
return (-1);
|
||||
|
||||
case KEY_CONTROL:
|
||||
if (shiftDown || ctrlDown)
|
||||
ctrlDown = 0;
|
||||
else
|
||||
ctrlDown = 1;
|
||||
return (-1);
|
||||
|
||||
case LK_POWER_ERROR:
|
||||
case LK_KDOWN_ERROR:
|
||||
case LK_INPUT_ERROR:
|
||||
case LK_OUTPUT_ERROR:
|
||||
log(LOG_WARNING,
|
||||
"lk201: keyboard error, code=%x\n", cc);
|
||||
return (-1);
|
||||
}
|
||||
if (shiftDown)
|
||||
cc = shiftedAscii[cc];
|
||||
else
|
||||
cc = unshiftedAscii[cc];
|
||||
if (cc >= KBD_NOKEY) {
|
||||
/*
|
||||
* A function key was typed - ignore it.
|
||||
*/
|
||||
return (-1);
|
||||
}
|
||||
if (cc >= 'a' && cc <= 'z') {
|
||||
if (ctrlDown)
|
||||
cc = cc - 'a' + '\1'; /* ^A */
|
||||
else if (shiftDown)
|
||||
cc = cc - 'a' + 'A';
|
||||
} else if (ctrlDown) {
|
||||
if (cc >= '[' && cc <= '_')
|
||||
cc = cc - '@';
|
||||
else if (cc == ' ' || cc == '@')
|
||||
cc = '\0';
|
||||
}
|
||||
lastChar = cc;
|
||||
done:
|
||||
return (cc);
|
||||
}
|
||||
|
||||
|
||||
static int (*raw_kbd_getc) __P((dev_t dev)) = NULL;
|
||||
static dev_t lk_in_dev = NODEV;
|
||||
|
||||
/*
|
||||
* Divert input from a serial port to the lk-201 keyboard handler.
|
||||
*/
|
||||
void
|
||||
lk_divert(getfn, in_dev)
|
||||
int (*getfn) __P ((dev_t dev)) ;
|
||||
dev_t in_dev;
|
||||
{
|
||||
raw_kbd_getc = getfn;
|
||||
lk_in_dev = in_dev;
|
||||
}
|
||||
|
||||
/*
|
||||
* Get an ASCII character off of the keyboard.
|
||||
* Simply pass the getc request onto the underlying
|
||||
* serial driver, and map the resulting LK-201 keycode to ASCII.
|
||||
* FIXME: this design can't handle cursor or keypad keys,
|
||||
* and should be thrown away and replaced with a stackable
|
||||
* "Bstreams"-style driver.
|
||||
*/
|
||||
int
|
||||
LKgetc(dev)
|
||||
dev_t dev; /* ignored */
|
||||
{
|
||||
register int c;
|
||||
|
||||
extern sccGetc();
|
||||
|
||||
#if 0
|
||||
/*XXX*/ printf("LK-201 getc 0x%x( [%d %d]) in_dev [%d %d]\n",
|
||||
raw_kbd_getc,
|
||||
major(dev), minor(dev),
|
||||
major(lk_in_dev), minor(lk_in_dev));
|
||||
#endif
|
||||
|
||||
if (raw_kbd_getc == NULL) {
|
||||
panic("Reading from LK-201 before keyboard driver diverted\n");
|
||||
return (-1);
|
||||
}
|
||||
|
||||
for (;;) {
|
||||
/* c = (*cn_tab.cn_kbdgetc)(cn_tab.cn_dev); */
|
||||
c = (*raw_kbd_getc) (lk_in_dev);
|
||||
#if 0
|
||||
/*XXX*/ printf(" 0x%x [%c]", c, c);
|
||||
#endif
|
||||
if (c == 0)
|
||||
return (-1);
|
||||
if ((c = kbdMapChar(c & 0xff)) >= 0)
|
||||
break;
|
||||
}
|
||||
return (c);
|
||||
}
|
142
sys/arch/pmax/dev/lk201.h
Normal file
142
sys/arch/pmax/dev/lk201.h
Normal file
@ -0,0 +1,142 @@
|
||||
|
||||
/*
|
||||
* Ascii values of command keys.
|
||||
*/
|
||||
#define KBD_TAB '\t'
|
||||
#define KBD_DEL 127
|
||||
#define KBD_RET '\r'
|
||||
|
||||
/*
|
||||
* Define "hardware-independent" codes for the control, shift, meta and
|
||||
* function keys. Codes start after the last 7-bit ASCII code (127)
|
||||
* and are assigned in an arbitrary order.
|
||||
*/
|
||||
#define KBD_NOKEY 128
|
||||
|
||||
#define KBD_F1 201
|
||||
#define KBD_F2 202
|
||||
#define KBD_F3 203
|
||||
#define KBD_F4 204
|
||||
#define KBD_F5 205
|
||||
#define KBD_F6 206
|
||||
#define KBD_F7 207
|
||||
#define KBD_F8 208
|
||||
#define KBD_F9 209
|
||||
#define KBD_F10 210
|
||||
#define KBD_F11 211
|
||||
#define KBD_F12 212
|
||||
#define KBD_F13 213
|
||||
#define KBD_F14 214
|
||||
#define KBD_HELP 215
|
||||
#define KBD_DO 216
|
||||
#define KBD_F17 217
|
||||
#define KBD_F18 218
|
||||
#define KBD_F19 219
|
||||
#define KBD_F20 220
|
||||
|
||||
#define KBD_FIND 221
|
||||
#define KBD_INSERT 222
|
||||
#define KBD_REMOVE 223
|
||||
#define KBD_SELECT 224
|
||||
#define KBD_PREVIOUS 225
|
||||
#define KBD_NEXT 226
|
||||
|
||||
#define KBD_KP_ENTER 227
|
||||
#define KBD_KP_F1 228
|
||||
#define KBD_KP_F2 229
|
||||
#define KBD_KP_F3 230
|
||||
#define KBD_KP_F4 231
|
||||
#define KBD_LEFT 232
|
||||
#define KBD_RIGHT 233
|
||||
#define KBD_DOWN 234
|
||||
#define KBD_UP 235
|
||||
|
||||
#define KBD_CONTROL 236
|
||||
#define KBD_SHIFT 237
|
||||
#define KBD_CAPSLOCK 238
|
||||
#define KBD_ALTERNATE 239
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Definitions for the Keyboard and mouse.
|
||||
*/
|
||||
/*
|
||||
* Special key values.
|
||||
*/
|
||||
#define KEY_R_SHIFT 0xab
|
||||
#define KEY_SHIFT 0xae
|
||||
#define KEY_CONTROL 0xaf
|
||||
#define KEY_R_ALT 0xb2
|
||||
#define KEY_UP 0xb3
|
||||
#define KEY_REPEAT 0xb4
|
||||
#define KEY_F1 0x56
|
||||
#define KEY_COMMAND KEY_F1
|
||||
|
||||
/*
|
||||
* Lk201/301 keyboard
|
||||
*/
|
||||
#define LK_UPDOWN 0x86 /* bits for setting lk201 modes */
|
||||
#define LK_AUTODOWN 0x82
|
||||
#define LK_DOWN 0x80
|
||||
#define LK_DEFAULTS 0xd3 /* reset mode settings */
|
||||
#define LK_AR_ENABLE 0xe3 /* global auto repeat enable */
|
||||
#define LK_CL_ENABLE 0x1b /* keyclick enable */
|
||||
#define LK_KBD_ENABLE 0x8b /* keyboard enable */
|
||||
#define LK_BELL_ENABLE 0x23 /* the bell */
|
||||
#define LK_LED_ENABLE 0x13 /* light led */
|
||||
#define LK_LED_DISABLE 0x11 /* turn off led */
|
||||
#define LK_RING_BELL 0xa7 /* ring keyboard bell */
|
||||
#define LED_1 0x81 /* led bits */
|
||||
#define LED_2 0x82
|
||||
#define LED_3 0x84
|
||||
#define LED_4 0x88
|
||||
#define LED_ALL 0x8f
|
||||
#define LK_HELP 0x7c /* help key */
|
||||
#define LK_DO 0x7d /* do key */
|
||||
#define LK_KDOWN_ERROR 0x3d /* key down on powerup error */
|
||||
#define LK_POWER_ERROR 0x3e /* keyboard failure on pwrup tst*/
|
||||
#define LK_OUTPUT_ERROR 0xb5 /* keystrokes lost during inhbt */
|
||||
#define LK_INPUT_ERROR 0xb6 /* garbage command to keyboard */
|
||||
#define LK_LOWEST 0x56 /* lowest significant keycode */
|
||||
|
||||
/* max volume is 0, lowest is 0x7 */
|
||||
#define LK_PARAM_VOLUME(v) (0x80|((v)&0x7))
|
||||
|
||||
/* mode command details */
|
||||
#define LK_CMD_MODE(m,div) ((m)|((div)<<3))
|
||||
|
||||
|
||||
/*
|
||||
* Command characters for the mouse.
|
||||
*/
|
||||
#define MOUSE_SELF_TEST 'T'
|
||||
#define MOUSE_INCREMENTAL 'R'
|
||||
|
||||
/*
|
||||
* Mouse output bits.
|
||||
*
|
||||
* MOUSE_START_FRAME Start of report frame bit.
|
||||
* MOUSE_X_SIGN Sign bit for X.
|
||||
* MOUSE_Y_SIGN Sign bit for Y.
|
||||
* MOUSE_X_OFFSET X offset to start cursor at.
|
||||
* MOUSE_Y_OFFSET Y offset to start cursor at.
|
||||
*/
|
||||
#define MOUSE_START_FRAME 0x80
|
||||
#define MOUSE_X_SIGN 0x10
|
||||
#define MOUSE_Y_SIGN 0x08
|
||||
|
||||
/*
|
||||
* Definitions for mouse buttons
|
||||
*/
|
||||
#define EVENT_LEFT_BUTTON 0x01
|
||||
#define EVENT_MIDDLE_BUTTON 0x02
|
||||
#define EVENT_RIGHT_BUTTON 0x03
|
||||
#define RIGHT_BUTTON 0x01
|
||||
#define MIDDLE_BUTTON 0x02
|
||||
#define LEFT_BUTTON 0x04
|
||||
|
||||
#ifdef _KERNEL
|
||||
extern int LKgetc __P((dev_t dev));
|
||||
extern void lkdivert __P (( int (*getc_fn) __P ((dev_t dev)), dev_t dev));
|
||||
#endif
|
142
sys/dev/dec/lk201.h
Normal file
142
sys/dev/dec/lk201.h
Normal file
@ -0,0 +1,142 @@
|
||||
|
||||
/*
|
||||
* Ascii values of command keys.
|
||||
*/
|
||||
#define KBD_TAB '\t'
|
||||
#define KBD_DEL 127
|
||||
#define KBD_RET '\r'
|
||||
|
||||
/*
|
||||
* Define "hardware-independent" codes for the control, shift, meta and
|
||||
* function keys. Codes start after the last 7-bit ASCII code (127)
|
||||
* and are assigned in an arbitrary order.
|
||||
*/
|
||||
#define KBD_NOKEY 128
|
||||
|
||||
#define KBD_F1 201
|
||||
#define KBD_F2 202
|
||||
#define KBD_F3 203
|
||||
#define KBD_F4 204
|
||||
#define KBD_F5 205
|
||||
#define KBD_F6 206
|
||||
#define KBD_F7 207
|
||||
#define KBD_F8 208
|
||||
#define KBD_F9 209
|
||||
#define KBD_F10 210
|
||||
#define KBD_F11 211
|
||||
#define KBD_F12 212
|
||||
#define KBD_F13 213
|
||||
#define KBD_F14 214
|
||||
#define KBD_HELP 215
|
||||
#define KBD_DO 216
|
||||
#define KBD_F17 217
|
||||
#define KBD_F18 218
|
||||
#define KBD_F19 219
|
||||
#define KBD_F20 220
|
||||
|
||||
#define KBD_FIND 221
|
||||
#define KBD_INSERT 222
|
||||
#define KBD_REMOVE 223
|
||||
#define KBD_SELECT 224
|
||||
#define KBD_PREVIOUS 225
|
||||
#define KBD_NEXT 226
|
||||
|
||||
#define KBD_KP_ENTER 227
|
||||
#define KBD_KP_F1 228
|
||||
#define KBD_KP_F2 229
|
||||
#define KBD_KP_F3 230
|
||||
#define KBD_KP_F4 231
|
||||
#define KBD_LEFT 232
|
||||
#define KBD_RIGHT 233
|
||||
#define KBD_DOWN 234
|
||||
#define KBD_UP 235
|
||||
|
||||
#define KBD_CONTROL 236
|
||||
#define KBD_SHIFT 237
|
||||
#define KBD_CAPSLOCK 238
|
||||
#define KBD_ALTERNATE 239
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Definitions for the Keyboard and mouse.
|
||||
*/
|
||||
/*
|
||||
* Special key values.
|
||||
*/
|
||||
#define KEY_R_SHIFT 0xab
|
||||
#define KEY_SHIFT 0xae
|
||||
#define KEY_CONTROL 0xaf
|
||||
#define KEY_R_ALT 0xb2
|
||||
#define KEY_UP 0xb3
|
||||
#define KEY_REPEAT 0xb4
|
||||
#define KEY_F1 0x56
|
||||
#define KEY_COMMAND KEY_F1
|
||||
|
||||
/*
|
||||
* Lk201/301 keyboard
|
||||
*/
|
||||
#define LK_UPDOWN 0x86 /* bits for setting lk201 modes */
|
||||
#define LK_AUTODOWN 0x82
|
||||
#define LK_DOWN 0x80
|
||||
#define LK_DEFAULTS 0xd3 /* reset mode settings */
|
||||
#define LK_AR_ENABLE 0xe3 /* global auto repeat enable */
|
||||
#define LK_CL_ENABLE 0x1b /* keyclick enable */
|
||||
#define LK_KBD_ENABLE 0x8b /* keyboard enable */
|
||||
#define LK_BELL_ENABLE 0x23 /* the bell */
|
||||
#define LK_LED_ENABLE 0x13 /* light led */
|
||||
#define LK_LED_DISABLE 0x11 /* turn off led */
|
||||
#define LK_RING_BELL 0xa7 /* ring keyboard bell */
|
||||
#define LED_1 0x81 /* led bits */
|
||||
#define LED_2 0x82
|
||||
#define LED_3 0x84
|
||||
#define LED_4 0x88
|
||||
#define LED_ALL 0x8f
|
||||
#define LK_HELP 0x7c /* help key */
|
||||
#define LK_DO 0x7d /* do key */
|
||||
#define LK_KDOWN_ERROR 0x3d /* key down on powerup error */
|
||||
#define LK_POWER_ERROR 0x3e /* keyboard failure on pwrup tst*/
|
||||
#define LK_OUTPUT_ERROR 0xb5 /* keystrokes lost during inhbt */
|
||||
#define LK_INPUT_ERROR 0xb6 /* garbage command to keyboard */
|
||||
#define LK_LOWEST 0x56 /* lowest significant keycode */
|
||||
|
||||
/* max volume is 0, lowest is 0x7 */
|
||||
#define LK_PARAM_VOLUME(v) (0x80|((v)&0x7))
|
||||
|
||||
/* mode command details */
|
||||
#define LK_CMD_MODE(m,div) ((m)|((div)<<3))
|
||||
|
||||
|
||||
/*
|
||||
* Command characters for the mouse.
|
||||
*/
|
||||
#define MOUSE_SELF_TEST 'T'
|
||||
#define MOUSE_INCREMENTAL 'R'
|
||||
|
||||
/*
|
||||
* Mouse output bits.
|
||||
*
|
||||
* MOUSE_START_FRAME Start of report frame bit.
|
||||
* MOUSE_X_SIGN Sign bit for X.
|
||||
* MOUSE_Y_SIGN Sign bit for Y.
|
||||
* MOUSE_X_OFFSET X offset to start cursor at.
|
||||
* MOUSE_Y_OFFSET Y offset to start cursor at.
|
||||
*/
|
||||
#define MOUSE_START_FRAME 0x80
|
||||
#define MOUSE_X_SIGN 0x10
|
||||
#define MOUSE_Y_SIGN 0x08
|
||||
|
||||
/*
|
||||
* Definitions for mouse buttons
|
||||
*/
|
||||
#define EVENT_LEFT_BUTTON 0x01
|
||||
#define EVENT_MIDDLE_BUTTON 0x02
|
||||
#define EVENT_RIGHT_BUTTON 0x03
|
||||
#define RIGHT_BUTTON 0x01
|
||||
#define MIDDLE_BUTTON 0x02
|
||||
#define LEFT_BUTTON 0x04
|
||||
|
||||
#ifdef _KERNEL
|
||||
extern int LKgetc __P((dev_t dev));
|
||||
extern void lkdivert __P (( int (*getc_fn) __P ((dev_t dev)), dev_t dev));
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user