Introduce iteinstallkeymap() which allows the keyboard driver to

register its keymap with ite.  Add RCSIDs while here.
This commit is contained in:
gmcgarry 2002-03-15 05:45:23 +00:00
parent 0cc97c18ac
commit 1cb254edf6
4 changed files with 50 additions and 54 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: hil.c,v 1.46 2002/02/23 21:53:25 gmcgarry Exp $ */
/* $NetBSD: hil.c,v 1.47 2002/03/15 05:45:23 gmcgarry Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@ -42,6 +42,9 @@
* @(#)hil.c 8.2 (Berkeley) 1/12/94
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: hil.c,v 1.47 2002/03/15 05:45:23 gmcgarry Exp $");
#include "opt_compat_hpux.h"
#include "rnd.h"
@ -97,12 +100,7 @@ int hildebug = 0;
extern struct emul emul_hpux;
#endif
/* ITE interface */
char *kbd_keymap;
char *kbd_shiftmap;
char *kbd_ctrlmap;
char *kbd_ctrlshiftmap;
char **kbd_stringmap;
extern struct kbdmap kbd_map[];
/* symbolic sleep message strings */
char hilin[] = "hilin";
@ -157,10 +155,6 @@ hilattach(parent, self, aux)
struct intio_attach_args *ia = aux;
int i;
/* XXX ITE interface */
extern char us_keymap[], us_shiftmap[], us_ctrlmap[],
us_ctrlshiftmap[], *us_stringmap[];
printf("\n");
#ifdef DEBUG
@ -195,12 +189,17 @@ hilattach(parent, self, aux)
* to US ASCII - it seems to work OK for non-recognized
* keyboards.
*/
hilp->hl_kbdlang = KBD_DEFAULT;
kbd_keymap = us_keymap; /* XXX */
kbd_shiftmap = us_shiftmap; /* XXX */
kbd_ctrlmap = us_ctrlmap; /* XXX */
kbd_ctrlshiftmap = us_ctrlshiftmap; /* XXX */
kbd_stringmap = us_stringmap; /* XXX */
#if NITE > 0
{
struct kbdmap *km;
for (km = kbd_map; km->kbd_code; km++) {
if (km->kbd_code == KBD_US)
iteinstallkeymap(km);
}
}
#endif
(void) intio_intr_establish(hilint, hilp, ia->ia_ipl, IPL_TTY);
@ -1215,12 +1214,13 @@ hilkbddisable(v)
{
}
#if NITE > 0
/*
* The following chunk of code implements HIL console keyboard
* support.
*/
static struct hil_dev *hilkbd_cn_device;
static struct hil_dev *hilkbd_cn_device;
static struct ite_kbdmap hilkbd_cn_map;
static struct ite_kbdops hilkbd_cn_ops = {
hilkbdcngetc,
@ -1229,6 +1229,8 @@ static struct ite_kbdops hilkbd_cn_ops = {
NULL,
};
extern char *us_keymap, *us_shiftmap, *us_ctrlmap;
/*
* XXX: read keyboard directly and return code.
* Used by console getchar routine. Could really screw up anybody
@ -1269,9 +1271,6 @@ hilkbdcnattach(bus_space_tag_t bst, bus_addr_t addr)
bus_space_handle_t bsh;
u_char lang;
/* XXX from hil_keymaps.c */
extern char us_keymap[], us_shiftmap[], us_ctrlmap[];
if (bus_space_map(bst, addr, NBPG, 0, &bsh))
return (1);
@ -1307,7 +1306,7 @@ hilkbdcnattach(bus_space_tag_t bst, bus_addr_t addr)
return (0);
}
/* End of HIL console keyboard code. */
#endif /* End of HIL console keyboard code. */
/*
* Recoginize and clear keyboard generated NMIs.
@ -1504,18 +1503,15 @@ hilconfig(hilp)
if (hilp->hl_kbdlang != KBD_SPECIAL) {
struct kbdmap *km;
#if NITE > 0
for (km = kbd_map; km->kbd_code; km++) {
if (km->kbd_code == db) {
hilp->hl_kbdlang = db;
/* XXX */
kbd_keymap = km->kbd_keymap;
kbd_shiftmap = km->kbd_shiftmap;
kbd_ctrlmap = km->kbd_ctrlmap;
kbd_ctrlshiftmap = km->kbd_ctrlshiftmap;
kbd_stringmap = km->kbd_stringmap;
iteinstallkeymap(km);
break;
}
}
#endif
if (km->kbd_code == 0) {
printf(
"hilconfig: unknown keyboard type 0x%x, using default\n",

View File

@ -1,4 +1,4 @@
/* $NetBSD: ite.c,v 1.50 2001/12/14 08:25:40 gmcgarry Exp $ */
/* $NetBSD: ite.c,v 1.51 2002/03/15 05:45:23 gmcgarry Exp $ */
/*-
* Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@ -84,6 +84,9 @@
* the hardware dependent routines.
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ite.c,v 1.51 2002/03/15 05:45:23 gmcgarry Exp $");
#include "hil.h"
#include <sys/param.h>
@ -128,6 +131,9 @@ struct cfattach ite_ca = {
sizeof(struct ite_softc), itematch, iteattach
};
/* XXX this has always been global, but shouldn't be */
static struct kbdmap *ite_km;
extern struct cfdriver ite_cd;
/*
@ -208,15 +214,13 @@ iteattach(parent, self, aux)
*/
cn_tab->cn_dev = makedev(ite_major(), self->dv_unit);
} else {
ite->sc_data =
(struct ite_data *)malloc(sizeof(struct ite_data),
M_DEVBUF, M_NOWAIT);
MALLOC(ite->sc_data, struct ite_data *,
sizeof(struct ite_data), M_DEVBUF, M_NOWAIT | M_ZERO);
if (ite->sc_data == NULL) {
printf("\n%s: malloc for ite_data failed\n",
ite->sc_dev.dv_xname);
return;
}
memset(ite->sc_data, 0, sizeof(struct ite_data));
ite->sc_data->flags = ITE_ALIVE;
}
@ -229,6 +233,13 @@ iteattach(parent, self, aux)
printf("\n");
}
void
iteinstallkeymap(v)
void *v;
{
ite_km = (struct kbdmap *)v;
}
/*
* Perform functions necessary to setup device as a terminal emulator.
*/
@ -284,9 +295,8 @@ iteinit(ip)
ip->attribute = 0;
if (ip->attrbuf == NULL)
ip->attrbuf = (u_char *)
malloc(ip->rows * ip->cols, M_DEVBUF, M_WAITOK);
memset(ip->attrbuf, 0, (ip->rows * ip->cols));
ip->attrbuf = (u_char *)malloc(ip->rows * ip->cols,
M_DEVBUF, M_WAITOK | M_ZERO);
ip->imode = 0;
ip->flags |= ITE_INITED;
@ -576,25 +586,25 @@ itefilter(stat, c)
default:
case KBD_KEY:
if (!capsmode) {
code = kbd_keymap[(int)c];
code = ite_km->kbd_keymap[(int)c];
break;
}
/* FALLTHROUGH */
case KBD_SHIFT:
code = kbd_shiftmap[(int)c];
code = ite_km->kbd_shiftmap[(int)c];
break;
case KBD_CTRL:
code = kbd_ctrlmap[(int)c];
code = ite_km->kbd_ctrlmap[(int)c];
break;
case KBD_CTRLSHIFT:
code = kbd_ctrlshiftmap[(int)c];
code = ite_km->kbd_ctrlshiftmap[(int)c];
break;
}
if (code == '\0' && (str = kbd_stringmap[(int)c]) != '\0') {
if (code == '\0' && (str = ite_km->kbd_stringmap[(int)c]) != '\0') {
while (*str)
(*kbd_tty->t_linesw->l_rint)(*str++, kbd_tty);
} else {

View File

@ -1,4 +1,4 @@
/* $NetBSD: itevar.h,v 1.15 2001/12/14 08:25:40 gmcgarry Exp $ */
/* $NetBSD: itevar.h,v 1.16 2002/03/15 05:45:24 gmcgarry Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@ -211,10 +211,11 @@ struct ite_kbdmap {
};
/* ite.c prototypes */
void ite_attach_grf __P((int, int));
int iteon __P((struct ite_data *, int));
void iteoff __P((struct ite_data *, int));
void iteinstallkeymap __P((void *));
void itefilter __P((char, char));
void itedisplaycnattach __P((struct grf_data *, struct itesw *));
void itekbdcnattach __P((struct ite_kbdops *, struct ite_kbdmap *));
void itecninit __P((void));

View File

@ -1,4 +1,4 @@
/* $NetBSD: kbdmap.h,v 1.8 2001/12/14 08:25:40 gmcgarry Exp $ */
/* $NetBSD: kbdmap.h,v 1.9 2002/03/15 05:45:24 gmcgarry Exp $ */
/*
* Copyright (c) 1982, 1990, 1993
@ -55,14 +55,3 @@ struct kbdmap {
#define KBD_SE 0x0e /* Swedish */
#define KBD_DEFAULT KBD_US /* default type */
#ifdef _KERNEL
/* XXX: ITE interface */
extern char *kbd_keymap;
extern char *kbd_shiftmap;
extern char *kbd_ctrlmap;
extern char *kbd_ctrlshiftmap;
extern char **kbd_stringmap;
extern struct kbdmap kbd_map[];
#endif