1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 #ifndef SDLA_H
19 #define SDLA_H
20
21
22 #define SDLA_TYPES
23 #define SDLA_S502A 5020
24 #define SDLA_S502E 5021
25 #define SDLA_S503 5030
26 #define SDLA_S507 5070
27 #define SDLA_S508 5080
28 #define SDLA_S509 5090
29 #define SDLA_UNKNOWN -1
30
31
32 #define SDLA_S508_PORT_V35 0x00
33 #define SDLA_S508_PORT_RS232 0x02
34
35
36 #define SDLA_CPU_3M 0x00
37 #define SDLA_CPU_5M 0x01
38 #define SDLA_CPU_7M 0x02
39 #define SDLA_CPU_8M 0x03
40 #define SDLA_CPU_10M 0x04
41 #define SDLA_CPU_16M 0x05
42 #define SDLA_CPU_12M 0x06
43
44
45 #define SDLA_IDENTIFY (FRAD_LAST_IOCTL + 1)
46 #define SDLA_CPUSPEED (FRAD_LAST_IOCTL + 2)
47 #define SDLA_PROTOCOL (FRAD_LAST_IOCTL + 3)
48
49 #define SDLA_CLEARMEM (FRAD_LAST_IOCTL + 4)
50 #define SDLA_WRITEMEM (FRAD_LAST_IOCTL + 5)
51 #define SDLA_READMEM (FRAD_LAST_IOCTL + 6)
52
53 struct sdla_mem {
54 int addr;
55 int len;
56 void *data;
57 };
58
59 #define SDLA_START (FRAD_LAST_IOCTL + 7)
60 #define SDLA_STOP (FRAD_LAST_IOCTL + 8)
61
62
63 #define SDLA_NMIADDR 0x0000
64 #define SDLA_CONF_ADDR 0x0010
65 #define SDLA_S502A_NMIADDR 0x0066
66 #define SDLA_CODE_BASEADDR 0x0100
67
68
69 #define SDLA_MAX_DATA 4080
70 #define SDLA_MAX_MTU 4072
71 #define SDLA_MAX_DLCI 24
72
73 struct sdla_conf {
74 short station;
75 short config;
76 short kbaud;
77 short clocking;
78 short max_frm;
79 short T391;
80 short T392;
81 short N391;
82 short N392;
83 short N393;
84 short CIR_fwd;
85 short Bc_fwd;
86 short Be_fwd;
87 short CIR_bwd;
88 short Bc_bwd;
89 short Be_bwd;
90 };
91
92 struct sdla_dlci {
93 short config;
94 short CIR_fwd;
95 short Bc_fwd;
96 short Be_fwd;
97 short CIR_bwd;
98 short Bc_bwd;
99 short Be_bwd;
100
101
102 short Tc_fwd;
103 short Tc_bwd;
104 short Tf_max;
105 short Tb_max;
106 };
107
108 #ifndef __KERNEL__
109
110 void sdla(void *cfg_info, char *dev, struct frad_conf *conf, int quiet);
111
112 #else
113
114
115 #define SDLA_CONTROL_WND 0xE000
116
117 #define SDLA_502_CMD_BUF 0xEF60
118 #define SDLA_502_RCV_BUF 0xA900
119 #define SDLA_502_TXN_AVAIL 0xFFF1
120 #define SDLA_502_RCV_AVAIL 0xFFF2
121 #define SDLA_502_EVENT_FLAGS 0xFFF3
122 #define SDLA_502_MDM_STATUS 0xFFF4
123 #define SDLA_502_IRQ_INTERFACE 0xFFFD
124 #define SDLA_502_IRQ_PERMISSION 0xFFFE
125 #define SDLA_502_DATA_OFS 0x0010
126
127 #define SDLA_508_CMD_BUF 0xE000
128 #define SDLA_508_TXBUF_INFO 0xF100
129 #define SDLA_508_RXBUF_INFO 0xF120
130 #define SDLA_508_EVENT_FLAGS 0xF003
131 #define SDLA_508_MDM_STATUS 0xF004
132 #define SDLA_508_IRQ_INTERFACE 0xF010
133 #define SDLA_508_IRQ_PERMISSION 0xF011
134 #define SDLA_508_TSE_OFFSET 0xF012
135
136
137 #define SDLA_EVENT_STATUS 0x01
138 #define SDLA_EVENT_DLCI_STATUS 0x02
139 #define SDLA_EVENT_BAD_DLCI 0x04
140 #define SDLA_EVENT_LINK_DOWN 0x40
141
142
143 #define SDLA_INTR_RX 0x01
144 #define SDLA_INTR_TX 0x02
145 #define SDLA_INTR_MODEM 0x04
146 #define SDLA_INTR_COMPLETE 0x08
147 #define SDLA_INTR_STATUS 0x10
148 #define SDLA_INTR_TIMER 0x20
149
150
151 #define SDLA_DLCI_DELETED 0x01
152 #define SDLA_DLCI_ACTIVE 0x02
153 #define SDLA_DLCI_WAITING 0x04
154 #define SDLA_DLCI_NEW 0x08
155 #define SDLA_DLCI_INCLUDED 0x40
156
157
158 #define SDLA_INFORMATION_WRITE 0x01
159 #define SDLA_INFORMATION_READ 0x02
160 #define SDLA_ISSUE_IN_CHANNEL_SIGNAL 0x03
161 #define SDLA_SET_DLCI_CONFIGURATION 0x10
162 #define SDLA_READ_DLCI_CONFIGURATION 0x11
163 #define SDLA_DISABLE_COMMUNICATIONS 0x12
164 #define SDLA_ENABLE_COMMUNICATIONS 0x13
165 #define SDLA_READ_DLC_STATUS 0x14
166 #define SDLA_READ_DLC_STATISTICS 0x15
167 #define SDLA_FLUSH_DLC_STATISTICS 0x16
168 #define SDLA_LIST_ACTIVE_DLCI 0x17
169 #define SDLA_FLUSH_INFORMATION_BUFFERS 0x18
170 #define SDLA_ADD_DLCI 0x20
171 #define SDLA_DELETE_DLCI 0x21
172 #define SDLA_ACTIVATE_DLCI 0x22
173 #define SDLA_DEACTIVATE_DLCI 0x23
174 #define SDLA_READ_MODEM_STATUS 0x30
175 #define SDLA_SET_MODEM_STATUS 0x31
176 #define SDLA_READ_COMMS_ERR_STATS 0x32
177 #define SDLA_FLUSH_COMMS_ERR_STATS 0x33
178 #define SDLA_READ_CODE_VERSION 0x40
179 #define SDLA_SET_IRQ_TRIGGER 0x50
180 #define SDLA_GET_IRQ_TRIGGER 0x51
181
182
183 #define SDLA_ICS_LINK_VERIFY 0x02
184 #define SDLA_ICS_STATUS_ENQ 0x03
185
186
187 #define SDLA_MODEM_DTR_HIGH 0x01
188 #define SDLA_MODEM_RTS_HIGH 0x02
189 #define SDLA_MODEM_DCD_HIGH 0x08
190 #define SDLA_MODEM_CTS_HIGH 0x20
191
192
193 #define SDLA_MODEM_DCD_LOW 0x01
194 #define SDLA_MODEM_CTS_LOW 0x02
195
196
197 #define SDLA_RET_OK 0x00
198 #define SDLA_RET_COMMUNICATIONS 0x01
199 #define SDLA_RET_CHANNEL_INACTIVE 0x02
200 #define SDLA_RET_DLCI_INACTIVE 0x03
201 #define SDLA_RET_DLCI_CONFIG 0x04
202 #define SDLA_RET_BUF_TOO_BIG 0x05
203 #define SDLA_RET_NO_DATA 0x05
204 #define SDLA_RET_BUF_OVERSIZE 0x06
205 #define SDLA_RET_CIR_OVERFLOW 0x07
206 #define SDLA_RET_NO_BUFF 0x08
207 #define SDLA_RET_TIMEOUT 0x0A
208 #define SDLA_RET_MODEM 0x10
209 #define SDLA_RET_CHANNEL_OFF 0x11
210 #define SDLA_RET_CHANNEL_ON 0x12
211 #define SDLA_RET_DLCI_STATUS 0x13
212 #define SDLA_RET_DLCI_UNKNOWN 0x14
213 #define SDLA_RET_COMMAND_INVALID 0x1F
214
215
216 #define SDLA_DIRECT_RECV 0x0080
217
218
219 #define SDLA_IRQ_RECEIVE 0x01
220 #define SDLA_IRQ_TRANSMIT 0x02
221 #define SDLA_IRQ_MODEM_STAT 0x04
222 #define SDLA_IRQ_COMMAND 0x08
223 #define SDLA_IRQ_CHANNEL 0x10
224 #define SDLA_IRQ_TIMER 0x20
225
226
227 #define SDLA_8K_WINDOW 0x01
228 #define SDLA_S502_SEG_A 0x10
229 #define SDLA_S502_SEG_C 0x20
230 #define SDLA_S502_SEG_D 0x00
231 #define SDLA_S502_SEG_E 0x30
232 #define SDLA_S507_SEG_A 0x00
233 #define SDLA_S507_SEG_B 0x40
234 #define SDLA_S507_SEG_C 0x80
235 #define SDLA_S507_SEG_E 0xC0
236 #define SDLA_S508_SEG_A 0x00
237 #define SDLA_S508_SEG_C 0x10
238 #define SDLA_S508_SEG_D 0x08
239 #define SDLA_S508_SEG_E 0x18
240
241
242 #define SDLA_IO_EXTENTS 0x04
243
244 #define SDLA_REG_CONTROL 0x00
245 #define SDLA_REG_PC_WINDOW 0x01
246 #define SDLA_REG_Z80_WINDOW 0x02
247 #define SDLA_REG_Z80_CONTROL 0x03
248
249 #define SDLA_S502_STS 0x00
250 #define SDLA_S508_GNRL 0x00
251 #define SDLA_S508_STS 0x01
252 #define SDLA_S508_IDR 0x02
253
254
255 #define SDLA_S502A_START 0x00
256 #define SDLA_S502A_INTREQ 0x02
257 #define SDLA_S502A_INTEN 0x04
258 #define SDLA_S502A_HALT 0x08
259 #define SDLA_S502A_NMI 0x10
260
261 #define SDLA_S502E_CPUEN 0x01
262 #define SDLA_S502E_ENABLE 0x02
263 #define SDLA_S502E_INTACK 0x04
264
265 #define SDLA_S507_ENABLE 0x01
266 #define SDLA_S507_IRQ3 0x00
267 #define SDLA_S507_IRQ4 0x20
268 #define SDLA_S507_IRQ5 0x40
269 #define SDLA_S507_IRQ7 0x60
270 #define SDLA_S507_IRQ10 0x80
271 #define SDLA_S507_IRQ11 0xA0
272 #define SDLA_S507_IRQ12 0xC0
273 #define SDLA_S507_IRQ15 0xE0
274
275 #define SDLA_HALT 0x00
276 #define SDLA_CPUEN 0x02
277 #define SDLA_MEMEN 0x04
278 #define SDLA_S507_EPROMWR 0x08
279 #define SDLA_S507_EPROMCLK 0x10
280 #define SDLA_S508_INTRQ 0x08
281 #define SDLA_S508_INTEN 0x10
282
283 struct sdla_cmd {
284 char opp_flag __attribute__((packed));
285 char cmd __attribute__((packed));
286 short length __attribute__((packed));
287 char retval __attribute__((packed));
288 short dlci __attribute__((packed));
289 char flags __attribute__((packed));
290 short rxlost_int __attribute__((packed));
291 long rxlost_app __attribute__((packed));
292 char reserve[2] __attribute__((packed));
293 char data[SDLA_MAX_DATA] __attribute__((packed));
294 };
295
296 struct intr_info {
297 char flags __attribute__((packed));
298 short txlen __attribute__((packed));
299 char irq __attribute__((packed));
300 char flags2 __attribute__((packed));
301 short timeout __attribute__((packed));
302 };
303
304
305 struct buf_info {
306 unsigned short rse_num __attribute__((packed));
307 unsigned long rse_base __attribute__((packed));
308 unsigned long rse_next __attribute__((packed));
309 unsigned long buf_base __attribute__((packed));
310 unsigned short reserved __attribute__((packed));
311 unsigned long buf_top __attribute__((packed));
312 };
313
314
315 struct buf_entry {
316 char opp_flag __attribute__((packed));
317 short length __attribute__((packed));
318 short dlci __attribute__((packed));
319 char flags __attribute__((packed));
320 short timestamp __attribute__((packed));
321 short reserved[2] __attribute__((packed));
322 long buf_addr __attribute__((packed));
323 };
324
325 #endif
326
327 #endif