Driver for ADAX APC-PCX, an SGS Thompson MK5025 based HDLC board
[unix-history] / usr / src / sys / i386 / isa / if_apxreg.h
CommitLineData
b852041a
KS
1/*
2 * Copyright (c) 1982, 1990 The Regents of the University of California.
3 * All rights reserved.
4 *
5 * %sccs.include.redist.c%
6 *
7 * @(#)if_apxreg.h 7.1 (Berkeley) %G%
8 */
9
10
11/* SGS Thompson MK5205 structures and registers */
12
13/*
14 * Device Control Ports
15 * (Multiplexed CSR's)
16 */
17struct sgcp {
18 u_short sgcp_rdp;
19 u_short sgcp_rap;
20};
21/*
22 * Operating Parameters for timers etc.
23 * (Suitable for reseting by ioctl).
24 */
25struct sgop {
26 u_short lsaddr;
27 u_short rsaddr;
28 u_short n1;
29 u_short n2_scale;
30 u_short t1;
31 u_short t3;
32 u_short tp;
33};
34
35/*
36 * common format for tx/rx descriptors
37 */
38
39struct sgdx {
40 u_short sgdx_flags;
41 u_short sgdx_addr;
42 short sgdx_bcnt;
43 u_short sgdx_mcnt;
44};
45
46/*
47 * interpretation of reported errors
48 */
49struct sger {
50 u_short sger_bad;
51 u_short sger_t1timo;
52 u_short sger_frmr;
53 u_short sger_txrej;
54 u_short sger_rxrej;
55 u_short sger_short;
56};
57
58/*
59 * Status Buffer, paried bytes hi order low order
60 */
61struct sgsb {
62 u_short sgsb_vrvs;
63 u_short sgsb_lsrs;
64 u_short sgsb_phzva;
65 u_short sgsb_hirxcnt;
66 u_short sgsb_lorxcnt;
67 u_short sgsb_hitxcnt;
68 u_short sgsb_lotxcnt;
69};
70
71#define SGMTU 1032
72#define SGRBUF 16
73#define SGRBUFLOG2 4
74#define SG_RLEN (SGRBUF_LOG2 << 12)
75#define SGTBUF 8
76#define SGTBUFLOG2 3
77#define SG_TLEN (SGTBUF_LOG2 << 12)
78
79/*
80 * APC-PCX RAM
81 */
82
83struct apc_mem {
84 /* Initialization Block */
85 u_short apc_mode;
86 struct sgop apc_sgop;
87 u_short apc_rlen;
88 u_short apc_rdra;
89 u_short apc_tlen;
90 u_short apc_tdra;
91 struct sgdx apc_txtid;
92 struct sgdx apc_rxtid;
93 u_short apc_stathi;
94 u_short apc_statlo;
95 struct sger apc_sger;
96 struct sgsb apc_sgsb; /* Status Buffer */
97 struct sgdx apc_rxmd[SGRBUF]; /* Receive Message Descriptors */
98 struct sgdx apc_txmd[SGTBUF]; /* Transmit Message Descriptors */
99 char apc_rbuf[SGRBUF][SGMTU]; /* Receive Message Buffers */
100 char apc_tbuf[SGTBUF][SGMTU]; /* Transmit Message Buffers */
101 char apc_rxidbuf[SGMTU];
102 char apc_txidbuf[SGMTU];
103};
104/*
105 * APC-PCX registers
106 */
107struct apc_reg {
108 struct sgcb axr_sgcb[2];
109 u_char arx_pad0[4];
110 u_char axr_cnt0;
111 u_char axr_cnt1;
112 u_char axr_cnt2;
113 u_char axr_ccr;
114 u_char axr_mode;
115 u_char axr_pad1;
116 u_char axr_status;
117 u_char axr_pad2;
118 u_char axr_altmode;
119 u_char axr_pad3[11];
120};
121
122/*
123 * Hardware tweaking
124 */
125struct apc_modes {
126 struct sgop apm_sgop; /* tweak timers */
127 u_char apm_txwin; /* set parameter for transmit window */
128 u_char apm_apxmode;
129 u_char apm_apxaltmode;
130 u_char apm_iftype; /* someday indicate PPP vs X.25 */
131};
132
133#define SIOCSIFMODE _IOW('i', 127, struct apc_modes) /* set parameters */
134
135/* TX RX descriptor bits */
136#define SG_OWN 0x8000
137#define SG_SLF 0x2000
138#define SG_ELF 0x1000
139#define SG_TUI 0x800
140
141/* CSR0 quantities */
142#define SG_TDMD 0x8000
143#define SG_STOPPED 0x4000
144#define SG_DTX 0x2000
145#define SG_DRX 0x1000
146#define SG_TXON 0x800
147#define SG_RXON 0x400
148#define SG_INEA 0x200
149#define SG_INTR 0x100
150#define SG_MERR 0x80
151#define SG_MISS 0x40
152#define SG_ROR 0x20
153#define SG_TUR 0x10
154#define SG_PINT 0x8
155#define SG_TINT 0x4
156#define SG_RINT 0x2
157
158/* CSR1 quantities */
159#define SG_UAV 0x4000
160#define SG_PAV 0x40
161#define SG_STOP 0
162#define SG_INIT (2 << 8)
163#define SG_TRANS (3 << 8)
164#define SG_STAT (4 << 8)
165
166#define SG_PROM 0x400
167#define SG_UIE 0x200
168#define SG_BSWAP 0x20