1*55140Storek /*- 2*55140Storek * Copyright (c) 1982, 1992 Regents of the University of California. 3*55140Storek * All rights reserved. 4*55140Storek * 5*55140Storek * %sccs.include.redist.c% 6*55140Storek * 7*55140Storek * @(#)if_lereg.h 7.1 (Berkeley) 07/13/92 8*55140Storek * 9*55140Storek * from: $Header: if_lereg.h,v 1.5 92/07/10 06:45:26 torek Exp $ 10*55140Storek */ 11*55140Storek 12*55140Storek #define LEMTU 1518 13*55140Storek #define LEMINSIZE 60 /* should be 64 if mode DTCR is set */ 14*55140Storek #define LERBUF 8 15*55140Storek #define LERBUFLOG2 3 16*55140Storek #define LE_RLEN (LERBUFLOG2 << 13) 17*55140Storek #define LETBUF 1 18*55140Storek #define LETBUFLOG2 0 19*55140Storek #define LE_TLEN (LETBUFLOG2 << 13) 20*55140Storek 21*55140Storek /* Local Area Network Controller for Ethernet (LANCE) registers */ 22*55140Storek struct lereg1 { 23*55140Storek u_short ler1_rdp; /* register data port */ 24*55140Storek u_short ler1_rap; /* register address port */ 25*55140Storek }; 26*55140Storek 27*55140Storek /* register addresses */ 28*55140Storek #define LE_CSR0 0 /* Control and status register */ 29*55140Storek #define LE_CSR1 1 /* low address of init block */ 30*55140Storek #define LE_CSR2 2 /* high address of init block */ 31*55140Storek #define LE_CSR3 3 /* Bus master and control */ 32*55140Storek 33*55140Storek /* Control and status register 0 (csr0) */ 34*55140Storek #define LE_C0_ERR 0x8000 /* error summary */ 35*55140Storek #define LE_C0_BABL 0x4000 /* transmitter timeout error */ 36*55140Storek #define LE_C0_CERR 0x2000 /* collision */ 37*55140Storek #define LE_C0_MISS 0x1000 /* missed a packet */ 38*55140Storek #define LE_C0_MERR 0x0800 /* memory error */ 39*55140Storek #define LE_C0_RINT 0x0400 /* receiver interrupt */ 40*55140Storek #define LE_C0_TINT 0x0200 /* transmitter interrupt */ 41*55140Storek #define LE_C0_IDON 0x0100 /* initalization done */ 42*55140Storek #define LE_C0_INTR 0x0080 /* interrupt condition */ 43*55140Storek #define LE_C0_INEA 0x0040 /* interrupt enable */ 44*55140Storek #define LE_C0_RXON 0x0020 /* receiver on */ 45*55140Storek #define LE_C0_TXON 0x0010 /* transmitter on */ 46*55140Storek #define LE_C0_TDMD 0x0008 /* transmit demand */ 47*55140Storek #define LE_C0_STOP 0x0004 /* disable all external activity */ 48*55140Storek #define LE_C0_STRT 0x0002 /* enable external activity */ 49*55140Storek #define LE_C0_INIT 0x0001 /* begin initalization */ 50*55140Storek 51*55140Storek #define LE_C0_BITS \ 52*55140Storek "\20\20ERR\17BABL\16CERR\15MISS\14MERR\13RINT\ 53*55140Storek \12TINT\11IDON\10INTR\07INEA\06RXON\05TXON\04TDMD\03STOP\02STRT\01INIT" 54*55140Storek 55*55140Storek /* Control and status register 3 (csr3) */ 56*55140Storek #define LE_C3_BSWP 0x4 /* byte swap */ 57*55140Storek #define LE_C3_ACON 0x2 /* ALE control, eh? */ 58*55140Storek #define LE_C3_BCON 0x1 /* byte control */ 59*55140Storek /* 60*55140Storek * Current size is 13,758 bytes with 8 x 1518 receive buffers and 61*55140Storek * 1 x 1518 transmit buffer. 62*55140Storek */ 63*55140Storek struct lereg2 { 64*55140Storek /* initialization block */ 65*55140Storek u_short ler2_mode; /* +0x0000: mode */ 66*55140Storek u_char ler2_padr[6]; /* +0x0002: physical address */ 67*55140Storek u_long ler2_ladrf[2]; /* +0x0008: logical address filter */ 68*55140Storek u_short ler2_rdra; /* +0x0010: receive descriptor addr */ 69*55140Storek u_short ler2_rlen; /* +0x0012: rda high and ring size */ 70*55140Storek u_short ler2_tdra; /* +0x0014: transmit descriptor addr */ 71*55140Storek u_short ler2_tlen; /* +0x0016: tda high and ring size */ 72*55140Storek /* receive message descriptors. bits/hadr are byte order dependent. */ 73*55140Storek struct lermd { /* +0x0018 */ 74*55140Storek u_short rmd0; /* low address of packet */ 75*55140Storek u_char rmd1_bits; /* descriptor bits */ 76*55140Storek u_char rmd1_hadr; /* high address of packet */ 77*55140Storek short rmd2; /* buffer byte count */ 78*55140Storek u_short rmd3; /* message byte count */ 79*55140Storek } ler2_rmd[LERBUF]; 80*55140Storek /* transmit message descriptors */ 81*55140Storek struct letmd { /* +0x0058 */ 82*55140Storek u_short tmd0; /* low address of packet */ 83*55140Storek u_char tmd1_bits; /* descriptor bits */ 84*55140Storek u_char tmd1_hadr; /* high address of packet */ 85*55140Storek short tmd2; /* buffer byte count */ 86*55140Storek u_short tmd3; /* transmit error bits */ 87*55140Storek } ler2_tmd[LETBUF]; 88*55140Storek char ler2_rbuf[LERBUF][LEMTU]; /* +0x0060 */ 89*55140Storek char ler2_tbuf[LETBUF][LEMTU]; /* +0x2fd0 */ 90*55140Storek }; 91*55140Storek 92*55140Storek /* Initialzation block (mode) */ 93*55140Storek #define LE_MODE_PROM 0x8000 /* promiscuous mode */ 94*55140Storek /* 0x7f80 reserved, must be zero */ 95*55140Storek #define LE_MODE_INTL 0x0040 /* internal loopback */ 96*55140Storek #define LE_MODE_DRTY 0x0020 /* disable retry */ 97*55140Storek #define LE_MODE_COLL 0x0010 /* force a collision */ 98*55140Storek #define LE_MODE_DTCR 0x0008 /* disable transmit CRC */ 99*55140Storek #define LE_MODE_LOOP 0x0004 /* loopback mode */ 100*55140Storek #define LE_MODE_DTX 0x0002 /* disable transmitter */ 101*55140Storek #define LE_MODE_DRX 0x0001 /* disable receiver */ 102*55140Storek #define LE_MODE_NORMAL 0 /* none of the above */ 103*55140Storek 104*55140Storek 105*55140Storek /* Receive message descriptor 1 (rmd1_bits) */ 106*55140Storek #define LE_R1_OWN 0x80 /* LANCE owns the packet */ 107*55140Storek #define LE_R1_ERR 0x40 /* error summary */ 108*55140Storek #define LE_R1_FRAM 0x20 /* framing error */ 109*55140Storek #define LE_R1_OFLO 0x10 /* overflow error */ 110*55140Storek #define LE_R1_CRC 0x08 /* CRC error */ 111*55140Storek #define LE_R1_BUFF 0x04 /* buffer error */ 112*55140Storek #define LE_R1_STP 0x02 /* start of packet */ 113*55140Storek #define LE_R1_ENP 0x01 /* end of packet */ 114*55140Storek 115*55140Storek #define LE_R1_BITS \ 116*55140Storek "\20\10OWN\7ERR\6FRAM\5OFLO\4CRC\3BUFF\2STP\1ENP" 117*55140Storek 118*55140Storek /* Transmit message descriptor 1 (tmd1_bits) */ 119*55140Storek #define LE_T1_OWN 0x80 /* LANCE owns the packet */ 120*55140Storek #define LE_T1_ERR 0x40 /* error summary */ 121*55140Storek #define LE_T1_MORE 0x10 /* multiple collisions */ 122*55140Storek #define LE_T1_ONE 0x08 /* single collision */ 123*55140Storek #define LE_T1_DEF 0x04 /* defferred transmit */ 124*55140Storek #define LE_T1_STP 0x02 /* start of packet */ 125*55140Storek #define LE_T1_ENP 0x01 /* end of packet */ 126*55140Storek 127*55140Storek #define LE_T1_BITS \ 128*55140Storek "\20\10OWN\7ERR\6RES\5MORE\4ONE\3DEF\2STP\1ENP" 129*55140Storek 130*55140Storek /* Transmit message descriptor 3 (tmd3) */ 131*55140Storek #define LE_T3_BUFF 0x8000 /* buffer error */ 132*55140Storek #define LE_T3_UFLO 0x4000 /* underflow error */ 133*55140Storek #define LE_T3_LCOL 0x1000 /* late collision */ 134*55140Storek #define LE_T3_LCAR 0x0800 /* loss of carrier */ 135*55140Storek #define LE_T3_RTRY 0x0400 /* retry error */ 136*55140Storek #define LE_T3_TDR_MASK 0x03ff /* time domain reflectometry counter */ 137*55140Storek 138*55140Storek #define LE_T3_BITS \ 139*55140Storek "\20\20BUFF\17UFLO\16RES\15LCOL\14LCAR\13RTRY" 140