xref: /csrg-svn/sys/vax/if/if_ilreg.h (revision 35323)
123299Smckusick /*
229285Smckusick  * Copyright (c) 1982, 1986 Regents of the University of California.
3*35323Sbostic  * All rights reserved.
423299Smckusick  *
5*35323Sbostic  * Redistribution and use in source and binary forms are permitted
6*35323Sbostic  * provided that the above copyright notice and this paragraph are
7*35323Sbostic  * duplicated in all such forms and that any documentation,
8*35323Sbostic  * advertising materials, and other materials related to such
9*35323Sbostic  * distribution and use acknowledge that the software was developed
10*35323Sbostic  * by the University of California, Berkeley.  The name of the
11*35323Sbostic  * University may not be used to endorse or promote products derived
12*35323Sbostic  * from this software without specific prior written permission.
13*35323Sbostic  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
14*35323Sbostic  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
15*35323Sbostic  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
16*35323Sbostic  *
17*35323Sbostic  *	@(#)if_ilreg.h	7.2 (Berkeley) 08/04/88
1823299Smckusick  */
196895Sfeldman 
206895Sfeldman /*
216895Sfeldman  * Interlan Ethernet Communications Controller interface
226895Sfeldman  */
236895Sfeldman struct ildevice {
246895Sfeldman 	short	il_csr;		/* Command and Status Register */
256895Sfeldman 	short	il_bar;		/* Buffer Address Register */
266895Sfeldman 	short	il_bcr;		/* Byte Count Register */
276895Sfeldman };
286895Sfeldman 
296895Sfeldman /*
306895Sfeldman  * Command and status bits
316895Sfeldman  */
327265Ssam #define	IL_EUA		0xc000		/* Extended Unibus Address */
336895Sfeldman #define	IL_CMD		0x3f00		/* Command Function Code */
346895Sfeldman #define	IL_CDONE	0x0080		/* Command Done */
356895Sfeldman #define	IL_CIE		0x0040		/* Command Interrupt Enable */
366895Sfeldman #define	IL_RDONE	0x0020		/* Receive DMA Done */
376895Sfeldman #define	IL_RIE		0x0010		/* Receive Interrupt Enable */
386895Sfeldman #define	IL_STATUS	0x000f		/* Command Status Code */
396895Sfeldman 
407265Ssam #define	IL_BITS		"\20\10CDONE\7CIE\6RDONE\5RIE"
416895Sfeldman 
427265Ssam /* command definitions */
436895Sfeldman #define	ILC_MLPBAK	0x0100		/* Set Module Interface Loopback Mode */
446895Sfeldman #define	ILC_ILPBAK	0x0200		/* Set Internal Loopback Mode */
456895Sfeldman #define	ILC_CLPBAK	0x0300		/* Clear Loopback Mode */
466895Sfeldman #define	ILC_PRMSC	0x0400		/* Set Promiscuous Receive Mode */
476895Sfeldman #define	ILC_CLPRMSC	0x0500		/* Clear Promiscuous Receive Mode */
486895Sfeldman #define	ILC_RCVERR	0x0600		/* Set Receive-On-Error Bit */
496895Sfeldman #define	ILC_CRCVERR	0x0700		/* Clear Receive-On-Error Bit */
506895Sfeldman #define	ILC_OFFLINE	0x0800		/* Go Offline */
516895Sfeldman #define	ILC_ONLINE	0x0900		/* Go Online */
526895Sfeldman #define	ILC_DIAG	0x0a00		/* Run On-board Diagnostics */
539180Ssam #define	ILC_ISA		0x0d00		/* Set Insert Source Address Mode */
549180Ssam #define	ILC_CISA	0x0e00		/* Clear Insert Source Address Mode */
559180Ssam #define	ILC_DEFPA	0x0f00		/* Set Physical Address to Default */
569180Ssam #define	ILC_ALLMC	0x1000		/* Set Receive All Multicast Packets */
579180Ssam #define	ILC_CALLMC	0x1100		/* Clear Receive All Multicast */
586895Sfeldman #define	ILC_STAT	0x1800		/* Report and Reset Statistics */
596895Sfeldman #define	ILC_DELAYS	0x1900		/* Report Collision Delay Times */
606895Sfeldman #define	ILC_RCV		0x2000		/* Supply Receive Buffer */
616895Sfeldman #define	ILC_LDXMIT	0x2800		/* Load Transmit Data */
626895Sfeldman #define	ILC_XMIT	0x2900		/* Load Transmit Data and Send */
636895Sfeldman #define	ILC_LDGRPS	0x2a00		/* Load Group Addresses */
646895Sfeldman #define	ILC_RMGRPS	0x2b00		/* Delete Group Addresses */
659180Ssam #define	ILC_LDPA	0x2c00		/* Load Physical Address */
666895Sfeldman #define	ILC_FLUSH	0x3000		/* Flush Receive BAR/BCR Queue */
676895Sfeldman #define	ILC_RESET	0x3f00		/* Reset */
686895Sfeldman 
696895Sfeldman /*
707265Ssam  * Error codes found in the status bits of the csr.
716895Sfeldman  */
727265Ssam #define	ILERR_SUCCESS		0	/* command successful */
737265Ssam #define	ILERR_RETRIES		1	/* " " with retries */
747265Ssam #define	ILERR_BADCMD		2	/* illegal command */
757265Ssam #define	ILERR_INVCMD		3	/* invalid command */
767265Ssam #define	ILERR_RECVERR		4	/* receiver error */
777265Ssam #define	ILERR_BUFSIZ		5	/* buffer size too big */
787265Ssam #define	ILERR_FRAMESIZ		6	/* frame size too small */
797265Ssam #define	ILERR_COLLISIONS	8	/* excessive collisions */
807265Ssam #define	ILERR_BUFALIGNMENT	10	/* buffer not word aligned */
817265Ssam #define	ILERR_NXM		15	/* non-existent memory */
827265Ssam 
837265Ssam #define	NILERRS			16
847265Ssam #ifdef ILERRS
857265Ssam char *ilerrs[NILERRS] = {
867265Ssam 	"success",			/*  0 */
877265Ssam 	"success with retries", 	/*  1 */
887265Ssam 	"illegal command",		/*  2 */
897265Ssam 	"inappropriate command",	/*  3 */
907265Ssam 	"failure",			/*  4 */
917265Ssam 	"buffer size exceeded",		/*  5 */
927265Ssam 	"frame too small",		/*  6 */
937265Ssam 	0,				/*  7 */
947265Ssam 	"excessive collisions",		/*  8 */
957265Ssam 	0,				/*  9 */
967265Ssam 	"buffer alignment error",	/* 10 */
977265Ssam 	0,				/* 11 */
987265Ssam 	0,				/* 12 */
997265Ssam 	0,				/* 13 */
1007265Ssam 	0,				/* 14 */
1017265Ssam 	"non-existent memory"		/* 15 */
1026895Sfeldman };
1037265Ssam #endif
1046895Sfeldman 
1057265Ssam /*
1067265Ssam  * Diagnostics codes.
1077265Ssam  */
1087265Ssam #define	ILDIAG_SUCCESS		0	/* no problems */
1097265Ssam #define	ILDIAG_CHKSUMERR	1	/* ROM/RAM checksum error */
1107265Ssam #define	ILDIAG_DMAERR		2	/* DMA not working */
1117265Ssam #define	ILDIAG_XMITERR		3	/* xmit circuitry failure */
1127265Ssam #define	ILDIAG_RECVERR		4	/* rcvr circuitry failure */
1137265Ssam #define	ILDIAG_LOOPBACK		5	/* loopback test failed */
1147265Ssam 
1157265Ssam #define	NILDIAGS		6
1167265Ssam #ifdef ILDIAGS
1177265Ssam char *ildiag[NILDIAGS] = {
1187265Ssam 	"success",			/* 0 */
1197265Ssam 	"checksum error",		/* 1 */
1207265Ssam 	"NM10 dma error",		/* 2 */
1217265Ssam 	"transmitter error",		/* 3 */
1227265Ssam 	"receiver error",		/* 4 */
1237265Ssam 	"loopback failure",		/* 5 */
1246895Sfeldman };
1257265Ssam #endif
1267265Ssam 
1277265Ssam /*
1287265Ssam  * Frame status bits, returned in frame status byte
1297265Ssam  * at the top of each received packet.
1307265Ssam  */
1317265Ssam #define	ILFSTAT_C	0x1		/* CRC error */
1327265Ssam #define	ILFSTAT_A	0x2		/* alignment error */
1337265Ssam #define	ILFSTAT_L	0x4		/* 1+ frames lost just before */
134