xref: /original-bsd/sys/tahoe/vba/vxreg.h (revision 2301fdfb)
1 /*
2  * Copyright (c) 1988 Regents of the University of California.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms are permitted
6  * provided that the above copyright notice and this paragraph are
7  * duplicated in all such forms and that any documentation,
8  * advertising materials, and other materials related to such
9  * distribution and use acknowledge that the software was developed
10  * by the University of California, Berkeley.  The name of the
11  * University may not be used to endorse or promote products derived
12  * from this software without specific prior written permission.
13  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
14  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
15  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
16  *
17  *	@(#)vxreg.h	7.2 (Berkeley) 06/29/88
18  */
19 
20 /*
21  * Vioc hardware interface structure.
22  */
23 struct	vxdevice {
24 	char	v_vioc;		/*  0 type of interrupt + vioc busy flag */
25 	char	v_hdwre;	/*  1 trap, reset, or hard interrupt */
26 	char	v_vcbsy;	/*  2 command busy (set by host) */
27 	char	v_vcid;		/*  3 command identifier */
28 	short	v_vcp[2];	/*  4 command pointer (sent by host) */
29 	short	v_unused;	/*  8 unused */
30 	short	v_rspoff;	/*  a offset into vblock for response buf */
31 	char	v_ustat;	/*  c status */
32 	char	v_uqual;	/*  d interrupt qualifier */
33 	char	v_usdata[0x3E];	/*  e unsolicited interrupt data */
34 	short	v_maxxmt;	/* 4C max xmit block size */
35 	short	v_maxsilo;	/* 4E max silo size */
36 	char	v_ident;	/* 50 identifies type of vioc */
37 	char	v_fault;	/* 51 denotes fault or ready after reset */
38 	short	v_dcd;		/* 52 bit mask for carr detect by port */
39 	short	v_cts;		/* 54 bit mask for cts by port */
40 	short	v_dsr;		/* 56 bit mask for dsr by port */
41 	short	v_secrec;	/* 58 bit mask for secondary receive */
42 	short	v_badport;	/* 5a bit mask of failed ports */
43 	char	v_portyp[16];	/* 5c type of each port */
44 };
45 
46 /* control bits for v_vioc and v_hdwre */
47 #define	V_RESET 0x1		/* cause a vioc reset */
48 #define	V_TRP	0x2		/* cause a vioc trap */
49 #define	V_INTR	0x4		/* cause a vioc interrupt */
50 #define	V_ERR	0x80		/* generic error flag */
51 #define	V_BSY	0x80		/* generic busy flag */
52 #define	V_UNBSY	0x80		/* not busy for unsolicited interrupt */
53 
54 /* command identifier codes */
55 #define	VXC_LIDENT	0x0000		/* load ident, set int vectors */
56 #define	VXC_XMITDTA	0x0200		/* transmit */
57 #define	VXC_XMITIMM	0x0400		/* xmit immediate */
58 #define	VXC_FDTATOX	0x0300		/* flush data */
59 #define	VXC_LPARAX	0x0600		/* load params */
60 #define	VXC_SNDBRKX	0x0C00		/* send break to port */
61 #define	VXC_MDMCTL	0x1000		/* auto modem control */
62 /* bisync specific command identifiers */
63 #define	VXC_LPARAX1	0x060a
64 #define	VXC_MDMCTL1	0x1004
65 #define	VXC_HUNTMD1	0x0804
66 
67 /* vioc types returned during config */
68 #define	VXT_VIOCBOP	0x05		/* vioc-bop */
69 #define	VXT_PVIOCX	0x0A		/* old connector panel vioc-x */
70 #define	VXT_VIOCX	0x0B		/* new connector panel vioc-x */
71 #define	VXT_VIOCB	0x0C		/* vioc-bisync */
72 #define	VXT_NEW		0x10		/* new type bit (or'd in) */
73 
74 #define	VX_BISYNC	0x1		/* bisync flag indicator for bscport */
75 
76 /* connector panel types (per port) */
77 #define	VXT_NONE	0		/* no connector panel */
78 #define	VXT_8PORT	1		/* 8 port RS-232C */
79 #define	VXT_RS422	2		/* 8 port RS-422 (nonexistent) */
80 #define	VXT_4PORT	3		/* 4 port RS-232 (with DSR/RING) */
81 #define	VXT_PARALLEL	4		/* 4 port panel parallel port */
82 
83 /* v_fault status values */
84 #define	VXF_READY	0x55		/* no err in vioc self-initializaton */
85 
86 /* line parameters, set with VXC_LPARAX */
87 #define	BITS5		0x00		/* 5 bits per character */
88 #define	BITS6		0x80		/* 6 bits per character */
89 #define	BITS7		0x40		/* 7 bits per character */
90 #define	BITS8		0xc0		/* 8 bits per character */
91 
92 #define	VNOPARITY	0x00		/* no parity bit */
93 #define	VODDP		0x01		/* odd parity bit */
94 #define	VEVENP		0x03		/* even parity bit */
95 
96 #define	VSTOP1		0x04		/* 1 stop bit */
97 #define	VSTOP2		0x0c		/* 2 stop bit */
98 
99 #define	V19200		0x13		/* 19.2 kbaud */
100 
101 /* modem control flags */
102 #define	VMOD_ON		1
103 #define	VMOD_OFF	0
104 
105 #define	V_AUTO		0x00		/* auto control of RTS, uses CTS */
106 #define	V_MANUAL	0x80		/* manual control of RTS, ignore CTS */
107 #define	V_DTR_ON	0x02		/* set DTR output */
108 #define	V_DTR_OFF	0x00		/* drop DTR output */
109 #define	V_RTS		0x01		/* set RTS output (manual only) */
110 
111 #define	BRK_CHR	040			/* break character */
112 #define	DCD_ON	020			/* */
113 #define	DCD_OFF	010			/* */
114 #define	CTS_ON	004			/* */
115 #define	DSR_ON	0200			/* modem signal states for bisync */
116 #define	DSR_OFF 0100
117 #define	DSR_CHG	(DSR_ON|DSR_OFF)
118 
119 #define	VX_SILO	0x800			/* offset to base of silo */
120 
121 /* input status bits returned in silo */
122 #define	VX_PE	0x40			/* parity error */
123 #define	VX_FE	0x80			/* framing error */
124 #define	VX_RO	0xc0			/* receiver overrun */
125 
126 #define	VRESPLEN	12
127 #define	VCMDLEN		64
128 #define	VC_IQLEN	64		/* Interrupt circular queue length */
129 #define	NVCXBUFS	16*3		/* 3 bufs per port per viocx */
130 #define	VC_CMDBUFL	NVCXBUFS	/* circular cmd (to exec) queue len*/
131 
132 struct	vcmds {
133 	int	v_cmdsem;		/* # cmds waiting for itrque */
134 	int	v_curcnt;		/* # cmds in itrque and executing */
135 	caddr_t	v_curcmd[VCMDLEN];	/* pointers to cmds being executed */
136 	int	v_fill;			/* circular fill index */
137 	int	v_empty;		/* circular empty index */
138 	caddr_t	cmdbuf[VC_CMDBUFL];	/* circular cmd (to exec) queue */
139 	int	v_itrfill;		/* circular intr issue queue fill */
140 	int	v_itrempt;		/* circular intr issue queue empty */
141 	short	v_itrqueu[VC_IQLEN];	/* circular intr issue queue */
142 };
143 
144 struct	vxcmd {
145 	struct	vxcmd *c_fwd;
146 	short	cmd;
147 	char	par[58];		/* pad to 64 total size */
148 };
149 
150 struct	vxmit {
151 	char	line;
152 	char	bcount;
153 	char	ostream[6];
154 };
155 
156 #define	SSPEED	13			/* standard speed 9600 bps */
157