xref: /csrg-svn/sys/pmax/pmax/cons.c (revision 52865)
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*52865Sralph  *	@(#)cons.c	7.3 (Berkeley) 03/07/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 {
4052701Sralph 	int (*f)();
4152701Sralph #include "dc.h"
4252701Sralph #if NDC > 0
4352701Sralph #include "machine/dc7085cons.h"
4452701Sralph #include "../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
68*52865Sralph #include "cfb.h"
69*52865Sralph #if NCFB > 0
70*52865Sralph 	cfbPutc(c);
71*52865Sralph #else
7252118Smckusick 	int s;
7352118Smckusick 	void (*f)() = (void (*)())MACH_MON_PUTCHAR;
7452118Smckusick 
7552118Smckusick 	s = splhigh();
7652118Smckusick 	(*f)(c);
7752118Smckusick 	splx(s);
7852118Smckusick #endif
79*52865Sralph #endif
8052118Smckusick }
81