xref: /csrg-svn/sys/vax/if/if_ilreg.h (revision 44561)
123299Smckusick /*
229285Smckusick  * Copyright (c) 1982, 1986 Regents of the University of California.
335323Sbostic  * All rights reserved.
423299Smckusick  *
5*44561Sbostic  * %sccs.include.redist.c%
635323Sbostic  *
7*44561Sbostic  *	@(#)if_ilreg.h	7.3 (Berkeley) 06/28/90
823299Smckusick  */
96895Sfeldman 
106895Sfeldman /*
116895Sfeldman  * Interlan Ethernet Communications Controller interface
126895Sfeldman  */
136895Sfeldman struct ildevice {
146895Sfeldman 	short	il_csr;		/* Command and Status Register */
156895Sfeldman 	short	il_bar;		/* Buffer Address Register */
166895Sfeldman 	short	il_bcr;		/* Byte Count Register */
176895Sfeldman };
186895Sfeldman 
196895Sfeldman /*
206895Sfeldman  * Command and status bits
216895Sfeldman  */
227265Ssam #define	IL_EUA		0xc000		/* Extended Unibus Address */
236895Sfeldman #define	IL_CMD		0x3f00		/* Command Function Code */
246895Sfeldman #define	IL_CDONE	0x0080		/* Command Done */
256895Sfeldman #define	IL_CIE		0x0040		/* Command Interrupt Enable */
266895Sfeldman #define	IL_RDONE	0x0020		/* Receive DMA Done */
276895Sfeldman #define	IL_RIE		0x0010		/* Receive Interrupt Enable */
286895Sfeldman #define	IL_STATUS	0x000f		/* Command Status Code */
296895Sfeldman 
307265Ssam #define	IL_BITS		"\20\10CDONE\7CIE\6RDONE\5RIE"
316895Sfeldman 
327265Ssam /* command definitions */
336895Sfeldman #define	ILC_MLPBAK	0x0100		/* Set Module Interface Loopback Mode */
346895Sfeldman #define	ILC_ILPBAK	0x0200		/* Set Internal Loopback Mode */
356895Sfeldman #define	ILC_CLPBAK	0x0300		/* Clear Loopback Mode */
366895Sfeldman #define	ILC_PRMSC	0x0400		/* Set Promiscuous Receive Mode */
376895Sfeldman #define	ILC_CLPRMSC	0x0500		/* Clear Promiscuous Receive Mode */
386895Sfeldman #define	ILC_RCVERR	0x0600		/* Set Receive-On-Error Bit */
396895Sfeldman #define	ILC_CRCVERR	0x0700		/* Clear Receive-On-Error Bit */
406895Sfeldman #define	ILC_OFFLINE	0x0800		/* Go Offline */
416895Sfeldman #define	ILC_ONLINE	0x0900		/* Go Online */
426895Sfeldman #define	ILC_DIAG	0x0a00		/* Run On-board Diagnostics */
439180Ssam #define	ILC_ISA		0x0d00		/* Set Insert Source Address Mode */
449180Ssam #define	ILC_CISA	0x0e00		/* Clear Insert Source Address Mode */
459180Ssam #define	ILC_DEFPA	0x0f00		/* Set Physical Address to Default */
469180Ssam #define	ILC_ALLMC	0x1000		/* Set Receive All Multicast Packets */
479180Ssam #define	ILC_CALLMC	0x1100		/* Clear Receive All Multicast */
486895Sfeldman #define	ILC_STAT	0x1800		/* Report and Reset Statistics */
496895Sfeldman #define	ILC_DELAYS	0x1900		/* Report Collision Delay Times */
506895Sfeldman #define	ILC_RCV		0x2000		/* Supply Receive Buffer */
516895Sfeldman #define	ILC_LDXMIT	0x2800		/* Load Transmit Data */
526895Sfeldman #define	ILC_XMIT	0x2900		/* Load Transmit Data and Send */
536895Sfeldman #define	ILC_LDGRPS	0x2a00		/* Load Group Addresses */
546895Sfeldman #define	ILC_RMGRPS	0x2b00		/* Delete Group Addresses */
559180Ssam #define	ILC_LDPA	0x2c00		/* Load Physical Address */
566895Sfeldman #define	ILC_FLUSH	0x3000		/* Flush Receive BAR/BCR Queue */
576895Sfeldman #define	ILC_RESET	0x3f00		/* Reset */
586895Sfeldman 
596895Sfeldman /*
607265Ssam  * Error codes found in the status bits of the csr.
616895Sfeldman  */
627265Ssam #define	ILERR_SUCCESS		0	/* command successful */
637265Ssam #define	ILERR_RETRIES		1	/* " " with retries */
647265Ssam #define	ILERR_BADCMD		2	/* illegal command */
657265Ssam #define	ILERR_INVCMD		3	/* invalid command */
667265Ssam #define	ILERR_RECVERR		4	/* receiver error */
677265Ssam #define	ILERR_BUFSIZ		5	/* buffer size too big */
687265Ssam #define	ILERR_FRAMESIZ		6	/* frame size too small */
697265Ssam #define	ILERR_COLLISIONS	8	/* excessive collisions */
707265Ssam #define	ILERR_BUFALIGNMENT	10	/* buffer not word aligned */
717265Ssam #define	ILERR_NXM		15	/* non-existent memory */
727265Ssam 
737265Ssam #define	NILERRS			16
747265Ssam #ifdef ILERRS
757265Ssam char *ilerrs[NILERRS] = {
767265Ssam 	"success",			/*  0 */
777265Ssam 	"success with retries", 	/*  1 */
787265Ssam 	"illegal command",		/*  2 */
797265Ssam 	"inappropriate command",	/*  3 */
807265Ssam 	"failure",			/*  4 */
817265Ssam 	"buffer size exceeded",		/*  5 */
827265Ssam 	"frame too small",		/*  6 */
837265Ssam 	0,				/*  7 */
847265Ssam 	"excessive collisions",		/*  8 */
857265Ssam 	0,				/*  9 */
867265Ssam 	"buffer alignment error",	/* 10 */
877265Ssam 	0,				/* 11 */
887265Ssam 	0,				/* 12 */
897265Ssam 	0,				/* 13 */
907265Ssam 	0,				/* 14 */
917265Ssam 	"non-existent memory"		/* 15 */
926895Sfeldman };
937265Ssam #endif
946895Sfeldman 
957265Ssam /*
967265Ssam  * Diagnostics codes.
977265Ssam  */
987265Ssam #define	ILDIAG_SUCCESS		0	/* no problems */
997265Ssam #define	ILDIAG_CHKSUMERR	1	/* ROM/RAM checksum error */
1007265Ssam #define	ILDIAG_DMAERR		2	/* DMA not working */
1017265Ssam #define	ILDIAG_XMITERR		3	/* xmit circuitry failure */
1027265Ssam #define	ILDIAG_RECVERR		4	/* rcvr circuitry failure */
1037265Ssam #define	ILDIAG_LOOPBACK		5	/* loopback test failed */
1047265Ssam 
1057265Ssam #define	NILDIAGS		6
1067265Ssam #ifdef ILDIAGS
1077265Ssam char *ildiag[NILDIAGS] = {
1087265Ssam 	"success",			/* 0 */
1097265Ssam 	"checksum error",		/* 1 */
1107265Ssam 	"NM10 dma error",		/* 2 */
1117265Ssam 	"transmitter error",		/* 3 */
1127265Ssam 	"receiver error",		/* 4 */
1137265Ssam 	"loopback failure",		/* 5 */
1146895Sfeldman };
1157265Ssam #endif
1167265Ssam 
1177265Ssam /*
1187265Ssam  * Frame status bits, returned in frame status byte
1197265Ssam  * at the top of each received packet.
1207265Ssam  */
1217265Ssam #define	ILFSTAT_C	0x1		/* CRC error */
1227265Ssam #define	ILFSTAT_A	0x2		/* alignment error */
1237265Ssam #define	ILFSTAT_L	0x4		/* 1+ frames lost just before */
124