1999-01-01 08:23:23 +00:00
|
|
|
/*
|
2000-03-26 09:17:14 +00:00
|
|
|
* Copyright (c) 1999, 2000 Hellmuth Michaelis
|
1999-12-30 16:17:11 +00:00
|
|
|
*
|
1999-01-01 08:23:23 +00:00
|
|
|
* Copyright (c) 1992, 1995 Hellmuth Michaelis and Joerg Wunsch.
|
|
|
|
*
|
|
|
|
* Copyright (c) 1992, 1993 Brian Dunford-Shore and Scott Turner.
|
|
|
|
*
|
|
|
|
* Copyright (c) 1993 Charles Hannum.
|
|
|
|
*
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Parts of this code regarding the NetBSD interface were written
|
|
|
|
* by Charles Hannum.
|
2000-03-26 09:17:14 +00:00
|
|
|
*
|
1999-01-01 08:23:23 +00:00
|
|
|
* This code is derived from software contributed to Berkeley by
|
|
|
|
* William Jolitz and Don Ahn.
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
* 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. All advertising materials mentioning features or use of this software
|
|
|
|
* must display the following acknowledgement:
|
|
|
|
* This product includes software developed by
|
|
|
|
* Hellmuth Michaelis, Brian Dunford-Shore, Joerg Wunsch, Scott Turner
|
|
|
|
* and Charles Hannum.
|
|
|
|
* 4. The name authors may not be used to endorse or promote products
|
|
|
|
* derived from this software without specific prior written permission.
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*---------------------------------------------------------------------------*
|
|
|
|
*
|
|
|
|
* pcvt_drv.c VT220 Driver Main Module / OS - Interface
|
|
|
|
* ---------------------------------------------------------
|
1999-12-30 16:17:11 +00:00
|
|
|
*
|
2000-07-15 13:16:28 +00:00
|
|
|
* Last Edit-Date: [Sat Jul 15 15:06:06 2000]
|
1999-12-30 16:17:11 +00:00
|
|
|
*
|
|
|
|
* $FreeBSD$
|
1999-01-01 08:23:23 +00:00
|
|
|
*
|
|
|
|
*---------------------------------------------------------------------------*/
|
|
|
|
|
2000-03-26 09:17:14 +00:00
|
|
|
#define MAIN
|
|
|
|
#include <i386/isa/pcvt/pcvt_hdr.h>
|
|
|
|
#undef MAIN
|
1999-01-01 08:23:23 +00:00
|
|
|
|
|
|
|
|
2000-04-16 09:33:17 +00:00
|
|
|
#include <sys/resource.h>
|
|
|
|
#include <sys/bus.h>
|
|
|
|
#include <sys/rman.h>
|
|
|
|
|
|
|
|
#include <machine/resource.h>
|
|
|
|
#include <machine/bus.h>
|
|
|
|
|
|
|
|
#include <isa/isareg.h>
|
|
|
|
#include <isa/isavar.h>
|
|
|
|
|
|
|
|
static kbd_callback_func_t pcvt_event;
|
2000-03-26 09:17:14 +00:00
|
|
|
static int pcvt_kbd_wptr = 0;
|
|
|
|
static u_char pcvt_timeout_scheduled = 0;
|
1999-01-01 08:23:23 +00:00
|
|
|
|
2000-03-26 09:17:14 +00:00
|
|
|
static void vgapelinit(void);
|
1999-01-11 03:18:56 +00:00
|
|
|
static void detect_kbd(void *arg);
|
2000-04-16 09:33:17 +00:00
|
|
|
static void pcvt_start(register struct tty *tp);
|
|
|
|
static int pcvt_param(struct tty *tp, struct termios *t);
|
1999-01-11 03:18:56 +00:00
|
|
|
|
2000-04-16 09:33:17 +00:00
|
|
|
static cn_probe_t pcvt_cn_probe;
|
|
|
|
static cn_init_t pcvt_cn_init;
|
|
|
|
static cn_term_t pcvt_cn_term;
|
|
|
|
static cn_getc_t pcvt_cn_getc;
|
|
|
|
static cn_checkc_t pcvt_cn_checkc;
|
|
|
|
static cn_putc_t pcvt_cn_putc;
|
1999-01-07 14:14:24 +00:00
|
|
|
|
2000-04-16 09:33:17 +00:00
|
|
|
CONS_DRIVER(vt, pcvt_cn_probe, pcvt_cn_init, pcvt_cn_term, pcvt_cn_getc,
|
|
|
|
pcvt_cn_checkc, pcvt_cn_putc, NULL);
|
1999-01-07 14:14:24 +00:00
|
|
|
|
2000-04-16 09:33:17 +00:00
|
|
|
static d_open_t pcvt_open;
|
|
|
|
static d_close_t pcvt_close;
|
|
|
|
static d_ioctl_t pcvt_ioctl;
|
|
|
|
static d_mmap_t pcvt_mmap;
|
1999-01-01 08:23:23 +00:00
|
|
|
|
|
|
|
#define CDEV_MAJOR 12
|
2000-04-16 09:33:17 +00:00
|
|
|
|
|
|
|
static struct cdevsw vt_cdevsw = {
|
2003-03-03 12:15:54 +00:00
|
|
|
.d_open = pcvt_open,
|
|
|
|
.d_close = pcvt_close,
|
|
|
|
.d_read = ttyread,
|
|
|
|
.d_write = ttywrite,
|
|
|
|
.d_ioctl = pcvt_ioctl,
|
|
|
|
.d_poll = ttypoll,
|
|
|
|
.d_mmap = pcvt_mmap,
|
|
|
|
.d_name = "vt",
|
|
|
|
.d_maj = CDEV_MAJOR,
|
2003-03-03 16:24:47 +00:00
|
|
|
.d_flags = D_TTY,
|
2003-03-03 12:15:54 +00:00
|
|
|
.d_kqfilter = ttykqfilter,
|
1999-01-01 08:23:23 +00:00
|
|
|
};
|
|
|
|
|
2000-04-16 09:33:17 +00:00
|
|
|
static int pcvt_probe(device_t dev);
|
|
|
|
static int pcvt_attach(device_t dev);
|
2000-07-15 13:16:28 +00:00
|
|
|
static void pcvt_identify (driver_t *driver, device_t parent);
|
2000-04-16 09:33:17 +00:00
|
|
|
|
|
|
|
static device_method_t pcvt_methods[] = {
|
2000-07-15 13:16:28 +00:00
|
|
|
DEVMETHOD(device_identify, pcvt_identify),
|
2000-04-16 09:33:17 +00:00
|
|
|
DEVMETHOD(device_probe, pcvt_probe),
|
|
|
|
DEVMETHOD(device_attach, pcvt_attach),
|
|
|
|
DEVMETHOD(bus_print_child, bus_generic_print_child),
|
|
|
|
{ 0, 0 }
|
|
|
|
};
|
2000-03-26 09:17:14 +00:00
|
|
|
|
2000-04-16 09:33:17 +00:00
|
|
|
static driver_t pcvt_driver = {
|
|
|
|
"vt",
|
|
|
|
pcvt_methods,
|
|
|
|
0
|
2000-03-26 09:17:14 +00:00
|
|
|
};
|
|
|
|
|
2000-04-16 09:33:17 +00:00
|
|
|
static devclass_t pcvt_devclass;
|
|
|
|
|
|
|
|
DRIVER_MODULE(pcvt, isa, pcvt_driver, pcvt_devclass, 0, 0);
|
|
|
|
|
2000-07-15 13:16:28 +00:00
|
|
|
/*---------------------------------------------------------------------------*
|
|
|
|
* driver identify
|
|
|
|
*---------------------------------------------------------------------------*/
|
|
|
|
static void
|
|
|
|
pcvt_identify (driver_t *driver, device_t parent)
|
|
|
|
{
|
|
|
|
BUS_ADD_CHILD(parent, ISA_ORDER_SPECULATIVE, "vt", 0);
|
|
|
|
}
|
|
|
|
|
2000-03-26 09:17:14 +00:00
|
|
|
/*---------------------------------------------------------------------------*
|
|
|
|
* driver probe
|
|
|
|
*---------------------------------------------------------------------------*/
|
|
|
|
static int
|
2000-04-16 09:33:17 +00:00
|
|
|
pcvt_probe(device_t dev)
|
1999-01-01 08:23:23 +00:00
|
|
|
{
|
1999-01-11 03:18:56 +00:00
|
|
|
int i;
|
2000-04-16 09:33:17 +00:00
|
|
|
device_t bus;
|
|
|
|
|
|
|
|
int unit = device_get_unit(dev);
|
|
|
|
|
|
|
|
/* No pnp support */
|
|
|
|
if(isa_get_vendorid(dev))
|
|
|
|
return ENXIO;
|
|
|
|
|
|
|
|
if(unit != 0)
|
|
|
|
return ENXIO;
|
|
|
|
|
|
|
|
device_set_desc(dev, "pcvt VT220 console driver");
|
|
|
|
|
|
|
|
bus = device_get_parent(dev);
|
|
|
|
bus_set_resource(dev, SYS_RES_IOPORT, 0, 0x3b0, 0x30);
|
|
|
|
bus_set_resource(dev, SYS_RES_MEMORY, 0, (u_long) Crtat, 0x8000);
|
1999-01-01 08:23:23 +00:00
|
|
|
|
2000-03-26 09:17:14 +00:00
|
|
|
if (kbd == NULL)
|
|
|
|
{
|
1999-01-01 08:23:23 +00:00
|
|
|
reset_keyboard = 0;
|
1999-01-14 03:17:32 +00:00
|
|
|
kbd_configure(KB_CONF_PROBE_ONLY);
|
2000-04-16 09:33:17 +00:00
|
|
|
i = kbd_allocate("*", -1, (void *)&kbd, pcvt_event, (void *)&vs[unit]);
|
1999-01-14 03:17:32 +00:00
|
|
|
if ((i < 0) || ((kbd = kbd_get_keyboard(i)) == NULL))
|
2000-04-16 09:33:17 +00:00
|
|
|
return 0;
|
1999-01-01 08:23:23 +00:00
|
|
|
}
|
|
|
|
reset_keyboard = 1; /* it's now safe to do kbd reset */
|
|
|
|
|
|
|
|
kbd_code_init();
|
|
|
|
|
2000-04-16 09:33:17 +00:00
|
|
|
return 0;
|
1999-01-01 08:23:23 +00:00
|
|
|
}
|
|
|
|
|
2000-03-26 09:17:14 +00:00
|
|
|
/*---------------------------------------------------------------------------*
|
|
|
|
* driver attach
|
|
|
|
*---------------------------------------------------------------------------*/
|
|
|
|
static int
|
2000-04-16 09:33:17 +00:00
|
|
|
pcvt_attach(device_t dev)
|
1999-01-01 08:23:23 +00:00
|
|
|
{
|
|
|
|
int i;
|
2000-04-16 09:33:17 +00:00
|
|
|
struct resource *port;
|
|
|
|
struct resource *mem;
|
|
|
|
|
|
|
|
int unit = device_get_unit(dev);
|
|
|
|
|
|
|
|
if(unit != 0)
|
|
|
|
return ENXIO;
|
|
|
|
|
|
|
|
i = 0;
|
|
|
|
port = bus_alloc_resource(dev, SYS_RES_IOPORT, &i, 0, ~0, 0,
|
|
|
|
RF_ACTIVE | RF_SHAREABLE);
|
|
|
|
|
|
|
|
i = 0;
|
|
|
|
mem = bus_alloc_resource(dev, SYS_RES_MEMORY, &i, 0, ~0, 0,
|
|
|
|
RF_ACTIVE | RF_SHAREABLE);
|
1999-01-01 08:23:23 +00:00
|
|
|
|
|
|
|
vt_coldmalloc(); /* allocate memory for screens */
|
|
|
|
|
1999-01-11 03:18:56 +00:00
|
|
|
if (kbd == NULL)
|
2000-04-16 09:33:17 +00:00
|
|
|
timeout(detect_kbd, (void *)&vs[unit], hz*2);
|
1999-01-01 08:23:23 +00:00
|
|
|
|
2000-04-16 09:33:17 +00:00
|
|
|
printf("vt%d: ", unit);
|
1999-01-01 08:23:23 +00:00
|
|
|
|
|
|
|
switch(adaptor_type)
|
|
|
|
{
|
|
|
|
case MDA_ADAPTOR:
|
2000-04-16 09:33:17 +00:00
|
|
|
printf("MDA");
|
1999-01-01 08:23:23 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case CGA_ADAPTOR:
|
2000-04-16 09:33:17 +00:00
|
|
|
printf("CGA");
|
1999-01-01 08:23:23 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case EGA_ADAPTOR:
|
2000-04-16 09:33:17 +00:00
|
|
|
printf("EGA");
|
1999-01-01 08:23:23 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case VGA_ADAPTOR:
|
2000-03-26 09:17:14 +00:00
|
|
|
printf("%s VGA, ", (char *)vga_string(vga_type));
|
1999-01-01 08:23:23 +00:00
|
|
|
if(can_do_132col)
|
2000-04-16 09:33:17 +00:00
|
|
|
printf("80/132 columns");
|
1999-01-01 08:23:23 +00:00
|
|
|
else
|
2000-04-16 09:33:17 +00:00
|
|
|
printf("80 columns");
|
1999-01-01 08:23:23 +00:00
|
|
|
vgapelinit();
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
printf("unknown");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(color == 0)
|
|
|
|
printf(", mono");
|
|
|
|
else
|
|
|
|
printf(", color");
|
|
|
|
|
2000-04-16 09:33:17 +00:00
|
|
|
printf(", %d screens, ", totalscreens);
|
1999-01-01 08:23:23 +00:00
|
|
|
|
|
|
|
switch(keyboard_type)
|
|
|
|
{
|
|
|
|
case KB_AT:
|
2000-04-16 09:33:17 +00:00
|
|
|
printf("AT-");
|
1999-01-01 08:23:23 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case KB_MFII:
|
2000-04-16 09:33:17 +00:00
|
|
|
printf("MF2-");
|
1999-01-01 08:23:23 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
printf("unknown ");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2000-04-16 09:33:17 +00:00
|
|
|
printf("keyboard\n");
|
1999-01-01 08:23:23 +00:00
|
|
|
|
|
|
|
for(i = 0; i < totalscreens; i++)
|
1999-10-06 13:01:12 +00:00
|
|
|
{
|
2000-04-16 09:33:17 +00:00
|
|
|
ttyregister(&pcvt_tty[i]);
|
|
|
|
vs[i].vs_tty = &pcvt_tty[i];
|
|
|
|
make_dev(&vt_cdevsw, i, UID_ROOT, GID_WHEEL, 0600, "ttyv%r", i);
|
1999-10-06 13:01:12 +00:00
|
|
|
}
|
1999-01-01 08:23:23 +00:00
|
|
|
|
|
|
|
async_update(UPDATE_START); /* start asynchronous updates */
|
|
|
|
|
2000-04-16 09:33:17 +00:00
|
|
|
return 0;
|
1999-01-01 08:23:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*---------------------------------------------------------------------------*
|
2000-03-26 09:17:14 +00:00
|
|
|
* driver open
|
1999-01-01 08:23:23 +00:00
|
|
|
*---------------------------------------------------------------------------*/
|
2000-03-26 09:17:14 +00:00
|
|
|
static int
|
2001-09-12 08:38:13 +00:00
|
|
|
pcvt_open(dev_t dev, int flag, int mode, struct thread *td)
|
1999-01-01 08:23:23 +00:00
|
|
|
{
|
|
|
|
register struct tty *tp;
|
|
|
|
register struct video_state *vsx;
|
|
|
|
int s, retval;
|
|
|
|
int winsz = 0;
|
|
|
|
int i = minor(dev);
|
|
|
|
|
|
|
|
vsx = &vs[i];
|
|
|
|
|
2000-03-26 09:17:14 +00:00
|
|
|
if(i >= PCVT_NSCREENS)
|
1999-01-01 08:23:23 +00:00
|
|
|
return ENXIO;
|
|
|
|
|
2000-04-16 09:33:17 +00:00
|
|
|
tp = &pcvt_tty[i];
|
1999-09-25 16:21:39 +00:00
|
|
|
|
2000-03-26 09:17:14 +00:00
|
|
|
dev->si_tty = tp;
|
1999-01-01 08:23:23 +00:00
|
|
|
|
|
|
|
vsx->openf++;
|
|
|
|
|
2000-04-16 09:33:17 +00:00
|
|
|
tp->t_oproc = pcvt_start;
|
|
|
|
tp->t_param = pcvt_param;
|
1999-10-06 13:01:12 +00:00
|
|
|
tp->t_stop = nottystop;
|
1999-01-01 08:23:23 +00:00
|
|
|
tp->t_dev = dev;
|
|
|
|
|
|
|
|
if ((tp->t_state & TS_ISOPEN) == 0)
|
|
|
|
{
|
|
|
|
ttychars(tp);
|
|
|
|
tp->t_iflag = TTYDEF_IFLAG;
|
|
|
|
tp->t_oflag = TTYDEF_OFLAG;
|
|
|
|
tp->t_cflag = TTYDEF_CFLAG;
|
|
|
|
tp->t_lflag = TTYDEF_LFLAG;
|
|
|
|
tp->t_ispeed = tp->t_ospeed = TTYDEF_SPEED;
|
2000-04-16 09:33:17 +00:00
|
|
|
pcvt_param(tp, &tp->t_termios);
|
1999-01-01 08:23:23 +00:00
|
|
|
(*linesw[tp->t_line].l_modem)(tp, 1); /* fake connection */
|
|
|
|
winsz = 1; /* set winsize later */
|
|
|
|
}
|
2002-04-01 21:31:13 +00:00
|
|
|
else if (tp->t_state & TS_XCLUDE && suser(td))
|
2000-03-26 09:17:14 +00:00
|
|
|
{
|
1999-01-01 08:23:23 +00:00
|
|
|
return (EBUSY);
|
2000-03-26 09:17:14 +00:00
|
|
|
}
|
1999-01-01 08:23:23 +00:00
|
|
|
|
|
|
|
retval = ((*linesw[tp->t_line].l_open)(dev, tp));
|
|
|
|
|
|
|
|
if(winsz == 1)
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* The line discipline has clobbered t_winsize if TS_ISOPEN
|
|
|
|
* was clear. (NetBSD PR #400 from Bill Sommerfeld)
|
|
|
|
* We have to do this after calling the open routine, because
|
|
|
|
* it does some other things in other/older *BSD releases -hm
|
|
|
|
*/
|
|
|
|
|
|
|
|
s = spltty();
|
|
|
|
|
|
|
|
tp->t_winsize.ws_col = vsx->maxcol;
|
|
|
|
tp->t_winsize.ws_row = vsx->screen_rows;
|
|
|
|
tp->t_winsize.ws_xpixel = (vsx->maxcol == 80)? 720: 1056;
|
|
|
|
tp->t_winsize.ws_ypixel = 400;
|
|
|
|
|
|
|
|
splx(s);
|
|
|
|
}
|
|
|
|
return(retval);
|
|
|
|
}
|
|
|
|
|
2000-03-26 09:17:14 +00:00
|
|
|
/*---------------------------------------------------------------------------*
|
|
|
|
* driver close
|
|
|
|
*---------------------------------------------------------------------------*/
|
|
|
|
static int
|
2001-09-12 08:38:13 +00:00
|
|
|
pcvt_close(dev_t dev, int flag, int mode, struct thread *td)
|
1999-01-01 08:23:23 +00:00
|
|
|
{
|
|
|
|
register struct tty *tp;
|
|
|
|
register struct video_state *vsx;
|
|
|
|
int i = minor(dev);
|
|
|
|
|
|
|
|
vsx = &vs[i];
|
|
|
|
|
2000-03-26 09:17:14 +00:00
|
|
|
if(i >= PCVT_NSCREENS)
|
1999-01-01 08:23:23 +00:00
|
|
|
return ENXIO;
|
|
|
|
|
2000-04-16 09:33:17 +00:00
|
|
|
tp = &pcvt_tty[i];
|
2000-03-26 09:17:14 +00:00
|
|
|
|
1999-01-01 08:23:23 +00:00
|
|
|
(*linesw[tp->t_line].l_close)(tp, flag);
|
|
|
|
|
2000-03-26 09:17:14 +00:00
|
|
|
ttyclose(tp);
|
1999-01-01 08:23:23 +00:00
|
|
|
|
|
|
|
vsx->openf = 0;
|
|
|
|
|
2000-03-26 09:17:14 +00:00
|
|
|
#ifdef XSERVER
|
1999-01-01 08:23:23 +00:00
|
|
|
reset_usl_modes(vsx);
|
2000-03-26 09:17:14 +00:00
|
|
|
#endif /* XSERVER */
|
1999-01-01 08:23:23 +00:00
|
|
|
|
|
|
|
return(0);
|
|
|
|
}
|
|
|
|
|
2000-03-26 09:17:14 +00:00
|
|
|
/*---------------------------------------------------------------------------*
|
|
|
|
* driver ioctl
|
|
|
|
*---------------------------------------------------------------------------*/
|
|
|
|
static int
|
2001-09-12 08:38:13 +00:00
|
|
|
pcvt_ioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td)
|
1999-01-01 08:23:23 +00:00
|
|
|
{
|
1999-04-20 08:45:27 +00:00
|
|
|
register int error;
|
1999-01-01 08:23:23 +00:00
|
|
|
register struct tty *tp;
|
2000-03-26 09:17:14 +00:00
|
|
|
int i = minor(dev);
|
|
|
|
|
|
|
|
if(i >= PCVT_NSCREENS)
|
|
|
|
return ENXIO;
|
1999-01-01 08:23:23 +00:00
|
|
|
|
2000-04-16 09:33:17 +00:00
|
|
|
tp = &pcvt_tty[i];
|
1999-01-01 08:23:23 +00:00
|
|
|
|
|
|
|
/* note that some ioctl's are global, e.g. KBSTPMAT: There is
|
|
|
|
* only one keyboard and different repeat rates for instance between
|
|
|
|
* sessions are a suspicious wish. If you really need this make the
|
|
|
|
* appropriate variables arrays
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef XSERVER
|
2001-09-12 08:38:13 +00:00
|
|
|
if((error = usl_vt_ioctl(dev, cmd, data, flag, td)) >= 0)
|
1999-01-01 08:23:23 +00:00
|
|
|
return error;
|
|
|
|
#endif /* XSERVER */
|
|
|
|
|
|
|
|
if((error = kbdioctl(dev,cmd,data,flag)) >= 0)
|
|
|
|
return error;
|
|
|
|
|
|
|
|
if((error = vgaioctl(dev,cmd,data,flag)) >= 0)
|
|
|
|
return error;
|
|
|
|
|
2001-09-12 08:38:13 +00:00
|
|
|
if((error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, td))
|
1999-01-01 08:23:23 +00:00
|
|
|
!= ENOIOCTL)
|
|
|
|
return (error);
|
|
|
|
|
|
|
|
if((error = ttioctl(tp, cmd, data, flag)) != ENOIOCTL)
|
|
|
|
return (error);
|
|
|
|
|
|
|
|
return (ENOTTY);
|
|
|
|
}
|
|
|
|
|
2000-03-26 09:17:14 +00:00
|
|
|
/*---------------------------------------------------------------------------*
|
|
|
|
* driver mmap
|
|
|
|
*---------------------------------------------------------------------------*/
|
|
|
|
static int
|
2003-03-25 00:07:06 +00:00
|
|
|
pcvt_mmap(dev_t dev, vm_offset_t offset, vm_paddr_t *paddr, int nprot)
|
1999-01-01 08:23:23 +00:00
|
|
|
{
|
|
|
|
if (offset > 0x20000 - PAGE_SIZE)
|
|
|
|
return -1;
|
2003-02-25 03:21:22 +00:00
|
|
|
*paddr = 0xa0000 + offset;
|
|
|
|
return 0;
|
1999-01-01 08:23:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*---------------------------------------------------------------------------*
|
2000-03-26 09:17:14 +00:00
|
|
|
* timeout handler
|
1999-01-01 08:23:23 +00:00
|
|
|
*---------------------------------------------------------------------------*/
|
|
|
|
static void
|
|
|
|
pcvt_timeout(void *arg)
|
|
|
|
{
|
|
|
|
u_char *cp;
|
|
|
|
|
|
|
|
#if PCVT_SLOW_INTERRUPT
|
|
|
|
int s;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
pcvt_timeout_scheduled = 0;
|
|
|
|
|
|
|
|
#if PCVT_SCREENSAVER
|
|
|
|
pcvt_scrnsv_reset();
|
|
|
|
#endif /* PCVT_SCREENSAVER */
|
|
|
|
|
|
|
|
while (pcvt_kbd_count)
|
|
|
|
{
|
|
|
|
if (((cp = sgetc(1)) != 0) &&
|
|
|
|
(vs[current_video_screen].openf))
|
|
|
|
{
|
|
|
|
|
|
|
|
#if PCVT_NULLCHARS
|
|
|
|
if(*cp == '\0')
|
|
|
|
{
|
|
|
|
/* pass a NULL character */
|
2000-04-16 09:33:17 +00:00
|
|
|
(*linesw[pcvt_ttyp->t_line].l_rint)('\0', pcvt_ttyp);
|
1999-01-01 08:23:23 +00:00
|
|
|
}
|
|
|
|
/* XXX */ else
|
|
|
|
#endif /* PCVT_NULLCHARS */
|
|
|
|
|
|
|
|
while (*cp)
|
2000-04-16 09:33:17 +00:00
|
|
|
(*linesw[pcvt_ttyp->t_line].l_rint)(*cp++ & 0xff, pcvt_ttyp);
|
1999-01-01 08:23:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
PCVT_DISABLE_INTR ();
|
|
|
|
|
|
|
|
if (!pcvt_kbd_count)
|
|
|
|
pcvt_timeout_scheduled = 0;
|
|
|
|
|
|
|
|
PCVT_ENABLE_INTR ();
|
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2000-03-26 09:17:14 +00:00
|
|
|
/*---------------------------------------------------------------------------*
|
|
|
|
* check for keyboard
|
|
|
|
*---------------------------------------------------------------------------*/
|
1999-01-11 03:18:56 +00:00
|
|
|
static void
|
|
|
|
detect_kbd(void *arg)
|
|
|
|
{
|
|
|
|
int unit = (int)arg;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
if (kbd != NULL)
|
|
|
|
return;
|
2000-04-16 09:33:17 +00:00
|
|
|
i = kbd_allocate("*", -1, (void *)&kbd, pcvt_event, (void *)unit);
|
1999-01-11 03:18:56 +00:00
|
|
|
if (i >= 0)
|
|
|
|
kbd = kbd_get_keyboard(i);
|
|
|
|
if (kbd != NULL)
|
|
|
|
{
|
|
|
|
reset_keyboard = 1; /* ok to reset the keyboard */
|
|
|
|
kbd_code_init();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
reset_keyboard = 0;
|
|
|
|
timeout(detect_kbd, (void *)unit, hz*2);
|
|
|
|
}
|
|
|
|
|
2000-03-26 09:17:14 +00:00
|
|
|
/*---------------------------------------------------------------------------*
|
|
|
|
* keyboard event handler
|
|
|
|
*---------------------------------------------------------------------------*/
|
|
|
|
static int
|
2000-04-16 09:33:17 +00:00
|
|
|
pcvt_event(keyboard_t *thiskbd, int event, void *arg)
|
1999-01-11 03:18:56 +00:00
|
|
|
{
|
|
|
|
int unit = (int)arg;
|
|
|
|
|
|
|
|
if (thiskbd != kbd)
|
|
|
|
return EINVAL; /* shouldn't happen */
|
|
|
|
|
|
|
|
switch (event) {
|
|
|
|
case KBDIO_KEYINPUT:
|
2000-04-16 09:33:17 +00:00
|
|
|
pcvt_rint(unit);
|
1999-01-11 03:18:56 +00:00
|
|
|
return 0;
|
|
|
|
case KBDIO_UNLOADING:
|
1999-01-14 03:17:32 +00:00
|
|
|
reset_keyboard = 0;
|
1999-01-11 03:18:56 +00:00
|
|
|
kbd = NULL;
|
|
|
|
kbd_release(thiskbd, (void *)&kbd);
|
|
|
|
timeout(detect_kbd, (void *)unit, hz*4);
|
|
|
|
return 0;
|
|
|
|
default:
|
|
|
|
return EINVAL;
|
|
|
|
}
|
|
|
|
}
|
1999-01-01 08:23:23 +00:00
|
|
|
|
2000-03-26 09:17:14 +00:00
|
|
|
/*---------------------------------------------------------------------------*
|
|
|
|
* (keyboard) interrupt handler
|
|
|
|
*---------------------------------------------------------------------------*/
|
1999-01-01 08:23:23 +00:00
|
|
|
void
|
2000-04-16 09:33:17 +00:00
|
|
|
pcvt_rint(int unit)
|
1999-01-01 08:23:23 +00:00
|
|
|
{
|
|
|
|
u_char dt;
|
|
|
|
u_char ret = -1;
|
2000-03-26 09:17:14 +00:00
|
|
|
int c;
|
|
|
|
|
1999-01-01 08:23:23 +00:00
|
|
|
# if PCVT_SLOW_INTERRUPT
|
|
|
|
int s;
|
|
|
|
# endif
|
|
|
|
|
|
|
|
#if PCVT_SCREENSAVER
|
|
|
|
pcvt_scrnsv_reset();
|
|
|
|
#endif /* PCVT_SCREENSAVER */
|
|
|
|
|
|
|
|
if (kbd_polling)
|
|
|
|
{
|
|
|
|
sgetc(1);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
1999-01-11 03:18:56 +00:00
|
|
|
while ((c = (*kbdsw[kbd->kb_index]->read)(kbd, FALSE)) != -1)
|
1999-01-01 08:23:23 +00:00
|
|
|
{
|
|
|
|
ret = 1; /* got something */
|
|
|
|
dt = c;
|
|
|
|
|
|
|
|
if (pcvt_kbd_count >= PCVT_KBD_FIFO_SZ) /* fifo overflow ? */
|
|
|
|
{
|
|
|
|
log (LOG_WARNING, "pcvt: keyboard buffer overflow\n");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
pcvt_kbd_fifo[pcvt_kbd_wptr++] = dt; /* data -> fifo */
|
|
|
|
|
|
|
|
PCVT_DISABLE_INTR (); /* XXX necessary ? */
|
|
|
|
pcvt_kbd_count++; /* update fifo count */
|
|
|
|
PCVT_ENABLE_INTR ();
|
|
|
|
|
|
|
|
if (pcvt_kbd_wptr >= PCVT_KBD_FIFO_SZ)
|
|
|
|
pcvt_kbd_wptr = 0; /* wraparound pointer */
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ret == 1) /* got data from keyboard ? */
|
|
|
|
{
|
|
|
|
if (!pcvt_timeout_scheduled) /* if not already active .. */
|
|
|
|
{
|
|
|
|
PCVT_DISABLE_INTR ();
|
|
|
|
pcvt_timeout_scheduled = 1; /* flag active */
|
|
|
|
timeout(pcvt_timeout, NULL, hz / 100); /* fire off */
|
|
|
|
PCVT_ENABLE_INTR ();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-03-26 09:17:14 +00:00
|
|
|
/*---------------------------------------------------------------------------*
|
|
|
|
* start output
|
|
|
|
*---------------------------------------------------------------------------*/
|
|
|
|
static void
|
2000-04-16 09:33:17 +00:00
|
|
|
pcvt_start(register struct tty *tp)
|
1999-01-01 08:23:23 +00:00
|
|
|
{
|
|
|
|
register struct clist *rbp;
|
|
|
|
int s, len;
|
|
|
|
u_char buf[PCVT_PCBURST];
|
|
|
|
|
|
|
|
s = spltty();
|
|
|
|
|
|
|
|
if (tp->t_state & (TS_TIMEOUT|TS_BUSY|TS_TTSTOP))
|
|
|
|
goto out;
|
|
|
|
|
|
|
|
tp->t_state |= TS_BUSY;
|
|
|
|
|
|
|
|
splx(s);
|
|
|
|
|
|
|
|
async_update(UPDATE_KERN);
|
|
|
|
|
|
|
|
rbp = &tp->t_outq;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Call q_to_b() at spltty() to ensure that the queue is empty when
|
|
|
|
* the loop terminates.
|
|
|
|
*/
|
|
|
|
|
|
|
|
s = spltty();
|
|
|
|
|
1999-04-20 08:45:27 +00:00
|
|
|
while((len = q_to_b(rbp, buf, PCVT_PCBURST)) > 0)
|
1999-01-01 08:23:23 +00:00
|
|
|
{
|
1999-12-30 16:17:11 +00:00
|
|
|
if(vs[minor(tp->t_dev)].scrolling)
|
2000-03-26 09:17:14 +00:00
|
|
|
sgetc(SCROLLBACK_COOKIE);
|
1999-12-30 16:17:11 +00:00
|
|
|
|
1999-01-01 08:23:23 +00:00
|
|
|
/*
|
|
|
|
* We need to do this outside spl since it could be fairly
|
|
|
|
* expensive and we don't want our serial ports to overflow.
|
|
|
|
*/
|
|
|
|
splx(s);
|
|
|
|
sput(&buf[0], 0, len, minor(tp->t_dev));
|
|
|
|
s = spltty();
|
|
|
|
}
|
|
|
|
|
|
|
|
tp->t_state &= ~TS_BUSY;
|
|
|
|
|
|
|
|
ttwwakeup(tp);
|
|
|
|
|
|
|
|
out:
|
|
|
|
splx(s);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*---------------------------------------------------------------------------*
|
2000-03-26 09:17:14 +00:00
|
|
|
* console probe
|
1999-01-01 08:23:23 +00:00
|
|
|
*---------------------------------------------------------------------------*/
|
1999-01-07 14:14:24 +00:00
|
|
|
static void
|
2000-04-16 09:33:17 +00:00
|
|
|
pcvt_cn_probe(struct consdev *cp)
|
1999-01-01 08:23:23 +00:00
|
|
|
{
|
1999-06-29 17:36:20 +00:00
|
|
|
int unit = 0;
|
1999-01-11 03:18:56 +00:00
|
|
|
|
2003-07-02 16:09:02 +00:00
|
|
|
/* See if this driver is disabled in probe hint. */
|
|
|
|
if (resource_disabled("vt", unit))
|
2000-03-26 09:17:14 +00:00
|
|
|
{
|
The second phase of syscons reorganization.
- Split syscons source code into manageable chunks and reorganize
some of complicated functions.
- Many static variables are moved to the softc structure.
- Added a new key function, PREV. When this key is pressed, the vty
immediately before the current vty will become foreground. Analogue
to PREV, which is usually assigned to the PrntScrn key.
PR: kern/10113
Submitted by: Christian Weisgerber <naddy@mips.rhein-neckar.de>
- Modified the kernel console input function sccngetc() so that it
handles function keys properly.
- Reorganized the screen update routine.
- VT switching code is reorganized. It now should be slightly more
robust than before.
- Added the DEVICE_RESUME function so that syscons no longer hooks the
APM resume event directly.
- New kernel configuration options: SC_NO_CUTPASTE, SC_NO_FONT_LOADING,
SC_NO_HISTORY and SC_NO_SYSMOUSE.
Various parts of syscons can be omitted so that the kernel size is
reduced.
SC_PIXEL_MODE
Made the VESA 800x600 mode an option, rather than a standard part of
syscons.
SC_DISABLE_DDBKEY
Disables the `debug' key combination.
SC_ALT_MOUSE_IMAGE
Inverse the character cell at the mouse cursor position in the text
console, rather than drawing an arrow on the screen.
Submitted by: Nick Hibma (n_hibma@FreeBSD.ORG)
SC_DFLT_FONT
makeoptions "SC_DFLT_FONT=_font_name_"
Include the named font as the default font of syscons. 16-line,
14-line and 8-line font data will be compiled in. This option replaces
the existing STD8X16FONT option, which loads 16-line font data only.
- The VGA driver is split into /sys/dev/fb/vga.c and /sys/isa/vga_isa.c.
- The video driver provides a set of ioctl commands to manipulate the
frame buffer.
- New kernel configuration option: VGA_WIDTH90
Enables 90 column modes: 90x25, 90x30, 90x43, 90x50, 90x60. These
modes are mot always supported by the video card.
PR: i386/7510
Submitted by: kbyanc@freedomnet.com and alexv@sui.gda.itesm.mx.
- The header file machine/console.h is reorganized; its contents is now
split into sys/fbio.h, sys/kbio.h (a new file) and sys/consio.h
(another new file). machine/console.h is still maintained for
compatibility reasons.
- Kernel console selection/installation routines are fixed and
slightly rebumped so that it should now be possible to switch between
the interanl kernel console (sc or vt) and a remote kernel console
(sio) again, as it was in 2.x, 3.0 and 3.1.
- Screen savers and splash screen decoders
Because of the header file reorganization described above, screen
savers and splash screen decoders are slightly modified. After this
update, /sys/modules/syscons/saver.h is no longer necessary and is
removed.
1999-06-22 14:14:06 +00:00
|
|
|
cp->cn_pri = CN_DEAD;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
1999-06-29 17:36:20 +00:00
|
|
|
kbd_configure(KB_CONF_PROBE_ONLY);
|
2000-03-26 09:17:14 +00:00
|
|
|
|
1999-06-29 17:36:20 +00:00
|
|
|
if (kbd_find_keyboard("*", unit) < 0)
|
1999-04-20 08:45:27 +00:00
|
|
|
{
|
1999-06-29 17:36:20 +00:00
|
|
|
cp->cn_pri = CN_DEAD;
|
|
|
|
return;
|
1999-01-14 03:17:32 +00:00
|
|
|
}
|
1999-01-01 08:23:23 +00:00
|
|
|
|
|
|
|
/* initialize required fields */
|
|
|
|
|
2003-09-26 08:51:54 +00:00
|
|
|
sprintf(cp->cn_name, "ttyv%r", 0);
|
1999-01-01 08:23:23 +00:00
|
|
|
cp->cn_pri = CN_INTERNAL;
|
2000-04-16 09:33:17 +00:00
|
|
|
cp->cn_tp = &pcvt_tty[0];
|
1999-01-01 08:23:23 +00:00
|
|
|
}
|
|
|
|
|
2000-03-26 09:17:14 +00:00
|
|
|
/*---------------------------------------------------------------------------*
|
|
|
|
* console init
|
|
|
|
*---------------------------------------------------------------------------*/
|
1999-01-07 14:14:24 +00:00
|
|
|
static void
|
2000-04-16 09:33:17 +00:00
|
|
|
pcvt_cn_init(struct consdev *cp)
|
1999-01-01 08:23:23 +00:00
|
|
|
{
|
1999-06-29 17:36:20 +00:00
|
|
|
int unit = 0;
|
|
|
|
int i;
|
|
|
|
|
1999-01-01 08:23:23 +00:00
|
|
|
pcvt_is_console = 1;
|
1999-06-29 17:36:20 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Don't reset the keyboard via `kbdio' just yet.
|
|
|
|
* The system clock has not been calibrated...
|
|
|
|
*/
|
|
|
|
reset_keyboard = 0;
|
|
|
|
|
|
|
|
if (kbd)
|
|
|
|
{
|
|
|
|
kbd_release(kbd, (void *)&kbd);
|
|
|
|
kbd = NULL;
|
|
|
|
}
|
2000-03-26 09:17:14 +00:00
|
|
|
|
2000-04-16 09:33:17 +00:00
|
|
|
i = kbd_allocate("*", -1, (void *)&kbd, pcvt_event, (void *)unit);
|
2000-03-26 09:17:14 +00:00
|
|
|
|
1999-06-29 17:36:20 +00:00
|
|
|
if (i >= 0)
|
|
|
|
kbd = kbd_get_keyboard(i);
|
|
|
|
|
|
|
|
#if PCVT_SCANSET == 2
|
|
|
|
/*
|
2002-04-09 11:18:46 +00:00
|
|
|
* Turn off scancode translation early so that
|
|
|
|
* DDB can read the keyboard.
|
1999-06-29 17:36:20 +00:00
|
|
|
*/
|
|
|
|
if (kbd)
|
|
|
|
{
|
|
|
|
empty_both_buffers(*(KBDC *)kbd->kb_data, 10);
|
|
|
|
set_controller_command_byte(*(KBDC *)kbd->kb_data,
|
|
|
|
KBD_TRANSLATION, 0);
|
|
|
|
}
|
|
|
|
#endif /* PCVT_SCANSET == 2 */
|
1999-01-01 08:23:23 +00:00
|
|
|
}
|
|
|
|
|
2000-03-26 09:17:14 +00:00
|
|
|
/*---------------------------------------------------------------------------*
|
|
|
|
* console finish
|
|
|
|
*---------------------------------------------------------------------------*/
|
1999-06-29 17:36:20 +00:00
|
|
|
static void
|
2000-04-16 09:33:17 +00:00
|
|
|
pcvt_cn_term(struct consdev *cp)
|
1999-06-29 17:36:20 +00:00
|
|
|
{
|
|
|
|
if (kbd)
|
|
|
|
{
|
|
|
|
kbd_release(kbd, (void *)&kbd);
|
|
|
|
kbd = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-03-26 09:17:14 +00:00
|
|
|
/*---------------------------------------------------------------------------*
|
|
|
|
* console put char
|
|
|
|
*---------------------------------------------------------------------------*/
|
1999-01-07 14:14:24 +00:00
|
|
|
static void
|
2003-02-20 20:54:45 +00:00
|
|
|
pcvt_cn_putc(struct consdev *cd, int c)
|
1999-01-01 08:23:23 +00:00
|
|
|
{
|
|
|
|
if (c == '\n')
|
|
|
|
sput("\r", 1, 1, 0);
|
|
|
|
|
|
|
|
sput((char *) &c, 1, 1, 0);
|
|
|
|
|
|
|
|
async_update(UPDATE_KERN);
|
|
|
|
}
|
|
|
|
|
2000-03-26 09:17:14 +00:00
|
|
|
/*---------------------------------------------------------------------------*
|
|
|
|
* console get char
|
|
|
|
*---------------------------------------------------------------------------*/
|
1999-01-07 14:14:24 +00:00
|
|
|
static int
|
2003-02-20 20:54:45 +00:00
|
|
|
pcvt_cn_getc(struct consdev *cd)
|
1999-01-01 08:23:23 +00:00
|
|
|
{
|
|
|
|
register int s;
|
|
|
|
static u_char *cp, cbuf[4]; /* Temp buf for multi-char key sequence. */
|
|
|
|
register u_char c;
|
|
|
|
|
|
|
|
#ifdef XSERVER
|
|
|
|
if (pcvt_kbd_raw)
|
|
|
|
return 0;
|
|
|
|
#endif /* XSERVER */
|
|
|
|
|
|
|
|
if (cp && *cp)
|
2000-03-26 09:17:14 +00:00
|
|
|
{
|
1999-01-01 08:23:23 +00:00
|
|
|
/*
|
|
|
|
* We still have a pending key sequence, e.g.
|
|
|
|
* from an arrow key. Deliver this one first.
|
|
|
|
*/
|
|
|
|
return (*cp++);
|
2000-03-26 09:17:14 +00:00
|
|
|
}
|
1999-01-01 08:23:23 +00:00
|
|
|
|
1999-06-29 17:36:20 +00:00
|
|
|
if (kbd == NULL)
|
|
|
|
return 0;
|
|
|
|
|
2000-04-16 09:33:17 +00:00
|
|
|
s = spltty(); /* block pcvt_rint while we poll */
|
1999-01-01 08:23:23 +00:00
|
|
|
kbd_polling = 1;
|
1999-01-11 03:18:56 +00:00
|
|
|
(*kbdsw[kbd->kb_index]->enable)(kbd);
|
1999-01-01 08:23:23 +00:00
|
|
|
cp = sgetc(0);
|
1999-01-11 03:18:56 +00:00
|
|
|
(*kbdsw[kbd->kb_index]->disable)(kbd);
|
1999-01-01 08:23:23 +00:00
|
|
|
kbd_polling = 0;
|
|
|
|
splx(s);
|
2000-03-26 09:17:14 +00:00
|
|
|
|
1999-01-01 08:23:23 +00:00
|
|
|
c = *cp++;
|
2000-03-26 09:17:14 +00:00
|
|
|
|
|
|
|
if (c && *cp)
|
|
|
|
{
|
1999-01-01 08:23:23 +00:00
|
|
|
/* Preserve the multi-char sequence for the next call. */
|
|
|
|
bcopy(cp, cbuf, 3); /* take care for a trailing '\0' */
|
|
|
|
cp = cbuf;
|
2000-03-26 09:17:14 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
1999-01-01 08:23:23 +00:00
|
|
|
cp = 0;
|
2000-03-26 09:17:14 +00:00
|
|
|
}
|
1999-01-01 08:23:23 +00:00
|
|
|
return c;
|
|
|
|
}
|
|
|
|
|
2000-03-26 09:17:14 +00:00
|
|
|
/*---------------------------------------------------------------------------*
|
|
|
|
* console check for char
|
|
|
|
*---------------------------------------------------------------------------*/
|
1999-01-07 14:14:24 +00:00
|
|
|
static int
|
2003-02-20 20:54:45 +00:00
|
|
|
pcvt_cn_checkc(struct consdev *cd)
|
1999-01-01 08:23:23 +00:00
|
|
|
{
|
|
|
|
char *cp;
|
1999-06-29 17:36:20 +00:00
|
|
|
int x;
|
|
|
|
|
|
|
|
if (kbd == NULL)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
x = spltty();
|
1999-01-01 08:23:23 +00:00
|
|
|
kbd_polling = 1;
|
1999-01-11 03:18:56 +00:00
|
|
|
(*kbdsw[kbd->kb_index]->enable)(kbd);
|
1999-01-01 08:23:23 +00:00
|
|
|
cp = sgetc(1);
|
1999-01-11 03:18:56 +00:00
|
|
|
(*kbdsw[kbd->kb_index]->disable)(kbd);
|
1999-01-01 08:23:23 +00:00
|
|
|
kbd_polling = 0;
|
|
|
|
splx(x);
|
|
|
|
|
2000-03-26 09:17:14 +00:00
|
|
|
return (cp == NULL ? -1 : *cp);
|
1999-01-01 08:23:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*---------------------------------------------------------------------------*
|
|
|
|
* Set line parameters
|
|
|
|
*---------------------------------------------------------------------------*/
|
2000-03-26 09:17:14 +00:00
|
|
|
static int
|
2000-04-16 09:33:17 +00:00
|
|
|
pcvt_param(struct tty *tp, struct termios *t)
|
1999-01-01 08:23:23 +00:00
|
|
|
{
|
|
|
|
tp->t_ispeed = t->c_ispeed;
|
|
|
|
tp->t_ospeed = t->c_ospeed;
|
2000-03-26 09:17:14 +00:00
|
|
|
tp->t_cflag = t->c_cflag;
|
1999-01-01 08:23:23 +00:00
|
|
|
|
|
|
|
return(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------*
|
|
|
|
* read initial VGA palette (as stored by VGA ROM BIOS) into
|
|
|
|
* palette save area
|
|
|
|
*----------------------------------------------------------------------*/
|
2000-03-26 09:17:14 +00:00
|
|
|
static void
|
1999-01-01 08:23:23 +00:00
|
|
|
vgapelinit(void)
|
|
|
|
{
|
|
|
|
register unsigned idx;
|
|
|
|
register struct rgb *val;
|
|
|
|
|
|
|
|
/* first, read all and store to first screen's save buffer */
|
|
|
|
for(idx = 0, val = vs[0].palette; idx < NVGAPEL; idx++, val++)
|
|
|
|
vgapaletteio(idx, val, 0 /* read it */);
|
|
|
|
|
|
|
|
/* now, duplicate for remaining screens */
|
|
|
|
for(idx = 1; idx < PCVT_NSCREENS; idx++)
|
|
|
|
bcopy(vs[0].palette, vs[idx].palette,
|
|
|
|
NVGAPEL * sizeof(struct rgb));
|
|
|
|
}
|
|
|
|
|
|
|
|
/*-------------------------- E O F -------------------------------------*/
|