FreeBSD/Linux Kernel Cross Reference
sys/chips/tca100.h
1 /*
2 * Mach Operating System
3 * Copyright (c) 1992 Carnegie Mellon University
4 * All Rights Reserved.
5 *
6 * Permission to use, copy, modify and distribute this software and its
7 * documentation is hereby granted, provided that both the copyright
8 * notice and this permission notice appear in all copies of the
9 * software, derivative works or modified versions, and any portions
10 * thereof, and that both notices appear in supporting documentation.
11 *
12 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
13 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
14 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
15 *
16 * Carnegie Mellon requests users of this software to return to
17 *
18 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
19 * School of Computer Science
20 * Carnegie Mellon University
21 * Pittsburgh PA 15213-3890
22 *
23 * any improvements or extensions that they make and grant Carnegie Mellon
24 * the rights to redistribute these changes.
25 */
26
27 /*
28 * HISTORY
29 * $Log: tca100.h,v $
30 * Revision 2.2 93/08/10 15:19:07 mrt
31 * Initial check-in.
32 * [93/06/09 15:57:40 jcb]
33 *
34 */
35
36 #ifndef _TCA100_H_
37 #define _TCA100_H_ 1
38
39 #ifndef STUB
40 #include <chips/nw.h>
41 #else
42 #include "nw.h"
43 #endif
44
45 /*** FORE TCA-100 Turbochannel ATM computer interface ***/
46
47 /*** HARDWARE REGISTERS ***/
48
49 typedef volatile unsigned int vol_u_int;
50
51 typedef struct atm_device {
52 unsigned int prom[64 * 1024 / 4];
53 vol_u_int sreg;
54 vol_u_int creg_set;
55 vol_u_int creg_clr;
56 vol_u_int creg;
57 vol_u_int rxtimer;
58 unsigned int pad1;
59 vol_u_int rxtimerv;
60 unsigned int pad2;
61 vol_u_int rxcount;
62 unsigned int pad3;
63 vol_u_int rxthresh;
64 unsigned int pad4;
65 vol_u_int txcount;
66 unsigned int pad5;
67 vol_u_int txthresh;
68 unsigned int pad6[64*1024/4 - 15];
69 vol_u_int rxfifo[14];
70 unsigned int pad7[64*1024/4 - 14];
71 vol_u_int txfifo[14];
72 unsigned int pad8[64*1024/4 - 14];
73 } atm_device_s, *atm_device_t;
74
75
76 /*** DEFINITION OF BITS IN THE STATUS AND CONTROL REGISTERS ***/
77
78 #define RX_COUNT_INTR 0x0001
79 #define RX_EOM_INTR 0x0002
80 #define RX_TIME_INTR 0x0004
81 #define TX_COUNT_INTR 0x0008
82 #define RX_CELL_LOST 0x0010
83 #define RX_NO_CARRIER 0x0020
84 #define CR_RX_ENABLE 0x0040
85 #define CR_TX_ENABLE 0x0080
86 #define CR_RX_RESET 0x0100
87 #define CR_TX_RESET 0x0200
88
89 #define RX_COUNTER_MASK 0x03ff
90
91 /*** DEFINITION OF FIELDS FOR AAL3/4 WITH THE TCA-100 PADDING ***/
92
93 /*Header -- ATM header*/
94
95 #define VPI 0x0ff00000
96 #define VCI 0x000ffff0
97
98 #define ATM_HEADER_RSV_BITS 0x00000004
99
100 #define PERMANENT_VIRTUAL_CONNECTIONS 1
101
102 #if PERMANENT_VIRTUAL_CONNECTIONS
103 #define ATM_VPVC_MASK 0x3ff00000
104 #define ATM_VPVC_SHIFT 20
105 #else
106 #define ATM_VPVC_MASK 0x00003ff0
107 #define ATM_VPVC_SHIFT 4
108 #endif
109
110
111 /*First payload word -- SAR header*/
112
113 #define ATM_HEADER_CRC 0xff000000
114 #define ATM_HEADER_CRC_SYNDROME 0x00ff0000
115
116 #define SEG_TYPE 0x0000c000
117 #define BOM 0x00008000
118 #define COM 0x00000000
119 #define EOM 0x00004000
120 #define SSM 0x0000c000
121
122 #define BOM_DATA_SIZE 40
123 #define COM_DATA_SIZE 44
124 #define EOM_DATA_SIZE 40
125 #define SSM_DATA_SIZE 36
126
127 #define SEQ_NO 0x00003c00
128 #define SEQ_INC 0x00000400
129
130 #define MID 0x000003ff
131 #define MID_INC 0x00000001
132
133 #define SAR_HEADER_MASK (ATM_HEADER_CRC_SYNDROME | SEG_TYPE | SEQ_NO | MID)
134
135 /*Trailer -- SAR trailer and error flags*/
136
137 #define PAYLOAD_LENGTH 0xfc000000
138 #define FULL_SEGMENT_TRAILER (44 << 26)
139 #define EMPTY_SEGMENT_TRAILER (4 << 26)
140 #define SYNCH_SEGMENT_TRAILER (16 << 26)
141
142 #define FRAMING_ERROR 0x0001
143 #define HEADER_CRC_ERROR 0x0002
144 #define PAYLOAD_CRC_ERROR 0x0004
145 #define PAD2_ERROR 0x0007
146
147 #define SAR_TRAILER_MASK (PAYLOAD_LENGTH | PAD2_ERROR)
148 /*This field should be FULL_SEGMENT_TRAILER IN BOM OR COM*/
149
150
151 /*CS header and trailer fields*/
152
153 #define CS_PDU_TYPE 0xff000000
154 #define BE_TAG 0x00ff0000
155 #define BA_SIZE 0x0000ffff
156
157 #define CS_PROTOCOL_CONTROL_FIELD 0xff000000
158 #define CS_LENGTH 0x0000ffff
159
160 /*** DEVICE STATUS ***/
161
162 typedef enum { /*"Flavors" for device_get_status and device_set_status*/
163 ATM_MAP_SIZE, /* device_get_status options */
164 ATM_MTU_SIZE,
165 ATM_EVC_ID, /* ID of event counter assigned to device */
166 ATM_ASSIGNMENT, /* Returns two words indicating whether device is mapped
167 and number of tasks with the device open */
168 /* device_set_status options */
169 ATM_INITIALIZE, /* Restarts hardware and low-level driver */
170 ATM_PVC_SET /* Sets up a permanent virtual connection --
171 the status argument array is cast to a nw_pvc_s
172 structure */
173
174 } atm_status;
175
176 typedef struct {
177 nw_peer_s pvc; /* Permanent virtual connection */
178 u_int tx_vp; /* VPI used for transmissions to permanent virtual
179 connection. The VPI used for reception is the
180 local endpoint number. VCIs are 0 */
181 nw_protocol protocol; /* Protocol of connection (possibly NW_LINE) */
182 } nw_pvc_s, *nw_pvc_t;
183
184 /*** BYTE ORDER ***/
185
186 /*The ATM header and SAR header and trailer are converted to and from
187 host byte order by hardware. CS headers and trailers and
188 signaling messages need byte order conversion in software.
189 Conversion in software is also necessary for application messages
190 if the communicating hosts have different byte orders (e.g. DECstation
191 and SPARCstation). */
192
193 #define HTONL(x) \
194 ((x << 24) | ((x & 0xff00) << 8) | ((x >> 8) & 0xff00) | ((u_int) x >> 24))
195
196 #define NTOHL(x) HTONL(x)
197
198 #if 0
199 unsigned int htonl(unsigned int x) {
200
201 return ((x << 24) | ((x & 0xff00) << 8) | ((x >> 8) & 0xff00) | (x >> 24));
202 }
203
204 #define ntohl(x) htonl(x)
205
206 #endif
207
208 #endif /* _TCA100_H_ */
209
Cache object: 138d9ccfba70622e392c2df463f883ad
|