xref: /csrg-svn/sys/pmax/pmax/cons.c (revision 56524)
152118Smckusick /*
252118Smckusick  * Copyright (c) 1988 University of Utah.
352118Smckusick  * Copyright (c) 1992 The Regents of the University of California.
452118Smckusick  * All rights reserved.
552118Smckusick  *
652118Smckusick  * This code is derived from software contributed to Berkeley by
752118Smckusick  * the Systems Programming Group of the University of Utah Computer
852118Smckusick  * Science Department and Ralph Campbell.
952118Smckusick  *
1052118Smckusick  * %sccs.include.redist.c%
1152118Smckusick  *
1252118Smckusick  * from: Utah $Hdr: cons.c 1.1 90/07/09$
1352118Smckusick  *
14*56524Sbostic  *	@(#)cons.c	7.4 (Berkeley) 10/11/92
1552118Smckusick  */
1652118Smckusick 
17*56524Sbostic #include <sys/param.h>
18*56524Sbostic #include <sys/proc.h>
19*56524Sbostic #include <sys/systm.h>
20*56524Sbostic #include <sys/buf.h>
21*56524Sbostic #include <sys/ioctl.h>
22*56524Sbostic #include <sys/tty.h>
23*56524Sbostic #include <sys/file.h>
24*56524Sbostic #include <sys/conf.h>
2552118Smckusick 
26*56524Sbostic #include <machine/machMon.h>
2752118Smckusick 
2852118Smckusick /*
2952118Smckusick  * Console output may be redirected to another tty
3052118Smckusick  * (e.g. a window); if so, constty will point to the current
3152118Smckusick  * virtual console.
3252118Smckusick  */
3352118Smckusick struct	tty *constty;		/* virtual console output device */
3452118Smckusick 
3552118Smckusick /*
3652118Smckusick  * Get character from console.
3752118Smckusick  */
3852118Smckusick cngetc()
3952118Smckusick {
4052701Sralph 	int (*f)();
4152701Sralph #include "dc.h"
4252701Sralph #if NDC > 0
43*56524Sbostic #include <machine/dc7085cons.h>
44*56524Sbostic #include <pmax/dev/pdma.h>
4552701Sralph 	extern struct pdma dcpdma[];
4652118Smckusick 
4752701Sralph 	/* check to be sure device has been initialized */
4852701Sralph 	if (dcpdma[0].p_addr)
4952701Sralph 		return (dcKBDGetc());
5052701Sralph 	f = (int (*)())MACH_MON_GETCHAR;
5152118Smckusick 	return (*f)();
5252701Sralph #else
5352701Sralph 	f = (int (*)())MACH_MON_GETCHAR;
5452701Sralph 	return (*f)();
5552701Sralph #endif
5652118Smckusick }
5752118Smckusick 
5852118Smckusick /*
5952118Smckusick  * Print a character on console.
6052118Smckusick  */
6152118Smckusick cnputc(c)
6252118Smckusick 	register int c;
6352118Smckusick {
6452701Sralph #include "pm.h"
6552118Smckusick #if NPM > 0
6652118Smckusick 	pmPutc(c);
6752118Smckusick #else
6852865Sralph #include "cfb.h"
6952865Sralph #if NCFB > 0
7052865Sralph 	cfbPutc(c);
7152865Sralph #else
7252118Smckusick 	int s;
7352118Smckusick 	void (*f)() = (void (*)())MACH_MON_PUTCHAR;
7452118Smckusick 
7552118Smckusick 	s = splhigh();
7652118Smckusick 	(*f)(c);
7752118Smckusick 	splx(s);
7852118Smckusick #endif
7952865Sralph #endif
8052118Smckusick }
81