mirror of
https://git.rtems.org/rtems-libbsd/
synced 2025-06-06 09:39:09 +08:00
Add FREEBSD keyboard driver files
This commit is contained in:
parent
67de3b57f4
commit
41d2784207
1477
freebsd/sys/dev/kbd/kbd.c
Normal file
1477
freebsd/sys/dev/kbd/kbd.c
Normal file
File diff suppressed because it is too large
Load Diff
307
freebsd/sys/dev/kbd/kbdreg.h
Normal file
307
freebsd/sys/dev/kbd/kbdreg.h
Normal file
@ -0,0 +1,307 @@
|
||||
/*-
|
||||
* Copyright (c) 1999 Kazutaka YOKOTA <yokota@zodiac.mech.utsunomiya-u.ac.jp>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer as
|
||||
* the first lines of this file unmodified.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#ifndef _DEV_KBD_KBDREG_H_
|
||||
#define _DEV_KBD_KBDREG_H_
|
||||
|
||||
/* forward declarations */
|
||||
typedef struct keyboard keyboard_t;
|
||||
struct keymap;
|
||||
struct accentmap;
|
||||
struct fkeytab;
|
||||
struct cdevsw;
|
||||
|
||||
/* call back funcion */
|
||||
typedef int kbd_callback_func_t(keyboard_t *kbd, int event,
|
||||
void *arg);
|
||||
/* event types */
|
||||
#define KBDIO_KEYINPUT 0
|
||||
#define KBDIO_UNLOADING 1
|
||||
|
||||
typedef struct keyboard_callback {
|
||||
kbd_callback_func_t *kc_func;
|
||||
void *kc_arg;
|
||||
} keyboard_callback_t;
|
||||
|
||||
/* keyboard */
|
||||
struct keyboard {
|
||||
/* the following fields are managed by kbdio */
|
||||
int kb_index; /* kbdio index# */
|
||||
int kb_minor; /* minor number of the sub-device */
|
||||
int kb_flags; /* internal flags */
|
||||
#define KB_VALID (1 << 16) /* this entry is valid */
|
||||
#define KB_NO_DEVICE (1 << 17) /* device not present */
|
||||
#define KB_PROBED (1 << 18) /* device probed */
|
||||
#define KB_INITIALIZED (1 << 19) /* device initialized */
|
||||
#define KB_REGISTERED (1 << 20) /* device registered to kbdio */
|
||||
#define KB_BUSY (1 << 21) /* device used by a client */
|
||||
#define KB_POLLED (1 << 22) /* device is polled */
|
||||
int kb_active; /* 0: inactive */
|
||||
void *kb_token; /* id of the current client */
|
||||
keyboard_callback_t kb_callback;/* callback function */
|
||||
|
||||
/*
|
||||
* Device configuration flags:
|
||||
* The upper 16 bits are common between various keyboard devices.
|
||||
* The lower 16 bits are device-specific.
|
||||
*/
|
||||
int kb_config;
|
||||
#define KB_CONF_PROBE_ONLY (1 << 16) /* probe only, don't initialize */
|
||||
|
||||
/* the following fields are set up by the driver */
|
||||
char *kb_name; /* driver name */
|
||||
int kb_unit; /* unit # */
|
||||
int kb_type; /* KB_84, KB_101, KB_OTHER,... */
|
||||
int kb_io_base; /* port# if any */
|
||||
int kb_io_size; /* # of occupied port */
|
||||
int kb_led; /* LED status */
|
||||
struct keymap *kb_keymap; /* key map */
|
||||
struct accentmap *kb_accentmap; /* accent map */
|
||||
struct fkeytab *kb_fkeytab; /* function key strings */
|
||||
int kb_fkeytab_size;/* # of function key strings */
|
||||
void *kb_data; /* the driver's private data */
|
||||
int kb_delay1;
|
||||
int kb_delay2;
|
||||
#define KB_DELAY1 500
|
||||
#define KB_DELAY2 100
|
||||
unsigned long kb_count; /* # of processed key strokes */
|
||||
u_char kb_lastact[NUM_KEYS/2];
|
||||
struct cdev *kb_dev;
|
||||
};
|
||||
|
||||
#define KBD_IS_VALID(k) ((k)->kb_flags & KB_VALID)
|
||||
#define KBD_VALID(k) ((k)->kb_flags |= KB_VALID)
|
||||
#define KBD_INVALID(k) ((k)->kb_flags &= ~KB_VALID)
|
||||
#define KBD_HAS_DEVICE(k) (!((k)->kb_flags & KB_NO_DEVICE))
|
||||
#define KBD_FOUND_DEVICE(k) ((k)->kb_flags &= ~KB_NO_DEVICE)
|
||||
#define KBD_IS_PROBED(k) ((k)->kb_flags & KB_PROBED)
|
||||
#define KBD_PROBE_DONE(k) ((k)->kb_flags |= KB_PROBED)
|
||||
#define KBD_IS_INITIALIZED(k) ((k)->kb_flags & KB_INITIALIZED)
|
||||
#define KBD_INIT_DONE(k) ((k)->kb_flags |= KB_INITIALIZED)
|
||||
#define KBD_IS_CONFIGURED(k) ((k)->kb_flags & KB_REGISTERED)
|
||||
#define KBD_CONFIG_DONE(k) ((k)->kb_flags |= KB_REGISTERED)
|
||||
#define KBD_IS_BUSY(k) ((k)->kb_flags & KB_BUSY)
|
||||
#define KBD_BUSY(k) ((k)->kb_flags |= KB_BUSY)
|
||||
#define KBD_UNBUSY(k) ((k)->kb_flags &= ~KB_BUSY)
|
||||
#define KBD_IS_POLLED(k) ((k)->kb_flags & KB_POLLED)
|
||||
#define KBD_POLL(k) ((k)->kb_flags |= KB_POLLED)
|
||||
#define KBD_UNPOLL(k) ((k)->kb_flags &= ~KB_POLLED)
|
||||
#define KBD_IS_ACTIVE(k) ((k)->kb_active)
|
||||
#define KBD_ACTIVATE(k) (++(k)->kb_active)
|
||||
#define KBD_DEACTIVATE(k) (--(k)->kb_active)
|
||||
#define KBD_LED_VAL(k) ((k)->kb_led)
|
||||
|
||||
/* keyboard function table */
|
||||
typedef int kbd_probe_t(int unit, void *arg, int flags);
|
||||
typedef int kbd_init_t(int unit, keyboard_t **kbdp, void *arg,
|
||||
int flags);
|
||||
typedef int kbd_term_t(keyboard_t *kbd);
|
||||
typedef int kbd_intr_t(keyboard_t *kbd, void *arg);
|
||||
typedef int kbd_test_if_t(keyboard_t *kbd);
|
||||
typedef int kbd_enable_t(keyboard_t *kbd);
|
||||
typedef int kbd_disable_t(keyboard_t *kbd);
|
||||
typedef int kbd_read_t(keyboard_t *kbd, int wait);
|
||||
typedef int kbd_check_t(keyboard_t *kbd);
|
||||
typedef u_int kbd_read_char_t(keyboard_t *kbd, int wait);
|
||||
typedef int kbd_check_char_t(keyboard_t *kbd);
|
||||
typedef int kbd_ioctl_t(keyboard_t *kbd, u_long cmd, caddr_t data);
|
||||
typedef int kbd_lock_t(keyboard_t *kbd, int lock);
|
||||
typedef void kbd_clear_state_t(keyboard_t *kbd);
|
||||
typedef int kbd_get_state_t(keyboard_t *kbd, void *buf, size_t len);
|
||||
typedef int kbd_set_state_t(keyboard_t *kbd, void *buf, size_t len);
|
||||
typedef u_char *kbd_get_fkeystr_t(keyboard_t *kbd, int fkey,
|
||||
size_t *len);
|
||||
typedef int kbd_poll_mode_t(keyboard_t *kbd, int on);
|
||||
typedef void kbd_diag_t(keyboard_t *kbd, int level);
|
||||
|
||||
typedef struct keyboard_switch {
|
||||
kbd_probe_t *probe;
|
||||
kbd_init_t *init;
|
||||
kbd_term_t *term;
|
||||
kbd_intr_t *intr;
|
||||
kbd_test_if_t *test_if;
|
||||
kbd_enable_t *enable;
|
||||
kbd_disable_t *disable;
|
||||
kbd_read_t *read;
|
||||
kbd_check_t *check;
|
||||
kbd_read_char_t *read_char;
|
||||
kbd_check_char_t *check_char;
|
||||
kbd_ioctl_t *ioctl;
|
||||
kbd_lock_t *lock;
|
||||
kbd_clear_state_t *clear_state;
|
||||
kbd_get_state_t *get_state;
|
||||
kbd_set_state_t *set_state;
|
||||
kbd_get_fkeystr_t *get_fkeystr;
|
||||
kbd_poll_mode_t *poll;
|
||||
kbd_diag_t *diag;
|
||||
} keyboard_switch_t;
|
||||
|
||||
/*
|
||||
* Keyboard disciplines: call actual handlers via kbdsw[].
|
||||
*/
|
||||
#define kbdd_probe(kbd, unit, arg, flags) \
|
||||
(*kbdsw[(kbd)->kb_index]->probe)((unit), (arg), (flags))
|
||||
#define kbdd_init(kbd, unit, kbdpp, arg, flags) \
|
||||
(*kbdsw[(kbd)->kb_index]->init)((unit), (kbdpp), (arg), (flags))
|
||||
#define kbdd_term(kbd) \
|
||||
(*kbdsw[(kbd)->kb_index]->term)((kbd))
|
||||
#define kbdd_intr(kbd, arg) \
|
||||
(*kbdsw[(kbd)->kb_index]->intr)((kbd), (arg))
|
||||
#define kbdd_test_if(kbd) \
|
||||
(*kbdsw[(kbd)->kb_index]->test_if)((kbd))
|
||||
#define kbdd_enable(kbd) \
|
||||
(*kbdsw[(kbd)->kb_index]->enable)((kbd))
|
||||
#define kbdd_disable(kbd) \
|
||||
(*kbdsw[(kbd)->kb_index]->disable)((kbd))
|
||||
#define kbdd_read(kbd, wait) \
|
||||
(*kbdsw[(kbd)->kb_index]->read)((kbd), (wait))
|
||||
#define kbdd_check(kbd) \
|
||||
(*kbdsw[(kbd)->kb_index]->check)((kbd))
|
||||
#define kbdd_read_char(kbd, wait) \
|
||||
(*kbdsw[(kbd)->kb_index]->read_char)((kbd), (wait))
|
||||
#define kbdd_check_char(kbd) \
|
||||
(*kbdsw[(kbd)->kb_index]->check_char)((kbd))
|
||||
#define kbdd_ioctl(kbd, cmd, arg) \
|
||||
(((kbd) == NULL) ? \
|
||||
ENODEV : \
|
||||
(*kbdsw[(kbd)->kb_index]->ioctl)((kbd), (cmd), (arg)))
|
||||
#define kbdd_lock(kbd, lockf) \
|
||||
(*kbdsw[(kbd)->kb_index]->lock)((kbd), (lockf))
|
||||
#define kbdd_clear_state(kbd) \
|
||||
(*kbdsw[(kbd)->kb_index]->clear_state)((kbd))
|
||||
#define kbdd_get_state(kbd, buf, len) \
|
||||
(*kbdsw[(kbd)->kb_index]->get_state)((kbd), (buf), (len))
|
||||
#define kbdd_set_state(kbd, buf, len) \
|
||||
(*kbdsw[(kbd)->kb_index]->set_state)((kbd), (buf), (len))
|
||||
#define kbdd_get_fkeystr(kbd, fkey, len) \
|
||||
(*kbdsw[(kbd)->kb_index]->get_fkeystr)((kbd), (fkey), (len))
|
||||
#define kbdd_poll(kbd, on) \
|
||||
(*kbdsw[(kbd)->kb_index]->poll)((kbd), (on))
|
||||
#define kbdd_diag(kbd, level) \
|
||||
(*kbdsw[(kbd)->kb_index]->diag)((kbd), (leve))
|
||||
|
||||
/* keyboard driver */
|
||||
typedef struct keyboard_driver {
|
||||
SLIST_ENTRY(keyboard_driver) link;
|
||||
char *name;
|
||||
keyboard_switch_t *kbdsw;
|
||||
int (*configure)(int); /* backdoor for the console driver */
|
||||
} keyboard_driver_t;
|
||||
|
||||
#ifdef _KERNEL
|
||||
|
||||
#define KEYBOARD_DRIVER(name, sw, config) \
|
||||
static struct keyboard_driver name##_kbd_driver = { \
|
||||
{ NULL }, #name, &sw, config \
|
||||
}; \
|
||||
DATA_SET(kbddriver_set, name##_kbd_driver);
|
||||
|
||||
/* global variables */
|
||||
extern keyboard_switch_t **kbdsw;
|
||||
|
||||
/* functions for the keyboard driver */
|
||||
int kbd_add_driver(keyboard_driver_t *driver);
|
||||
int kbd_delete_driver(keyboard_driver_t *driver);
|
||||
int kbd_register(keyboard_t *kbd);
|
||||
int kbd_unregister(keyboard_t *kbd);
|
||||
keyboard_switch_t *kbd_get_switch(char *driver);
|
||||
void kbd_init_struct(keyboard_t *kbd, char *name, int type,
|
||||
int unit, int config, int port,
|
||||
int port_size);
|
||||
void kbd_set_maps(keyboard_t *kbd, struct keymap *keymap,
|
||||
struct accentmap *accmap,
|
||||
struct fkeytab *fkeymap, int fkeymap_size);
|
||||
|
||||
/* functions for the keyboard client */
|
||||
int kbd_allocate(char *driver, int unit, void *id,
|
||||
kbd_callback_func_t *func, void *arg);
|
||||
int kbd_release(keyboard_t *kbd, void *id);
|
||||
int kbd_change_callback(keyboard_t *kbd, void *id,
|
||||
kbd_callback_func_t *func, void *arg);
|
||||
int kbd_find_keyboard(char *driver, int unit);
|
||||
int kbd_find_keyboard2(char *driver, int unit, int index);
|
||||
keyboard_t *kbd_get_keyboard(int index);
|
||||
|
||||
/* a back door for the console driver to tickle the keyboard driver XXX */
|
||||
int kbd_configure(int flags);
|
||||
/* see `kb_config' above for flag bit definitions */
|
||||
|
||||
#ifdef KBD_INSTALL_CDEV
|
||||
|
||||
/* virtual keyboard cdev driver functions */
|
||||
int kbd_attach(keyboard_t *kbd);
|
||||
int kbd_detach(keyboard_t *kbd);
|
||||
|
||||
#endif /* KBD_INSTALL_CDEV */
|
||||
|
||||
/* generic low-level keyboard functions */
|
||||
|
||||
/* shift key state */
|
||||
#define SHIFTS1 (1 << 16)
|
||||
#define SHIFTS2 (1 << 17)
|
||||
#define SHIFTS (SHIFTS1 | SHIFTS2)
|
||||
#define CTLS1 (1 << 18)
|
||||
#define CTLS2 (1 << 19)
|
||||
#define CTLS (CTLS1 | CTLS2)
|
||||
#define ALTS1 (1 << 20)
|
||||
#define ALTS2 (1 << 21)
|
||||
#define ALTS (ALTS1 | ALTS2)
|
||||
#define AGRS1 (1 << 22)
|
||||
#define AGRS2 (1 << 23)
|
||||
#define AGRS (AGRS1 | AGRS2)
|
||||
#define METAS1 (1 << 24)
|
||||
#define METAS2 (1 << 25)
|
||||
#define METAS (METAS1 | METAS2)
|
||||
#define NLKDOWN (1 << 26)
|
||||
#define SLKDOWN (1 << 27)
|
||||
#define CLKDOWN (1 << 28)
|
||||
#define ALKDOWN (1 << 29)
|
||||
#define SHIFTAON (1 << 30)
|
||||
/* lock key state (defined in sys/kbio.h) */
|
||||
/*
|
||||
#define CLKED LED_CAP
|
||||
#define NLKED LED_NUM
|
||||
#define SLKED LED_SCR
|
||||
#define ALKED (1 << 3)
|
||||
#define LOCK_MASK (CLKED | NLKED | SLKED | ALKED)
|
||||
#define LED_CAP (1 << 0)
|
||||
#define LED_NUM (1 << 1)
|
||||
#define LED_SCR (1 << 2)
|
||||
#define LED_MASK (LED_CAP | LED_NUM | LED_SCR)
|
||||
*/
|
||||
|
||||
kbd_get_fkeystr_t genkbd_get_fkeystr;
|
||||
kbd_diag_t genkbd_diag;
|
||||
|
||||
int genkbd_commonioctl(keyboard_t *kbd, u_long cmd, caddr_t arg);
|
||||
int genkbd_keyaction(keyboard_t *kbd, int keycode, int up,
|
||||
int *shiftstate, int *accents);
|
||||
|
||||
#endif /* _KERNEL */
|
||||
|
||||
#endif /* !_DEV_KBD_KBDREG_H_ */
|
238
freebsd/sys/dev/kbd/kbdtables.h
Normal file
238
freebsd/sys/dev/kbd/kbdtables.h
Normal file
@ -0,0 +1,238 @@
|
||||
/*-
|
||||
* Copyright (c) 1992-1998 Sen Schmidt
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer,
|
||||
* without modification, immediately at the beginning of the file.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#ifndef KBD_DFLT_KEYMAP
|
||||
|
||||
/* US iso8859 */
|
||||
#define ISO_ACCENTCHARS
|
||||
/*
|
||||
* Automatically generated from /usr/share/syscons/keymaps/us.iso.kbd.
|
||||
* DO NOT EDIT!
|
||||
*/
|
||||
static keymap_t key_map = { 0x6d, {
|
||||
/* alt
|
||||
* scan cntrl alt alt cntrl
|
||||
* code base shift cntrl shift alt shift cntrl shift spcl flgs
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
/*00*/{{ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, }, 0xFF,0x00 },
|
||||
/*01*/{{ 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, DBG, 0x1B, }, 0x02,0x00 },
|
||||
/*02*/{{ '1', '!', NOP, NOP, '1', '!', NOP, NOP, }, 0x33,0x00 },
|
||||
/*03*/{{ '2', '@', 0x00, 0x00, '2', '@', 0x00, 0x00, }, 0x00,0x00 },
|
||||
/*04*/{{ '3', '#', NOP, NOP, '3', '#', NOP, NOP, }, 0x33,0x00 },
|
||||
/*05*/{{ '4', '$', NOP, NOP, '4', '$', NOP, NOP, }, 0x33,0x00 },
|
||||
/*06*/{{ '5', '%', NOP, NOP, '5', '%', NOP, NOP, }, 0x33,0x00 },
|
||||
/*07*/{{ '6', '^', 0x1E, 0x1E, '6', '^', 0x1E, 0x1E, }, 0x00,0x00 },
|
||||
/*08*/{{ '7', '&', NOP, NOP, '7', '&', NOP, NOP, }, 0x33,0x00 },
|
||||
/*09*/{{ '8', '*', NOP, NOP, '8', '*', NOP, NOP, }, 0x33,0x00 },
|
||||
/*0a*/{{ '9', '(', NOP, NOP, '9', '(', NOP, NOP, }, 0x33,0x00 },
|
||||
/*0b*/{{ '0', ')', NOP, NOP, '0', ')', NOP, NOP, }, 0x33,0x00 },
|
||||
/*0c*/{{ '-', '_', 0x1F, 0x1F, '-', '_', 0x1F, 0x1F, }, 0x00,0x00 },
|
||||
/*0d*/{{ '=', '+', NOP, NOP, '=', '+', NOP, NOP, }, 0x33,0x00 },
|
||||
/*0e*/{{ 0x08, 0x08, 0x7F, 0x7F, 0x08, 0x08, 0x7F, 0x7F, }, 0x00,0x00 },
|
||||
/*0f*/{{ 0x09, BTAB, NOP, NOP, 0x09, BTAB, NOP, NOP, }, 0x77,0x00 },
|
||||
/*10*/{{ 'q', 'Q', 0x11, 0x11, 'q', 'Q', 0x11, 0x11, }, 0x00,0x01 },
|
||||
/*11*/{{ 'w', 'W', 0x17, 0x17, 'w', 'W', 0x17, 0x17, }, 0x00,0x01 },
|
||||
/*12*/{{ 'e', 'E', 0x05, 0x05, 'e', 'E', 0x05, 0x05, }, 0x00,0x01 },
|
||||
/*13*/{{ 'r', 'R', 0x12, 0x12, 'r', 'R', 0x12, 0x12, }, 0x00,0x01 },
|
||||
/*14*/{{ 't', 'T', 0x14, 0x14, 't', 'T', 0x14, 0x14, }, 0x00,0x01 },
|
||||
/*15*/{{ 'y', 'Y', 0x19, 0x19, 'y', 'Y', 0x19, 0x19, }, 0x00,0x01 },
|
||||
/*16*/{{ 'u', 'U', 0x15, 0x15, 'u', 'U', 0x15, 0x15, }, 0x00,0x01 },
|
||||
/*17*/{{ 'i', 'I', 0x09, 0x09, 'i', 'I', 0x09, 0x09, }, 0x00,0x01 },
|
||||
/*18*/{{ 'o', 'O', 0x0F, 0x0F, 'o', 'O', 0x0F, 0x0F, }, 0x00,0x01 },
|
||||
/*19*/{{ 'p', 'P', 0x10, 0x10, 'p', 'P', 0x10, 0x10, }, 0x00,0x01 },
|
||||
/*1a*/{{ '[', '{', 0x1B, 0x1B, '[', '{', 0x1B, 0x1B, }, 0x00,0x00 },
|
||||
/*1b*/{{ ']', '}', 0x1D, 0x1D, ']', '}', 0x1D, 0x1D, }, 0x00,0x00 },
|
||||
/*1c*/{{ 0x0D, 0x0D, 0x0A, 0x0A, 0x0D, 0x0D, 0x0A, 0x0A, }, 0x00,0x00 },
|
||||
/*1d*/{{ LCTR, LCTR, LCTR, LCTR, LCTR, LCTR, LCTR, LCTR, }, 0xFF,0x00 },
|
||||
/*1e*/{{ 'a', 'A', 0x01, 0x01, 'a', 'A', 0x01, 0x01, }, 0x00,0x01 },
|
||||
/*1f*/{{ 's', 'S', 0x13, 0x13, 's', 'S', 0x13, 0x13, }, 0x00,0x01 },
|
||||
/*20*/{{ 'd', 'D', 0x04, 0x04, 'd', 'D', 0x04, 0x04, }, 0x00,0x01 },
|
||||
/*21*/{{ 'f', 'F', 0x06, 0x06, 'f', 'F', 0x06, 0x06, }, 0x00,0x01 },
|
||||
/*22*/{{ 'g', 'G', 0x07, 0x07, 'g', 'G', 0x07, 0x07, }, 0x00,0x01 },
|
||||
/*23*/{{ 'h', 'H', 0x08, 0x08, 'h', 'H', 0x08, 0x08, }, 0x00,0x01 },
|
||||
/*24*/{{ 'j', 'J', 0x0A, 0x0A, 'j', 'J', 0x0A, 0x0A, }, 0x00,0x01 },
|
||||
/*25*/{{ 'k', 'K', 0x0B, 0x0B, 'k', 'K', 0x0B, 0x0B, }, 0x00,0x01 },
|
||||
/*26*/{{ 'l', 'L', 0x0C, 0x0C, 'l', 'L', 0x0C, 0x0C, }, 0x00,0x01 },
|
||||
/*27*/{{ ';', ':', NOP, NOP, ';', ':', NOP, NOP, }, 0x33,0x00 },
|
||||
/*28*/{{ '\'', '"', NOP, NOP, '\'', '"', NOP, NOP, }, 0x33,0x00 },
|
||||
/*29*/{{ '`', '~', NOP, NOP, '`', '~', NOP, NOP, }, 0x33,0x00 },
|
||||
/*2a*/{{ LSH, LSH, LSH, LSH, LSH, LSH, LSH, LSH, }, 0xFF,0x00 },
|
||||
/*2b*/{{ '\\', '|', 0x1C, 0x1C, '\\', '|', 0x1C, 0x1C, }, 0x00,0x00 },
|
||||
/*2c*/{{ 'z', 'Z', 0x1A, 0x1A, 'z', 'Z', 0x1A, 0x1A, }, 0x00,0x01 },
|
||||
/*2d*/{{ 'x', 'X', 0x18, 0x18, 'x', 'X', 0x18, 0x18, }, 0x00,0x01 },
|
||||
/*2e*/{{ 'c', 'C', 0x03, 0x03, 'c', 'C', 0x03, 0x03, }, 0x00,0x01 },
|
||||
/*2f*/{{ 'v', 'V', 0x16, 0x16, 'v', 'V', 0x16, 0x16, }, 0x00,0x01 },
|
||||
/*30*/{{ 'b', 'B', 0x02, 0x02, 'b', 'B', 0x02, 0x02, }, 0x00,0x01 },
|
||||
/*31*/{{ 'n', 'N', 0x0E, 0x0E, 'n', 'N', 0x0E, 0x0E, }, 0x00,0x01 },
|
||||
/*32*/{{ 'm', 'M', 0x0D, 0x0D, 'm', 'M', 0x0D, 0x0D, }, 0x00,0x01 },
|
||||
/*33*/{{ ',', '<', NOP, NOP, ',', '<', NOP, NOP, }, 0x33,0x00 },
|
||||
/*34*/{{ '.', '>', NOP, NOP, '.', '>', NOP, NOP, }, 0x33,0x00 },
|
||||
/*35*/{{ '/', '?', NOP, NOP, '/', '?', NOP, NOP, }, 0x33,0x00 },
|
||||
/*36*/{{ RSH, RSH, RSH, RSH, RSH, RSH, RSH, RSH, }, 0xFF,0x00 },
|
||||
/*37*/{{ '*', '*', '*', '*', '*', '*', '*', '*', }, 0x00,0x00 },
|
||||
/*38*/{{ LALT, LALT, LALT, LALT, LALT, LALT, LALT, LALT, }, 0xFF,0x00 },
|
||||
/*39*/{{ ' ', ' ', 0x00, ' ', ' ', ' ', SUSP, ' ', }, 0x02,0x00 },
|
||||
/*3a*/{{ CLK, CLK, CLK, CLK, CLK, CLK, CLK, CLK, }, 0xFF,0x00 },
|
||||
/*3b*/{{ F( 1), F(13), F(25), F(37), S( 1), S(11), S( 1), S(11),}, 0xFF,0x00 },
|
||||
/*3c*/{{ F( 2), F(14), F(26), F(38), S( 2), S(12), S( 2), S(12),}, 0xFF,0x00 },
|
||||
/*3d*/{{ F( 3), F(15), F(27), F(39), S( 3), S(13), S( 3), S(13),}, 0xFF,0x00 },
|
||||
/*3e*/{{ F( 4), F(16), F(28), F(40), S( 4), S(14), S( 4), S(14),}, 0xFF,0x00 },
|
||||
/*3f*/{{ F( 5), F(17), F(29), F(41), S( 5), S(15), S( 5), S(15),}, 0xFF,0x00 },
|
||||
/*40*/{{ F( 6), F(18), F(30), F(42), S( 6), S(16), S( 6), S(16),}, 0xFF,0x00 },
|
||||
/*41*/{{ F( 7), F(19), F(31), F(43), S( 7), S( 7), S( 7), S( 7),}, 0xFF,0x00 },
|
||||
/*42*/{{ F( 8), F(20), F(32), F(44), S( 8), S( 8), S( 8), S( 8),}, 0xFF,0x00 },
|
||||
/*43*/{{ F( 9), F(21), F(33), F(45), S( 9), S( 9), S( 9), S( 9),}, 0xFF,0x00 },
|
||||
/*44*/{{ F(10), F(22), F(34), F(46), S(10), S(10), S(10), S(10),}, 0xFF,0x00 },
|
||||
/*45*/{{ NLK, NLK, NLK, NLK, NLK, NLK, NLK, NLK, }, 0xFF,0x00 },
|
||||
/*46*/{{ SLK, SLK, SLK, SLK, SLK, SLK, SLK, SLK, }, 0xFF,0x00 },
|
||||
/*47*/{{ F(49), '7', '7', '7', '7', '7', '7', '7', }, 0x80,0x02 },
|
||||
/*48*/{{ F(50), '8', '8', '8', '8', '8', '8', '8', }, 0x80,0x02 },
|
||||
/*49*/{{ F(51), '9', '9', '9', '9', '9', '9', '9', }, 0x80,0x02 },
|
||||
/*4a*/{{ F(52), '-', '-', '-', '-', '-', '-', '-', }, 0x80,0x02 },
|
||||
/*4b*/{{ F(53), '4', '4', '4', '4', '4', '4', '4', }, 0x80,0x02 },
|
||||
/*4c*/{{ F(54), '5', '5', '5', '5', '5', '5', '5', }, 0x80,0x02 },
|
||||
/*4d*/{{ F(55), '6', '6', '6', '6', '6', '6', '6', }, 0x80,0x02 },
|
||||
/*4e*/{{ F(56), '+', '+', '+', '+', '+', '+', '+', }, 0x80,0x02 },
|
||||
/*4f*/{{ F(57), '1', '1', '1', '1', '1', '1', '1', }, 0x80,0x02 },
|
||||
/*50*/{{ F(58), '2', '2', '2', '2', '2', '2', '2', }, 0x80,0x02 },
|
||||
/*51*/{{ F(59), '3', '3', '3', '3', '3', '3', '3', }, 0x80,0x02 },
|
||||
/*52*/{{ F(60), '0', '0', '0', '0', '0', '0', '0', }, 0x80,0x02 },
|
||||
/*53*/{{ 0x7F, '.', '.', '.', '.', '.', RBT, RBT, }, 0x03,0x02 },
|
||||
/*54*/{{ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, }, 0xFF,0x00 },
|
||||
/*55*/{{ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, }, 0xFF,0x00 },
|
||||
/*56*/{{ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, }, 0xFF,0x00 },
|
||||
/*57*/{{ F(11), F(23), F(35), F(47), S(11), S(11), S(11), S(11),}, 0xFF,0x00 },
|
||||
/*58*/{{ F(12), F(24), F(36), F(48), S(12), S(12), S(12), S(12),}, 0xFF,0x00 },
|
||||
/*59*/{{ 0x0D, 0x0D, 0x0A, 0x0A, 0x0D, 0x0D, 0x0A, 0x0A, }, 0x00,0x00 },
|
||||
/*5a*/{{ RCTR, RCTR, RCTR, RCTR, RCTR, RCTR, RCTR, RCTR, }, 0xFF,0x00 },
|
||||
/*5b*/{{ '/', '/', '/', '/', '/', '/', '/', '/', }, 0x00,0x02 },
|
||||
/*5c*/{{ NEXT, PREV, DBG, DBG, NOP, NOP, NOP, NOP, }, 0xFF,0x00 },
|
||||
/*5d*/{{ RALT, RALT, RALT, RALT, RALT, RALT, RALT, RALT, }, 0xFF,0x00 },
|
||||
/*5e*/{{ F(49), F(49), F(49), F(49), F(49), F(49), F(49), F(49),}, 0xFF,0x00 },
|
||||
/*5f*/{{ F(50), F(50), F(50), F(50), F(50), F(50), F(50), F(50),}, 0xFF,0x00 },
|
||||
/*60*/{{ F(51), F(51), F(51), F(51), F(51), F(51), F(51), F(51),}, 0xFF,0x00 },
|
||||
/*61*/{{ F(53), F(53), F(53), F(53), F(53), F(53), F(53), F(53),}, 0xFF,0x00 },
|
||||
/*62*/{{ F(55), F(55), F(55), F(55), F(55), F(55), F(55), F(55),}, 0xFF,0x00 },
|
||||
/*63*/{{ F(57), F(57), F(57), F(57), F(57), F(57), F(57), F(57),}, 0xFF,0x00 },
|
||||
/*64*/{{ F(58), F(58), F(58), F(58), F(58), F(58), F(58), F(58),}, 0xFF,0x00 },
|
||||
/*65*/{{ F(59), F(59), F(59), F(59), F(59), F(59), F(59), F(59),}, 0xFF,0x00 },
|
||||
/*66*/{{ F(60),PASTE, F(60), F(60), F(60), F(60), F(60), F(60),}, 0xFF,0x00 },
|
||||
/*67*/{{ F(61), F(61), F(61), F(61), F(61), F(61), RBT, F(61),}, 0xFF,0x00 },
|
||||
/*68*/{{ SLK, SPSC, SLK, SPSC, SUSP, NOP, SUSP, NOP, }, 0xFF,0x00 },
|
||||
/*69*/{{ F(62), F(62), F(62), F(62), F(62), F(62), F(62), F(62),}, 0xFF,0x00 },
|
||||
/*6a*/{{ F(63), F(63), F(63), F(63), F(63), F(63), F(63), F(63),}, 0xFF,0x00 },
|
||||
/*6b*/{{ F(64), F(64), F(64), F(64), F(64), F(64), F(64), F(64),}, 0xFF,0x00 },
|
||||
/*6c*/{{ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, }, 0xFF,0x00 },
|
||||
} };
|
||||
|
||||
#if defined(NO_ACCENTCHARS)
|
||||
static accentmap_t accent_map = { 0, /* empty accent map */
|
||||
{
|
||||
{ 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 },
|
||||
{ 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 },
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
#if defined(ISO_ACCENTCHARS)
|
||||
static accentmap_t accent_map = { 15, /* iso8859 accent map */
|
||||
{
|
||||
/* dgra=0 */
|
||||
{ '`', { { 'a',0xe0 }, { 'A',0xc0 }, { 'e',0xe8 }, { 'E',0xc8 },
|
||||
{ 'i',0xec }, { 'I',0xcc }, { 'o',0xf2 }, { 'O',0xd2 },
|
||||
{ 'u',0xf9 }, { 'U',0xd9 }, }, },
|
||||
/* dacu=1 */
|
||||
{ 0xb4, { { 'a',0xe1 }, { 'A',0xc1 }, { 'e',0xe9 }, { 'E',0xc9 },
|
||||
{ 'i',0xed }, { 'I',0xcd }, { 'o',0xf3 }, { 'O',0xd3 },
|
||||
{ 'u',0xfa }, { 'U',0xda }, { 'y',0xfd }, { 'Y',0xdd }, }, },
|
||||
/* dcir=2 */
|
||||
{ '^', { { 'a',0xe2 }, { 'A',0xc2 }, { 'e',0xea }, { 'E',0xca },
|
||||
{ 'i',0xee }, { 'I',0xce }, { 'o',0xf4 }, { 'O',0xd4 },
|
||||
{ 'u',0xfb }, { 'U',0xdb }, }, },
|
||||
/* dtil=3 */
|
||||
{ '~', { { 'a',0xe3 }, { 'A',0xc3 }, { 'n',0xf1 }, { 'N',0xd1 },
|
||||
{ 'o',0xf5 }, { 'O',0xd5 }, }, },
|
||||
/* dmac=4 */
|
||||
{ 0 },
|
||||
/* dbre=5 */
|
||||
{ 0 },
|
||||
/* ddot=6 */
|
||||
{ 0 },
|
||||
/* duml=7 */
|
||||
{ 0xa8, { { 'a',0xe4 }, { 'A',0xc4 }, { 'e',0xeb }, { 'E',0xcb },
|
||||
{ 'i',0xef }, { 'I',0xcf }, { 'o',0xf6 }, { 'O',0xd6 },
|
||||
{ 'u',0xfc }, { 'U',0xdc }, { 'y',0xff }, }, },
|
||||
/* dsla=8 */
|
||||
{ 0 },
|
||||
/* drin=9 */
|
||||
{ 0xb0, { { 'a',0xe5 }, { 'A',0xc5 }, }, },
|
||||
/* dced=10 */
|
||||
{ 0xb8, { { 'c',0xe7 }, { 'C',0xc7 }, }, },
|
||||
/* dapo=11 */
|
||||
{ 0 },
|
||||
/* ddac=12 */
|
||||
{ 0 },
|
||||
/* dogo=13 */
|
||||
{ 0 },
|
||||
/* dcar=14 */
|
||||
{ 0 },
|
||||
}
|
||||
};
|
||||
#endif /* ISO_ACCENTCHARS */
|
||||
|
||||
#endif /* !KBD_DFLT_KEYMAP */
|
||||
|
||||
static fkeytab_t fkey_tab[96] = {
|
||||
/* 01-04 */ {"\033[M", 3}, {"\033[N", 3}, {"\033[O", 3}, {"\033[P", 3},
|
||||
/* 05-08 */ {"\033[Q", 3}, {"\033[R", 3}, {"\033[S", 3}, {"\033[T", 3},
|
||||
/* 09-12 */ {"\033[U", 3}, {"\033[V", 3}, {"\033[W", 3}, {"\033[X", 3},
|
||||
/* 13-16 */ {"\033[Y", 3}, {"\033[Z", 3}, {"\033[a", 3}, {"\033[b", 3},
|
||||
/* 17-20 */ {"\033[c", 3}, {"\033[d", 3}, {"\033[e", 3}, {"\033[f", 3},
|
||||
/* 21-24 */ {"\033[g", 3}, {"\033[h", 3}, {"\033[i", 3}, {"\033[j", 3},
|
||||
/* 25-28 */ {"\033[k", 3}, {"\033[l", 3}, {"\033[m", 3}, {"\033[n", 3},
|
||||
/* 29-32 */ {"\033[o", 3}, {"\033[p", 3}, {"\033[q", 3}, {"\033[r", 3},
|
||||
/* 33-36 */ {"\033[s", 3}, {"\033[t", 3}, {"\033[u", 3}, {"\033[v", 3},
|
||||
/* 37-40 */ {"\033[w", 3}, {"\033[x", 3}, {"\033[y", 3}, {"\033[z", 3},
|
||||
/* 41-44 */ {"\033[@", 3}, {"\033[[", 3}, {"\033[\\",3}, {"\033[]", 3},
|
||||
/* 45-48 */ {"\033[^", 3}, {"\033[_", 3}, {"\033[`", 3}, {"\033[{", 3},
|
||||
/* 49-52 */ {"\033[H", 3}, {"\033[A", 3}, {"\033[I", 3}, {"-" , 1},
|
||||
/* 53-56 */ {"\033[D", 3}, {"\033[E", 3}, {"\033[C", 3}, {"+" , 1},
|
||||
/* 57-60 */ {"\033[F", 3}, {"\033[B", 3}, {"\033[G", 3}, {"\033[L", 3},
|
||||
/* 61-64 */ {"\177", 1}, {"\033[J", 3}, {"\033[~", 3}, {"\033[}", 3},
|
||||
/* 65-68 */ {"", 0} , {"", 0} , {"", 0} , {"", 0} ,
|
||||
/* 69-72 */ {"", 0} , {"", 0} , {"", 0} , {"", 0} ,
|
||||
/* 73-76 */ {"", 0} , {"", 0} , {"", 0} , {"", 0} ,
|
||||
/* 77-80 */ {"", 0} , {"", 0} , {"", 0} , {"", 0} ,
|
||||
/* 81-84 */ {"", 0} , {"", 0} , {"", 0} , {"", 0} ,
|
||||
/* 85-88 */ {"", 0} , {"", 0} , {"", 0} , {"", 0} ,
|
||||
/* 89-92 */ {"", 0} , {"", 0} , {"", 0} , {"", 0} ,
|
||||
/* 93-96 */ {"", 0} , {"", 0} , {"", 0} , {"", 0}
|
||||
};
|
269
freebsd/sys/sys/kbio.h
Normal file
269
freebsd/sys/sys/kbio.h
Normal file
@ -0,0 +1,269 @@
|
||||
/*-
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#ifndef _SYS_KBIO_H_
|
||||
#define _SYS_KBIO_H_
|
||||
|
||||
#ifndef _KERNEL
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
#include <sys/ioccom.h>
|
||||
|
||||
/* get/set keyboard I/O mode */
|
||||
#define K_RAW 0 /* keyboard returns scancodes */
|
||||
#define K_XLATE 1 /* keyboard returns ascii */
|
||||
#define K_CODE 2 /* keyboard returns keycodes */
|
||||
#define KDGKBMODE _IOR('K', 6, int)
|
||||
#define KDSKBMODE _IOWINT('K', 7)
|
||||
|
||||
/* make tone */
|
||||
#define KDMKTONE _IOWINT('K', 8)
|
||||
|
||||
/* see console.h for the definitions of the following ioctls */
|
||||
#ifdef notdef
|
||||
#define KDGETMODE _IOR('K', 9, int)
|
||||
#define KDSETMODE _IOWINT('K', 10)
|
||||
#define KDSBORDER _IOWINT('K', 13)
|
||||
#endif
|
||||
|
||||
/* get/set keyboard lock state */
|
||||
#define CLKED 1 /* Caps locked */
|
||||
#define NLKED 2 /* Num locked */
|
||||
#define SLKED 4 /* Scroll locked */
|
||||
#define ALKED 8 /* AltGr locked */
|
||||
#define LOCK_MASK (CLKED | NLKED | SLKED | ALKED)
|
||||
#define KDGKBSTATE _IOR('K', 19, int)
|
||||
#define KDSKBSTATE _IOWINT('K', 20)
|
||||
|
||||
/* enable/disable I/O access */
|
||||
#define KDENABIO _IO('K', 60)
|
||||
#define KDDISABIO _IO('K', 61)
|
||||
|
||||
/* make sound */
|
||||
#define KIOCSOUND _IOWINT('K', 63)
|
||||
|
||||
/* get keyboard model */
|
||||
#define KB_OTHER 0 /* keyboard not known */
|
||||
#define KB_84 1 /* 'old' 84 key AT-keyboard */
|
||||
#define KB_101 2 /* MF-101 or MF-102 keyboard */
|
||||
#define KDGKBTYPE _IOR('K', 64, int)
|
||||
|
||||
/* get/set keyboard LED state */
|
||||
#define LED_CAP 1 /* Caps lock LED */
|
||||
#define LED_NUM 2 /* Num lock LED */
|
||||
#define LED_SCR 4 /* Scroll lock LED */
|
||||
#define LED_MASK (LED_CAP | LED_NUM | LED_SCR)
|
||||
#define KDGETLED _IOR('K', 65, int)
|
||||
#define KDSETLED _IOWINT('K', 66)
|
||||
|
||||
/* set keyboard repeat rate (obsolete, use KDSETREPEAT below) */
|
||||
#define KDSETRAD _IOWINT('K', 67)
|
||||
|
||||
struct keyboard_info {
|
||||
int kb_index; /* kbdio index# */
|
||||
char kb_name[16]; /* driver name */
|
||||
int kb_unit; /* unit# */
|
||||
int kb_type; /* KB_84, KB_101, KB_OTHER,... */
|
||||
int kb_config; /* device configuration flags */
|
||||
int kb_flags; /* internal flags */
|
||||
};
|
||||
typedef struct keyboard_info keyboard_info_t;
|
||||
|
||||
/* add/remove keyboard to/from mux */
|
||||
#define KBADDKBD _IOW('K', 68, keyboard_info_t) /* add keyboard */
|
||||
#define KBRELKBD _IOW('K', 69, keyboard_info_t) /* release keyboard */
|
||||
|
||||
/* see console.h for the definition of the following ioctl */
|
||||
#ifdef notdef
|
||||
#define KDRASTER _IOW('K', 100, scr_size_t)
|
||||
#endif
|
||||
|
||||
/* get keyboard information */
|
||||
#define KDGKBINFO _IOR('K', 101, keyboard_info_t)
|
||||
|
||||
/* set/get keyboard repeat rate (new interface) */
|
||||
struct keyboard_repeat {
|
||||
int kb_repeat[2];
|
||||
};
|
||||
typedef struct keyboard_repeat keyboard_repeat_t;
|
||||
#define KDSETREPEAT _IOW('K', 102, keyboard_repeat_t)
|
||||
#define KDGETREPEAT _IOR('K', 103, keyboard_repeat_t)
|
||||
|
||||
/* get/set key map/accent map/function key strings */
|
||||
|
||||
#define NUM_KEYS 256 /* number of keys in table */
|
||||
#define NUM_STATES 8 /* states per key */
|
||||
#define ALTGR_OFFSET 128 /* offset for altlock keys */
|
||||
|
||||
#define NUM_DEADKEYS 15 /* number of accent keys */
|
||||
#define NUM_ACCENTCHARS 52 /* max number of accent chars */
|
||||
|
||||
#define NUM_FKEYS 96 /* max number of function keys */
|
||||
#define MAXFK 16 /* max length of a function key str */
|
||||
|
||||
#ifndef _KEYMAP_DECLARED
|
||||
#define _KEYMAP_DECLARED
|
||||
|
||||
struct keyent_t {
|
||||
u_int map[NUM_STATES];
|
||||
u_char spcl;
|
||||
u_char flgs;
|
||||
#define FLAG_LOCK_O 0
|
||||
#define FLAG_LOCK_C 1
|
||||
#define FLAG_LOCK_N 2
|
||||
};
|
||||
|
||||
struct keymap {
|
||||
u_short n_keys;
|
||||
struct keyent_t key[NUM_KEYS];
|
||||
};
|
||||
typedef struct keymap keymap_t;
|
||||
|
||||
#ifdef _KERNEL
|
||||
struct okeyent_t {
|
||||
u_char map[NUM_STATES];
|
||||
u_char spcl;
|
||||
u_char flgs;
|
||||
};
|
||||
|
||||
struct okeymap {
|
||||
u_short n_keys;
|
||||
struct okeyent_t key[NUM_KEYS];
|
||||
};
|
||||
typedef struct okeymap okeymap_t;
|
||||
#endif /* _KERNEL */
|
||||
|
||||
#endif /* !_KEYMAP_DECLARED */
|
||||
|
||||
/* defines for "special" keys (spcl bit set in keymap) */
|
||||
#define NOP 0x00 /* nothing (dead key) */
|
||||
#define LSH 0x02 /* left shift key */
|
||||
#define RSH 0x03 /* right shift key */
|
||||
#define CLK 0x04 /* caps lock key */
|
||||
#define NLK 0x05 /* num lock key */
|
||||
#define SLK 0x06 /* scroll lock key */
|
||||
#define LALT 0x07 /* left alt key */
|
||||
#define BTAB 0x08 /* backwards tab */
|
||||
#define LCTR 0x09 /* left control key */
|
||||
#define NEXT 0x0a /* switch to next screen */
|
||||
#define F_SCR 0x0b /* switch to first screen */
|
||||
#define L_SCR 0x1a /* switch to last screen */
|
||||
#define F_FN 0x1b /* first function key */
|
||||
#define L_FN 0x7a /* last function key */
|
||||
/* 0x7b-0x7f reserved do not use ! */
|
||||
#define RCTR 0x80 /* right control key */
|
||||
#define RALT 0x81 /* right alt (altgr) key */
|
||||
#define ALK 0x82 /* alt lock key */
|
||||
#define ASH 0x83 /* alt shift key */
|
||||
#define META 0x84 /* meta key */
|
||||
#define RBT 0x85 /* boot machine */
|
||||
#define DBG 0x86 /* call debugger */
|
||||
#define SUSP 0x87 /* suspend power (APM) */
|
||||
#define SPSC 0x88 /* toggle splash/text screen */
|
||||
|
||||
#define F_ACC DGRA /* first accent key */
|
||||
#define DGRA 0x89 /* grave */
|
||||
#define DACU 0x8a /* acute */
|
||||
#define DCIR 0x8b /* circumflex */
|
||||
#define DTIL 0x8c /* tilde */
|
||||
#define DMAC 0x8d /* macron */
|
||||
#define DBRE 0x8e /* breve */
|
||||
#define DDOT 0x8f /* dot */
|
||||
#define DUML 0x90 /* umlaut/diaresis */
|
||||
#define DDIA 0x90 /* diaresis */
|
||||
#define DSLA 0x91 /* slash */
|
||||
#define DRIN 0x92 /* ring */
|
||||
#define DCED 0x93 /* cedilla */
|
||||
#define DAPO 0x94 /* apostrophe */
|
||||
#define DDAC 0x95 /* double acute */
|
||||
#define DOGO 0x96 /* ogonek */
|
||||
#define DCAR 0x97 /* caron */
|
||||
#define L_ACC DCAR /* last accent key */
|
||||
|
||||
#define STBY 0x98 /* Go into standby mode (apm) */
|
||||
#define PREV 0x99 /* switch to previous screen */
|
||||
#define PNC 0x9a /* force system panic */
|
||||
#define LSHA 0x9b /* left shift key / alt lock */
|
||||
#define RSHA 0x9c /* right shift key / alt lock */
|
||||
#define LCTRA 0x9d /* left ctrl key / alt lock */
|
||||
#define RCTRA 0x9e /* right ctrl key / alt lock */
|
||||
#define LALTA 0x9f /* left alt key / alt lock */
|
||||
#define RALTA 0xa0 /* right alt key / alt lock */
|
||||
#define HALT 0xa1 /* halt machine */
|
||||
#define PDWN 0xa2 /* halt machine and power down */
|
||||
#define PASTE 0xa3 /* paste from cut-paste buffer */
|
||||
|
||||
#define F(x) ((x)+F_FN-1)
|
||||
#define S(x) ((x)+F_SCR-1)
|
||||
#define ACC(x) ((x)+F_ACC)
|
||||
|
||||
struct acc_t {
|
||||
u_char accchar;
|
||||
u_char map[NUM_ACCENTCHARS][2];
|
||||
};
|
||||
|
||||
struct accentmap {
|
||||
u_short n_accs;
|
||||
struct acc_t acc[NUM_DEADKEYS];
|
||||
};
|
||||
typedef struct accentmap accentmap_t;
|
||||
|
||||
struct keyarg {
|
||||
u_short keynum;
|
||||
struct keyent_t key;
|
||||
};
|
||||
typedef struct keyarg keyarg_t;
|
||||
|
||||
struct fkeytab {
|
||||
u_char str[MAXFK];
|
||||
u_char len;
|
||||
};
|
||||
typedef struct fkeytab fkeytab_t;
|
||||
|
||||
struct fkeyarg {
|
||||
u_short keynum;
|
||||
char keydef[MAXFK];
|
||||
char flen;
|
||||
};
|
||||
typedef struct fkeyarg fkeyarg_t;
|
||||
|
||||
#define GETFKEY _IOWR('k', 0, fkeyarg_t)
|
||||
#define SETFKEY _IOWR('k', 1, fkeyarg_t)
|
||||
#ifdef notdef /* see console.h */
|
||||
#define GIO_SCRNMAP _IOR('k', 2, scrmap_t)
|
||||
#define PIO_SCRNMAP _IOW('k', 3, scrmap_t)
|
||||
#endif
|
||||
/* XXX: Should have keymap_t as an argument, but that's too big for ioctl()! */
|
||||
#define GIO_KEYMAP _IO('k', 6)
|
||||
#define PIO_KEYMAP _IO('k', 7)
|
||||
#ifdef _KERNEL
|
||||
#define OGIO_KEYMAP _IOR('k', 6, okeymap_t)
|
||||
#define OPIO_KEYMAP _IOW('k', 7, okeymap_t)
|
||||
#endif /* _KERNEL */
|
||||
#define GIO_DEADKEYMAP _IOR('k', 8, accentmap_t)
|
||||
#define PIO_DEADKEYMAP _IOW('k', 9, accentmap_t)
|
||||
#define GIO_KEYMAPENT _IOWR('k', 10, keyarg_t)
|
||||
#define PIO_KEYMAPENT _IOW('k', 11, keyarg_t)
|
||||
|
||||
/* flags set to the return value in the KD_XLATE mode */
|
||||
|
||||
#define NOKEY 0x01000000 /* no key pressed marker */
|
||||
#define FKEY 0x02000000 /* function key marker */
|
||||
#define MKEY 0x04000000 /* meta key marker (prepend ESC)*/
|
||||
#define BKEY 0x08000000 /* backtab (ESC [ Z) */
|
||||
|
||||
#define SPCLKEY 0x80000000 /* special key */
|
||||
#define RELKEY 0x40000000 /* key released */
|
||||
#define ERRKEY 0x20000000 /* error */
|
||||
|
||||
/*
|
||||
* The top byte is used to store the flags. This means there are 24
|
||||
* bits left to store the actual character. Because UTF-8 can encode
|
||||
* 2^21 different characters, this is good enough to get Unicode
|
||||
* working.
|
||||
*/
|
||||
#define KEYCHAR(c) ((c) & 0x00ffffff)
|
||||
#define KEYFLAGS(c) ((c) & ~0x00ffffff)
|
||||
|
||||
#endif /* !_SYS_KBIO_H_ */
|
Loading…
x
Reference in New Issue
Block a user