|
|
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: * @(#)dca.c 7.1 (Berkeley) 5/8/90 ! 26: */ ! 27: ! 28: #ifdef DCACONSOLE ! 29: #include "../sys/param.h" ! 30: #include "../hpdev/dcareg.h" ! 31: #include "machine/cpu.h" ! 32: #include "machine/cons.h" ! 33: ! 34: #define CONSDEV (0) ! 35: #define CONSOLE ((struct dcadevice *)(EXTIOBASE + (9 * IOCARDSIZE))) ! 36: ! 37: dcaprobe(cp) ! 38: struct consdev *cp; ! 39: { ! 40: register struct dcadevice *dca = CONSOLE; ! 41: ! 42: if (badaddr((char *)CONSOLE)) { ! 43: cp->cn_pri = CN_DEAD; ! 44: return; ! 45: } ! 46: switch (dca->dca_irid) { ! 47: case DCAID0: ! 48: case DCAID1: ! 49: cp->cn_pri = CN_NORMAL; ! 50: break; ! 51: case DCAREMID0: ! 52: case DCAREMID1: ! 53: cp->cn_pri = CN_REMOTE; ! 54: break; ! 55: default: ! 56: cp->cn_pri = CN_DEAD; ! 57: break; ! 58: } ! 59: } ! 60: ! 61: dcainit(cp) ! 62: struct consdev *cp; ! 63: { ! 64: register struct dcadevice *dca = CONSOLE; ! 65: ! 66: dca->dca_irid = 0xFF; ! 67: DELAY(100); ! 68: dca->dca_ic = 0; ! 69: dca->dca_cfcr = CFCR_DLAB; ! 70: dca->dca_data = DCABRD(9600) & 0xFF; ! 71: dca->dca_ier = DCABRD(9600) >> 8; ! 72: dca->dca_cfcr = CFCR_8BITS; ! 73: } ! 74: ! 75: #ifndef SMALL ! 76: dcagetchar() ! 77: { ! 78: register struct dcadevice *dca = CONSOLE; ! 79: short stat; ! 80: int c; ! 81: ! 82: if (((stat = dca->dca_lsr) & LSR_RXRDY) == 0) ! 83: return(0); ! 84: c = dca->dca_data; ! 85: return(c); ! 86: } ! 87: #else ! 88: dcagetchar() ! 89: { ! 90: return(0); ! 91: } ! 92: #endif ! 93: ! 94: dcaputchar(c) ! 95: register int c; ! 96: { ! 97: register struct dcadevice *dca = CONSOLE; ! 98: register int timo; ! 99: short stat; ! 100: ! 101: /* wait a reasonable time for the transmitter to come ready */ ! 102: timo = 50000; ! 103: while (((stat = dca->dca_lsr) & LSR_TXRDY) == 0 && --timo) ! 104: ; ! 105: dca->dca_data = c; ! 106: /* wait for this transmission to complete */ ! 107: timo = 1000000; ! 108: while (((stat = dca->dca_lsr) & LSR_TXRDY) == 0 && --timo) ! 109: ; ! 110: } ! 111: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.