xref: /original-bsd/sys/vax/if/if_ilreg.h (revision c577960b)
1 /*
2  * Copyright (c) 1982, 1986 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  *	@(#)if_ilreg.h	7.2 (Berkeley) 08/04/88
18  */
19 
20 /*
21  * Interlan Ethernet Communications Controller interface
22  */
23 struct ildevice {
24 	short	il_csr;		/* Command and Status Register */
25 	short	il_bar;		/* Buffer Address Register */
26 	short	il_bcr;		/* Byte Count Register */
27 };
28 
29 /*
30  * Command and status bits
31  */
32 #define	IL_EUA		0xc000		/* Extended Unibus Address */
33 #define	IL_CMD		0x3f00		/* Command Function Code */
34 #define	IL_CDONE	0x0080		/* Command Done */
35 #define	IL_CIE		0x0040		/* Command Interrupt Enable */
36 #define	IL_RDONE	0x0020		/* Receive DMA Done */
37 #define	IL_RIE		0x0010		/* Receive Interrupt Enable */
38 #define	IL_STATUS	0x000f		/* Command Status Code */
39 
40 #define	IL_BITS		"\20\10CDONE\7CIE\6RDONE\5RIE"
41 
42 /* command definitions */
43 #define	ILC_MLPBAK	0x0100		/* Set Module Interface Loopback Mode */
44 #define	ILC_ILPBAK	0x0200		/* Set Internal Loopback Mode */
45 #define	ILC_CLPBAK	0x0300		/* Clear Loopback Mode */
46 #define	ILC_PRMSC	0x0400		/* Set Promiscuous Receive Mode */
47 #define	ILC_CLPRMSC	0x0500		/* Clear Promiscuous Receive Mode */
48 #define	ILC_RCVERR	0x0600		/* Set Receive-On-Error Bit */
49 #define	ILC_CRCVERR	0x0700		/* Clear Receive-On-Error Bit */
50 #define	ILC_OFFLINE	0x0800		/* Go Offline */
51 #define	ILC_ONLINE	0x0900		/* Go Online */
52 #define	ILC_DIAG	0x0a00		/* Run On-board Diagnostics */
53 #define	ILC_ISA		0x0d00		/* Set Insert Source Address Mode */
54 #define	ILC_CISA	0x0e00		/* Clear Insert Source Address Mode */
55 #define	ILC_DEFPA	0x0f00		/* Set Physical Address to Default */
56 #define	ILC_ALLMC	0x1000		/* Set Receive All Multicast Packets */
57 #define	ILC_CALLMC	0x1100		/* Clear Receive All Multicast */
58 #define	ILC_STAT	0x1800		/* Report and Reset Statistics */
59 #define	ILC_DELAYS	0x1900		/* Report Collision Delay Times */
60 #define	ILC_RCV		0x2000		/* Supply Receive Buffer */
61 #define	ILC_LDXMIT	0x2800		/* Load Transmit Data */
62 #define	ILC_XMIT	0x2900		/* Load Transmit Data and Send */
63 #define	ILC_LDGRPS	0x2a00		/* Load Group Addresses */
64 #define	ILC_RMGRPS	0x2b00		/* Delete Group Addresses */
65 #define	ILC_LDPA	0x2c00		/* Load Physical Address */
66 #define	ILC_FLUSH	0x3000		/* Flush Receive BAR/BCR Queue */
67 #define	ILC_RESET	0x3f00		/* Reset */
68 
69 /*
70  * Error codes found in the status bits of the csr.
71  */
72 #define	ILERR_SUCCESS		0	/* command successful */
73 #define	ILERR_RETRIES		1	/* " " with retries */
74 #define	ILERR_BADCMD		2	/* illegal command */
75 #define	ILERR_INVCMD		3	/* invalid command */
76 #define	ILERR_RECVERR		4	/* receiver error */
77 #define	ILERR_BUFSIZ		5	/* buffer size too big */
78 #define	ILERR_FRAMESIZ		6	/* frame size too small */
79 #define	ILERR_COLLISIONS	8	/* excessive collisions */
80 #define	ILERR_BUFALIGNMENT	10	/* buffer not word aligned */
81 #define	ILERR_NXM		15	/* non-existent memory */
82 
83 #define	NILERRS			16
84 #ifdef ILERRS
85 char *ilerrs[NILERRS] = {
86 	"success",			/*  0 */
87 	"success with retries", 	/*  1 */
88 	"illegal command",		/*  2 */
89 	"inappropriate command",	/*  3 */
90 	"failure",			/*  4 */
91 	"buffer size exceeded",		/*  5 */
92 	"frame too small",		/*  6 */
93 	0,				/*  7 */
94 	"excessive collisions",		/*  8 */
95 	0,				/*  9 */
96 	"buffer alignment error",	/* 10 */
97 	0,				/* 11 */
98 	0,				/* 12 */
99 	0,				/* 13 */
100 	0,				/* 14 */
101 	"non-existent memory"		/* 15 */
102 };
103 #endif
104 
105 /*
106  * Diagnostics codes.
107  */
108 #define	ILDIAG_SUCCESS		0	/* no problems */
109 #define	ILDIAG_CHKSUMERR	1	/* ROM/RAM checksum error */
110 #define	ILDIAG_DMAERR		2	/* DMA not working */
111 #define	ILDIAG_XMITERR		3	/* xmit circuitry failure */
112 #define	ILDIAG_RECVERR		4	/* rcvr circuitry failure */
113 #define	ILDIAG_LOOPBACK		5	/* loopback test failed */
114 
115 #define	NILDIAGS		6
116 #ifdef ILDIAGS
117 char *ildiag[NILDIAGS] = {
118 	"success",			/* 0 */
119 	"checksum error",		/* 1 */
120 	"NM10 dma error",		/* 2 */
121 	"transmitter error",		/* 3 */
122 	"receiver error",		/* 4 */
123 	"loopback failure",		/* 5 */
124 };
125 #endif
126 
127 /*
128  * Frame status bits, returned in frame status byte
129  * at the top of each received packet.
130  */
131 #define	ILFSTAT_C	0x1		/* CRC error */
132 #define	ILFSTAT_A	0x2		/* alignment error */
133 #define	ILFSTAT_L	0x4		/* 1+ frames lost just before */
134