xref: /csrg-svn/sys/pmax/pmax/cons.c (revision 52701)
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*52701Sralph  *	@(#)cons.c	7.2 (Berkeley) 02/29/92
1552118Smckusick  */
1652118Smckusick 
1752118Smckusick #include "param.h"
1852118Smckusick #include "proc.h"
1952118Smckusick #include "systm.h"
2052118Smckusick #include "buf.h"
2152118Smckusick #include "ioctl.h"
2252118Smckusick #include "tty.h"
2352118Smckusick #include "file.h"
2452118Smckusick #include "conf.h"
2552118Smckusick 
2652118Smckusick #include "../include/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 {
40*52701Sralph 	int (*f)();
41*52701Sralph #include "dc.h"
42*52701Sralph #if NDC > 0
43*52701Sralph #include "machine/dc7085cons.h"
44*52701Sralph #include "../dev/pdma.h"
45*52701Sralph 	extern struct pdma dcpdma[];
4652118Smckusick 
47*52701Sralph 	/* check to be sure device has been initialized */
48*52701Sralph 	if (dcpdma[0].p_addr)
49*52701Sralph 		return (dcKBDGetc());
50*52701Sralph 	f = (int (*)())MACH_MON_GETCHAR;
5152118Smckusick 	return (*f)();
52*52701Sralph #else
53*52701Sralph 	f = (int (*)())MACH_MON_GETCHAR;
54*52701Sralph 	return (*f)();
55*52701Sralph #endif
5652118Smckusick }
5752118Smckusick 
5852118Smckusick /*
5952118Smckusick  * Print a character on console.
6052118Smckusick  */
6152118Smckusick cnputc(c)
6252118Smckusick 	register int c;
6352118Smckusick {
64*52701Sralph #include "pm.h"
6552118Smckusick #if NPM > 0
6652118Smckusick 	pmPutc(c);
6752118Smckusick #else
6852118Smckusick 	int s;
6952118Smckusick 	void (*f)() = (void (*)())MACH_MON_PUTCHAR;
7052118Smckusick 
7152118Smckusick 	s = splhigh();
7252118Smckusick 	(*f)(c);
7352118Smckusick 	splx(s);
7452118Smckusick #endif
7552118Smckusick }
76