155140Storek /*- 263322Sbostic * Copyright (c) 1982, 1992, 1993 363322Sbostic * The Regents of the University of California. All rights reserved. 455140Storek * 555140Storek * %sccs.include.redist.c% 655140Storek * 7*64778Storek * @(#)if_lereg.h 8.2 (Berkeley) 10/30/93 855140Storek * 9*64778Storek * from: $Header: if_lereg.h,v 1.7 93/10/31 04:41:00 leres Locked $ 1055140Storek */ 1155140Storek 1255140Storek #define LEMTU 1518 1355140Storek #define LEMINSIZE 60 /* should be 64 if mode DTCR is set */ 1455140Storek #define LERBUF 8 1555140Storek #define LERBUFLOG2 3 1655140Storek #define LE_RLEN (LERBUFLOG2 << 13) 1755140Storek #define LETBUF 1 1855140Storek #define LETBUFLOG2 0 1955140Storek #define LE_TLEN (LETBUFLOG2 << 13) 2055140Storek 2155140Storek /* Local Area Network Controller for Ethernet (LANCE) registers */ 2255140Storek struct lereg1 { 2355140Storek u_short ler1_rdp; /* register data port */ 2455140Storek u_short ler1_rap; /* register address port */ 2555140Storek }; 2655140Storek 2755140Storek /* register addresses */ 2855140Storek #define LE_CSR0 0 /* Control and status register */ 2955140Storek #define LE_CSR1 1 /* low address of init block */ 3055140Storek #define LE_CSR2 2 /* high address of init block */ 3155140Storek #define LE_CSR3 3 /* Bus master and control */ 3255140Storek 3355140Storek /* Control and status register 0 (csr0) */ 3455140Storek #define LE_C0_ERR 0x8000 /* error summary */ 3555140Storek #define LE_C0_BABL 0x4000 /* transmitter timeout error */ 3655140Storek #define LE_C0_CERR 0x2000 /* collision */ 3755140Storek #define LE_C0_MISS 0x1000 /* missed a packet */ 3855140Storek #define LE_C0_MERR 0x0800 /* memory error */ 3955140Storek #define LE_C0_RINT 0x0400 /* receiver interrupt */ 4055140Storek #define LE_C0_TINT 0x0200 /* transmitter interrupt */ 4155140Storek #define LE_C0_IDON 0x0100 /* initalization done */ 4255140Storek #define LE_C0_INTR 0x0080 /* interrupt condition */ 4355140Storek #define LE_C0_INEA 0x0040 /* interrupt enable */ 4455140Storek #define LE_C0_RXON 0x0020 /* receiver on */ 4555140Storek #define LE_C0_TXON 0x0010 /* transmitter on */ 4655140Storek #define LE_C0_TDMD 0x0008 /* transmit demand */ 4755140Storek #define LE_C0_STOP 0x0004 /* disable all external activity */ 4855140Storek #define LE_C0_STRT 0x0002 /* enable external activity */ 4955140Storek #define LE_C0_INIT 0x0001 /* begin initalization */ 5055140Storek 5155140Storek #define LE_C0_BITS \ 5255140Storek "\20\20ERR\17BABL\16CERR\15MISS\14MERR\13RINT\ 5355140Storek \12TINT\11IDON\10INTR\07INEA\06RXON\05TXON\04TDMD\03STOP\02STRT\01INIT" 5455140Storek 5555140Storek /* Control and status register 3 (csr3) */ 5655140Storek #define LE_C3_BSWP 0x4 /* byte swap */ 5755140Storek #define LE_C3_ACON 0x2 /* ALE control, eh? */ 5855140Storek #define LE_C3_BCON 0x1 /* byte control */ 5955140Storek /* 6055140Storek * Current size is 13,758 bytes with 8 x 1518 receive buffers and 6155140Storek * 1 x 1518 transmit buffer. 6255140Storek */ 6355140Storek struct lereg2 { 6455140Storek /* initialization block */ 65*64778Storek u_short ler2_mode; /* mode */ 66*64778Storek u_char ler2_padr[6]; /* physical address */ 67*64778Storek u_short ler2_ladrf[4]; /* logical address filter */ 68*64778Storek u_short ler2_rdra; /* receive descriptor addr */ 69*64778Storek u_short ler2_rlen; /* rda high and ring size */ 70*64778Storek u_short ler2_tdra; /* transmit descriptor addr */ 71*64778Storek u_short ler2_tlen; /* tda high and ring size */ 7255140Storek /* receive message descriptors. bits/hadr are byte order dependent. */ 73*64778Storek struct lermd { 7455140Storek u_short rmd0; /* low address of packet */ 7555140Storek u_char rmd1_bits; /* descriptor bits */ 7655140Storek u_char rmd1_hadr; /* high address of packet */ 7755140Storek short rmd2; /* buffer byte count */ 7855140Storek u_short rmd3; /* message byte count */ 7955140Storek } ler2_rmd[LERBUF]; 8055140Storek /* transmit message descriptors */ 81*64778Storek struct letmd { 8255140Storek u_short tmd0; /* low address of packet */ 8355140Storek u_char tmd1_bits; /* descriptor bits */ 8455140Storek u_char tmd1_hadr; /* high address of packet */ 8555140Storek short tmd2; /* buffer byte count */ 8655140Storek u_short tmd3; /* transmit error bits */ 8755140Storek } ler2_tmd[LETBUF]; 88*64778Storek char ler2_rbuf[LERBUF][LEMTU]; 89*64778Storek char ler2_tbuf[LETBUF][LEMTU]; 9055140Storek }; 9155140Storek 9255140Storek /* Initialzation block (mode) */ 9355140Storek #define LE_MODE_PROM 0x8000 /* promiscuous mode */ 9455140Storek /* 0x7f80 reserved, must be zero */ 9555140Storek #define LE_MODE_INTL 0x0040 /* internal loopback */ 9655140Storek #define LE_MODE_DRTY 0x0020 /* disable retry */ 9755140Storek #define LE_MODE_COLL 0x0010 /* force a collision */ 9855140Storek #define LE_MODE_DTCR 0x0008 /* disable transmit CRC */ 9955140Storek #define LE_MODE_LOOP 0x0004 /* loopback mode */ 10055140Storek #define LE_MODE_DTX 0x0002 /* disable transmitter */ 10155140Storek #define LE_MODE_DRX 0x0001 /* disable receiver */ 10255140Storek #define LE_MODE_NORMAL 0 /* none of the above */ 10355140Storek 10455140Storek 10555140Storek /* Receive message descriptor 1 (rmd1_bits) */ 10655140Storek #define LE_R1_OWN 0x80 /* LANCE owns the packet */ 10755140Storek #define LE_R1_ERR 0x40 /* error summary */ 10855140Storek #define LE_R1_FRAM 0x20 /* framing error */ 10955140Storek #define LE_R1_OFLO 0x10 /* overflow error */ 11055140Storek #define LE_R1_CRC 0x08 /* CRC error */ 11155140Storek #define LE_R1_BUFF 0x04 /* buffer error */ 11255140Storek #define LE_R1_STP 0x02 /* start of packet */ 11355140Storek #define LE_R1_ENP 0x01 /* end of packet */ 11455140Storek 11555140Storek #define LE_R1_BITS \ 11655140Storek "\20\10OWN\7ERR\6FRAM\5OFLO\4CRC\3BUFF\2STP\1ENP" 11755140Storek 11855140Storek /* Transmit message descriptor 1 (tmd1_bits) */ 11955140Storek #define LE_T1_OWN 0x80 /* LANCE owns the packet */ 12055140Storek #define LE_T1_ERR 0x40 /* error summary */ 12155140Storek #define LE_T1_MORE 0x10 /* multiple collisions */ 12255140Storek #define LE_T1_ONE 0x08 /* single collision */ 12355140Storek #define LE_T1_DEF 0x04 /* defferred transmit */ 12455140Storek #define LE_T1_STP 0x02 /* start of packet */ 12555140Storek #define LE_T1_ENP 0x01 /* end of packet */ 12655140Storek 12755140Storek #define LE_T1_BITS \ 12855140Storek "\20\10OWN\7ERR\6RES\5MORE\4ONE\3DEF\2STP\1ENP" 12955140Storek 13055140Storek /* Transmit message descriptor 3 (tmd3) */ 13155140Storek #define LE_T3_BUFF 0x8000 /* buffer error */ 13255140Storek #define LE_T3_UFLO 0x4000 /* underflow error */ 13355140Storek #define LE_T3_LCOL 0x1000 /* late collision */ 13455140Storek #define LE_T3_LCAR 0x0800 /* loss of carrier */ 13555140Storek #define LE_T3_RTRY 0x0400 /* retry error */ 13655140Storek #define LE_T3_TDR_MASK 0x03ff /* time domain reflectometry counter */ 13755140Storek 13855140Storek #define LE_T3_BITS \ 13955140Storek "\20\20BUFF\17UFLO\16RES\15LCOL\14LCAR\13RTRY" 140