2 * Copyright (C) 1993, 1994 by
3 * Digital Equipment Corporation, Maynard, Massachusetts.
6 * This software is furnished under a license and may be used and copied
7 * only in accordance of the terms of such license and with the
8 * inclusion of the above copyright notice. This software or any other
9 * copies thereof may not be provided or otherwise made available to any
10 * other person. No title to and ownership of the software is hereby
13 * The information in this software is subject to change without notice
14 * and should not be construed as a commitment by Digital Equipment
17 * Digital assumes no responsibility for the use or reliability of its
18 * software on equipment which is not supplied by Digital.
27 #include "alpha-uart.h"
28 /*#include "alphansi.h"*/
29 #include "alpha-patch.h"
34 if (inVti(com1Lsr
) & 1)
35 return COM1
| inVti (com1Rbr
);
44 while(!((s
= inVti(lptSr
)) & 0x80))
54 outVti(lptCr
, lptnInit
|lptSTB
|lptAFD
);
58 outVti(lptCr
, lptnInit
|lptAFD
);
68 uart_putchar(int port
, char c
)
93 while ((inVti(lsr
) & 0x20) == 0);
95 if (c
== '\n') uart_putchar(port
, '\r');
100 int uart_init_line(int line
, int baud
)
107 case 57600: baudconst
= 2; break;
108 case 38400: baudconst
= 3; break;
109 case 19200: baudconst
= 6; break;
110 case 9600: baudconst
= 12; break;
111 case 4800: baudconst
= 24; break;
112 case 2400: baudconst
= 48; break;
113 case 1200: baudconst
= 96; break;
114 case 300: baudconst
= 384; break;
115 case 150: baudconst
= 768; break;
116 default: baudconst
= 12; break;
121 outVti(com1Lcr
, 0x87);
123 outVti(com1Dll
, baudconst
);
124 outVti(com1Lcr
, 0x07);
125 outVti(com1Mcr
, 0x0F);
131 outVti(com2Lcr
, 0x87);
133 outVti(com2Dll
, baudconst
);
134 outVti(com2Lcr
, 0x07);
135 outVti(com2Mcr
, 0x0F);
137 fprintf (stderr
, "com1Ier = 0x%x\n", inVti(com1Ier
));
138 fprintf (stderr
, "com1Lcr = 0x%x\n", inVti(com1Lcr
));
139 fprintf (stderr
, "com1Dlm = 0x%x\n", inVti(com1Dlm
));
140 fprintf (stderr
, "com1Dll = 0x%x\n", inVti(com1Dll
));
141 fprintf (stderr
, "com1Lcr = 0x%x\n", inVti(com1Lcr
));
142 fprintf (stderr
, "com1Mcr = 0x%x\n", inVti(com1Mcr
));
150 uart_init_line(1, 19200);
157 outVti(com1Ier
, 0x01);
164 outVti(com1Ier
, 0x0);
171 outVti(com2Ier
, 0x01);
178 outVti(com2Ier
, 0x0);