1 /* 2 * Copyright (c) 1988 University of Utah. 3 * Copyright (c) 1992 The Regents of the University of California. 4 * All rights reserved. 5 * 6 * This code is derived from software contributed to Berkeley by 7 * the Systems Programming Group of the University of Utah Computer 8 * Science Department and Ralph Campbell. 9 * 10 * %sccs.include.redist.c% 11 * 12 * from: Utah $Hdr: cons.c 1.1 90/07/09$ 13 * 14 * @(#)cons.c 7.4 (Berkeley) 10/11/92 15 */ 16 17 #include <sys/param.h> 18 #include <sys/proc.h> 19 #include <sys/systm.h> 20 #include <sys/buf.h> 21 #include <sys/ioctl.h> 22 #include <sys/tty.h> 23 #include <sys/file.h> 24 #include <sys/conf.h> 25 26 #include <machine/machMon.h> 27 28 /* 29 * Console output may be redirected to another tty 30 * (e.g. a window); if so, constty will point to the current 31 * virtual console. 32 */ 33 struct tty *constty; /* virtual console output device */ 34 35 /* 36 * Get character from console. 37 */ 38 cngetc() 39 { 40 int (*f)(); 41 #include "dc.h" 42 #if NDC > 0 43 #include <machine/dc7085cons.h> 44 #include <pmax/dev/pdma.h> 45 extern struct pdma dcpdma[]; 46 47 /* check to be sure device has been initialized */ 48 if (dcpdma[0].p_addr) 49 return (dcKBDGetc()); 50 f = (int (*)())MACH_MON_GETCHAR; 51 return (*f)(); 52 #else 53 f = (int (*)())MACH_MON_GETCHAR; 54 return (*f)(); 55 #endif 56 } 57 58 /* 59 * Print a character on console. 60 */ 61 cnputc(c) 62 register int c; 63 { 64 #include "pm.h" 65 #if NPM > 0 66 pmPutc(c); 67 #else 68 #include "cfb.h" 69 #if NCFB > 0 70 cfbPutc(c); 71 #else 72 int s; 73 void (*f)() = (void (*)())MACH_MON_PUTCHAR; 74 75 s = splhigh(); 76 (*f)(c); 77 splx(s); 78 #endif 79 #endif 80 } 81