1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
|
/* $NetBSD: sccreg.h,v 1.2 1995/04/11 03:41:10 mycroft Exp $ */
/*
* Copyright (c) 1991,1990,1989,1994,1995 Carnegie Mellon University
* All Rights Reserved.
*
* Permission to use, copy, modify and distribute this software and its
* documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie Mellon
* the rights to redistribute these changes.
*/
/*-
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Ralph Campbell and Rick Macklem.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)sccreg.h 8.1 (Berkeley) 6/10/93
*/
/*
* Definitions for Intel 82530 serial communications chip. Each chip is a
* dual uart with the A channels used for the keyboard and mouse with the B
* channel(s) for comm ports with modem control. Since some registers are
* used for the other channel, the following macros are used to access the
* register ports.
*
* Actual access to the registers is provided by sccvar.h, as it's
* machine-dependent.
*/
/* Scc channel numbers; B channel comes first. */
#define SCC_CHANNEL_B 0
#define SCC_CHANNEL_A 1
#define SCC_INIT_REG(scc, chan) { \
char tmp; \
scc_get_datum((scc)->scc_channel[(chan)].scc_command, tmp); \
scc_get_datum((scc)->scc_channel[(chan)].scc_command, tmp); \
}
#define SCC_READ_REG(scc, chan, reg, val) { \
scc_set_datum((scc)->scc_channel[(chan)].scc_command, reg); \
scc_get_datum((scc)->scc_channel[(chan)].scc_command, val); \
}
#define SCC_READ_REG_ZERO(scc, chan, val) { \
scc_get_datum((scc)->scc_channel[(chan)].scc_command, val); \
}
#define SCC_WRITE_REG(scc, chan, reg, val) { \
scc_set_datum((scc)->scc_channel[(chan)].scc_command, reg); \
scc_set_datum((scc)->scc_channel[(chan)].scc_command, val); \
}
#define SCC_WRITE_REG_ZERO(scc, chan, val) { \
scc_set_datum((scc)->scc_channel[(chan)].scc_command, val); \
}
#define SCC_READ_DATA(scc, chan, val) { \
scc_get_datum((scc)->scc_channel[(chan)].scc_data, val); \
}
#define SCC_WRITE_DATA(scc, chan, val) { \
scc_set_datum((scc)->scc_channel[(chan)].scc_data, val); \
}
/* Addressable registers. */
#define SCC_RR0 0 /* status register */
#define SCC_RR1 1 /* special receive conditions */
#define SCC_RR8 8 /* recv buffer (alias for data) */
#define SCC_RR10 10 /* sdlc status */
#define SCC_RR15 15 /* interrupts currently enabled */
#define SCC_WR0 0 /* reg select, and commands */
#define SCC_WR1 1 /* interrupt and DMA enables */
#define SCC_WR3 3 /* receiver params and enables */
#define SCC_WR4 4 /* clock/char/parity params */
#define SCC_WR5 5 /* xmit params and enables */
#define SCC_WR8 8 /* xmit buffer (alias for data) */
#define SCC_WR9 9 /* vectoring and resets */
#define SCC_WR10 10 /* synchr params */
#define SCC_WR11 11 /* clocking definitions */
#define SCC_WR14 14 /* BRG enables and commands */
#define SCC_WR15 15 /* interrupt enables */
/* Read register's defines. */
/*
* RR2 contains the interrupt vector unmodified (channel A) or
* modified as follows (channel B, if vector-include-status).
*/
#define SCC_RR2_STATUS(val) ((val)&0xf)
#define SCC_RR2_B_XMIT_DONE 0x0
#define SCC_RR2_B_EXT_STATUS 0x2
#define SCC_RR2_B_RECV_DONE 0x4
#define SCC_RR2_B_RECV_SPECIAL 0x6
#define SCC_RR2_A_XMIT_DONE 0x8
#define SCC_RR2_A_EXT_STATUS 0xa
#define SCC_RR2_A_RECV_DONE 0xc
#define SCC_RR2_A_RECV_SPECIAL 0xe
/* RR12/RR13 hold the timing base, upper byte in RR13. */
#define SCC_GET_TIMING_BASE(scc, chan, val) { \
register char tmp; \
SCC_READ_REG(scc, chan, ZSRR_BAUDLO, val); \
SCC_READ_REG(scc, chan, ZSRR_BAUDHI, tmp); \
(val) = ((val) << 8) | (tmp & 0xff); \
}
/*
* Write register's defines.
*/
/* WR12/WR13 are for timing base preset */
#define SCC_SET_TIMING_BASE(scc, chan, val) { \
SCC_WRITE_REG(scc, chan, ZSWR_BAUDLO, val); \
SCC_WRITE_REG(scc, chan, ZSWR_BAUDHI, (val) >> 8); \
}
/* Bits in dm lsr, copied from dmreg.h. */
#define DML_DSR 0000400 /* data set ready, not a real DM bit */
#define DML_RNG 0000200 /* ring */
#define DML_CAR 0000100 /* carrier detect */
#define DML_CTS 0000040 /* clear to send */
#define DML_SR 0000020 /* secondary receive */
#define DML_ST 0000010 /* secondary transmit */
#define DML_RTS 0000004 /* request to send */
#define DML_DTR 0000002 /* data terminal ready */
#define DML_LE 0000001 /* line enable */
|