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 * %sccs.include.redist.c% 11 * 12 * from: Utah $Hdr: cons.c 1.5 89/08/22$ 13 * 14 * @(#)cons.c 7.4 (Berkeley) 05/05/91 15 */ 16 17 #include "sys/param.h" 18 #include "samachdep.h" 19 #include "../hp300/cons.h" 20 21 #ifdef ITECONSOLE 22 int iteprobe(), iteinit(), itegetchar(), iteputchar(); 23 #endif 24 #ifdef DCACONSOLE 25 int dcaprobe(), dcainit(), dcagetchar(), dcaputchar(); 26 #endif 27 #ifdef DCMCONSOLE 28 int dcmprobe(), dcminit(), dcmgetchar(), dcmputchar(); 29 #endif 30 31 struct consdev constab[] = { 32 #ifdef ITECONSOLE 33 { iteprobe, iteinit, itegetchar, iteputchar }, 34 #endif 35 #ifdef DCACONSOLE 36 { dcaprobe, dcainit, dcagetchar, dcaputchar }, 37 #endif 38 #ifdef DCMCONSOLE 39 { dcmprobe, dcminit, dcmgetchar, dcmputchar }, 40 #endif 41 { 0 }, 42 }; 43 44 struct consdev *cn_tab; 45 int noconsole; 46 47 cninit() 48 { 49 register struct consdev *cp; 50 51 cn_tab = NULL; 52 noconsole = 1; 53 for (cp = constab; cp->cn_probe; cp++) { 54 (*cp->cn_probe)(cp); 55 if (cp->cn_pri > CN_DEAD && 56 (cn_tab == NULL || cp->cn_pri > cn_tab->cn_pri)) 57 cn_tab = cp; 58 } 59 if (cn_tab) { 60 (*cn_tab->cn_init)(cn_tab); 61 noconsole = 0; 62 } 63 } 64 65 cngetc() 66 { 67 if (cn_tab) 68 return((*cn_tab->cn_getc)()); 69 return(0); 70 } 71 72 cnputc(c) 73 int c; 74 { 75 if (cn_tab) 76 (*cn_tab->cn_putc)(c); 77 } 78