xref: /csrg-svn/sys/hp/dev/dcareg.h (revision 41480)
1 /*
2  * Copyright (c) 1982, 1986, 1990 Regents of the University of California.
3  * All rights reserved.
4  *
5  * %sccs.include.redist.c%
6  *
7  *	@(#)dcareg.h	7.1 (Berkeley) 05/08/90
8  */
9 
10 struct dcadevice {
11 	u_char	dca_pad0;
12 	volatile u_char	dca_irid;
13 	volatile short	dca_ic;
14 	volatile short	dca_ocbrc;
15 	volatile short	dca_lcsm;
16 	short	dca_pad1[4];
17 	u_char	dca_pad2;
18 	volatile u_char	dca_data;
19 	volatile short	dca_ier;
20 	volatile short	dca_iir;
21 	volatile short	dca_cfcr;
22 	volatile short	dca_mcr;
23 	volatile short	dca_lsr;
24 	u_char	dca_pad3;
25 	volatile u_char	dca_msr;
26 };
27 
28 /* interface reset/id */
29 #define	DCAID0		0x02
30 #define DCAREMID0	0x82
31 #define	DCAID1		0x42
32 #define DCAREMID1	0xC2
33 
34 /* interrupt control */
35 #define	DCAIPL(x)	((((x) >> 4) & 3) + 3)
36 #define	IC_IR		0x40
37 #define	IC_IE		0x80
38 
39 /* 16 bit baud rate divisor (lower byte in dca_data, upper in dca_ier) */
40 #define	DCABRD(x)	(153600 / (x))
41 
42 /* interrupt enable register */
43 #define	IER_ERXRDY	0x1
44 #define	IER_ETXRDY	0x2
45 #define	IER_ERLS	0x4
46 #define	IER_EMSC	0x8
47 
48 /* interrupt identification register */
49 #define	IIR_NOPEND	0x1
50 #define	IIR_IMASK	0x6
51 #define	IIR_RLS		6
52 #define	IIR_RXRDY	4
53 #define	IIR_TXRDY	2
54 #define	IIR_MLSC	0
55 
56 /* character format control register */
57 #define	CFCR_DLAB	0x80
58 #define	CFCR_SBREAK	0x40
59 #define	CFCR_PZERO	0x30
60 #define	CFCR_PONE	0x20
61 #define	CFCR_PEVEN	0x10
62 #define	CFCR_PODD	0x00
63 #define	CFCR_PENAB	0x08
64 #define	CFCR_STOPB	0x04
65 #define	CFCR_8BITS	0x03
66 #define	CFCR_7BITS	0x02
67 #define	CFCR_6BITS	0x01
68 #define	CFCR_5BITS	0x00
69 
70 /* modem control register */
71 #define	MCR_LOOPBACK	0x10
72 #define	MCR_SRTS	0x08
73 #define	MCR_DRS		0x04
74 #define	MCR_RTS		0x02
75 #define	MCR_DTR		0x01
76 
77 /* line status register */
78 #define	LSR_TSRE	0x40
79 #define	LSR_TXRDY	0x20
80 #define	LSR_BI		0x10
81 #define	LSR_FE		0x08
82 #define	LSR_PE		0x04
83 #define	LSR_OE		0x02
84 #define	LSR_RXRDY	0x01
85 
86 /* modem status register */
87 #define	MSR_DCD		0x80
88 #define	MSR_RI		0x40
89 #define	MSR_DSR		0x20
90 #define	MSR_CTS		0x10
91 #define	MSR_CCD		0x08
92 #define	MSR_TERI	0x04
93 #define	MSR_DDSR	0x02
94 #define	MSR_CCTS	0x01
95 
96 /*
97  * WARNING: Serial console is assumed to be at SC9
98  * and CONUNIT must be 0.
99  */
100 #define CONADDR	((struct dcadevice *)(IOV(EXTIOBASE + (9 * IOCARDSIZE))))
101 #define CONUNIT	(0)
102