|
|
1.1 root 1: /*
2: * Copyright (c) 1988 Regents of the University of California.
3: * All rights reserved.
4: *
5: * This code is derived from software contributed to Berkeley by
6: * Computer Consoles Inc.
7: *
8: * Redistribution and use in source and binary forms, with or without
9: * modification, are permitted provided that the following conditions
10: * are met:
11: * 1. Redistributions of source code must retain the above copyright
12: * notice, this list of conditions and the following disclaimer.
13: * 2. Redistributions in binary form must reproduce the above copyright
14: * notice, this list of conditions and the following disclaimer in the
15: * documentation and/or other materials provided with the distribution.
16: * 3. All advertising materials mentioning features or use of this software
17: * must display the following acknowledgement:
18: * This product includes software developed by the University of
19: * California, Berkeley and its contributors.
20: * 4. Neither the name of the University nor the names of its contributors
21: * may be used to endorse or promote products derived from this software
22: * without specific prior written permission.
23: *
24: * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27: * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34: * SUCH DAMAGE.
35: *
36: * @(#)mpreg.h 7.4 (Berkeley) 6/28/90
37: */
38:
39: /*
40: * MPCC Asynchronous Communications Interface.
41: */
42: #define MPINTRBASE 0xa0 /* base vector for interupts */
43: #define MPMAGIC 1969 /* magic number for mblok */
44: #define MPMAXPORT 32 /* maximum number of ports on an MPCC */
45:
46: /*
47: * MPCC's are capable of supporting one of a
48: * the protocols listed below. This driver
49: * supports only the async terminal protocol.
50: */
51: #define MPPROTO_UNUSED 0 /* port not in use */
52: #define MPPROTO_ASYNC 1 /* async protocol */
53: #define MPPROTO_X25 2 /* x25 protocol (unsupported) */
54: #define MPPROTO_BISYNC 3 /* bisync protocol (unsupported) */
55: #define MPPROTO_SNA 4 /* sna protocol (unsupported) */
56:
57: #define NMPPROTO 5 /* max protocols supported by MPCC */
58:
59: #define MPINSET 8
60: #define MPOUTSET 8
61:
62: /*
63: * Host Interface semaphores
64: */
65: #define MPSEMA_AVAILABLE 1
66: #define MPSEMA_WORK 4
67:
68: /*
69: * Host Interface imok values
70: */
71: #define MPIMOK_ALIVE 0x01
72: #define MPIMOK_DEAD 0x80
73:
74: /*
75: * Host Interface Structure
76: */
77: struct his {
78: u_char semaphore;
79: u_char imok;
80: u_char brdnum; /* Virtual brd number for protocol */
81: u_char unused;
82: struct {
83: u_char inbdone[MPMAXPORT]; /* Ports w/ inbound completed */
84: u_char outbdone[MPMAXPORT]; /* Ports w/outbound available */
85: u_int fill[2];
86: } proto[NMPPROTO];
87: };
88:
89: #define MPPORT_EOL 0xff /* end of port list */
90:
91: /*
92: * Async host transmit list structure.
93: */
94: #define MPXMIT 4 /* # of transmit ptrs/MP_WRITE event */
95:
96: struct hxmtl {
97: caddr_t dblock[MPXMIT]; /* ptrs to data blocks */
98: u_short size[MPXMIT]; /* size of each block */
99: };
100:
101: /*
102: * MPCC asynchronous protocol events.
103: */
104: struct mpevent {
105: u_char ev_status; /* Go Status */
106: u_char ev_cmd; /* Optional Op-code */
107: u_short ev_opts; /* Optional flags */
108: u_short ev_error; /* error status returned */
109: u_short ev_flags; /* optional event flags field */
110: caddr_t ev_params; /* pointer to event parameters */
111: union {
112: struct hxmtl *hxl; /* pointer to host xmit list */
113: u_char *rcvblk; /* pointer to receive block */
114: } ev_un;
115: u_short ev_count; /* # ptrs in xmit list/# receive chars */
116: u_short ev_unused; /* round to longword */
117: u_int ev_unused2; /* round to size of BSC struct. GROT!! */
118: };
119:
120: /* defines for ev_status */
121: #define EVSTATUS_FREE 0
122: #define EVSTATUS_GO 1
123: #define EVSTATUS_BUSY 2
124: #define EVSTATUS_DONE 4
125:
126: /* defines for ev_cmd */
127: #define EVCMD_OPEN 1
128: #define EVCMD_CLOSE 2
129: #define EVCMD_RESET 3
130: #define EVCMD_IOCTL 4
131: #define EVCMD_WRITE 5
132: #define EVCMD_READ 6
133: #define EVCMD_STATUS 7
134: #define EVCMD_EVENT 8
135:
136: /*
137: * Host-MPCC interface block.
138: */
139: struct mblok {
140: u_char mb_status; /* mpcc status */
141: u_char mb_ivec; /* host interrupt vector */
142: u_short mb_magic;
143: u_char mb_diagswitch[2]; /* run diagnostics/application */
144: u_char mb_softerr; /* soft error code */
145: u_char mb_harderr; /* hard error code */
146: struct mpdl { /* download/config area */
147: u_char mpdl_status; /* control/status */
148: u_char mpdl_cmd; /* request type */
149: u_short mpdl_count; /* size of parameter block */
150: caddr_t mpdl_data; /* command parameters */
151: } mb_dl;
152: u_char mb_hiport, mb_loport; /* high-low mpcc port numbers */
153: u_char mb_unit; /* mpcc unit number */
154: u_char mb_hndshk; /* handshaking timer */
155: caddr_t mb_imokclk; /* handshaking clock */
156: u_char mb_nointcnt; /* no interrupt from handshake */
157: u_char mb_mpintcnt; /* # outstanding interupts to MPCC */
158: short mb_unused;
159: caddr_t mb_mpintclk; /* MPCC interrupt clock */
160: struct his mb_hostint; /* To Talk with Host */
161: u_char mb_proto[MPMAXPORT]; /* per-port protocols */
162: u_char mb_intr[MPMAXPORT]; /* per-port host->mpcc int flags */
163: struct mpport { /* per-port structure */
164: u_short mp_proto; /* protocol of port */
165: u_char mp_on; /* Next available entry on Host */
166: u_char mp_off; /* Next expected 'DONE' entry on Host */
167: struct mpevent mp_recvq[MPINSET]; /* queue of events to host */
168: struct mpevent mp_sendq[MPOUTSET];/* queue of events to mpcc */
169: u_char mp_nextrcv; /* next expected 'DONE' entry on Host */
170: u_char mp_flags; /* host flags */
171: short mp_unused;
172: caddr_t mp_data; /* pointer to data for port */
173: } mb_port[MPMAXPORT];
174: };
175:
176: /* status defines for mblok.status */
177: #define MP_DLPEND 1
178: #define MP_DLOPEN 2
179: #define MP_DLDONE 3
180: #define MP_OPCLOSE 4
181: #define MP_OPOPEN 5
182: #define MP_DLTIME 6
183: #define MP_DLERROR (-1)
184:
185: /* hard error status values loaded into mblock.herr */
186: #define NOHERR 0 /* no error */
187: #define MPBUSERR 1 /* bus error */
188: #define ADDRERR 2 /* address error */
189: #define UNDECC 3 /* undefined ecc interrupt */
190: #define UNDINT 4 /* undefined interrupt */
191: #define PWRFL 5 /* power fail occurred */
192: #define NOXENTRY 6 /* xdone was enterred w/o xmit entry on queue */
193: #define TWOFTMRS 7 /* tried to start two fast timers on one port */
194: #define INTQFULL 8 /* interupt queue full */
195: #define INTQERR 9 /* interupt queue ack error */
196: #define CBPERR 10 /* uncorrectable DMA parity error */
197: #define ACPDEAD 11 /* acap has died */
198: /* additional panic codes not listed */
199:
200: /* soft error status values loaded into mblock.serr */
201: #define NOSERR 0 /* no error */
202: #define DMAPERR 1 /* dma parity error */
203: #define ECCERR 2 /* local memory ecc error */
204:
205: /* Defines for flags */
206: #define MP_PROGRESS 1 /* Open or Close is in progress */
207: #define MP_IOCTL 2 /* IOCTL is in progress */
208: #define MP_REMBSY 4 /* remote station busy */
209:
210: /*
211: * Asynchronous Terminal Protocol Definitions.
212: */
213: #define A_RCVTIM 2 /* default max tix for receive event (~20ms) */
214: #define ACPTMR 300 /* approx. 5 secs to wait for acap */
215: #define A_MAXEVTP 3 /* maximum # of L1 or Host Events to */
216: /* process per port at one time */
217: #define A_MAXRCV 128 /* max # of chars in rcv event - enough */
218: /* to hold 20ms of chars at 19.2KB */
219: #define A_NUMRCV 32 /* number of rcv buffers per port */
220: #define A_NUMXMT 2 /* max number of concurrent xmits/port */
221: #define A_NUMEVT 32 /* number of evt bufs for status evts */
222: /* and L2 to L1 transmit evts */
223: #define WR5 5 /* SCC Write Reg 5 */
224: #define TXENBL 0x08 /* mask to enable transmitter in WR 5 */
225: #define RTSON 0x02 /* mask to turn on RTS in wreg 5 */
226: #define CHR5MSK 0x1F /* mask for 5-bit transmit data */
227:
228: /*
229: * macro to adjust a circular buffer ptr
230: * x = pointer or index
231: * sz = size of circular buffer
232: */
233: #define adjptr(x,sz) ((x) = ((++(x) == (sz)) ? 0 : (x)))
234: #define adjptrbk(x,sz) ((x) = ((x) == 0) ? (sz) : --(x))
235:
236: /*
237: * Events from ASYNC Level 1 to Level 2
238: */
239: #define RCVDTA 10 /* normal receive data available */
240: #define PARERR 11 /* receive data with parity error */
241: #define OVRNERR 12 /* receive data with overrun error */
242: #define OVFERR 13 /* receive data with overflow error */
243: #define FRAMERR 14 /* receive data with framing error */
244: #define ACKXMT 15 /* successful completion of transmit */
245: #define NORBUF 16 /* No Receive Buffers available */
246: #define NOEBUF 17 /* No Event Buffers available */
247: #define BRKASRT 18 /* Break condition detected */
248:
249: /* defines for error conditions */
250: #define A_OK 0 /* No Errors */
251: #define A_INVEVT 1 /* Invalid Event Error */
252: #define A_IOCERR 2 /* Error while configuring port */
253: #define A_SIZERR 3 /* Error in count of data chars to xmt */
254: #define A_NXBERR 4 /* Transmit Incomplete due to lack of bufs */
255:
256: /*
257: * Modem control signal control structure.
258: */
259: struct mdmctl {
260: u_char mc_rngdsr; /* ring or dsr */
261: u_char mc_rts; /* request to send */
262: u_char mc_rate;
263: u_char mc_dcd; /* data carrier detect */
264: u_char mc_sectx; /* secondary transmit */
265: u_char mc_cts; /* clear to send */
266: u_char mc_secrx; /* secondary receive */
267: u_char mc_dtr; /* data terminal ready */
268: };
269:
270: /* defines for modem control lines */
271: #define ASSERT 1 /* line asserted */
272: #define DROP 2 /* line dropped */
273: #define AUTO 3 /* auto mode enabled, rts only */
274:
275: /*
276: * Async parameter structure.
277: */
278: struct asyncparam {
279: u_char ap_xon, ap_xoff; /* xon-xoff characters */
280: u_char ap_xena; /* xon/xoff enabled */
281: u_char ap_xany; /* any received char enables xmitter */
282: struct mdmctl ap_modem; /* port modem control lines */
283: struct mdmctl ap_intena; /* modem signals which generate */
284: /* status change events */
285: u_char ap_data; /* number of data bits */
286: u_char ap_stop; /* number of stop bits */
287: u_char ap_baud; /* baud rate */
288: u_char ap_parity; /* even/odd/no parity */
289: u_char ap_loop; /* enable for local loopback */
290: u_char ap_rtimer; /* receive timer value (msec) */
291: short ap_fill; /* round to longword */
292: };
293:
294: /* enable/disable signal codes */
295: #define MPA_ENA 1 /* condition enabled */
296: #define MPA_DIS 2 /* condition disabled */
297:
298: /* defines for ap_data */
299: #define MPCHAR_5 0 /* 5 bits per character */
300: #define MPCHAR_6 2 /* 6 bits per character */
301: #define MPCHAR_7 1 /* 7 bits per character */
302: #define MPCHAR_8 3 /* 8 bits per character */
303:
304: /* defines for ap_stop */
305: #define MPSTOP_1 1 /* 1 stop bit per character */
306: #define MPSTOP_1_5 2 /* 1 1/2 stop bits per character */
307: #define MPSTOP_2 3 /* 2 stop bits per character */
308:
309: /* defines for ap_baud */
310: #define MODEM 0
311: #define M0 0 /* baud rate = 0 */
312: #define M50 1 /* baud rate = 50 */
313: #define M75 2 /* baud rate = 75 */
314: #define M110 3 /* baud rate = 110 */
315: #define M134_5 4 /* baud rate = 134.5 */
316: #define M150 5 /* baud rate = 150 */
317: #define M200 6 /* baud rate = 200 */
318: #define M300 7 /* baud rate = 300 */
319: #define M600 8 /* baud rate = 600 */
320: #define M1200 9 /* baud rate = 1200 */
321: #define M1800 10 /* baud rate = 1800 */
322: #define M2400 11 /* baud rate = 2400 */
323: #define M4800 12 /* baud rate = 4800 */
324: #define M9600 13 /* baud rate = 9600 */
325: #define MEXTA 14 /* baud rate = Ext A */
326: #define MEXTB 15 /* baud rate = Ext B */
327: #define M2000 16 /* baud rate = 2000 */
328: #define M3600 17 /* baud rate = 3600 */
329: #define M7200 18 /* baud rate = 7200 */
330: #define M19200 19 /* baud rate = 19,200 */
331: #define M24000 20 /* baud rate = 24,000 */
332: #define M28400 21 /* baud rate = 28,400 */
333: #define M37800 22 /* baud rate = 37,800 */
334: #define M40300 23 /* baud rate = 40,300 */
335: #define M48000 24 /* baud rate = 48,000 */
336: #define M52000 25 /* baud rate = 52,000 */
337: #define M56800 26 /* baud rate = 56,800 */
338:
339: /* defines for ap_parity */
340: #define MPPAR_NONE 0 /* no parity */
341: #define MPPAR_ODD 1 /* odd parity */
342: #define MPPAR_EVEN 3 /* even parity */
343:
344: /* possible flags for Host MP_IOCTL Events */
345: #define A_CHGX 1 /* IOCTL is only chging xonxoff params */
346: #define A_MDMCHG 2 /* change modem control lines */
347: #define A_MDMGET 3 /* get current state of modem ctl lines */
348: #define A_CHGL1P 4 /* IOCTL is changing changing L1 params */
349: #define A_BRKON 5 /* set port break bit */
350: #define A_BRKOFF 6 /* clear port break bit */
351: #define A_CHGALL 7 /* IOCTL is changing xonxoff params, */
352: /* pcnfg struct, & modem ctl structs */
353: #define A_DISABX 8 /* disable port transmitter (ctl-s) */
354: #define A_ENABLX 9 /* enable port transmitter (ctl-q) */
355:
356: /* possible flags for Host MP_WRITE Events */
357: #define A_FLUSH 1 /* flush any queued transmit events */
358: #define A_SSTOP 2 /* transmit a port stop (xoff) char */
359: /* before sending rest of event xmts */
360: #define A_SSTART 3 /* transmit a port start (xon) char */
361: /* before sending rest of event xmts */
362:
363: /* possible flags for Outbound MP_READ Events */
364: #define A_XOFF 1 /* transmitter stopped from by xoff char */
365:
366: /* Perpos flags for modem control fields */
367: #define A_RNGDSR 00001
368: #define A_RTS 00002
369: #define A_RATE 00004
370: #define A_DCD 00010
371: #define A_SECTX 00020
372: #define A_CTS 00040
373: #define A_SECRX 00100
374: #define A_DTR 00200
375:
376: #define DCDASRT 100 /* data carrier detect asserted */
377: #define DTRASRT 101 /* data terminal ready asserted */
378: #define RNGASRT 102 /* ring indicator asserted */
379: #define DSRASRT 102 /* data set ready asserted */
380: #define CTSASRT 103 /* clear to send asserted */
381: #define RTSASRT 104 /* ready to send asserted */
382: #define STXASRT 105 /* secondary transmit asserted */
383: #define SRXASRT 106 /* secondary recieve asserted */
384: #define RATEASRT 107 /* rate signal asserted */
385: #define DCDDROP 108 /* data carrier detect dropped */
386: #define DTRDROP 109 /* data terminal ready dropped */
387: #define RNGDROP 110 /* ring indicator dropped */
388: #define MPDSRDROP 110 /* data set ready dropped */
389: #define CTSDROP 111 /* clear to send dropped */
390: #define RTSDROP 112 /* ready to send dropped */
391: #define STXDROP 113 /* secondary transmit dropped */
392: #define SRXDROP 114 /* secondary recieve dropped */
393: #define RATEDROP 115 /* rate signal dropped */
394:
395: /* Defines for filters and intena in portstat */
396: #define MDM_OFF 0
397: #define MDM_ON 1
398:
399: /* Modem on/off flags */
400: #define MMOD_OFF 0
401: #define MMOD_ON 1
402:
403: /* defintions for DL interface */
404:
405: #define MPDLBUFSIZE 1024
406:
407: /* mpdlioctl command defines */
408:
409: struct protports {
410: char protoport[MPMAXPORT];
411: };
412:
413: struct abdcf {
414: short xmtbsz; /* transmit buffer size - should */
415: /* equal # of chars in a cblock */
416: };
417:
418: struct bdcf {
419: char loadname[NMPPROTO+1];
420: char protoports[MPMAXPORT];
421: char fccstimer; /* powerfail timer */
422: char fccsports; /* ports to affect */
423: char fccssoc; /* ports which will 'switch on close' */
424: };
425:
426:
427: /* These ioctls are for the dlmpcc command */
428: #define MPIOPORTMAP _IOW('m',1, struct protports)
429: #define MPIOHILO _IOW('m',3, short)
430: #define MPIOENDCODE _IO('m',4)
431: #define MPIOASYNCNF _IOW('m',7, struct abdcf)
432: #define MPIOENDDL _IO('m',10)
433: #define MPIOSTARTDL _IO('m',11)
434: #define MPIORESETBOARD _IO('m',12)
435:
436: /* mpdlwrite opcode defines */
437:
438: #define MPDLCMD_NORMAL 1
439:
440: /* error messages printed at console , board & port # filled in later */
441:
442: #define A_INVSTS "Invalid Status Event "
443: #define A_INVCMD "Invalid Event From the MPCC "
444: #define A_NORBUF "No More Available Receive Buffers "
445: #define A_NOEBUF "No More Available Event Buffers "
446: #define A_OVRN "Overrun Error Detected "
447: #define A_OVRF "Overflow Error Detected "
448: #define A_NOXBUF "No More Available Transmit Event Buffers "
449: #define A_XSIZE "Transmit Data Block Size Exceeds Event Data Buffer Size "
450: #define A_NOFREIN "No Available Inbound Entries to Send Close Event "
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.