1 /*****************************************************************************
3 Copyright © 1995, 1996 Digital Equipment Corporation,
4 Maynard, Massachusetts.
8 Permission to use, copy, modify, and distribute this software and its
9 documentation for any purpose and without fee is hereby granted, provided
10 that the copyright notice and this permission notice appear in all copies
11 of software and supporting documentation, and that the name of Digital not
12 be used in advertising or publicity pertaining to distribution of the software
13 without specific, written prior permission. Digital grants this permission
14 provided that you prominently mark, as not part of the original, any
15 modifications made to this software or documentation.
17 Digital Equipment Corporation disclaims all warranties and/or guarantees
18 with regard to this software, including all implied warranties of fitness for
19 a particular purpose and merchantability, and makes no representations
20 regarding the use of, or the results of the use of, the software and
21 documentation in terms of correctness, accuracy, reliability, currentness or
22 otherwise; and you rely on the software, documentation and results solely at
25 ******************************************************************************/
28 * david.rusling@reo.mts.dec.com
30 * Modified for QEMU PALcode by rth@twiddle.net.
37 #define SERIAL_SPEED 9600
41 uart_charav(int offset
)
43 return inb(com2Lsr
+ offset
) & 1;
47 uart_getchar(int offset
)
49 /* If interrupts are enabled, use wtint assuming that either the
50 device itself will wake us, or that a clock interrupt will. */
51 if ((rdps() & 7) == 0) {
52 while (!uart_charav(offset
)) {
56 while (!uart_charav(offset
))
60 return inb(com2Rbr
+ offset
);
64 uart_putchar_raw(int offset
, char c
)
66 while ((inb(com2Lsr
+ offset
) & 0x20) == 0)
68 outb(c
, com2Thr
+ offset
);
72 uart_putchar(int offset
, char c
)
75 uart_putchar_raw(offset
, '\r');
76 uart_putchar_raw(offset
, c
);
80 uart_puts(int offset
, const char *s
)
83 uart_putchar(offset
, *s
++);
87 uart_init_line(int offset
, int baud
)
126 outb(0x87, com2Lcr
+ offset
);
127 outb(0, com2Dlm
+ offset
);
128 outb(baudconst
, com2Dll
+ offset
);
129 outb(0x07, com2Lcr
+ offset
);
130 outb(0x0F, com2Mcr
+ offset
);
132 for (i
= 10; i
> 0; i
--) {
133 if (inb(com2Lsr
+ offset
) == 0)
135 inb(com2Rbr
+ offset
);
141 uart_init_line(COM1
, SERIAL_SPEED
);
142 uart_init_line(COM2
, SERIAL_SPEED
);