*BSD News Article 9912


Return to BSD News archive

Received: by minnie.vk1xwt.ampr.org with NNTP
	id AA6793 ; Fri, 15 Jan 93 10:34:11 EST
Xref: sserve comp.unix.bsd:9969 alt.sources:4990
Path: sserve!manuel.anu.edu.au!munnari.oz.au!sgiblab!darwin.sura.net!newsserver.jvnc.net!yale.edu!ira.uka.de!Germany.EU.net!hcshh!hm
From: hm@hcshh.hcs.de (Hellmuth Michaelis)
Newsgroups: comp.unix.bsd,alt.sources
Subject: [386BSD] pcvt 2.00 - VT220 console driver (part 08/11)
Summary: 386BSD 0.1 VT220 console device driver source code
Keywords: 386BSD console driver VT220
Message-ID: <1624@hcshh.hcs.de>
Date: 15 Jan 93 13:02:55 GMT
Followup-To: comp.unix.bsd
Organization: HCS GmbH, Hamburg, Europe
Lines: 1929

Submitted-by: hm@hcshh.hcs.de (Hellmuth Michaelis)
Archive-name: pcvt-2.00/part08

---- Cut Here and unpack ----
#!/bin/sh
# This is part 08 of pcvt-2.00
if touch 2>&1 | fgrep '[-amc]' > /dev/null
 then TOUCH=touch
 else TOUCH=true
fi
# ============= Support/cursor/cursor.1 ==============
if test ! -d 'Support/cursor'; then
    echo "x - creating directory Support/cursor"
    mkdir 'Support/cursor'
fi
if test X"$1" != X"-c" -a -f 'Support/cursor/cursor.1'; then
	echo "File already exists: skipping 'Support/cursor/cursor.1'"
else
echo "x - extracting Support/cursor/cursor.1 (Text)"
sed 's/^X//' << 'SHAR_EOF' > Support/cursor/cursor.1 &&
X.\" Copyright (c) 1992, 1993 Hellmuth Michaelis
X.\"
X.\" All rights reserved.
X.\" 
X.\" This driver is contributed to the 386BSD operating system.
X.\"
X.\" Redistribution and use in source and binary forms, with or without
X.\" modification, are permitted provided that the following conditions
X.\" are met:
X.\" 1. Redistributions of source code must retain the above copyright
X.\"    notice, this list of conditions and the following disclaimer.
X.\" 2. Redistributions in binary form must reproduce the above copyright
X.\"    notice, this list of conditions and the following disclaimer in the
X.\"    documentation and/or other materials provided with the distribution.
X.\" 3. All advertising materials mentioning features or use of this software
X.\"    must display the following acknowledgement:
X.\"    This product includes software contributed to 386BSD and developed
X.\"      by Hellmuth Michaelis
X.\" 4. Neither the name of the developers nor the names "386BSD" and "pcvt"
X.\"    may be used to endorse or promote products derived from this software
X.\"    without specific prior written permission.
X.\"  
X.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
X.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
X.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
X.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
X.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
X.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
X.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
X.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
X.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
X.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
X.\"
X.\"	@(#)cursor.1		2.00		   (contributed to 386BSD)
X.\"				Last Edit-Date: [Sun Jan  3 15:32:24 1993]
X.\"
X.Dd January 3, 1993
X.Dt CURSOR 1
X.Os 386BSD 0.1
X.Sh NAME
X.Nm cursor
X.Nd set cursor shape for the pcvt 2.0 vt220 driver
X.Sh SYNOPSIS
X.Nm cursor
X.Op Fl n Ar screenno
X.Op Fl s Ar lineno
X.Op Fl e Ar lineno
X.Sh DESCRIPTION
XThe
X.Nm cursor
Xutility allows the user to set the cursor shape in a given virtual screen
Xof the above mentioned driver.
X.Pp
XThe options are as follows:
X.Bl -tag -width Ds
X.It Fl n
XSets the virtual screen number to apply the following paramters to. Not
Xspecifying this parameter implies the current virtual screen.
X.It Fl s
XSpecifies the starting (top) scanline the cursor should have.
X.It Fl e
XSpecifies the last (bottom) scanline the cursor should have.
X.El
X.Pp
XBe aware of the fact that the paramters need to be adjusted for the current
Xsize of the characterfont in use, on EGA and VGA boards sizes of 8, 14 and
X16 scanlines are currently supported.
X.Sh EXAMPLES
XThe command
X.Dq Li cursor -s3 -e10
Xsets the cursor on the current virtual screen to a rectangular shape on a
X14 line VGA screen.
X.Sh BUGS
XNo known bugs
X.Sh SEE ALSO
X.Xr loadfont 1 ,
X.Xr scon 1 ,
X.Xr pcvt 8
SHAR_EOF
$TOUCH -am 0113141093 Support/cursor/cursor.1 &&
chmod 0640 Support/cursor/cursor.1 ||
echo "restore of Support/cursor/cursor.1 failed"
set `wc -c Support/cursor/cursor.1`;Wc_c=$1
if test "$Wc_c" != "3059"; then
	echo original size 3059, current size $Wc_c
fi
fi
# ============= Support/cursor/cursor.c ==============
if test X"$1" != X"-c" -a -f 'Support/cursor/cursor.c'; then
	echo "File already exists: skipping 'Support/cursor/cursor.c'"
else
echo "x - extracting Support/cursor/cursor.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > Support/cursor/cursor.c &&
X/*
X * Copyright (c) 1992, 1993 Hellmuth Michaelis, Brian Dunford-Shore
X *
X * All rights reserved.
X *
X * This program is contributed to the 386BSD operating system.
X *
X * Redistribution and use in source and binary forms, with or without
X * modification, are permitted provided that the following conditions
X * are met:
X * 1. Redistributions of source code must retain the above copyright
X *    notice, this list of conditions and the following disclaimer.
X * 2. Redistributions in binary form must reproduce the above copyright
X *    notice, this list of conditions and the following disclaimer in the
X *    documentation and/or other materials provided with the distribution.
X * 3. All advertising materials mentioning features or use of this software
X *    must display the following acknowledgement:
X *	This product includes software contributed to 386BSD and developed
X *      by Hellmuth Michaelis, Brian Dunford-Shore, Joerg Wunsch
X *         and Scott Turner.
X * 4. Neither the name of the developers nor the names "386BSD" and "pcvt"
X *    may be used to endorse or promote products derived from this software
X *    without specific prior written permission.
X *
X * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
X * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
X * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
X * IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
X * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
X * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
X * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
X * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
X * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
X * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
X */
X
X/*
X *	@(#)cursor.c	1.10                       (contributed to 386BSD)
X *				Last Edit-Date: [Sun Jan  3 15:33:55 1993]
X */
X
X#include <stdio.h>
X#include <sys/pcvt_ioctl.h>
X
Xmain(argc,argv)
Xint argc;
Xchar *argv[];
X{
X	extern int optind;
X	extern int opterr;
X	extern char *optarg;
X
X	struct cursorshape cursorshape;
X	int c;
X	int screen = -1;
X	int start = -1;
X	int end = -1;
X	
X	while( (c = getopt(argc, argv, "n:s:e:")) != EOF)
X	{
X		switch(c)
X		{
X			case 'n':
X				screen = atoi(optarg);
X				break;
X				
X			case 's':
X				start = atoi(optarg);
X				break;
X				
X			case 'e':
X				end = atoi(optarg);
X				break;
X
X			case '?':
X			default:
X				usage();
X				break;
X		}
X	}
X
X	if(start == -1 || end == -1)	
X		usage();
X
X	cursorshape.start = start;
X	cursorshape.end = end;
X	cursorshape.screen_no = screen;
X
X	if(ioctl(1, VGACURSOR, &cursorshape) == -1)
X	{
X		perror("cursor - ioctl VGACURSOR failed, error");
X		exit(1);
X	}
X	else
X		exit(0);
X}
X
Xusage()
X{
X	fprintf(stderr,"\ncursor - set cursor shape for pcvt video driver\n");
X	fprintf(stderr,"usage: cursor -n [no] -s [line] -e [line]\n");
X	fprintf(stderr,"       -n <no>   screen no if specified, else current screen\n");
X	fprintf(stderr,"       -s <line> start scan line (topmost scan line)\n");
X	fprintf(stderr,"       -e <line> ending scan line (bottom scan line)\n\n");
X	exit(1);
X}
X
SHAR_EOF
$TOUCH -am 0113141093 Support/cursor/cursor.c &&
chmod 0640 Support/cursor/cursor.c ||
echo "restore of Support/cursor/cursor.c failed"
set `wc -c Support/cursor/cursor.c`;Wc_c=$1
if test "$Wc_c" != "3231"; then
	echo original size 3231, current size $Wc_c
fi
fi
# ============= Support/cursor/Makefile ==============
if test X"$1" != X"-c" -a -f 'Support/cursor/Makefile'; then
	echo "File already exists: skipping 'Support/cursor/Makefile'"
else
echo "x - extracting Support/cursor/Makefile (Text)"
sed 's/^X//' << 'SHAR_EOF' > Support/cursor/Makefile &&
XPROG=	cursor
X
X.include <bsd.prog.mk>
X
Xcursor.c:	/usr/include/sys/pcvt_ioctl.h
X
X/usr/include/sys/pcvt_ioctl.h: ../../pcvt_ioctl.h
X	cp ../../pcvt_ioctl.h /usr/include/sys
SHAR_EOF
$TOUCH -am 0113151193 Support/cursor/Makefile &&
chmod 0660 Support/cursor/Makefile ||
echo "restore of Support/cursor/Makefile failed"
set `wc -c Support/cursor/Makefile`;Wc_c=$1
if test "$Wc_c" != "169"; then
	echo original size 169, current size $Wc_c
fi
fi
# ============= pcvt_drv.c ==============
if test X"$1" != X"-c" -a -f 'pcvt_drv.c'; then
	echo "File already exists: skipping 'pcvt_drv.c'"
else
echo "x - extracting pcvt_drv.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > pcvt_drv.c &&
X/*
X * Copyright (c) 1992, 1993 Hellmuth Michaelis, Brian Dunford-Shore,
X * Joerg Wunsch and Scott Turner.
X *
X * All rights reserved.
X *
X * This code is derived from software contributed to Berkeley by
X * William Jolitz and Don Ahn.
X *
X * This driver is contributed to the 386BSD operating system.
X *
X * Redistribution and use in source and binary forms, with or without
X * modification, are permitted provided that the following conditions
X * are met:
X * 1. Redistributions of source code must retain the above copyright
X *    notice, this list of conditions and the following disclaimer.
X * 2. Redistributions in binary form must reproduce the above copyright
X *    notice, this list of conditions and the following disclaimer in the
X *    documentation and/or other materials provided with the distribution.
X * 3. All advertising materials mentioning features or use of this software
X *    must display the following acknowledgement:
X *	This product includes software contributed to 386BSD and developed
X *      by Hellmuth Michaelis, Brian Dunford-Shore, Joerg Wunsch
X *         and Scott Turner.
X * 4. Neither the name of the developers nor the names "386BSD" and "pcvt"
X *    may be used to endorse or promote products derived from this software
X *    without specific prior written permission.
X *
X * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
X * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
X * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
X * IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
X * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
X * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
X * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
X * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
X * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
X * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
X */
X
X/*
X *	@(#)pcvt_drv.c		2.00               (contributed to 386BSD)
X *				Last Edit-Date: [Tue Jan 12 13:54:59 1993]
X */
X
X/*---------------------------------------------------------------------------*
X *
X *	pcvt_drv.c	VT220 Driver Main Module / OS - Interface
X *	---------------------------------------------------------
X *
X *	Hellmuth Michaelis, hm@hcshh.hcs.de
X *
X *	-hm	patch from Frank Maclachlan, fpm@crash.cts.com
X *		(system crash by scrolling back in 'less', 25 aug 92)
X *	-hm	minor housekeeping all the time ...
X *	-hm	masking minor driver number
X *	-hm	keyboard type display
X *	-hm	screen resizeing at kernel level from scotty
X *
X *---------------------------------------------------------------------------*/
X
X#define EXTERN			/* allocate mem */
X
X#include "machine/stdarg.h"
X#include "pcvt_hdr.h"		/* global include */
X
Xunsigned	__debug = 0; /*0xffe */;
Xstatic		__color;
Xstatic		nrow;
X
Xstatic void vgapelinit(void);	/* read initial VGA DAC palette */
X
X#define	DPAUSE 1
X
Xpcattach(struct isa_device *dev)
X{
X	switch(adaptor_type)
X	{
X		case MDA_ADAPTOR:
X			printf(" <mda");
X			break;
X
X		case HGC_ADAPTOR:
X			printf(" <hgc");
X			break;
X
X		case CGA_ADAPTOR:
X			printf(" <cga");
X			break;
X
X		case EGA_ADAPTOR:
X			printf(" <ega");
X			break;
X
X		case VGA_ADAPTOR:
X			printf(" <vga");
X			vgapelinit();
X			break;
X
X		default:
X			printf(" <unknown");
X			break;
X	}
X
X	if(color == 0)
X		printf("-mono / ");
X	else
X		printf("-color / ");
X
X	switch(keyboard_type)
X	{
X		case KB_AT:
X			printf("at-keyboard>");
X			break;
X			
X		case KB_MFII:
X			printf("mf2-keyboard>");
X			break;
X			
X		default:
X			printf("unknown keyboard>");
X			break;
X	}
X
X	average(0);		/* fire off load average display */
X}
X
X/* had a look at the friedl driver */
X
Xstruct tty *get_pccons(dev_t dev)
X{
X	int i = (minor(dev) & MINORMASK);
X	if(i > NSCREENS-1)
X		return(NULL);
X	return(&pccons[i]);
X}
X
X/*---------------------------------------------------------------------------*
X *		/dev/pc0, /dev/pc1, /dev/pc2, /dev/pc3
X *---------------------------------------------------------------------------*/
Xpcopen(dev_t dev, int flag, int mode, struct proc *p)
X{
X	register struct tty *tp;
X	int i = (minor(dev) & MINORMASK);
X	
X	if((tp = get_pccons(dev)) == NULL)
X		return ENXIO;
X		
X	vs[i].openf++;
X	
X	tp->t_oproc = pcstart;
X	tp->t_param = pcparam;
X	tp->t_dev = dev;
X
X	if ((tp->t_state & TS_ISOPEN) == 0)
X	{
X		tp->t_state |= TS_WOPEN;
X		ttychars(tp);
X		tp->t_iflag = TTYDEF_IFLAG;
X		tp->t_oflag = TTYDEF_OFLAG;
X		tp->t_cflag = TTYDEF_CFLAG;
X		tp->t_lflag = TTYDEF_LFLAG;
X		tp->t_ispeed = tp->t_ospeed = TTYDEF_SPEED;
X		pcparam(tp, &tp->t_termios);
X		ttsetwater(tp);
X	}
X	else if (tp->t_state&TS_XCLUDE && p->p_ucred->cr_uid != 0)
X		return (EBUSY);
X	tp->t_state |= TS_CARR_ON;
X	return ((*linesw[tp->t_line].l_open)(dev, tp));
X}
X
Xpcclose(dev_t dev, int flag, int mode, struct proc *p)
X{
X	register struct tty *tp;
X	int i = (minor(dev) & MINORMASK);
X	
X	if((tp = get_pccons(dev)) == NULL)
X		return ENXIO;
X
X	(*linesw[tp->t_line].l_close)(tp, flag);
X	ttyclose(tp);
X	vs[i].openf = 0;
X	return(0);
X}
X
Xpcread(dev_t dev, struct uio *uio, int flag)
X{
X	register struct tty *tp;
X
X	if((tp = get_pccons(dev)) == NULL)
X		return ENXIO;
X		
X#ifndef SEVEN_BITS
X	/* this does not belong to here, but anybody always wants to
X	   strip the 8th bit, very likely the shell */
X
X	tp->t_iflag &= ~ISTRIP;		
X#endif
X
X	return ((*linesw[tp->t_line].l_read)(tp, uio, flag));
X}
X
Xpcwrite(dev_t dev, struct uio *uio, int flag)
X{
X	register struct tty *tp;
X
X	if((tp = get_pccons(dev)) == NULL)
X		return ENXIO;
X
X	return ((*linesw[tp->t_line].l_write)(tp, uio, flag));
X}
X
Xpcioctl(dev_t dev, int cmd, caddr_t data, int flag)
X{
X	register error;
X	register struct tty *tp;
X
X	if((tp = get_pccons(dev)) == NULL)
X		return(ENXIO);
X
X	/* note that some ioctl's are global, e.g.  KBSTPMAT: There is
X	 * only one keyboard and different repeat rates for instance between
X	 * sessions are a suspicious wish. If you really need this make the
X	 * appropriate variables arrays
X	 */
X
X	if((error = kbdioctl(dev,cmd,data,flag)) >= 0)
X		return error;
X
X	if((error = vgaioctl(dev,cmd,data,flag)) >= 0)
X		return error;
X		
X	if((error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag)) >= 0)
X		return (error);
X
X	if((error = ttioctl(tp, cmd, data, flag)) >= 0)
X		return (error);
X
X	return (ENOTTY);
X}
X
Xint pcmmap(dev_t dev, int offset, int nprot)
X{
X	if (offset > 0x20000)
X		return -1;
X	return i386_btop((0xa0000 + offset));
X}
X
X/*---------------------------------------------------------------------------*
X *		common code for /dev/pcX and /dev/console
X *---------------------------------------------------------------------------*/
X
X/*---------------------------------------------------------------------------*
X * Got a console receive interrupt - the console processor wants to give us
X * a character. Catch the character, and see who it goes to.
X *---------------------------------------------------------------------------*/
Xpcrint(dev_t dev, int irq, int cpl)
X{
X
X#ifdef KDB	
X	int c;
X#endif
X
X	u_char *cp;
X
X#ifdef PCVT_SCREENSAVER
X	pcvt_scrnsv_reset();
X#endif
X	
X	cp = sgetc(1);
X
X	if (cp == 0)
X		return;
X
X	if (pcconsoftc.cs_flags & CSF_POLLING)
X		return;
X
X#ifdef KDB
X	if (kdbrintr(c, pcconsp))
X		return;
X#endif
X
X	if(!vs[(minor(dev) & MINORMASK)].openf)
X		return;
X
X#ifdef ENABLE_NULLCHARS
X	if(*cp == 0)
X	{
X		/* pass a NULL character */
X		(*linesw[pcconsp->t_line].l_rint)(0, pcconsp);
X		return;
X	}
X
X#endif /* ENABLE_NULLCHARS */
X
X	while (*cp)
X		(*linesw[pcconsp->t_line].l_rint)(*cp++ & 0xff, pcconsp);
X}
X
X/*---------------------------------------------------------------------------*
X * Got a console transmission interrupt - the console processor wants
X * another character.
X *---------------------------------------------------------------------------*/
Xpcxint(dev_t dev)
X{
X	if (!pcconsintr)
X		return;
X
X	pccons[0].t_state &= ~TS_BUSY;
X	pcconsoftc.cs_timo = 0;
X	if (pccons[0].t_line)
X		(*linesw[pccons[0].t_line].l_start)(&pccons[0]);
X	else
X		pcstart(&pccons[0]);
X}
X
Xpcstart(struct tty *tp)
X{
X	int c, s;
X	
X	s = spltty();
X
X	if (tp->t_state & (TS_TIMEOUT|TS_BUSY|TS_TTSTOP))
X	{
X		goto out;
X	}
X	
X	for(;;)
X	{
X		if (RB_LEN(&tp->t_out) <= tp->t_lowat)
X		{
X			if (tp->t_state&TS_ASLEEP)
X			{
X				tp->t_state &= ~TS_ASLEEP;
X				wakeup((caddr_t)&tp->t_out);
X			}
X
X			if (tp->t_wsel)
X			{
X				selwakeup(tp->t_wsel, tp->t_state & TS_WCOLL);
X				tp->t_wsel = 0;
X				tp->t_state &= ~TS_WCOLL;
X			}
X		}
X
X		if (RB_LEN(&tp->t_out) == 0)
X		{
X			goto out;
X		}
X
X		c = getc(&tp->t_out);
X
X		tp->t_state |= TS_BUSY;	/* patch from Frank Maclachlan */
X		splx(s);
X		sput(c, 0, (minor(tp->t_dev) & MINORMASK));
X		(void)spltty();
X		tp->t_state &= ~TS_BUSY; /* patch from Frank Maclachlan */
X	}
X
Xout:
X	splx(s);
X}
X
X/*---------------------------------------------------------------------------*
X *		/dev/console
X *---------------------------------------------------------------------------*/
X
Xconsinit()	/* init for kernel messages during boot */
X{
X}
X 
Xpccnprobe(struct consdev *cp)
X{
X	int maj;
X	int i;
X
X	/* locate the major number */
X	
X	for (maj = 0; maj < nchrdev; maj++)
X	{
X		if (cdevsw[maj].d_open == pcopen)
X			break;
X	}
X	
X	/* initialize required fields */
X
X	cp->cn_dev = makedev(maj, 0);
X	cp->cn_tp = &pccons[0];
X	cp->cn_pri = CN_INTERNAL;
X
X	/* Load pointers to pccons into vs */
X
X	for(i = 0; i < NSCREENS; i++)
X		vs[i].vs_tty = &pccons[i];
X}
X
Xpccninit(struct consdev *cp)
X{
X}
X
Xpccnputc(dev_t dev, u_char c)
X{
X	if (c == '\n')
X		sput('\r', 1, 0);
X	sput(c, 1, 0);
X}
X
Xpccngetc(dev_t dev)
X{
X	register int s;
X	register u_char *cp;
X
X	s = spltty();		/* block pcrint while we poll */
X	cp = sgetc(0);
X	splx(s);
X	if (*cp == '\r')
X		return('\n');
X	return (*cp);
X}
X
X/*---------------------------------------------------------------------------*
X *	Set line parameters
X *---------------------------------------------------------------------------*/
Xpcparam(struct tty *tp, struct termios *t)
X{
X	register int cflag = t->c_cflag;
X
X        /* and copy to tty */
X
X        tp->t_ispeed = t->c_ispeed;
X        tp->t_ospeed = t->c_ospeed;
X        tp->t_cflag = cflag;
X
X	return(0);
X}
X
X#ifdef KDB
X/*
X * Turn input polling on/off (used by debugger).
X */
Xpcpoll(onoff)
Xint onoff;
X{
X}
X#endif
X
Xint pg(char *p, int q, int r, int s, int t, int u, int v, int w, int x, int y, int z)
X{
X	vgapage(0);
X	printf(p,q,r,s,t,u,v,w,x,y,z);
X	printf("\n");
X	return(getchar());
X}
X
X/* special characters */
X#define bs	8
X#define lf	10	
X#define cr	13	
X#define cntlc	3	
X#define del	0177	
X#define cntld	4
X
Xgetchar()
X{
X	u_char	thechar;
X	int	x;
X
X	pcconsoftc.cs_flags |= CSF_POLLING;
X	x = splhigh();
X	sput('>', 1, 0);
X
X	thechar = *(sgetc(0));
X	pcconsoftc.cs_flags &= ~CSF_POLLING;
X	splx(x);
X
X	switch (thechar)
X	{
X		default:
X			if (thechar >= ' ')
X				sput(thechar, 1, 0);
X			return(thechar);
X
X		case cr:
X		case lf:
X			sput('\r', 1, 0);
X			sput('\n', 1, 0);
X			return(lf);
X
X		case bs:
X		case del:
X			 sput('\b', 1, 0);
X			 sput(' ', 1, 0);
X			 sput('\b', 1, 0);
X			 return(thechar);
X
X		case cntlc:
X			 sput('^', 1, 0) ; sput('C', 1, 0) ; sput('\r', 1, 0) ; sput('\n', 1, 0) ;
X			 cpu_reset();
X
X		case cntld:
X			 sput('^', 1, 0) ; sput('D', 1, 0) ; sput('\r', 1, 0) ; sput('\n', 1, 0) ;
X			 return(0);
X	}
X}
X
Xvoid dprintf(unsigned flgs, const char *fmt, ...)
X{
X	extern unsigned __debug;
X	va_list ap;
X
X	if((flgs&__debug) > DPAUSE)
X	{
X		__color = ffs(flgs&__debug)+1;
X		va_start(ap,fmt);
X		kprintf(fmt, 1, (struct tty *)0, ap);
X		va_end(ap);
X
X		if (flgs&DPAUSE || nrow%24 == 23)
X		{ 
X			int x;
X			x = splhigh();
X			if(nrow%24 == 23)
X				nrow = 0;
X			(void)sgetc(0);
X			splx(x);
X		}
X	}
X	__color = 0;
X}
X
X/*----------------------------------------------------------------------*
X *	read initial VGA palette (as stored by VGA ROM BIOS) into
X *	palette save area
X *----------------------------------------------------------------------*/
Xvoid vgapelinit(void)
X{
X	register unsigned idx;
X	register struct rgb *val;
X
X	/* first, read all and store to first screen's save buffer */
X	for(idx = 0, val = vs[0].palette; idx < NVGAPEL; idx++, val++)
X		vgapaletteio(idx, val, 0 /* read it */);
X
X	/* now, duplicate for remaining screens */
X	for(idx = 1; idx < NSCREENS; idx++)
X		bcopy(vs[0].palette, vs[idx].palette,
X		      NVGAPEL * sizeof(struct rgb));
X}
X
X/*-------------------------- E O F -------------------------------------*/
SHAR_EOF
$TOUCH -am 0114130693 pcvt_drv.c &&
chmod 0660 pcvt_drv.c ||
echo "restore of pcvt_drv.c failed"
set `wc -c pcvt_drv.c`;Wc_c=$1
if test "$Wc_c" != "12263"; then
	echo original size 12263, current size $Wc_c
fi
fi
# ============= pcvt_hdr.h ==============
if test X"$1" != X"-c" -a -f 'pcvt_hdr.h'; then
	echo "File already exists: skipping 'pcvt_hdr.h'"
else
echo "x - extracting pcvt_hdr.h (Text)"
sed 's/^X//' << 'SHAR_EOF' > pcvt_hdr.h &&
X/*
X * Copyright (c) 1992, 1993 Hellmuth Michaelis and Brian Dunford-Shore
X *
X * All rights reserved.
X *
X * This code is derived from software contributed to Berkeley by
X * William Jolitz and Don Ahn.
X *
X * This driver is contributed to the 386BSD operating system.
X *
X * Redistribution and use in source and binary forms, with or without
X * modification, are permitted provided that the following conditions
X * are met:
X * 1. Redistributions of source code must retain the above copyright
X *    notice, this list of conditions and the following disclaimer.
X * 2. Redistributions in binary form must reproduce the above copyright
X *    notice, this list of conditions and the following disclaimer in the
X *    documentation and/or other materials provided with the distribution.
X * 3. All advertising materials mentioning features or use of this software
X *    must display the following acknowledgement:
X *	This product includes software contributed to 386BSD and developed
X *      by Hellmuth Michaelis and Brian Dunford-Shore
X * 4. Neither the name of the developers nor the names "386BSD" and "pcvt"
X *    may be used to endorse or promote products derived from this software
X *    without specific prior written permission.
X *
X * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
X * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
X * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
X * IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
X * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
X * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
X * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
X * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
X * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
X * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
X */
X
X/*
X *	@(#)pcvt_hdr.h		2.00               (contributed to 386BSD)
X *				Last Edit-Date: [Thu Jan 14 18:40:33 1993]
X */
X
X/*---------------------------------------------------------------------------
X *
X *	pcvt_hdr.h	VT220 Driver Global Include File
X *	------------------------------------------------
X *
X *	written by Hellmuth Michaelis, hm@hcshh.hcs.de
X *
X *	-hm	new variables for vt100 last char on line behaviour bugfix
X *	-hm	loadable character sets
X *	-hm	cleanup
X *	-hm	pure vt mode intro
X *	-hm	ioctl's and charset semantics changes
X *	-hm	vt220 charactersets via conversion tables
X *	-hm	ansi function prototypes
X *	-hm	keyboard layout choices
X *	-hm	new select graphic rendition scheme
X *	-hm	new physical keyboard i/o routines
X *	-hm	joerg's screensaver and keyboard null-chars
X *
X *---------------------------------------------------------------------------*/
X
X#include "param.h"
X#include "conf.h"
X#include "ioctl.h"
X#include "proc.h"
X#include "user.h"
X#include "tty.h"
X#include "uio.h"
X#include "i386/isa/isa_device.h"
X#include "callout.h"
X#include "systm.h"
X#include "kernel.h"
X#include "syslog.h"
X#include "i386/isa/icu.h"
X#include "i386/i386/cons.h"
X#include "i386/isa/isa.h"
X#include "machine/pc/display.h"
X#include "malloc.h"
X#include "time.h"
X#include "pcvt_ioctl.h"
X
X/*======================================================================*
X *		START OF CONFIGURATION SECTION				*
X *======================================================================*/
X
X/* #define VT220_KEYBOARDLAYOUT	/* this compiles a more vt220-like	*/
X				/* keyboardlayout as described in the	*/
X				/* file Keyboard.VT220.			*/
X				/* if undefined, a more HP-like         */
X				/* keyboardlayout is compiled		*/
X				/* try to find out what YOU like !	*/
X
X#define OLDKEYBOARDSTUFF	/* use the "old" keyboard code for now. */
X				/* in the file pcvt_kbd.c is some new	*/
X				/* experimental keyboard code which	*/
X				/* tries to avoid problems like the	*/
X				/* "RECONNECT" problem and which tries	*/
X				/* to implement keyboard type detection.*/
X				/* this is VERY experimental and 	*/
X				/* rudimentary - we are working on a	*/
X				/* much better improved verion !	*/
X				/* if you like to test it, undef this.	*/
X
X/* #define LAPTOP 		/* Got this one from Peter Galbavy to 	*/
X				/* make his laptop play - PLEASE LOOK	*/
X				/* AT pcvt_kbd.c BEFORE USING IT !!!!!! */  
X
X#define SIGNAL_WINCH		/* this sends a SIGWINCH signal in case	*/
X				/* the window size is changed. to try,	*/
X				/* issue "scons -s<size>" while in elvis*/
X				/* and you'll see the effect.		*/
X				/* i'm not shure, whether this feature	*/
X				/* has to be in the driver or has to    */
X				/* move as a ioctl call to scon ....	*/
X				/* (see code in pcvt_sup.c)		*/
X				
X/* #define PCVT_SCREENSAVER	/* enable screen saving feature		*/
X				/* this is experimental code, which has	*/
X				/* not been fully beta tested. second,	*/
X				/* if enabled, it slows down screen	*/
X				/* output noticable (pcvt_scrnsv_reset)	*/
X				/* until fixed, default is not enabled	*/
X
X#ifdef PCVT_SCREENSAVER		/* if the screen saving feature is on ..*/
X#define HAS_PRETTY_SCREENSAVER	/* for the cost of some microsecs of CPU*/
X				/* this adds the pretty version		*/
X#endif /* PCVT_SCREENSAVER */
X
X/* #define ENABLE_NULLCHARS	/* allow the keyboard to send null 	*/
X				/* (0x00) characters to the calling	*/
X				/* program. this has the side effect,	*/
X				/* that every undefined key also sends	*/
X				/* out nulls. take it at experimental	*/
X				/* code, this behaviour will change in	*/
X				/* the next release (because of a new	*/
X				/* keyboard driver ....)		*/
X
X/* #define PALETTE_FLICKER	/* --- see also WAIT_RETRACE below ---	*/
X				/* this option turns off the screen 	*/
X				/* during accesses to the VGA DAC	*/
X				/* registers. why: on one fo the tested	*/
X				/* pc's (WD-chipset), accesses to the	*/
X				/* vga dac registers caused distortions	*/
X				/* on the screen. Ferraro says, one has	*/
X				/* to blank the screen. the method used	*/
X				/* to accomplish this stopped the noise	*/
X				/* but introduced another flicker, so	*/
X				/* this is for you to experiment .....	*/
X				
X/* #define WAIT_RETRACE		/* -- see also PALETTE_FLICKER above -- */
X				/* this option waits for being in a 	*/
X				/* retrace window prior to accessing	*/
X				/* the VGA DAC registers.		*/
X				/* this is the other method Ferraro	*/
X				/* mentioned in his book. this option 	*/
X				/* did eleminate the flicker noticably	*/
X				/* but not completely. besides that, it	*/
X				/* is implemented as a busy-wait loop	*/
X				/* which is a no-no-no in environments	*/
X				/* like this - VERY BAD PRACTICE !!!!!	*/
X				/* the other method implementing it is	*/
X				/* using the vertical retrace irq, but	*/
X				/* we get short of irq-lines on pc's.	*/
X				/* this is for you to experiment .....	*/
X
X/*---------------------------------------------------------------------------
X	COLORS:
X
X	be careful when designing color combinations, because on
X	EGA and VGA displays, bit 3 of the attribute byte is used
X	for characterset switching, and is no longer available for
X	foreground intensity (bold)!
X
X---------------------------------------------------------------------------*/
X
X/*---------------------------------------------------------------------------*
X *	INTERNAL COLOR DEFINITIONS - KERNEL
X *---------------------------------------------------------------------------*/
X
X#define COLOR_KERNEL_FG	FG_LIGHTGREY	/* kernel messages, foreground */
X#define COLOR_KERNEL_BG	BG_RED		/* kernel messages, background */
X
X/* monochrome displays - really don't know if it fits ... */
X
X#define MONO_KERNEL_FG	FG_UNDERLINE	/* kernel messages, foreground */
X#define MONO_KERNEL_BG	BG_BLACK	/* kernel messages, background */
X
X/*======================================================================*
X *		END OF CONFIGURATION SECTION				*
X *======================================================================*/
X
X/*---------------------------------------------------------------------------*
X *	Keyboard and Keyboard Controller
X *---------------------------------------------------------------------------*/
X
X#define CONTROLLER_CTRL	0x64	/* W - command, R - status	*/
X#define CONTROLLER_DATA	0x60	/* R/W - data			*/
X
X/* commands to control the CONTROLLER (8042) on the mainboard */
X
X#define CONTR_READ	0x20	/* read command byte from controller */
X#define CONTR_WRITE	0x60	/* write command to controller, see below */
X#define CONTR_SELFTEST	0xaa	/* controller selftest, returns 0x55 when ok */
X#define CONTR_IFTEST	0xab	/* interface selftest */
X#define CONTR_KBDISABL	0xad	/* disable keyboard */
X#define CONTR_KBENABL	0xae	/* enable keyboard */
X
X/* command byte for writing to controller via CONTR_WRITE */
X
X#define	 COMMAND_RES7	0x80	/* bit 7, reserved, always write a ZERO ! */
X#define	 COMMAND_PCSCAN	0x40	/* bit 6, 1 = convert to pc scan codes */
X#define	 COMMAND_RES5	0x20	/* bit 5, perhaps (!) use 9bit frame instead of 11 */
X#define	 COMMAND_DISABL	0x10	/* bit 4, 1 = disable keyboard */
X#define	 COMMAND_INHOVR	0x08	/* bit 3, 1 = override security lock inhibit */
X#define	 COMMAND_SYSFLG	0x04	/* bit 2, value stored as "system flag" */
X#define	 COMMAND_RES2	0x02	/* bit 1, reserved, always write a ZERO ! */
X#define	 COMMAND_IRQEN	0x01	/* bit 0, 1 = enable output buffer full interrupt */
X
X/* status from CONTROLLER (8042) on the mainboard */
X
X#define	STATUS_PARITY	0x80	/* bit 7, 1 = parity error on last byte */
X#define STATUS_RXTIMO	0x40	/* bit 6, 1 = receive timeout error occured */
X#define STATUS_TXTIMO	0x20	/* bit 5, 1 = transmit timeout error occured */
X#define STATUS_ENABLE	0x10	/* bit 4, 1 = keyboard unlocked */
X#define STATUS_WHAT	0x08	/* bit 3, 1 = wrote cmd to 0x64, 0 = wrote data to 0x60 */
X#define STATUS_SYSFLG	0x04	/* bit 2, value stored as "system flag" */
X#define STATUS_INPBF	0x02	/* bit 1, 1 = input buffer full (to 8042) */
X#define STATUS_OUTPBF	0x01	/* bit 0, 1 = output buffer full (from 8042) */
X
X/* commands via 8042 on mainboard to the KEYBOARD */
X
X#define KEYB_C_RESET	0xff	/* reset keyboard to power-on status */
X#define	KEYB_C_RESEND	0xfe	/* resend last byte in case of error */
X#define KEYB_C_TYPEM	0xf3	/* set keyboard typematic rate/delay */
X#define KEYB_C_ID	0xf2	/* return keyboard id */
X#define KEYB_C_ECHO	0xee	/* diagnostic, echo 0xee */
X#define KEYB_C_LEDS	0xed	/* set/reset numlock,capslock & scroll lock */
X
X/* responses from the KEYBOARD via 8042 on mainboard */
X
X#define	KEYB_R_OVERRUN	0x00	/* keyboard buffer overflow */
X#define KEYB_R_SELFOK	0xaa	/* keyboard selftest ok after KEYB_C_RESET */
X#define KEYB_R_ECHO	0xee	/* keyboard response to KEYB_C_ECHO */
X#define KEYB_R_ACK	0xfa	/* acknowledge after a command has rx'd */
X#define KEYB_R_SELFBAD	0xfc	/* keyboard selftest FAILED after KEYB_C_RESET */
X#define KEYB_R_RESEND	0xfe	/* keyboard wants command resent or illegal command rx'd */
X#define	KEYB_R_OVERRUN1	0xff	/* keyboard buffer overflow */
X#define KEYB_R_MF2ID1	0xab	/* MF II Keyboard id-byte #1 */
X#define KEYB_R_MF2ID2	0x41	/* MF II Keyboard id-byte #2 */
X
X/* timeout values */
X
X#define KEYB_TIMEOUT	50000	/* ~ 500 ms timeout value */
X#define KEYB_INNERTIMO	5	/* inner timeout */
X
X/* internal Keyboard Type */
X
X#define KB_UNKNOWN	0	/* unknown keyboard type */
X#define KB_AT		1	/* AT (84 keys) Keyboard */
X#define KB_MFII		2	/* MF II (101/102 keys) Keyboard */
X
X/* VT220 -> internal color conversion table fields */
X
X#define VT_NORMAL	0x00		/* no attributes at all */
X#define VT_BOLD		0x01		/* bold attribute */
X#define VT_UNDER	0x02		/* underline attribute */
X#define VT_BLINK	0x04		/* blink attribute */
X#define VT_INVERSE	0x08		/* inverse attribute */
X 
X/* 6845 register definitions */
X
X#define	M6845_ADDR	0	/* wr */
X
X#define M6845_HTOTAL	0	/* wr */
X#define M6845_HDISPL	1	/* wr */
X#define M6845_HSYNC	2	/* wr */
X#define M6845_SYNCWIDTH	3	/* wr */
X#define M6845_VTOTAL	4	/* wr */
X#define M6845_VTOTADJ	5	/* wr */
X#define M6845_VDISPL	6	/* wr */
X#define M6845_VSYNC	7	/* wr */
X#define M6845_IMODE	8	/* wr */
X#define M6845_MAXSCAN	9	/* wr */
X#define M6845_CURSTART	10	/* wr */
X#define M6845_CUREND	11	/* wr */
X#define M6845_STARTADRH	12	/* rd/wr */
X#define M6845_STARTADRL	13	/* rd/wr */
X#define M6845_CURSORH	14	/* rd/wr */
X#define M6845_CURSORL	15	/* rd/wr */
X#define M6845_LPENH	16	/* rd */
X#define M6845_LPENL	17	/* rd */
X
X/* function key labels */
X
X#define LABEL_LEN	9		/* length of one label */
X#define LABEL_MID	8		/* mid-part (row/col)	*/
X
X#define LABEL_ROWH	((4*LABEL_LEN)+0)
X#define LABEL_ROWL	((4*LABEL_LEN)+1)
X#define LABEL_COLH	((4*LABEL_LEN)+3)
X#define LABEL_COLL	((4*LABEL_LEN)+4)
X#define LABEL_RESH	((4*LABEL_LEN)+6)
X#define LABEL_RESL	((4*LABEL_LEN)+7)
X
X/* tab setting */
X
X#define MAXTAB 132		/* no of possible tab stops */
X
X/* escape detection state machine */
X
X#define STATE_INIT	0	/* normal	*/
X#define	STATE_ESC	1	/* got ESC	*/
X#define STATE_HASH	2	/* got ESC #	*/
X#define STATE_BROPN	3	/* got ESC (	*/
X#define STATE_BRCLO	4	/* got ESC )	*/
X#define STATE_CSI	5	/* got ESC [	*/
X#define STATE_CSIQM	6	/* got ESC [ ?	*/
X#define STATE_AMPSND	7	/* got ESC &	*/
X#define STATE_STAR	8	/* got ESC *	*/
X#define STATE_PLUS	9	/* got ESC +	*/
X#define STATE_DCS	10	/* got ESC P	*/
X#define STATE_SCA	11	/* got ESC <Ps> " */
X#define STATE_STR	12	/* got ESC !	*/
X#define STATE_MINUS	13	/* got ESC -	*/
X#define STATE_DOT	14	/* got ESC .	*/
X#define STATE_SLASH	15	/* got ESC /	*/
X
X/* for storing escape sequence parameters */
X
X#define MAXPARMS 	10	/* maximum no of parms */
X
X/* terminal responses */
X
X#define DA_VT220	"\033[?62;1;2;6;7;8;9c"
X
X/* sub-states for Device Control String processing */
X
X#define DCS_INIT	0	/* got ESC P ... */
X#define DCS_AND_UDK	1	/* got ESC P ... | */
X#define DCS_UDK_DEF	2	/* got ESC P ... | fnckey / */
X#define DCS_UDK_ESC	3	/* got ESC P ... | fnckey / ... ESC */
X#define DCS_DLD_DSCS	4	/* got ESC P ... { */
X#define DCS_DLD_DEF	5	/* got ESC P ... { dscs */
X#define DCS_DLD_ESC	6	/* got ESC P ... { dscs ... / ... ESC */
X
X
X/* vt220 user defined keys and vt220 downloadable charset */
X
X#define MAXUDKDEF	300	/* max 256 char + 1 '\0' + space.. */
X#define	MAXUDKEYS	18	/* plus holes .. */
X#define DSCS_LENGTH	3	/* descriptor length */
X#define MAXSIXEL	8	/* sixels forever ! */
X
X/* sub-states for HP-terminal emulator */
X
X#define SHP_INIT	0
X
X/* esc & f family */
X
X#define SHP_AND_F	1
X#define SHP_AND_Fa	2
X#define SHP_AND_Fak	3
X#define SHP_AND_Fak1	4
X#define SHP_AND_Fakd	5
X#define SHP_AND_FakdL	6
X#define SHP_AND_FakdLl	7
X#define SHP_AND_FakdLls	8
X
X/* esc & j family */
X
X#define SHP_AND_J	9
X#define SHP_AND_JL	10
X
X/* additionals for function key labels */
X
X#define MAX_LABEL	16
X#define MAX_STRING	80
X#define MAX_STATUS	160
X
X#define	COL		80
X#define	MAXCOL		(COL-1)
X
X#define	SCR_MAXROW	50
X
X#define MAXDECSCA	((COL * SCR_MAXROW) / (8 * sizeof(unsigned int)))+1
X
X#define	CHR		2		/* bytes per word in screen mem */
X
X#define MONO_BASE	0x3B4
X#define MONO_BUF	0xfe0B0000
X#define CGA_BASE	0x3D4
X#define CGA_BUF		0xfe0B8000
X
X#define IOPHYSMEM	0xA0000
X
X/* VGA palette handling (output DAC palette) */
X
X#define VGA_DAC		0x3C6
X#define VGA_PMSK	0x3F	/* palette mask, only 64 distinct values */
X#define NVGAPEL 	256	/* number of palette entries */
X
X#define NSCREENS	4	/* number of virtual devices */
X#define NVGAFONTS	8	/* number of vga fonts loadable */
X
X/* max no of keys in table */
X
X#define MAXKEYNUM	127
X
X/* keyboard command byte to use the AT-scancode set */
X
X#define ATCMDBYTE	(KC8_IGNSEC|KC8_CPU|KC8_IEN)
X
X/* charset tables */
X
X#define	CSL	0x0000		/* ega/vga charset, lower half of 512 */
X#define	CSH	0x0800		/* ega/vga charset, upper half of 512 */
X#define CSSIZE	96		/* (physical) size of a character set */
X
X/* charset designations */
X
X#define D_G0		0	/* designated as G0 */
X#define D_G1		1	/* designated as G1 */
X#define D_G2		2	/* designated as G2 */
X#define D_G3		3	/* designated as G3 */
X#define D_G1_96		4	/* designated as G1 for 96-char charsets */
X#define D_G2_96		5	/* designated as G2 for 96-char charsets */
X#define D_G3_96		6	/* designated as G3 for 96-char charsets */
X
X/* which fkey-labels */
X
X#define SYS_FKL		0	/* in hp mode, sys-fkls are active */
X#define USR_FKL		1	/* in hp mode, user-fkls are active */
X
X/* minor mask */
X
X#define MINORMASK	0x03	/* minor no is masked by this */
X
X/* variables */
X
X#ifdef EXTERN
X#define WAS_EXTERN
X#else
X#define EXTERN extern
X#endif
X
XEXTERN	u_char	*more_chars;
XEXTERN	int	char_count;
XEXTERN	u_char	color;			/* color or mono display */
X
XEXTERN	u_short	kern_attr;		/* kernel messages char attributes */
XEXTERN	u_short	user_attr;		/* character attributes */
X
XEXTERN	struct tty pccons[NSCREENS];
X
XEXTERN	struct	pcconsoftc {
X	u_char	cs_flags;
X#define	CSF_ACTIVE	0x1	/* timeout active */
X#define	CSF_POLLING	0x2	/* polling for input */
X	u_char	cs_lastc;	/* last char sent */
X	int	cs_timo;	/* timeouts since interrupt */
X	u_long	cs_wedgecnt;	/* times restarted */
X} pcconsoftc;
X
XEXTERN struct	kbdsoftc {
X	u_char	kbd_flags;
X#define	KBDF_ACTIVE	0x1	/* timeout active */
X#define	KBDF_POLLING	0x2	/* polling for input */
X#define	KBDF_RAW	0x4	/* pass thru scan codes for input */
X	u_char	kbd_lastc;	/* last char sent */
X} kbdsoftc;
X
Xstruct sixels {
X	u_char lower[MAXSIXEL];		/* lower half of char */
X	u_char upper[MAXSIXEL];		/* upper half of char */
X};
X
Xstruct udkentry {
X	u_char	first[MAXUDKEYS];	/* index to first char */
X	u_char	length[MAXUDKEYS];	/* length of this entry */
X};
X
X/* VGA palette handling */
Xstruct rgb {
X	u_char	r, g, b;		/* red/green/blue, valid 0..VGA_PMSK */
X};
X
Xtypedef struct video_state {
X	struct tty *vs_tty;		/* pointer to this screen's tty */
X	u_char 	row, col;		/* current cursor position */
X	u_short	c_attr;			/* current character attributes */
X	u_char	vtsgr;			/* current sgr configuration */
X	u_short	*Crtat;			/* video page start addr */
X	u_short	*crtat;			/* current cursor position */
X	u_char	bell_on;		/* flag, bell enabled */
X	u_char	sevenbit;		/* flag, data path 7 bits wide */
X	u_char	dis_fnc;		/* flag, display functions enable */
X	u_char	transparent;		/* flag, make path temp transparent for ctrls */
X	u_short *scr_beg;		/* scrolling region, begin */
X	u_char	row_beg;		/* scrolling region, begin */
X	u_char	maxrow;			/* scrolling region, length */
X	u_char	screen_rows;		/* screen size, length (minus status lines) */
X	u_char	screen_rowsize; 	/* screen size, length */
X	u_char	vga_charset;		/* VGA character set value */
X	u_char	lastchar;		/* flag, vt100 behaviour of last char on line */
X	u_char	lastrow;		/* save row, vt100 behaviour of last char on line */
X	u_char	*report_chars;		/* ptr, status reports from terminal */
X	u_char	report_count;		/* count, -"- */
X	u_char	state;			/* escape sequence state machine */
X	u_char	m_awm;			/* flag, vt100 mode, auto wrap */
X	u_char	m_om;			/* flag, vt100 mode, origin mode */
X	u_char	sc_flag;		/* flag, vt100 mode, saved parms valid */
X	u_char	sc_row;			/* saved row */
X	u_char	sc_col;			/* saved col */
X	u_short *sc_crtat;		/* saved cursor addr ptr */
X	u_short	sc_attr;		/* saved attributes */	
X	u_char	sc_vtsgr;		/* saved sgr configuration */
X	u_char	sc_awm;			/* saved auto wrap mode */
X	u_char	sc_om;			/* saved origin mode */
X	u_short	*sc_G0;			/* save G0 ptr */
X	u_short	*sc_G1;			/* save G1 ptr */
X	u_short	*sc_G2;			/* save G2 ptr */
X	u_short	*sc_G3;			/* save G3 ptr */
X	u_short	*sc_GL;			/* save GL ptr */
X	u_short	*sc_GR;			/* save GR ptr */	
X	u_char	sc_sel;			/* selective erase state */
X	u_char	ufkl[8][17];		/* user fkey-labels */
X	u_char	sfkl[8][17];		/* system fkey-labels */
X	u_char	labels_on;		/* display fkey labels and status line on/off */
X	u_char	which_fkl;		/* which fkey labels are active */
X	char	tab_stops[MAXTAB]; 	/* table of active tab stops */
X	u_char	parmi;			/* parameter index */
X	u_char	parms[MAXPARMS];	/* parameter array */
X	u_char	hp_state;		/* hp escape sequence state machine */
X	u_char	attribute;		/* attribute normal, tx only, local */
X	u_char	key;			/* fkey label no */
X	u_char	l_len;			/* buffer length's */
X	u_char	s_len;	
X	u_char	m_len;
X	u_char	i;			/* help (got short of names ...) */
X	u_char	l_buf[MAX_LABEL+1]; 	/* buffers */
X	u_char	s_buf[MAX_STRING+1];
X	u_char	m_buf[MAX_STATUS+1];
X	u_char	openf;			/* we are opened ! */
X	u_char	vt_pure_mode;		/* no fkey labels, row/col, status */
X	u_char	cursor_start;		/* Start of cursor */
X	u_char	cursor_end;		/* End of cursor */
X	u_char	num;			/* true = keypad numeric mode */
X	u_char	ckm;			/* true = cursor key normal mode */
X	u_char	irm;			/* true = insert mode */
X	u_char	lnm;			/* Line Feed/New Line Mode */
X	u_char	dcs_state;		/* dcs escape sequence state machine */
X	u_char	udk_def[MAXUDKDEF]; 	/* new definitions for vt220 FKeys */
X	u_char	udk_defi;		/* index for FKey definitions */
X	u_char	udk_deflow;		/* low or high nibble in sequence */
X	u_char	udk_fnckey;		/* function key to assign to */
X	u_char	dld_dscs[DSCS_LENGTH];	/* designate soft character set id */
X	u_char	dld_dscsi;		/* index for dscs */
X	u_char	dld_sixel_lower;	/* upper/lower sixels of character */
X	u_char	dld_sixelli;		/* index for lower sixels */
X	u_char	dld_sixelui;		/* index for upper sixels */
X	struct sixels sixel;		/* structure for storing char sixels */
X	u_char	selchar;		/* true = selective attribute on */
X	u_int	decsca[MAXDECSCA];	/* Select Character Attrib bit array */
X	u_short *GL;			/* ptr to current GL conversion table */
X	u_short *GR;			/* ptr to current GR conversion table */
X	u_short *G0;			/* ptr to current G0 conversion table */
X	u_short *G1;			/* ptr to current G1 conversion table */
X	u_short *G2;			/* ptr to current G2 conversion table */
X	u_short *G3;			/* ptr to current G3 conversion table */
X	u_char	dld_id[DSCS_LENGTH+1];	/* soft character set id */
X	u_char	which[DSCS_LENGTH+1];	/* which set to designate */
X	u_char	whichi;			/* index into which ..	*/
X	u_char	ss2;			/* flag, single shift G2 -> GL */
X	u_char	ss3;			/* flag, single shift G3 -> GL */	
X	u_char	udkbuf[MAXUDKDEF];	/* buffer for user defined keys */
X	struct udkentry ukt;		/* index & length for each udk */
X	u_char	udkff;			/* index into buffer first free entry */
X	struct rgb palette[NVGAPEL];	/* saved VGA DAC palette */
X} video_state;
X
XEXTERN video_state vs[NSCREENS];	/* parameters for screens */
X
Xstruct vga_char_state {
X	int	loaded;		/* Whether a font is loaded here */
X	int	secondloaded;	/* an extension characterset was loaded, */
X				/*	the number is found here	 */
X	u_char	char_scanlines;	/* Scanlines per character */
X	u_char	scr_scanlines;	/* Low byte of scanlines per screen */
X	int	screen_size;	/* Screen size in SIZ_YYx80 */
X};
X
XEXTERN struct vga_char_state vgacs[NVGAFONTS];	/* Character set states */
X
X#ifndef WAS_EXTERN
X
Xextern struct tty	*pcconsp;
Xextern video_state	*vsp;
Xextern u_int		addr_6845;
Xextern u_short		*Crtat;
Xextern struct isa_driver pcdriver;
Xextern u_char		do_initialization;
Xextern u_char		bgansitopc[];
Xextern u_char		fgansitopc[];
Xextern u_char 		shift_down;
Xextern u_char		ctrl_down;
Xextern u_char		meta_down;
Xextern u_char		altgr_down;
Xextern u_char		caps;
Xextern u_char		extended;
Xextern u_char		shiftlock;
Xextern u_char		kbrepflag;
Xextern u_char		kbd_lastkey;
Xextern u_char		kbd_scroll;
Xextern u_char 		pcconsintr;
Xextern u_char		adaptor_type;
Xextern u_char		current_video_screen;
Xextern u_char		totalfonts;
Xextern u_char		totalscreens;
Xextern u_char		chargen_access;
Xextern u_char		keyboard_type;
Xextern u_char		sgr_tab_color[];
Xextern u_char		sgr_tab_mono[];
X
X#else /* WAS_EXTERN */			/* declarations allocating memory */
X
Xstruct tty *pcconsp =	&pccons[0];		/* ptr to current device */
Xvideo_state *vsp =	&vs[0];			/* ptr to current screen parms */
Xu_int addr_6845 =	MONO_BASE;		/* crtc base addr */
Xu_short *Crtat	=	(u_short *)MONO_BUF;	/* screen start address */
Xu_char do_initialization = 1;			/* we have to init ourselves */
X
Xint pcprobe ( struct isa_device *dev );
Xint pcattach ( struct isa_device *dev );
X
Xstruct	isa_driver pcdriver = {
X	pcprobe, pcattach, "pc",
X};
X
Xu_char fgansitopc[] = {			/* translate ANSI color -> pc */
X	FG_BLACK, FG_RED, FG_GREEN, FG_BROWN, FG_BLUE,
X	FG_MAGENTA, FG_CYAN, FG_LIGHTGREY
X};
X
Xu_char bgansitopc[] = {
X	BG_BLACK, BG_RED, BG_GREEN, BG_BROWN, BG_BLUE,
X	BG_MAGENTA, BG_CYAN, BG_LIGHTGREY
X};
X	
Xu_char 	shift_down = 0;
Xu_char	ctrl_down = 0; 
Xu_char	meta_down = 0; 
Xu_char	altgr_down = 0; 
Xu_char	caps = 0; 
Xu_char	extended = 0;
Xu_char	shiftlock = 0;
Xu_char	kbd_lastkey = 0;
Xu_char	kbd_scroll = 0;
X
Xu_char	kbrepflag = 1;
Xu_char	pcconsintr = 1;
X
Xu_char	current_video_screen = 0;
Xu_char	adaptor_type = UNKNOWN_ADAPTOR;
Xu_char	totalfonts = 0;
Xu_char	totalscreens = 1;
Xu_char	chargen_access = 0;
Xu_char	keyboard_type = 0;
X
X/*---------------------------------------------------------------------------
X
X	VT220 attributes -> internal emulator attributes conversion tables
X
X	be careful when designing color combinations, because on
X	EGA and VGA displays, bit 3 of the attribute byte is used
X	for characterset switching, and is no longer available for
X	foreground intensity (bold)!
X
X---------------------------------------------------------------------------*/
X
Xu_char sgr_tab_color[16] = {
X/*00*/	(BG_BLACK	| FG_LIGHTGREY	),		/* normal		*/
X/*01*/	(BG_BLUE	| FG_LIGHTGREY	),		/* bold			*/
X/*02*/	(BG_BROWN	| FG_LIGHTGREY	),		/* underline		*/
X/*03*/	(BG_MAGENTA	| FG_LIGHTGREY	),		/* bold+underline	*/
X/*04*/	(BG_BLACK	| FG_LIGHTGREY | FG_BLINK),	/* blink		*/
X/*05*/	(BG_BLUE	| FG_LIGHTGREY | FG_BLINK),	/* bold+blink		*/
X/*06*/	(BG_BROWN	| FG_LIGHTGREY | FG_BLINK),	/* underline+blink	*/
X/*07*/	(BG_MAGENTA	| FG_LIGHTGREY | FG_BLINK),	/* bold+underline+blink	*/
X/*08*/	(BG_LIGHTGREY	| FG_BLACK	),		/* invers		*/
X/*09*/	(BG_LIGHTGREY	| FG_BLUE	),		/* bold+invers		*/
X/*10*/	(BG_LIGHTGREY	| FG_BROWN	),		/* underline+invers	*/
X/*11*/	(BG_LIGHTGREY	| FG_MAGENTA	),		/* bold+underline+invers*/
X/*12*/	(BG_LIGHTGREY	| FG_BLACK	| FG_BLINK),	/* blink+invers		*/
X/*13*/	(BG_LIGHTGREY	| FG_BLUE	| FG_BLINK),	/* bold+blink+invers	*/
X/*14*/	(BG_LIGHTGREY	| FG_BROWN	| FG_BLINK),	/* underline+blink+invers*/
X/*15*/	(BG_LIGHTGREY	| FG_MAGENTA	| FG_BLINK)	/* bold+underl+blink+invers*/
X};
X
X/* monochrome displays - really don't know if it fits ... */
X	
Xu_char sgr_tab_mono[16] = {
X/*00*/	(BG_BLACK	| FG_LIGHTGREY	),			  /* normal		*/
X/*01*/	(BG_BLACK	| FG_LIGHTGREY | FG_UNDERLINE),		  /* bold			*/
X/*02*/	(BG_BLACK	| FG_LIGHTGREY | FG_UNDERLINE),		  /* underline		*/
X/*03*/	(BG_BLACK	| FG_LIGHTGREY | FG_UNDERLINE),		  /* bold+underline	*/
X/*04*/	(BG_BLACK	| FG_LIGHTGREY | FG_BLINK),		  /* blink		*/
X/*05*/	(BG_BLACK	| FG_LIGHTGREY | FG_UNDERLINE | FG_BLINK),/* bold+blink		*/
X/*06*/	(BG_BLACK	| FG_LIGHTGREY | FG_UNDERLINE | FG_BLINK),/* underline+blink	*/
X/*07*/	(BG_BLACK	| FG_LIGHTGREY | FG_UNDERLINE | FG_BLINK),/* bold+underline+blink	*/
X/*08*/	(BG_LIGHTGREY	| FG_BLACK	),			  /* invers		*/
X/*09*/	(BG_LIGHTGREY	| FG_UNDERLINE	),			  /* bold+invers		*/
X/*10*/	(BG_LIGHTGREY	| FG_UNDERLINE	),			  /* underline+invers	*/
X/*11*/	(BG_LIGHTGREY	| FG_UNDERLINE	),			  /* bold+underline+invers*/
X/*12*/	(BG_LIGHTGREY	| FG_BLACK | FG_BLINK),			  /* blink+invers		*/
X/*13*/	(BG_LIGHTGREY	| FG_BLACK | FG_UNDERLINE | FG_BLINK),	  /* bold+blink+invers	*/
X/*14*/	(BG_LIGHTGREY	| FG_BLACK | FG_UNDERLINE | FG_BLINK),	  /* underline+blink+invers*/
X/*15*/	(BG_LIGHTGREY	| FG_BLACK | FG_UNDERLINE | FG_BLINK)	  /* bold+underl+blink+invers*/
X};
X
X#endif
X
Xstruct tty *get_pccons ( dev_t dev );
Xint pcopen ( dev_t dev, int flag, int mode, struct proc *p );
Xint pcclose ( dev_t dev, int flag, int mode, struct proc *p );
Xint pcread ( dev_t dev, struct uio *uio, int flag );
Xint pcwrite ( dev_t dev, struct uio *uio, int flag );
Xint pcioctl ( dev_t dev, int cmd, caddr_t data, int flag );
Xint pcmmap ( dev_t dev, int offset, int nprot );
Xint pcrint ( dev_t dev, int irq, int cpl );
Xint pcxint ( dev_t dev );
Xint pcstart ( struct tty *tp );
Xint consinit ( void );
Xint pccnprobe ( struct consdev *cp );
Xint pccninit ( struct consdev *cp );
Xint pccnputc ( dev_t dev, u_char c );
Xint pccngetc ( dev_t dev );
Xint pcparam ( struct tty *tp, struct termios *t );
Xint pg ( char *p, int q, int r, int s, int t, int u, int v, int w, int x, int y, int z );
Xvoid dprintf(unsigned flgs, const char *fmt, ...);
Xvoid vt_keynum ( struct video_state *svsp );
Xvoid vt_keyappl ( struct video_state *svsp );
Xu_char kbd_cmd ( u_char byte );
Xvoid update_led ( void );
Xu_char *sgetc ( int noblock );
Xint kbdioctl ( dev_t dev, int cmd, caddr_t data, int flag );
Xvoid sput ( u_char ch, u_char attrib, int page );
Xvoid fkl_off ( struct video_state *svsp );
Xvoid fkl_on ( struct video_state *svsp );
Xvoid set_emulation_mode ( struct video_state *svsp, int mode );
Xint init_ufkl ( struct video_state *svsp );
Xint init_sfkl ( struct video_state *svsp );
Xvoid sw_ufkl ( struct video_state *svsp );
Xvoid sw_sfkl ( struct video_state *svsp );
Xvoid toggl_dspf ( struct video_state *svsp );
Xvoid toggl_awm ( struct video_state *svsp );
Xvoid toggl_bell ( struct video_state *svsp );
Xvoid toggl_sevenbit ( struct video_state *svsp );
Xvoid clr_parms ( struct video_state *svsp );
Xint respond ( struct video_state *svsp );
Xint vgaioctl ( dev_t dev, int cmd, caddr_t data, int flag );
Xvoid average ( int a );
Xvoid set_charset ( struct video_state *svsp, int curvgacs );
Xvoid loadchar ( int fontset, int character, int char_scanlines, unsigned char *char_table );
Xvoid vgapage ( int n );
Xint egavga_test ( void );
Xint vga_test ( void );
Xvoid sixel_vga ( struct sixels *charsixel, unsigned char *charvga );
Xvoid vga10_vga16 ( unsigned char *invga, unsigned char *outvga );
Xvoid vga10_vga14 ( unsigned char *invga, unsigned char *outvga );
Xvoid vga10_vga10 ( unsigned char *invga, unsigned char *outvga );
Xvoid vga10_vga8 ( unsigned char *invga, unsigned char *outvga );
Xvoid set_2ndcharset ( void );
Xvoid vgapaletteio ( unsigned idx, struct rgb *val, int writeit );
X#ifdef PCVT_SCREENSAVER
Xvoid pcvt_scrnsv_reset ( void );
X#endif
X
X/*---------------------------------- E O F ----------------------------------*/
SHAR_EOF
$TOUCH -am 0114184093 pcvt_hdr.h &&
chmod 0660 pcvt_hdr.h ||
echo "restore of pcvt_hdr.h failed"
set `wc -c pcvt_hdr.h`;Wc_c=$1
if test "$Wc_c" != "29799"; then
	echo original size 29799, current size $Wc_c
fi
fi
# ============= pcvt_ioctl.h ==============
if test X"$1" != X"-c" -a -f 'pcvt_ioctl.h'; then
	echo "File already exists: skipping 'pcvt_ioctl.h'"
else
echo "x - extracting pcvt_ioctl.h (Text)"
sed 's/^X//' << 'SHAR_EOF' > pcvt_ioctl.h &&
X/*
X * Copyright (c) 1992, 1993 Hellmuth Michaelis, Brian Dunford-Shore,
X * Joerg Wunsch and Holger Veit.
X *
X * All rights reserved.
X *
X * This code is derived from software contributed to Berkeley by
X * William Jolitz and Don Ahn.
X *
X * This code is based in part on software contributed to 386BSD by
X * Holger Veit 
X *
X * This driver is contributed to the 386BSD operating system.
X *
X * Redistribution and use in source and binary forms, with or without
X * modification, are permitted provided that the following conditions
X * are met:
X * 1. Redistributions of source code must retain the above copyright
X *    notice, this list of conditions and the following disclaimer.
X * 2. Redistributions in binary form must reproduce the above copyright
X *    notice, this list of conditions and the following disclaimer in the
X *    documentation and/or other materials provided with the distribution.
X * 3. All advertising materials mentioning features or use of this software
X *    must display the following acknowledgement:
X *	This product includes software contributed to 386BSD and developed
X *      by Hellmuth Michaelis, Brian Dunford-Shore, Joerg Wunsch
X *         and Holger Veit.
X * 4. Neither the name of the developers nor the names "386BSD" and "pcvt"
X *    may be used to endorse or promote products derived from this software
X *    without specific prior written permission.
X *
X * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
X * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
X * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
X * IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
X * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
X * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
X * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
X * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
X * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
X * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
X */
X 
X/*
X *	@(#)ioctl_pcvt.h	2.00		   (contributed to 386BSD)
X *				Last Edit-Date: [Tue Jan 12 13:15:00 1993]
X */
X
X#ifndef	_IOCTL_PCVT_H_
X#define	_IOCTL_PCVT_H_
X
X#ifndef KERNEL
X#include <sys/ioctl.h>
X#include <sys/types.h>
X#else
X#include "ioctl.h"
X#endif
X
X/*---------------------------------------------------------------------------*
X *		IOCTLs for MF II and AT Keyboards
X *---------------------------------------------------------------------------*/
X
X#define KBDRESET	_IO('K',  1)	  /* reset keyboard / set defaults */
X#define KBDGTPMAT	_IOR('K', 2, int) /* get current typematic value   */
X#define KBDSTPMAT	_IOW('K', 3, int) /* set current typematic value   */
X
X/*	Typematic Delay Values	*/
X
X#define	KBD_TPD250	0x00			/*  250 ms	*/
X#define	KBD_TPD500	0x20			/*  500 ms	*/
X#define	KBD_TPD750	0x40			/*  750 ms	*/
X#define	KBD_TPD1000	0x60			/* 1000 ms	*/
X
X/*	Typematic Repeat Rate	*/
X
X#define	KBD_TPM300	0x00			/* 30.0 char/second */
X#define	KBD_TPM267	0x01			/* 26.7 char/second */
X#define	KBD_TPM240	0x02			/* 24.0 char/second */
X#define	KBD_TPM218	0x03			/* 21.8 char/second */
X#define	KBD_TPM200	0x04			/* 20.0 char/second */
X#define	KBD_TPM185	0x05			/* 18.5 char/second */
X#define	KBD_TPM171	0x06			/* 17.1 char/second */
X#define	KBD_TPM160	0x07			/* 16.0 char/second */
X#define	KBD_TPM150	0x08			/* 15.0 char/second */
X#define	KBD_TPM133	0x09			/* 13.3 char/second */
X#define	KBD_TPM120	0x0A			/* 12.0 char/second */
X#define	KBD_TPM109	0x0B			/* 10.9 char/second */
X#define	KBD_TPM100	0x0C			/* 10.0 char/second */
X#define	KBD_TPM92	0x0D			/*  9.2 char/second */
X#define	KBD_TPM86	0x0E			/*  8.6 char/second */
X#define	KBD_TPM80	0x0F			/*  8.0 char/second */
X#define	KBD_TPM75	0x10			/*  7.5 char/second */
X#define	KBD_TPM67	0x11			/*  6.7 char/second */
X#define	KBD_TPM60	0x12			/*  6.0 char/second */
X#define	KBD_TPM55	0x13			/*  5.5 char/second */
X#define	KBD_TPM50	0x14			/*  5.0 char/second */
X#define	KBD_TPM46	0x15			/*  4.6 char/second */
X#define	KBD_TPM43	0x16			/*  4.3 char/second */
X#define	KBD_TPM40	0x17			/*  4.0 char/second */
X#define	KBD_TPM37	0x18			/*  3.7 char/second */
X#define	KBD_TPM33	0x19			/*  3.3 char/second */
X#define	KBD_TPM30	0x1A			/*  3.0 char/second */
X#define	KBD_TPM27	0x1B			/*  2.7 char/second */
X#define	KBD_TPM25	0x1C			/*  2.5 char/second */
X#define	KBD_TPM23	0x1D			/*  2.3 char/second */
X#define	KBD_TPM21	0x1E			/*  2.1 char/second */
X#define	KBD_TPM20	0x1F			/*  2.0 char/second */
X
X#define KBDGREPSW	_IOR('K', 4, int)	/* get key repetition switch */
X#define KBDSREPSW	_IOW('K', 5, int)	/* set key repetition switch */
X#define		KBD_REPEATOFF	0
X#define		KBD_REPEATON	1
X
X#define KBDGLEDS	_IOR('K', 6, int)	/* get LED state */
X#define KBDSLEDS	_IOW('K', 7, int)	/* set LED state, does not influence */
X#define 	KBD_SCROLLLOCK	0x0001		/* the driver's idea of lock key state */
X#define		KBD_NUMLOCK	0x0002
X#define		KBD_CAPSLOCK	0x0004
X#define KBDGLOCK	_IOR('K', 8, int)	/* gets state of SCROLL,NUM,CAPS */
X#define KBDSLOCK	_IOW('K', 9, int)	/* sets state of SCROLL,NUM,CAPS + LEDs */
X
X#define KBDMAXOVLKEYSIZE	15		/* + zero byte */
X
Xstruct kbd_ovlkey				/* complete definition of a key */
X{
X	u_short	keynum;				/* the key itself */
X	u_short	type;				/* type of key, see below */
X	u_char	subu;				/* subtype, ignored on write */
X	char	unshift[KBDMAXOVLKEYSIZE+1];	/* emitted string, unshifted */
X	u_char	subs;				/* subtype, ignored on write */
X	char	shift[KBDMAXOVLKEYSIZE+1];	/* emitted string, shifted */
X	u_char	subc;				/* subtype, ignored on write */
X	char	ctrl[KBDMAXOVLKEYSIZE+1];	/* emitted string, control */
X	u_char	suba;				/* subtype, ignored on write */
X	char	altgr[KBDMAXOVLKEYSIZE+1];	/* emitted string, altgr */
X};
X
X/*	Max value for keynum field	*/
X
X#define	KBDMAXKEYS	128		/* Max No. of Keys */
X	
X/*	Values for type field	*/
X
X#define	KBD_NONE	0	/* no function, key is disabled */
X#define	KBD_SHIFT	1	/* keyboard shift */
X#define	KBD_META	2	/* alternate shift, sets bit8 to ASCII code */
X#define	KBD_NUM		3	/* numeric shift, keypad num / appl */
X#define	KBD_CTL		4	/* control code generation */
X#define	KBD_CAPS	5	/* caps shift - swaps case of letter */
X#define	KBD_ASCII	6	/* ascii code generating key */
X#define	KBD_SCROLL	7	/* stop output */
X#define	KBD_FUNC	8	/* function key */
X#define	KBD_KP		9	/* keypad keys */
X#define	KBD_BREAK	10	/* ignored */
X#define	KBD_ALTGR	11	/* AltGr Translation feature */
X#define	KBD_SHFTLOCK	12	/* shiftlock */
X#define	KBD_CURSOR	13	/* cursor keys */
X#define	KBD_RETURN	14	/* RETURN/ENTER keys */
X
X/*	Values  for subtype field	*/
X
X#define	KBD_SUBT_STR	0	/* key is bound to a string */
X#define	KBD_SUBT_FNC	1	/* key is bound to a function */
X
X
X#define	KBD_OVERLOAD	0x8000	/* Key is overloaded, ignored in ioctl */
X#define	KBD_MASK	(~KBD_OVERLOAD)	/* mask for type */ 
X
X#define KBDGCKEY	_IOWR('K',16, struct kbd_ovlkey)	/* get current key values */
X#define KBDSCKEY	_IOW('K',17, struct kbd_ovlkey)		/* set new key assignment values*/
X#define KBDGOKEY	_IOWR('K',18, struct kbd_ovlkey) 	/* get original key assignment values*/ 
X
X#define KBDRMKEY	_IOW('K', 19, int)	/* remove a key assignment */
X#define KBDDEFAULT	_IO('K',20)		/* remove all key assignments */
X
X
X/*---------------------------------------------------------------------------*
X *		IOCTLs for Video Adapter
X *---------------------------------------------------------------------------*/
X
X/* Definition of PC Video Adaptor Types */
X
X#define UNKNOWN_ADAPTOR	0	/* Unidentified adaptor ... */
X#define MDA_ADAPTOR	1	/* Monochrome Display Adaptor */
X#define HGC_ADAPTOR	2	/* Hercules Graphics Card */
X#define CGA_ADAPTOR	3	/* Color Graphics Adaptor */
X#define EGA_ADAPTOR	4	/* Enhanced Graphics Adaptor */
X#define VGA_ADAPTOR	5	/* Video Graphics Adaptor/Array */
X
X/* Definitions of Screen Sizes for EGA/VGA Adaptors */
X
X#define SIZ_25x80	0	/* VGA: 25 lines, 80 columns, 8x16 font */
X				/* EGA: 25 lines, 80 columns, 8x14 font */
X#define SIZ_28x80	1	/* VGA: 28 lines, 80 columns, 8x14 font */
X#define SIZ_35x80	2	/* EGA: 35 lines, 80 columns, 8x10 font */
X#define SIZ_40x80	3	/* VGA: 40 lines, 80 columns, 8x10 font */
X#define SIZ_43x80	4	/* EGA: 43 lines, 80 columns, 8x8  font */
X#define SIZ_50x80	5	/* VGA: 50 lines, 80 columns, 8x8  font */
X
X/* Definitions of Font Sizes for EGA/VGA Adaptors */
X
X#define FNT_8x16	0	/* 8x16 Pixel Font, only VGA */
X#define FNT_8x14	1	/* 8x14 Pixel Font, EGA/VGA  */
X#define FNT_8x10	2	/* 8x10 Pixel Font, EGA/VGA  */
X#define FNT_8x8		3	/* 8x8  Pixel Font, EGA/VGA  */
X
X/* Definitions of Character Set (Font) Numbers */
X
X#define CH_SET0		0	/* Character Set (Font) 0, EGA/VGA */
X#define CH_SET1		1	/* Character Set (Font) 1, EGA/VGA */
X#define CH_SET2		2	/* Character Set (Font) 2, EGA/VGA */
X#define CH_SET3		3	/* Character Set (Font) 3, EGA/VGA */
X#define CH_SETMAX_EGA	3	/* EGA has 4 Character Sets / Fonts */
X#define CH_SET4		4	/* Character Set (Font) 4, VGA */
X#define CH_SET5		5	/* Character Set (Font) 5, VGA */
X#define CH_SET6		6	/* Character Set (Font) 6, VGA */
X#define CH_SET7		7	/* Character Set (Font) 7, VGA */
X#define CH_SETMAX_VGA	7	/* VGA has 8 Character Sets / Fonts */
X
X/* Definitions of Terminal Emulation Modes */
X
X#define M_HPVT		0	/* VTxxx and HP Mode, Labels & Status Line on */
X#define M_PUREVT	1	/* only VTxxx Sequences recognized, no Labels */
X
X/*---*/
X
X#define VGACURSOR	_IOW('V',100, struct cursorshape) /* set cursor shape */
X
Xstruct cursorshape {
X	int screen_no;	   /* screen number for which to set,		    */
X			   /*  or -1 to set on current active screen        */
X	int start;	   /* top scanline, range 0... Character Height - 1 */
X	int end;	   /* end scanline, range 0... Character Height - 1 */
X};
X
X#define VGALOADCHAR	_IOW('V',101, struct vgaloadchar) /* load vga char */
X
Xstruct vgaloadchar {
X	int character_set;	    /* VGA character set to load into */
X	int character;		    /* Character to load */
X	int character_scanlines;    /* Scanlines per character */
X	u_char char_table[16];	    /* VGA character shape table */
X};
X
X#define VGASETFONTATTR	_IOW('V',102, struct vgafontattr) /* set font attr */
X#define VGAGETFONTATTR	_IOWR('V',103, struct vgafontattr) /* get font attr */
X
Xstruct vgafontattr {
X	int character_set;	    /* VGA character set */
X	int font_loaded;	    /* Mark font loaded or unloaded */
X	int screen_size;	    /* Character rows per screen */
X	int character_scanlines;    /* Scanlines per character - 1 */
X	int screen_scanlines;       /* Scanlines per screen - 1 byte */
X};
X
X#define VGASETSCREEN	_IOW('V',104, struct screeninfo) /* set screen info */
X#define VGAGETSCREEN	_IOWR('V',105, struct screeninfo) /* get screen info */
X
Xstruct screeninfo {
X	int adaptor_type;	/* type of video adaptor installed	*/
X				/* read only, ignored on write (yet!)	*/
X	int totalfonts;		/* no of downloadable fonts		*/
X				/* read only, ignored on write		*/
X	int totalscreens;	/* no of virtual screens		*/
X				/* read only, ignored on write		*/
X	int screen_no;		/* screen number, this was got from	*/
X				/* on write, if -1, apply pure_vt_mode	*/
X				/* and/or screen_size to current screen */
X				/* else to screen_no supplied		*/
X	int current_screen;	/* screen number, which is displayed.	*/
X				/* on write, if -1, make this screen	*/
X				/* the current screen, else set current	*/
X				/* displayed screen to parameter	*/
X	int pure_vt_mode;	/* flag, pure VT mode or HP/VT mode	*/
X				/* on write, if -1, no change		*/
X	int screen_size;	/* screen size 				*/
X				/* on write, if -1, no change		*/	
X};
X
X#define VGAREADPEL	_IOWR('V', 110, struct vgapel) /*r VGA palette entry */
X#define VGAWRITEPEL	_IOW('V', 111, struct vgapel)  /*w VGA palette entry */
X
Xstruct vgapel {
X	unsigned idx;		/* index into palette, 0 .. 255 valid	*/
X	unsigned r, g, b;	/* RGB values, masked by VGA_PMASK (63) */
X};
X
X/* NOTE: The next ioctl is only valid if option PCVT_SCREENSAVER is configured*/
X/* this is *not* restricted to VGA's, but won't introduce new garbage...      */
X
X#define VGASCREENSAVER	_IOW('V', 112, int)	/* set timeout for screen     */
X						/* saver in seconds; 0 turns  */
X						/* it off                     */
X
X#endif	/* _IOCTL_PC_H_ */
SHAR_EOF
$TOUCH -am 0114130693 pcvt_ioctl.h &&
chmod 0660 pcvt_ioctl.h ||
echo "restore of pcvt_ioctl.h failed"
set `wc -c pcvt_ioctl.h`;Wc_c=$1
if test "$Wc_c" != "12192"; then
	echo original size 12192, current size $Wc_c
fi
fi
echo "End of part 8, continue with part 9"
exit 0
-- 
hellmuth michaelis    HCS Hanseatischer Computerservice GmbH   hamburg, europe
hm@hcshh.hcs.de              tel: +49/40/55903-170         fax: +49/40/5591486