|
|
1.1 ! root 1: /* ! 2: * Copyright (c) 1988 University of Utah. ! 3: * Copyright (c) 1990 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. ! 9: * ! 10: * Redistribution is only permitted until one year after the first shipment ! 11: * of 4.4BSD by the Regents. Otherwise, redistribution and use in source and ! 12: * binary forms are permitted provided that: (1) source distributions retain ! 13: * this entire copyright notice and comment, and (2) distributions including ! 14: * binaries display the following acknowledgement: This product includes ! 15: * software developed by the University of California, Berkeley and its ! 16: * contributors'' in the documentation or other materials provided with the ! 17: * distribution and in all advertising materials mentioning features or use ! 18: * of this software. Neither the name of the University nor the names of ! 19: * its contributors may be used to endorse or promote products derived from ! 20: * this software without specific prior written permission. ! 21: * THIS SOFTWARE IS PROVIDED AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED ! 22: * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF ! 23: * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ! 24: * ! 25: * from: Utah $Hdr: cons.c 1.5 89/08/22$ ! 26: * ! 27: * @(#)cons.c 7.2 (Berkeley) 5/25/90 ! 28: */ ! 29: ! 30: #include "param.h" ! 31: #include "samachdep.h" ! 32: #include "machine/cons.h" ! 33: ! 34: int nodev(); ! 35: #ifdef ITECONSOLE ! 36: int iteprobe(), iteinit(), itegetchar(), iteputchar(); ! 37: #endif ! 38: #ifdef DCACONSOLE ! 39: int dcaprobe(), dcainit(), dcagetchar(), dcaputchar(); ! 40: #endif ! 41: #ifdef DCMCONSOLE ! 42: int dcmprobe(), dcminit(), dcmgetchar(), dcmputchar(); ! 43: #endif ! 44: ! 45: struct consdev constab[] = { ! 46: #ifdef ITECONSOLE ! 47: { iteprobe, iteinit, itegetchar, iteputchar }, ! 48: #endif ! 49: #ifdef DCACONSOLE ! 50: { dcaprobe, dcainit, dcagetchar, dcaputchar }, ! 51: #endif ! 52: #ifdef DCMCONSOLE ! 53: { dcmprobe, dcminit, dcmgetchar, dcmputchar }, ! 54: #endif ! 55: { 0 }, ! 56: }; ! 57: ! 58: struct consdev *cn_tab; ! 59: int noconsole; ! 60: ! 61: cninit() ! 62: { ! 63: register struct consdev *cp; ! 64: ! 65: cn_tab = NULL; ! 66: noconsole = 1; ! 67: for (cp = constab; cp->cn_probe; cp++) { ! 68: (*cp->cn_probe)(cp); ! 69: if (cp->cn_pri > CN_DEAD && ! 70: (cn_tab == NULL || cp->cn_pri > cn_tab->cn_pri)) ! 71: cn_tab = cp; ! 72: } ! 73: if (cn_tab) { ! 74: (*cn_tab->cn_init)(cn_tab); ! 75: noconsole = 0; ! 76: } ! 77: } ! 78: ! 79: cngetc() ! 80: { ! 81: if (cn_tab) ! 82: return((*cn_tab->cn_getc)()); ! 83: return(0); ! 84: } ! 85: ! 86: cnputc(c) ! 87: int c; ! 88: { ! 89: if (cn_tab) ! 90: (*cn_tab->cn_putc)(c); ! 91: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.