ec_rxstart doesn't eists
[unix-history] / usr / src / sys / tahoe / stand / prf.c
CommitLineData
206e7747
KB
1/*-
2 * Copyright (c) 1991 The Regents of the University of California.
3 * All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Computer Consoles Inc.
7 *
8 * %sccs.include.redist.c%
1e1f58c3 9 *
206e7747 10 * @(#)prf.c 7.1 (Berkeley) %G%
1e1f58c3 11 */
1e1f58c3 12
206e7747
KB
13#include "sys/param.h"
14#include "../tahoe/cp.h"
15#include "../include/mtpr.h"
1e1f58c3 16
1e1f58c3
SL
17/*
18 * Print a character on console.
1e1f58c3 19 */
1e1f58c3
SL
20struct cpdcb_o cpout;
21struct cpdcb_i cpin;
22
23/* console requires even parity */
24#define EVENP
54e5fb0b 25
1e1f58c3 26putchar(c)
54e5fb0b 27 char c;
1e1f58c3
SL
28{
29 int time;
30#ifdef EVENP
31 register mask, par;
32
54e5fb0b 33 for (par = 0, mask = 1; mask != 0200; mask <<= 1, par <<= 1)
1e1f58c3
SL
34 par ^= c&mask;
35 c |= par;
206e7747
KB
36#endif /* EVENP */
37 cpout.cp_hdr.cp_unit = CPCONS; /* Resets done bit */
1e1f58c3
SL
38 cpout.cp_hdr.cp_comm = CPWRITE;
39 cpout.cp_hdr.cp_count = 1;
40 cpout.cp_buf[0] = c;
41 mtpr(CPMDCB, &cpout);
1e1f58c3
SL
42 time = 100000; /* Delay loop */
43 while (time--) {
54e5fb0b
MK
44 uncache(&cpout.cp_hdr.cp_unit);
45 if (cpout.cp_hdr.cp_unit & CPDONE)
46 break;
1e1f58c3 47 }
54e5fb0b
MK
48 if (c == '\n')
49 putchar ('\r');
1e1f58c3 50}
1e1f58c3 51
206e7747
KB
52scankbd()
53{}
54
1e1f58c3
SL
55getchar()
56{
54e5fb0b 57 char c;
1e1f58c3 58
206e7747 59 cpin.cp_hdr.cp_unit = CPCONS; /* Resets done bit */
1e1f58c3
SL
60 cpin.cp_hdr.cp_comm = CPREAD;
61 cpin.cp_hdr.cp_count = 1;
62 mtpr(CPMDCB, &cpin);
1e1f58c3 63 while ((cpin.cp_hdr.cp_unit & CPDONE) == 0)
54e5fb0b
MK
64 uncache(&cpin.cp_hdr.cp_unit);
65 uncache(&cpin.cpi_buf[0]);
1e1f58c3 66 c = cpin.cpi_buf[0] & 0x7f;
54e5fb0b
MK
67 if (c == '\r')
68 c = '\n';
69 if (c != '\b' && c != '\177')
70 putchar(c);
71 return (c);
1e1f58c3 72}
0aa02f62
KB
73
74trap(ps)
75 int ps;
76{
77 printf("Trap %o\n", ps);
78 for (;;)
79 ;
80}
81
82uncache (addr)
83 char *addr;
84{
85 /* Return *(addr-0x4000); DIRTY assumes this address is valid */
86 mtpr(PDCS, addr);
87}