xref: /csrg-svn/sys/pmax/dev/if_lereg.h (revision 52696)
152130Smckusick /*
252130Smckusick  * Copyright (c) 1992 Regents of the University of California.
352130Smckusick  * All rights reserved.
452130Smckusick  *
552130Smckusick  * This code is derived from software contributed to Berkeley by
652130Smckusick  * Ralph Campbell.
752130Smckusick  *
852130Smckusick  * %sccs.include.redist.c%
952130Smckusick  *
10*52696Sralph  *	@(#)if_lereg.h	7.2 (Berkeley) 02/29/92
1152130Smckusick  */
1252130Smckusick 
1352130Smckusick #define	LEMTU		1518
1452130Smckusick #define	LEMINSIZE	60	/* should be 64 if mode DTCR is set */
1552130Smckusick #define	LERBUF		32
1652130Smckusick #define	LERBUFLOG2	5
1752130Smckusick #define	LE_RLEN		(LERBUFLOG2 << 13)
1852130Smckusick #define	LETBUF		8
1952130Smckusick #define	LETBUFLOG2	3
2052130Smckusick #define	LE_TLEN		(LETBUFLOG2 << 13)
2152130Smckusick 
2252130Smckusick /*
2352130Smckusick  * LANCE registers.
2452130Smckusick  */
2552130Smckusick struct lereg1 {
2652130Smckusick 	u_short	ler1_rdp;	/* data port */
2752130Smckusick 	short	pad0;
2852130Smckusick 	u_short	ler1_rap;	/* register select port */
2952130Smckusick 	short	pad1;
3052130Smckusick };
3152130Smckusick 
32*52696Sralph #ifdef DS3100
33*52696Sralph #define LEPAD(x)	short x;
34*52696Sralph #define LE_RAM_SIZE	0x10000
35*52696Sralph 
36*52696Sralph typedef u_short	le_buf_t;
37*52696Sralph #endif
38*52696Sralph #ifdef DS5000
39*52696Sralph #define LEPAD(x)
40*52696Sralph #define LE_RAM_SIZE	0x20000
41*52696Sralph 
42*52696Sralph typedef u_char	le_buf_t;
43*52696Sralph #endif
44*52696Sralph 
4552130Smckusick /*
46*52696Sralph  * This structure is overlayed on the network dual-port RAM.
4752130Smckusick  * Currently 32 * 1518 receive plus 8 * 1518 transmit buffers plus
4852130Smckusick  * buffer descriptor rings.
4952130Smckusick  */
5052130Smckusick struct lereg2 {
5152130Smckusick 	/* init block */		/* CHIP address */
5252130Smckusick 	u_short	ler2_mode;		/* +0x0000 */
53*52696Sralph 	LEPAD(pad0)
5452130Smckusick 	u_short	ler2_padr0;		/* +0x0002 */
55*52696Sralph 	LEPAD(pad1)
5652130Smckusick 	u_short	ler2_padr1;		/* +0x0004 */
57*52696Sralph 	LEPAD(pad2)
5852130Smckusick 	u_short	ler2_padr2;		/* +0x0006 */
59*52696Sralph 	LEPAD(pad3)
6052130Smckusick 	u_short	ler2_ladrf0;		/* +0x0008 */
61*52696Sralph 	LEPAD(pad4)
6252130Smckusick 	u_short	ler2_ladrf1;		/* +0x000A */
63*52696Sralph 	LEPAD(pad5)
6452130Smckusick 	u_short	ler2_ladrf2;		/* +0x000C */
65*52696Sralph 	LEPAD(pad6)
6652130Smckusick 	u_short	ler2_ladrf3;		/* +0x000E */
67*52696Sralph 	LEPAD(pad7)
6852130Smckusick 	u_short	ler2_rdra;		/* +0x0010 */
69*52696Sralph 	LEPAD(pad8)
7052130Smckusick 	u_short	ler2_rlen;		/* +0x0012 */
71*52696Sralph 	LEPAD(pad9)
7252130Smckusick 	u_short	ler2_tdra;		/* +0x0014 */
73*52696Sralph 	LEPAD(pad10)
7452130Smckusick 	u_short	ler2_tlen;		/* +0x0016 */
75*52696Sralph 	LEPAD(pad11)
7652130Smckusick 	/* receive message descriptors */
7752130Smckusick 	struct	lermd {			/* +0x0018 */
7852130Smckusick 		u_short	rmd0;
79*52696Sralph 		LEPAD(pad0)
8052130Smckusick 		u_short	rmd1;
81*52696Sralph 		LEPAD(pad1)
8252130Smckusick 		short	rmd2;
83*52696Sralph 		LEPAD(pad2)
8452130Smckusick 		u_short	rmd3;
85*52696Sralph 		LEPAD(pad3)
8652130Smckusick 	} ler2_rmd[LERBUF];
8752130Smckusick 	/* transmit message descriptors */
8852130Smckusick 	struct	letmd {			/* +0x0058 */
8952130Smckusick 		u_short	tmd0;
90*52696Sralph 		LEPAD(pad0)
9152130Smckusick 		u_short	tmd1;
92*52696Sralph 		LEPAD(pad1)
9352130Smckusick 		short	tmd2;
94*52696Sralph 		LEPAD(pad2)
9552130Smckusick 		u_short	tmd3;
96*52696Sralph 		LEPAD(pad3)
9752130Smckusick 	} ler2_tmd[LETBUF];
98*52696Sralph 	le_buf_t	ler2_rbuf[LERBUF][LEMTU]; /* +0x0060 */
99*52696Sralph 	le_buf_t	ler2_tbuf[LETBUF][LEMTU]; /* +0x2FD0 */
10052130Smckusick };
10152130Smckusick 
10252130Smckusick /*
10352130Smckusick  * Control and status bits -- lereg0
10452130Smckusick  */
10552130Smckusick #define	LE_IE		0x80		/* interrupt enable */
10652130Smckusick #define	LE_IR		0x40		/* interrupt requested */
10752130Smckusick #define	LE_LOCK		0x08		/* lock status register */
10852130Smckusick #define	LE_ACK		0x04		/* ack of lock */
10952130Smckusick #define	LE_JAB		0x02		/* loss of tx clock (???) */
11052130Smckusick #define LE_IPL(x)	((((x) >> 4) & 0x3) + 3)
11152130Smckusick 
11252130Smckusick /*
11352130Smckusick  * Control and status bits -- lereg1
11452130Smckusick  */
11552130Smckusick #define	LE_CSR0		0
11652130Smckusick #define	LE_CSR1		1
11752130Smckusick #define	LE_CSR2		2
11852130Smckusick #define	LE_CSR3		3
11952130Smckusick 
12052130Smckusick #define	LE_SERR		0x8000
12152130Smckusick #define	LE_BABL		0x4000
12252130Smckusick #define	LE_CERR		0x2000
12352130Smckusick #define	LE_MISS		0x1000
12452130Smckusick #define	LE_MERR		0x0800
12552130Smckusick #define	LE_RINT		0x0400
12652130Smckusick #define	LE_TINT		0x0200
12752130Smckusick #define	LE_IDON		0x0100
12852130Smckusick #define	LE_INTR		0x0080
12952130Smckusick #define	LE_INEA		0x0040
13052130Smckusick #define	LE_RXON		0x0020
13152130Smckusick #define	LE_TXON		0x0010
13252130Smckusick #define	LE_TDMD		0x0008
13352130Smckusick #define	LE_STOP		0x0004
13452130Smckusick #define	LE_STRT		0x0002
13552130Smckusick #define	LE_INIT		0x0001
13652130Smckusick 
13752130Smckusick #define	LE_BSWP		0x4
13852130Smckusick #define	LE_MODE		0x0
13952130Smckusick 
14052130Smckusick /*
14152130Smckusick  * Control and status bits -- lereg2
14252130Smckusick  */
14352130Smckusick #define	LE_OWN		0x8000
14452130Smckusick #define	LE_ERR		0x4000
14552130Smckusick #define	LE_STP		0x0200
14652130Smckusick #define	LE_ENP		0x0100
14752130Smckusick 
14852130Smckusick #define	LE_FRAM		0x2000
14952130Smckusick #define	LE_OFLO		0x1000
15052130Smckusick #define	LE_CRC		0x0800
15152130Smckusick #define	LE_RBUFF	0x0400
15252130Smckusick 
15352130Smckusick #define	LE_MORE		0x1000
15452130Smckusick #define	LE_ONE		0x0800
15552130Smckusick #define	LE_DEF		0x0400
15652130Smckusick 
15752130Smckusick #define	LE_TBUFF	0x8000
15852130Smckusick #define	LE_UFLO		0x4000
15952130Smckusick #define	LE_LCOL		0x1000
16052130Smckusick #define	LE_LCAR		0x0800
16152130Smckusick #define	LE_RTRY		0x0400
162